diff --git a/native/.clang-format b/native/.clang-format index 2ea2429307..9f238f2ae8 100644 --- a/native/.clang-format +++ b/native/.clang-format @@ -1,30 +1,18 @@ -BasedOnStyle: LLVM +--- -IndentWidth: 4 +BasedOnStyle: Google -BreakBeforeBraces: Attach +AccessModifierOffset: -4 +AlignConsecutiveMacros: true +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AllowShortCaseLabelsOnASingleLine: true +ColumnLimit: 0 +ConstructorInitializerIndentWidth: 0 +IncludeBlocks: Preserve +IndentPPDirectives: BeforeHash +IndentWidth: 4 +SpacesBeforeTrailingComments: 1 -AllowShortIfStatementsOnASingleLine: true - -AllowShortLoopsOnASingleLine: true - -IndentCaseLabels: true - -ObjCBlockIndentWidth: 4 - -ObjCSpaceAfterProperty: true - -ColumnLimit: 0 - -AlignTrailingComments: true - -AllowShortCaseLabelsOnASingleLine: true -AllowAllConstructorInitializersOnNextLine: false - -AccessModifierOffset: -4 - -ConstructorInitializerIndentWidth: 0 -ConstructorInitializerAllOnOneLineOrOnePerLine: true - -AlignConsecutiveMacros: true -IndentPPDirectives: BeforeHash +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: true diff --git a/native/.clang-tidy b/native/.clang-tidy index acec2c637e..4eb2096e84 100644 --- a/native/.clang-tidy +++ b/native/.clang-tidy @@ -1,83 +1,64 @@ -# Here is an explanation for why some of the checks are disabled: +--- +# Here are the reasons for disabled checks: # -# -modernize-use-trailing-return-type, -fuchsia-trailing-return: return a function call -# at the end of a function is normal usage. +# -misc-non-private-member-variables-in-classes +# -modernize-avoid-c-arrays +# Legacy reasons # -# -readability-implicit-bool-conversion, -readability-implicit-bool-cast: if (_usage & BufferUsageBit::VERTEX) -# is normal usage -# -# -cppcoreguidelines-pro-type-vararg: use it in macro define, such as Log functions. May use -# template instead in future. -# -# -cppcoreguidelines-pro-type-static-cast-downcast: sub class of gfx device should use static_cast() to -# cast to derived class. -# -# -readability-function-cognitive-complexity: it will limit function size. -# -# -cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-bounds-array-to-pointer-decay: -# JS pass data by pointer, so it is common to use pointer arithmetic. -# -Checks: > - -*, - readability-*, - performance-*, - modernize-*, - misc-*, - portability-*, - cppcoreguidelines-*, - google-explicit-constructor, - -modernize-use-trailing-return-type, - -fuchsia-trailing-return, - -readability-implicit-bool-conversion, - -readability-implicit-bool-cast, - -cppcoreguidelines-pro-type-vararg, - -cppcoreguidelines-pro-type-static-cast-downcast, - -readability-function-cognitive-complexity, - -cppcoreguidelines-pro-bounds-pointer-arithmetic, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay +# -bugprone-macro-parentheses: This conflicts with our usages +# -modernize-concat-nested-namespaces: More flexible not concated +# -modernize-use-nodiscard: No C++17 specific rules for now +# -modernize-use-trailing-return-type: It is acceptable to return a function call at the end of a function +# -readability-braces-around-statements: Simple single statement can be without braces +# -readability-function-cognitive-complexity: This will limit function size +# -readability-implicit-bool-conversion: We omit explicit bool conversion for brevity +# -readability-implicit-bool-cast: We omit explicit bool conversion for brevity +# -readability-magic-numbers: There will be lots of constants +# -bugprone-branch-clone: two branches may only print debug message, then will be treat as the same logic. +Checks: > + -*, + bugprone-*, + google-*, + misc-*, + modernize-*, + performance-*, + portability-*, + readability-*, + + -misc-non-private-member-variables-in-classes, + -modernize-avoid-c-arrays, + + -bugprone-macro-parentheses, + -modernize-concat-nested-namespaces, + -modernize-use-nodiscard, + -modernize-use-trailing-return-type, + -readability-braces-around-statements, + -readability-function-cognitive-complexity, + -readability-implicit-bool-conversion, + -readability-implicit-bool-cast, + -readability-magic-numbers, + -bugprone-branch-clone, CheckOptions: -################## readability identifier naming ################################ -# class - - key: readability-identifier-naming.ClassCase - value: CamelCase - - key: readability-identifier-naming.ClassMemberCase - value: camelBack - - key: readability-identifier-naming.ClassMemberPrefix - value: _ - - key: readability-identifier-naming.ClassMethodCase - value: camelBack - - key: readability-identifier-naming.ClassConstantCase - value: UPPER_CASE - - key: readability-identifier-naming.ClassConstantCasePrefix - value: _ -# enum - - key: readability-identifier-naming.EnumCase - value: CamelCase - - key: readability-identifier-naming.ScopedEnumConstantCase - value: UPPER_CASE - - key: readability-identifier-naming.EnumConstantCase - value: UPPER_CASE -# others - - key: readability-identifier-naming.FunctionCase - value: camelBack - - key: readability-identifier-naming.ConstantCase - value: UPPER_CASE - - key: readability-identifier-naming.GlobalConstantCase - value: UPPER_CASE - - key: readability-identifier-naming.LocalConstantCase - value: camelBack - - key: readability-identifier-naming.LocalVariableCase - value: camelBack - - key: readability-identifier-naming.MacroDefinitionCase - value: UPPER_CASE - - key: readability-identifier-naming.ParameterCase - value: camelBack - - key: readability-identifier-naming.StaticConstantCase - value: UPPER_CASE - - key: readability-identifier-naming.VariableCase - value: camelBack - - key: readability-identifier-naming.StructCase - value: CamelBack + - { key: readability-identifier-naming.NamespaceCase, value: lower_case } + - { key: readability-identifier-naming.StructCase, value: CamelCase } + - { key: readability-identifier-naming.ClassCase, value: CamelCase } + - { key: readability-identifier-naming.ClassMethodCase, value: camelBack } + - { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.ClassMemberCase, value: camelBack } + - { key: readability-identifier-naming.ProtectedMemberPrefix, value: _ } + - { key: readability-identifier-naming.PrivateMemberPrefix, value: _ } + - { key: readability-identifier-naming.EnumCase, value: CamelCase } + - { key: readability-identifier-naming.ScopedEnumConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } + + - { key: readability-identifier-naming.FunctionCase, value: camelBack } + - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.LocalConstantCase, value: camelBack } + - { key: readability-identifier-naming.LocalVariableCase, value: camelBack } + - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE } + - { key: readability-identifier-naming.ParameterCase, value: camelBack } + - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.VariableCase, value: camelBack } diff --git a/native/.github/workflows/clang-format.yml b/native/.github/workflows/clang-format.yml new file mode 100644 index 0000000000..926bf68f68 --- /dev/null +++ b/native/.github/workflows/clang-format.yml @@ -0,0 +1,25 @@ +# Name of the workflow +name: Check Clang Format + +#on: [push, pull_request] +on: + pull_request: + types: [closed] + +jobs: + clang-format: + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + # Checks-out our repository under $GITHUB_WORKSPACE, so our job can access it + - uses: actions/checkout@v2 + + # Applies clang-format to all C/C++ files w/ the specified style + - name: Check clang-format + uses: fish9167/clang-format-action@master + id: formatting + with: + style: 'file' + + - name: Get the output message + run: echo "${{ steps.formatting.outputs.message }}" diff --git a/native/.github/workflows/clangtidy-android.yml b/native/.github/workflows/clangtidy-android.yml new file mode 100644 index 0000000000..e79b877892 --- /dev/null +++ b/native/.github/workflows/clangtidy-android.yml @@ -0,0 +1,69 @@ +name: Clang Tidy - Android + +on: pull_request + +jobs: + # Set the job key. The key is displayed as the job name + # when a job name is not provided + super-lint: + # Name the Job + name: Lint code base - Android + # Set the type of machine to run on + runs-on: ubuntu-latest + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + - name: Get changed files + uses: PatriceJiang/paths-filter@master + id: listchanged + with: + list-files: shell + filters: | + source: + - added|modified: '**/*.cpp' + - added|modified: '**/*.h' + - added|modified: '**/*.hpp' + - added|modified: '**/*.m' + - added|modified: '**/*.mm' + - added|modified: '**/*.c' + - exclude: 'cocos/editor-support/dragonbones/**' + - exclude: 'cocos/base/etc1.*' + - exclude: 'cocos/base/etc2.*' + allChanges: + - added|modified|deleted: '**' + skipedDebug: + - added|modified|deleted: '**' + - exclude: 'cocos/editor-support/dragonbones/**' + - name: Install CMake & Clang Tidy + run: | + sudo apt install -y cmake llvm clang-tidy-11 + + - name: Generate Compile database + shell: bash + run: | + EXT_VERSION=`grep version external/config.json |awk -F'"' '{print $4}'` + rm external/config.json + git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos-creator/engine-native-external external + utils/generate_compile_commands_android.sh + + - name: Generate clang-fix.yaml + shell: bash + if: ${{ steps.listchanged.outputs.source == 'true' }} + run: | + CPP="${{ steps.listchanged.outputs.source_files }}" + FILTERED=`node .github/workflows/filter_by_cdb.js $CPP` + if [[ "$FILTERED-xxx" == "-xxx" ]]; then + echo "no source files match" + else + clang-tidy-11 --format-style=file --export-fixes=clang-fixes.yaml $FILTERED + fi + - name: clang-tidy-action + uses: PatriceJiang/clang-tidy-action@master + if: hashFiles('clang-fixes.yaml') != '' + with: + fixesFile: clang-fixes.yaml + noFailOnIssue: false + repo-token: ${{ secrets.GITHUB_TOKEN }} + error-limit: 200 diff --git a/native/.github/workflows/cmake.yml b/native/.github/workflows/cmake.yml new file mode 100644 index 0000000000..a8bf72f21f --- /dev/null +++ b/native/.github/workflows/cmake.yml @@ -0,0 +1,45 @@ +name: Cmake Unit Test + +on: [push, pull_request] + +jobs: + camke-unit: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + #runs-on: windows-latest + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Create build directory + run: mkdir -p ${{github.workspace}}/unit-test/build + + - name: Downlad external libraties + shell: bash + working-directory: ${{github.workspace}}/external + run: | + cd ${{github.workspace}}/external + external_version=`grep version config.json |awk -F'"' '{print $4}'` + external_repo_name=`grep name config.json |awk -F'"' '{print $4}'` + external_repo_parent=`grep owner config.json |awk -F'"' '{print $4}'` + rm ${{github.workspace}}/external/* + git clone --branch ${external_version} --depth 1 https://github.com/${external_repo_parent}/${external_repo_name} . + git log --oneline -1 + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/unit-test/build + run: pwd && cd ${{github.workspace}}/unit-test/build && cmake .. -G"Unix Makefiles" + + - name: Build + working-directory: ${{github.workspace}}/unit-test/build + shell: bash + run: pwd && cd ${{github.workspace}}/unit-test/build && make V=1 + + - name: Run Test + working-directory: ${{github.workspace}}/unit-test/build + shell: bash + run: pwd && cd ${{github.workspace}}/unit-test/build && ./src/CocosTest diff --git a/native/.github/workflows/filter_by_cdb.js b/native/.github/workflows/filter_by_cdb.js new file mode 100644 index 0000000000..2e8e358847 --- /dev/null +++ b/native/.github/workflows/filter_by_cdb.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node + +const path = require('path'); +const fs = require('fs'); + +const ARGS = process.argv.slice(2); + +let result = []; + +const cdbFile = path.join(__dirname, '../../build/compile_commands.json'); +if (fs.existsSync(cdbFile)) { + const db = JSON.parse(fs.readFileSync(cdbFile, { encoding: 'utf8' })); + for (let f of ARGS) { + const name = f.endsWith('.h') ? f.slice(0, -2) : f; // ignore .h extension name + if (db.some((info) => info.file.includes(name))) { + result.push(f); + } + } + console.log(result.join(' ')); +} else { + console.log(ARGS.join(' ')); +} diff --git a/native/.gitignore b/native/.gitignore index 0c86a8785e..e10d3055a6 100644 --- a/native/.gitignore +++ b/native/.gitignore @@ -77,9 +77,6 @@ xcschememanagement.plist xcuserdata/ DerivedData/ -# Ignore files built by AppCode -.idea/ - # Ignore files built by bada .Simulator-Debug/ .Target-Debug/ @@ -159,6 +156,10 @@ tests/cpp-tests/Resources/audio # generated by vscode .vscode/ +# generated by Clion +.idea/ +cmake-build* +compile_commands.json # generated by "gulp gen-simulator" /tools/simulator/runtime/win32 @@ -169,5 +170,5 @@ next*.zip build/* out - -CMakeSettings.json + +CMakeSettings.json diff --git a/native/.vscode/c_cpp_properties.json b/native/.vscode/c_cpp_properties.json new file mode 100644 index 0000000000..22ea0dd8ed --- /dev/null +++ b/native/.vscode/c_cpp_properties.json @@ -0,0 +1,23 @@ +{ + "configurations": [ + { + "name": "Clang-Android", + "includePath": [ + ".", + "cocos", + "cocos/renderer", + "cocos/platform", + "cocos/platform/ios", + "cocos/editor-support", + "cocos/bindings/jswrapper", + "external/sources", + "external/sources/khronos", + "external/win32/include", + "external/win32/include/glslang", + "external/win32/include/v8" + ], + "compileCommands": "${workspaceFolder}/compile_commands.json" + } + ], + "version": 4 +} diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index 5048eb0f10..3300cdc75d 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -50,7 +50,7 @@ endif() # set c++ standard set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -59,14 +59,45 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CWD ${CMAKE_CURRENT_LIST_DIR}) set(COCOS2D_SOURCE_LIST) +set(WERROR_FLAGS "-Werror") +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(WERROR_FLAGS "/WX") +endif() + +# Should be enable someday in the future +# set(CMAKE_CXX_FLAGS "${WERROR_FLAGS}") + + +function(enable_werror source_list) + foreach(src IN LISTS source_list) + if("${src}" MATCHES "\\.(cpp|mm|c|m)\$") + set_source_files_properties("${src}" PROPERTIES + COMPILE_FLAGS "${WERROR_FLAGS}" + ) + endif() + endforeach() +endfunction() + macro(cocos_source_files) set(list_var "${ARGN}") + set(TWAE ON) foreach(src IN LISTS list_var) - set(fp "${CWD}/${src}") - if(EXISTS ${fp}) - list(APPEND COCOS2D_SOURCE_LIST "${CWD}/${src}") + + if("NO_WERROR" STREQUAL "${src}") + set(TWAE OFF) else() - message(FATAL_ERROR "Cocos souce file not exists: ${src} in ${CWD}") + set(fp "${CWD}/${src}") + if(EXISTS ${fp}) + if("${src}" MATCHES "\\.(cpp|mm|c|m)\$" AND TWAE) + set_source_files_properties("${CWD}/${src}" PROPERTIES + COMPILE_FLAGS "${WERROR_FLAGS}" + ) + endif() + list(APPEND COCOS2D_SOURCE_LIST "${CWD}/${src}") + else() + message(FATAL_ERROR "Cocos souce file not exists: ${src} in ${CWD}") + endif() + set(TWAE ON) endif() endforeach() endmacro() @@ -92,7 +123,7 @@ endfunction() ################################# options ############################################ -# default fallback options +# default fallback options set_if_undefined(USE_SE_V8 ON) set_if_undefined(USE_V8_DEBUGGER ON) set_if_undefined(USE_SOCKET ON) @@ -105,6 +136,7 @@ set_if_undefined(USE_MIDDLEWARE ON) set_if_undefined(USE_DRAGONBONES ON) set_if_undefined(USE_SPINE ON) set_if_undefined(USE_WEBSOCKET_SERVER OFF) +set_if_undefined(USE_PHYSICS_PHYSX OFF) if(ANDROID OR WINDOWS) set_if_undefined(CC_USE_GLES3 ON) @@ -118,6 +150,13 @@ elseif(MACOSX OR IOS) set_if_undefined(CC_USE_GLES2 OFF) endif() +if(USE_PHYSICS_PHYSX) + if (ANDROID AND CMAKE_ANDROID_ARCH_ABI MATCHES x86) + set(USE_PHYSICS_PHYSX OFF) + message(AUTHOR_WARNING "Native PhysX does not support Google Android X86") + endif() +endif() + if(USE_SE_JSC) set(USE_SE_V8 OFF) set(USE_V8_DEBUGGER OFF) @@ -163,6 +202,7 @@ inspect_values( USE_WEBSOCKET_SERVER USE_SE_V8 USE_V8_DEBUGGER + USE_PHYSICS_PHYSX ) ################################# external source code ################################ @@ -177,105 +217,105 @@ include(${CMAKE_CURRENT_LIST_DIR}/external/CMakeLists.txt) ##### audio if(USE_AUDIO) cocos_source_files( - cocos/audio/AudioEngine.cpp - cocos/audio/include/AudioEngine.h - cocos/audio/include/Export.h + cocos/audio/AudioEngine.cpp + cocos/audio/include/AudioEngine.h + cocos/audio/include/Export.h ) if(WINDOWS) cocos_source_files( - cocos/audio/win32/AudioCache.cpp - cocos/audio/win32/AudioCache.h - cocos/audio/win32/AudioDecoder.cpp - cocos/audio/win32/AudioDecoder.h - cocos/audio/win32/AudioDecoderManager.cpp - cocos/audio/win32/AudioDecoderManager.h - cocos/audio/win32/AudioDecoderMp3.cpp - cocos/audio/win32/AudioDecoderMp3.h - cocos/audio/win32/AudioDecoderOgg.cpp - cocos/audio/win32/AudioDecoderOgg.h - cocos/audio/win32/AudioEngine-win32.cpp - cocos/audio/win32/AudioEngine-win32.h - cocos/audio/win32/AudioMacros.h - cocos/audio/win32/AudioPlayer.cpp - cocos/audio/win32/AudioPlayer.h + cocos/audio/win32/AudioCache.cpp + cocos/audio/win32/AudioCache.h + cocos/audio/win32/AudioDecoder.cpp + cocos/audio/win32/AudioDecoder.h + cocos/audio/win32/AudioDecoderManager.cpp + cocos/audio/win32/AudioDecoderManager.h + cocos/audio/win32/AudioDecoderMp3.cpp + cocos/audio/win32/AudioDecoderMp3.h + cocos/audio/win32/AudioDecoderOgg.cpp + cocos/audio/win32/AudioDecoderOgg.h + cocos/audio/win32/AudioEngine-win32.cpp + cocos/audio/win32/AudioEngine-win32.h + cocos/audio/win32/AudioMacros.h + cocos/audio/win32/AudioPlayer.cpp + cocos/audio/win32/AudioPlayer.h ) elseif(ANDROID) cocos_source_files( - cocos/audio/android/AssetFd.cpp - cocos/audio/android/AssetFd.h - cocos/audio/android/audio.h - cocos/audio/android/AudioBufferProvider.h - cocos/audio/android/AudioDecoder.cpp - cocos/audio/android/AudioDecoder.h - cocos/audio/android/AudioDecoderMp3.cpp - cocos/audio/android/AudioDecoderMp3.h - cocos/audio/android/AudioDecoderOgg.cpp - cocos/audio/android/AudioDecoderOgg.h - cocos/audio/android/AudioDecoderProvider.cpp - cocos/audio/android/AudioDecoderProvider.h - cocos/audio/android/AudioDecoderSLES.cpp - cocos/audio/android/AudioDecoderSLES.h - cocos/audio/android/AudioDecoderWav.cpp - cocos/audio/android/AudioDecoderWav.h - cocos/audio/android/AudioEngine-inl.cpp - cocos/audio/android/AudioEngine-inl.h - cocos/audio/android/AudioMixer.cpp - cocos/audio/android/AudioMixer.h - cocos/audio/android/AudioMixerController.cpp - cocos/audio/android/AudioMixerController.h - cocos/audio/android/AudioMixerOps.h - cocos/audio/android/AudioPlayerProvider.cpp - cocos/audio/android/AudioPlayerProvider.h - cocos/audio/android/AudioResampler.cpp - cocos/audio/android/AudioResampler.h - cocos/audio/android/AudioResamplerCubic.cpp - cocos/audio/android/AudioResamplerCubic.h - cocos/audio/android/AudioResamplerPublic.h - cocos/audio/android/audio_utils/format.c - cocos/audio/android/audio_utils/include/audio_utils/format.h - cocos/audio/android/audio_utils/include/audio_utils/minifloat.h - cocos/audio/android/audio_utils/include/audio_utils/primitives.h - cocos/audio/android/audio_utils/minifloat.cpp - cocos/audio/android/audio_utils/primitives.c - cocos/audio/android/audio_utils/private/private.h - cocos/audio/android/cutils/bitops.h - cocos/audio/android/cutils/log.h - cocos/audio/android/IAudioPlayer.h - cocos/audio/android/ICallerThreadUtils.h - cocos/audio/android/IVolumeProvider.h - cocos/audio/android/mp3reader.cpp - cocos/audio/android/mp3reader.h - cocos/audio/android/OpenSLHelper.h - cocos/audio/android/PcmAudioPlayer.cpp - cocos/audio/android/PcmAudioPlayer.h - cocos/audio/android/PcmAudioService.cpp - cocos/audio/android/PcmAudioService.h - cocos/audio/android/PcmBufferProvider.cpp - cocos/audio/android/PcmBufferProvider.h - cocos/audio/android/PcmData.cpp - cocos/audio/android/PcmData.h - cocos/audio/android/tinysndfile.cpp - cocos/audio/android/tinysndfile.h - cocos/audio/android/Track.cpp - cocos/audio/android/Track.h - cocos/audio/android/UrlAudioPlayer.cpp - cocos/audio/android/UrlAudioPlayer.h - cocos/audio/android/utils/Compat.h - cocos/audio/android/utils/Errors.h - cocos/audio/android/utils/Utils.cpp - cocos/audio/android/utils/Utils.h + cocos/audio/android/AssetFd.cpp + cocos/audio/android/AssetFd.h + cocos/audio/android/audio.h + cocos/audio/android/AudioBufferProvider.h + cocos/audio/android/AudioDecoder.cpp + cocos/audio/android/AudioDecoder.h + cocos/audio/android/AudioDecoderMp3.cpp + cocos/audio/android/AudioDecoderMp3.h + cocos/audio/android/AudioDecoderOgg.cpp + cocos/audio/android/AudioDecoderOgg.h + cocos/audio/android/AudioDecoderProvider.cpp + cocos/audio/android/AudioDecoderProvider.h + cocos/audio/android/AudioDecoderSLES.cpp + cocos/audio/android/AudioDecoderSLES.h + cocos/audio/android/AudioDecoderWav.cpp + cocos/audio/android/AudioDecoderWav.h + cocos/audio/android/AudioEngine-inl.cpp + cocos/audio/android/AudioEngine-inl.h + cocos/audio/android/AudioMixer.cpp + cocos/audio/android/AudioMixer.h + cocos/audio/android/AudioMixerController.cpp + cocos/audio/android/AudioMixerController.h + cocos/audio/android/AudioMixerOps.h + cocos/audio/android/AudioPlayerProvider.cpp + cocos/audio/android/AudioPlayerProvider.h + cocos/audio/android/AudioResampler.cpp + cocos/audio/android/AudioResampler.h + cocos/audio/android/AudioResamplerCubic.cpp + cocos/audio/android/AudioResamplerCubic.h + cocos/audio/android/AudioResamplerPublic.h + cocos/audio/android/audio_utils/format.c + cocos/audio/android/audio_utils/include/audio_utils/format.h + cocos/audio/android/audio_utils/include/audio_utils/minifloat.h + cocos/audio/android/audio_utils/include/audio_utils/primitives.h + cocos/audio/android/audio_utils/minifloat.cpp + cocos/audio/android/audio_utils/primitives.c + cocos/audio/android/audio_utils/private/private.h + cocos/audio/android/cutils/bitops.h + cocos/audio/android/cutils/log.h + cocos/audio/android/IAudioPlayer.h + cocos/audio/android/ICallerThreadUtils.h + cocos/audio/android/IVolumeProvider.h + cocos/audio/android/mp3reader.cpp + cocos/audio/android/mp3reader.h + cocos/audio/android/OpenSLHelper.h + cocos/audio/android/PcmAudioPlayer.cpp + cocos/audio/android/PcmAudioPlayer.h + cocos/audio/android/PcmAudioService.cpp + cocos/audio/android/PcmAudioService.h + cocos/audio/android/PcmBufferProvider.cpp + cocos/audio/android/PcmBufferProvider.h + cocos/audio/android/PcmData.cpp + cocos/audio/android/PcmData.h + cocos/audio/android/tinysndfile.cpp + cocos/audio/android/tinysndfile.h + cocos/audio/android/Track.cpp + cocos/audio/android/Track.h + cocos/audio/android/UrlAudioPlayer.cpp + cocos/audio/android/UrlAudioPlayer.h + cocos/audio/android/utils/Compat.h + cocos/audio/android/utils/Errors.h + cocos/audio/android/utils/Utils.cpp + cocos/audio/android/utils/Utils.h ) elseif(APPLE) cocos_source_files( - cocos/audio/apple/AudioDecoder.h - cocos/audio/apple/AudioPlayer.mm - cocos/audio/apple/AudioDecoder.mm - cocos/audio/apple/AudioPlayer.h - cocos/audio/apple/AudioEngine-inl.mm - cocos/audio/apple/AudioMacros.h - cocos/audio/apple/AudioCache.mm - cocos/audio/apple/AudioCache.h - cocos/audio/apple/AudioEngine-inl.h + cocos/audio/apple/AudioDecoder.h + NO_WERROR cocos/audio/apple/AudioPlayer.mm + NO_WERROR cocos/audio/apple/AudioDecoder.mm + cocos/audio/apple/AudioPlayer.h + NO_WERROR cocos/audio/apple/AudioEngine-inl.mm + cocos/audio/apple/AudioMacros.h + NO_WERROR cocos/audio/apple/AudioCache.mm + cocos/audio/apple/AudioCache.h + cocos/audio/apple/AudioEngine-inl.h ) endif() @@ -283,28 +323,43 @@ endif() ##### base cocos_source_files( + cocos/base/Agent.h cocos/base/astc.cpp cocos/base/astc.h + cocos/base/AutoreleasePool.cpp + cocos/base/AutoreleasePool.h cocos/base/base64.cpp cocos/base/base64.h cocos/base/CachedArray.h - cocos/base/AutoreleasePool.cpp - cocos/base/AutoreleasePool.h - cocos/base/Array.cpp - cocos/base/Array.h cocos/base/Config.h + cocos/base/CoreStd.h + cocos/base/csscolorparser.cpp + cocos/base/csscolorparser.h cocos/base/Data.cpp cocos/base/Data.h + cocos/base/etc1.cpp + cocos/base/etc1.h + cocos/base/etc2.cpp + cocos/base/etc2.h + cocos/base/IndexHandle.h + cocos/base/Log.cpp + cocos/base/Log.h cocos/base/Macros.h cocos/base/Map.h - cocos/base/Random.cpp + cocos/base/Object.h cocos/base/Random.h cocos/base/Ref.cpp cocos/base/Ref.h cocos/base/Scheduler.cpp cocos/base/Scheduler.h + cocos/base/StringHandle.cpp + cocos/base/StringHandle.h + cocos/base/StringPool.h + cocos/base/StringUtil.cpp + cocos/base/StringUtil.h cocos/base/ThreadPool.cpp cocos/base/ThreadPool.h + cocos/base/TypeDef.h cocos/base/UTF8.cpp cocos/base/UTF8.h cocos/base/Utils.cpp @@ -312,38 +367,58 @@ cocos_source_files( cocos/base/Value.cpp cocos/base/Value.h cocos/base/Vector.h - cocos/base/csscolorparser.cpp - cocos/base/csscolorparser.h - cocos/base/etc1.cpp - cocos/base/etc1.h - cocos/base/etc2.cpp - cocos/base/etc2.h - cocos/base/Log.cpp - cocos/base/Log.h - cocos/base/memory/AllocatedObj.cpp - cocos/base/memory/AllocatedObj.h - cocos/base/memory/JeAlloc.cpp - cocos/base/memory/JeAlloc.h - cocos/base/memory/MemDef.h - cocos/base/memory/Memory.cpp - cocos/base/memory/Memory.h - cocos/base/memory/MemTracker.cpp - cocos/base/memory/MemTracker.h - cocos/base/memory/NedPooling.cpp - cocos/base/memory/NedPooling.h - cocos/base/memory/StdAlloc.h - cocos/base/memory/StlAlloc.h - cocos/base/Object.h - cocos/base/TypeDef.h - cocos/base/uthash.h - cocos/base/StringUtil.cpp - cocos/base/StringUtil.h - cocos/base/UTFString.cpp - cocos/base/UTFString.h cocos/base/ZipUtils.cpp cocos/base/ZipUtils.h ) +##### memory +cocos_source_files( + cocos/base/memory/AllocatedObj.cpp + cocos/base/memory/AllocatedObj.h + cocos/base/memory/JeAlloc.cpp + cocos/base/memory/JeAlloc.h + cocos/base/memory/MemDef.h + cocos/base/memory/Memory.cpp + cocos/base/memory/Memory.h + cocos/base/memory/MemTracker.cpp + cocos/base/memory/MemTracker.h + cocos/base/memory/NedPooling.cpp + cocos/base/memory/NedPooling.h + cocos/base/memory/StdAlloc.h + cocos/base/memory/StlAlloc.h +) + +##### threading +cocos_source_files( + cocos/base/threading/ConditionVariable.h + cocos/base/threading/ConditionVariable.cpp + cocos/base/threading/Event.h + cocos/base/threading/MessageQueue.h + cocos/base/threading/MessageQueue.cpp + cocos/base/threading/Semaphore.h + cocos/base/threading/Semaphore.cpp + cocos/base/threading/ThreadPool.h + cocos/base/threading/ThreadPool.cpp + cocos/base/threading/ThreadSafeCounter.h + cocos/base/threading/ThreadSafeLinearAllocator.h + cocos/base/threading/ThreadSafeLinearAllocator.cpp +) + +##### job system +cocos_source_files( + cocos/base/job-system/JobSystem.h + + cocos/base/job-system/job-system-taskflow/TFJobGraph.h + cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp + cocos/base/job-system/job-system-taskflow/TFJobSystem.h + cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp + + cocos/base/job-system/job-system-tbb/TBBJobGraph.h + cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp + cocos/base/job-system/job-system-tbb/TBBJobSystem.h + cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp +) + ##### math cocos_source_files( cocos/math/Geometry.cpp @@ -380,44 +455,44 @@ cocos_source_files( ##### network cocos_source_files( - cocos/network/Downloader.cpp - cocos/network/Downloader.h - cocos/network/DownloaderImpl.h - cocos/network/HttpClient.h - cocos/network/HttpCookie.cpp - cocos/network/HttpCookie.h - cocos/network/HttpRequest.h - cocos/network/HttpResponse.h - cocos/network/Uri.cpp - cocos/network/Uri.h + cocos/network/Downloader.cpp + cocos/network/Downloader.h + cocos/network/DownloaderImpl.h + cocos/network/HttpClient.h + cocos/network/HttpCookie.cpp + cocos/network/HttpCookie.h + cocos/network/HttpRequest.h + cocos/network/HttpResponse.h + cocos/network/Uri.cpp + cocos/network/Uri.h ) if(USE_SOCKET) cocos_source_files( - cocos/network/WebSocket.h - cocos/network/SocketIO.cpp - cocos/network/SocketIO.h + cocos/network/WebSocket.h + NO_WERROR cocos/network/SocketIO.cpp + cocos/network/SocketIO.h ) endif() if(NOT IOS AND USE_WEBSOCKET_SERVER) cocos_source_files( - cocos/network/WebSocketServer.h - cocos/network/WebSocketServer.cpp + cocos/network/WebSocketServer.h + NO_WERROR cocos/network/WebSocketServer.cpp ) endif() if(APPLE) cocos_source_files( - cocos/network/DownloaderImpl-apple.h - cocos/network/DownloaderImpl-apple.mm - cocos/network/HttpAsynConnection-apple.h - cocos/network/HttpAsynConnection-apple.m - cocos/network/HttpClient-apple.mm + cocos/network/DownloaderImpl-apple.h + NO_WERROR cocos/network/DownloaderImpl-apple.mm + cocos/network/HttpAsynConnection-apple.h + NO_WERROR cocos/network/HttpAsynConnection-apple.m + NO_WERROR cocos/network/HttpClient-apple.mm ) if(USE_SOCKET) cocos_source_files( - cocos/network/WebSocket-apple.mm + NO_WERROR cocos/network/WebSocket-apple.mm ) set_source_files_properties(${CWD}/cocos/network/WebSocket-apple.mm PROPERTIES COMPILE_FLAGS -fobjc-arc @@ -427,28 +502,28 @@ endif() if(ANDROID) cocos_source_files( - cocos/network/Downloader-android.cpp - cocos/network/Downloader-android.h - cocos/network/HttpClient-android.cpp + cocos/network/Downloader-android.cpp + cocos/network/Downloader-android.h + cocos/network/HttpClient-android.cpp ) endif() if(NOT APPLE AND USE_SOCKET) cocos_source_files( - cocos/network/WebSocket-libwebsockets.cpp + NO_WERROR cocos/network/WebSocket-libwebsockets.cpp ) endif() if(WINDOWS) cocos_source_files( - cocos/network/Downloader-curl.cpp - cocos/network/Downloader-curl.h + NO_WERROR cocos/network/Downloader-curl.cpp + cocos/network/Downloader-curl.h ) endif() if(WINDOWS OR MACOSX) cocos_source_files( - cocos/network/HttpClient.cpp + NO_WERROR cocos/network/HttpClient.cpp ) endif() @@ -469,29 +544,29 @@ cocos_source_files( ) if(WINDOWS) cocos_source_files( - cocos/platform/win32/Application-win32.cpp - cocos/platform/win32/CanvasRenderingContext2D-win32.cpp - cocos/platform/win32/Device-win32.cpp - cocos/platform/win32/FileUtils-win32.cpp - cocos/platform/win32/FileUtils-win32.h - cocos/platform/win32/Utils-win32.cpp - cocos/platform/win32/Utils-win32.h - cocos/platform/win32/View-win32.cpp - cocos/platform/win32/View-win32.h - cocos/platform/win32/compat - cocos/platform/win32/compat/stdint.h - cocos/platform/win32/inet_pton_mingw.cpp - cocos/platform/win32/inet_pton_mingw.h + NO_WERROR cocos/platform/win32/Application-win32.cpp + NO_WERROR cocos/platform/win32/CanvasRenderingContext2D-win32.cpp + cocos/platform/win32/Device-win32.cpp + cocos/platform/win32/FileUtils-win32.cpp + cocos/platform/win32/FileUtils-win32.h + cocos/platform/win32/Utils-win32.cpp + cocos/platform/win32/Utils-win32.h + cocos/platform/win32/View-win32.cpp + cocos/platform/win32/View-win32.h + cocos/platform/win32/compat + cocos/platform/win32/compat/stdint.h + cocos/platform/win32/inet_pton_mingw.cpp + cocos/platform/win32/inet_pton_mingw.h ) elseif(ANDROID) cocos_source_files( - cocos/platform/android/Application-android.cpp - cocos/platform/android/CanvasRenderingContext2D-android.cpp - cocos/platform/android/Device-android.cpp - cocos/platform/android/FileUtils-android.cpp - cocos/platform/android/FileUtils-android.h - cocos/platform/android/View.cpp - cocos/platform/android/View.h + cocos/platform/android/Application-android.cpp + cocos/platform/android/CanvasRenderingContext2D-android.cpp + cocos/platform/android/Device-android.cpp + cocos/platform/android/FileUtils-android.cpp + cocos/platform/android/FileUtils-android.h + cocos/platform/android/View.cpp + cocos/platform/android/View.h ) set(CC_JNI_SRC_FILES ${CWD}/cocos/platform/android/jni/JniCocosActivity.cpp @@ -507,16 +582,16 @@ elseif(ANDROID) ) elseif(APPLE) cocos_source_files( - cocos/platform/apple/FileUtils-apple.h - cocos/platform/apple/Device-apple.mm - cocos/platform/apple/FileUtils-apple.mm - cocos/platform/apple/CanvasRenderingContext2D-apple.mm - cocos/platform/apple/Device-apple.h + cocos/platform/apple/FileUtils-apple.h + cocos/platform/apple/Device-apple.mm + cocos/platform/apple/FileUtils-apple.mm + cocos/platform/apple/CanvasRenderingContext2D-apple.mm + cocos/platform/apple/Device-apple.h ) - #bad struct + # bad structure cocos_source_files( - cocos/platform/ios/Reachability.h - cocos/platform/ios/Reachability.cpp + cocos/platform/ios/Reachability.h + cocos/platform/ios/Reachability.cpp ) if(MACOSX) cocos_source_files( @@ -529,861 +604,1045 @@ elseif(APPLE) ) elseif(IOS) cocos_source_files( - cocos/platform/ios/View.h - cocos/platform/ios/View.mm - cocos/platform/ios/Application-ios.mm - cocos/platform/ios/Device-ios.mm + cocos/platform/ios/View.h + NO_WERROR cocos/platform/ios/View.mm # CAMetalLayer bug for apple + cocos/platform/ios/Application-ios.mm + cocos/platform/ios/Device-ios.mm ) endif() endif() ##### renderer cocos_source_files( - cocos/renderer/core/Core.h - cocos/renderer/core/CoreStd.cpp - cocos/renderer/core/CoreStd.h - cocos/renderer/core/gfx/GFXObject.h - cocos/renderer/core/gfx/GFXObject.cpp - cocos/renderer/core/gfx/GFXBuffer.cpp - cocos/renderer/core/gfx/GFXBuffer.h - cocos/renderer/core/gfx/GFXCommand.h - cocos/renderer/core/gfx/GFXCommandBuffer.cpp - cocos/renderer/core/gfx/GFXCommandBuffer.h - cocos/renderer/core/gfx/GFXCommandPool.h - cocos/renderer/core/gfx/GFXContext.cpp - cocos/renderer/core/gfx/GFXContext.h - cocos/renderer/core/gfx/GFXDef.cpp - cocos/renderer/core/gfx/GFXDef.h - cocos/renderer/core/gfx/GFXDevice.cpp - cocos/renderer/core/gfx/GFXDevice.h - cocos/renderer/core/gfx/GFXFramebuffer.cpp - cocos/renderer/core/gfx/GFXFramebuffer.h - cocos/renderer/core/gfx/GFXInputAssembler.cpp - cocos/renderer/core/gfx/GFXInputAssembler.h - cocos/renderer/core/gfx/GFXDescriptorSet.cpp - cocos/renderer/core/gfx/GFXDescriptorSet.h - cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp - cocos/renderer/core/gfx/GFXDescriptorSetLayout.h - cocos/renderer/core/gfx/GFXPipelineLayout.cpp - cocos/renderer/core/gfx/GFXPipelineLayout.h - cocos/renderer/core/gfx/GFXPipelineState.cpp - cocos/renderer/core/gfx/GFXPipelineState.h - cocos/renderer/core/gfx/GFXQueue.cpp - cocos/renderer/core/gfx/GFXQueue.h - cocos/renderer/core/gfx/GFXRenderPass.cpp - cocos/renderer/core/gfx/GFXRenderPass.h - cocos/renderer/core/gfx/GFXSampler.cpp - cocos/renderer/core/gfx/GFXSampler.h - cocos/renderer/core/gfx/GFXShader.cpp - cocos/renderer/core/gfx/GFXShader.h - cocos/renderer/core/gfx/GFXTexture.cpp - cocos/renderer/core/gfx/GFXTexture.h - cocos/renderer/core/gfx/GFXFence.h - cocos/renderer/core/gfx/GFXFence.cpp - cocos/renderer/pipeline/BatchedBuffer.cpp - cocos/renderer/pipeline/BatchedBuffer.h - cocos/renderer/pipeline/Define.h - cocos/renderer/pipeline/Define.cpp - cocos/renderer/pipeline/InstancedBuffer.cpp - cocos/renderer/pipeline/InstancedBuffer.h - cocos/renderer/pipeline/PipelineStateManager.cpp - cocos/renderer/pipeline/PipelineStateManager.h - cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp - cocos/renderer/pipeline/RenderAdditiveLightQueue.h - cocos/renderer/pipeline/RenderBatchedQueue.cpp - cocos/renderer/pipeline/RenderBatchedQueue.h - cocos/renderer/pipeline/RenderFlow.cpp - cocos/renderer/pipeline/RenderFlow.h - cocos/renderer/pipeline/RenderInstancedQueue.cpp - cocos/renderer/pipeline/RenderInstancedQueue.h - cocos/renderer/pipeline/RenderPipeline.cpp - cocos/renderer/pipeline/RenderPipeline.h - cocos/renderer/pipeline/RenderQueue.cpp - cocos/renderer/pipeline/RenderQueue.h - cocos/renderer/pipeline/RenderStage.cpp - cocos/renderer/pipeline/RenderStage.h - cocos/renderer/pipeline/PlanarShadowQueue.cpp - cocos/renderer/pipeline/PlanarShadowQueue.h - cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp - cocos/renderer/pipeline/ShadowMapBatchedQueue.h - cocos/renderer/pipeline/forward/ForwardFlow.cpp - cocos/renderer/pipeline/forward/ForwardFlow.h - cocos/renderer/pipeline/forward/ForwardPipeline.cpp - cocos/renderer/pipeline/forward/ForwardPipeline.h - cocos/renderer/pipeline/forward/ForwardStage.cpp - cocos/renderer/pipeline/forward/ForwardStage.h - cocos/renderer/pipeline/forward/SceneCulling.cpp - cocos/renderer/pipeline/forward/SceneCulling.h - cocos/renderer/pipeline/forward/UIPhase.cpp - cocos/renderer/pipeline/forward/UIPhase.h - cocos/renderer/pipeline/shadow/ShadowFlow.cpp - cocos/renderer/pipeline/shadow/ShadowFlow.h - cocos/renderer/pipeline/shadow/ShadowStage.cpp - cocos/renderer/pipeline/shadow/ShadowStage.h - cocos/renderer/pipeline/helper/DefineMap.h - cocos/renderer/pipeline/helper/DefineMap.cpp - cocos/renderer/pipeline/helper/SharedMemory.h - cocos/renderer/pipeline/helper/SharedMemory.cpp + cocos/renderer/GFXDeviceManager.h + + cocos/renderer/gfx-base/GFXObject.h + cocos/renderer/gfx-base/GFXObject.cpp + cocos/renderer/gfx-base/GFXBase.h + cocos/renderer/gfx-base/GFXBuffer.cpp + cocos/renderer/gfx-base/GFXBuffer.h + cocos/renderer/gfx-base/GFXCommandBuffer.cpp + cocos/renderer/gfx-base/GFXCommandBuffer.h + cocos/renderer/gfx-base/GFXContext.cpp + cocos/renderer/gfx-base/GFXContext.h + cocos/renderer/gfx-base/GFXDef.cpp + cocos/renderer/gfx-base/GFXDef.h + cocos/renderer/gfx-base/GFXDef-common.h + cocos/renderer/gfx-base/GFXDevice.cpp + cocos/renderer/gfx-base/GFXDevice.h + cocos/renderer/gfx-base/GFXFramebuffer.cpp + cocos/renderer/gfx-base/GFXFramebuffer.h + cocos/renderer/gfx-base/GFXGlobalBarrier.cpp + cocos/renderer/gfx-base/GFXGlobalBarrier.h + cocos/renderer/gfx-base/GFXInputAssembler.cpp + cocos/renderer/gfx-base/GFXInputAssembler.h + cocos/renderer/gfx-base/GFXDescriptorSet.cpp + cocos/renderer/gfx-base/GFXDescriptorSet.h + cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp + cocos/renderer/gfx-base/GFXDescriptorSetLayout.h + cocos/renderer/gfx-base/GFXPipelineLayout.cpp + cocos/renderer/gfx-base/GFXPipelineLayout.h + cocos/renderer/gfx-base/GFXPipelineState.cpp + cocos/renderer/gfx-base/GFXPipelineState.h + cocos/renderer/gfx-base/GFXQueue.cpp + cocos/renderer/gfx-base/GFXQueue.h + cocos/renderer/gfx-base/GFXRenderPass.cpp + cocos/renderer/gfx-base/GFXRenderPass.h + cocos/renderer/gfx-base/GFXSampler.cpp + cocos/renderer/gfx-base/GFXSampler.h + cocos/renderer/gfx-base/GFXShader.cpp + cocos/renderer/gfx-base/GFXShader.h + cocos/renderer/gfx-base/GFXTexture.cpp + cocos/renderer/gfx-base/GFXTexture.h + cocos/renderer/gfx-base/GFXTextureBarrier.cpp + cocos/renderer/gfx-base/GFXTextureBarrier.h + + cocos/renderer/gfx-agent/BufferAgent.h + cocos/renderer/gfx-agent/BufferAgent.cpp + cocos/renderer/gfx-agent/CommandBufferAgent.h + cocos/renderer/gfx-agent/CommandBufferAgent.cpp + cocos/renderer/gfx-agent/DescriptorSetAgent.h + cocos/renderer/gfx-agent/DescriptorSetAgent.cpp + cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.h + cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.cpp + cocos/renderer/gfx-agent/DeviceAgent.h + cocos/renderer/gfx-agent/DeviceAgent.cpp + cocos/renderer/gfx-agent/FramebufferAgent.h + cocos/renderer/gfx-agent/FramebufferAgent.cpp + cocos/renderer/gfx-agent/InputAssemblerAgent.h + cocos/renderer/gfx-agent/InputAssemblerAgent.cpp + cocos/renderer/gfx-agent/LinearAllocatorPool.h + cocos/renderer/gfx-agent/PipelineLayoutAgent.h + cocos/renderer/gfx-agent/PipelineLayoutAgent.cpp + cocos/renderer/gfx-agent/PipelineStateAgent.h + cocos/renderer/gfx-agent/PipelineStateAgent.cpp + cocos/renderer/gfx-agent/QueueAgent.h + cocos/renderer/gfx-agent/QueueAgent.cpp + cocos/renderer/gfx-agent/RenderPassAgent.h + cocos/renderer/gfx-agent/RenderPassAgent.cpp + cocos/renderer/gfx-agent/SamplerAgent.h + cocos/renderer/gfx-agent/SamplerAgent.cpp + cocos/renderer/gfx-agent/ShaderAgent.h + cocos/renderer/gfx-agent/ShaderAgent.cpp + cocos/renderer/gfx-agent/TextureAgent.h + cocos/renderer/gfx-agent/TextureAgent.cpp + + cocos/renderer/gfx-validator/BufferValidator.h + cocos/renderer/gfx-validator/BufferValidator.cpp + cocos/renderer/gfx-validator/CommandBufferValidator.h + cocos/renderer/gfx-validator/CommandBufferValidator.cpp + cocos/renderer/gfx-validator/DescriptorSetValidator.h + cocos/renderer/gfx-validator/DescriptorSetValidator.cpp + cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.h + cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.cpp + cocos/renderer/gfx-validator/DeviceValidator.h + cocos/renderer/gfx-validator/DeviceValidator.cpp + cocos/renderer/gfx-validator/FramebufferValidator.h + cocos/renderer/gfx-validator/FramebufferValidator.cpp + cocos/renderer/gfx-validator/InputAssemblerValidator.h + cocos/renderer/gfx-validator/InputAssemblerValidator.cpp + cocos/renderer/gfx-validator/PipelineLayoutValidator.h + cocos/renderer/gfx-validator/PipelineLayoutValidator.cpp + cocos/renderer/gfx-validator/PipelineStateValidator.h + cocos/renderer/gfx-validator/PipelineStateValidator.cpp + cocos/renderer/gfx-validator/QueueValidator.h + cocos/renderer/gfx-validator/QueueValidator.cpp + cocos/renderer/gfx-validator/RenderPassValidator.h + cocos/renderer/gfx-validator/RenderPassValidator.cpp + cocos/renderer/gfx-validator/SamplerValidator.h + cocos/renderer/gfx-validator/SamplerValidator.cpp + cocos/renderer/gfx-validator/ShaderValidator.h + cocos/renderer/gfx-validator/ShaderValidator.cpp + cocos/renderer/gfx-validator/TextureValidator.h + cocos/renderer/gfx-validator/TextureValidator.cpp + cocos/renderer/gfx-validator/ValidationUtils.h + cocos/renderer/gfx-validator/ValidationUtils.cpp + + cocos/renderer/gfx-empty/EmptyBuffer.h + cocos/renderer/gfx-empty/EmptyBuffer.cpp + cocos/renderer/gfx-empty/EmptyCommandBuffer.h + cocos/renderer/gfx-empty/EmptyCommandBuffer.cpp + cocos/renderer/gfx-empty/EmptyContext.h + cocos/renderer/gfx-empty/EmptyContext.cpp + cocos/renderer/gfx-empty/EmptyDescriptorSet.h + cocos/renderer/gfx-empty/EmptyDescriptorSet.cpp + cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.h + cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.cpp + cocos/renderer/gfx-empty/EmptyDevice.h + cocos/renderer/gfx-empty/EmptyDevice.cpp + cocos/renderer/gfx-empty/EmptyFramebuffer.h + cocos/renderer/gfx-empty/EmptyFramebuffer.cpp + cocos/renderer/gfx-empty/EmptyInputAssembler.h + cocos/renderer/gfx-empty/EmptyInputAssembler.cpp + cocos/renderer/gfx-empty/EmptyPipelineLayout.h + cocos/renderer/gfx-empty/EmptyPipelineLayout.cpp + cocos/renderer/gfx-empty/EmptyPipelineState.h + cocos/renderer/gfx-empty/EmptyPipelineState.cpp + cocos/renderer/gfx-empty/EmptyQueue.h + cocos/renderer/gfx-empty/EmptyQueue.cpp + cocos/renderer/gfx-empty/EmptyRenderPass.h + cocos/renderer/gfx-empty/EmptyRenderPass.cpp + cocos/renderer/gfx-empty/EmptySampler.h + cocos/renderer/gfx-empty/EmptySampler.cpp + cocos/renderer/gfx-empty/EmptyShader.h + cocos/renderer/gfx-empty/EmptyShader.cpp + cocos/renderer/gfx-empty/EmptyTexture.h + cocos/renderer/gfx-empty/EmptyTexture.cpp + + cocos/renderer/pipeline/BatchedBuffer.cpp + cocos/renderer/pipeline/BatchedBuffer.h + cocos/renderer/pipeline/Define.h + cocos/renderer/pipeline/Define.cpp + cocos/renderer/pipeline/InstancedBuffer.cpp + cocos/renderer/pipeline/InstancedBuffer.h + cocos/renderer/pipeline/PipelineStateManager.cpp + cocos/renderer/pipeline/PipelineStateManager.h + cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp + cocos/renderer/pipeline/RenderAdditiveLightQueue.h + cocos/renderer/pipeline/RenderBatchedQueue.cpp + cocos/renderer/pipeline/RenderBatchedQueue.h + cocos/renderer/pipeline/RenderFlow.cpp + cocos/renderer/pipeline/RenderFlow.h + cocos/renderer/pipeline/RenderInstancedQueue.cpp + cocos/renderer/pipeline/RenderInstancedQueue.h + cocos/renderer/pipeline/RenderPipeline.cpp + cocos/renderer/pipeline/RenderPipeline.h + cocos/renderer/pipeline/RenderQueue.cpp + cocos/renderer/pipeline/RenderQueue.h + cocos/renderer/pipeline/RenderStage.cpp + cocos/renderer/pipeline/RenderStage.h + cocos/renderer/pipeline/PlanarShadowQueue.cpp + cocos/renderer/pipeline/PlanarShadowQueue.h + cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp + cocos/renderer/pipeline/ShadowMapBatchedQueue.h + cocos/renderer/pipeline/PipelineUBO.cpp + cocos/renderer/pipeline/PipelineUBO.h + cocos/renderer/pipeline/PipelineSceneData.cpp + cocos/renderer/pipeline/PipelineSceneData.h + cocos/renderer/pipeline/forward/ForwardFlow.cpp + cocos/renderer/pipeline/forward/ForwardFlow.h + cocos/renderer/pipeline/forward/ForwardPipeline.cpp + cocos/renderer/pipeline/forward/ForwardPipeline.h + cocos/renderer/pipeline/forward/ForwardStage.cpp + cocos/renderer/pipeline/forward/ForwardStage.h + cocos/renderer/pipeline/SceneCulling.cpp + cocos/renderer/pipeline/SceneCulling.h + cocos/renderer/pipeline/forward/UIPhase.cpp + cocos/renderer/pipeline/forward/UIPhase.h + cocos/renderer/pipeline/deferred/DeferredPipeline.cpp + cocos/renderer/pipeline/deferred/DeferredPipeline.h + cocos/renderer/pipeline/deferred/GbufferFlow.cpp + cocos/renderer/pipeline/deferred/GbufferFlow.h + cocos/renderer/pipeline/deferred/GbufferStage.cpp + cocos/renderer/pipeline/deferred/GbufferStage.h + cocos/renderer/pipeline/deferred/LightingFlow.cpp + cocos/renderer/pipeline/deferred/LightingFlow.h + cocos/renderer/pipeline/deferred/LightingStage.cpp + cocos/renderer/pipeline/deferred/LightingStage.h + cocos/renderer/pipeline/deferred/PostprocessStage.cpp + cocos/renderer/pipeline/deferred/PostprocessStage.h + cocos/renderer/pipeline/shadow/ShadowFlow.cpp + cocos/renderer/pipeline/shadow/ShadowFlow.h + cocos/renderer/pipeline/shadow/ShadowStage.cpp + cocos/renderer/pipeline/shadow/ShadowStage.h + cocos/renderer/pipeline/helper/DefineMap.h + cocos/renderer/pipeline/helper/DefineMap.cpp + cocos/renderer/pipeline/helper/SharedMemory.h + cocos/renderer/pipeline/helper/SharedMemory.cpp ) +if(CC_USE_GLES2 OR CC_USE_GLES3) +cocos_source_files( + cocos/renderer/gfx-gles-common/GLESCommandPool.h + cocos/renderer/gfx-gles-common/eglw.cpp + cocos/renderer/gfx-gles-common/gles2w.cpp + cocos/renderer/gfx-gles-common/gles3w.cpp +) +endif() + if(CC_USE_GLES2) cocos_source_files( - cocos/renderer/gfx-gles2/GFXGLES2.h - cocos/renderer/gfx-gles2/GLES2Buffer.cpp - cocos/renderer/gfx-gles2/GLES2Buffer.h - cocos/renderer/gfx-gles2/GLES2CommandBuffer.cpp - cocos/renderer/gfx-gles2/GLES2CommandBuffer.h - cocos/renderer/gfx-gles2/GLES2Commands.cpp - cocos/renderer/gfx-gles2/GLES2Commands.h - cocos/renderer/gfx-gles2/GLES2Context.h - cocos/renderer/gfx-gles2/GLES2Device.cpp - cocos/renderer/gfx-gles2/GLES2Device.h - cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp - cocos/renderer/gfx-gles2/GLES2Framebuffer.h - cocos/renderer/gfx-gles2/GLES2GPUObjects.h - cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp - cocos/renderer/gfx-gles2/GLES2InputAssembler.h - cocos/renderer/gfx-gles2/GLES2DescriptorSet.cpp - cocos/renderer/gfx-gles2/GLES2DescriptorSet.h - cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.cpp - cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h - cocos/renderer/gfx-gles2/GLES2PipelineLayout.cpp - cocos/renderer/gfx-gles2/GLES2PipelineLayout.h - cocos/renderer/gfx-gles2/GLES2PipelineState.cpp - cocos/renderer/gfx-gles2/GLES2PipelineState.h - cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.cpp - cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.h - cocos/renderer/gfx-gles2/GLES2Queue.cpp - cocos/renderer/gfx-gles2/GLES2Queue.h - cocos/renderer/gfx-gles2/GLES2RenderPass.cpp - cocos/renderer/gfx-gles2/GLES2RenderPass.h - cocos/renderer/gfx-gles2/GLES2Sampler.cpp - cocos/renderer/gfx-gles2/GLES2Sampler.h - cocos/renderer/gfx-gles2/GLES2Shader.cpp - cocos/renderer/gfx-gles2/GLES2Shader.h - cocos/renderer/gfx-gles2/GLES2Std.cpp - cocos/renderer/gfx-gles2/GLES2Std.h - cocos/renderer/gfx-gles2/GLES2Texture.cpp - cocos/renderer/gfx-gles2/GLES2Texture.h - cocos/renderer/gfx-gles2/gles2w.h - cocos/renderer/gfx-gles2/GLES2Fence.h - cocos/renderer/gfx-gles2/GLES2Fence.cpp + cocos/renderer/gfx-gles2/GFXGLES2.h + cocos/renderer/gfx-gles2/GLES2Buffer.cpp + cocos/renderer/gfx-gles2/GLES2Buffer.h + cocos/renderer/gfx-gles2/GLES2CommandBuffer.cpp + cocos/renderer/gfx-gles2/GLES2CommandBuffer.h + cocos/renderer/gfx-gles2/GLES2Commands.cpp + cocos/renderer/gfx-gles2/GLES2Commands.h + cocos/renderer/gfx-gles2/GLES2Context.h + cocos/renderer/gfx-gles2/GLES2Context.cpp + cocos/renderer/gfx-gles2/GLES2Device.cpp + cocos/renderer/gfx-gles2/GLES2Device.h + cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp + cocos/renderer/gfx-gles2/GLES2Framebuffer.h + cocos/renderer/gfx-gles2/GLES2GPUObjects.h + cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp + cocos/renderer/gfx-gles2/GLES2InputAssembler.h + cocos/renderer/gfx-gles2/GLES2DescriptorSet.cpp + cocos/renderer/gfx-gles2/GLES2DescriptorSet.h + cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.cpp + cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h + cocos/renderer/gfx-gles2/GLES2PipelineLayout.cpp + cocos/renderer/gfx-gles2/GLES2PipelineLayout.h + cocos/renderer/gfx-gles2/GLES2PipelineState.cpp + cocos/renderer/gfx-gles2/GLES2PipelineState.h + cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.cpp + cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.h + cocos/renderer/gfx-gles2/GLES2Queue.cpp + cocos/renderer/gfx-gles2/GLES2Queue.h + cocos/renderer/gfx-gles2/GLES2RenderPass.cpp + cocos/renderer/gfx-gles2/GLES2RenderPass.h + cocos/renderer/gfx-gles2/GLES2Sampler.cpp + cocos/renderer/gfx-gles2/GLES2Sampler.h + cocos/renderer/gfx-gles2/GLES2Shader.cpp + cocos/renderer/gfx-gles2/GLES2Shader.h + cocos/renderer/gfx-gles2/GLES2Std.cpp + cocos/renderer/gfx-gles2/GLES2Std.h + cocos/renderer/gfx-gles2/GLES2Texture.cpp + cocos/renderer/gfx-gles2/GLES2Texture.h + cocos/renderer/gfx-gles2/GLES2Wrangler.h ) if(APPLE) cocos_source_files( - cocos/renderer/gfx-gles2/GLES2Context.mm - cocos/renderer/gfx-gles2/gles2w.mm + NO_WERROR cocos/renderer/gfx-gles2/GLES2Wrangler.mm ) else() cocos_source_files( - cocos/renderer/gfx-gles2/GLES2Context.cpp - cocos/renderer/gfx-gles2/gles2w.c - ) - endif() - -endif() - -if(CC_USE_GLES3) - cocos_source_files( - cocos/renderer/gfx-gles3/GFXGLES3.h - cocos/renderer/gfx-gles3/GLES3Buffer.cpp - cocos/renderer/gfx-gles3/GLES3Buffer.h - cocos/renderer/gfx-gles3/GLES3CommandBuffer.cpp - cocos/renderer/gfx-gles3/GLES3CommandBuffer.h - cocos/renderer/gfx-gles3/GLES3Commands.cpp - cocos/renderer/gfx-gles3/GLES3Commands.h - cocos/renderer/gfx-gles3/GLES3Context.cpp - cocos/renderer/gfx-gles3/GLES3Context.h - cocos/renderer/gfx-gles3/GLES3Device.cpp - cocos/renderer/gfx-gles3/GLES3Device.h - cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp - cocos/renderer/gfx-gles3/GLES3Framebuffer.h - cocos/renderer/gfx-gles3/GLES3GPUObjects.h - cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp - cocos/renderer/gfx-gles3/GLES3InputAssembler.h - cocos/renderer/gfx-gles3/GLES3DescriptorSet.cpp - cocos/renderer/gfx-gles3/GLES3DescriptorSet.h - cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.cpp - cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h - cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp - cocos/renderer/gfx-gles3/GLES3PipelineLayout.h - cocos/renderer/gfx-gles3/GLES3PipelineState.cpp - cocos/renderer/gfx-gles3/GLES3PipelineState.h - cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp - cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.h - cocos/renderer/gfx-gles3/GLES3Queue.cpp - cocos/renderer/gfx-gles3/GLES3Queue.h - cocos/renderer/gfx-gles3/GLES3RenderPass.cpp - cocos/renderer/gfx-gles3/GLES3RenderPass.h - cocos/renderer/gfx-gles3/GLES3Sampler.cpp - cocos/renderer/gfx-gles3/GLES3Sampler.h - cocos/renderer/gfx-gles3/GLES3Shader.cpp - cocos/renderer/gfx-gles3/GLES3Shader.h - cocos/renderer/gfx-gles3/GLES3Std.cpp - cocos/renderer/gfx-gles3/GLES3Std.h - cocos/renderer/gfx-gles3/GLES3Texture.cpp - cocos/renderer/gfx-gles3/GLES3Texture.h - cocos/renderer/gfx-gles3/gles3w.h - cocos/renderer/gfx-gles3/GLES3Fence.h - cocos/renderer/gfx-gles3/GLES3Fence.cpp - ) - if(APPLE) - cocos_source_files( - cocos/renderer/gfx-gles3/gles3w.mm - ) - else() - cocos_source_files( - cocos/renderer/gfx-gles3/gles3w.c + cocos/renderer/gfx-gles2/GLES2Wrangler.cpp ) endif() if(IOS) cocos_source_files( - cocos/renderer/gfx-gles3/GLES3Context.mm + NO_WERROR cocos/renderer/gfx-gles2/GLES2Context.mm + ) + endif() +endif() + +if(CC_USE_GLES3) + cocos_source_files( + cocos/renderer/gfx-gles3/GFXGLES3.h + cocos/renderer/gfx-gles3/GLES3Buffer.cpp + cocos/renderer/gfx-gles3/GLES3Buffer.h + cocos/renderer/gfx-gles3/GLES3CommandBuffer.cpp + cocos/renderer/gfx-gles3/GLES3CommandBuffer.h + cocos/renderer/gfx-gles3/GLES3Commands.cpp + cocos/renderer/gfx-gles3/GLES3Commands.h + cocos/renderer/gfx-gles3/GLES3Context.cpp + cocos/renderer/gfx-gles3/GLES3Context.h + cocos/renderer/gfx-gles3/GLES3Device.cpp + cocos/renderer/gfx-gles3/GLES3Device.h + cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp + cocos/renderer/gfx-gles3/GLES3Framebuffer.h + cocos/renderer/gfx-gles3/GLES3GlobalBarrier.cpp + cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h + cocos/renderer/gfx-gles3/GLES3GPUObjects.h + cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp + cocos/renderer/gfx-gles3/GLES3InputAssembler.h + cocos/renderer/gfx-gles3/GLES3DescriptorSet.cpp + cocos/renderer/gfx-gles3/GLES3DescriptorSet.h + cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.cpp + cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h + cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp + cocos/renderer/gfx-gles3/GLES3PipelineLayout.h + cocos/renderer/gfx-gles3/GLES3PipelineState.cpp + cocos/renderer/gfx-gles3/GLES3PipelineState.h + cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp + cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.h + cocos/renderer/gfx-gles3/GLES3Queue.cpp + cocos/renderer/gfx-gles3/GLES3Queue.h + cocos/renderer/gfx-gles3/GLES3RenderPass.cpp + cocos/renderer/gfx-gles3/GLES3RenderPass.h + cocos/renderer/gfx-gles3/GLES3Sampler.cpp + cocos/renderer/gfx-gles3/GLES3Sampler.h + cocos/renderer/gfx-gles3/GLES3Shader.cpp + cocos/renderer/gfx-gles3/GLES3Shader.h + cocos/renderer/gfx-gles3/GLES3Std.cpp + cocos/renderer/gfx-gles3/GLES3Std.h + cocos/renderer/gfx-gles3/GLES3Texture.cpp + cocos/renderer/gfx-gles3/GLES3Texture.h + cocos/renderer/gfx-gles3/GLES3Wrangler.h + ) + if(APPLE) + cocos_source_files( + NO_WERROR cocos/renderer/gfx-gles3/GLES3Wrangler.mm + ) + else() + cocos_source_files( + cocos/renderer/gfx-gles3/GLES3Wrangler.cpp + ) + endif() + if(IOS) + cocos_source_files( + NO_WERROR cocos/renderer/gfx-gles3/GLES3Context.mm ) endif() endif() if(CC_USE_METAL) cocos_source_files( - cocos/renderer/gfx-metal/GFXMTL.h - cocos/renderer/gfx-metal/MTLBuffer.h - cocos/renderer/gfx-metal/MTLBuffer.mm - cocos/renderer/gfx-metal/MTLCommandBuffer.h - cocos/renderer/gfx-metal/MTLCommandBuffer.mm - cocos/renderer/gfx-metal/MTLContext.h - cocos/renderer/gfx-metal/MTLContext.mm - cocos/renderer/gfx-metal/MTLDevice.h - cocos/renderer/gfx-metal/MTLDevice.mm - cocos/renderer/gfx-metal/MTLFramebuffer.mm - cocos/renderer/gfx-metal/MTLFramebuffer.h - cocos/renderer/gfx-metal/MTLGPUObjects.h - cocos/renderer/gfx-metal/MTLInputAssembler.h - cocos/renderer/gfx-metal/MTLInputAssembler.mm - cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h - cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm - cocos/renderer/gfx-metal/MTLPipelineLayout.h - cocos/renderer/gfx-metal/MTLPipelineLayout.mm - cocos/renderer/gfx-metal/MTLPipelineState.h - cocos/renderer/gfx-metal/MTLPipelineState.mm - cocos/renderer/gfx-metal/MTLDescriptorSet.h - cocos/renderer/gfx-metal/MTLDescriptorSet.mm - cocos/renderer/gfx-metal/MTLQueue.h - cocos/renderer/gfx-metal/MTLQueue.mm - cocos/renderer/gfx-metal/MTLRenderPass.h - cocos/renderer/gfx-metal/MTLRenderPass.mm - cocos/renderer/gfx-metal/MTLSampler.h - cocos/renderer/gfx-metal/MTLSampler.mm - cocos/renderer/gfx-metal/MTLShader.h - cocos/renderer/gfx-metal/MTLShader.mm - cocos/renderer/gfx-metal/MTLStd.cpp - cocos/renderer/gfx-metal/MTLStd.h - cocos/renderer/gfx-metal/MTLTexture.h - cocos/renderer/gfx-metal/MTLTexture.mm - cocos/renderer/gfx-metal/MTLUtils.h - cocos/renderer/gfx-metal/MTLUtils.mm - cocos/renderer/gfx-metal/MTLFence.h - cocos/renderer/gfx-metal/MTLFence.mm - cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h - cocos/renderer/gfx-metal/MTLConfig.h - cocos/renderer/gfx-metal/MTLSemaphore.h + cocos/renderer/gfx-metal/GFXMTL.h + cocos/renderer/gfx-metal/MTLBuffer.h + cocos/renderer/gfx-metal/MTLBuffer.mm + cocos/renderer/gfx-metal/MTLCommandBuffer.h + cocos/renderer/gfx-metal/MTLCommandBuffer.mm + cocos/renderer/gfx-metal/MTLContext.h + NO_WERROR cocos/renderer/gfx-metal/MTLContext.mm # CAMetalLayer bug for apple + cocos/renderer/gfx-metal/MTLDevice.h + NO_WERROR cocos/renderer/gfx-metal/MTLDevice.mm # CAMetalLayer bug for apple + cocos/renderer/gfx-metal/MTLFramebuffer.mm + cocos/renderer/gfx-metal/MTLFramebuffer.h + cocos/renderer/gfx-metal/MTLGPUObjects.h + cocos/renderer/gfx-metal/MTLInputAssembler.h + cocos/renderer/gfx-metal/MTLInputAssembler.mm + cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h + cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm + cocos/renderer/gfx-metal/MTLPipelineLayout.h + cocos/renderer/gfx-metal/MTLPipelineLayout.mm + cocos/renderer/gfx-metal/MTLPipelineState.h + cocos/renderer/gfx-metal/MTLPipelineState.mm + cocos/renderer/gfx-metal/MTLDescriptorSet.h + cocos/renderer/gfx-metal/MTLDescriptorSet.mm + cocos/renderer/gfx-metal/MTLQueue.h + cocos/renderer/gfx-metal/MTLQueue.mm + cocos/renderer/gfx-metal/MTLRenderPass.h + cocos/renderer/gfx-metal/MTLRenderPass.mm + cocos/renderer/gfx-metal/MTLSampler.h + cocos/renderer/gfx-metal/MTLSampler.mm + cocos/renderer/gfx-metal/MTLShader.h + cocos/renderer/gfx-metal/MTLShader.mm + cocos/renderer/gfx-metal/MTLStd.cpp + cocos/renderer/gfx-metal/MTLStd.h + cocos/renderer/gfx-metal/MTLTexture.h + cocos/renderer/gfx-metal/MTLTexture.mm + cocos/renderer/gfx-metal/MTLUtils.h + cocos/renderer/gfx-metal/MTLUtils.mm + cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h + cocos/renderer/gfx-metal/MTLComputeCommandEncoder.h + cocos/renderer/gfx-metal/MTLCommandEncoder.h + cocos/renderer/gfx-metal/MTLConfig.h + cocos/renderer/gfx-metal/MTLSemaphore.h ) endif() if(CC_USE_VULKAN) cocos_source_files( - cocos/renderer/gfx-vulkan/GFXVulkan.h - cocos/renderer/gfx-vulkan/vk_mem_alloc.h - cocos/renderer/gfx-vulkan/VKBuffer.cpp - cocos/renderer/gfx-vulkan/VKBuffer.h - cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp - cocos/renderer/gfx-vulkan/VKCommandBuffer.h - cocos/renderer/gfx-vulkan/VKCommands.cpp - cocos/renderer/gfx-vulkan/VKCommands.h - cocos/renderer/gfx-vulkan/VKContext.cpp - cocos/renderer/gfx-vulkan/VKContext.h - cocos/renderer/gfx-vulkan/VKDevice.cpp - cocos/renderer/gfx-vulkan/VKDevice.h - cocos/renderer/gfx-vulkan/VKFramebuffer.cpp - cocos/renderer/gfx-vulkan/VKFramebuffer.h - cocos/renderer/gfx-vulkan/VKGPUObjects.h - cocos/renderer/gfx-vulkan/VKInputAssembler.cpp - cocos/renderer/gfx-vulkan/VKInputAssembler.h - cocos/renderer/gfx-vulkan/VKDescriptorSet.cpp - cocos/renderer/gfx-vulkan/VKDescriptorSet.h - cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.cpp - cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h - cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp - cocos/renderer/gfx-vulkan/VKPipelineLayout.h - cocos/renderer/gfx-vulkan/VKPipelineState.cpp - cocos/renderer/gfx-vulkan/VKPipelineState.h - cocos/renderer/gfx-vulkan/VKQueue.cpp - cocos/renderer/gfx-vulkan/VKQueue.h - cocos/renderer/gfx-vulkan/VKRenderPass.cpp - cocos/renderer/gfx-vulkan/VKRenderPass.h - cocos/renderer/gfx-vulkan/VKSampler.cpp - cocos/renderer/gfx-vulkan/VKSampler.h - cocos/renderer/gfx-vulkan/VKShader.cpp - cocos/renderer/gfx-vulkan/VKShader.h - cocos/renderer/gfx-vulkan/VKSPIRV.h - cocos/renderer/gfx-vulkan/VKStd.cpp - cocos/renderer/gfx-vulkan/VKStd.h - cocos/renderer/gfx-vulkan/VKTexture.cpp - cocos/renderer/gfx-vulkan/VKTexture.h - cocos/renderer/gfx-vulkan/VKUtils.h - cocos/renderer/gfx-vulkan/VKFence.h - cocos/renderer/gfx-vulkan/VKFence.cpp - cocos/renderer/gfx-vulkan/volk.h - cocos/renderer/gfx-vulkan/volk.c + cocos/renderer/gfx-vulkan/GFXVulkan.h + cocos/renderer/gfx-vulkan/vk_mem_alloc.h + cocos/renderer/gfx-vulkan/VKBuffer.cpp + cocos/renderer/gfx-vulkan/VKBuffer.h + cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp + cocos/renderer/gfx-vulkan/VKCommandBuffer.h + cocos/renderer/gfx-vulkan/VKCommands.cpp + cocos/renderer/gfx-vulkan/VKCommands.h + cocos/renderer/gfx-vulkan/VKContext.cpp + cocos/renderer/gfx-vulkan/VKContext.h + cocos/renderer/gfx-vulkan/VKDevice.cpp + cocos/renderer/gfx-vulkan/VKDevice.h + cocos/renderer/gfx-vulkan/VKFramebuffer.cpp + cocos/renderer/gfx-vulkan/VKFramebuffer.h + cocos/renderer/gfx-vulkan/VKGlobalBarrier.cpp + cocos/renderer/gfx-vulkan/VKGlobalBarrier.h + cocos/renderer/gfx-vulkan/VKGPUObjects.h + cocos/renderer/gfx-vulkan/VKInputAssembler.cpp + cocos/renderer/gfx-vulkan/VKInputAssembler.h + cocos/renderer/gfx-vulkan/VKDescriptorSet.cpp + cocos/renderer/gfx-vulkan/VKDescriptorSet.h + cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.cpp + cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h + cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp + cocos/renderer/gfx-vulkan/VKPipelineLayout.h + cocos/renderer/gfx-vulkan/VKPipelineState.cpp + cocos/renderer/gfx-vulkan/VKPipelineState.h + cocos/renderer/gfx-vulkan/VKQueue.cpp + cocos/renderer/gfx-vulkan/VKQueue.h + cocos/renderer/gfx-vulkan/VKRenderPass.cpp + cocos/renderer/gfx-vulkan/VKRenderPass.h + cocos/renderer/gfx-vulkan/VKSampler.cpp + cocos/renderer/gfx-vulkan/VKSampler.h + cocos/renderer/gfx-vulkan/VKShader.cpp + cocos/renderer/gfx-vulkan/VKShader.h + cocos/renderer/gfx-vulkan/VKSPIRV.h + cocos/renderer/gfx-vulkan/VKStd.cpp + cocos/renderer/gfx-vulkan/VKStd.h + cocos/renderer/gfx-vulkan/VKTexture.cpp + cocos/renderer/gfx-vulkan/VKTexture.h + cocos/renderer/gfx-vulkan/VKTextureBarrier.cpp + cocos/renderer/gfx-vulkan/VKTextureBarrier.h + cocos/renderer/gfx-vulkan/VKUtils.cpp + cocos/renderer/gfx-vulkan/VKUtils.h + cocos/renderer/gfx-vulkan/volk.c + cocos/renderer/gfx-vulkan/volk.h + ) +endif() + +cocos_source_files( + cocos/renderer/frame-graph/Blackboard.h + cocos/renderer/frame-graph/CallbackPass.h + cocos/renderer/frame-graph/DevicePass.cpp + cocos/renderer/frame-graph/DevicePass.h + cocos/renderer/frame-graph/DevicePassResourceTable.cpp + cocos/renderer/frame-graph/DevicePassResourceTable.h + cocos/renderer/frame-graph/FrameGraph.cpp + cocos/renderer/frame-graph/FrameGraph.h + cocos/renderer/frame-graph/Handle.h + cocos/renderer/frame-graph/PassInsertPointManager.cpp + cocos/renderer/frame-graph/PassInsertPointManager.h + cocos/renderer/frame-graph/PassNode.cpp + cocos/renderer/frame-graph/PassNode.h + cocos/renderer/frame-graph/PassNodeBuilder.cpp + cocos/renderer/frame-graph/PassNodeBuilder.h + cocos/renderer/frame-graph/RenderTargetAttachment.h + cocos/renderer/frame-graph/Resource.h + cocos/renderer/frame-graph/ResourceAllocator.h + cocos/renderer/frame-graph/ResourceEntry.h + cocos/renderer/frame-graph/ResourceNode.h + cocos/renderer/frame-graph/VirtualResource.cpp + cocos/renderer/frame-graph/VirtualResource.h +) + +##### physics + +if(USE_PHYSICS_PHYSX) + cocos_source_files( + cocos/physics/PhysicsSDK.h + cocos/physics/PhysicsSelector.h + cocos/physics/sdk/World.h + cocos/physics/sdk/World.cpp + cocos/physics/sdk/Shape.h + cocos/physics/sdk/Shape.cpp + cocos/physics/sdk/RigidBody.h + cocos/physics/sdk/RigidBody.cpp + cocos/physics/sdk/Joint.h + cocos/physics/sdk/Joint.cpp + cocos/physics/spec/IBody.h + cocos/physics/spec/IJoint.h + cocos/physics/spec/ILifecycle.h + cocos/physics/spec/IShape.h + cocos/physics/spec/IWorld.h + cocos/physics/physx/PhysX.h + cocos/physics/physx/PhysXInc.h + cocos/physics/physx/PhysXUtils.h + cocos/physics/physx/PhysXUtils.cpp + cocos/physics/physx/PhysXWorld.h + cocos/physics/physx/PhysXWorld.cpp + cocos/physics/physx/PhysXFilterShader.h + cocos/physics/physx/PhysXFilterShader.cpp + cocos/physics/physx/PhysXEventManager.h + cocos/physics/physx/PhysXEventManager.cpp + cocos/physics/physx/PhysXSharedBody.h + cocos/physics/physx/PhysXSharedBody.cpp + cocos/physics/physx/PhysXRigidBody.h + cocos/physics/physx/PhysXRigidBody.cpp + cocos/physics/physx/shapes/PhysXShape.h + cocos/physics/physx/shapes/PhysXShape.cpp + cocos/physics/physx/shapes/PhysXSphere.h + cocos/physics/physx/shapes/PhysXSphere.cpp + cocos/physics/physx/shapes/PhysXBox.h + cocos/physics/physx/shapes/PhysXBox.cpp + cocos/physics/physx/shapes/PhysXPlane.h + cocos/physics/physx/shapes/PhysXPlane.cpp + cocos/physics/physx/shapes/PhysXCapsule.h + cocos/physics/physx/shapes/PhysXCapsule.cpp + cocos/physics/physx/shapes/PhysXCone.h + cocos/physics/physx/shapes/PhysXCone.cpp + cocos/physics/physx/shapes/PhysXCylinder.h + cocos/physics/physx/shapes/PhysXCylinder.cpp + cocos/physics/physx/shapes/PhysXTerrain.h + cocos/physics/physx/shapes/PhysXTerrain.cpp + cocos/physics/physx/shapes/PhysXTrimesh.h + cocos/physics/physx/shapes/PhysXTrimesh.cpp + cocos/physics/physx/joints/PhysXJoint.h + cocos/physics/physx/joints/PhysXJoint.cpp + cocos/physics/physx/joints/PhysXRevolute.h + cocos/physics/physx/joints/PhysXRevolute.cpp + cocos/physics/physx/joints/PhysXDistance.h + cocos/physics/physx/joints/PhysXDistance.cpp + cocos/bindings/auto/jsb_physics_auto.cpp + cocos/bindings/auto/jsb_physics_auto.h ) endif() ##### script bindings ######## dop cocos_source_files( - cocos/bindings/dop/BufferPool.cpp - cocos/bindings/dop/BufferPool.h - cocos/bindings/dop/ObjectPool.cpp - cocos/bindings/dop/ObjectPool.h - cocos/bindings/dop/jsb_dop.cpp - cocos/bindings/dop/jsb_dop.h - cocos/bindings/dop/PoolType.h - cocos/bindings/dop/BufferAllocator.h - cocos/bindings/dop/BufferAllocator.cpp + NO_WERROR cocos/bindings/dop/BufferPool.cpp + cocos/bindings/dop/BufferPool.h + NO_WERROR cocos/bindings/dop/ObjectPool.cpp + cocos/bindings/dop/ObjectPool.h + NO_WERROR cocos/bindings/dop/jsb_dop.cpp + cocos/bindings/dop/jsb_dop.h + cocos/bindings/dop/PoolType.h + cocos/bindings/dop/BufferAllocator.h + NO_WERROR cocos/bindings/dop/BufferAllocator.cpp ) ######## auto cocos_source_files( - cocos/bindings/auto/jsb_cocos_auto.cpp - cocos/bindings/auto/jsb_cocos_auto.h - cocos/bindings/auto/jsb_extension_auto.cpp - cocos/bindings/auto/jsb_extension_auto.h - cocos/bindings/auto/jsb_gfx_auto.cpp - cocos/bindings/auto/jsb_gfx_auto.h - cocos/bindings/auto/jsb_network_auto.cpp - cocos/bindings/auto/jsb_network_auto.h - cocos/bindings/auto/jsb_pipeline_auto.cpp - cocos/bindings/auto/jsb_pipeline_auto.h + NO_WERROR cocos/bindings/auto/jsb_cocos_auto.cpp + cocos/bindings/auto/jsb_cocos_auto.h + NO_WERROR cocos/bindings/auto/jsb_extension_auto.cpp + cocos/bindings/auto/jsb_extension_auto.h + NO_WERROR cocos/bindings/auto/jsb_gfx_auto.cpp + cocos/bindings/auto/jsb_gfx_auto.h + NO_WERROR cocos/bindings/auto/jsb_network_auto.cpp + cocos/bindings/auto/jsb_network_auto.h + NO_WERROR cocos/bindings/auto/jsb_pipeline_auto.cpp + cocos/bindings/auto/jsb_pipeline_auto.h ) if(USE_AUDIO) cocos_source_files( - cocos/bindings/auto/jsb_audio_auto.cpp - cocos/bindings/auto/jsb_audio_auto.h + NO_WERROR cocos/bindings/auto/jsb_audio_auto.cpp + cocos/bindings/auto/jsb_audio_auto.h ) endif() if(USE_VIDEO) cocos_source_files( - cocos/bindings/auto/jsb_video_auto.cpp - cocos/bindings/auto/jsb_video_auto.h + NO_WERROR cocos/bindings/auto/jsb_video_auto.cpp + cocos/bindings/auto/jsb_video_auto.h ) endif() if(USE_WEBVIEW) cocos_source_files( - cocos/bindings/auto/jsb_webview_auto.cpp - cocos/bindings/auto/jsb_webview_auto.h + NO_WERROR cocos/bindings/auto/jsb_webview_auto.cpp + cocos/bindings/auto/jsb_webview_auto.h ) endif() if(USE_MIDDLEWARE) cocos_source_files( - cocos/editor-support/IOBuffer.cpp - cocos/editor-support/IOBuffer.h - cocos/editor-support/IOTypedArray.cpp - cocos/editor-support/IOTypedArray.h - cocos/editor-support/MeshBuffer.cpp - cocos/editor-support/MeshBuffer.h - cocos/editor-support/middleware-adapter.cpp - cocos/editor-support/middleware-adapter.h - cocos/editor-support/MiddlewareMacro.h - cocos/editor-support/MiddlewareManager.cpp - cocos/editor-support/MiddlewareManager.h - cocos/editor-support/SharedBufferManager.cpp - cocos/editor-support/SharedBufferManager.h - cocos/editor-support/TypedArrayPool.cpp - cocos/editor-support/TypedArrayPool.h - cocos/bindings/auto/jsb_editor_support_auto.cpp - cocos/bindings/auto/jsb_editor_support_auto.h + cocos/editor-support/IOBuffer.cpp + cocos/editor-support/IOBuffer.h + cocos/editor-support/IOTypedArray.cpp + cocos/editor-support/IOTypedArray.h + cocos/editor-support/MeshBuffer.cpp + cocos/editor-support/MeshBuffer.h + cocos/editor-support/middleware-adapter.cpp + cocos/editor-support/middleware-adapter.h + cocos/editor-support/MiddlewareMacro.h + cocos/editor-support/MiddlewareManager.cpp + cocos/editor-support/MiddlewareManager.h + cocos/editor-support/SharedBufferManager.cpp + cocos/editor-support/SharedBufferManager.h + cocos/editor-support/TypedArrayPool.cpp + cocos/editor-support/TypedArrayPool.h + NO_WERROR cocos/bindings/auto/jsb_editor_support_auto.cpp + cocos/bindings/auto/jsb_editor_support_auto.h ) if(USE_SPINE) cocos_source_files( - cocos/editor-support/spine/Animation.cpp - cocos/editor-support/spine/Animation.h - cocos/editor-support/spine/AnimationState.cpp - cocos/editor-support/spine/AnimationState.h - cocos/editor-support/spine/AnimationStateData.cpp - cocos/editor-support/spine/AnimationStateData.h - cocos/editor-support/spine/Atlas.cpp - cocos/editor-support/spine/Atlas.h - cocos/editor-support/spine/AtlasAttachmentLoader.cpp - cocos/editor-support/spine/AtlasAttachmentLoader.h - cocos/editor-support/spine/Attachment.cpp - cocos/editor-support/spine/Attachment.h - cocos/editor-support/spine/AttachmentLoader.cpp - cocos/editor-support/spine/AttachmentLoader.h - cocos/editor-support/spine/AttachmentTimeline.cpp - cocos/editor-support/spine/AttachmentTimeline.h - cocos/editor-support/spine/AttachmentType.h - cocos/editor-support/spine/BlendMode.h - cocos/editor-support/spine/Bone.cpp - cocos/editor-support/spine/Bone.h - cocos/editor-support/spine/BoneData.cpp - cocos/editor-support/spine/BoneData.h - cocos/editor-support/spine/BoundingBoxAttachment.cpp - cocos/editor-support/spine/BoundingBoxAttachment.h - cocos/editor-support/spine/ClippingAttachment.cpp - cocos/editor-support/spine/ClippingAttachment.h - cocos/editor-support/spine/Color.h - cocos/editor-support/spine/ColorTimeline.cpp - cocos/editor-support/spine/ColorTimeline.h - cocos/editor-support/spine/Constraint.cpp - cocos/editor-support/spine/Constraint.h - cocos/editor-support/spine/ConstraintData.cpp - cocos/editor-support/spine/ConstraintData.h - cocos/editor-support/spine/ContainerUtil.h - cocos/editor-support/spine/CurveTimeline.cpp - cocos/editor-support/spine/CurveTimeline.h - cocos/editor-support/spine/Debug.h - cocos/editor-support/spine/DeformTimeline.cpp - cocos/editor-support/spine/DeformTimeline.h - cocos/editor-support/spine/dll.h - cocos/editor-support/spine/DrawOrderTimeline.cpp - cocos/editor-support/spine/DrawOrderTimeline.h - cocos/editor-support/spine/Event.cpp - cocos/editor-support/spine/Event.h - cocos/editor-support/spine/EventData.cpp - cocos/editor-support/spine/EventData.h - cocos/editor-support/spine/EventTimeline.cpp - cocos/editor-support/spine/EventTimeline.h - cocos/editor-support/spine/Extension.cpp - cocos/editor-support/spine/Extension.h - cocos/editor-support/spine/HashMap.h - cocos/editor-support/spine/HasRendererObject.h - cocos/editor-support/spine/IkConstraint.cpp - cocos/editor-support/spine/IkConstraint.h - cocos/editor-support/spine/IkConstraintData.cpp - cocos/editor-support/spine/IkConstraintData.h - cocos/editor-support/spine/IkConstraintTimeline.cpp - cocos/editor-support/spine/IkConstraintTimeline.h - cocos/editor-support/spine/Json.cpp - cocos/editor-support/spine/Json.h - cocos/editor-support/spine/LinkedMesh.cpp - cocos/editor-support/spine/LinkedMesh.h - cocos/editor-support/spine/MathUtil.cpp - cocos/editor-support/spine/MathUtil.h - cocos/editor-support/spine/MeshAttachment.cpp - cocos/editor-support/spine/MeshAttachment.h - cocos/editor-support/spine/MixBlend.h - cocos/editor-support/spine/MixDirection.h - cocos/editor-support/spine/PathAttachment.cpp - cocos/editor-support/spine/PathAttachment.h - cocos/editor-support/spine/PathConstraint.cpp - cocos/editor-support/spine/PathConstraint.h - cocos/editor-support/spine/PathConstraintData.cpp - cocos/editor-support/spine/PathConstraintData.h - cocos/editor-support/spine/PathConstraintMixTimeline.cpp - cocos/editor-support/spine/PathConstraintMixTimeline.h - cocos/editor-support/spine/PathConstraintPositionTimeline.cpp - cocos/editor-support/spine/PathConstraintPositionTimeline.h - cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp - cocos/editor-support/spine/PathConstraintSpacingTimeline.h - cocos/editor-support/spine/PointAttachment.cpp - cocos/editor-support/spine/PointAttachment.h - cocos/editor-support/spine/Pool.h - cocos/editor-support/spine/PositionMode.h - cocos/editor-support/spine/RegionAttachment.cpp - cocos/editor-support/spine/RegionAttachment.h - cocos/editor-support/spine/RotateMode.h - cocos/editor-support/spine/RotateTimeline.cpp - cocos/editor-support/spine/RotateTimeline.h - cocos/editor-support/spine/RTTI.cpp - cocos/editor-support/spine/RTTI.h - cocos/editor-support/spine/ScaleTimeline.cpp - cocos/editor-support/spine/ScaleTimeline.h - cocos/editor-support/spine/ShearTimeline.cpp - cocos/editor-support/spine/ShearTimeline.h - cocos/editor-support/spine/Skeleton.cpp - cocos/editor-support/spine/Skeleton.h - cocos/editor-support/spine/SkeletonBinary.cpp - cocos/editor-support/spine/SkeletonBinary.h - cocos/editor-support/spine/SkeletonBounds.cpp - cocos/editor-support/spine/SkeletonBounds.h - cocos/editor-support/spine/SkeletonClipping.cpp - cocos/editor-support/spine/SkeletonClipping.h - cocos/editor-support/spine/SkeletonData.cpp - cocos/editor-support/spine/SkeletonData.h - cocos/editor-support/spine/SkeletonJson.cpp - cocos/editor-support/spine/SkeletonJson.h - cocos/editor-support/spine/Skin.cpp - cocos/editor-support/spine/Skin.h - cocos/editor-support/spine/Slot.cpp - cocos/editor-support/spine/Slot.h - cocos/editor-support/spine/SlotData.cpp - cocos/editor-support/spine/SlotData.h - cocos/editor-support/spine/SpacingMode.h - cocos/editor-support/spine/spine.h - cocos/editor-support/spine/SpineObject.cpp - cocos/editor-support/spine/SpineObject.h - cocos/editor-support/spine/SpineString.h - cocos/editor-support/spine/TextureLoader.cpp - cocos/editor-support/spine/TextureLoader.h - cocos/editor-support/spine/Timeline.cpp - cocos/editor-support/spine/Timeline.h - cocos/editor-support/spine/TimelineType.h - cocos/editor-support/spine/TransformConstraint.cpp - cocos/editor-support/spine/TransformConstraint.h - cocos/editor-support/spine/TransformConstraintData.cpp - cocos/editor-support/spine/TransformConstraintData.h - cocos/editor-support/spine/TransformConstraintTimeline.cpp - cocos/editor-support/spine/TransformConstraintTimeline.h - cocos/editor-support/spine/TransformMode.h - cocos/editor-support/spine/TranslateTimeline.cpp - cocos/editor-support/spine/TranslateTimeline.h - cocos/editor-support/spine/Triangulator.cpp - cocos/editor-support/spine/Triangulator.h - cocos/editor-support/spine/TwoColorTimeline.cpp - cocos/editor-support/spine/TwoColorTimeline.h - cocos/editor-support/spine/Updatable.cpp - cocos/editor-support/spine/Updatable.h - cocos/editor-support/spine/Vector.h - cocos/editor-support/spine/VertexAttachment.cpp - cocos/editor-support/spine/VertexAttachment.h - cocos/editor-support/spine/VertexEffect.cpp - cocos/editor-support/spine/VertexEffect.h - cocos/editor-support/spine/Vertices.h - cocos/editor-support/spine-creator-support/AttachmentVertices.cpp - cocos/editor-support/spine-creator-support/AttachmentVertices.h - cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp - cocos/editor-support/spine-creator-support/SkeletonAnimation.h - cocos/editor-support/spine-creator-support/SkeletonCache.cpp - cocos/editor-support/spine-creator-support/SkeletonCache.h - cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp - cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h - cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp - cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h - cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp - cocos/editor-support/spine-creator-support/SkeletonDataMgr.h - cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp - cocos/editor-support/spine-creator-support/SkeletonRenderer.h - cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp - cocos/editor-support/spine-creator-support/spine-cocos2dx.h - cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp - cocos/editor-support/spine-creator-support/VertexEffectDelegate.h - cocos/bindings/auto/jsb_spine_auto.cpp - cocos/bindings/auto/jsb_spine_auto.h - cocos/bindings/manual/jsb_spine_manual.cpp - cocos/bindings/manual/jsb_spine_manual.h + NO_WERROR cocos/editor-support/spine/Animation.cpp + cocos/editor-support/spine/Animation.h + NO_WERROR cocos/editor-support/spine/AnimationState.cpp + cocos/editor-support/spine/AnimationState.h + NO_WERROR cocos/editor-support/spine/AnimationStateData.cpp + cocos/editor-support/spine/AnimationStateData.h + NO_WERROR cocos/editor-support/spine/Atlas.cpp + cocos/editor-support/spine/Atlas.h + NO_WERROR cocos/editor-support/spine/AtlasAttachmentLoader.cpp + cocos/editor-support/spine/AtlasAttachmentLoader.h + NO_WERROR cocos/editor-support/spine/Attachment.cpp + cocos/editor-support/spine/Attachment.h + NO_WERROR cocos/editor-support/spine/AttachmentLoader.cpp + cocos/editor-support/spine/AttachmentLoader.h + NO_WERROR cocos/editor-support/spine/AttachmentTimeline.cpp + cocos/editor-support/spine/AttachmentTimeline.h + cocos/editor-support/spine/AttachmentType.h + cocos/editor-support/spine/BlendMode.h + NO_WERROR cocos/editor-support/spine/Bone.cpp + cocos/editor-support/spine/Bone.h + NO_WERROR cocos/editor-support/spine/BoneData.cpp + cocos/editor-support/spine/BoneData.h + NO_WERROR cocos/editor-support/spine/BoundingBoxAttachment.cpp + cocos/editor-support/spine/BoundingBoxAttachment.h + NO_WERROR cocos/editor-support/spine/ClippingAttachment.cpp + cocos/editor-support/spine/ClippingAttachment.h + cocos/editor-support/spine/Color.h + NO_WERROR cocos/editor-support/spine/ColorTimeline.cpp + cocos/editor-support/spine/ColorTimeline.h + NO_WERROR cocos/editor-support/spine/Constraint.cpp + cocos/editor-support/spine/Constraint.h + NO_WERROR cocos/editor-support/spine/ConstraintData.cpp + cocos/editor-support/spine/ConstraintData.h + cocos/editor-support/spine/ContainerUtil.h + NO_WERROR cocos/editor-support/spine/CurveTimeline.cpp + cocos/editor-support/spine/CurveTimeline.h + cocos/editor-support/spine/Debug.h + NO_WERROR cocos/editor-support/spine/DeformTimeline.cpp + cocos/editor-support/spine/DeformTimeline.h + cocos/editor-support/spine/dll.h + NO_WERROR cocos/editor-support/spine/DrawOrderTimeline.cpp + cocos/editor-support/spine/DrawOrderTimeline.h + NO_WERROR cocos/editor-support/spine/Event.cpp + cocos/editor-support/spine/Event.h + NO_WERROR cocos/editor-support/spine/EventData.cpp + cocos/editor-support/spine/EventData.h + NO_WERROR cocos/editor-support/spine/EventTimeline.cpp + cocos/editor-support/spine/EventTimeline.h + NO_WERROR cocos/editor-support/spine/Extension.cpp + cocos/editor-support/spine/Extension.h + cocos/editor-support/spine/HashMap.h + cocos/editor-support/spine/HasRendererObject.h + NO_WERROR cocos/editor-support/spine/IkConstraint.cpp + cocos/editor-support/spine/IkConstraint.h + NO_WERROR cocos/editor-support/spine/IkConstraintData.cpp + cocos/editor-support/spine/IkConstraintData.h + NO_WERROR cocos/editor-support/spine/IkConstraintTimeline.cpp + cocos/editor-support/spine/IkConstraintTimeline.h + NO_WERROR cocos/editor-support/spine/Json.cpp + cocos/editor-support/spine/Json.h + NO_WERROR cocos/editor-support/spine/LinkedMesh.cpp + cocos/editor-support/spine/LinkedMesh.h + NO_WERROR cocos/editor-support/spine/MathUtil.cpp + cocos/editor-support/spine/MathUtil.h + NO_WERROR cocos/editor-support/spine/MeshAttachment.cpp + cocos/editor-support/spine/MeshAttachment.h + cocos/editor-support/spine/MixBlend.h + cocos/editor-support/spine/MixDirection.h + NO_WERROR cocos/editor-support/spine/PathAttachment.cpp + cocos/editor-support/spine/PathAttachment.h + NO_WERROR cocos/editor-support/spine/PathConstraint.cpp + cocos/editor-support/spine/PathConstraint.h + NO_WERROR cocos/editor-support/spine/PathConstraintData.cpp + cocos/editor-support/spine/PathConstraintData.h + NO_WERROR cocos/editor-support/spine/PathConstraintMixTimeline.cpp + cocos/editor-support/spine/PathConstraintMixTimeline.h + NO_WERROR cocos/editor-support/spine/PathConstraintPositionTimeline.cpp + cocos/editor-support/spine/PathConstraintPositionTimeline.h + NO_WERROR cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp + cocos/editor-support/spine/PathConstraintSpacingTimeline.h + NO_WERROR cocos/editor-support/spine/PointAttachment.cpp + cocos/editor-support/spine/PointAttachment.h + cocos/editor-support/spine/Pool.h + cocos/editor-support/spine/PositionMode.h + NO_WERROR cocos/editor-support/spine/RegionAttachment.cpp + cocos/editor-support/spine/RegionAttachment.h + cocos/editor-support/spine/RotateMode.h + NO_WERROR cocos/editor-support/spine/RotateTimeline.cpp + cocos/editor-support/spine/RotateTimeline.h + NO_WERROR cocos/editor-support/spine/RTTI.cpp + cocos/editor-support/spine/RTTI.h + NO_WERROR cocos/editor-support/spine/ScaleTimeline.cpp + cocos/editor-support/spine/ScaleTimeline.h + NO_WERROR cocos/editor-support/spine/ShearTimeline.cpp + cocos/editor-support/spine/ShearTimeline.h + NO_WERROR cocos/editor-support/spine/Skeleton.cpp + cocos/editor-support/spine/Skeleton.h + NO_WERROR cocos/editor-support/spine/SkeletonBinary.cpp + cocos/editor-support/spine/SkeletonBinary.h + NO_WERROR cocos/editor-support/spine/SkeletonBounds.cpp + cocos/editor-support/spine/SkeletonBounds.h + NO_WERROR cocos/editor-support/spine/SkeletonClipping.cpp + cocos/editor-support/spine/SkeletonClipping.h + NO_WERROR cocos/editor-support/spine/SkeletonData.cpp + cocos/editor-support/spine/SkeletonData.h + NO_WERROR cocos/editor-support/spine/SkeletonJson.cpp + cocos/editor-support/spine/SkeletonJson.h + NO_WERROR cocos/editor-support/spine/Skin.cpp + cocos/editor-support/spine/Skin.h + NO_WERROR cocos/editor-support/spine/Slot.cpp + cocos/editor-support/spine/Slot.h + NO_WERROR cocos/editor-support/spine/SlotData.cpp + cocos/editor-support/spine/SlotData.h + cocos/editor-support/spine/SpacingMode.h + cocos/editor-support/spine/spine.h + NO_WERROR cocos/editor-support/spine/SpineObject.cpp + cocos/editor-support/spine/SpineObject.h + cocos/editor-support/spine/SpineString.h + NO_WERROR cocos/editor-support/spine/TextureLoader.cpp + cocos/editor-support/spine/TextureLoader.h + NO_WERROR cocos/editor-support/spine/Timeline.cpp + cocos/editor-support/spine/Timeline.h + cocos/editor-support/spine/TimelineType.h + NO_WERROR cocos/editor-support/spine/TransformConstraint.cpp + cocos/editor-support/spine/TransformConstraint.h + NO_WERROR cocos/editor-support/spine/TransformConstraintData.cpp + cocos/editor-support/spine/TransformConstraintData.h + NO_WERROR cocos/editor-support/spine/TransformConstraintTimeline.cpp + cocos/editor-support/spine/TransformConstraintTimeline.h + cocos/editor-support/spine/TransformMode.h + NO_WERROR cocos/editor-support/spine/TranslateTimeline.cpp + cocos/editor-support/spine/TranslateTimeline.h + NO_WERROR cocos/editor-support/spine/Triangulator.cpp + cocos/editor-support/spine/Triangulator.h + NO_WERROR cocos/editor-support/spine/TwoColorTimeline.cpp + cocos/editor-support/spine/TwoColorTimeline.h + NO_WERROR cocos/editor-support/spine/Updatable.cpp + cocos/editor-support/spine/Updatable.h + cocos/editor-support/spine/Vector.h + NO_WERROR cocos/editor-support/spine/VertexAttachment.cpp + cocos/editor-support/spine/VertexAttachment.h + NO_WERROR cocos/editor-support/spine/VertexEffect.cpp + cocos/editor-support/spine/VertexEffect.h + cocos/editor-support/spine/Vertices.h + NO_WERROR cocos/editor-support/spine-creator-support/AttachmentVertices.cpp + cocos/editor-support/spine-creator-support/AttachmentVertices.h + NO_WERROR cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp + cocos/editor-support/spine-creator-support/SkeletonAnimation.h + NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCache.cpp + cocos/editor-support/spine-creator-support/SkeletonCache.h + NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp + cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h + NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp + cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h + NO_WERROR cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp + cocos/editor-support/spine-creator-support/SkeletonDataMgr.h + NO_WERROR cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp + cocos/editor-support/spine-creator-support/SkeletonRenderer.h + NO_WERROR cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp + cocos/editor-support/spine-creator-support/spine-cocos2dx.h + NO_WERROR cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp + cocos/editor-support/spine-creator-support/VertexEffectDelegate.h + NO_WERROR cocos/bindings/auto/jsb_spine_auto.cpp + cocos/bindings/auto/jsb_spine_auto.h + NO_WERROR cocos/bindings/manual/jsb_spine_manual.cpp + cocos/bindings/manual/jsb_spine_manual.h ) endif() if(USE_DRAGONBONES) cocos_source_files( - cocos/editor-support/dragonbones/DragonBonesHeaders.h - cocos/editor-support/dragonbones/animation/Animation.cpp - cocos/editor-support/dragonbones/animation/Animation.h - cocos/editor-support/dragonbones/animation/AnimationState.cpp - cocos/editor-support/dragonbones/animation/AnimationState.h - cocos/editor-support/dragonbones/animation/BaseTimelineState.cpp - cocos/editor-support/dragonbones/animation/BaseTimelineState.h - cocos/editor-support/dragonbones/animation/IAnimatable.h - cocos/editor-support/dragonbones/animation/TimelineState.cpp - cocos/editor-support/dragonbones/animation/TimelineState.h - cocos/editor-support/dragonbones/animation/WorldClock.cpp - cocos/editor-support/dragonbones/animation/WorldClock.h - cocos/editor-support/dragonbones/armature/Armature.cpp - cocos/editor-support/dragonbones/armature/Armature.h - cocos/editor-support/dragonbones/armature/Bone.cpp - cocos/editor-support/dragonbones/armature/Bone.h - cocos/editor-support/dragonbones/armature/Constraint.cpp - cocos/editor-support/dragonbones/armature/Constraint.h - cocos/editor-support/dragonbones/armature/DeformVertices.cpp - cocos/editor-support/dragonbones/armature/DeformVertices.h - cocos/editor-support/dragonbones/armature/IArmatureProxy.h - cocos/editor-support/dragonbones/armature/Slot.cpp - cocos/editor-support/dragonbones/armature/Slot.h - cocos/editor-support/dragonbones/armature/TransformObject.cpp - cocos/editor-support/dragonbones/armature/TransformObject.h - cocos/editor-support/dragonbones/core/BaseObject.cpp - cocos/editor-support/dragonbones/core/BaseObject.h - cocos/editor-support/dragonbones/core/DragonBones.cpp - cocos/editor-support/dragonbones/core/DragonBones.h - cocos/editor-support/dragonbones/event/EventObject.cpp - cocos/editor-support/dragonbones/event/EventObject.h - cocos/editor-support/dragonbones/event/IEventDispatcher.h - cocos/editor-support/dragonbones/factory/BaseFactory.cpp - cocos/editor-support/dragonbones/factory/BaseFactory.h - cocos/editor-support/dragonbones/geom/ColorTransform.h - cocos/editor-support/dragonbones/geom/Matrix.h - cocos/editor-support/dragonbones/geom/Point.cpp - cocos/editor-support/dragonbones/geom/Point.h - cocos/editor-support/dragonbones/geom/Rectangle.h - cocos/editor-support/dragonbones/geom/Transform.cpp - cocos/editor-support/dragonbones/geom/Transform.h - cocos/editor-support/dragonbones/model/AnimationConfig.cpp - cocos/editor-support/dragonbones/model/AnimationConfig.h - cocos/editor-support/dragonbones/model/AnimationData.cpp - cocos/editor-support/dragonbones/model/AnimationData.h - cocos/editor-support/dragonbones/model/ArmatureData.cpp - cocos/editor-support/dragonbones/model/ArmatureData.h - cocos/editor-support/dragonbones/model/BoundingBoxData.cpp - cocos/editor-support/dragonbones/model/BoundingBoxData.h - cocos/editor-support/dragonbones/model/CanvasData.cpp - cocos/editor-support/dragonbones/model/CanvasData.h - cocos/editor-support/dragonbones/model/ConstraintData.cpp - cocos/editor-support/dragonbones/model/ConstraintData.h - cocos/editor-support/dragonbones/model/DisplayData.cpp - cocos/editor-support/dragonbones/model/DisplayData.h - cocos/editor-support/dragonbones/model/DragonBonesData.cpp - cocos/editor-support/dragonbones/model/DragonBonesData.h - cocos/editor-support/dragonbones/model/SkinData.cpp - cocos/editor-support/dragonbones/model/SkinData.h - cocos/editor-support/dragonbones/model/TextureAtlasData.cpp - cocos/editor-support/dragonbones/model/TextureAtlasData.h - cocos/editor-support/dragonbones/model/UserData.cpp - cocos/editor-support/dragonbones/model/UserData.h - cocos/editor-support/dragonbones/parser/BinaryDataParser.cpp - cocos/editor-support/dragonbones/parser/BinaryDataParser.h - cocos/editor-support/dragonbones/parser/DataParser.cpp - cocos/editor-support/dragonbones/parser/DataParser.h - cocos/editor-support/dragonbones/parser/JSONDataParser.cpp - cocos/editor-support/dragonbones/parser/JSONDataParser.h - cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp - cocos/editor-support/dragonbones-creator-support/ArmatureCache.h - cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp - cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h - cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp - cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h - cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp - cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h - cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h - cocos/editor-support/dragonbones-creator-support/CCFactory.cpp - cocos/editor-support/dragonbones-creator-support/CCFactory.h - cocos/editor-support/dragonbones-creator-support/CCSlot.cpp - cocos/editor-support/dragonbones-creator-support/CCSlot.h - cocos/editor-support/dragonbones-creator-support/CCTextureAtlasData.cpp - cocos/editor-support/dragonbones-creator-support/CCTextureAtlasData.h - cocos/bindings/auto/jsb_dragonbones_auto.cpp - cocos/bindings/auto/jsb_dragonbones_auto.h - cocos/bindings/manual/jsb_dragonbones_manual.cpp - cocos/bindings/manual/jsb_dragonbones_manual.h + cocos/editor-support/dragonbones/DragonBonesHeaders.h + NO_WERROR cocos/editor-support/dragonbones/animation/Animation.cpp + cocos/editor-support/dragonbones/animation/Animation.h + NO_WERROR cocos/editor-support/dragonbones/animation/AnimationState.cpp + cocos/editor-support/dragonbones/animation/AnimationState.h + NO_WERROR cocos/editor-support/dragonbones/animation/BaseTimelineState.cpp + cocos/editor-support/dragonbones/animation/BaseTimelineState.h + cocos/editor-support/dragonbones/animation/IAnimatable.h + NO_WERROR cocos/editor-support/dragonbones/animation/TimelineState.cpp + cocos/editor-support/dragonbones/animation/TimelineState.h + NO_WERROR cocos/editor-support/dragonbones/animation/WorldClock.cpp + cocos/editor-support/dragonbones/animation/WorldClock.h + NO_WERROR cocos/editor-support/dragonbones/armature/Armature.cpp + cocos/editor-support/dragonbones/armature/Armature.h + NO_WERROR cocos/editor-support/dragonbones/armature/Bone.cpp + cocos/editor-support/dragonbones/armature/Bone.h + NO_WERROR cocos/editor-support/dragonbones/armature/Constraint.cpp + cocos/editor-support/dragonbones/armature/Constraint.h + NO_WERROR cocos/editor-support/dragonbones/armature/DeformVertices.cpp + cocos/editor-support/dragonbones/armature/DeformVertices.h + cocos/editor-support/dragonbones/armature/IArmatureProxy.h + NO_WERROR cocos/editor-support/dragonbones/armature/Slot.cpp + cocos/editor-support/dragonbones/armature/Slot.h + NO_WERROR cocos/editor-support/dragonbones/armature/TransformObject.cpp + cocos/editor-support/dragonbones/armature/TransformObject.h + NO_WERROR cocos/editor-support/dragonbones/core/BaseObject.cpp + cocos/editor-support/dragonbones/core/BaseObject.h + NO_WERROR cocos/editor-support/dragonbones/core/DragonBones.cpp + cocos/editor-support/dragonbones/core/DragonBones.h + NO_WERROR cocos/editor-support/dragonbones/event/EventObject.cpp + cocos/editor-support/dragonbones/event/EventObject.h + cocos/editor-support/dragonbones/event/IEventDispatcher.h + NO_WERROR cocos/editor-support/dragonbones/factory/BaseFactory.cpp + cocos/editor-support/dragonbones/factory/BaseFactory.h + cocos/editor-support/dragonbones/geom/ColorTransform.h + cocos/editor-support/dragonbones/geom/Matrix.h + NO_WERROR cocos/editor-support/dragonbones/geom/Point.cpp + cocos/editor-support/dragonbones/geom/Point.h + cocos/editor-support/dragonbones/geom/Rectangle.h + NO_WERROR cocos/editor-support/dragonbones/geom/Transform.cpp + cocos/editor-support/dragonbones/geom/Transform.h + NO_WERROR cocos/editor-support/dragonbones/model/AnimationConfig.cpp + cocos/editor-support/dragonbones/model/AnimationConfig.h + NO_WERROR cocos/editor-support/dragonbones/model/AnimationData.cpp + cocos/editor-support/dragonbones/model/AnimationData.h + NO_WERROR cocos/editor-support/dragonbones/model/ArmatureData.cpp + cocos/editor-support/dragonbones/model/ArmatureData.h + NO_WERROR cocos/editor-support/dragonbones/model/BoundingBoxData.cpp + cocos/editor-support/dragonbones/model/BoundingBoxData.h + NO_WERROR cocos/editor-support/dragonbones/model/CanvasData.cpp + cocos/editor-support/dragonbones/model/CanvasData.h + NO_WERROR cocos/editor-support/dragonbones/model/ConstraintData.cpp + cocos/editor-support/dragonbones/model/ConstraintData.h + NO_WERROR cocos/editor-support/dragonbones/model/DisplayData.cpp + cocos/editor-support/dragonbones/model/DisplayData.h + NO_WERROR cocos/editor-support/dragonbones/model/DragonBonesData.cpp + cocos/editor-support/dragonbones/model/DragonBonesData.h + NO_WERROR cocos/editor-support/dragonbones/model/SkinData.cpp + cocos/editor-support/dragonbones/model/SkinData.h + NO_WERROR cocos/editor-support/dragonbones/model/TextureAtlasData.cpp + cocos/editor-support/dragonbones/model/TextureAtlasData.h + NO_WERROR cocos/editor-support/dragonbones/model/UserData.cpp + cocos/editor-support/dragonbones/model/UserData.h + NO_WERROR cocos/editor-support/dragonbones/parser/BinaryDataParser.cpp + cocos/editor-support/dragonbones/parser/BinaryDataParser.h + NO_WERROR cocos/editor-support/dragonbones/parser/DataParser.cpp + cocos/editor-support/dragonbones/parser/DataParser.h + NO_WERROR cocos/editor-support/dragonbones/parser/JSONDataParser.cpp + cocos/editor-support/dragonbones/parser/JSONDataParser.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/ArmatureCache.cpp + cocos/editor-support/dragonbones-creator-support/ArmatureCache.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.cpp + cocos/editor-support/dragonbones-creator-support/ArmatureCacheMgr.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp + cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp + cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.h + cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/CCFactory.cpp + cocos/editor-support/dragonbones-creator-support/CCFactory.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/CCSlot.cpp + cocos/editor-support/dragonbones-creator-support/CCSlot.h + NO_WERROR cocos/editor-support/dragonbones-creator-support/CCTextureAtlasData.cpp + cocos/editor-support/dragonbones-creator-support/CCTextureAtlasData.h + NO_WERROR cocos/bindings/auto/jsb_dragonbones_auto.cpp + cocos/bindings/auto/jsb_dragonbones_auto.h + NO_WERROR cocos/bindings/manual/jsb_dragonbones_manual.cpp + cocos/bindings/manual/jsb_dragonbones_manual.h ) endif() endif() ######## manual cocos_source_files( - cocos/bindings/manual/jsb_classtype.cpp - cocos/bindings/manual/jsb_classtype.h - #cocos/bindings/manual/jsb_extension_manual.cpp - #cocos/bindings/manual/jsb_extension_manual.h - cocos/bindings/manual/jsb_cocos_manual.cpp - cocos/bindings/manual/jsb_cocos_manual.h - cocos/bindings/manual/jsb_conversions.cpp - cocos/bindings/manual/jsb_conversions.h - cocos/bindings/manual/jsb_gfx_manual.cpp - cocos/bindings/manual/jsb_gfx_manual.h - cocos/bindings/manual/jsb_global.cpp - cocos/bindings/manual/jsb_global.h - cocos/bindings/manual/jsb_helper.cpp - cocos/bindings/manual/jsb_helper.h - cocos/bindings/manual/jsb_module_register.h - cocos/bindings/manual/jsb_platform.h - cocos/bindings/manual/jsb_network_manual.cpp - cocos/bindings/manual/jsb_network_manual.h - cocos/bindings/manual/jsb_xmlhttprequest.cpp - cocos/bindings/manual/jsb_xmlhttprequest.h - cocos/bindings/manual/jsb_pipeline_manual.h - cocos/bindings/manual/jsb_pipeline_manual.cpp + NO_WERROR cocos/bindings/manual/jsb_classtype.cpp + cocos/bindings/manual/jsb_classtype.h + #NO_WERROR cocos/bindings/manual/jsb_extension_manual.cpp + #cocos/bindings/manual/jsb_extension_manual.h + NO_WERROR cocos/bindings/manual/jsb_cocos_manual.cpp + cocos/bindings/manual/jsb_cocos_manual.h + NO_WERROR cocos/bindings/manual/jsb_conversions.cpp + cocos/bindings/manual/jsb_conversions.h + NO_WERROR cocos/bindings/manual/jsb_gfx_manual.cpp + cocos/bindings/manual/jsb_gfx_manual.h + NO_WERROR cocos/bindings/manual/jsb_global.cpp + cocos/bindings/manual/jsb_global.h + NO_WERROR cocos/bindings/manual/jsb_global_init.cpp + cocos/bindings/manual/jsb_global_init.h + NO_WERROR cocos/bindings/manual/jsb_helper.cpp + cocos/bindings/manual/jsb_helper.h + cocos/bindings/manual/jsb_module_register.h + cocos/bindings/manual/jsb_platform.h + NO_WERROR cocos/bindings/manual/jsb_network_manual.cpp + cocos/bindings/manual/jsb_network_manual.h + NO_WERROR cocos/bindings/manual/jsb_xmlhttprequest.cpp + cocos/bindings/manual/jsb_xmlhttprequest.h + cocos/bindings/manual/jsb_pipeline_manual.h + NO_WERROR cocos/bindings/manual/jsb_pipeline_manual.cpp ) if(USE_SOCKET) cocos_source_files( - cocos/bindings/manual/jsb_socketio.cpp - cocos/bindings/manual/jsb_socketio.h - cocos/bindings/manual/jsb_websocket.cpp - cocos/bindings/manual/jsb_websocket.h + NO_WERROR cocos/bindings/manual/jsb_socketio.cpp + cocos/bindings/manual/jsb_socketio.h + NO_WERROR cocos/bindings/manual/jsb_websocket.cpp + cocos/bindings/manual/jsb_websocket.h ) endif() if(NOT IOS AND USE_WEBSOCKET_SERVER) cocos_source_files( - cocos/bindings/manual/jsb_websocket_server.cpp - cocos/bindings/manual/jsb_websocket_server.h + NO_WERROR cocos/bindings/manual/jsb_websocket_server.cpp + cocos/bindings/manual/jsb_websocket_server.h ) endif() if(ANDROID) cocos_source_files( - cocos/bindings/manual/jsb_platform_android.cpp - cocos/bindings/manual/JavaScriptJavaBridge.cpp - cocos/bindings/manual/JavaScriptJavaBridge.h + cocos/bindings/manual/jsb_platform_android.cpp + cocos/bindings/manual/JavaScriptJavaBridge.cpp + cocos/bindings/manual/JavaScriptJavaBridge.h ) elseif(APPLE) cocos_source_files( - cocos/bindings/manual/jsb_platfrom_apple.mm - cocos/bindings/manual/JavaScriptObjCBridge.h - cocos/bindings/manual/JavaScriptObjCBridge.mm + NO_WERROR cocos/bindings/manual/jsb_platfrom_apple.mm + cocos/bindings/manual/JavaScriptObjCBridge.h + NO_WERROR cocos/bindings/manual/JavaScriptObjCBridge.mm ) elseif(WIN32) cocos_source_files( - cocos/bindings/manual/jsb_platfrom_win32.cpp - ) -endif() - -if(CC_USE_GLES2) - cocos_source_files( - cocos/bindings/auto/jsb_gles2_auto.h - cocos/bindings/auto/jsb_gles2_auto.cpp - ) -endif() - -if(CC_USE_GLES3) - cocos_source_files( - cocos/bindings/auto/jsb_gles3_auto.h - cocos/bindings/auto/jsb_gles3_auto.cpp - ) -endif() - -if(CC_USE_METAL) - cocos_source_files( - cocos/bindings/auto/jsb_mtl_auto.h - cocos/bindings/auto/jsb_mtl_auto.cpp - ) -endif() - -if(CC_USE_VULKAN) - cocos_source_files( - cocos/bindings/auto/jsb_vk_auto.h - cocos/bindings/auto/jsb_vk_auto.cpp + NO_WERROR cocos/bindings/manual/jsb_platfrom_win32.cpp ) endif() if(USE_SE_V8) cocos_source_files( - cocos/bindings/jswrapper/v8/Base.h - cocos/bindings/jswrapper/v8/Class.cpp - cocos/bindings/jswrapper/v8/Class.h - cocos/bindings/jswrapper/v8/HelperMacros.h - cocos/bindings/jswrapper/v8/Object.cpp - cocos/bindings/jswrapper/v8/Object.h - cocos/bindings/jswrapper/v8/ObjectWrap.cpp - cocos/bindings/jswrapper/v8/ObjectWrap.h - cocos/bindings/jswrapper/v8/ScriptEngine.cpp - cocos/bindings/jswrapper/v8/ScriptEngine.h - cocos/bindings/jswrapper/v8/SeApi.h - cocos/bindings/jswrapper/v8/Utils.cpp - cocos/bindings/jswrapper/v8/Utils.h + cocos/bindings/jswrapper/v8/Base.h + cocos/bindings/jswrapper/v8/Class.cpp + cocos/bindings/jswrapper/v8/Class.h + cocos/bindings/jswrapper/v8/HelperMacros.h + cocos/bindings/jswrapper/v8/Object.cpp + cocos/bindings/jswrapper/v8/Object.h + cocos/bindings/jswrapper/v8/ObjectWrap.cpp + cocos/bindings/jswrapper/v8/ObjectWrap.h + cocos/bindings/jswrapper/v8/ScriptEngine.cpp + cocos/bindings/jswrapper/v8/ScriptEngine.h + cocos/bindings/jswrapper/v8/SeApi.h + cocos/bindings/jswrapper/v8/Utils.cpp + cocos/bindings/jswrapper/v8/Utils.h ) if(USE_V8_DEBUGGER) cocos_source_files( - cocos/bindings/jswrapper/v8/debugger/base64.h - cocos/bindings/jswrapper/v8/debugger/env.cpp - cocos/bindings/jswrapper/v8/debugger/env.h - cocos/bindings/jswrapper/v8/debugger/http_parser.c - cocos/bindings/jswrapper/v8/debugger/http_parser.h - cocos/bindings/jswrapper/v8/debugger/inspector_agent.cpp - cocos/bindings/jswrapper/v8/debugger/inspector_agent.h - cocos/bindings/jswrapper/v8/debugger/inspector_io.cpp - cocos/bindings/jswrapper/v8/debugger/inspector_io.h - cocos/bindings/jswrapper/v8/debugger/inspector_socket.cpp - cocos/bindings/jswrapper/v8/debugger/inspector_socket.h - cocos/bindings/jswrapper/v8/debugger/inspector_socket_server.cpp - cocos/bindings/jswrapper/v8/debugger/inspector_socket_server.h - cocos/bindings/jswrapper/v8/debugger/node.cpp - cocos/bindings/jswrapper/v8/debugger/node.h - cocos/bindings/jswrapper/v8/debugger/node_debug_options.cpp - cocos/bindings/jswrapper/v8/debugger/node_debug_options.h - cocos/bindings/jswrapper/v8/debugger/node_mutex.h - cocos/bindings/jswrapper/v8/debugger/SHA1.cpp - cocos/bindings/jswrapper/v8/debugger/SHA1.h - cocos/bindings/jswrapper/v8/debugger/util-inl.h - cocos/bindings/jswrapper/v8/debugger/util.cpp - cocos/bindings/jswrapper/v8/debugger/util.h - cocos/bindings/jswrapper/v8/debugger/v8_inspector_protocol_json.h + cocos/bindings/jswrapper/v8/debugger/base64.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/env.cpp + cocos/bindings/jswrapper/v8/debugger/env.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/http_parser.c + cocos/bindings/jswrapper/v8/debugger/http_parser.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/inspector_agent.cpp + cocos/bindings/jswrapper/v8/debugger/inspector_agent.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/inspector_io.cpp + cocos/bindings/jswrapper/v8/debugger/inspector_io.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/inspector_socket.cpp + cocos/bindings/jswrapper/v8/debugger/inspector_socket.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/inspector_socket_server.cpp + cocos/bindings/jswrapper/v8/debugger/inspector_socket_server.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/node.cpp + cocos/bindings/jswrapper/v8/debugger/node.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/node_debug_options.cpp + cocos/bindings/jswrapper/v8/debugger/node_debug_options.h + cocos/bindings/jswrapper/v8/debugger/node_mutex.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/SHA1.cpp + cocos/bindings/jswrapper/v8/debugger/SHA1.h + cocos/bindings/jswrapper/v8/debugger/util-inl.h + NO_WERROR cocos/bindings/jswrapper/v8/debugger/util.cpp + cocos/bindings/jswrapper/v8/debugger/util.h + cocos/bindings/jswrapper/v8/debugger/v8_inspector_protocol_json.h ) endif() endif() if(USE_SE_JSC) cocos_source_files( - cocos/bindings/jswrapper/jsc/Class.h - cocos/bindings/jswrapper/jsc/EJConvert.h - cocos/bindings/jswrapper/jsc/HelperMacros.h - cocos/bindings/jswrapper/jsc/Utils.cpp - cocos/bindings/jswrapper/jsc/EJConvertTypedArray.h - cocos/bindings/jswrapper/jsc/PlatformUtils.h - cocos/bindings/jswrapper/jsc/EJConvertTypedArray.m - cocos/bindings/jswrapper/jsc/EJConvert.m - cocos/bindings/jswrapper/jsc/Object.h - cocos/bindings/jswrapper/jsc/Object.mm - cocos/bindings/jswrapper/jsc/ScriptEngine.h - cocos/bindings/jswrapper/jsc/ScriptEngine.mm - cocos/bindings/jswrapper/jsc/PlatformUtils.mm - cocos/bindings/jswrapper/jsc/SeApi.h - cocos/bindings/jswrapper/jsc/Class.cpp - cocos/bindings/jswrapper/jsc/Utils.h - cocos/bindings/jswrapper/jsc/Base.h + cocos/bindings/jswrapper/jsc/Class.h + cocos/bindings/jswrapper/jsc/EJConvert.h + cocos/bindings/jswrapper/jsc/HelperMacros.h + NO_WERROR cocos/bindings/jswrapper/jsc/Utils.cpp + cocos/bindings/jswrapper/jsc/EJConvertTypedArray.h + cocos/bindings/jswrapper/jsc/PlatformUtils.h + NO_WERROR cocos/bindings/jswrapper/jsc/EJConvertTypedArray.m + NO_WERROR cocos/bindings/jswrapper/jsc/EJConvert.m + cocos/bindings/jswrapper/jsc/Object.h + NO_WERROR cocos/bindings/jswrapper/jsc/Object.mm + cocos/bindings/jswrapper/jsc/ScriptEngine.h + NO_WERROR cocos/bindings/jswrapper/jsc/ScriptEngine.mm + NO_WERROR cocos/bindings/jswrapper/jsc/PlatformUtils.mm + cocos/bindings/jswrapper/jsc/SeApi.h + NO_WERROR cocos/bindings/jswrapper/jsc/Class.cpp + cocos/bindings/jswrapper/jsc/Utils.h + cocos/bindings/jswrapper/jsc/Base.h ) endif() cocos_source_files( - cocos/bindings/jswrapper/config.cpp - cocos/bindings/jswrapper/config.h - cocos/bindings/jswrapper/HandleObject.cpp - cocos/bindings/jswrapper/HandleObject.h - cocos/bindings/jswrapper/MappingUtils.cpp - cocos/bindings/jswrapper/MappingUtils.h - cocos/bindings/jswrapper/Object.h - cocos/bindings/jswrapper/RefCounter.cpp - cocos/bindings/jswrapper/RefCounter.h - cocos/bindings/jswrapper/SeApi.h - cocos/bindings/jswrapper/State.cpp - cocos/bindings/jswrapper/State.h - cocos/bindings/jswrapper/Value.cpp - cocos/bindings/jswrapper/Value.h + cocos/bindings/jswrapper/config.cpp + cocos/bindings/jswrapper/config.h + cocos/bindings/jswrapper/HandleObject.cpp + cocos/bindings/jswrapper/HandleObject.h + cocos/bindings/jswrapper/MappingUtils.cpp + cocos/bindings/jswrapper/MappingUtils.h + cocos/bindings/jswrapper/Object.h + cocos/bindings/jswrapper/RefCounter.cpp + cocos/bindings/jswrapper/RefCounter.h + cocos/bindings/jswrapper/SeApi.h + cocos/bindings/jswrapper/State.cpp + cocos/bindings/jswrapper/State.h + cocos/bindings/jswrapper/Value.cpp + cocos/bindings/jswrapper/Value.h ) cocos_source_files( - cocos/bindings/event/CustomEventTypes.h - cocos/bindings/event/EventDispatcher.cpp - cocos/bindings/event/EventDispatcher.h + cocos/bindings/event/CustomEventTypes.h + cocos/bindings/event/EventDispatcher.cpp + cocos/bindings/event/EventDispatcher.h ) #### storage cocos_source_files( - cocos/storage/local-storage/LocalStorage.cpp - cocos/storage/local-storage/LocalStorage.h + cocos/storage/local-storage/LocalStorage.cpp + cocos/storage/local-storage/LocalStorage.h ) if(ANDROID) cocos_source_files( - cocos/storage/local-storage/LocalStorage-android.cpp + cocos/storage/local-storage/LocalStorage-android.cpp ) endif() #### ui if(USE_EDIT_BOX) cocos_source_files( - cocos/ui/edit-box/EditBox.h + cocos/ui/edit-box/EditBox.h ) endif() if(ANDROID OR IOS) if(USE_VIDEO) cocos_source_files( - cocos/ui/videoplayer/VideoPlayer.h + cocos/ui/videoplayer/VideoPlayer.h ) endif() if(USE_WEBVIEW) cocos_source_files( - cocos/ui/webview/WebViewImpl-android.h - cocos/ui/webview/WebViewImpl-ios.h - cocos/ui/webview/WebView-inl.h - cocos/ui/webview/WebView.h + cocos/ui/webview/WebViewImpl-android.h + cocos/ui/webview/WebViewImpl-ios.h + cocos/ui/webview/WebView-inl.h + cocos/ui/webview/WebView.h ) endif() endif() @@ -1391,45 +1650,45 @@ endif() if(ANDROID) if(USE_EDIT_BOX) cocos_source_files( - cocos/ui/edit-box/EditBox-android.cpp + cocos/ui/edit-box/EditBox-android.cpp ) endif() if(USE_VIDEO) cocos_source_files( - cocos/ui/videoplayer/VideoPlayer-android.cpp + cocos/ui/videoplayer/VideoPlayer-android.cpp ) endif() if(USE_WEBVIEW) cocos_source_files( - cocos/ui/webview/WebViewImpl-android.cpp + cocos/ui/webview/WebViewImpl-android.cpp ) endif() elseif(MACOSX) if(USE_EDIT_BOX) cocos_source_files( - cocos/ui/edit-box/EditBox-mac.mm + cocos/ui/edit-box/EditBox-mac.mm ) endif() elseif(IOS) if(USE_EDIT_BOX) cocos_source_files( - cocos/ui/edit-box/EditBox-ios.mm + cocos/ui/edit-box/EditBox-ios.mm ) endif() if(USE_VIDEO) cocos_source_files( - cocos/ui/videoplayer/VideoPlayer-ios.mm + cocos/ui/videoplayer/VideoPlayer-ios.mm ) endif() if(USE_WEBVIEW) cocos_source_files( - cocos/ui/webview/WebViewImpl-ios.mm + NO_WERROR cocos/ui/webview/WebViewImpl-ios.mm ) endif() elseif(WIN32) if(USE_EDIT_BOX) cocos_source_files( - cocos/ui/edit-box/EditBox-win32.cpp + NO_WERROR cocos/ui/edit-box/EditBox-win32.cpp ) endif() endif() @@ -1437,24 +1696,25 @@ endif() ##### extensions cocos_source_files( - extensions/assets-manager/AssetsManagerEx.cpp - extensions/assets-manager/AssetsManagerEx.h - extensions/assets-manager/AsyncTaskPool.cpp - extensions/assets-manager/AsyncTaskPool.h - extensions/assets-manager/EventAssetsManagerEx.cpp - extensions/assets-manager/EventAssetsManagerEx.h - extensions/assets-manager/Manifest.cpp - extensions/assets-manager/Manifest.h - extensions/cocos-ext.h - extensions/ExtensionExport.h - extensions/ExtensionMacros.h + NO_WERROR extensions/assets-manager/AssetsManagerEx.cpp + extensions/assets-manager/AssetsManagerEx.h + NO_WERROR extensions/assets-manager/AsyncTaskPool.cpp + extensions/assets-manager/AsyncTaskPool.h + NO_WERROR extensions/assets-manager/EventAssetsManagerEx.cpp + extensions/assets-manager/EventAssetsManagerEx.h + NO_WERROR extensions/assets-manager/Manifest.cpp + extensions/assets-manager/Manifest.h + extensions/cocos-ext.h + extensions/ExtensionExport.h + extensions/ExtensionMacros.h ) -list(APPEND COCOS2D_SOURCE_LIST ${CC_EXTERNAL_SROUCES}) +list(APPEND COCOS2D_SOURCE_LIST ${CC_EXTERNAL_SOURCES}) add_library(cocos2d ${COCOS2D_SOURCE_LIST}) if(ANDROID) + enable_werror("${CC_JNI_SRC_FILES}") add_library(cocos2d_jni STATIC ${CC_JNI_SRC_FILES}) target_include_directories(cocos2d_jni PUBLIC ${CWD} @@ -1479,6 +1739,7 @@ target_compile_definitions(cocos2d PUBLIC $,USE_MIDDLEWARE=1,USE_MIDDLEWARE=0> $,USE_SPINE=1,USE_SPINE=0> $,USE_DRAGONBONES=1,USE_DRAGONBONES=0> + $,USE_PHYSICS_PHYSX=1,USE_PHYSICS_PHYSX=0> $<$:SCRIPT_ENGINE_TYPE=3> $<$:CC_DEBUG=1> ) @@ -1520,7 +1781,6 @@ target_include_directories(cocos2d ${CWD}/cocos ${CWD}/cocos/renderer ${CWD}/cocos/platform - ${CWD}/cocos/renderer/core ${CWD}/external/sources/khronos ${CWD}/cocos/editor-support $<$:${CWD}/cocos/bindings/jswrapper> @@ -1528,9 +1788,14 @@ target_include_directories(cocos2d ${CC_EXTERNAL_PRIVATE_INCLUDES} ) +target_compile_definitions(cocos2d + PRIVATE + ${CC_EXTERNAL_PRIVATE_DEFINITIONS} +) + if(WIN32) target_link_libraries(cocos2d PUBLIC - ws2_32 userenv psapi winmm Version Iphlpapi opengl32 + ws2_32 userenv psapi winmm Iphlpapi ${CC_EXTERNAL_LIBS} ) @@ -1547,10 +1812,13 @@ if(WIN32) _USRLIBSIMSTATIC SE_ENABLE_INSPECTOR ) - endif() if(ANDROID) + target_compile_options(cocos2d PRIVATE + -Wno-comment # nested block comments are actually useful sometimes + ) + find_library(LIB_EGL NAMES EGL) find_library(LIB_GLESv2 NAMES GLESv2) target_link_libraries(cocos2d PUBLIC @@ -1581,7 +1849,8 @@ if(APPLE) "-framework GameController" "-framework Metal" "-framework MetalKit" - "-lsqlite3" + "-framework QuartzCore" + "-lSQLite3" "-framework Security" "-framework SystemConfiguration" ${CC_EXTERNAL_LIBS} diff --git a/native/README.md b/native/README.md index eb7a6cf499..426f901cad 100644 --- a/native/README.md +++ b/native/README.md @@ -8,7 +8,7 @@ It is the native backend of [Cocos Creator](https://www.cocos.com/en/creator). I Coding format and coding style --------------------------------- -The coding format file is `.clang-format`, and the coding style fomat file is `.clang-tidy`. Please use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to format the codes and use [clang-tidy](http://clang.llvm.org/extra/index.html) to fix the coding style before commiting codes. +The coding format file is `.clang-format`, and the coding style fomat file is `.clang-tidy`. Please use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to format the codes and use [clang-tidy](http://clang.llvm.org/extra/index.html) to fix the coding style before commiting codes. See the [linter auto-fix guide](docs/LINTER_AUTOFIX_GUIDE.md) for more information. Documentations -------------------------------- diff --git a/native/cocos/audio/AudioEngine.cpp b/native/cocos/audio/AudioEngine.cpp index 90802a70fb..6226a3d17a 100644 --- a/native/cocos/audio/AudioEngine.cpp +++ b/native/cocos/audio/AudioEngine.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "audio/include/AudioEngine.h" #include "platform/FileUtils.h" #include "base/Utils.h" diff --git a/native/cocos/audio/android/AudioEngine-inl.cpp b/native/cocos/audio/android/AudioEngine-inl.cpp index 9433362bed..53dd8788d5 100644 --- a/native/cocos/audio/android/AudioEngine-inl.cpp +++ b/native/cocos/audio/android/AudioEngine-inl.cpp @@ -40,6 +40,7 @@ #include "platform/Application.h" #include "base/Scheduler.h" #include "base/UTF8.h" +#include "base/Log.h" #include "platform/android/FileUtils-android.h" #include "platform/android/jni/JniImp.h" #include "platform/android/jni/JniHelper.h" diff --git a/native/cocos/audio/android/AudioPlayerProvider.cpp b/native/cocos/audio/android/AudioPlayerProvider.cpp index bbedabfa73..aa8190d44a 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.cpp +++ b/native/cocos/audio/android/AudioPlayerProvider.cpp @@ -73,7 +73,7 @@ AudioPlayerProvider::AudioPlayerProvider(SLEngineItf engineItf, SLObjectItf outp int deviceSampleRate, int bufferSizeInFrames, const FdGetterCallback &fdGetterCallback, ICallerThreadUtils *callerThreadUtils) -: _engineItf(engineItf), _outputMixObject(outputMixObject), _deviceSampleRate(deviceSampleRate), _bufferSizeInFrames(bufferSizeInFrames), _fdGetterCallback(fdGetterCallback), _callerThreadUtils(callerThreadUtils), _pcmAudioService(nullptr), _mixController(nullptr), _threadPool(ThreadPool::newCachedThreadPool(1, 8, 5, 2, 2)) { +: _engineItf(engineItf), _outputMixObject(outputMixObject), _deviceSampleRate(deviceSampleRate), _bufferSizeInFrames(bufferSizeInFrames), _fdGetterCallback(fdGetterCallback), _callerThreadUtils(callerThreadUtils), _pcmAudioService(nullptr), _mixController(nullptr), _threadPool(LegacyThreadPool::newCachedThreadPool(1, 8, 5, 2, 2)) { ALOGI("deviceSampleRate: %d, bufferSizeInFrames: %d", _deviceSampleRate, _bufferSizeInFrames); if (getSystemAPILevel() >= 17) { _mixController = new (std::nothrow) AudioMixerController(_bufferSizeInFrames, _deviceSampleRate, 2); diff --git a/native/cocos/audio/android/AudioPlayerProvider.h b/native/cocos/audio/android/AudioPlayerProvider.h index af223dcf02..e737d2d72e 100644 --- a/native/cocos/audio/android/AudioPlayerProvider.h +++ b/native/cocos/audio/android/AudioPlayerProvider.h @@ -42,7 +42,7 @@ class UrlAudioPlayer; class AudioMixerController; class ICallerThreadUtils; class AssetFd; -class ThreadPool; +class LegacyThreadPool; class AudioPlayerProvider { public: @@ -116,7 +116,7 @@ private: PcmAudioService *_pcmAudioService; AudioMixerController *_mixController; - ThreadPool *_threadPool; + LegacyThreadPool *_threadPool; }; } // namespace cc diff --git a/native/cocos/audio/apple/AudioCache.h b/native/cocos/audio/apple/AudioCache.h index 149d7b3598..29135e5937 100644 --- a/native/cocos/audio/apple/AudioCache.h +++ b/native/cocos/audio/apple/AudioCache.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #import diff --git a/native/cocos/audio/apple/AudioCache.mm b/native/cocos/audio/apple/AudioCache.mm index 514cda632b..86d8b1b8a5 100644 --- a/native/cocos/audio/apple/AudioCache.mm +++ b/native/cocos/audio/apple/AudioCache.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 LOG_TAG "AudioCache" #include "audio/apple/AudioCache.h" diff --git a/native/cocos/audio/apple/AudioDecoder.h b/native/cocos/audio/apple/AudioDecoder.h index dec97aa83a..d543d5e515 100644 --- a/native/cocos/audio/apple/AudioDecoder.h +++ b/native/cocos/audio/apple/AudioDecoder.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/audio/apple/AudioDecoder.mm b/native/cocos/audio/apple/AudioDecoder.mm index f9bb3ab333..583f0ed41f 100644 --- a/native/cocos/audio/apple/AudioDecoder.mm +++ b/native/cocos/audio/apple/AudioDecoder.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 "audio/apple/AudioDecoder.h" #include "audio/apple/AudioMacros.h" diff --git a/native/cocos/audio/apple/AudioEngine-inl.h b/native/cocos/audio/apple/AudioEngine-inl.h index 84400114c5..9a4b734af4 100644 --- a/native/cocos/audio/apple/AudioEngine-inl.h +++ b/native/cocos/audio/apple/AudioEngine-inl.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 __AUDIO_ENGINE_INL_H_ #define __AUDIO_ENGINE_INL_H_ diff --git a/native/cocos/audio/apple/AudioEngine-inl.mm b/native/cocos/audio/apple/AudioEngine-inl.mm index 40b3e8b602..2a692d310b 100644 --- a/native/cocos/audio/apple/AudioEngine-inl.mm +++ b/native/cocos/audio/apple/AudioEngine-inl.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 LOG_TAG "AudioEngine-inl.mm" #include "audio/apple/AudioEngine-inl.h" diff --git a/native/cocos/audio/apple/AudioMacros.h b/native/cocos/audio/apple/AudioMacros.h index a5ed9f9493..4a62904707 100644 --- a/native/cocos/audio/apple/AudioMacros.h +++ b/native/cocos/audio/apple/AudioMacros.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #define QUEUEBUFFER_NUM (3) diff --git a/native/cocos/audio/apple/AudioPlayer.h b/native/cocos/audio/apple/AudioPlayer.h index 5e6fe7ed04..e0646e59bf 100644 --- a/native/cocos/audio/apple/AudioPlayer.h +++ b/native/cocos/audio/apple/AudioPlayer.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "base/Macros.h" diff --git a/native/cocos/audio/apple/AudioPlayer.mm b/native/cocos/audio/apple/AudioPlayer.mm index 1520b5a3ff..37f2f99e23 100644 --- a/native/cocos/audio/apple/AudioPlayer.mm +++ b/native/cocos/audio/apple/AudioPlayer.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 LOG_TAG "AudioPlayer" #import diff --git a/native/cocos/audio/include/AudioEngine.h b/native/cocos/audio/include/AudioEngine.h index 63c615ef01..206df41c22 100644 --- a/native/cocos/audio/include/AudioEngine.h +++ b/native/cocos/audio/include/AudioEngine.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/audio/include/Export.h b/native/cocos/audio/include/Export.h index 099b8a1a15..a76ced08da 100644 --- a/native/cocos/audio/include/Export.h +++ b/native/cocos/audio/include/Export.h @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __EXPORT_COMMON__ #define __EXPORT_COMMON__ diff --git a/native/cocos/audio/win32/AudioCache.cpp b/native/cocos/audio/win32/AudioCache.cpp index 964c5749e7..5341387637 100644 --- a/native/cocos/audio/win32/AudioCache.cpp +++ b/native/cocos/audio/win32/AudioCache.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 LOG_TAG "AudioCache" #include "audio/win32/AudioCache.h" @@ -51,7 +53,7 @@ unsigned int __idIndex = 0; using namespace cc; AudioCache::AudioCache() -: _totalFrames(0), _framesRead(0), _format(-1), _duration(0.0f), _alBufferId(INVALID_AL_BUFFER_ID), _pcmData(nullptr), _queBufferFrames(0), _state(State::INITIAL), _isDestroyed(std::make_shared(false)), _id(++__idIndex), _isLoadingFinished(false), _isSkipReadDataTask(false) { +: _format(-1), _sampleRate(0), _duration(0.0f), _totalFrames(0), _framesRead(0), _alBufferId(INVALID_AL_BUFFER_ID), _pcmData(nullptr), _queBufferFrames(0), _state(State::INITIAL), _isDestroyed(std::make_shared(false)), _id(++__idIndex), _isLoadingFinished(false), _isSkipReadDataTask(false) { ALOGVV("AudioCache() %p, id=%u", this, _id); for (int i = 0; i < QUEUEBUFFER_NUM; ++i) { _queBuffers[i] = nullptr; @@ -159,6 +161,8 @@ void AudioCache::readDataTask(unsigned int selfId) { BREAK_IF_ERR_LOG(!decoder->seek(0), "AudioDecoder::seek(0) failed!"); _pcmData = (char *)malloc(dataSize); + + CC_ASSERT(_pcmData); memset(_pcmData, 0x00, dataSize); if (adjustFrames > 0) { @@ -209,7 +213,7 @@ void AudioCache::readDataTask(unsigned int selfId) { _state = State::READY; } else { - _queBufferFrames = sampleRate * QUEUEBUFFER_TIME_STEP; + _queBufferFrames = static_cast(sampleRate * QUEUEBUFFER_TIME_STEP); BREAK_IF_ERR_LOG(_queBufferFrames == 0, "_queBufferFrames == 0"); const uint32_t queBufferBytes = _queBufferFrames * bytesPerFrame; diff --git a/native/cocos/audio/win32/AudioCache.h b/native/cocos/audio/win32/AudioCache.h index af87b10e34..5f8e4d4408 100644 --- a/native/cocos/audio/win32/AudioCache.h +++ b/native/cocos/audio/win32/AudioCache.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/audio/win32/AudioDecoder.cpp b/native/cocos/audio/win32/AudioDecoder.cpp index 73ae63f8f9..a5af94a6ed 100644 --- a/native/cocos/audio/win32/AudioDecoder.cpp +++ b/native/cocos/audio/win32/AudioDecoder.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "audio/win32/AudioDecoder.h" #include "audio/win32/AudioMacros.h" #include "platform/FileUtils.h" diff --git a/native/cocos/audio/win32/AudioDecoder.h b/native/cocos/audio/win32/AudioDecoder.h index 5880f38ecd..69ba19c285 100644 --- a/native/cocos/audio/win32/AudioDecoder.h +++ b/native/cocos/audio/win32/AudioDecoder.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/audio/win32/AudioDecoderManager.cpp b/native/cocos/audio/win32/AudioDecoderManager.cpp index b7ed37d466..7cc0a752b7 100644 --- a/native/cocos/audio/win32/AudioDecoderManager.cpp +++ b/native/cocos/audio/win32/AudioDecoderManager.cpp @@ -1,27 +1,29 @@ /**************************************************************************** -Copyright (c) 2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 LOG_TAG "AudioDecoderManager" #include "audio/win32/AudioDecoderManager.h" diff --git a/native/cocos/audio/win32/AudioDecoderManager.h b/native/cocos/audio/win32/AudioDecoderManager.h index 858ab107c4..f14ceaeea0 100644 --- a/native/cocos/audio/win32/AudioDecoderManager.h +++ b/native/cocos/audio/win32/AudioDecoderManager.h @@ -1,27 +1,29 @@ /**************************************************************************** -Copyright (c) 2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once namespace cc { diff --git a/native/cocos/audio/win32/AudioDecoderMp3.cpp b/native/cocos/audio/win32/AudioDecoderMp3.cpp index cc8231b17a..5101bea81e 100644 --- a/native/cocos/audio/win32/AudioDecoderMp3.cpp +++ b/native/cocos/audio/win32/AudioDecoderMp3.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "audio/win32/AudioDecoderMp3.h" #include "audio/win32/AudioMacros.h" #include "platform/FileUtils.h" diff --git a/native/cocos/audio/win32/AudioDecoderMp3.h b/native/cocos/audio/win32/AudioDecoderMp3.h index a00b0afa44..21a903be5f 100644 --- a/native/cocos/audio/win32/AudioDecoderMp3.h +++ b/native/cocos/audio/win32/AudioDecoderMp3.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "audio/win32/AudioDecoder.h" diff --git a/native/cocos/audio/win32/AudioDecoderOgg.cpp b/native/cocos/audio/win32/AudioDecoderOgg.cpp index bdc795c1a8..4830182337 100644 --- a/native/cocos/audio/win32/AudioDecoderOgg.cpp +++ b/native/cocos/audio/win32/AudioDecoderOgg.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "audio/win32/AudioDecoderOgg.h" #include "audio/win32/AudioMacros.h" #include "platform/FileUtils.h" diff --git a/native/cocos/audio/win32/AudioDecoderOgg.h b/native/cocos/audio/win32/AudioDecoderOgg.h index 658e7c8043..74dbe95c04 100644 --- a/native/cocos/audio/win32/AudioDecoderOgg.h +++ b/native/cocos/audio/win32/AudioDecoderOgg.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "audio/win32/AudioDecoder.h" diff --git a/native/cocos/audio/win32/AudioEngine-win32.cpp b/native/cocos/audio/win32/AudioEngine-win32.cpp index 15b72b76ec..8a5021a95e 100644 --- a/native/cocos/audio/win32/AudioEngine-win32.cpp +++ b/native/cocos/audio/win32/AudioEngine-win32.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 LOG_TAG "AudioEngine-Win32" #include "audio/win32/AudioEngine-win32.h" diff --git a/native/cocos/audio/win32/AudioEngine-win32.h b/native/cocos/audio/win32/AudioEngine-win32.h index 434f973812..cc67e2d9ce 100644 --- a/native/cocos/audio/win32/AudioEngine-win32.h +++ b/native/cocos/audio/win32/AudioEngine-win32.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/audio/win32/AudioMacros.h b/native/cocos/audio/win32/AudioMacros.h index 33bbf612f9..1ac8704df2 100644 --- a/native/cocos/audio/win32/AudioMacros.h +++ b/native/cocos/audio/win32/AudioMacros.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #define QUEUEBUFFER_NUM (3) diff --git a/native/cocos/audio/win32/AudioPlayer.cpp b/native/cocos/audio/win32/AudioPlayer.cpp index 061f8f33c2..1d47aae0d0 100644 --- a/native/cocos/audio/win32/AudioPlayer.cpp +++ b/native/cocos/audio/win32/AudioPlayer.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 LOG_TAG "AudioPlayer" @@ -234,7 +235,7 @@ void AudioPlayer::rotateBufferThread(int offsetFrame) { bufferProcessed--; if (_timeDirty) { _timeDirty = false; - offsetFrame = _currTime * decoder->getSampleRate(); + offsetFrame = static_cast(_currTime * decoder->getSampleRate()); decoder->seek(offsetFrame); } else { _currTime += QUEUEBUFFER_TIME_STEP; diff --git a/native/cocos/audio/win32/AudioPlayer.h b/native/cocos/audio/win32/AudioPlayer.h index 9490a60ad8..b2e438c6f4 100644 --- a/native/cocos/audio/win32/AudioPlayer.h +++ b/native/cocos/audio/win32/AudioPlayer.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/base/Agent.h b/native/cocos/base/Agent.h new file mode 100644 index 0000000000..f7d7f2eb40 --- /dev/null +++ b/native/cocos/base/Agent.h @@ -0,0 +1,57 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Macros.h" +#include + +namespace cc { + +template +class CC_DLL Agent : public Actor { +public: + Agent() noexcept = delete; + + explicit Agent(Actor *const actor) noexcept + : Actor(), _actor(actor) {} + + ~Agent() override {} + + Agent(Agent const &) = delete; + + Agent(Agent &&) = delete; + + Agent &operator=(Agent const &) = delete; + + Agent &operator=(Agent &&) = delete; + + inline Actor *getActor() const noexcept { return _actor; } + +protected: + Actor *_actor{nullptr}; +}; + +} // namespace cc diff --git a/native/cocos/base/Array.cpp b/native/cocos/base/Array.cpp deleted file mode 100644 index d226264a82..0000000000 --- a/native/cocos/base/Array.cpp +++ /dev/null @@ -1,403 +0,0 @@ -/**************************************************************************** -Copyright (c) 2007 Scott Lembcke -Copyright (c) 2010-2012 cocos2d-x.org -CopyRight (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "base/Log.h" -#include "base/Array.h" - -namespace cc { - -/** Allocates and initializes a new array with specified capacity */ -ccArray *ccArrayNew(ssize_t capacity) { - if (capacity == 0) - capacity = 7; - - ccArray *arr = (ccArray *)malloc(sizeof(ccArray)); - arr->num = 0; - arr->arr = (Ref **)calloc(capacity, sizeof(Ref *)); - arr->max = capacity; - - return arr; -} - -/** Frees array after removing all remaining objects. Silently ignores nullptr arr. */ -void ccArrayFree(ccArray *&arr) { - if (arr == nullptr) { - return; - } - ccArrayRemoveAllObjects(arr); - - free(arr->arr); - free(arr); - - arr = nullptr; -} - -void ccArrayDoubleCapacity(ccArray *arr) { - arr->max *= 2; - Ref **newArr = (Ref **)realloc(arr->arr, arr->max * sizeof(Ref *)); - // will fail when there's not enough memory - CCASSERT(newArr != 0, "ccArrayDoubleCapacity failed. Not enough memory"); - arr->arr = newArr; -} - -void ccArrayEnsureExtraCapacity(ccArray *arr, ssize_t extra) { - while (arr->max < arr->num + extra) { - CC_LOG_INFO("ccCArray: resizing ccArray capacity from [%d] to [%d].", - static_cast(arr->max), - static_cast(arr->max * 2)); - - ccArrayDoubleCapacity(arr); - } -} - -void ccArrayShrink(ccArray *arr) { - ssize_t newSize = 0; - - //only resize when necessary - if (arr->max > arr->num && !(arr->num == 0 && arr->max == 1)) { - if (arr->num != 0) { - newSize = arr->num; - arr->max = arr->num; - } else { //minimum capacity of 1, with 0 elements the array would be free'd by realloc - newSize = 1; - arr->max = 1; - } - - arr->arr = (Ref **)realloc(arr->arr, newSize * sizeof(Ref *)); - CCASSERT(arr->arr != nullptr, "could not reallocate the memory"); - } -} - -/** Returns index of first occurrence of object, -1 if object not found. */ -ssize_t ccArrayGetIndexOfObject(ccArray *arr, Ref *object) { - const auto arrNum = arr->num; - Ref **ptr = arr->arr; - for (ssize_t i = 0; i < arrNum; ++i, ++ptr) { - if (*ptr == object) - return i; - } - - return -1; -} - -/** Returns a Boolean value that indicates whether object is present in array. */ -bool ccArrayContainsObject(ccArray *arr, Ref *object) { - return ccArrayGetIndexOfObject(arr, object) != -1; -} - -/** Appends an object. Behavior undefined if array doesn't have enough capacity. */ -void ccArrayAppendObject(ccArray *arr, Ref *object) { - CCASSERT(object != nullptr, "Invalid parameter!"); - object->retain(); - arr->arr[arr->num] = object; - arr->num++; -} - -/** Appends an object. Capacity of arr is increased if needed. */ -void ccArrayAppendObjectWithResize(ccArray *arr, Ref *object) { - ccArrayEnsureExtraCapacity(arr, 1); - ccArrayAppendObject(arr, object); -} - -/** Appends objects from plusArr to arr. Behavior undefined if arr doesn't have - enough capacity. */ -void ccArrayAppendArray(ccArray *arr, ccArray *plusArr) { - for (ssize_t i = 0; i < plusArr->num; i++) { - ccArrayAppendObject(arr, plusArr->arr[i]); - } -} - -/** Appends objects from plusArr to arr. Capacity of arr is increased if needed. */ -void ccArrayAppendArrayWithResize(ccArray *arr, ccArray *plusArr) { - ccArrayEnsureExtraCapacity(arr, plusArr->num); - ccArrayAppendArray(arr, plusArr); -} - -/** Inserts an object at index */ -void ccArrayInsertObjectAtIndex(ccArray *arr, Ref *object, ssize_t index) { - CCASSERT(index <= arr->num, "Invalid index. Out of bounds"); - CCASSERT(object != nullptr, "Invalid parameter!"); - - ccArrayEnsureExtraCapacity(arr, 1); - - ssize_t remaining = arr->num - index; - if (remaining > 0) { - memmove((void *)&arr->arr[index + 1], (void *)&arr->arr[index], sizeof(Ref *) * remaining); - } - - object->retain(); - arr->arr[index] = object; - arr->num++; -} - -/** Swaps two objects */ -void ccArraySwapObjectsAtIndexes(ccArray *arr, ssize_t index1, ssize_t index2) { - CCASSERT(index1 >= 0 && index1 < arr->num, "(1) Invalid index. Out of bounds"); - CCASSERT(index2 >= 0 && index2 < arr->num, "(2) Invalid index. Out of bounds"); - - Ref *object1 = arr->arr[index1]; - - arr->arr[index1] = arr->arr[index2]; - arr->arr[index2] = object1; -} - -/** Removes all objects from arr */ -void ccArrayRemoveAllObjects(ccArray *arr) { - while (arr->num > 0) { - (arr->arr[--arr->num])->release(); - } -} - -/** Removes object at specified index and pushes back all subsequent objects. - Behavior undefined if index outside [0, num-1]. */ -void ccArrayRemoveObjectAtIndex(ccArray *arr, ssize_t index, bool releaseObj /* = true*/) { - CCASSERT(arr && arr->num > 0 && index >= 0 && index < arr->num, "Invalid index. Out of bounds"); - if (releaseObj) { - CC_SAFE_RELEASE(arr->arr[index]); - } - - arr->num--; - - ssize_t remaining = arr->num - index; - if (remaining > 0) { - memmove((void *)&arr->arr[index], (void *)&arr->arr[index + 1], remaining * sizeof(Ref *)); - } -} - -/** Removes object at specified index and fills the gap with the last object, - thereby avoiding the need to push back subsequent objects. - Behavior undefined if index outside [0, num-1]. */ -void ccArrayFastRemoveObjectAtIndex(ccArray *arr, ssize_t index) { - CC_SAFE_RELEASE(arr->arr[index]); - auto last = --arr->num; - arr->arr[index] = arr->arr[last]; -} - -void ccArrayFastRemoveObject(ccArray *arr, Ref *object) { - auto index = ccArrayGetIndexOfObject(arr, object); - if (index != -1) { - ccArrayFastRemoveObjectAtIndex(arr, index); - } -} - -/** Searches for the first occurrence of object and removes it. If object is not - found the function has no effect. */ -void ccArrayRemoveObject(ccArray *arr, Ref *object, bool releaseObj /* = true*/) { - auto index = ccArrayGetIndexOfObject(arr, object); - if (index != -1) { - ccArrayRemoveObjectAtIndex(arr, index, releaseObj); - } -} - -/** Removes from arr all objects in minusArr. For each object in minusArr, the - first matching instance in arr will be removed. */ -void ccArrayRemoveArray(ccArray *arr, ccArray *minusArr) { - for (ssize_t i = 0; i < minusArr->num; i++) { - ccArrayRemoveObject(arr, minusArr->arr[i]); - } -} - -/** Removes from arr all objects in minusArr. For each object in minusArr, all - matching instances in arr will be removed. */ -void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr) { - ssize_t back = 0; - - for (ssize_t i = 0; i < arr->num; i++) { - if (ccArrayContainsObject(minusArr, arr->arr[i])) { - CC_SAFE_RELEASE(arr->arr[i]); - back++; - } else { - arr->arr[i - back] = arr->arr[i]; - } - } - - arr->num -= back; -} - -// -// // ccCArray for Values (c structures) - -/** Allocates and initializes a new C array with specified capacity */ -ccCArray *ccCArrayNew(ssize_t capacity) { - if (capacity == 0) { - capacity = 7; - } - - ccCArray *arr = (ccCArray *)malloc(sizeof(ccCArray)); - arr->num = 0; - arr->arr = (void **)malloc(capacity * sizeof(void *)); - arr->max = capacity; - - return arr; -} - -/** Frees C array after removing all remaining values. Silently ignores nullptr arr. */ -void ccCArrayFree(ccCArray *arr) { - if (arr == nullptr) { - return; - } - ccCArrayRemoveAllValues(arr); - - free(arr->arr); - free(arr); -} - -/** Doubles C array capacity */ -void ccCArrayDoubleCapacity(ccCArray *arr) { - ccArrayDoubleCapacity((ccArray *)arr); -} - -/** Increases array capacity such that max >= num + extra. */ -void ccCArrayEnsureExtraCapacity(ccCArray *arr, ssize_t extra) { - ccArrayEnsureExtraCapacity((ccArray *)arr, extra); -} - -/** Returns index of first occurrence of value, -1 if value not found. */ -ssize_t ccCArrayGetIndexOfValue(ccCArray *arr, void *value) { - for (ssize_t i = 0; i < arr->num; i++) { - if (arr->arr[i] == value) - return i; - } - return -1; -} - -/** Returns a Boolean value that indicates whether value is present in the C array. */ -bool ccCArrayContainsValue(ccCArray *arr, void *value) { - return ccCArrayGetIndexOfValue(arr, value) != -1; -} - -/** Inserts a value at a certain position. Behavior undefined if array doesn't have enough capacity */ -void ccCArrayInsertValueAtIndex(ccCArray *arr, void *value, ssize_t index) { - CCASSERT(index < arr->max, "ccCArrayInsertValueAtIndex: invalid index"); - - auto remaining = arr->num - index; - // make sure it has enough capacity - if (arr->num + 1 == arr->max) { - ccCArrayDoubleCapacity(arr); - } - // last Value doesn't need to be moved - if (remaining > 0) { - // tex coordinates - memmove((void *)&arr->arr[index + 1], (void *)&arr->arr[index], sizeof(void *) * remaining); - } - - arr->num++; - arr->arr[index] = value; -} - -/** Appends an value. Behavior undefined if array doesn't have enough capacity. */ -void ccCArrayAppendValue(ccCArray *arr, void *value) { - arr->arr[arr->num] = value; - arr->num++; - // double the capacity for the next append action - // if the num >= max - if (arr->num >= arr->max) { - ccCArrayDoubleCapacity(arr); - } -} - -/** Appends an value. Capacity of arr is increased if needed. */ -void ccCArrayAppendValueWithResize(ccCArray *arr, void *value) { - ccCArrayEnsureExtraCapacity(arr, 1); - ccCArrayAppendValue(arr, value); -} - -/** Appends values from plusArr to arr. Behavior undefined if arr doesn't have - enough capacity. */ -void ccCArrayAppendArray(ccCArray *arr, ccCArray *plusArr) { - for (ssize_t i = 0; i < plusArr->num; i++) { - ccCArrayAppendValue(arr, plusArr->arr[i]); - } -} - -/** Appends values from plusArr to arr. Capacity of arr is increased if needed. */ -void ccCArrayAppendArrayWithResize(ccCArray *arr, ccCArray *plusArr) { - ccCArrayEnsureExtraCapacity(arr, plusArr->num); - ccCArrayAppendArray(arr, plusArr); -} - -/** Removes all values from arr */ -void ccCArrayRemoveAllValues(ccCArray *arr) { - arr->num = 0; -} - -/** Removes value at specified index and pushes back all subsequent values. - Behavior undefined if index outside [0, num-1]. - @since v0.99.4 - */ -void ccCArrayRemoveValueAtIndex(ccCArray *arr, ssize_t index) { - for (ssize_t last = --arr->num; index < last; index++) { - arr->arr[index] = arr->arr[index + 1]; - } -} - -/** Removes value at specified index and fills the gap with the last value, - thereby avoiding the need to push back subsequent values. - Behavior undefined if index outside [0, num-1]. - @since v0.99.4 - */ -void ccCArrayFastRemoveValueAtIndex(ccCArray *arr, ssize_t index) { - ssize_t last = --arr->num; - arr->arr[index] = arr->arr[last]; -} - -/** Searches for the first occurrence of value and removes it. If value is not found the function has no effect. - @since v0.99.4 - */ -void ccCArrayRemoveValue(ccCArray *arr, void *value) { - auto index = ccCArrayGetIndexOfValue(arr, value); - if (index != -1) { - ccCArrayRemoveValueAtIndex(arr, index); - } -} - -/** Removes from arr all values in minusArr. For each Value in minusArr, the first matching instance in arr will be removed. - @since v0.99.4 - */ -void ccCArrayRemoveArray(ccCArray *arr, ccCArray *minusArr) { - for (ssize_t i = 0; i < minusArr->num; i++) { - ccCArrayRemoveValue(arr, minusArr->arr[i]); - } -} - -/** Removes from arr all values in minusArr. For each value in minusArr, all matching instances in arr will be removed. - @since v0.99.4 - */ -void ccCArrayFullRemoveArray(ccCArray *arr, ccCArray *minusArr) { - ssize_t back = 0; - - for (ssize_t i = 0; i < arr->num; i++) { - if (ccCArrayContainsValue(minusArr, arr->arr[i])) { - back++; - } else { - arr->arr[i - back] = arr->arr[i]; - } - } - - arr->num -= back; -} - -} // namespace cc diff --git a/native/cocos/base/Array.h b/native/cocos/base/Array.h deleted file mode 100644 index d5019a65e7..0000000000 --- a/native/cocos/base/Array.h +++ /dev/null @@ -1,209 +0,0 @@ -/**************************************************************************** -Copyright (c) 2007 Scott Lembcke -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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. -****************************************************************************/ - -/** - @file - based on Chipmunk cpArray. - ccArray is a faster alternative to NSMutableArray, it does pretty much the - same thing (stores NSObjects and retains/releases them appropriately). It's - faster because: - - it uses a plain C interface so it doesn't incur Objective-c messaging overhead - - it assumes you know what you're doing, so it doesn't spend time on safety checks - (index out of bounds, required capacity etc.) - - comparisons are done using pointer equality instead of isEqual - - There are 2 kind of functions: - - ccArray functions that manipulates objective-c objects (retain and release are performed) - - ccCArray functions that manipulates values like if they were standard C structures (no retain/release is performed) - */ - -#ifndef CC_ARRAY_H -#define CC_ARRAY_H -/// @cond DO_NOT_SHOW - -#include "base/Macros.h" -#include "base/Ref.h" - -#include -#include -#include - -namespace cc { - -// Easy integration -#define CCARRAYDATA_FOREACH(__array__, __object__) \ - __object__ = __array__->arr[0]; \ - for (ssize_t i = 0, num = __array__->num; i < num; i++, __object__ = __array__->arr[i]) - -typedef struct _ccArray { - ssize_t num, max; - Ref **arr; -} ccArray; - -/** Allocates and initializes a new array with specified capacity */ -ccArray *ccArrayNew(ssize_t capacity); - -/** Frees array after removing all remaining objects. Silently ignores nil arr. */ -void ccArrayFree(ccArray *&arr); - -/** Doubles array capacity */ -void ccArrayDoubleCapacity(ccArray *arr); - -/** Increases array capacity such that max >= num + extra. */ -void ccArrayEnsureExtraCapacity(ccArray *arr, ssize_t extra); - -/** shrinks the array so the memory footprint corresponds with the number of items */ -void ccArrayShrink(ccArray *arr); - -/** Returns index of first occurrence of object, NSNotFound if object not found. */ -ssize_t ccArrayGetIndexOfObject(ccArray *arr, Ref *object); - -/** Returns a Boolean value that indicates whether object is present in array. */ -bool ccArrayContainsObject(ccArray *arr, Ref *object); - -/** Appends an object. Behavior undefined if array doesn't have enough capacity. */ -void ccArrayAppendObject(ccArray *arr, Ref *object); - -/** Appends an object. Capacity of arr is increased if needed. */ -void ccArrayAppendObjectWithResize(ccArray *arr, Ref *object); - -/** Appends objects from plusArr to arr. - Behavior undefined if arr doesn't have enough capacity. */ -void ccArrayAppendArray(ccArray *arr, ccArray *plusArr); - -/** Appends objects from plusArr to arr. Capacity of arr is increased if needed. */ -void ccArrayAppendArrayWithResize(ccArray *arr, ccArray *plusArr); - -/** Inserts an object at index */ -void ccArrayInsertObjectAtIndex(ccArray *arr, Ref *object, ssize_t index); - -/** Swaps two objects */ -void ccArraySwapObjectsAtIndexes(ccArray *arr, ssize_t index1, ssize_t index2); - -/** Removes all objects from arr */ -void ccArrayRemoveAllObjects(ccArray *arr); - -/** Removes object at specified index and pushes back all subsequent objects. - Behavior undefined if index outside [0, num-1]. */ -void ccArrayRemoveObjectAtIndex(ccArray *arr, ssize_t index, bool releaseObj = true); - -/** Removes object at specified index and fills the gap with the last object, - thereby avoiding the need to push back subsequent objects. - Behavior undefined if index outside [0, num-1]. */ -void ccArrayFastRemoveObjectAtIndex(ccArray *arr, ssize_t index); - -void ccArrayFastRemoveObject(ccArray *arr, Ref *object); - -/** Searches for the first occurrence of object and removes it. If object is not - found the function has no effect. */ -void ccArrayRemoveObject(ccArray *arr, Ref *object, bool releaseObj = true); - -/** Removes from arr all objects in minusArr. For each object in minusArr, the - first matching instance in arr will be removed. */ -void ccArrayRemoveArray(ccArray *arr, ccArray *minusArr); - -/** Removes from arr all objects in minusArr. For each object in minusArr, all - matching instances in arr will be removed. */ -void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr); - -// -// // ccCArray for Values (c structures) - -typedef struct _ccCArray { - ssize_t num, max; - void **arr; -} ccCArray; - -/** Allocates and initializes a new C array with specified capacity */ -ccCArray *ccCArrayNew(ssize_t capacity); - -/** Frees C array after removing all remaining values. Silently ignores nil arr. */ -void ccCArrayFree(ccCArray *arr); - -/** Doubles C array capacity */ -void ccCArrayDoubleCapacity(ccCArray *arr); - -/** Increases array capacity such that max >= num + extra. */ -void ccCArrayEnsureExtraCapacity(ccCArray *arr, ssize_t extra); - -/** Returns index of first occurrence of value, NSNotFound if value not found. */ -ssize_t ccCArrayGetIndexOfValue(ccCArray *arr, void *value); - -/** Returns a Boolean value that indicates whether value is present in the C array. */ -bool ccCArrayContainsValue(ccCArray *arr, void *value); - -/** Inserts a value at a certain position. Behavior undefined if array doesn't have enough capacity */ -void ccCArrayInsertValueAtIndex(ccCArray *arr, void *value, ssize_t index); - -/** Appends an value. Behavior undefined if array doesn't have enough capacity. */ -void ccCArrayAppendValue(ccCArray *arr, void *value); - -/** Appends an value. Capacity of arr is increased if needed. */ -void ccCArrayAppendValueWithResize(ccCArray *arr, void *value); - -/** Appends values from plusArr to arr. Behavior undefined if arr doesn't have - enough capacity. */ -void ccCArrayAppendArray(ccCArray *arr, ccCArray *plusArr); - -/** Appends values from plusArr to arr. Capacity of arr is increased if needed. */ -void ccCArrayAppendArrayWithResize(ccCArray *arr, ccCArray *plusArr); - -/** Removes all values from arr */ -void ccCArrayRemoveAllValues(ccCArray *arr); - -/** Removes value at specified index and pushes back all subsequent values. - Behavior undefined if index outside [0, num-1]. - @since v0.99.4 - */ -void ccCArrayRemoveValueAtIndex(ccCArray *arr, ssize_t index); - -/** Removes value at specified index and fills the gap with the last value, - thereby avoiding the need to push back subsequent values. - Behavior undefined if index outside [0, num-1]. - @since v0.99.4 - */ -void ccCArrayFastRemoveValueAtIndex(ccCArray *arr, ssize_t index); - -/** Searches for the first occurrence of value and removes it. If value is not found the function has no effect. - @since v0.99.4 - */ -void ccCArrayRemoveValue(ccCArray *arr, void *value); - -/** Removes from arr all values in minusArr. For each Value in minusArr, the first matching instance in arr will be removed. - @since v0.99.4 - */ -void ccCArrayRemoveArray(ccCArray *arr, ccCArray *minusArr); - -/** Removes from arr all values in minusArr. For each value in minusArr, all matching instances in arr will be removed. - @since v0.99.4 - */ -void ccCArrayFullRemoveArray(ccCArray *arr, ccCArray *minusArr); - -} // namespace cc - -/// @endcond -#endif // CC_ARRAY_H diff --git a/native/cocos/base/AutoreleasePool.cpp b/native/cocos/base/AutoreleasePool.cpp index a92897dd19..a9baa10957 100644 --- a/native/cocos/base/AutoreleasePool.cpp +++ b/native/cocos/base/AutoreleasePool.cpp @@ -1,46 +1,46 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "base/AutoreleasePool.h" #include "base/Log.h" namespace cc { AutoreleasePool::AutoreleasePool() -: _name("") #if defined(CC_DEBUG) && (CC_DEBUG > 0) - , - _isClearing(false) +: _isClearing(false) #endif { _managedObjectArray.reserve(150); PoolManager::getInstance()->push(this); } -AutoreleasePool::AutoreleasePool(const std::string &name) -: _name(name) +AutoreleasePool::AutoreleasePool(std::string name) +: _name(std::move(name)) #if defined(CC_DEBUG) && (CC_DEBUG > 0) , _isClearing(false) @@ -77,8 +77,9 @@ void AutoreleasePool::clear() { bool AutoreleasePool::contains(Ref *object) const { for (const auto &obj : _managedObjectArray) { - if (obj == object) + if (obj == object) { return true; + } } return false; } @@ -98,20 +99,19 @@ void AutoreleasePool::dump() { // //-------------------------------------------------------------------- -PoolManager *PoolManager::s_singleInstance = nullptr; +PoolManager *PoolManager::_singleInstance = nullptr; PoolManager *PoolManager::getInstance() { - if (s_singleInstance == nullptr) { - s_singleInstance = new (std::nothrow) PoolManager(); - // Add the first auto release pool - new (std::nothrow) AutoreleasePool("autorelease pool"); + if (_singleInstance == nullptr) { + _singleInstance = new (std::nothrow) PoolManager(); + _singleInstance->push(new AutoreleasePool()); } - return s_singleInstance; + return _singleInstance; } void PoolManager::destroyInstance() { - delete s_singleInstance; - s_singleInstance = nullptr; + delete _singleInstance; + _singleInstance = nullptr; } PoolManager::PoolManager() { @@ -129,13 +129,17 @@ PoolManager::~PoolManager() { } AutoreleasePool *PoolManager::getCurrentPool() const { + if (_releasePoolStack.empty()) { + return nullptr; + } return _releasePoolStack.back(); } bool PoolManager::isObjectInPools(Ref *obj) const { for (const auto &pool : _releasePoolStack) { - if (pool->contains(obj)) + if (pool->contains(obj)) { return true; + } } return false; } diff --git a/native/cocos/base/AutoreleasePool.h b/native/cocos/base/AutoreleasePool.h index fd527c96b7..52dd657cf9 100644 --- a/native/cocos/base/AutoreleasePool.h +++ b/native/cocos/base/AutoreleasePool.h @@ -1,68 +1,56 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __AUTORELEASEPOOL_H__ -#define __AUTORELEASEPOOL_H__ + +#pragma once #include #include #include "base/Ref.h" -/** - * @addtogroup base - * @{ - */ namespace cc { /** * A pool for managing autorelease objects. - * @js NA */ class CC_DLL AutoreleasePool { public: /** * @warning Don't create an autorelease pool in heap, create it in stack. - * @js NA - * @lua NA */ AutoreleasePool(); /** * Create an autorelease pool with specific name. This name is useful for debugging. * @warning Don't create an autorelease pool in heap, create it in stack. - * @js NA - * @lua NA * * @param name The name of created autorelease pool. */ - AutoreleasePool(const std::string &name); + explicit AutoreleasePool(std::string name); - /** - * @js NA - * @lua NA - */ ~AutoreleasePool(); /** @@ -73,8 +61,6 @@ public: * the same times as it was added. * * @param object The object to be added into the autorelease pool. - * @js NA - * @lua NA */ void addObject(Ref *object); @@ -82,9 +68,6 @@ public: * Clear the autorelease pool. * * It will invoke each element's `release()` function. - * - * @js NA - * @lua NA */ void clear(); @@ -93,9 +76,6 @@ public: * Whether the autorelease pool is doing `clear` operation. * * @return True if autorelease pool is clearing, false if not. - * - * @js NA - * @lua NA */ bool isClearing() const { return _isClearing; }; #endif @@ -105,8 +85,6 @@ public: * * @param object The object to be checked. * @return True if the autorelease pool contains the object, false if not - * @js NA - * @lua NA */ bool contains(Ref *object) const; @@ -115,9 +93,6 @@ public: * * The result will look like: * Object pointer address object id reference count - * - * @js NA - * @lua NA */ void dump(); @@ -142,12 +117,6 @@ private: #endif }; -// end of base group -/** @} */ - -/** - * @cond - */ class CC_DLL PoolManager { public: static PoolManager *getInstance(); @@ -171,14 +140,9 @@ private: void push(AutoreleasePool *pool); void pop(); - static PoolManager *s_singleInstance; + static PoolManager *_singleInstance; std::vector _releasePoolStack; }; -/** - * @endcond - */ } // namespace cc - -#endif //__AUTORELEASEPOOL_H__ diff --git a/native/cocos/base/CachedArray.h b/native/cocos/base/CachedArray.h index 1a7eecfae9..6d2448b377 100755 --- a/native/cocos/base/CachedArray.h +++ b/native/cocos/base/CachedArray.h @@ -1,19 +1,46 @@ -#ifndef CC_CORE_KERNEL_CACHED_ARRAY_H_ -#define CC_CORE_KERNEL_CACHED_ARRAY_H_ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Object.h" +#include "base/TypeDef.h" namespace cc { template class CachedArray : public Object { public: - CachedArray(uint size = 1u) { + explicit CachedArray(uint size = 1U) { _size = 0; _capacity = std::max(size, 1u); _array = CC_NEW_ARRAY(T, _capacity); } // The rule of five applies here - ~CachedArray() { + ~CachedArray() override { CC_SAFE_DELETE_ARRAY(_array); } @@ -22,6 +49,7 @@ public: memcpy(_array, other._array, _size * sizeof(T)); } + // NOLINTNEXTLINE(bugprone-unhandled-self-assignment) false positive CachedArray &operator=(const CachedArray &other) noexcept { if (this != &other) { CC_DELETE_ARRAY(_array); @@ -34,7 +62,7 @@ public: } CachedArray(CachedArray &&other) - : _size(other._size), _capacity(other._capacity), _array(other._array) { + noexcept : _size(other._size), _capacity(other._capacity), _array(other._array) { other._size = 0; other._capacity = 0; other._array = nullptr; @@ -136,5 +164,3 @@ private: }; } // namespace cc - -#endif // CC_CORE_KERNEL_CACHED_ARRAY_H_ diff --git a/native/cocos/base/Config.h b/native/cocos/base/Config.h index 388117f836..f99d02a2ff 100644 --- a/native/cocos/base/Config.h +++ b/native/cocos/base/Config.h @@ -1,38 +1,33 @@ /**************************************************************************** -Copyright (c) 2008-2010 Ricardo Quesada -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2008-2010 Ricardo Quesada + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2011 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CCCONFIG_H__ -#define __CCCONFIG_H__ - -/** - * @file - * cocos2d (cc) configuration file. -*/ +#pragma once // disable module if you didn't need it, this will reduce package size @@ -116,5 +111,3 @@ THE SOFTWARE. #ifndef CC_ENABLE_CACHE_JSB_FUNC_RESULT #define CC_ENABLE_CACHE_JSB_FUNC_RESULT 1 #endif - -#endif // __CCCONFIG_H__ diff --git a/native/cocos/base/CoreStd.h b/native/cocos/base/CoreStd.h new file mode 100644 index 0000000000..4d5419023d --- /dev/null +++ b/native/cocos/base/CoreStd.h @@ -0,0 +1,71 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Macros.h" + +// STD including +#include +#include +#include +#include +#include +#include +#include +#include + +// STL including +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "base/TypeDef.h" +#include "base/memory/Memory.h" +#include "base/Log.h" +#include "base/Object.h" +#include "base/CachedArray.h" +#include "base/StringUtil.h" + +#include "math/Math.h" + +#define CC_JOB_SYSTEM_TASKFLOW 1 +#define CC_JOB_SYSTEM_TBB 2 + +#define CC_JOB_SYSTEM CC_JOB_SYSTEM_TASKFLOW diff --git a/native/cocos/base/Data.cpp b/native/cocos/base/Data.cpp index d763d77c06..601f1915b2 100644 --- a/native/cocos/base/Data.cpp +++ b/native/cocos/base/Data.cpp @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,22 +23,22 @@ 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 "base/Data.h" #include "base/Log.h" namespace cc { -const Data Data::Null; +const Data Data::NULL_DATA; Data::Data() : _bytes(nullptr), _size(0) { // CC_LOG_INFO("In the empty constructor of Data."); } -Data::Data(Data &&other) : _bytes(nullptr), - _size(0) { +Data::Data(Data &&other) noexcept : _bytes(nullptr), + _size(0) { // CC_LOG_INFO("In the move constructor of Data."); move(other); } @@ -59,7 +60,7 @@ Data &Data::operator=(const Data &other) { return *this; } -Data &Data::operator=(Data &&other) { +Data &Data::operator=(Data &&other) noexcept { // CC_LOG_INFO("In the move assignment of Data."); move(other); return *this; @@ -69,10 +70,10 @@ void Data::move(Data &other) { clear(); _bytes = other._bytes; - _size = other._size; + _size = other._size; other._bytes = nullptr; - other._size = 0; + other._size = 0; } bool Data::isNull() const { @@ -87,35 +88,36 @@ ssize_t Data::getSize() const { return _size; } -void Data::copy(const unsigned char *bytes, const ssize_t size) { +void Data::copy(const unsigned char *bytes, ssize_t size) { clear(); if (size > 0) { - _size = size; + _size = size; _bytes = (unsigned char *)malloc(sizeof(unsigned char) * _size); memcpy(_bytes, bytes, _size); } } -void Data::fastSet(unsigned char *bytes, const ssize_t size) { +void Data::fastSet(unsigned char *bytes, ssize_t size) { free(_bytes); _bytes = bytes; - _size = size; + _size = size; } void Data::clear() { free(_bytes); _bytes = nullptr; - _size = 0; + _size = 0; } unsigned char *Data::takeBuffer(ssize_t *size) { auto buffer = getBytes(); - if (size) + if (size) { *size = getSize(); + } _bytes = nullptr; - _size = 0; + _size = 0; return buffer; } diff --git a/native/cocos/base/Data.h b/native/cocos/base/Data.h index b71d7a0e96..f395aae3ac 100644 --- a/native/cocos/base/Data.h +++ b/native/cocos/base/Data.h @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,14 +23,13 @@ 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 __CCDATA_H__ -#define __CCDATA_H__ +#pragma once #include "base/Macros.h" -#include // for ssize_t on android -#include // for ssize_t on linux +#include // for ssize_t on android +#include // for ssize_t on linux /** * @addtogroup base @@ -45,7 +45,7 @@ public: /** * This parameter is defined for convenient reference if a null Data object is needed. */ - static const Data Null; + static const Data NULL_DATA; /** * Constructor of Data. @@ -60,7 +60,7 @@ public: /** * Copy constructor of Data. */ - Data(Data &&other); + Data(Data &&other) noexcept; /** * Destructor of Data. @@ -75,7 +75,7 @@ public: /** * Overloads of operator=. */ - Data &operator=(Data &&other); + Data &operator=(Data &&other) noexcept; /** * Gets internal bytes of Data. It will return the pointer directly used in Data, so don't delete it. @@ -96,7 +96,7 @@ public: * Developer should free the pointer after invoking this method. * @see Data::fastSet */ - void copy(const unsigned char *bytes, const ssize_t size); + void copy(const unsigned char *bytes, ssize_t size); /** Fast set the buffer pointer and its size. Please use it carefully. * @param bytes The buffer pointer, note that it have to be allocated by 'malloc' or 'calloc', @@ -105,7 +105,7 @@ public: * 2. The pointer should not be used outside after it was passed to this method. * @see Data::copy */ - void fastSet(unsigned char *bytes, const ssize_t size); + void fastSet(unsigned char *bytes, ssize_t size); /** * Clears data, free buffer and reset data size. @@ -146,10 +146,7 @@ private: private: unsigned char *_bytes; - ssize_t _size; + ssize_t _size; }; } // namespace cc - -/** @} */ -#endif // __CCDATA_H__ diff --git a/native/cocos/base/IndexHandle.h b/native/cocos/base/IndexHandle.h new file mode 100644 index 0000000000..935f201b41 --- /dev/null +++ b/native/cocos/base/IndexHandle.h @@ -0,0 +1,90 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include +#include + +namespace cc { + +template >> +class IndexHandle { +public: + struct Hasher { + inline size_t operator()(IndexHandle const &s) const noexcept { return s._index; } + }; + + using IndexType = Index; + + IndexHandle() noexcept = default; + explicit IndexHandle(IndexType index) noexcept : _index(index) {} + + inline bool isValid() const noexcept; + inline void clear() noexcept; + + inline bool operator<(IndexHandle const &rhs) const noexcept; + inline bool operator==(IndexHandle const &rhs) const noexcept; + inline bool operator!=(IndexHandle const &rhs) const noexcept; + inline operator IndexType() const noexcept; + + static IndexType constexpr UNINITIALIZED{std::numeric_limits::max()}; + +private: + IndexType _index{UNINITIALIZED}; +}; + +template +bool IndexHandle::isValid() const noexcept { + return _index != UNINITIALIZED; +} + +template +void IndexHandle::clear() noexcept { + _index = UNINITIALIZED; +} + +template +bool IndexHandle::operator<(IndexHandle const &rhs) const noexcept { + return _index < rhs._index; +} + +template +bool IndexHandle::operator==(IndexHandle const &rhs) const noexcept { + return (_index == rhs._index); +} + +template +bool IndexHandle::operator!=(IndexHandle const &rhs) const noexcept { + return !operator==(rhs); +} + +template +IndexHandle::operator IndexType() const noexcept { + return _index; +} + +} // namespace cc diff --git a/native/cocos/base/Log.cpp b/native/cocos/base/Log.cpp index fc5f2b27ea..c99f20bb16 100755 --- a/native/cocos/base/Log.cpp +++ b/native/cocos/base/Log.cpp @@ -1,5 +1,33 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "Log.h" -#include "UTFString.h" + +#include +#include + #include "StringUtil.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) @@ -25,13 +53,13 @@ namespace cc { #define LOG_USE_TIMESTAMP #if (CC_DEBUG == 1) -LogLevel Log::logLevel = LogLevel::DEBUG_; +LogLevel Log::_logLevel = LogLevel::LEVEL_DEBUG; #else -LogLevel Log::logLevel = LogLevel::INFO; +LogLevel Log::_logLevel = LogLevel::INFO; #endif -FILE *Log::_logFile = nullptr; -const char *LOG_LEVEL_DESCS[] = {"FATAL", "ERROR", "WARN", "INFO", "DEBUG"}; +FILE * Log::_logFile = nullptr; +const std::vector LOG_LEVEL_DESCS{"FATAL", "ERROR", "WARN", "INFO", "DEBUG"}; void Log::setLogFile(const std::string &filename) { #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) @@ -46,11 +74,11 @@ void Log::setLogFile(const std::string &filename) { msg += "------------------------------------------------------\n"; struct tm *tm_time; - time_t ct_time; + time_t ct_time; time(&ct_time); tm_time = localtime(&ct_time); - msg += StringUtil::Format("LOG DATE: %04d-%02d-%02d %02d:%02d:%02d\n", + msg += StringUtil::format("LOG DATE: %04d-%02d-%02d %02d:%02d:%02d\n", tm_time->tm_year + 1900, tm_time->tm_mon + 1, tm_time->tm_mday, @@ -74,27 +102,27 @@ void Log::close() { } void Log::logMessage(LogType type, LogLevel level, const char *formats, ...) { - char buff[4096]; - char *p = buff; + char buff[4096]; + char *p = buff; char *last = buff + sizeof(buff) - 3; #if defined(LOG_USE_TIMESTAMP) - struct tm *tm_time; - time_t ct_time; - time(&ct_time); - tm_time = localtime(&ct_time); + struct tm *tmTime; + time_t ctTime; + time(&ctTime); + tmTime = localtime(&ctTime); - p += sprintf(p, "%02d:%02d:%02d ", tm_time->tm_hour, tm_time->tm_min, tm_time->tm_sec); + p += sprintf(p, "%02d:%02d:%02d ", tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec); #endif - p += sprintf(p, "[%s]: ", LOG_LEVEL_DESCS[(int)level]); + p += sprintf(p, "[%s]: ", LOG_LEVEL_DESCS[static_cast(level)].c_str()); va_list args; va_start(args, formats); - // p += StringUtil::VPrintf(p, last, formats, args); + // p += StringUtil::vprintf(p, last, formats, args); int count = (int)(last - p); - int ret = vsnprintf(p, count, formats, args); + int ret = vsnprintf(p, count, formats, args); if (ret >= count - 1) { p += (count - 1); } else if (ret >= 0) { @@ -104,7 +132,7 @@ void Log::logMessage(LogType type, LogLevel level, const char *formats, ...) { va_end(args); *p++ = '\n'; - *p = 0; + *p = 0; if (_logFile) { fputs(buff, _logFile); @@ -112,12 +140,12 @@ void Log::logMessage(LogType type, LogLevel level, const char *formats, ...) { } #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - UTFString utfstr(buff); - const wchar_t *ustr = utfstr.asWStr_c_str(); + WCHAR wszBuf[4096] = {0}; + MultiByteToWideChar(CP_UTF8, 0, buff, -1, wszBuf, sizeof(wszBuf)); WORD color; switch (level) { - case LogLevel::DEBUG_: color = COLOR_DEBUG; break; + case LogLevel::LEVEL_DEBUG: color = COLOR_DEBUG; break; case LogLevel::INFO: color = COLOR_INFO; break; case LogLevel::WARN: color = COLOR_WARN; break; case LogLevel::ERR: color = COLOR_ERROR; break; @@ -125,14 +153,14 @@ void Log::logMessage(LogType type, LogLevel level, const char *formats, ...) { default: color = COLOR_INFO; } SET_CONSOLE_TEXT_COLOR(color); - wprintf(L"%s", ustr); + wprintf(L"%s", wszBuf); SET_CONSOLE_TEXT_COLOR(COLOR_NORMAL); - OutputDebugStringW(ustr); + OutputDebugStringW(wszBuf); #elif (CC_PLATFORM == CC_PLATFORM_ANDROID) android_LogPriority priority; switch (level) { - case LogLevel::DEBUG_: priority = ANDROID_LOG_DEBUG; break; + case LogLevel::LEVEL_DEBUG: priority = ANDROID_LOG_DEBUG; break; case LogLevel::INFO: priority = ANDROID_LOG_INFO; break; case LogLevel::WARN: priority = ANDROID_LOG_WARN; break; case LogLevel::ERR: priority = ANDROID_LOG_ERROR; break; diff --git a/native/cocos/base/Log.h b/native/cocos/base/Log.h index d0f3015b0b..b807529b20 100755 --- a/native/cocos/base/Log.h +++ b/native/cocos/base/Log.h @@ -1,5 +1,29 @@ -#ifndef CC_CORE_KERNEL_LOG_H_ -#define CC_CORE_KERNEL_LOG_H_ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once #include "Macros.h" #include @@ -17,19 +41,19 @@ enum class LogLevel { ERR, WARN, INFO, - DEBUG_, // DEBUG is a macro on windows, so use DEBUG_ instead. + LEVEL_DEBUG, // DEBUG is a macro on windows, so use LEVEL_DEBUG instead. COUNT, }; class CC_DLL Log { public: - static LogLevel logLevel; // for read only + static LogLevel _logLevel; // for read only - static CC_INLINE void setLogLevel(LogLevel level) { logLevel = level; } + static CC_INLINE void setLogLevel(LogLevel level) { _logLevel = level; } static CC_INLINE FILE *getLogFile() { return _logFile; } - static void setLogFile(const std::string &filename); - static void close(); - static void logMessage(LogType type, LogLevel level, const char *formats, ...); + static void setLogFile(const std::string &filename); + static void close(); + static void logMessage(LogType type, LogLevel level, const char *formats, ...); private: static FILE *_logFile; @@ -38,20 +62,18 @@ private: } // namespace cc #define CC_LOG_DEBUG(formats, ...) \ - if (cc::Log::logLevel >= cc::LogLevel::DEBUG_) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::DEBUG_, formats, ##__VA_ARGS__) + if (cc::Log::_logLevel >= cc::LogLevel::LEVEL_DEBUG) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::LEVEL_DEBUG, formats, ##__VA_ARGS__) #define CC_LOG_INFO(formats, ...) \ - if (cc::Log::logLevel >= cc::LogLevel::INFO) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::INFO, formats, ##__VA_ARGS__) + if (cc::Log::_logLevel >= cc::LogLevel::INFO) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::INFO, formats, ##__VA_ARGS__) #define CC_LOG_WARNING(formats, ...) \ - if (cc::Log::logLevel >= cc::LogLevel::WARN) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::WARN, formats, ##__VA_ARGS__) -#define CC_LOG_ERROR_(formats, ...) \ - if (cc::Log::logLevel >= cc::LogLevel::ERR) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::ERR, formats, ##__VA_ARGS__) + if (cc::Log::_logLevel >= cc::LogLevel::WARN) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::WARN, formats, ##__VA_ARGS__) +#define DO_CC_LOG_ERROR(formats, ...) \ + if (cc::Log::_logLevel >= cc::LogLevel::ERR) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::ERR, formats, ##__VA_ARGS__) #define CC_LOG_FATAL(formats, ...) \ - if (cc::Log::logLevel >= cc::LogLevel::FATAL) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::FATAL, formats, ##__VA_ARGS__) + if (cc::Log::_logLevel >= cc::LogLevel::FATAL) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::FATAL, formats, ##__VA_ARGS__) -#define CC_LOG_ERROR(formats, ...) \ - do { \ - CC_LOG_ERROR_("[ERROR] file %s: line %d ", __FILE__, __LINE__); \ - CC_LOG_ERROR_(formats, ##__VA_ARGS__); \ +#define CC_LOG_ERROR(formats, ...) \ + do { \ + DO_CC_LOG_ERROR("[ERROR] file %s: line %d ", __FILE__, __LINE__); \ + DO_CC_LOG_ERROR(formats, ##__VA_ARGS__); \ } while (0) - -#endif // CC_CORE_KERNEL_LOG_H_ diff --git a/native/cocos/base/Macros.h b/native/cocos/base/Macros.h index 16ae35e861..3a29228986 100644 --- a/native/cocos/base/Macros.h +++ b/native/cocos/base/Macros.h @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2008-2010 Ricardo Quesada -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2008-2010 Ricardo Quesada + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2011 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) @@ -225,8 +227,6 @@ It should work same as apples CFSwapInt32LittleToHost(..) #define CC_FORMAT_PRINTF(formatPos, argPos) #endif -#define CC_CORE_CORE_DEF_H_ - // Initial compiler-related stuff to set. #define CC_COMPILER_MSVC 1 #define CC_COMPILER_CLANG 2 @@ -320,7 +320,7 @@ It should work same as apples CFSwapInt32LittleToHost(..) #elif CC_PLATFORM == CC_PLATFORM_MAC_OSX && CC_ENDIAN == CC_ENDIAN_BIG #define CC_CPU CC_CPU_PPC #elif CC_PLATFORM == CC_PLATFORM_MAC_OSX - #define COCOS_CPU CC_CPU_X86 + #define CC_CPU CC_CPU_X86 #elif CC_PLATFORM == CC_PLATFORM_MAC_IOS && (defined(__i386__) || defined(__x86_64__)) #define CC_CPU CC_CPU_X86 #elif defined(__arm__) || defined(_M_ARM) || defined(__arm64__) || defined(_aarch64_) @@ -337,11 +337,6 @@ It should work same as apples CFSwapInt32LittleToHost(..) #define CC_CPU_ARCH CC_CPU_ARCH_32 #endif -#if (__cplusplus >= 201103L) - #define CC_C11 - #define register -#endif - // C11 features #if (CC_COMPILER == CC_COMPILER_MSVC) #if (_MSC_VER >= 1700) diff --git a/native/cocos/base/Map.h b/native/cocos/base/Map.h index 95c8124a71..dc0fd677c5 100644 --- a/native/cocos/base/Map.h +++ b/native/cocos/base/Map.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #define USE_STD_UNORDERED_MAP 1 @@ -38,10 +40,6 @@ #include "base/Random.h" #include "base/Ref.h" -/** - * @addtogroup base - * @{ - */ namespace cc { /** @@ -55,7 +53,7 @@ template class Map { public: #if USE_STD_UNORDERED_MAP - typedef std::unordered_map RefMap; + using RefMap = std::unordered_map; #else typedef std::map RefMap; #endif @@ -65,9 +63,9 @@ public: // ------------------------------------------ /** Iterator, can be used to loop the Map. */ - typedef typename RefMap::iterator iterator; + using iterator = typename RefMap::iterator; /** Const iterator, can be used to loop the Map. */ - typedef typename RefMap::const_iterator const_iterator; + using const_iterator = typename RefMap::const_iterator; /** Return iterator to beginning. */ iterator begin() { return _data.begin(); } @@ -108,7 +106,7 @@ public: } /** Move constructor. */ - Map(Map &&other) { + Map(Map &&other) noexcept { static_assert(std::is_convertible::value, "Invalid Type for cc::Map!"); CC_LOG_INFO("In the move constructor of Map!"); _data = std::move(other._data); @@ -211,17 +209,11 @@ public: * @param key Key value of the element whose mapped value is accessed. * Member type K is the keys for the elements in the container. defined in Map as an alias of its first template parameter (Key). */ - const V at(const K &key) const { - auto iter = _data.find(key); - if (iter != _data.end()) - return iter->second; - return nullptr; - } - V at(const K &key) { auto iter = _data.find(key); - if (iter != _data.end()) + if (iter != _data.end()) { return iter->second; + } return nullptr; } @@ -314,7 +306,7 @@ public: */ V getRandomObject() const { if (!_data.empty()) { - ssize_t randIdx = RandomHelper::random_int(0, static_cast(_data.size()) - 1); + auto randIdx = RandomHelper::randomInt(0, static_cast(_data.size()) - 1); const_iterator randIter = _data.begin(); std::advance(randIter, randIdx); return randIter->second; @@ -322,31 +314,6 @@ public: return nullptr; } - // Don't uses operator since we could not decide whether it needs 'retain'/'release'. - // V& operator[] ( const K& key ) - // { - // CC_LOG_DEBUG("copy: [] ref"); - // return _data[key]; - // } - // - // V& operator[] ( K&& key ) - // { - // CC_LOG_DEBUG("move [] ref"); - // return _data[key]; - // } - - // const V& operator[] ( const K& key ) const - // { - // CC_LOG_DEBUG("const copy []"); - // return _data.at(key); - // } - // - // const V& operator[] ( K&& key ) const - // { - // CC_LOG_DEBUG("const move []"); - // return _data.at(key); - // } - /** Copy assignment operator. */ Map &operator=(const Map &other) { if (this != &other) { @@ -359,7 +326,7 @@ public: } /** Move assignment operator. */ - Map &operator=(Map &&other) { + Map &operator=(Map &&other) noexcept { if (this != &other) { CC_LOG_INFO("In the move assignment operator of Map!"); clear(); @@ -380,5 +347,3 @@ protected: }; } // namespace cc -// end group -/// @} diff --git a/native/cocos/base/Object.h b/native/cocos/base/Object.h index 02ff104737..bef6411e1e 100755 --- a/native/cocos/base/Object.h +++ b/native/cocos/base/Object.h @@ -1,14 +1,35 @@ -#ifndef CC_CORE_KERNEL_OBJECT_H_ -#define CC_CORE_KERNEL_OBJECT_H_ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. -#include "memory/AllocatedObj.h" -#include "memory/MemDef.h" + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "memory/Memory.h" namespace cc { // Now define all the base classes for each allocation -typedef AllocatedObject Object; +using Object = AllocatedObject; } // namespace cc - -#endif // CC_CORE_KERNEL_OBJECT_H_ diff --git a/native/cocos/base/Random.h b/native/cocos/base/Random.h index d26ed4806b..22d07ab3b5 100644 --- a/native/cocos/base/Random.h +++ b/native/cocos/base/Random.h @@ -1,41 +1,37 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __ccRandom_H_ -#define __ccRandom_H_ +#pragma once #include #include #include "base/Macros.h" -/** -* @addtogroup base -* @{ -*/ namespace cc { /** @@ -45,14 +41,14 @@ namespace cc { class CC_DLL RandomHelper { public: template - static inline T random_real(T min, T max) { + static inline T randomReal(T min, T max) { std::uniform_real_distribution dist(min, max); auto &mt = RandomHelper::getEngine(); return dist(mt); } template - static inline T random_int(T min, T max) { + static inline T randomInt(T min, T max) { std::uniform_int_distribution dist(min, max); auto &mt = RandomHelper::getEngine(); return dist(mt); @@ -60,8 +56,8 @@ public: private: static inline std::mt19937 &getEngine() { - static std::random_device seed_gen; - static std::mt19937 engine(seed_gen()); + static std::random_device seedGen; + static std::mt19937 engine(seedGen()); return engine; } }; @@ -71,22 +67,22 @@ private: */ template inline T random(T min, T max) { - return RandomHelper::random_int(min, max); + return RandomHelper::randomInt(min, max); } template <> inline float random(float min, float max) { - return RandomHelper::random_real(min, max); + return RandomHelper::randomReal(min, max); } template <> inline long double random(long double min, long double max) { - return RandomHelper::random_real(min, max); + return RandomHelper::randomReal(min, max); } template <> inline double random(double min, double max) { - return RandomHelper::random_real(min, max); + return RandomHelper::randomReal(min, max); } /** @@ -100,7 +96,7 @@ inline int random() { * Returns a random float between -1 and 1. * It can be seeded using std::srand(seed); */ -inline float rand_minus1_1() { +inline float randMinus1_1() { // IDEA: using the new c++11 random engine generator // without a proper way to set a seed is not useful. // Resorting to the old random method since it can @@ -114,7 +110,7 @@ inline float rand_minus1_1() { * Returns a random float between 0 and 1. * It can be seeded using std::srand(seed); */ -inline float rand_0_1() { +inline float rand0_1() { // IDEA: using the new c++11 random engine generator // without a proper way to set a seed is not useful. // Resorting to the old random method since it can @@ -125,6 +121,3 @@ inline float rand_0_1() { }; } // namespace cc -// end group -/// @} -#endif //__ccRandom_H_ diff --git a/native/cocos/base/Ref.cpp b/native/cocos/base/Ref.cpp index e1d05a0448..ca2c715b73 100644 --- a/native/cocos/base/Ref.cpp +++ b/native/cocos/base/Ref.cpp @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "base/Ref.h" @@ -65,8 +66,9 @@ void Ref::release() { if (_referenceCount == 0) { #if defined(CC_DEBUG) && (CC_DEBUG > 0) - auto poolManager = PoolManager::getInstance(); - if (!poolManager->getCurrentPool()->isClearing() && poolManager->isObjectInPools(this)) { + auto *poolManager = PoolManager::getInstance(); + auto *currentPool = poolManager->getCurrentPool(); + if (currentPool && !currentPool->isClearing() && poolManager->isObjectInPools(this)) { // Trigger an assert if the reference count is 0 but the Ref is still in autorelease pool. // This happens when 'autorelease/release' were not used in pairs with 'new/retain'. // diff --git a/native/cocos/base/Ref.h b/native/cocos/base/Ref.h index 544a89a329..d8b023e5d6 100644 --- a/native/cocos/base/Ref.h +++ b/native/cocos/base/Ref.h @@ -1,66 +1,55 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __BASE_CCREF_H__ -#define __BASE_CCREF_H__ +#pragma once #include "base/Macros.h" #include "base/Config.h" #define CC_REF_LEAK_DETECTION 0 -/** - * @addtogroup base - * @{ - */ namespace cc { class Ref; /** * Interface that defines how to clone an Ref. - * @lua NA - * @js NA */ class CC_DLL Clonable { public: /** Returns a copy of the Ref. */ virtual Clonable *clone() const = 0; - /** - * @js NA - * @lua NA - */ - virtual ~Clonable(){}; + virtual ~Clonable() = default; }; /** * Ref is used for reference count management. If a class inherits from Ref, * then it is easy to be shared in different places. - * @js NA */ class CC_DLL Ref { public: @@ -70,7 +59,6 @@ public: * This increases the Ref's reference count. * * @see release, autorelease - * @js NA */ void retain(); @@ -83,7 +71,6 @@ public: * destructed. * * @see retain, autorelease - * @js NA */ void release(); @@ -99,8 +86,6 @@ public: * @returns The Ref itself. * * @see AutoreleasePool, retain, release - * @js NA - * @lua NA */ Ref *autorelease(); @@ -108,7 +93,6 @@ public: * Returns the Ref's current reference count. * * @returns The Ref's reference count. - * @js NA */ unsigned int getReferenceCount() const; @@ -117,16 +101,9 @@ protected: * Constructor * * The Ref's reference count is 1 after construction. - * @js NA */ Ref(); - /** - * Destructor - * - * @js NA - * @lua NA - */ virtual ~Ref(); protected: @@ -143,7 +120,3 @@ public: }; } // namespace cc -// end of base group -/** @} */ - -#endif // __BASE_CCREF_H__ diff --git a/native/cocos/base/Scheduler.cpp b/native/cocos/base/Scheduler.cpp index 07b80baad3..aac1a26a82 100644 --- a/native/cocos/base/Scheduler.cpp +++ b/native/cocos/base/Scheduler.cpp @@ -1,86 +1,61 @@ /**************************************************************************** -Copyright (c) 2008-2010 Ricardo Quesada -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2008-2010 Ricardo Quesada + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2011 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "base/Scheduler.h" -#include "base/Macros.h" -#include "base/Array.h" -#define CC_REPEAT_FOREVER (UINT_MAX - 1) +#include "base/Scheduler.h" + +#include +#include + +#include "base/Macros.h" +#include "base/Log.h" + +namespace { +constexpr unsigned CC_REPEAT_FOREVER{UINT_MAX - 1}; +constexpr int MAX_FUNC_TO_PERFORM{30}; +constexpr int INITIAL_TIMER_COUND{10}; +} // namespace namespace cc { - -// data structures - -// A list double-linked list used for "updates with priority" -typedef struct _listEntry { - struct _listEntry *prev, *next; - ccSchedulerFunc callback; - void *target; - int priority; - bool paused; - bool markedForDeletion; // selector will no longer be called and entry will be removed at end of the next tick -} tListEntry; - -typedef struct _hashUpdateEntry { - tListEntry **list; // Which list does it belong to ? - tListEntry *entry; // entry in the list - void *target; - ccSchedulerFunc callback; - UT_hash_handle hh; -} tHashUpdateEntry; - -// Hash Element used for "selectors with interval" -typedef struct _hashSelectorEntry { - ccArray *timers; - void *target; - int timerIndex; - Timer *currentTimer; - bool currentTimerSalvaged; - bool paused; - UT_hash_handle hh; -} tHashTimerEntry; - // implementation Timer -Timer::Timer() { -} - void Timer::setupTimerWithInterval(float seconds, unsigned int repeat, float delay) { - _elapsed = -1; - _interval = seconds; - _delay = delay; - _useDelay = (_delay > 0.0f) ? true : false; - _repeat = repeat; - _runForever = (_repeat == CC_REPEAT_FOREVER) ? true : false; + _elapsed = -1; + _interval = seconds; + _delay = delay; + _useDelay = _delay > 0.0F; + _repeat = repeat; + _runForever = _repeat == CC_REPEAT_FOREVER; } void Timer::update(float dt) { if (_elapsed == -1) { - _elapsed = 0; + _elapsed = 0; _timesExecuted = 0; return; } @@ -116,7 +91,7 @@ void Timer::update(float dt) { break; } - if (_elapsed <= 0.f) { + if (_elapsed <= 0.F) { break; } @@ -128,14 +103,11 @@ void Timer::update(float dt) { // TimerTargetCallback -TimerTargetCallback::TimerTargetCallback() { -} - bool TimerTargetCallback::initWithCallback(Scheduler *scheduler, const ccSchedulerFunc &callback, void *target, const std::string &key, float seconds, unsigned int repeat, float delay) { _scheduler = scheduler; - _target = target; - _callback = callback; - _key = key; + _target = target; + _callback = callback; + _key = key; setupTimerWithInterval(seconds, repeat, delay); return true; } @@ -154,61 +126,64 @@ void TimerTargetCallback::cancel() { Scheduler::Scheduler() { // I don't expect to have more than 30 functions to all per frame - _functionsToPerform.reserve(30); + _functionsToPerform.reserve(MAX_FUNC_TO_PERFORM); } -Scheduler::~Scheduler(void) { +Scheduler::~Scheduler() { unscheduleAll(); } -void Scheduler::removeHashElement(_hashSelectorEntry *element) { - ccArrayFree(element->timers); - HASH_DEL(_hashForTimers, element); - free(element); +void Scheduler::removeHashElement(HashTimerEntry *element) { + if (element) { + for (auto &timer : element->timers) { + timer->release(); + } + element->timers.clear(); + + _hashForTimers.erase(element->target); + free(element); + } } void Scheduler::schedule(const ccSchedulerFunc &callback, void *target, float interval, bool paused, const std::string &key) { - this->schedule(callback, target, interval, CC_REPEAT_FOREVER, 0.0f, paused, key); + this->schedule(callback, target, interval, CC_REPEAT_FOREVER, 0.0F, paused, key); } void Scheduler::schedule(const ccSchedulerFunc &callback, void *target, float interval, unsigned int repeat, float delay, bool paused, const std::string &key) { CCASSERT(target, "Argument target must be non-nullptr"); CCASSERT(!key.empty(), "key should not be empty!"); - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - - if (!element) { - element = (tHashTimerEntry *)calloc(sizeof(*element), 1); + auto iter = _hashForTimers.find(target); + HashTimerEntry *element = nullptr; + if (iter == _hashForTimers.end()) { + element = new HashTimerEntry(); element->target = target; - HASH_ADD_PTR(_hashForTimers, target, element); + _hashForTimers[target] = element; // Is this the 1st element ? Then set the pause level to all the selectors of this target element->paused = paused; } else { + element = iter->second; CCASSERT(element->paused == paused, "element's paused should be paused!"); } - if (element->timers == nullptr) { - element->timers = ccArrayNew(10); + if (element->timers.empty()) { + element->timers.reserve(INITIAL_TIMER_COUND); } else { - for (int i = 0; i < element->timers->num; ++i) { - TimerTargetCallback *timer = dynamic_cast(element->timers->arr[i]); - - if (timer && key == timer->getKey()) { + for (auto &e : element->timers) { + auto *timer = dynamic_cast(e); + if (key == timer->getKey()) { CC_LOG_DEBUG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), interval); timer->setInterval(interval); return; } } - ccArrayEnsureExtraCapacity(element->timers, 1); } - TimerTargetCallback *timer = new (std::nothrow) TimerTargetCallback(); + auto *timer = new (std::nothrow) TimerTargetCallback(); timer->initWithCallback(this, callback, target, key, interval, repeat, delay); - ccArrayAppendObject(element->timers, timer); - timer->release(); + element->timers.push_back(timer); } void Scheduler::unschedule(const std::string &key, void *target) { @@ -217,15 +192,14 @@ void Scheduler::unschedule(const std::string &key, void *target) { return; } - //CCASSERT(target); - //CCASSERT(selector); + auto iter = _hashForTimers.find(target); + if (iter != _hashForTimers.end()) { + HashTimerEntry *element = iter->second; + int i = 0; + auto &timers = element->timers; - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - - if (element) { - for (int i = 0; i < element->timers->num; ++i) { - TimerTargetCallback *timer = dynamic_cast(element->timers->arr[i]); + for (auto *t : timers) { + auto *timer = dynamic_cast(t); if (timer && key == timer->getKey()) { if (timer == element->currentTimer && (!element->currentTimerSalvaged)) { @@ -233,14 +207,15 @@ void Scheduler::unschedule(const std::string &key, void *target) { element->currentTimerSalvaged = true; } - ccArrayRemoveObjectAtIndex(element->timers, i, true); + timers.erase(timers.begin() + i); + timer->release(); // update timerIndex in case we are in tick:, looping over the actions if (element->timerIndex >= i) { element->timerIndex--; } - if (element->timers->num == 0) { + if (timers.empty()) { if (_currentTarget == element) { _currentTargetSalvaged = true; } else { @@ -250,6 +225,8 @@ void Scheduler::unschedule(const std::string &key, void *target) { return; } + + ++i; } } } @@ -258,37 +235,26 @@ bool Scheduler::isScheduled(const std::string &key, void *target) { CCASSERT(!key.empty(), "Argument key must not be empty"); CCASSERT(target, "Argument target must be non-nullptr"); - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - - if (!element) { + auto iter = _hashForTimers.find(target); + if (iter == _hashForTimers.end()) { return false; } - if (element->timers == nullptr) { - return false; - } else { - for (int i = 0; i < element->timers->num; ++i) { - TimerTargetCallback *timer = dynamic_cast(element->timers->arr[i]); - - if (timer && key == timer->getKey()) { - return true; - } - } - + HashTimerEntry *element = iter->second; + if (element->timers.empty()) { return false; } - return false; // should never get here + const auto &timers = element->timers; + return std::any_of(timers.begin(), timers.end(), [&key](Timer *t) { + auto *timer = dynamic_cast(t); + return (timer && key == timer->getKey()); + }); } void Scheduler::unscheduleAll() { - for (tHashTimerEntry *element = _hashForTimers, *nextElement = nullptr; element != nullptr;) { - // element may be removed in unscheduleAllSelectorsForTarget - nextElement = (tHashTimerEntry *)element->hh.next; - unscheduleAllForTarget(element->target); - - element = nextElement; + for (auto iter : _hashForTimers) { + unscheduleAllForTarget(iter.first); } } @@ -299,15 +265,21 @@ void Scheduler::unscheduleAllForTarget(void *target) { } // Custom Selectors - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - if (element) { - if (ccArrayContainsObject(element->timers, element->currentTimer) && (!element->currentTimerSalvaged)) { + auto iter = _hashForTimers.find(target); + if (iter != _hashForTimers.end()) { + HashTimerEntry *element = iter->second; + auto &timers = element->timers; + if (std::find(timers.begin(), timers.end(), element->currentTimer) != timers.end() && + (!element->currentTimerSalvaged)) { element->currentTimer->retain(); element->currentTimerSalvaged = true; } - ccArrayRemoveAllObjects(element->timers); + + for (auto *t : timers) { + t->release(); + } + timers.clear(); if (_currentTarget == element) { _currentTargetSalvaged = true; @@ -321,10 +293,9 @@ void Scheduler::resumeTarget(void *target) { CCASSERT(target != nullptr, "target can't be nullptr!"); // custom selectors - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - if (element) { - element->paused = false; + auto iter = _hashForTimers.find(target); + if (iter != _hashForTimers.end()) { + iter->second->paused = false; } } @@ -332,10 +303,9 @@ void Scheduler::pauseTarget(void *target) { CCASSERT(target != nullptr, "target can't be nullptr!"); // custom selectors - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - if (element) { - element->paused = true; + auto iter = _hashForTimers.find(target); + if (iter != _hashForTimers.end()) { + iter->second->paused = true; } } @@ -343,34 +313,14 @@ bool Scheduler::isTargetPaused(void *target) { CCASSERT(target != nullptr, "target must be non nil"); // Custom selectors - tHashTimerEntry *element = nullptr; - HASH_FIND_PTR(_hashForTimers, &target, element); - if (element) { - return element->paused; + auto iter = _hashForTimers.find(target); + if (iter != _hashForTimers.end()) { + return iter->second->paused; } return false; // should never get here } -std::set Scheduler::pauseAllTargets() { - std::set idsWithSelectors; - - // Custom Selectors - for (tHashTimerEntry *element = _hashForTimers; element != nullptr; - element = (tHashTimerEntry *)element->hh.next) { - element->paused = true; - idsWithSelectors.insert(element->target); - } - - return idsWithSelectors; -} - -void Scheduler::resumeTargets(const std::set &targetsToResume) { - for (const auto &obj : targetsToResume) { - this->resumeTarget(obj); - } -} - void Scheduler::performFunctionInCocosThread(const std::function &function) { _performMutex.lock(); _functionsToPerform.push_back(function); @@ -387,14 +337,16 @@ void Scheduler::update(float dt) { _updateHashLocked = true; // Iterate over all the custom selectors - for (tHashTimerEntry *elt = _hashForTimers; elt != nullptr;) { - _currentTarget = elt; + HashTimerEntry *elt = nullptr; + for (auto iter = _hashForTimers.begin(); iter != _hashForTimers.end();) { + elt = iter->second; + _currentTarget = elt; _currentTargetSalvaged = false; if (!_currentTarget->paused) { // The 'timers' array may change while inside this loop - for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex)) { - elt->currentTimer = (Timer *)(elt->timers->arr[elt->timerIndex]); + for (elt->timerIndex = 0; elt->timerIndex < static_cast(elt->timers.size()); ++(elt->timerIndex)) { + elt->currentTimer = elt->timers[elt->timerIndex]; elt->currentTimerSalvaged = false; elt->currentTimer->update(dt); @@ -410,18 +362,20 @@ void Scheduler::update(float dt) { } } - // elt, at this moment, is still valid - // so it is safe to ask this here (issue #490) - elt = (tHashTimerEntry *)elt->hh.next; - // only delete currentTarget if no actions were scheduled during the cycle (issue #481) - if (_currentTargetSalvaged && _currentTarget->timers->num == 0) { + if (_currentTargetSalvaged && _currentTarget->timers.empty()) { + ++iter; removeHashElement(_currentTarget); + if (iter != _hashForTimers.end()) { + ++iter; + } + } else { + ++iter; } } _updateHashLocked = false; - _currentTarget = nullptr; + _currentTarget = nullptr; // // Functions allocated from another thread diff --git a/native/cocos/base/Scheduler.h b/native/cocos/base/Scheduler.h index 47a2b1f495..9da227abb4 100644 --- a/native/cocos/base/Scheduler.h +++ b/native/cocos/base/Scheduler.h @@ -1,45 +1,48 @@ /**************************************************************************** -Copyright (c) 2008-2010 Ricardo Quesada -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2008-2010 Ricardo Quesada + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2011 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include #include #include +#include +#include #include "base/Ref.h" -#include "base/Vector.h" -#include "base/uthash.h" +//#include "base/Vector.h" namespace cc { class Scheduler; -typedef std::function ccSchedulerFunc; +using ccSchedulerFunc = std::function; /** * @cond @@ -54,42 +57,42 @@ public: void setupTimerWithInterval(float seconds, unsigned int repeat, float delay); virtual void trigger(float dt) = 0; - virtual void cancel() = 0; + virtual void cancel() = 0; /** triggers the timer */ void update(float dt); protected: - Timer(); + Timer() = default; protected: - Scheduler *_scheduler = nullptr; - float _elapsed = 0.f; - bool _runForever = false; - bool _useDelay = false; + Scheduler * _scheduler = nullptr; + float _elapsed = 0.f; + bool _runForever = false; + bool _useDelay = false; unsigned int _timesExecuted = 0; - unsigned int _repeat = 0; //0 = once, 1 is 2 x executed - float _delay = 0.f; - float _interval = 0.f; + unsigned int _repeat = 0; //0 = once, 1 is 2 x executed + float _delay = 0.f; + float _interval = 0.f; }; class CC_DLL TimerTargetCallback final : public Timer { public: - TimerTargetCallback(); + TimerTargetCallback() = default; // Initializes a timer with a target, a lambda and an interval in seconds, repeat in number of times to repeat, delay in seconds. bool initWithCallback(Scheduler *scheduler, const ccSchedulerFunc &callback, void *target, const std::string &key, float seconds, unsigned int repeat, float delay); inline const ccSchedulerFunc &getCallback() const { return _callback; }; - inline const std::string &getKey() const { return _key; }; + inline const std::string & getKey() const { return _key; }; - virtual void trigger(float dt) override; - virtual void cancel() override; + void trigger(float dt) override; + void cancel() override; -protected: - void *_target = nullptr; +private: + void * _target = nullptr; ccSchedulerFunc _callback = nullptr; - std::string _key; + std::string _key; }; /** @@ -243,12 +246,6 @@ public: */ bool isTargetPaused(void *target); - /** Pause all selectors from all targets. - You should NEVER call this method, unless you know what you are doing. - @since v2.0.0 - */ - std::set pauseAllTargets(); - /** Pause all selectors from all targets with a minimum priority. You should only call this with PRIORITY_NON_SYSTEM_MIN or higher. @param minPriority The minimum priority of selector to be paused. Which means, all selectors which @@ -257,13 +254,6 @@ public: */ std::set pauseAllTargetsWithMinPriority(int minPriority); - /** Resume selectors on a set of targets. - This can be useful for undoing a call to pauseAllSelectors. - @param targetsToResume The set of targets to be resumed. - @since v2.0.0 - */ - void resumeTargets(const std::set &targetsToResume); - /** Calls a function on the cocos2d thread. Useful when you need to call a cocos2d function from another thread. This function is thread safe. @param function The function to be run in cocos2d thread. @@ -284,21 +274,31 @@ public: bool isCurrentTargetSalvaged() const { return _currentTargetSalvaged; }; private: - void removeHashElement(struct _hashSelectorEntry *element); + // Hash Element used for "selectors with interval" + struct HashTimerEntry { + std::vector timers; + void * target; + int timerIndex; + Timer * currentTimer; + bool currentTimerSalvaged; + bool paused; + }; + + void removeHashElement(struct HashTimerEntry *element); void removeUpdateFromHash(struct _listEntry *entry); // update specific // Used for "selectors with interval" - struct _hashSelectorEntry *_hashForTimers = nullptr; - struct _hashSelectorEntry *_currentTarget = nullptr; - bool _currentTargetSalvaged = false; + std::unordered_map _hashForTimers; + struct HashTimerEntry * _currentTarget = nullptr; + bool _currentTargetSalvaged = false; // If true unschedule will not remove anything from a hash. Elements will only be marked for deletion. bool _updateHashLocked = false; // Used for "perform Function" std::vector> _functionsToPerform; - std::mutex _performMutex; + std::mutex _performMutex; }; // end of base group diff --git a/native/cocos/base/StringHandle.cpp b/native/cocos/base/StringHandle.cpp new file mode 100644 index 0000000000..109f2d0d67 --- /dev/null +++ b/native/cocos/base/StringHandle.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "StringHandle.h" + +namespace cc { + +StringHandle::StringHandle(IndexType handle, const char *str) noexcept +: IndexHandle(handle), + _str(str) { +} + +} // namespace cc diff --git a/native/cocos/base/StringHandle.h b/native/cocos/base/StringHandle.h new file mode 100644 index 0000000000..7cb3caeb40 --- /dev/null +++ b/native/cocos/base/StringHandle.h @@ -0,0 +1,42 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "IndexHandle.h" + +namespace cc { + +class StringHandle final : public IndexHandle { +public: + StringHandle() noexcept = default; + explicit StringHandle(IndexType handle, const char *str) noexcept; + inline char const *str() const noexcept { return _str; } + +private: + char const *_str{nullptr}; +}; + +} // namespace cc diff --git a/native/cocos/base/StringPool.h b/native/cocos/base/StringPool.h new file mode 100644 index 0000000000..fbb28a54d4 --- /dev/null +++ b/native/cocos/base/StringPool.h @@ -0,0 +1,134 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include +#include +#include +#include "StringHandle.h" +#include "threading/ReadWriteLock.h" + +namespace cc { + +struct StringCompare final { + inline bool operator()(char const *lhs, char const *rhs) const noexcept { + return strcmp(lhs, rhs) < 0; + } +}; + +template +class StringPool final { +public: + StringPool() = default; + ~StringPool(); + StringPool(const StringPool &) = delete; + StringPool(StringPool &&) = delete; + StringPool &operator=(const StringPool &) = delete; + StringPool &operator=(StringPool &&) = delete; + + StringHandle stringToHandle(const char *str) noexcept; + char const * handleToString(const StringHandle &handle) const noexcept; + StringHandle find(const char *str) const noexcept; + +private: + StringHandle doStringToHandle(const char *str) noexcept; + char const * doHandleToString(const StringHandle &handle) const noexcept; + StringHandle doFind(const char *str) const noexcept; + + std::map _stringToHandles{}; + std::vector _handleToStrings{}; + mutable ReadWriteLock _readWriteLock{}; +}; + +using ThreadSafeStringPool = StringPool; + +template +StringPool::~StringPool() { + for (char const *strCache : _handleToStrings) { + delete[] strCache; + } +} + +template +inline StringHandle StringPool::stringToHandle(const char *str) noexcept { + if (ThreadSafe) { + return _readWriteLock.lockWrite([this, str]() { + return doStringToHandle(str); + }); + } + return doStringToHandle(str); +} + +template +inline char const *StringPool::handleToString(const StringHandle &handle) const noexcept { + if (ThreadSafe) { + return _readWriteLock.lockRead([this, handle]() { + return doHandleToString(handle); + }); + } + return doHandleToString(handle); +} + +template +StringHandle StringPool::find(const char *str) const noexcept { + if (ThreadSafe) { + return _readWriteLock.lockRead([this, str]() { + return doFind(str); + }); + } + return doFind(str); +} + +template +inline StringHandle StringPool::doStringToHandle(const char *str) noexcept { + auto const it = _stringToHandles.find(str); + + if (it == _stringToHandles.end()) { + size_t const strLength = strlen(str) + 1; + char *const strCache = new char[strLength]; + strcpy(strCache, str); + StringHandle name(static_cast(_handleToStrings.size()), strCache); + _handleToStrings.emplace_back(strCache); + _stringToHandles.emplace(strCache, name); + return name; + } + return it->second; +} + +template +inline char const *StringPool::doHandleToString(const StringHandle &handle) const noexcept { + assert(handle < _handleToStrings.size()); + return _handleToStrings[handle]; +} + +template +StringHandle StringPool::doFind(char const *str) const noexcept { + auto const it = _stringToHandles.find(str); + return it == _stringToHandles.end() ? StringHandle{} : it->second; +} + +} // namespace cc diff --git a/native/cocos/base/StringUtil.cpp b/native/cocos/base/StringUtil.cpp index 4e1eb8ea56..14442a554e 100755 --- a/native/cocos/base/StringUtil.cpp +++ b/native/cocos/base/StringUtil.cpp @@ -1,5 +1,31 @@ -#include "CoreStd.h" +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "StringUtil.h" +#include "memory/Memory.h" +#include #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #ifndef WIN32_LEAN_AND_MEAN @@ -11,11 +37,11 @@ namespace cc { #if defined(_WIN32) -int StringUtil::VPrintf(char *buf, char *last, const char *fmt, va_list args) { +int StringUtil::vprintf(char *buf, const char *last, const char *fmt, va_list args) { if (last <= buf) return 0; int count = (int)(last - buf); - int ret = _vsnprintf_s(buf, count, _TRUNCATE, fmt, args); + int ret = _vsnprintf_s(buf, count, _TRUNCATE, fmt, args); if (ret < 0) { if (errno == 0) { return count - 1; @@ -27,56 +53,61 @@ int StringUtil::VPrintf(char *buf, char *last, const char *fmt, va_list args) { } } #else -int StringUtil::VPrintf(char *buf, char *last, const char *fmt, va_list args) { - if (last <= buf) return 0; +int StringUtil::vprintf(char *buf, const char *last, const char *fmt, va_list args) { + if (last <= buf) { + return 0; + } int count = (int)(last - buf); - int ret = vsnprintf(buf, count, fmt, args); + int ret = vsnprintf(buf, count, fmt, args); if (ret >= count - 1) { return count - 1; - } else if (ret < 0) { + } + if (ret < 0) { return 0; } return ret; } #endif -int StringUtil::Printf(char *buf, char *last, const char *fmt, ...) { +int StringUtil::printf(char *buf, const char *last, const char *fmt, ...) { va_list args; va_start(args, fmt); - int ret = VPrintf(buf, last, fmt, args); + int ret = vprintf(buf, last, fmt, args); va_end(args); return ret; } -String StringUtil::Format(const char *fmt, ...) { - char sz[4096]; +String StringUtil::format(const char *fmt, ...) { + char sz[4096]; va_list args; va_start(args, fmt); - VPrintf(sz, sz + sizeof(sz) - 1, fmt, args); + vprintf(sz, sz + sizeof(sz) - 1, fmt, args); va_end(args); return sz; } -StringArray StringUtil::Split(const String &str, const String &delims, uint max_splits) { +StringArray StringUtil::split(const String &str, const String &delims, uint maxSplits) { StringArray strs; - if (str.empty()) + if (str.empty()) { return strs; + } // Pre-allocate some space for performance - strs.reserve(max_splits ? max_splits + 1 : 16); // 16 is guessed capacity for most case + strs.reserve(maxSplits ? maxSplits + 1 : 16); // 16 is guessed capacity for most case - uint num_splits = 0; + uint numSplits = 0; // Use STL methods - size_t start, pos; + size_t start; + size_t pos; start = 0; do { pos = str.find_first_of(delims, start); if (pos == start) { // Do nothing start = pos + 1; - } else if (pos == String::npos || (max_splits && num_splits == max_splits)) { + } else if (pos == String::npos || (maxSplits && numSplits == maxSplits)) { // Copy the rest of the string strs.push_back(str.substr(start)); break; @@ -87,7 +118,7 @@ StringArray StringUtil::Split(const String &str, const String &delims, uint max_ } // parse up to next real data start = str.find_first_not_of(delims, start); - ++num_splits; + ++numSplits; } while (pos != String::npos); return strs; diff --git a/native/cocos/base/StringUtil.h b/native/cocos/base/StringUtil.h index 83dffac04e..7a559d1a0b 100755 --- a/native/cocos/base/StringUtil.h +++ b/native/cocos/base/StringUtil.h @@ -1,19 +1,42 @@ -#ifndef CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ -#define CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once #include "Macros.h" #include "TypeDef.h" +#include "memory/Memory.h" namespace cc { class CC_DLL StringUtil { public: - static int VPrintf(char *buf, char *last, const char *fmt, va_list args); - static int Printf(char *buf, char *last, const char *fmt, ...); - static String Format(const char *fmt, ...); - static StringArray Split(const String &str, const String &delims, uint max_splits = 0); + static int vprintf(char *buf, const char *last, const char *fmt, va_list args); + static int printf(char *buf, const char *last, const char *fmt, ...); + static String format(const char *fmt, ...); + static StringArray split(const String &str, const String &delims, uint maxSplits = 0); }; } // namespace cc - -#endif // CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ diff --git a/native/cocos/base/ThreadPool.cpp b/native/cocos/base/ThreadPool.cpp index 787361850a..ce482673b6 100644 --- a/native/cocos/base/ThreadPool.cpp +++ b/native/cocos/base/ThreadPool.cpp @@ -1,18 +1,20 @@ /**************************************************************************** Copyright (c) 2016-2017 Chukong Technologies Inc. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,15 +22,12 @@ 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. - - Inspired by https://github.com/vit-vit/CTPL - - ****************************************************************************/ +****************************************************************************/ #include "base/ThreadPool.h" #include "platform/StdC.h" -#include #include +#include #ifdef __ANDROID__ #include @@ -45,31 +44,31 @@ namespace cc { #define DEFAULT_THREAD_POOL_MIN_NUM (4) #define DEFAULT_THREAD_POOL_MAX_NUM (20) -#define DEFAULT_SHRINK_INTERVAL (5.0f) +#define DEFAULT_SHRINK_INTERVAL (5) #define DEFAULT_SHRINK_STEP (2) #define DEFAULT_STRETCH_STEP (2) -static ThreadPool *__defaultThreadPool = nullptr; +LegacyThreadPool *LegacyThreadPool::_instance = nullptr; -ThreadPool *ThreadPool::getDefaultThreadPool() { - if (__defaultThreadPool == nullptr) { - __defaultThreadPool = newCachedThreadPool(DEFAULT_THREAD_POOL_MIN_NUM, - DEFAULT_THREAD_POOL_MAX_NUM, - DEFAULT_SHRINK_INTERVAL, DEFAULT_SHRINK_STEP, - DEFAULT_STRETCH_STEP); +LegacyThreadPool *LegacyThreadPool::getDefaultThreadPool() { + if (LegacyThreadPool::_instance == nullptr) { + LegacyThreadPool::_instance = newCachedThreadPool(DEFAULT_THREAD_POOL_MIN_NUM, + DEFAULT_THREAD_POOL_MAX_NUM, + DEFAULT_SHRINK_INTERVAL, DEFAULT_SHRINK_STEP, + DEFAULT_STRETCH_STEP); } - return __defaultThreadPool; + return LegacyThreadPool::_instance; } -void ThreadPool::destroyDefaultThreadPool() { - delete __defaultThreadPool; - __defaultThreadPool = nullptr; +void LegacyThreadPool::destroyDefaultThreadPool() { + delete LegacyThreadPool::_instance; + LegacyThreadPool::_instance = nullptr; } -ThreadPool *ThreadPool::newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, - int shrinkStep, int stretchStep) { - ThreadPool *pool = new (std::nothrow) ThreadPool(minThreadNum, maxThreadNum); +LegacyThreadPool *LegacyThreadPool::newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, + int shrinkStep, int stretchStep) { + auto *pool = new (std::nothrow) LegacyThreadPool(minThreadNum, maxThreadNum); if (pool != nullptr) { pool->setFixedSize(false); pool->setShrinkInterval(shrinkInterval); @@ -79,40 +78,41 @@ ThreadPool *ThreadPool::newCachedThreadPool(int minThreadNum, int maxThreadNum, return pool; } -ThreadPool *ThreadPool::newFixedThreadPool(int threadNum) { - ThreadPool *pool = new (std::nothrow) ThreadPool(threadNum, threadNum); +LegacyThreadPool *LegacyThreadPool::newFixedThreadPool(int threadNum) { + auto *pool = new (std::nothrow) LegacyThreadPool(threadNum, threadNum); if (pool != nullptr) { pool->setFixedSize(true); } return pool; } -ThreadPool *ThreadPool::newSingleThreadPool() { - ThreadPool *pool = new (std::nothrow) ThreadPool(1, 1); +LegacyThreadPool *LegacyThreadPool::newSingleThreadPool() { + auto *pool = new (std::nothrow) LegacyThreadPool(1, 1); if (pool != nullptr) { pool->setFixedSize(true); } return pool; } -ThreadPool::ThreadPool(int minNum, int maxNum) -: _isDone(false), _isStop(false), _idleThreadNum(0), _minThreadNum(minNum), _maxThreadNum(maxNum), _initedThreadNum(0), _shrinkInterval(DEFAULT_SHRINK_INTERVAL), _shrinkStep(DEFAULT_SHRINK_STEP), _stretchStep(DEFAULT_STRETCH_STEP), _isFixedSize(false) { +LegacyThreadPool::LegacyThreadPool(int minNum, int maxNum) +: _minThreadNum(minNum), + _maxThreadNum(maxNum) { init(); } // the destructor waits for all the functions in the queue to be finished -ThreadPool::~ThreadPool() { +LegacyThreadPool::~LegacyThreadPool() { stop(); } // number of idle threads -int ThreadPool::getIdleThreadNum() const { - ThreadPool *thiz = const_cast(this); +int LegacyThreadPool::getIdleThreadNum() const { + auto * thiz = const_cast(this); std::lock_guard lk(thiz->_idleThreadNumMutex); return _idleThreadNum; } -void ThreadPool::init() { +void LegacyThreadPool::init() { _lastShrinkTime = std::chrono::high_resolution_clock::now(); _maxThreadNum = std::max(_minThreadNum, _maxThreadNum); @@ -130,19 +130,19 @@ void ThreadPool::init() { _initedFlags[i] = std::make_shared>(true); ++_initedThreadNum; } else { - _abortFlags[i] = std::make_shared>(true); + _abortFlags[i] = std::make_shared>(true); _initedFlags[i] = std::make_shared>(false); } } } -bool ThreadPool::tryShrinkPool() { +bool LegacyThreadPool::tryShrinkPool() { LOGD("shrink pool, _idleThreadNum = %d \n", getIdleThreadNum()); auto before = std::chrono::high_resolution_clock::now(); std::vector threadIDsToJoin; - int maxThreadNumToJoin = std::min(_initedThreadNum - _minThreadNum, _shrinkStep); + int maxThreadNumToJoin = std::min(_initedThreadNum - _minThreadNum, _shrinkStep); for (int i = 0; i < _maxThreadNum; ++i) { if ((int)threadIDsToJoin.size() >= maxThreadNumToJoin) { @@ -177,13 +177,10 @@ bool ThreadPool::tryShrinkPool() { LOGD("shrink %d threads, waste: %f seconds\n", (int)threadIDsToJoin.size(), seconds); - if (_initedThreadNum <= _minThreadNum) - return true; - - return false; + return (_initedThreadNum <= _minThreadNum); } -void ThreadPool::stretchPool(int count) { +void LegacyThreadPool::stretchPool(int count) { auto before = std::chrono::high_resolution_clock::now(); int oldThreadCount = _initedThreadNum; @@ -203,7 +200,7 @@ void ThreadPool::stretchPool(int count) { } if (newThreadCount > 0) { - auto after = std::chrono::high_resolution_clock::now(); + auto after = std::chrono::high_resolution_clock::now(); float seconds = TIME_MINUS(after, before); LOGD("stretch pool from %d to %d, waste %f seconds\n", oldThreadCount, _initedThreadNum, @@ -211,8 +208,8 @@ void ThreadPool::stretchPool(int count) { } } -void ThreadPool::pushTask(const std::function &runnable, - TaskType type /* = DEFAULT*/) { +void LegacyThreadPool::pushTask(const std::function &runnable, + TaskType type /* = DEFAULT*/) { if (!_isFixedSize) { _idleThreadNumMutex.lock(); int idleNum = _idleThreadNum; @@ -220,7 +217,7 @@ void ThreadPool::pushTask(const std::function &runnable, if (idleNum > _minThreadNum) { if (_taskQueue.empty()) { - auto now = std::chrono::high_resolution_clock::now(); + auto now = std::chrono::high_resolution_clock::now(); float seconds = TIME_MINUS(now, _lastShrinkTime); if (seconds > _shrinkInterval) { tryShrinkPool(); @@ -237,9 +234,9 @@ void ThreadPool::pushTask(const std::function &runnable, }); Task task; - task.type = type; + task.type = type; task.callback = callback; - _taskQueue.push(std::move(task)); + _taskQueue.push(task); { std::unique_lock lock(_mutex); @@ -247,14 +244,14 @@ void ThreadPool::pushTask(const std::function &runnable, } } -void ThreadPool::stopAllTasks() { +void LegacyThreadPool::stopAllTasks() { Task task; while (_taskQueue.pop(task)) { delete task.callback; // empty the queue } } -void ThreadPool::stopTasksByType(TaskType type) { +void LegacyThreadPool::stopTasksByType(TaskType type) { Task task; std::vector notStopTasks; @@ -275,7 +272,7 @@ void ThreadPool::stopTasksByType(TaskType type) { } } -void ThreadPool::joinThread(int tid) { +void LegacyThreadPool::joinThread(int tid) { if (tid < 0 || tid >= (int)_threads.size()) { LOGD("Invalid thread id %d\n", tid); return; @@ -289,32 +286,37 @@ void ThreadPool::joinThread(int tid) { } } -int ThreadPool::getTaskNum() const { +int LegacyThreadPool::getTaskNum() const { return (int)_taskQueue.size(); } -void ThreadPool::setFixedSize(bool isFixedSize) { +void LegacyThreadPool::setFixedSize(bool isFixedSize) { _isFixedSize = isFixedSize; } -void ThreadPool::setShrinkInterval(int seconds) { - if (seconds >= 0) - _shrinkInterval = (float)seconds; +void LegacyThreadPool::setShrinkInterval(int seconds) { + if (seconds >= 0) { + _shrinkInterval = static_cast(seconds); + } } -void ThreadPool::setShrinkStep(int step) { - if (step > 0) +void LegacyThreadPool::setShrinkStep(int step) { + if (step > 0) { _shrinkStep = step; + } } -void ThreadPool::setStretchStep(int step) { - if (step > 0) +void LegacyThreadPool::setStretchStep(int step) { + if (step > 0) { _stretchStep = step; + } } -void ThreadPool::stop() { - if (_isDone || _isStop) +void LegacyThreadPool::stop() { + if (_isDone || _isStop) { return; + } + _isDone = true; // give the waiting threads a command to finish { @@ -332,22 +334,23 @@ void ThreadPool::stop() { _abortFlags.clear(); } -void ThreadPool::setThread(int tid) { - std::shared_ptr> abort_ptr( +void LegacyThreadPool::setThread(int tid) { + std::shared_ptr> abortPtr( _abortFlags[tid]); // a copy of the shared ptr to the flag - auto f = [this, tid, abort_ptr /* a copy of the shared ptr to the abort */]() { - std::atomic &abort = *abort_ptr; - Task task; - bool isPop = _taskQueue.pop(task); + auto f = [this, tid, abortPtr /* a copy of the shared ptr to the abort */]() { + std::atomic &abort = *abortPtr; + Task task; + bool isPop = _taskQueue.pop(task); while (true) { while (isPop) { // if there is anything in the queue std::unique_ptr> func( task.callback); // at return, delete the function even if an exception occurred (*task.callback)(tid); - if (abort) + if (abort) { return; // the thread is wanted to stop, return even if the queue is not empty yet - else - isPop = _taskQueue.pop(task); + } + + isPop = _taskQueue.pop(task); } // the queue is empty here, wait for the next command std::unique_lock lock(_mutex); @@ -365,8 +368,9 @@ void ThreadPool::setThread(int tid) { --_idleThreadNum; _idleThreadNumMutex.unlock(); - if (!isPop) + if (!isPop) { return; // if the queue is empty and isDone == true or *flag then return + } } }; _threads[tid].reset( diff --git a/native/cocos/base/ThreadPool.h b/native/cocos/base/ThreadPool.h index 706bdca3cf..9a929a0c0f 100644 --- a/native/cocos/base/ThreadPool.h +++ b/native/cocos/base/ThreadPool.h @@ -1,18 +1,20 @@ /**************************************************************************** Copyright (c) 2016-2017 Chukong Technologies Inc. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,32 +22,25 @@ 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. - - Inspired by https://github.com/vit-vit/CTPL - - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "base/Utils.h" -#include -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include namespace cc { -/** - * @addtogroup base - * @{ - */ - -class CC_DLL ThreadPool { +class CC_DLL LegacyThreadPool { public: enum class TaskType { DEFAULT = 0, @@ -58,7 +53,7 @@ public: /* * Gets the default thread pool which is a cached thread pool with default parameters. */ - static ThreadPool *getDefaultThreadPool(); + static LegacyThreadPool *getDefaultThreadPool(); /* * Destroys the default thread pool @@ -69,23 +64,23 @@ public: * Creates a cached thread pool * @note The return value has to be delete while it doesn't needed */ - static ThreadPool *newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, - int shrinkStep, int stretchStep); + static LegacyThreadPool *newCachedThreadPool(int minThreadNum, int maxThreadNum, int shrinkInterval, + int shrinkStep, int stretchStep); /* * Creates a thread pool with fixed thread count * @note The return value has to be delete while it doesn't needed */ - static ThreadPool *newFixedThreadPool(int threadNum); + static LegacyThreadPool *newFixedThreadPool(int threadNum); /* * Creates a thread pool with only one thread in the pool, it could be used to execute multiply tasks serially in just one thread. * @note The return value has to be delete while it doesn't needed */ - static ThreadPool *newSingleThreadPool(); + static LegacyThreadPool *newSingleThreadPool(); // the destructor waits for all the functions in the queue to be finished - ~ThreadPool(); + ~LegacyThreadPool(); /* Pushs a task to thread pool * @param runnable The callback of the task executed in sub thread @@ -122,15 +117,15 @@ public: bool tryShrinkPool(); private: - ThreadPool(int minNum, int maxNum); + LegacyThreadPool(int minNum, int maxNum); - ThreadPool(const ThreadPool &); + LegacyThreadPool(const LegacyThreadPool &); - ThreadPool(ThreadPool &&); + LegacyThreadPool(LegacyThreadPool &&) noexcept; - ThreadPool &operator=(const ThreadPool &); + LegacyThreadPool &operator=(const LegacyThreadPool &); - ThreadPool &operator=(ThreadPool &&); + LegacyThreadPool &operator=(LegacyThreadPool &&) noexcept; void init(); @@ -150,7 +145,7 @@ private: void stretchPool(int count); - std::vector> _threads; + std::vector> _threads; std::vector>> _abortFlags; std::vector>> _idleFlags; std::vector>> _initedFlags; @@ -175,51 +170,50 @@ private: } bool empty() const { - auto thiz = const_cast(this); + auto thiz = const_cast(this); std::unique_lock lock(thiz->mutex); return this->q.empty(); } size_t size() const { - auto thiz = const_cast(this); + auto thiz = const_cast(this); std::unique_lock lock(thiz->mutex); return this->q.size(); } private: std::queue q; - std::mutex mutex; + std::mutex mutex; }; struct Task { - TaskType type; + TaskType type; std::function *callback; }; + static LegacyThreadPool *_instance; + ThreadSafeQueue _taskQueue; - std::atomic _isDone; - std::atomic _isStop; + std::atomic _isDone{false}; + std::atomic _isStop{false}; //IDEA: std::atomic isn't supported by ndk-r10e while compiling with `armeabi` arch. // So using a mutex here instead. - int _idleThreadNum; // how many threads are waiting + int _idleThreadNum{0}; // how many threads are waiting std::mutex _idleThreadNumMutex; - std::mutex _mutex; + std::mutex _mutex; std::condition_variable _cv; - int _minThreadNum; - int _maxThreadNum; - int _initedThreadNum; + int _minThreadNum{0}; + int _maxThreadNum{0}; + int _initedThreadNum{0}; std::chrono::time_point _lastShrinkTime; - float _shrinkInterval; - int _shrinkStep; - int _stretchStep; - bool _isFixedSize; + float _shrinkInterval{5}; + int _shrinkStep{2}; + int _stretchStep{2}; + bool _isFixedSize{false}; }; -// end of base group -/// @} - } // namespace cc diff --git a/native/cocos/base/TypeDef.h b/native/cocos/base/TypeDef.h index e896fc2bbe..994139c326 100755 --- a/native/cocos/base/TypeDef.h +++ b/native/cocos/base/TypeDef.h @@ -1,18 +1,59 @@ -#ifndef CC_CORE_TYPE_DEF_H_ -#define CC_CORE_TYPE_DEF_H_ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. -typedef unsigned int uint; -typedef unsigned short ushort; -typedef unsigned long ulong; + http://www.cocos.com -typedef unsigned int FlagBits; + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -#define CC_ENUM_OPERATORS(type_) \ - CC_INLINE type_ operator|(type_ lhs, type_ rhs) { return (type_)(static_cast::type /**/>(lhs) | static_cast::type /**/>(rhs)); } \ - CC_INLINE void operator|=(type_ &lhs, type_ rhs) { lhs = (type_)(static_cast::type /**/>(lhs) | static_cast::type /**/>(rhs)); } \ - CC_INLINE int operator&(type_ lhs, type_ rhs) { return (int)(static_cast::type /**/>(lhs) & static_cast::type /**/>(rhs)); } \ - CC_INLINE void operator&=(type_ &lhs, type_ rhs) { lhs = (type_)(static_cast::type /**/>(lhs) & static_cast::type /**/>(rhs)); } \ - CC_INLINE bool operator||(type_ lhs, type_ rhs) { return (static_cast::type /**/>(lhs) || static_cast::type /**/>(rhs)); } \ - CC_INLINE bool operator&&(type_ lhs, type_ rhs) { return (static_cast::type /**/>(lhs) && static_cast::type /**/>(rhs)); } + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -#endif // CC_CORE_TYPE_DEF_H_ + 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. +****************************************************************************/ + +#pragma once + +#include + +using uint = uint32_t; +using ushort = uint16_t; +using ulong = uint32_t; +using FlagBits = uint32_t; + +#define CC_ENUM_OPERATORS(T) \ + inline T operator~(const T v) { return static_cast(~static_cast::type>(v)); } \ + inline bool operator||(const T lhs, const T rhs) { return (static_cast::type>(lhs) || static_cast::type>(rhs)); } \ + inline bool operator&&(const T lhs, const T rhs) { return (static_cast::type>(lhs) && static_cast::type>(rhs)); } \ + inline T operator|(const T lhs, const T rhs) { return static_cast(static_cast::type>(lhs) | static_cast::type>(rhs)); } \ + inline T operator&(const T lhs, const T rhs) { return static_cast(static_cast::type>(lhs) & static_cast::type>(rhs)); } \ + inline T operator^(const T lhs, const T rhs) { return static_cast(static_cast::type>(lhs) ^ static_cast::type>(rhs)); } \ + inline void operator|=(T &lhs, const T rhs) { lhs = static_cast(static_cast::type>(lhs) | static_cast::type>(rhs)); } \ + inline void operator&=(T &lhs, const T rhs) { lhs = static_cast(static_cast::type>(lhs) & static_cast::type>(rhs)); } \ + inline void operator^=(T &lhs, const T rhs) { lhs = static_cast(static_cast::type>(lhs) ^ static_cast::type>(rhs)); } \ + inline bool hasFlag(const T flags, const T flagToTest) { \ + using ValueType = std::underlying_type::type; \ + CCASSERT((static_cast(flagToTest) & (static_cast(flagToTest) - 1)) == 0, "More than one flag specified"); \ + return (static_cast(flags) & static_cast(flagToTest)) != 0; \ + } \ + inline bool hasAnyFlags(const T flags, const T flagsToTest) { \ + using ValueType = std::underlying_type::type; \ + return (static_cast(flags) & static_cast(flagsToTest)) != 0; \ + } \ + inline bool hasAllFlags(const T flags, const T flagsToTest) { \ + using ValueType = std::underlying_type::type; \ + return (static_cast(flags) & static_cast(flagsToTest)) == static_cast(flagsToTest); \ + } \ + inline T addFlags(const T flags, const T flagsToAdd) { return (flags | flagsToAdd); } \ + inline T removeFlags(const T flags, const T flagsToRemove) { return (flags & ~flagsToRemove); } diff --git a/native/cocos/base/UTF8.cpp b/native/cocos/base/UTF8.cpp index 3c7728114e..6606b25b7b 100644 --- a/native/cocos/base/UTF8.cpp +++ b/native/cocos/base/UTF8.cpp @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2014 cocos2d-x.org Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,14 +23,15 @@ 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 "base/UTF8.h" -#include "base/Log.h" -#include "ConvertUTF/ConvertUTF.h" -#include -#include +#include +#include + +#include "ConvertUTF/ConvertUTF.h" +#include "base/Log.h" namespace cc { @@ -64,8 +66,11 @@ unsigned int getIndexOfLastNotChar16(const std::vector &str, char16_t int len = static_cast(str.size()); int i = len - 1; - for (; i >= 0; --i) - if (str[i] != c) return i; + for (; i >= 0; --i) { + if (str[i] != c) { + return i; + } + } return i; } @@ -80,8 +85,9 @@ unsigned int getIndexOfLastNotChar16(const std::vector &str, char16_t * */ static void trimUTF16VectorFromIndex(std::vector &str, int index) { int size = static_cast(str.size()); - if (index >= size || index < 0) + if (index >= size || index < 0) { return; + } str.erase(str.begin() + index, str.begin() + size); } @@ -111,39 +117,43 @@ bool isCJKUnicode(char16_t ch) { void trimUTF16Vector(std::vector &str) { int len = static_cast(str.size()); - if (len <= 0) + if (len <= 0) { return; + } - int last_index = len - 1; + int lastIndex = len - 1; // Only start trimming if the last character is whitespace.. - if (isUnicodeSpace(str[last_index])) { - for (int i = last_index - 1; i >= 0; --i) { - if (isUnicodeSpace(str[i])) - last_index = i; - else + if (isUnicodeSpace(str[lastIndex])) { + for (int i = lastIndex - 1; i >= 0; --i) { + if (isUnicodeSpace(str[i])) { + lastIndex = i; + } + + else { break; + } } - trimUTF16VectorFromIndex(str, last_index); + trimUTF16VectorFromIndex(str, lastIndex); } } template struct ConvertTrait { - typedef T ArgType; + using ArgType = T; }; template <> struct ConvertTrait { - typedef UTF8 ArgType; + using ArgType = UTF8; }; template <> struct ConvertTrait { - typedef UTF16 ArgType; + using ArgType = UTF16; }; template <> struct ConvertTrait { - typedef UTF32 ArgType; + using ArgType = UTF32; }; template , typename ToTrait = ConvertTrait> @@ -161,10 +171,10 @@ bool utfConvert( } // See: http://unicode.org/faq/utf_bom.html#gen6 - static const int most_bytes_per_character = 4; + static const int mostBytesPerCharacter = 4; const size_t maxNumberOfChars = from.length(); // all UTFs at most one element represents one character. - const size_t numberOfOut = maxNumberOfChars * most_bytes_per_character / sizeof(To); + const size_t numberOfOut = maxNumberOfChars * mostBytesPerCharacter / sizeof(To); std::basic_string working(numberOfOut, 0); @@ -173,9 +183,10 @@ bool utfConvert( auto outbeg = reinterpret_cast(&working[0]); auto outend = outbeg + working.length(); - auto r = cvtfunc(&inbeg, inend, &outbeg, outend, strictConversion); - if (r != conversionOK) + auto r = cvtfunc(&inbeg, inend, &outbeg, outend, strictConversion); + if (r != conversionOK) { return false; + } working.resize(reinterpret_cast(outbeg) - &working[0]); to = std::move(working); @@ -184,9 +195,9 @@ bool utfConvert( }; CC_DLL void UTF8LooseFix(const std::string &in, std::string &out) { - const UTF8 *p = (const UTF8 *)in.c_str(); - const UTF8 *end = (const UTF8 *)(in.c_str() + in.size()); - unsigned ucharLen = 0; + const UTF8 *p = (const UTF8 *)in.c_str(); + const UTF8 *end = (const UTF8 *)(in.c_str() + in.size()); + unsigned ucharLen = 0; while (p < end) { ucharLen = getNumBytesForUTF8(*p); if (isLegalUTF8Sequence(p, p + ucharLen)) { @@ -226,11 +237,11 @@ bool UTF32ToUTF16(const std::u32string &utf32, std::u16string &outUtf16) { #if (CC_PLATFORM == CC_PLATFORM_ANDROID) std::string getStringUTFCharsJNI(JNIEnv *env, jstring srcjStr, bool *ret) { - std::string utf8Str; - const unsigned short *unicodeChar = (const unsigned short *)env->GetStringChars(srcjStr, nullptr); - size_t unicodeCharLength = env->GetStringLength(srcjStr); + std::string utf8Str; + auto * unicodeChar = static_cast(env->GetStringChars(srcjStr, nullptr)); + size_t unicodeCharLength = env->GetStringLength(srcjStr); const std::u16string unicodeStr((const char16_t *)unicodeChar, unicodeCharLength); - bool flag = UTF16ToUTF8(unicodeStr, utf8Str); + bool flag = UTF16ToUTF8(unicodeStr, utf8Str); if (ret) { *ret = flag; @@ -245,7 +256,7 @@ std::string getStringUTFCharsJNI(JNIEnv *env, jstring srcjStr, bool *ret) { jstring newStringUTFJNI(JNIEnv *env, const std::string &utf8Str, bool *ret) { std::u16string utf16Str; - bool flag = cc::StringUtils::UTF8ToUTF16(utf8Str, utf16Str); + bool flag = cc::StringUtils::UTF8ToUTF16(utf8Str, utf16Str); if (ret) { *ret = flag; @@ -267,16 +278,10 @@ long getCharacterCountInUTF8String(const std::string &utf8) { return getUTF8StringLength((const UTF8 *)utf8.c_str()); } -StringUTF8::StringUTF8() { -} - StringUTF8::StringUTF8(const std::string &newStr) { replace(newStr); } -StringUTF8::~StringUTF8() { -} - std::size_t StringUTF8::length() const { return _str.size(); } @@ -319,9 +324,8 @@ bool StringUTF8::deleteChar(std::size_t pos) { if (pos < _str.size()) { _str.erase(_str.begin() + pos); return true; - } else { - return false; } + return false; } bool StringUTF8::insert(std::size_t pos, const std::string &insertStr) { @@ -335,9 +339,8 @@ bool StringUTF8::insert(std::size_t pos, const StringUTF8 &insertStr) { _str.insert(_str.begin() + pos, insertStr._str.begin(), insertStr._str.end()); return true; - } else { - return false; } + return false; } } // namespace StringUtils diff --git a/native/cocos/base/UTF8.h b/native/cocos/base/UTF8.h index 51b3a162f5..a75d866118 100644 --- a/native/cocos/base/UTF8.h +++ b/native/cocos/base/UTF8.h @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2014 cocos2d-x.org Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,15 +23,14 @@ 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 __cocos2dx__ccUTF8__ -#define __cocos2dx__ccUTF8__ +#pragma once #include "base/Macros.h" -#include -#include #include +#include +#include #if (CC_PLATFORM == CC_PLATFORM_ANDROID) #include "platform/android/jni/JniHelper.h" @@ -189,16 +189,16 @@ class CC_DLL StringUTF8 { public: struct CharUTF8 { std::string _char; - bool isAnsi() { return _char.size() == 1; } + bool isAnsi() { return _char.size() == 1; } }; - typedef std::vector CharUTF8Store; + using CharUTF8Store = std::vector; - StringUTF8(); - StringUTF8(const std::string &newStr); - ~StringUTF8(); + StringUTF8() = default; + explicit StringUTF8(const std::string &newStr); + ~StringUTF8() = default; std::size_t length() const; - void replace(const std::string &newStr); + void replace(const std::string &newStr); std::string getAsCharSequence() const; @@ -215,5 +215,3 @@ private: } // namespace StringUtils } // namespace cc - -#endif /** defined(__cocos2dx__ccUTF8__) */ diff --git a/native/cocos/base/UTFString.cpp b/native/cocos/base/UTFString.cpp deleted file mode 100755 index d770acec40..0000000000 --- a/native/cocos/base/UTFString.cpp +++ /dev/null @@ -1,569 +0,0 @@ -#include "UTFString.h" -#include "memory/Memory.h" - -namespace cc { - -UTFString::unicode_char UTFString::_base_iterator::_getCharacter() const { - return string_->getChar(_get_index()); -} - -int UTFString::_base_iterator::_setCharacter(unicode_char uc) { - size_type current_index = _get_index(); - int change = string_->setChar(current_index, uc); - _jump_to(current_index); - return change; -} - -void UTFString::_base_iterator::_moveNext() { - _seekFwd(1); // move 1 code point forward - if (_test_end()) return; // exit if we hit the end - if (_utf16_surrogate_follow(iter_[0])) { - // landing on a follow code point means we might be part of a bigger character - // so we test for that - code_point lead_half = 0; - //NB: we can't possibly be at the beginning here, so no need to test - lead_half = iter_[-1]; // check the previous code point to see if we're part of a surrogate pair - if (_utf16_surrogate_lead(lead_half)) { - _seekFwd(1); // if so, then advance 1 more code point - } - } -} - -void UTFString::_base_iterator::_movePrev() { - _seekRev(1); // move 1 code point backwards - if (_test_begin()) return; // exit if we hit the beginning - if (_utf16_surrogate_follow(iter_[0])) { - // landing on a follow code point means we might be part of a bigger character - // so we test for that - code_point lead_half = 0; - lead_half = iter_[-1]; // check the previous character to see if we're part of a surrogate pair - if (_utf16_surrogate_lead(lead_half)) { - _seekRev(1); // if so, then rewind 1 more code point - } - } -} - -////////////////////////////////////////////////////////////////////////// - -UTFString::unicode_char UTFString::getChar(size_type loc) const { - const code_point *ptr = c_str(); - unicode_char uc; - size_t l = _utf16_char_length(ptr[loc]); - code_point cp[2] = {/* blame the code beautifier */ - 0, 0}; - cp[0] = ptr[loc]; - - if (l == 2 && (loc + 1) < m_data.length()) { - cp[1] = ptr[loc + 1]; - } - _utf16_to_utf32(cp, uc); - return uc; -} - -int UTFString::setChar(size_type loc, unicode_char ch) { - code_point cp[2] = {/* blame the code beautifier */ - 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - unicode_char existingChar = getChar(loc); - size_t existingSize = _utf16_char_length(existingChar); - size_t newSize = _utf16_char_length(ch); - - if (newSize > existingSize) { - at(loc) = cp[0]; - insert(loc + 1, 1, cp[1]); - return 1; - } - if (newSize < existingSize) { - erase(loc, 1); - at(loc) = cp[0]; - return -1; - } - - // newSize == existingSize - at(loc) = cp[0]; - if (l == 2) at(loc + 1) = cp[1]; - return 0; -} - -UTFString &UTFString::assign(const String &str) { - size_type len = _verifyUTF8(str); - clear(); // empty our contents, if there are any - if (len == 0) { - return *this; - } - - reserve(len); // best guess bulk capacity growth - - // This is a 3 step process, converting each byte in the UTF-8 stream to UTF-32, - // then converting it to UTF-16, then finally appending the data buffer - - unicode_char uc = 0; // temporary Unicode character buffer - unsigned char utf8buf[7]; // temporary UTF-8 buffer - utf8buf[6] = 0; - size_t utf8len; // UTF-8 length - code_point utf16buff[3]; // temporary UTF-16 buffer - utf16buff[2] = 0; - size_t utf16len; // UTF-16 length - - String::const_iterator i, ie = str.end(); - for (i = str.begin(); i != ie; i++) { - utf8len = _utf8_char_length(static_cast(*i)); // estimate bytes to load - for (size_t j = 0; j < utf8len; j++) { // load the needed UTF-8 bytes - utf8buf[j] = (static_cast(*(i + j))); // we don't increment 'i' here just in case the estimate is wrong (shouldn't happen, but we're being careful) - } - utf8buf[utf8len] = 0; // nul terminate so we throw an exception before running off the end of the buffer - utf8len = _utf8_to_utf32(utf8buf, uc); // do the UTF-8 -> UTF-32 conversion - i += utf8len - 1; // we subtract 1 for the increment of the 'for' loop - - utf16len = _utf32_to_utf16(uc, utf16buff); // UTF-32 -> UTF-16 conversion - append(utf16buff, utf16len); // append the characters to the string - } - return *this; -} - -UTFString &UTFString::assign(const WString &wstr) { - m_data.clear(); - m_data.reserve(wstr.length()); // best guess bulk allocate -#ifdef WCHAR_UTF16 // if we're already working in UTF-16, this is easy - code_point tmp; - WString::const_iterator i, ie = wstr.end(); - for (i = wstr.begin(); i != ie; i++) { - tmp = static_cast(*i); - m_data.push_back(tmp); - } -#else // otherwise we do it the safe way (which is still 100% safe to pass UTF-16 through, just slower) - code_point cp[3] = {0, 0, 0}; - unicode_char tmp; - WString::const_iterator i, ie = wstr.end(); - for (i = wstr.begin(); i != ie; i++) { - tmp = static_cast(*i); - size_t l = _utf32_to_utf16(tmp, cp); - if (l > 0) m_data.push_back(cp[0]); - if (l > 1) m_data.push_back(cp[1]); - } -#endif - return *this; -} - -UTFString &UTFString::append(size_type num, unicode_char ch) { - code_point cp[2] = {0, 0}; - if (_utf32_to_utf16(ch, cp) == 2) { - for (size_type i = 0; i < num; i++) { - append(1, cp[0]); - append(1, cp[1]); - } - } else { - for (size_type i = 0; i < num; i++) { - append(1, cp[0]); - } - } - return *this; -} - -UTFString &UTFString::insert(size_type index, size_type num, unicode_char ch) { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - if (l == 1) { - return insert(index, num, cp[0]); - } - for (size_type c = 0; c < num; c++) { - // insert in reverse order to preserve ordering after insert - insert(index, 1, cp[1]); - insert(index, 1, cp[0]); - } - return *this; -} - -void UTFString::insert(iterator i, size_type num, const unicode_char &ch) { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - if (l == 1) { - insert(i, num, cp[0]); - } else { - for (size_type c = 0; c < num; c++) { - // insert in reverse order to preserve ordering after insert - insert(i, 1, cp[1]); - insert(i, 1, cp[0]); - } - } -} - -UTFString::size_type UTFString::find_first_of(const UTFString &str, size_type index /*= 0*/, size_type num /*= npos */) const { - size_type i = 0; - const size_type len = length(); - while (i < num && (index + i) < len) { - unicode_char ch = getChar(index + i); - if (str.inString(ch)) - return index + i; - i += _utf16_char_length(ch); // increment by the Unicode character length - } - return npos; -} - -UTFString::size_type UTFString::find_first_not_of(const UTFString &str, size_type index /*= 0*/, size_type num /*= npos */) const { - size_type i = 0; - const size_type len = length(); - while (i < num && (index + i) < len) { - unicode_char ch = getChar(index + i); - if (!str.inString(ch)) - return index + i; - i += _utf16_char_length(ch); // increment by the Unicode character length - } - return npos; -} - -UTFString::size_type UTFString::find_last_of(const UTFString &str, size_type index /*= npos*/, size_type num /*= npos */) const { - size_type i = 0; - const size_type len = length(); - if (index > len) index = len - 1; - - while (i < num && (index - i) != npos) { - size_type j = index - i; - // careful to step full Unicode characters - if (j != 0 && _utf16_surrogate_follow(at(j)) && _utf16_surrogate_lead(at(j - 1))) { - j = index - ++i; - } - // and back to the usual dull test - unicode_char ch = getChar(j); - if (str.inString(ch)) - return j; - i++; - } - return npos; -} - -UTFString::size_type UTFString::find_last_not_of(const UTFString &str, size_type index /*= npos*/, size_type num /*= npos */) const { - size_type i = 0; - const size_type len = length(); - if (index > len) index = len - 1; - - while (i < num && (index - i) != npos) { - size_type j = index - i; - // careful to step full Unicode characters - if (j != 0 && _utf16_surrogate_follow(at(j)) && _utf16_surrogate_lead(at(j - 1))) { - j = index - ++i; - } - // and back to the usual dull test - unicode_char ch = getChar(j); - if (!str.inString(ch)) - return j; - i++; - } - return npos; -} - -size_t UTFString::_utf16_to_utf32(const code_point in_cp[2], unicode_char &out_uc) { - const code_point &cp1 = in_cp[0]; - const code_point &cp2 = in_cp[1]; - bool wordPair = false; - - // does it look like a surrogate pair? - if (0xD800 <= cp1 && cp1 <= 0xDBFF) { - // looks like one, but does the other half match the algorithm as well? - if (0xDC00 <= cp2 && cp2 <= 0xDFFF) - wordPair = true; // yep! - } - - if (!wordPair) { // if we aren't a 100% authentic surrogate pair, then just copy the value - out_uc = cp1; - return 1; - } - - unsigned short cU = cp1, cL = cp2; // copy upper and lower words of surrogate pair to writable buffers - cU -= 0xD800; // remove the encoding markers - cL -= 0xDC00; - - out_uc = (cU & 0x03FF) << 10; // grab the 10 upper bits and set them in their proper location - out_uc |= (cL & 0x03FF); // combine in the lower 10 bits - out_uc += 0x10000; // add back in the value offset - - return 2; // this whole operation takes to words, so that's what we'll return -} - -size_t UTFString::_utf32_to_utf16(const unicode_char &in_uc, code_point out_cp[2]) { - if (in_uc <= 0xFFFF) { // we blindly preserve sentinel values because our decoder understands them - out_cp[0] = static_cast(in_uc); - return 1; - } - unicode_char uc = in_uc; // copy to writable buffer - unsigned short tmp; // single code point buffer - uc -= 0x10000; // subtract value offset - - //process upper word - tmp = static_cast((uc >> 10) & 0x03FF); // grab the upper 10 bits - tmp += 0xD800; // add encoding offset - out_cp[0] = tmp; // write - - // process lower word - tmp = static_cast(uc & 0x03FF); // grab the lower 10 bits - tmp += 0xDC00; // add encoding offset - out_cp[1] = tmp; // write - - return 2; // return used word count (2 for surrogate pairs) -} - -size_t UTFString::_utf8_char_length(unsigned char cp) { - if (!(cp & 0x80)) return 1; - if ((cp & ~_lead1_mask) == _lead1) return 2; - if ((cp & ~_lead2_mask) == _lead2) return 3; - if ((cp & ~_lead3_mask) == _lead3) return 4; - if ((cp & ~_lead4_mask) == _lead4) return 5; - if ((cp & ~_lead5_mask) == _lead5) return 6; - - CCASSERT(0, "invalid UTF-8 sequence header value"); - return 1; -} - -size_t UTFString::_utf8_char_length(unicode_char uc) { - /* - 7 bit: U-00000000 - U-0000007F: 0xxxxxxx - 11 bit: U-00000080 - U-000007FF: 110xxxxx 10xxxxxx - 16 bit: U-00000800 - U-0000FFFF: 1110xxxx 10xxxxxx 10xxxxxx - 21 bit: U-00010000 - U-001FFFFF: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - 26 bit: U-00200000 - U-03FFFFFF: 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - 31 bit: U-04000000 - U-7FFFFFFF: 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - */ - if (!(uc & ~0x0000007F)) return 1; - if (!(uc & ~0x000007FF)) return 2; - if (!(uc & ~0x0000FFFF)) return 3; - if (!(uc & ~0x001FFFFF)) return 4; - if (!(uc & ~0x03FFFFFF)) return 5; - if (!(uc & ~0x7FFFFFFF)) return 6; - - CCASSERT(0, "invalid UTF-32 value"); - return 1; -} - -size_t UTFString::_utf8_to_utf32(const unsigned char in_cp[6], unicode_char &out_uc) { - size_t len = _utf8_char_length(in_cp[0]); - if (len == 1) { // if we are only 1 byte long, then just grab it and exit - out_uc = in_cp[0]; - return 1; - } - - unicode_char c = 0; // temporary buffer - size_t i = 0; - switch (len) { // load header byte - case 6: - c = in_cp[i] & _lead5_mask; - break; - case 5: - c = in_cp[i] & _lead4_mask; - break; - case 4: - c = in_cp[i] & _lead3_mask; - break; - case 3: - c = in_cp[i] & _lead2_mask; - break; - case 2: - c = in_cp[i] & _lead1_mask; - break; - } - - for (++i; i < len; i++) { // load each continuation byte - if ((in_cp[i] & ~_cont_mask) != _cont) { - CCASSERT(0, "bad UTF-8 continuation byte"); - break; - } - c <<= 6; - c |= (in_cp[i] & _cont_mask); - } - - out_uc = c; // write the final value and return the used byte length - return len; -} - -size_t UTFString::_utf32_to_utf8(const unicode_char &in_uc, unsigned char out_cp[6]) { - size_t len = _utf8_char_length(in_uc); // predict byte length of sequence - unicode_char c = in_uc; // copy to temp buffer - - //stuff all of the lower bits - for (size_t i = len - 1; i > 0; i--) { - out_cp[i] = static_cast(((c)&_cont_mask) | _cont); - c >>= 6; - } - - //now write the header byte - switch (len) { - case 6: - out_cp[0] = static_cast(((c)&_lead5_mask) | _lead5); - break; - case 5: - out_cp[0] = static_cast(((c)&_lead4_mask) | _lead4); - break; - case 4: - out_cp[0] = static_cast(((c)&_lead3_mask) | _lead3); - break; - case 3: - out_cp[0] = static_cast(((c)&_lead2_mask) | _lead2); - break; - case 2: - out_cp[0] = static_cast(((c)&_lead1_mask) | _lead1); - break; - case 1: - default: - out_cp[0] = static_cast((c)&0x7F); - break; - } - - // return the byte length of the sequence - return len; -} - -UTFString::size_type UTFString::_verifyUTF8(const String &str) { - String::const_iterator i, ie = str.end(); - i = str.begin(); - size_type length = 0; - - while (i != ie) { - // characters pass until we find an extended sequence - if ((*i) & 0x80) { - unsigned char c = (*i); - size_t contBytes = 0; - - // get continuation byte count and test for overlong sequences - if ((c & ~_lead1_mask) == _lead1) { // 1 additional byte - if (c == _lead1) { - CCASSERT(0, "overlong UTF-8 sequence"); - return 0; - } - contBytes = 1; - - } else if ((c & ~_lead2_mask) == _lead2) { // 2 additional bytes - contBytes = 2; - if (c == _lead2) { // possible overlong UTF-8 sequence - c = (*(i + 1)); // look ahead to next byte in sequence - if ((c & _lead2) == _cont) { - CCASSERT(0, "overlong UTF-8 sequence"); - return 0; - } - } - - } else if ((c & ~_lead3_mask) == _lead3) { // 3 additional bytes - contBytes = 3; - if (c == _lead3) { // possible overlong UTF-8 sequence - c = (*(i + 1)); // look ahead to next byte in sequence - if ((c & _lead3) == _cont) { - CCASSERT(0, "overlong UTF-8 sequence"); - return 0; - } - } - - } else if ((c & ~_lead4_mask) == _lead4) { // 4 additional bytes - contBytes = 4; - if (c == _lead4) { // possible overlong UTF-8 sequence - c = (*(i + 1)); // look ahead to next byte in sequence - if ((c & _lead4) == _cont) { - CCASSERT(0, "overlong UTF-8 sequence"); - return 0; - } - } - - } else if ((c & ~_lead5_mask) == _lead5) { // 5 additional bytes - contBytes = 5; - if (c == _lead5) { // possible overlong UTF-8 sequence - c = (*(i + 1)); // look ahead to next byte in sequence - if ((c & _lead5) == _cont) { - CCASSERT(0, "overlong UTF-8 sequence"); - return 0; - } - } - } - - // check remaining continuation bytes for - while (contBytes--) { - c = (*(++i)); // get next byte in sequence - if ((c & ~_cont_mask) != _cont) { - CCASSERT(0, "bad UTF-8 continuation byte"); - return 0; - } - } - } - length++; - i++; - } - return length; -} - -void UTFString::_cleanBuffer() const { - if (m_buff.m_voidBuff != 0) { - switch (m_buffType) { - case BT_STR: - CC_DELETE_T(m_buff.m_strBuff, String); - break; - case BT_WSTR: - CC_DELETE_T(m_buff.m_wstrBuff, WString); - break; - case BT_NONE: // under the worse of circumstances, this is all we can do, and hope it works out - default: - //delete mBuffer.mVoidBuffer; - // delete void* is undefined, don't do that - CCASSERT(0, "This should never happen - mVoidBuffer should never contain something if we " - "don't know the type"); - break; - } - m_buff.m_voidBuff = 0; - m_buffSize = 0; - m_buffType = BT_NONE; - } -} - -void UTFString::_getBufferStr() const { - if (m_buffType != BT_STR) { - _cleanBuffer(); - m_buff.m_strBuff = CC_NEW_T(String); - m_buffType = BT_STR; - } - m_buff.m_strBuff->clear(); -} - -void UTFString::_getBufferWStr() const { - if (m_buffType != BT_WSTR) { - _cleanBuffer(); - m_buff.m_wstrBuff = CC_NEW_T(WString); - m_buffType = BT_WSTR; - } - m_buff.m_wstrBuff->clear(); -} - -void UTFString::_load_buffer_UTF8() const { - _getBufferStr(); - String &buffer = (*m_buff.m_strBuff); - buffer.reserve(length()); - - unsigned char utf8buf[6] = ""; - char *charbuf = (char *)utf8buf; - unicode_char c; - size_t len; - - const_iterator i, ie = end(); - for (i = begin(); i != ie; i.moveNext()) { - c = i.getCharacter(); - len = _utf32_to_utf8(c, utf8buf); - size_t j = 0; - while (j < len) - buffer.push_back(charbuf[j++]); - } -} - -void UTFString::_load_buffer_WStr() const { - _getBufferWStr(); - WString &buffer = (*m_buff.m_wstrBuff); - buffer.reserve(length()); // may over reserve, but should be close enough -#ifdef WCHAR_UTF16 // wchar_t matches UTF-16 - const_iterator i, ie = end(); - for (i = begin(); i != ie; ++i) { - buffer.push_back((wchar_t)(*i)); - } -#else // wchar_t fits UTF-32 - unicode_char c; - const_iterator i, ie = end(); - for (i = begin(); i != ie; i.moveNext()) { - c = i.getCharacter(); - buffer.push_back((wchar_t)c); - } -#endif -} - -} // namespace cc diff --git a/native/cocos/base/UTFString.h b/native/cocos/base/UTFString.h deleted file mode 100755 index c61afcdea8..0000000000 --- a/native/cocos/base/UTFString.h +++ /dev/null @@ -1,1561 +0,0 @@ -#ifndef CC_CORE_KERNEL_UTF_STRING_H_ -#define CC_CORE_KERNEL_UTF_STRING_H_ - -#include "Macros.h" -#include "memory/StlAlloc.h" - -#if (CC_COMPILER == CC_COMPILER_MSVC && (CC_COMPILER_VERSION >= 70 && CC_COMPILER_VERSION < 100)) - - #if defined(_DLL_CPPLIB) -namespace std { -template class _CRTIMP2 basic_string, - allocator>; - -template class _CRTIMP2 basic_string<__wchar_t, char_traits<__wchar_t>, - allocator<__wchar_t>>; -} // namespace std - #endif // defined(_DLL_CPPLIB) - -#endif - -namespace cc { - -/* READ THIS NOTICE BEFORE USING IN YOUR OWN APPLICATIONS - =NOTICE= - This class is not a complete Unicode solution. It purposefully does not - provide certain functionality, such as proper lexical sorting for - Unicode values. It does provide comparison operators for the sole purpose - of using UTFString as an index with std::map and other operator< sorted - containers, but it should NOT be relied upon for meaningful lexical - operations, such as alphabetical sorts. If you need this type of - functionality, look into using ICU instead (http://icu.sourceforge.net/). - - =REQUIREMENTS= - There are a few requirements for proper operation. They are fairly small, - and shouldn't restrict usage on any reasonable target. - * Compiler must support unsigned 16-bit integer types - * Compiler must support signed 32-bit integer types - * wchar_t must be either UTF-16 or UTF-32 encoding, and specified as such - using the WCHAR_UTF16 macro as outlined below. - * You must include , , and . Probably more, but - these are the most obvious. - - =REQUIRED PREPROCESSOR MACROS= - This class requires two preprocessor macros to be defined in order to - work as advertised. - INT32 - must be mapped to a signed 32 bit integer (ex. #define INT32 int) - UINT16 - must be mapped to an unsigned 16 bit integer (ex. #define UINT32 unsigned short) - - Additionally, a third macro should be defined to control the evaluation of wchar_t: - WCHAR_UTF16 - should be defined when wchar_t represents UTF-16 code points, - such as in Windows. Otherwise it is assumed that wchar_t is a 32-bit - integer representing UTF-32 code points. - */ - -// THIS IS A VERY BRIEF AUTO DETECTION. YOU MAY NEED TO TWEAK THIS -#ifdef __STDC_ISO_10646__ -// for any compiler that provides this, wchar_t is guaranteed to hold any Unicode value with a single code point (32-bit or larger) -// so we can safely skip the rest of the testing -#else // #ifdef __STDC_ISO_10646__ - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) || (CC_PLATFORM != CC_PLATFORM_ANDROID) - #define WCHAR_UTF16 // All currently known Windows platforms utilize UTF-16 encoding in wchar_t - #endif -#endif // #ifdef __STDC_ISO_10646__ - -// OGRE_IS_NATIVE_WCHAR_T means that wchar_t isn't a typedef of -// uint16 or uint32. -#if CC_COMPILER == CC_COMPILER_MSVC - - // Don't define wchar_t related functions since it'll duplicate - // with UTFString::code_point related functions when compile - // without /Zc:wchar_t, because in this case both of them are - // a typedef of uint16. - #if defined(_NATIVE_WCHAR_T_DEFINED) - #define CC_IS_NATIVE_WCHAR_T 0 - #else - #define CC_IS_NATIVE_WCHAR_T 0 - #endif -#else - // Assumed wchar_t is natively for other compilers - #define CC_IS_NATIVE_WCHAR_T 1 -#endif // CC_COMPILER == CC_COMPILER_MSVC - -//! A UTF-16 string with implicit conversion to/from std::string and std::wstring -/*! This class provides a complete 1 to 1 map of most std::string functions (at least to my - knowledge). Implicit conversions allow this string class to work with all common C++ string - formats, with specialty functions defined where implicit conversion would cause potential - problems or is otherwise unavailable. - - Some additional functionality is present to assist in working with characters using the - 32-bit UTF-32 encoding. (Which is guaranteed to fit any Unicode character into a single - code point.) \b Note: Reverse iterators do not have this functionality due to the - ambiguity that surrounds working with UTF-16 in reverse. (Such as, where should an - iterator point to represent the beginning of a surrogate pair?) - - - \par Supported Input Types - The supported string types for input, and their assumed encoding schemes, are: - - std::string (UTF-8) - - char* (UTF-8) - - std::wstring (autodetected UTF-16 / UTF-32 based on compiler) - - wchar_t* (autodetected UTF-16 / UTF-32 based on compiler) - - - \see - - For additional information on UTF-16 encoding: http://en.wikipedia.org/wiki/UTF-16 - - For additional information on UTF-8 encoding: http://en.wikipedia.org/wiki/UTF-8 - - For additional information on UTF-32 encoding: http://en.wikipedia.org/wiki/UTF-32 - */ - -class CC_DLL UTFString { - // constants used in UTF-8 conversions - static const unsigned char _lead1 = 0xC0; //110xxxxx - static const unsigned char _lead1_mask = 0x1F; //00011111 - static const unsigned char _lead2 = 0xE0; //1110xxxx - static const unsigned char _lead2_mask = 0x0F; //00001111 - static const unsigned char _lead3 = 0xF0; //11110xxx - static const unsigned char _lead3_mask = 0x07; //00000111 - static const unsigned char _lead4 = 0xF8; //111110xx - static const unsigned char _lead4_mask = 0x03; //00000011 - static const unsigned char _lead5 = 0xFC; //1111110x - static const unsigned char _lead5_mask = 0x01; //00000001 - static const unsigned char _cont = 0x80; //10xxxxxx - static const unsigned char _cont_mask = 0x3F; //00111111 - -public: - //! size type used to indicate string size and character positions within the string - typedef size_t size_type; - //! the usual constant representing: not found, no limit, etc - static const size_type npos = static_cast(~0); - - //! a single 32-bit Unicode character - typedef uint32_t unicode_char; - - //! a single UTF-16 code point - typedef char16_t code_point; - - //! value type typedef for use in iterators - typedef code_point value_type; - -#if (CC_STL_MEMORY_ALLOCATOR == CC_STL_MEMORY_ALLOCATOR_CUSTOM) - typedef std::basic_string, SA> dstring; // data string -#else - typedef std::basic_string dstring; // data string -#endif - //! base iterator class for UTFString - class CC_DLL _base_iterator : public std::iterator { - friend class UTFString; - - protected: - _base_iterator() { string_ = 0; } - - inline void _seekFwd(size_type c) { iter_ += c; } - inline void _seekRev(size_type c) { iter_ -= c; } - inline void _become(const _base_iterator &i) { - iter_ = i.iter_; - string_ = i.string_; - } - inline bool _test_begin() const { return iter_ == string_->m_data.begin(); } - inline bool _test_end() const { return iter_ == string_->m_data.end(); } - inline size_type _get_index() const { return iter_ - string_->m_data.begin(); } - inline void _jump_to(size_type index) { iter_ = string_->m_data.begin() + index; } - - unicode_char _getCharacter() const; - int _setCharacter(unicode_char uc); - void _moveNext(); - void _movePrev(); - - dstring::iterator iter_; - UTFString *string_; - }; - - ////////////////////////////////////////////////////////////////////////// - // FORWARD ITERATORS - - class _const_fwd_iterator; // forward declaration - - //! forward iterator for UTFString - class CC_DLL _fwd_iterator : public _base_iterator { - friend class _const_fwd_iterator; - - public: - _fwd_iterator() {} - _fwd_iterator(const _fwd_iterator &i) { _become(i); } - - //! pre-increment - inline _fwd_iterator &operator++() { - _seekFwd(1); - return *this; - } - - //! post-increment - inline _fwd_iterator operator++(int) { - _fwd_iterator tmp(*this); - _seekFwd(1); - return tmp; - } - - //! pre-decrement - inline _fwd_iterator &operator--() { - _seekRev(1); - return *this; - } - - //! post-decrement - inline _fwd_iterator operator--(int) { - _fwd_iterator tmp(*this); - _seekRev(1); - return tmp; - } - - //! addition operator - inline _fwd_iterator operator+(difference_type n) { - _fwd_iterator tmp(*this); - if (n < 0) - tmp._seekRev(-n); - else - tmp._seekFwd(n); - return tmp; - } - - //! subtraction operator - inline _fwd_iterator operator-(difference_type n) { - _fwd_iterator tmp(*this); - if (n < 0) - tmp._seekFwd(-n); - else - tmp._seekRev(n); - return tmp; - } - - //! addition assignment operator - inline _fwd_iterator &operator+=(difference_type n) { - if (n < 0) - _seekRev(-n); - else - _seekFwd(n); - return *this; - } - - //! subtraction assignment operator - inline _fwd_iterator &operator-=(difference_type n) { - if (n < 0) - _seekFwd(-n); - else - _seekRev(n); - return *this; - } - - //! dereference operator - inline value_type &operator*() const { return *iter_; } - - //! dereference at offset operator - inline value_type &operator[](difference_type n) const { - _fwd_iterator tmp(*this); - tmp += n; - return *tmp; - } - - //! advances to the next Unicode character, honoring surrogate pairs in the UTF-16 stream - inline _fwd_iterator &moveNext() { - _moveNext(); - return *this; - } - - //! rewinds to the previous Unicode character, honoring surrogate pairs in the UTF-16 stream - inline _fwd_iterator &movePrev() { - _movePrev(); - return *this; - } - - //! Returns the Unicode value of the character at the current position (decodes surrogate pairs if needed) - inline unicode_char getCharacter() const { return _getCharacter(); } - //! Sets the Unicode value of the character at the current position (adding a surrogate pair if needed); returns the amount of string length change caused by the operation - inline int setCharacter(unicode_char uc) { return _setCharacter(uc); } - }; - - ////////////////////////////////////////////////////////////////////////// - //! const forward iterator for UTFString - class CC_DLL _const_fwd_iterator : public _base_iterator { - public: - _const_fwd_iterator() {} - _const_fwd_iterator(const _const_fwd_iterator &i) { _become(i); } - _const_fwd_iterator(const _fwd_iterator &i) { _become(i); } - - //! pre-increment - inline _const_fwd_iterator &operator++() { - _seekFwd(1); - return *this; - } - - //! post-increment - inline _const_fwd_iterator operator++(int) { - _const_fwd_iterator tmp(*this); - _seekFwd(1); - return tmp; - } - - //! pre-decrement - inline _const_fwd_iterator &operator--() { - _seekRev(1); - return *this; - } - - //! post-decrement - inline _const_fwd_iterator operator--(int) { - _const_fwd_iterator tmp(*this); - _seekRev(1); - return tmp; - } - - //! addition operator - inline _const_fwd_iterator operator+(difference_type n) { - _const_fwd_iterator tmp(*this); - if (n < 0) - tmp._seekRev(-n); - else - tmp._seekFwd(n); - return tmp; - } - - //! subtraction operator - inline _const_fwd_iterator operator-(difference_type n) { - _const_fwd_iterator tmp(*this); - if (n < 0) - tmp._seekFwd(-n); - else - tmp._seekRev(n); - return tmp; - } - - //! addition assignment operator - inline _const_fwd_iterator &operator+=(difference_type n) { - if (n < 0) - _seekRev(-n); - else - _seekFwd(n); - return *this; - } - - //! subtraction assignment operator - inline _const_fwd_iterator &operator-=(difference_type n) { - if (n < 0) - _seekFwd(-n); - else - _seekRev(n); - return *this; - } - - //! dereference operator - inline const value_type &operator*() const { return *iter_; } - - //! dereference at offset operator - inline const value_type &operator[](difference_type n) const { - _const_fwd_iterator tmp(*this); - tmp += n; - return *tmp; - } - - //! advances to the next Unicode character, honoring surrogate pairs in the UTF-16 stream - inline _const_fwd_iterator &moveNext() { - _moveNext(); - return *this; - } - - //! rewinds to the previous Unicode character, honoring surrogate pairs in the UTF-16 stream - inline _const_fwd_iterator &movePrev() { - _movePrev(); - return *this; - } - - //! Returns the Unicode value of the character at the current position (decodes surrogate pairs if needed) - inline unicode_char getCharacter() const { return _getCharacter(); } - - //! difference operator - friend size_type operator-(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - //! equality operator - friend bool operator==(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - //! inequality operator - friend bool operator!=(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - //! less than - friend bool operator<(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - //! less than or equal - friend bool operator<=(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - //! greater than - friend bool operator>(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - //! greater than or equal - friend bool operator>=(const _const_fwd_iterator &left, const _const_fwd_iterator &right); - }; - - ////////////////////////////////////////////////////////////////////////// - // REVERSE ITERATORS - - class _const_rev_iterator; // forward declaration - //! forward iterator for UTFString - class CC_DLL _rev_iterator : public _base_iterator { - friend class _const_rev_iterator; - - public: - _rev_iterator() {} - _rev_iterator(const _rev_iterator &i) { _become(i); } - - //! pre-increment - inline _rev_iterator &operator++() { - _seekRev(1); - return *this; - } - - //! post-increment - inline _rev_iterator operator++(int) { - _rev_iterator tmp(*this); - _seekRev(1); - return tmp; - } - - //! pre-decrement - inline _rev_iterator &operator--() { - _seekFwd(1); - return *this; - } - - //! post-decrement - inline _rev_iterator operator--(int) { - _rev_iterator tmp(*this); - _seekFwd(1); - return tmp; - } - - //! addition operator - inline _rev_iterator operator+(difference_type n) { - _rev_iterator tmp(*this); - if (n < 0) - tmp._seekFwd(-n); - else - tmp._seekRev(n); - return tmp; - } - - //! subtraction operator - inline _rev_iterator operator-(difference_type n) { - _rev_iterator tmp(*this); - if (n < 0) - tmp._seekRev(-n); - else - tmp._seekFwd(n); - return tmp; - } - - //! addition assignment operator - inline _rev_iterator &operator+=(difference_type n) { - if (n < 0) - _seekFwd(-n); - else - _seekRev(n); - return *this; - } - - //! subtraction assignment operator - inline _rev_iterator &operator-=(difference_type n) { - if (n < 0) - _seekRev(-n); - else - _seekFwd(n); - return *this; - } - - //! dereference operator - inline value_type &operator*() const { return iter_[-1]; } - - //! dereference at offset operator - inline value_type &operator[](difference_type n) const { - _rev_iterator tmp(*this); - tmp -= n; - return *tmp; - } - }; - - ////////////////////////////////////////////////////////////////////////// - //! const reverse iterator for UTFString - - class CC_DLL _const_rev_iterator : public _base_iterator { - public: - _const_rev_iterator() {} - _const_rev_iterator(const _const_rev_iterator &i) { _become(i); } - _const_rev_iterator(const _rev_iterator &i) { _become(i); } - - //! pre-increment - inline _const_rev_iterator &operator++() { - _seekRev(1); - return *this; - } - - //! post-increment - inline _const_rev_iterator operator++(int) { - _const_rev_iterator tmp(*this); - _seekRev(1); - return tmp; - } - - //! pre-decrement - inline _const_rev_iterator &operator--() { - _seekFwd(1); - return *this; - } - - //! post-decrement - inline _const_rev_iterator operator--(int) { - _const_rev_iterator tmp(*this); - _seekFwd(1); - return tmp; - } - - //! addition operator - inline _const_rev_iterator operator+(difference_type n) { - _const_rev_iterator tmp(*this); - if (n < 0) - tmp._seekFwd(-n); - else - tmp._seekRev(n); - return tmp; - } - - //! subtraction operator - inline _const_rev_iterator operator-(difference_type n) { - _const_rev_iterator tmp(*this); - if (n < 0) - tmp._seekRev(-n); - else - tmp._seekFwd(n); - return tmp; - } - - //! addition assignment operator - inline _const_rev_iterator &operator+=(difference_type n) { - if (n < 0) - _seekFwd(-n); - else - _seekRev(n); - return *this; - } - - //! subtraction assignment operator - inline _const_rev_iterator &operator-=(difference_type n) { - if (n < 0) - _seekRev(-n); - else - _seekFwd(n); - return *this; - } - - //! dereference operator - inline const value_type &operator*() const { return iter_[-1]; } - - //! dereference at offset operator - inline const value_type &operator[](difference_type n) const { - _const_rev_iterator tmp(*this); - tmp -= n; - return *tmp; - } - - //! difference operator - friend size_type operator-(const _const_rev_iterator &left, const _const_rev_iterator &right); - //! equality operator - friend bool operator==(const _const_rev_iterator &left, const _const_rev_iterator &right); - //! inequality operator - friend bool operator!=(const _const_rev_iterator &left, const _const_rev_iterator &right); - //! less than - friend bool operator<(const _const_rev_iterator &left, const _const_rev_iterator &right); - //! less than or equal - friend bool operator<=(const _const_rev_iterator &left, const _const_rev_iterator &right); - //! greater than - friend bool operator>(const _const_rev_iterator &left, const _const_rev_iterator &right); - //! greater than or equal - friend bool operator>=(const _const_rev_iterator &left, const _const_rev_iterator &right); - }; - - ////////////////////////////////////////////////////////////////////////// - - typedef _fwd_iterator iterator; //!< iterator - typedef _rev_iterator reverse_iterator; //!< reverse iterator - typedef _const_fwd_iterator const_iterator; //!< const iterator - typedef _const_rev_iterator const_reverse_iterator; //!< const reverse iterator - - //!\name Constructors/Destructor - //@{ - //! default constructor, creates an empty string - UTFString() { _init(); } - //! copy constructor - UTFString(const UTFString ©) { - _init(); - m_data = copy.m_data; - } - //! \a length copies of \a ch - UTFString(size_type length, const code_point &ch) { - _init(); - assign(length, ch); - } - //! duplicate of nul-terminated sequence \a str - UTFString(const code_point *str) { - _init(); - assign(str); - } - //! duplicate of \a str, \a length code points long - UTFString(const code_point *str, size_type length) { - _init(); - assign(str, length); - } - //! substring of \a str starting at \a index and \a length code points long - UTFString(const UTFString &str, size_type index, size_type length) { - _init(); - assign(str, index, length); - } -#if CC_IS_NATIVE_WCHAR_T - //! duplicate of nul-terminated \c wchar_t array - UTFString(const wchar_t *w_str) { - _init(); - assign(w_str); - } - //! duplicate of \a w_str, \a length characters long - UTFString(const wchar_t *w_str, size_type length) { - _init(); - assign(w_str, length); - } -#endif - - //! duplicate of nul-terminated C-string \a c_str (UTF-8 encoding) - UTFString(const char *c_str) { - _init(); - assign(c_str); - } - //! duplicate of \a c_str, \a length characters long (UTF-8 encoding) - UTFString(const char *c_str, size_type length) { - _init(); - assign(c_str, length); - } - //! duplicate of \a str (UTF-8 encoding) - UTFString(const String &str) { - _init(); - assign(str); - } - //! duplicate of \a wstr - UTFString(const WString &wstr) { - _init(); - assign(wstr); - } - - //! destructor - ~UTFString() { _cleanBuffer(); } - - ////////////////////////////////////////////////////////////////////////// - // Utility functions - - //! Returns the number of code points in the current string - inline size_type size() const { return m_data.size(); } - //! Returns the number of code points in the current string - inline size_type length() const { return size(); } - //! Returns the number of Unicode characters in the string - /*! Executes in linear time. */ - inline size_type length_Characters() const { - const_iterator i = begin(), ie = end(); - size_type c = 0; - while (i != ie) { - i.moveNext(); - ++c; - } - return c; - } - //! returns the maximum number of UTF-16 code points that the string can hold - inline size_type max_size() const { return m_data.max_size(); } - //! sets the capacity of the string to at least \a size code points - inline void reserve(size_type size) { m_data.reserve(size); } - //! changes the size of the string to \a size, filling in any new area with \a val - inline void resize(size_type num, const code_point &val = 0) { m_data.resize(num, val); } - //! exchanges the elements of the current string with those of \a from - inline void swap(UTFString &from) { m_data.swap(from.m_data); } - //! returns \c true if the string has no elements, \c false otherwise - inline bool empty() const { return m_data.empty(); } - //! returns a pointer to the first character in the current string - inline const code_point *c_str() const { return m_data.c_str(); } - //! returns a pointer to the first character in the current string - inline const code_point *data() const { return c_str(); } - //! returns the number of elements that the string can hold before it will need to allocate more space - inline size_type capacity() const { return m_data.capacity(); } - //! deletes all of the elements in the string - inline void clear() { m_data.clear(); } - //! returns a substring of the current string, starting at \a index, and \a num characters long. - /*! If \a num is omitted, it will default to \c UTFString::npos, and the substr() function will simply return the remainder of the string starting at \a index. */ - inline UTFString substr(size_type index, size_type num = npos) const { - // this could avoid the extra copy if we used a private specialty constructor - dstring tmpData = m_data.substr(index, num); - UTFString tmp; - tmp.m_data.swap(tmpData); - return tmp; - } - //! appends \a val to the end of the string - inline void push_back(unicode_char val) { - code_point cp[2] = {0, 0}; - size_t c = _utf32_to_utf16(val, cp); - if (c > 0) push_back(cp[0]); - if (c > 1) push_back(cp[1]); - } -#if CC_IS_NATIVE_WCHAR_T - //! appends \a val to the end of the string - inline void push_back(wchar_t val) { - // we do this because the Unicode method still preserves UTF-16 code points - m_data.push_back(static_cast(val)); - } -#endif - //! appends \a val to the end of the string - /*! This can be used to push surrogate pair code points, you'll just need to push them - one after the other. */ - inline void push_back(code_point val) { m_data.push_back(val); } - //! appends \a val to the end of the string - /*! Limited to characters under the 127 value barrier. */ - inline void push_back(char val) { m_data.push_back(static_cast(val)); } - //! returns \c true if the given Unicode character \a ch is in this string - inline bool inString(unicode_char ch) const { - const_iterator i, ie = end(); - for (i = begin(); i != ie; i.moveNext()) { - if (i.getCharacter() == ch) - return true; - } - return false; - } - - ////////////////////////////////////////////////////////////////////////// - // Stream variations - - //! returns the current string in UTF-8 form within a std::string - inline const String &asUTF8() const { - _load_buffer_UTF8(); - return *m_buff.m_strBuff; - } - - //! returns the current string in UTF-8 form as a nul-terminated char array - inline const char *asUTF8_c_str() const { - _load_buffer_UTF8(); - return m_buff.m_strBuff->c_str(); - } - - //! returns the current string in the native form of std::wstring - inline const WString &asWStr() const { - _load_buffer_WStr(); - return *m_buff.m_wstrBuff; - } - - //! returns the current string in the native form of a nul-terminated wchar_t array - inline const wchar_t *asWStr_c_str() const { - _load_buffer_WStr(); - return m_buff.m_wstrBuff->c_str(); - } - - ////////////////////////////////////////////////////////////////////////// - // Single Character Access - - //! returns a reference to the element in the string at index \c loc - inline code_point &at(size_type loc) { return m_data.at(loc); } - //! returns a reference to the element in the string at index \c loc - inline const code_point &at(size_type loc) const { return m_data.at(loc); } - //! returns the data point \a loc evaluated as a UTF-32 value - /*! This function will will only properly decode surrogate pairs when \a loc points to the index - of a lead code point that is followed by a trailing code point. Evaluating the trailing code point - itself, or pointing to a code point that is a sentinel value (part of a broken pair) will return - the value of just that code point (not a valid Unicode value, but useful as a sentinel value). */ - unicode_char getChar(size_type loc) const; - - //! sets the value of the character at \a loc to the Unicode value \a ch (UTF-32) - /*! Providing sentinel values (values between U+D800-U+DFFF) are accepted, but you should be aware - that you can also unwittingly create a valid surrogate pair if you don't pay attention to what you - are doing. @note This operation may also lengthen the string if a surrogate pair is needed to - represent the value given, but one is not available to replace; or alternatively shorten the string - if an existing surrogate pair is replaced with a character that is representable without a surrogate - pair. The return value will signify any lengthening or shortening performed, returning 0 if no change - was made, -1 if the string was shortened, or 1 if the string was lengthened. Any single call can - only change the string length by + or - 1. */ - int setChar(size_type loc, unicode_char ch); - - ////////////////////////////////////////////////////////////////////////// - // iterator acquisition - - //! returns an iterator to the first element of the string - inline iterator begin() { - iterator i; - i.iter_ = m_data.begin(); - i.string_ = this; - return i; - } - //! returns an iterator to the first element of the string - inline const_iterator begin() const { - const_iterator i; - i.iter_ = const_cast(this)->m_data.begin(); - i.string_ = const_cast(this); - return i; - } - //! returns an iterator just past the end of the string - inline iterator end() { - iterator i; - i.iter_ = m_data.end(); - i.string_ = this; - return i; - } - //! returns an iterator just past the end of the string - inline const_iterator end() const { - const_iterator i; - i.iter_ = const_cast(this)->m_data.end(); - i.string_ = const_cast(this); - return i; - } - //! returns a reverse iterator to the last element of the string - inline reverse_iterator rbegin() { - reverse_iterator i; - i.iter_ = m_data.end(); - i.string_ = this; - return i; - } - //! returns a reverse iterator to the last element of the string - inline const_reverse_iterator rbegin() const { - const_reverse_iterator i; - i.iter_ = const_cast(this)->m_data.end(); - i.string_ = const_cast(this); - return i; - } - //! returns a reverse iterator just past the beginning of the string - inline reverse_iterator rend() { - reverse_iterator i; - i.iter_ = m_data.begin(); - i.string_ = this; - return i; - } - //! returns a reverse iterator just past the beginning of the string - inline const_reverse_iterator rend() const { - const_reverse_iterator i; - i.iter_ = const_cast(this)->m_data.begin(); - i.string_ = const_cast(this); - return i; - } - - ////////////////////////////////////////////////////////////////////////// - // assign - - //! gives the current string the values from \a start to \a end - inline UTFString &assign(iterator start, iterator end) { - m_data.assign(start.iter_, end.iter_); - return *this; - } - - //! assign \a str to the current string - inline UTFString &assign(const UTFString &str) { - m_data.assign(str.m_data); - return *this; - } - - //! assign the nul-terminated \a str to the current string - inline UTFString &assign(const code_point *str) { - m_data.assign(str); - return *this; - } - - //! assign the first \a num characters of \a str to the current string - inline UTFString &assign(const code_point *str, size_type num) { - m_data.assign(str, num); - return *this; - } - - //! assign \a len entries from \a str to the current string, starting at \a index - inline UTFString &assign(const UTFString &str, size_type index, size_type len) { - m_data.assign(str.m_data, index, len); - return *this; - } - - //! assign \a num copies of \a ch to the current string - inline UTFString &assign(size_type num, const code_point &ch) { - m_data.assign(num, ch); - return *this; - } - - //! assign \a str to the current string (\a str is treated as a UTF-8 stream) - UTFString &assign(const String &str); - //! assign \a wstr to the current string (\a wstr is treated as a UTF-16 stream) - UTFString &assign(const WString &wstr); - -#if CC_IS_NATIVE_WCHAR_T - //! assign \a w_str to the current string - inline UTFString &assign(const wchar_t *w_str) { - WString tmp(w_str); - return assign(tmp); - } - - //! assign the first \a num characters of \a w_str to the current string - inline UTFString &assign(const wchar_t *w_str, size_type num) { - WString tmp(w_str, num); - return assign(tmp); - } -#endif - - //! assign \a c_str to the current string (\a c_str is treated as a UTF-8 stream) - inline UTFString &assign(const char *c_str) { - String tmp(c_str); - return assign(tmp); - } - - //! assign the first \a num characters of \a c_str to the current string (\a c_str is treated as a UTF-8 stream) - inline UTFString &assign(const char *c_str, size_type num) { - String tmp(c_str, num); - return assign(tmp); - } - - ////////////////////////////////////////////////////////////////////////// - // append - - //! appends \a str on to the end of the current string - inline UTFString &append(const UTFString &str) { - m_data.append(str.m_data); - return *this; - } - //! appends \a str on to the end of the current string - inline UTFString &append(const code_point *str) { - m_data.append(str); - return *this; - } - //! appends a substring of \a str starting at \a index that is \a len characters long on to the end of the current string - inline UTFString &append(const UTFString &str, size_type index, size_type len) { - m_data.append(str.m_data, index, len); - return *this; - } - //! appends \a num characters of \a str on to the end of the current string - inline UTFString &append(const code_point *str, size_type num) { - m_data.append(str, num); - return *this; - } - //! appends \a num repetitions of \a ch on to the end of the current string - inline UTFString &append(size_type num, code_point ch) { - m_data.append(num, ch); - return *this; - } - //! appends the sequence denoted by \a start and \a end on to the end of the current string - inline UTFString &append(iterator start, iterator end) { - m_data.append(start.iter_, end.iter_); - return *this; - } -#if CC_IS_NATIVE_WCHAR_T - //! appends \a num characters of \a str on to the end of the current string - inline UTFString &append(const wchar_t *w_str, size_type num) { - WString tmp(w_str, num); - return append(tmp); - } - //! appends \a num repetitions of \a ch on to the end of the current string - inline UTFString &append(size_type num, wchar_t ch) { return append(num, static_cast(ch)); } -#endif - //! appends \a num characters of \a str on to the end of the current string (UTF-8 encoding) - inline UTFString &append(const char *c_str, size_type num) { - UTFString tmp(c_str, num); - append(tmp); - return *this; - } - - //! appends \a num repetitions of \a ch on to the end of the current string (Unicode values less than 128) - inline UTFString &append(size_type num, char ch) { - append(num, static_cast(ch)); - return *this; - } - - //! appends \a num repetitions of \a ch on to the end of the current string (Full Unicode spectrum) - UTFString &append(size_type num, unicode_char ch); - - ////////////////////////////////////////////////////////////////////////// - // insert - - //! inserts \a ch before the code point denoted by \a i - inline iterator insert(iterator i, const code_point &ch) { - iterator ret; - ret.iter_ = m_data.insert(i.iter_, ch); - ret.string_ = this; - return ret; - } - - //! inserts \a str into the current string, at location \a index - inline UTFString &insert(size_type index, const UTFString &str) { - m_data.insert(index, str.m_data); - return *this; - } - - //! inserts \a str into the current string, at location \a index - inline UTFString &insert(size_type index, const code_point *str) { - m_data.insert(index, str); - return *this; - } - //! inserts a substring of \a str (starting at \a index2 and \a num code points long) into the current string, at location \a index1 - inline UTFString &insert(size_type index1, const UTFString &str, size_type index2, size_type num) { - m_data.insert(index1, str.m_data, index2, num); - return *this; - } - - //! inserts the code points denoted by \a start and \a end into the current string, before the code point specified by \a i - inline void insert(iterator i, iterator start, iterator end) { m_data.insert(i.iter_, start.iter_, end.iter_); } - - //! inserts \a num code points of \a str into the current string, at location \a index - inline UTFString &insert(size_type index, const code_point *str, size_type num) { - m_data.insert(index, str, num); - return *this; - } - -#if CC_IS_NATIVE_WCHAR_T - //! inserts \a num code points of \a str into the current string, at location \a index - inline UTFString &insert(size_type index, const wchar_t *w_str, size_type num) { - UTFString tmp(w_str, num); - insert(index, tmp); - return *this; - } -#endif - //! inserts \a num code points of \a str into the current string, at location \a index - inline UTFString &insert(size_type index, const char *c_str, size_type num) { - UTFString tmp(c_str, num); - insert(index, tmp); - return *this; - } - - //! inserts \a num copies of \a ch into the current string, at location \a index - inline UTFString &insert(size_type index, size_type num, code_point ch) { - m_data.insert(index, num, ch); - return *this; - } - -#if CC_IS_NATIVE_WCHAR_T - //! inserts \a num copies of \a ch into the current string, at location \a index - inline UTFString &insert(size_type index, size_type num, wchar_t ch) { - insert(index, num, static_cast(ch)); - return *this; - } -#endif - //! inserts \a num copies of \a ch into the current string, at location \a index - inline UTFString &insert(size_type index, size_type num, char ch) { - insert(index, num, static_cast(ch)); - return *this; - } - - //! inserts \a num copies of \a ch into the current string, at location \a index - UTFString &insert(size_type index, size_type num, unicode_char ch); - - //! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i - inline void insert(iterator i, size_type num, const code_point &ch) { m_data.insert(i.iter_, num, ch); } - -#if CC_IS_NATIVE_WCHAR_T - //! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i - inline void insert(iterator i, size_type num, const wchar_t &ch) { insert(i, num, static_cast(ch)); } -#endif - - //! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i - inline void insert(iterator i, size_type num, const char &ch) { insert(i, num, static_cast(ch)); } - //! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i - void insert(iterator i, size_type num, const unicode_char &ch); - - ////////////////////////////////////////////////////////////////////////// - // erase - - //! removes the code point pointed to by \a loc, returning an iterator to the next character - inline iterator erase(iterator loc) { - iterator ret; - ret.iter_ = m_data.erase(loc.iter_); - ret.string_ = this; - return ret; - } - //! removes the code points between \a start and \a end (including the one at \a start but not the one at \a end), returning an iterator to the code point after the last code point removed - inline iterator erase(iterator start, iterator last) { - iterator ret; - ret.iter_ = m_data.erase(start.iter_, last.iter_); - ret.string_ = this; - return ret; - } - //! removes \a num code points from the current string, starting at \a index - inline UTFString &erase(size_type index = 0, size_type num = npos) { - if (num == npos) - m_data.erase(index); - else - m_data.erase(index, num); - return *this; - } - - ////////////////////////////////////////////////////////////////////////// - // replace - - //! replaces up to \a num1 code points of the current string (starting at \a index1) with \a str - inline UTFString &replace(size_type index1, size_type num1, const UTFString &str) { - m_data.replace(index1, num1, str.m_data, 0, npos); - return *this; - } - - //! replaces up to \a num1 code points of the current string (starting at \a index1) with up to \a num2 code points from \a str - inline UTFString &replace(size_type index1, size_type num1, const UTFString &str, size_type num2) { - m_data.replace(index1, num1, str.m_data, 0, num2); - return *this; - } - - //! replaces up to \a num1 code points of the current string (starting at \a index1) with up to \a num2 code points from \a str beginning at \a index2 - inline UTFString &replace(size_type index1, size_type num1, const UTFString &str, size_type index2, size_type num2) { - m_data.replace(index1, num1, str.m_data, index2, num2); - return *this; - } - - //! replaces code points in the current string from \a start to \a end with \a num code points from \a str - inline UTFString &replace(iterator start, iterator end, const UTFString &str, size_type num = npos) { - _const_fwd_iterator st(start); //Work around for gcc, allow it to find correct overload - - size_type index1 = begin() - st; - size_type num1 = end - st; - return replace(index1, num1, str, 0, num); - } - - //! replaces up to \a num1 code points in the current string (beginning at \a index) with \c num2 copies of \c ch - inline UTFString &replace(size_type index, size_type num1, size_type num2, code_point ch) { - m_data.replace(index, num1, num2, ch); - return *this; - } - - //! replaces the code points in the current string from \a start to \a end with \a num copies of \a ch - inline UTFString &replace(iterator start, iterator end, size_type num, code_point ch) { - _const_fwd_iterator st(start); //Work around for gcc, allow it to find correct overload - size_type index1 = begin() - st; - size_type num1 = end - st; - return replace(index1, num1, num, ch); - } - - ////////////////////////////////////////////////////////////////////////// - // compare - - //! compare \a str to the current string - inline int compare(const UTFString &str) const { return m_data.compare(str.m_data); } - //! compare \a str to the current string - inline int compare(const code_point *str) const { return m_data.compare(str); } - //! compare \a str to a substring of the current string, starting at \a index for \a length characters - inline int compare(size_type index, size_type length, const UTFString &str) const { return m_data.compare(index, length, str.m_data); } - //! compare a substring of \a str to a substring of the current string, where \a index2 and \a length2 refer to \a str and \a index and \a length refer to the current string - inline int compare(size_type index, size_type length, const UTFString &str, size_type index2, size_type length2) const { return m_data.compare(index, length, str.m_data, index2, length2); } - //! compare a substring of \a str to a substring of the current string, where the substring of \a str begins at zero and is \a length2 characters long, and the substring of the current string begins at \a index and is \a length characters long - inline int compare(size_type index, size_type length, const code_point *str, size_type length2) const { return m_data.compare(index, length, str, length2); } -#if CC_IS_NATIVE_WCHAR_T - //! compare a substring of \a str to a substring of the current string, where the substring of \a str begins at zero and is \a length2 elements long, and the substring of the current string begins at \a index and is \a length characters long - inline int compare(size_type index, size_type length, const wchar_t *w_str, size_type length2) const { - UTFString tmp(w_str, length2); - return compare(index, length, tmp); - } -#endif - //! compare a substring of \a str to a substring of the current string, where the substring of \a str begins at zero and is \a length2 UTF-8 code points long, and the substring of the current string begins at \a index and is \a length characters long - inline int compare(size_type index, size_type length, const char *c_str, size_type length2) const { - UTFString tmp(c_str, length2); - return compare(index, length, tmp); - } - - ////////////////////////////////////////////////////////////////////////// - // find & rfind - - //! returns the index of the first occurrence of \a str within the current string, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a str is a UTF-16 encoded string, but through implicit casting can also be a UTF-8 encoded string (const char* or std::string) */ - inline size_type find(const UTFString &str, size_type index = 0) const { return m_data.find(str.c_str(), index); } - //! returns the index of the first occurrence of \a str within the current string and within \a length code points, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a cp_str is a UTF-16 encoded string */ - inline size_type find(const code_point *cp_str, size_type index, size_type length) const { - UTFString tmp(cp_str); - return m_data.find(tmp.c_str(), index, length); - } - //! returns the index of the first occurrence of \a str within the current string and within \a length code points, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a cp_str is a UTF-8 encoded string */ - inline size_type find(const char *c_str, size_type index, size_type length) const { - UTFString tmp(c_str); - return m_data.find(tmp.c_str(), index, length); - } -#if CC_IS_NATIVE_WCHAR_T - //! returns the index of the first occurrence of \a str within the current string and within \a length code points, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a cp_str is a UTF-16 encoded string */ - inline size_type find(const wchar_t *w_str, size_type index, size_type length) const { - UTFString tmp(w_str); - return m_data.find(tmp.c_str(), index, length); - } -#endif - //! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a ch is only capable of representing Unicode values up to U+007F (127) */ - inline size_type find(char ch, size_type index = 0) const { return find(static_cast(ch), index); } - //! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a ch is only capable of representing Unicode values up to U+FFFF (65535) */ - inline size_type find(code_point ch, size_type index = 0) const { return m_data.find(ch, index); } -#if CC_IS_NATIVE_WCHAR_T - //! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a ch is only capable of representing Unicode values up to U+FFFF (65535) */ - inline size_type find(wchar_t ch, size_type index = 0) const { return find(static_cast(ch), index); } -#endif - //! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found - /*! \a ch can fully represent any Unicode character */ - inline size_type find(unicode_char ch, size_type index = 0) const { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - return find(UTFString(cp, l), index); - } - - //! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type rfind(const UTFString &str, size_type index = 0) const { return m_data.rfind(str.c_str(), index); } - //! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index, searching at most \a num characters; returns \c UTFString::npos if nothing is found - inline size_type rfind(const code_point *cp_str, size_type index, size_type num) const { - UTFString tmp(cp_str); - return m_data.rfind(tmp.c_str(), index, num); - } - //! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index, searching at most \a num characters; returns \c UTFString::npos if nothing is found - inline size_type rfind(const char *c_str, size_type index, size_type num) const { - UTFString tmp(c_str); - return m_data.rfind(tmp.c_str(), index, num); - } -#if CC_IS_NATIVE_WCHAR_T - //! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index, searching at most \a num characters; returns \c UTFString::npos if nothing is found - inline size_type rfind(const wchar_t *w_str, size_type index, size_type num) const { - UTFString tmp(w_str); - return m_data.rfind(tmp.c_str(), index, num); - } -#endif - //! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type rfind(char ch, size_type index = 0) const { return rfind(static_cast(ch), index); } - //! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type rfind(code_point ch, size_type index) const { return m_data.rfind(ch, index); } -#if CC_IS_NATIVE_WCHAR_T - //! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type rfind(wchar_t ch, size_type index = 0) const { return rfind(static_cast(ch), index); } -#endif - //! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type rfind(unicode_char ch, size_type index = 0) const { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - return rfind(UTFString(cp, l), index); - } - - ////////////////////////////////////////////////////////////////////////// - //! find_first/last_(not)_of - - //! Returns the index of the first character within the current string that matches \b any character in \a str, beginning the search at \a index and searching at most \a num characters; returns \c UTFString::npos if nothing is found - size_type find_first_of(const UTFString &str, size_type index = 0, size_type num = npos) const; - //! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_of(code_point ch, size_type index = 0) const { - UTFString tmp; - tmp.assign(1, ch); - return find_first_of(tmp, index); - } - //! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_of(char ch, size_type index = 0) const { return find_first_of(static_cast(ch), index); } -#if CC_IS_NATIVE_WCHAR_T - //! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_of(wchar_t ch, size_type index = 0) const { return find_first_of(static_cast(ch), index); } -#endif - //! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_of(unicode_char ch, size_type index = 0) const { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - return find_first_of(UTFString(cp, l), index); - } - - //! returns the index of the first character within the current string that does not match any character in \a str, beginning the search at \a index and searching at most \a num characters; returns \c UTFString::npos if nothing is found - size_type find_first_not_of(const UTFString &str, size_type index = 0, size_type num = npos) const; - //! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_not_of(code_point ch, size_type index = 0) const { - UTFString tmp; - tmp.assign(1, ch); - return find_first_not_of(tmp, index); - } - //! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_not_of(char ch, size_type index = 0) const { return find_first_not_of(static_cast(ch), index); } -#if CC_IS_NATIVE_WCHAR_T - //! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_not_of(wchar_t ch, size_type index = 0) const { return find_first_not_of(static_cast(ch), index); } -#endif - //! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found - inline size_type find_first_not_of(unicode_char ch, size_type index = 0) const { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - return find_first_not_of(UTFString(cp, l), index); - } - - //! returns the index of the first character within the current string that matches any character in \a str, doing a reverse search from \a index and searching at most \a num characters; returns \c UTFString::npos if nothing is found - size_type find_last_of(const UTFString &str, size_type index = npos, size_type num = npos) const; - - //! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_of(code_point ch, size_type index = npos) const { - UTFString tmp; - tmp.assign(1, ch); - return find_last_of(tmp, index); - } - - //! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_of(char ch, size_type index = npos) const { return find_last_of(static_cast(ch), index); } - -#if CC_IS_NATIVE_WCHAR_T - //! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_of(wchar_t ch, size_type index = npos) const { return find_last_of(static_cast(ch), index); } -#endif - //! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_of(unicode_char ch, size_type index = npos) const { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - return find_last_of(UTFString(cp, l), index); - } - - //! returns the index of the last character within the current string that does not match any character in \a str, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - size_type find_last_not_of(const UTFString &str, size_type index = npos, size_type num = npos) const; - - //! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_not_of(code_point ch, size_type index = npos) const { - UTFString tmp; - tmp.assign(1, ch); - return find_last_not_of(tmp, index); - } - - //! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_not_of(char ch, size_type index = npos) const { return find_last_not_of(static_cast(ch), index); } - -#if CC_IS_NATIVE_WCHAR_T - //! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_not_of(wchar_t ch, size_type index = npos) const { return find_last_not_of(static_cast(ch), index); } -#endif - //! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found - inline size_type find_last_not_of(unicode_char ch, size_type index = npos) const { - code_point cp[3] = {0, 0, 0}; - size_t l = _utf32_to_utf16(ch, cp); - return find_last_not_of(UTFString(cp, l), index); - } - - ////////////////////////////////////////////////////////////////////////// - // Operators - - //! less than operator - inline bool operator<(const UTFString &right) const { return compare(right) < 0; } - //! less than or equal operator - inline bool operator<=(const UTFString &right) const { return compare(right) <= 0; } - //! greater than operator - inline bool operator>(const UTFString &right) const { return compare(right) > 0; } - //! greater than or equal operator - inline bool operator>=(const UTFString &right) const { return compare(right) >= 0; } - //! equality operator - inline bool operator==(const UTFString &right) const { return compare(right) == 0; } - //! inequality operator - inline bool operator!=(const UTFString &right) const { return !operator==(right); } - //! assignment operator, implicitly casts all compatible types - inline UTFString &operator=(const UTFString &s) { return assign(s); } - //! assignment operator - inline UTFString &operator=(code_point ch) { - clear(); - return append(1, ch); - } - //! assignment operator - inline UTFString &operator=(char ch) { - clear(); - return append(1, ch); - } -#if CC_IS_NATIVE_WCHAR_T - //! assignment operator - inline UTFString &operator=(wchar_t ch) { - clear(); - return append(1, ch); - } -#endif - //! assignment operator - inline UTFString &operator=(unicode_char ch) { - clear(); - return append(1, ch); - } - //! code point dereference operator - inline code_point &operator[](size_type index) { return at(index); } - //! code point dereference operator - inline const code_point &operator[](size_type index) const { return at(index); } - - ////////////////////////////////////////////////////////////////////////// - // Implicit Cast Operators - - //! implicit cast to string - inline operator String() const { return String(asUTF8()); } - //! implicit cast to wstring - inline operator WString() const { return WString(asWStr()); } - - ////////////////////////////////////////////////////////////////////////// - // UTF-16 character encoding/decoding - - //! returns \c true if \a cp does not match the signature for the lead of follow code point of a surrogate pair in a UTF-16 sequence - inline static bool _utf16_independent_char(code_point cp) { - /* - if ( 0xD800 <= cp && cp <= 0xDFFF ) // tests if the cp is within the surrogate pair range - return false; // it matches a surrogate pair signature - return true; // everything else is a standalone code point - */ - return (0xD800 > cp || cp > 0xDFFF); - } - - //! returns \c true if \a cp matches the signature of a surrogate pair lead character - inline static bool _utf16_surrogate_lead(code_point cp) { - /* - if ( 0xD800 <= cp && cp <= 0xDBFF ) // tests if the cp is within the 2nd word of a surrogate pair - return true; // it is a 1st word - return false; // it isn't - */ - - return (0xD800 <= cp && cp <= 0xDBFF); - } - - //! returns \c true if \a cp matches the signature of a surrogate pair following character - inline static bool _utf16_surrogate_follow(code_point cp) { - /* - if ( 0xDC00 <= cp && cp <= 0xDFFF ) // tests if the cp is within the 2nd word of a surrogate pair - return true; // it is a 2nd word - return false; // everything else isn't - */ - - return (0xDC00 <= cp && cp <= 0xDFFF); - } - - //! estimates the number of UTF-16 code points in the sequence starting with \a cp - inline static size_t _utf16_char_length(code_point cp) { - /* - if ( 0xD800 <= cp && cp <= 0xDBFF ) // test if cp is the beginning of a surrogate pair - return 2; // if it is, then we are 2 words long - return 1; // otherwise we are only 1 word long - */ - - return (0xD800 <= cp && cp <= 0xDBFF) ? 2 : 1; - } - - //! returns the number of UTF-16 code points needed to represent the given UTF-32 character \a cp - inline static size_t _utf16_char_length(unicode_char uc) { - /* - if ( uc > 0xFFFF ) // test if uc is greater than the single word maximum - return 2; // if so, we need a surrogate pair - return 1; // otherwise we can stuff it into a single word - */ - - return (uc > 0xFFFF ? 2 : 1); - } - - //! converts the given UTF-16 character buffer \a in_cp to a single UTF-32 Unicode character \a out_uc, returns the number of code points used to create the output character (2 for surrogate pairs, otherwise 1) - /*! This function does it's best to prevent error conditions, verifying complete - surrogate pairs before applying the algorithm. In the event that half of a pair - is found it will happily generate a value in the 0xD800 - 0xDFFF range, which is - normally an invalid Unicode value but we preserve them for use as sentinel values. */ - static size_t _utf16_to_utf32(const code_point in_cp[2], unicode_char &out_uc); - - //! writes the given UTF-32 \a uc_in to the buffer location \a out_cp using UTF-16 encoding, returns the number of code points used to encode the input (always 1 or 2) - /*! This function, like its counterpart, will happily create invalid UTF-16 surrogate pairs. These - invalid entries will be created for any value of \c in_uc that falls in the range U+D800 - U+DFFF. - These are generally useful as sentinel values to represent various program specific conditions. - @note This function will also pass through any single UTF-16 code point without modification, - making it a safe method of ensuring a stream that is unknown UTF-32 or UTF-16 is truly UTF-16.*/ - static size_t _utf32_to_utf16(const unicode_char &in_uc, code_point out_cp[2]); - - ////////////////////////////////////////////////////////////////////////// - // UTF-8 character encoding/decoding - - //! returns \c true if \a cp is the beginning of a UTF-8 sequence - inline static bool _utf8_start_char(unsigned char cp) { return (cp & ~_cont_mask) != _cont; } - - //! estimates the number of UTF-8 code points in the sequence starting with \a cp - static size_t _utf8_char_length(unsigned char cp); - //! returns the number of UTF-8 code points needed to represent the given UTF-32 character \a cp - static size_t _utf8_char_length(unicode_char uc); - - //! converts the given UTF-8 character buffer to a single UTF-32 Unicode character, returns the number of bytes used to create the output character (maximum of 6) - static size_t _utf8_to_utf32(const unsigned char in_cp[6], unicode_char &out_uc); - //! writes the given UTF-32 \a uc_in to the buffer location \a out_cp using UTF-8 encoding, returns the number of bytes used to encode the input - static size_t _utf32_to_utf8(const unicode_char &in_uc, unsigned char out_cp[6]); - - //! verifies a UTF-8 stream, returning the total number of Unicode characters found - inline static size_type _verifyUTF8(const unsigned char *c_str) { - String tmp(reinterpret_cast(c_str)); - return _verifyUTF8(tmp); - } - - //! verifies a UTF-8 stream, returning the total number of Unicode characters found - static size_type _verifyUTF8(const String &str); - -private: - //template friend class _iterator; - dstring m_data; - - //! buffer data type identifier - enum BufferType { - BT_NONE, - BT_STR, - BT_WSTR, - }; - - //! common constructor operations - inline void _init() { - m_buff.m_voidBuff = 0; - m_buffType = BT_NONE; - m_buffSize = 0; - } - - /////////////////////////////////////////////////////////////////////// - // Scratch buffer - //! auto cleans the scratch buffer using the proper delete for the stored type - void _cleanBuffer() const; - - //! create a std::string in the scratch buffer area - void _getBufferStr() const; - //! create a std::wstring in the scratch buffer area - void _getBufferWStr() const; - - void _load_buffer_UTF8() const; - void _load_buffer_WStr() const; - void _load_buffer_UTF32() const; - - mutable BufferType m_buffType; // identifies the data type held in mBuffer - mutable size_t m_buffSize; // size of the CString buffer - - // multi-purpose buffer used everywhere we need a throw-away buffer - union { - mutable void *m_voidBuff; - mutable String *m_strBuff; - mutable WString *m_wstrBuff; - } m_buff; -}; - -////////////////////////////////////////////////////////////////////////// - -//! string addition operator \relates UTFString -inline UTFString operator+(const UTFString &s1, const UTFString &s2) { return UTFString(s1).append(s2); } -//! string addition operator \relates UTFString -inline UTFString operator+(const UTFString &s1, UTFString::code_point c) { return UTFString(s1).append(1, c); } -//! string addition operator \relates UTFString -inline UTFString operator+(const UTFString &s1, UTFString::unicode_char c) { return UTFString(s1).append(1, c); } -//! string addition operator \relates UTFString -inline UTFString operator+(const UTFString &s1, char c) { return UTFString(s1).append(1, c); } - -#if CC_IS_NATIVE_WCHAR_T -//! string addition operator \relates UTFString -inline UTFString operator+(const UTFString &s1, wchar_t c) { return UTFString(s1).append(1, c); } -#endif - -//! string addition operator \relates UTFString -inline UTFString operator+(UTFString::code_point c, const UTFString &s2) { return UTFString().append(1, c).append(s2); } -//! string addition operator \relates UTFString -inline UTFString operator+(UTFString::unicode_char c, const UTFString &s2) { return UTFString().append(1, c).append(s2); } -//! string addition operator \relates UTFString -inline UTFString operator+(char c, const UTFString &s2) { return UTFString().append(1, c).append(s2); } - -#if CC_IS_NATIVE_WCHAR_T -//! string addition operator \relates UTFString -inline UTFString operator+(wchar_t c, const UTFString &s2) { return UTFString().append(1, c).append(s2); } -#endif - -// (const) forward iterator common operators -inline UTFString::size_type operator-(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return (left.iter_ - right.iter_); } -inline bool operator==(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return left.iter_ == right.iter_; } -inline bool operator!=(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return left.iter_ != right.iter_; } -inline bool operator<(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return left.iter_ < right.iter_; } -inline bool operator<=(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return left.iter_ <= right.iter_; } -inline bool operator>(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return left.iter_ > right.iter_; } -inline bool operator>=(const UTFString::_const_fwd_iterator &left, const UTFString::_const_fwd_iterator &right) { return left.iter_ >= right.iter_; } - -// (const) reverse iterator common operators -// NB: many of these operations are evaluated in reverse because this is a reverse iterator wrapping a forward iterator -inline UTFString::size_type operator-(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return (right.iter_ - left.iter_); } -inline bool operator==(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return left.iter_ == right.iter_; } -inline bool operator!=(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return left.iter_ != right.iter_; } -inline bool operator<(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return right.iter_ < left.iter_; } -inline bool operator<=(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return right.iter_ <= left.iter_; } -inline bool operator>(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return right.iter_ > left.iter_; } -inline bool operator>=(const UTFString::_const_rev_iterator &left, const UTFString::_const_rev_iterator &right) { return right.iter_ >= left.iter_; } - -} // namespace cc - -#endif // CC_CORE_KERNEL_UTF_STRING_H_ diff --git a/native/cocos/base/Utils.cpp b/native/cocos/base/Utils.cpp index fc557e460a..d966cbf12f 100644 --- a/native/cocos/base/Utils.cpp +++ b/native/cocos/base/Utils.cpp @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "base/Utils.h" @@ -33,7 +34,10 @@ THE SOFTWARE. #endif #include -#include +#include + +#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED +#include "boost/stacktrace.hpp" namespace cc { @@ -67,6 +71,11 @@ int nextPOT(int x) { return x + 1; } +// painfully slow to execute, use with caution +std::string getStacktrace(uint skip, uint maxDepth) { + return boost::stacktrace::to_string(boost::stacktrace::stacktrace(skip, maxDepth)); +} + } // namespace utils } // namespace cc diff --git a/native/cocos/base/Utils.h b/native/cocos/base/Utils.h index 6a22e9044b..1f1c68e724 100644 --- a/native/cocos/base/Utils.h +++ b/native/cocos/base/Utils.h @@ -1,65 +1,77 @@ /**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include -#include #include "base/Macros.h" - -/** @file ccUtils.h -Misc free functions -*/ +#include "base/TypeDef.h" +#include +#include namespace cc { - -/* -utils::nextPOT function is licensed under the same license that is used in Texture2D.m. -*/ - -/** Returns the Next Power of Two value. - -Examples: -- If "value" is 15, it will return 16. -- If "value" is 16, it will return 16. -- If "value" is 17, it will return 32. -@param value The value to get next power of two. -@return Returns the next power of two value. -@since v0.99.5 -*/ - namespace utils { -CC_DLL int nextPOT(int x); -/** Same to ::atof, but strip the string, remain 7 numbers after '.' before call atof. - * Why we need this? Because in android c++_static, atof ( and std::atof ) is unsupported for numbers have long decimal part and contain - * several numbers can approximate to 1 ( like 90.099998474121094 ), it will return inf. This function is used to fix this bug. - * @param str The string be to converted to double. - * @return Returns converted value of a string. - */ + +CC_DLL std::string getStacktrace(uint skip = 0, uint maxDepth = UINT_MAX); + +/** + * Returns the Next Power of Two value. + * Examples: + * - If "value" is 15, it will return 16. + * - If "value" is 16, it will return 16. + * - If "value" is 17, it will return 32. + * @param value The value to get next power of two. + * @return Returns the next power of two value. + * @since v0.99.5 +*/ +CC_DLL uint nextPOT(uint x); + +/** + * Same to ::atof, but strip the string, remain 7 numbers after '.' before call atof. + * Why we need this? Because in android c++_static, atof ( and std::atof ) is unsupported for numbers have long decimal part and contain + * several numbers can approximate to 1 ( like 90.099998474121094 ), it will return inf. This function is used to fix this bug. + * @param str The string be to converted to double. + * @return Returns converted value of a string. + */ CC_DLL double atof(const char *str); -} // namespace utils +template +char (*countOfHelper(T (&array)[Size]))[Size]; +#define COUNTOF(array) (sizeof(*countOfHelper(array)) + 0) + +template +uint toUint(T value) { + static_assert(std::is_arithmetic::value, "T must be numeric"); + + CCASSERT(static_cast(value) <= static_cast(std::numeric_limits::max()), + "value is too big to be converted to uint"); + + return static_cast(value); +} + +} // namespace utils } // namespace cc diff --git a/native/cocos/base/Value.cpp b/native/cocos/base/Value.cpp index 213d92edc9..11f2a18984 100644 --- a/native/cocos/base/Value.cpp +++ b/native/cocos/base/Value.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -24,22 +25,23 @@ ****************************************************************************/ #include "base/Value.h" -#include "base/Utils.h" +#include #include -#include +#include #include -#include -#include #include +#include + +#include "base/Utils.h" namespace cc { -const ValueVector ValueVectorNull; -const ValueMap ValueMapNull; -const ValueMapIntKey ValueMapIntKeyNull; +const ValueVector VALUE_VECTOR_NULL; +const ValueMap VALUE_MAP_NULL; +const ValueMapIntKey VALUE_MAP_INT_KEY_NULL; -const Value Value::Null; +const Value Value::VALUE_NULL; Value::Value() : _type(Type::NONE) { @@ -86,43 +88,43 @@ Value::Value(const char *v) Value::Value(const std::string &v) : _type(Type::STRING) { - _field.strVal = new (std::nothrow) std::string(); + _field.strVal = new (std::nothrow) std::string(); *_field.strVal = v; } Value::Value(const ValueVector &v) : _type(Type::VECTOR) { - _field.vectorVal = new (std::nothrow) ValueVector(); + _field.vectorVal = new (std::nothrow) ValueVector(); *_field.vectorVal = v; } Value::Value(ValueVector &&v) : _type(Type::VECTOR) { - _field.vectorVal = new (std::nothrow) ValueVector(); + _field.vectorVal = new (std::nothrow) ValueVector(); *_field.vectorVal = std::move(v); } Value::Value(const ValueMap &v) : _type(Type::MAP) { - _field.mapVal = new (std::nothrow) ValueMap(); + _field.mapVal = new (std::nothrow) ValueMap(); *_field.mapVal = v; } Value::Value(ValueMap &&v) : _type(Type::MAP) { - _field.mapVal = new (std::nothrow) ValueMap(); + _field.mapVal = new (std::nothrow) ValueMap(); *_field.mapVal = std::move(v); } Value::Value(const ValueMapIntKey &v) : _type(Type::INT_KEY_MAP) { - _field.intKeyMapVal = new (std::nothrow) ValueMapIntKey(); + _field.intKeyMapVal = new (std::nothrow) ValueMapIntKey(); *_field.intKeyMapVal = v; } Value::Value(ValueMapIntKey &&v) : _type(Type::INT_KEY_MAP) { - _field.intKeyMapVal = new (std::nothrow) ValueMapIntKey(); + _field.intKeyMapVal = new (std::nothrow) ValueMapIntKey(); *_field.intKeyMapVal = std::move(v); } @@ -131,7 +133,7 @@ Value::Value(const Value &other) *this = other; } -Value::Value(Value &&other) +Value::Value(Value &&other) noexcept : _type(Type::NONE) { *this = std::move(other); } @@ -194,7 +196,7 @@ Value &Value::operator=(const Value &other) { return *this; } -Value &Value::operator=(Value &&other) { +Value &Value::operator=(Value &&other) noexcept { if (this != &other) { clear(); switch (other._type) { @@ -336,9 +338,18 @@ bool Value::operator==(const Value &v) { return t == v; } bool Value::operator==(const Value &v) const { - if (this == &v) return true; - if (v._type != this->_type) return false; - if (this->isNull()) return true; + if (this == &v) { + return true; + } + + if (v._type != this->_type) { + return false; + } + + if (this->isNull()) { + return true; + } + switch (_type) { case Type::BYTE: return v._field.byteVal == this->_field.byteVal; case Type::INTEGER: return v._field.intVal == this->_field.intVal; @@ -348,12 +359,14 @@ bool Value::operator==(const Value &v) const { case Type::FLOAT: return std::abs(v._field.floatVal - this->_field.floatVal) <= FLT_EPSILON; case Type::DOUBLE: return std::abs(v._field.doubleVal - this->_field.doubleVal) <= DBL_EPSILON; case Type::VECTOR: { - const auto &v1 = *(this->_field.vectorVal); - const auto &v2 = *(v._field.vectorVal); - const auto size = v1.size(); + const auto &v1 = *(this->_field.vectorVal); + const auto &v2 = *(v._field.vectorVal); + const auto size = v1.size(); if (size == v2.size()) { for (size_t i = 0; i < size; i++) { - if (v1[i] != v2[i]) return false; + if (v1[i] != v2[i]) { + return false; + } } return true; } @@ -503,7 +516,7 @@ float Value::asFloat() const { } if (_type == Type::STRING) { - return utils::atof(_field.strVal->c_str()); + return static_cast(utils::atof(_field.strVal->c_str())); } if (_type == Type::INTEGER) { @@ -565,27 +578,27 @@ bool Value::asBool() const { } if (_type == Type::BYTE) { - return _field.byteVal == 0 ? false : true; + return _field.byteVal != 0; } if (_type == Type::STRING) { - return (*_field.strVal == "0" || *_field.strVal == "false") ? false : true; + return *_field.strVal != "0" || *_field.strVal != "false"; } if (_type == Type::INTEGER) { - return _field.intVal == 0 ? false : true; + return _field.intVal != 0; } if (_type == Type::UNSIGNED) { - return _field.unsignedVal == 0 ? false : true; + return _field.unsignedVal != 0; } if (_type == Type::FLOAT) { - return _field.floatVal == 0.0f ? false : true; + return _field.floatVal != 0.0f; } if (_type == Type::DOUBLE) { - return _field.doubleVal == 0.0 ? false : true; + return _field.doubleVal != 0.0; } return false; @@ -670,8 +683,9 @@ static std::string visit(const Value &v, int depth); static std::string visitVector(const ValueVector &v, int depth) { std::stringstream ret; - if (depth > 0) + if (depth > 0) { ret << "\n"; + } ret << getTabs(depth) << "[\n"; @@ -690,8 +704,9 @@ template static std::string visitMap(const T &v, int depth) { std::stringstream ret; - if (depth > 0) + if (depth > 0) { ret << "\n"; + } ret << getTabs(depth) << "{\n"; @@ -783,8 +798,9 @@ void Value::clear() { } void Value::reset(Type type) { - if (_type == type) + if (_type == type) { return; + } clear(); diff --git a/native/cocos/base/Value.h b/native/cocos/base/Value.h index ee7599246b..a43ad953fb 100644 --- a/native/cocos/base/Value.h +++ b/native/cocos/base/Value.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "base/Macros.h" @@ -31,13 +33,13 @@ namespace cc { class Value; -typedef vector ValueVector; -typedef unordered_map ValueMap; -typedef unordered_map ValueMapIntKey; +using ValueVector = vector; +using ValueMap = unordered_map; +using ValueMapIntKey = unordered_map; -CC_DLL extern const ValueVector ValueVectorNull; -CC_DLL extern const ValueMap ValueMapNull; -CC_DLL extern const ValueMapIntKey ValueMapIntKeyNull; +CC_DLL extern const ValueVector VALUE_VECTOR_NULL; +CC_DLL extern const ValueMap VALUE_MAP_NULL; +CC_DLL extern const ValueMapIntKey VALUE_MAP_INT_KEY_NULL; /* * This class is provide as a wrapper of basic types, such as int and bool. @@ -45,7 +47,7 @@ CC_DLL extern const ValueMapIntKey ValueMapIntKeyNull; class CC_DLL Value { public: /** A predefined Value that has not value. */ - static const Value Null; + static const Value VALUE_NULL; /** Default constructor. */ Value(); @@ -92,7 +94,7 @@ public: /** Create a Value by another Value object. */ Value(const Value &other); /** Create a Value by a Value object. It will use std::move internally. */ - Value(Value &&other); + Value(Value &&other) noexcept; /** Destructor. */ ~Value(); @@ -100,7 +102,7 @@ public: /** Assignment operator, assign from Value to Value. */ Value &operator=(const Value &other); /** Assignment operator, assign from Value to Value. It will use std::move internally. */ - Value &operator=(Value &&other); + Value &operator=(Value &&other) noexcept; /** Assignment operator, assign from unsigned char to Value. */ Value &operator=(unsigned char v); diff --git a/native/cocos/base/Vector.h b/native/cocos/base/Vector.h index 539380ed97..9924482f13 100644 --- a/native/cocos/base/Vector.h +++ b/native/cocos/base/Vector.h @@ -1,51 +1,48 @@ /**************************************************************************** -Copyright (c) 2010 ForzeField Studios S.L. http://forzefield.com -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010 ForzeField Studios S.L. http://forzefield.com + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include -#include #include // for std::find +#include +#include +#include "base/Log.h" #include "base/Macros.h" #include "base/Random.h" #include "base/Ref.h" -#include "base/Log.h" -/** - * @addtogroup base - * @{ - */ namespace cc { /* * Similar to std::vector, but it will manage reference count automatically internally. * Which means it will invoke Ref::retain() when adding an element, and invoke Ref::release() when removing an element. * @warn The element should be `Ref` or its sub-class. - * @lua NA */ template class Vector { @@ -147,7 +144,7 @@ public: } /** Constructor with std::move semantic. */ - Vector(Vector &&other) { + Vector(Vector &&other) noexcept { static_assert(std::is_convertible::value, "Invalid Type for cc::Vector!"); CC_LOG_INFO("In the move constructor of Vector!"); _data = std::move(other._data); @@ -165,7 +162,7 @@ public: } /** Copy assignment operator with std::move semantic. */ - Vector &operator=(Vector &&other) { + Vector &operator=(Vector &&other) noexcept { if (this != &other) { CC_LOG_INFO("In the move assignment operator!"); clear(); @@ -174,17 +171,6 @@ public: return *this; } - // Don't uses operator since we could not decide whether it needs 'retain'/'release'. - // T& operator[](int index) - // { - // return _data[index]; - // } - // - // const T& operator[](int index) const - // { - // return _data[index]; - // } - /** * Requests that the vector capacity be at least enough to contain n elements. * @param capacity Minimum capacity requested of the Vector. @@ -218,15 +204,16 @@ public: } /** Returns the maximum number of elements that the Vector can hold. */ - ssize_t max_size() const { + ssize_t maxSize() const { return _data.max_size(); } /** Returns index of a certain object, return UINT_MAX if doesn't contain the object */ ssize_t getIndex(T object) const { auto iter = std::find(_data.begin(), _data.end(), object); - if (iter != _data.end()) + if (iter != _data.end()) { return iter - _data.begin(); + } return -1; } @@ -268,7 +255,7 @@ public: /** Returns a random element of the Vector. */ T getRandomObject() const { if (!_data.empty()) { - ssize_t randIdx = RandomHelper::random_int(0, static_cast(_data.size()) - 1); + auto randIdx = static_cast(RandomHelper::randomInt(0, static_cast(_data.size()) - 1)); return *(_data.begin() + randIdx); } return nullptr; @@ -290,8 +277,9 @@ public: */ bool equals(const Vector &other) const { ssize_t s = this->size(); - if (s != other.size()) + if (s != other.size()) { return false; + } for (ssize_t i = 0; i < s; i++) { if (this->at(i) != other.at(i)) { @@ -462,7 +450,4 @@ protected: std::vector _data; }; -// end of base group -/** @} */ - } // namespace cc diff --git a/native/cocos/base/ZipUtils.cpp b/native/cocos/base/ZipUtils.cpp index f21b46ad21..d3af77dada 100644 --- a/native/cocos/base/ZipUtils.cpp +++ b/native/cocos/base/ZipUtils.cpp @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ // IDEA: hack, must be included before ziputils #include "base/ZipUtils.h" diff --git a/native/cocos/base/ZipUtils.h b/native/cocos/base/ZipUtils.h index a80e63e40c..8f19c25aff 100644 --- a/native/cocos/base/ZipUtils.h +++ b/native/cocos/base/ZipUtils.h @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __SUPPORT_ZIPUTILS_H__ diff --git a/native/cocos/base/astc.cpp b/native/cocos/base/astc.cpp index 9ce0456ffa..2f2302ede2 100644 --- a/native/cocos/base/astc.cpp +++ b/native/cocos/base/astc.cpp @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -22,7 +23,7 @@ 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 "base/astc.h" #include "platform/Image.h" diff --git a/native/cocos/base/astc.h b/native/cocos/base/astc.h index 091d989165..c14a1e1a06 100644 --- a/native/cocos/base/astc.h +++ b/native/cocos/base/astc.h @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -22,15 +23,14 @@ 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 -#ifndef __ASTC_H__ - #define __ASTC_H__ +#pragma once -typedef unsigned char astc_byte; -typedef unsigned int astc_uint32; +using astc_byte = unsigned char; +using astc_uint32 = unsigned int; // Size of a ASTC header @@ -49,5 +49,3 @@ int astcGetWidth(const astc_byte *pHeader); // Read the image height from a ASTC header int astcGetHeight(const astc_byte *pHeader); - -#endif diff --git a/native/cocos/base/base64.cpp b/native/cocos/base/base64.cpp index ddb544f781..d1b4ac21c6 100644 --- a/native/cocos/base/base64.cpp +++ b/native/cocos/base/base64.cpp @@ -1,167 +1,180 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 #include "base/base64.h" +#include +#include +#include +#include + namespace cc { -unsigned char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +std::string alphabet{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}; -int _base64Decode(const unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len) { - static char inalphabet[256], decoder[256]; - int i, bits, c = 0, char_count, errors = 0; - unsigned int input_idx = 0; - unsigned int output_idx = 0; - - for (i = (sizeof alphabet) - 1; i >= 0; i--) { +int doBase64Decode(const unsigned char *input, unsigned int inputLen, unsigned char *output, unsigned int *outputLen) { + static std::vector inalphabet(256); + static std::vector decoder(256); + int i; + int bits; + int c = 0; + int charCount; + int errors = 0; + unsigned int inputIdx = 0; + unsigned int outputIdx = 0; + int length = static_cast(alphabet.length()); + for (i = length - 1; i >= 0; i--) { inalphabet[alphabet[i]] = 1; - decoder[alphabet[i]] = i; + decoder[alphabet[i]] = i; } - char_count = 0; - bits = 0; - for (input_idx = 0; input_idx < input_len; input_idx++) { - c = input[input_idx]; - if (c == '=') + charCount = 0; + bits = 0; + for (inputIdx = 0; inputIdx < inputLen; inputIdx++) { + c = input[inputIdx]; + if (c == '=') { break; - if (c > 255 || !inalphabet[c]) + } + + if (c > 255 || !inalphabet[c]) { continue; + } + bits += decoder[c]; - char_count++; - if (char_count == 4) { - output[output_idx++] = (bits >> 16); - output[output_idx++] = ((bits >> 8) & 0xff); - output[output_idx++] = (bits & 0xff); - bits = 0; - char_count = 0; + ++charCount; + if (charCount == 4) { + output[outputIdx++] = (bits >> 16); + output[outputIdx++] = ((bits >> 8) & 0xff); + output[outputIdx++] = (bits & 0xff); + bits = 0; + charCount = 0; } else { bits <<= 6; } } if (c == '=') { - switch (char_count) { + switch (charCount) { case 1: #if (CC_PLATFORM != CC_PLATFORM_BADA) fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing"); #endif - errors++; + ++errors; break; case 2: - output[output_idx++] = (bits >> 10); + output[outputIdx++] = (bits >> 10); break; case 3: - output[output_idx++] = (bits >> 16); - output[output_idx++] = ((bits >> 8) & 0xff); + output[outputIdx++] = (bits >> 16); + output[outputIdx++] = ((bits >> 8) & 0xff); break; } - } else if (input_idx < input_len) { - if (char_count) { + } else if (inputIdx < inputLen) { + if (charCount) { #if (CC_PLATFORM != CC_PLATFORM_BADA) fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated", - ((4 - char_count) * 6)); + ((4 - charCount) * 6)); #endif - errors++; + ++errors; } } - *output_len = output_idx; + *outputLen = outputIdx; return errors; } -void _base64Encode(const unsigned char *input, unsigned int input_len, char *output) { - unsigned int char_count; +void doBase64Encode(const unsigned char *input, unsigned int inputLen, char *output) { + unsigned int charCount; unsigned int bits; - unsigned int input_idx = 0; - unsigned int output_idx = 0; + unsigned int inputIdx = 0; + unsigned int outputIdx = 0; - char_count = 0; - bits = 0; - for (input_idx = 0; input_idx < input_len; input_idx++) { - bits |= input[input_idx]; + charCount = 0; + bits = 0; + for (inputIdx = 0; inputIdx < inputLen; inputIdx++) { + bits |= input[inputIdx]; - char_count++; - if (char_count == 3) { - output[output_idx++] = alphabet[(bits >> 18) & 0x3f]; - output[output_idx++] = alphabet[(bits >> 12) & 0x3f]; - output[output_idx++] = alphabet[(bits >> 6) & 0x3f]; - output[output_idx++] = alphabet[bits & 0x3f]; - bits = 0; - char_count = 0; + charCount++; + if (charCount == 3) { + output[outputIdx++] = alphabet[(bits >> 18) & 0x3f]; + output[outputIdx++] = alphabet[(bits >> 12) & 0x3f]; + output[outputIdx++] = alphabet[(bits >> 6) & 0x3f]; + output[outputIdx++] = alphabet[bits & 0x3f]; + bits = 0; + charCount = 0; } else { bits <<= 8; } } - if (char_count) { - if (char_count == 1) { + if (charCount) { + if (charCount == 1) { bits <<= 8; } - output[output_idx++] = alphabet[(bits >> 18) & 0x3f]; - output[output_idx++] = alphabet[(bits >> 12) & 0x3f]; - if (char_count > 1) { - output[output_idx++] = alphabet[(bits >> 6) & 0x3f]; + output[outputIdx++] = alphabet[(bits >> 18) & 0x3f]; + output[outputIdx++] = alphabet[(bits >> 12) & 0x3f]; + if (charCount > 1) { + output[outputIdx++] = alphabet[(bits >> 6) & 0x3f]; } else { - output[output_idx++] = '='; + output[outputIdx++] = '='; } - output[output_idx++] = '='; + output[outputIdx++] = '='; } - output[output_idx++] = 0; + output[outputIdx++] = 0; } int base64Decode(const unsigned char *in, unsigned int inLength, unsigned char **out) { unsigned int outLength = 0; //should be enough to store 6-bit buffers in 8-bit buffers - *out = (unsigned char *)malloc(inLength / 4 * 3 + 1); + *out = static_cast(malloc(inLength / 4 * 3 + 1)); if (*out) { - int ret = _base64Decode(in, inLength, *out, &outLength); + int ret = doBase64Decode(in, inLength, *out, &outLength); if (ret > 0) { free(*out); - *out = nullptr; + *out = nullptr; outLength = 0; } } - return outLength; + return static_cast(outLength); } int base64Encode(const unsigned char *in, unsigned int inLength, char **out) { unsigned int outLength = (inLength + 2) / 3 * 4; //should be enough to store 8-bit buffers in 6-bit buffers - *out = (char *)malloc(outLength + 1); + *out = static_cast(malloc(outLength + 1)); if (*out) { - _base64Encode(in, inLength, *out); + doBase64Encode(in, inLength, *out); } - return outLength; + return static_cast(outLength); } } // namespace cc diff --git a/native/cocos/base/base64.h b/native/cocos/base/base64.h index c8adaa99da..205af09a83 100644 --- a/native/cocos/base/base64.h +++ b/native/cocos/base/base64.h @@ -1,32 +1,31 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __SUPPORT_BASE64_H__ -#define __SUPPORT_BASE64_H__ -/// @cond DO_NOT_SHOW +#pragma once #include "base/Macros.h" @@ -36,17 +35,11 @@ extern "C" { namespace cc { -/** @file - base64 helper functions - */ - /** * Decodes a 64base encoded memory. The decoded memory is * expected to be freed by the caller by calling `free()` * * @returns the length of the out buffer - * - @since v0.8.1 */ int CC_DLL base64Decode(const unsigned char *in, unsigned int inLength, unsigned char **out); @@ -56,7 +49,6 @@ int CC_DLL base64Decode(const unsigned char *in, unsigned int inLength, unsigned * * @returns the length of the out buffer * - @since v2.1.4 */ int CC_DLL base64Encode(const unsigned char *in, unsigned int inLength, char **out); @@ -65,6 +57,3 @@ int CC_DLL base64Encode(const unsigned char *in, unsigned int inLength, char **o #ifdef __cplusplus } #endif - -/// @endcond -#endif // __SUPPORT_BASE64_H__ diff --git a/native/cocos/base/csscolorparser.cpp b/native/cocos/base/csscolorparser.cpp index bf324ecef7..4a5cddd8f6 100644 --- a/native/cocos/base/csscolorparser.cpp +++ b/native/cocos/base/csscolorparser.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // (c) Dean McNamee , 2012. // C++ port by Mapbox, Konstantin Käfer , 2014-2017. // @@ -34,11 +59,11 @@ namespace CSSColorParser { // http://www.w3.org/TR/css3-color/ struct NamedColor { - const char *const name; - const Color color; + const char * name; + Color color; }; -const std::vector namedColors = { +const std::vector NAMED_COLORS = { {"transparent", {0, 0, 0, 0}}, {"aliceblue", {240, 248, 255, 1}}, {"antiquewhite", {250, 235, 215, 1}}, @@ -189,13 +214,13 @@ const std::vector namedColors = { {"yellowgreen", {154, 205, 50, 1}}}; template -uint8_t clamp_css_byte(T i) { // Clamp to integer 0 .. 255. - i = ::round(i); // Seems to be what Chrome does (vs truncation). - return i < 0 ? 0 : i > 255 ? 255 : uint8_t(i); +uint8_t clampCssByte(T i) { // Clamp to integer 0 .. 255. + i = static_cast(::round(i)); // Seems to be what Chrome does (vs truncation). + return static_cast(i < 0 ? 0 : i > 255 ? 255 : i); } template -float clamp_css_float(T f) { // Clamp to float 0.0 .. 1.0. +float clampCssFloat(T f) { // Clamp to float 0.0 .. 1.0. return f < 0 ? 0 : f > 1 ? 1 : float(f); } @@ -207,23 +232,21 @@ int64_t parseInt(const std::string &str, uint8_t base = 10) { return strtoll(str.c_str(), nullptr, base); } -uint8_t parse_css_int(const std::string &str) { // int or percentage. +uint8_t parseCssInt(const std::string &str) { // int or percentage. if (str.length() && str.back() == '%') { - return clamp_css_byte(parseFloat(str) / 100.0f * 255.0f); - } else { - return clamp_css_byte(parseInt(str)); + return clampCssByte(parseFloat(str) / 100.0f * 255.0f); } + return clampCssByte(parseInt(str)); + } + +float parseCssFloat(const std::string &str) { // float or percentage. + if (str.length() && str.back() == '%') { + return clampCssFloat(parseFloat(str) / 100.0f); + } + return clampCssFloat(parseFloat(str)); } -float parse_css_float(const std::string &str) { // float or percentage. - if (str.length() && str.back() == '%') { - return clamp_css_float(parseFloat(str) / 100.0f); - } else { - return clamp_css_float(parseFloat(str)); - } -} - -float css_hue_to_rgb(float m1, float m2, float h) { +float cssHueToRgb(float m1, float m2, float h) { if (h < 0.0f) { h += 1.0f; } else if (h > 1.0f) { @@ -252,8 +275,8 @@ std::vector split(const std::string &s, char delim) { return elems; } -Color parse(const std::string &css_str) { - std::string str = css_str; +Color parse(const std::string &cssStr) { + std::string str = cssStr; // Remove all whitespace, not compliant, but should just be more accepting. str.erase(std::remove(str.begin(), str.end(), ' '), str.end()); @@ -261,9 +284,9 @@ Color parse(const std::string &css_str) { // Convert to lowercase. std::transform(str.begin(), str.end(), str.begin(), ::tolower); - for (size_t i = 0; i < namedColors.size(); i++) { - if (str == namedColors[i].name) { - return {namedColors[i].color}; + for (const auto &namedColor : NAMED_COLORS) { + if (str == namedColor.name) { + return namedColor.color; } } @@ -274,28 +297,30 @@ Color parse(const std::string &css_str) { parseInt(str.substr(1), 16); // REFINE(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xfff)) { return {}; - } else { - return Color( - static_cast(((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8)), - static_cast((iv & 0xf0) | ((iv & 0xf0) >> 4)), - static_cast((iv & 0xf) | ((iv & 0xf) << 4)), 1); - } - } else if (str.length() == 7) { - int64_t iv = - parseInt(str.substr(1), 16); // REFINE(deanm): Stricter parsing. + } + + return Color( + static_cast(((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8)), + static_cast((iv & 0xf0) | ((iv & 0xf0) >> 4)), + static_cast((iv & 0xf) | ((iv & 0xf) << 4)), 1); + } + + if (str.length() == 7) { + int64_t iv = parseInt(str.substr(1), 16); // REFINE(deanm): Stricter parsing. if (!(iv >= 0 && iv <= 0xffffff)) { return {}; // Covers NaN. - } else { - return Color(static_cast((iv & 0xff0000) >> 16), - static_cast((iv & 0xff00) >> 8), - static_cast(iv & 0xff), 1); } + + return Color(static_cast((iv & 0xff0000) >> 16), + static_cast((iv & 0xff00) >> 8), + static_cast(iv & 0xff), 1); } return Color(); } - size_t op = str.find_first_of('('), ep = str.find_first_of(')'); + size_t op = str.find_first_of('('); + size_t ep = str.find_first_of(')'); if (op != std::string::npos && ep + 1 == str.length()) { const std::string fname = str.substr(0, op); const std::vector params = @@ -308,22 +333,24 @@ Color parse(const std::string &css_str) { if (params.size() != 4) { return {}; } - alpha = parse_css_float(params.back()); + alpha = parseCssFloat(params.back()); } else { if (params.size() != 3) { return {}; } } - return Color(parse_css_int(params[0]), parse_css_int(params[1]), - parse_css_int(params[2]), alpha); + return Color(parseCssInt(params[0]), parseCssInt(params[1]), + parseCssInt(params[2]), alpha); - } else if (fname == "hsla" || fname == "hsl") { + } + + if (fname == "hsla" || fname == "hsl") { if (fname == "hsla") { if (params.size() != 4) { return {}; } - alpha = parse_css_float(params.back()); + alpha = parseCssFloat(params.back()); } else { if (params.size() != 3) { return {}; @@ -331,23 +358,25 @@ Color parse(const std::string &css_str) { } float h = parseFloat(params[0]) / 360.0f; - while (h < 0.0f) - h++; - while (h > 1.0f) - h--; + while (h < 0.0f) { + ++h; + } + while (h > 1.0f) { + --h; + } // NOTE(deanm): According to the CSS spec s/l should only be // percentages, but we don't bother and let float or percentage. - float s = parse_css_float(params[1]); - float l = parse_css_float(params[2]); + float s = parseCssFloat(params[1]); + float l = parseCssFloat(params[2]); float m2 = l <= 0.5f ? l * (s + 1.0f) : l + s - l * s; float m1 = l * 2.0f - m2; return Color( - clamp_css_byte(css_hue_to_rgb(m1, m2, h + 1.0f / 3.0f) * 255.0f), - clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255.0f), - clamp_css_byte(css_hue_to_rgb(m1, m2, h - 1.0f / 3.0f) * 255.0f), + clampCssByte(cssHueToRgb(m1, m2, h + 1.0f / 3.0f) * 255.0f), + clampCssByte(cssHueToRgb(m1, m2, h) * 255.0f), + clampCssByte(cssHueToRgb(m1, m2, h - 1.0f / 3.0f) * 255.0f), alpha); } } diff --git a/native/cocos/base/csscolorparser.h b/native/cocos/base/csscolorparser.h index 93854d0e62..a129578849 100644 --- a/native/cocos/base/csscolorparser.h +++ b/native/cocos/base/csscolorparser.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // (c) Dean McNamee , 2012. // C++ port by Mapbox, Konstantin Käfer , 2014-2017. // @@ -22,19 +47,17 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. -#ifndef CSS_COLOR_PARSER_CPP -#define CSS_COLOR_PARSER_CPP +#pragma once #include -#include +#include namespace CSSColorParser { struct Color { - inline Color() { - } - inline Color(unsigned char r_, unsigned char g_, unsigned char b_, float a_) - : r(r_), g(g_), b(b_), a(a_ > 1 ? 1 : a_ < 0 ? 0 : a_) { + inline Color() = default; + inline Color(unsigned char red, unsigned char green, unsigned char blue, float alpha) + : r(red), g(green), b(blue), a(alpha > 1 ? 1 : alpha < 0 ? 0 : alpha) { } unsigned char r = 0, g = 0, b = 0; float a = 1.0f; @@ -48,8 +71,6 @@ inline bool operator!=(const Color &lhs, const Color &rhs) { return !(lhs == rhs); } -Color parse(const std::string &css_str); +Color parse(const std::string &cssStr); } // namespace CSSColorParser - -#endif diff --git a/native/cocos/base/etc1.cpp b/native/cocos/base/etc1.cpp index 3fa1429478..b2dc807ab6 100644 --- a/native/cocos/base/etc1.cpp +++ b/native/cocos/base/etc1.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // Copyright 2009 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/native/cocos/base/etc1.h b/native/cocos/base/etc1.h index 2193cd9fdf..a96a6b245a 100644 --- a/native/cocos/base/etc1.h +++ b/native/cocos/base/etc1.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // Copyright 2009 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/native/cocos/base/etc2.cpp b/native/cocos/base/etc2.cpp index 107ca4aaba..f1a43fb63b 100644 --- a/native/cocos/base/etc2.cpp +++ b/native/cocos/base/etc2.cpp @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -22,7 +23,7 @@ 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 "base/etc2.h" #include diff --git a/native/cocos/base/etc2.h b/native/cocos/base/etc2.h index 4be5125fe4..30597bc446 100644 --- a/native/cocos/base/etc2.h +++ b/native/cocos/base/etc2.h @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -22,7 +23,7 @@ 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 __etc2_h__ #define __etc2_h__ diff --git a/native/cocos/base/job-system/JobSystem.h b/native/cocos/base/job-system/JobSystem.h new file mode 100644 index 0000000000..5f08f24419 --- /dev/null +++ b/native/cocos/base/job-system/JobSystem.h @@ -0,0 +1,42 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#if CC_JOB_SYSTEM == CC_JOB_SYSTEM_TASKFLOW +#include "job-system-taskflow/TFJobGraph.h" +#include "job-system-taskflow/TFJobSystem.h" +namespace cc { +using JobToken = TFJobToken; +using JobGraph = TFJobGraph; +using JobSystem = TFJobSystem; +} // namespace cc +#elif CC_JOB_SYSTEM == CC_JOB_SYSTEM_TBB +#include "job-system-tbb/TBBJobGraph.h" +#include "job-system-tbb/TBBJobSystem.h" +namespace cc { +using JobToken = TBBJobToken; +using JobGraph = TBBJobGraph; +using JobSystem = TBBJobSystem; +} // namespace cc +#endif diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp new file mode 100644 index 0000000000..01e933700f --- /dev/null +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "TFJobGraph.h" +#include "TFJobSystem.h" + +namespace cc { + +void TFJobGraph::makeEdge(uint j1, uint j2) noexcept { + _tasks[j1].precede(_tasks[j2]); +} + +void TFJobGraph::run() noexcept { + if (_pending) return; + _future = _executor->run(_flow); + _pending = true; +} + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h new file mode 100644 index 0000000000..2ccbf655c1 --- /dev/null +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobGraph.h @@ -0,0 +1,78 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "TFJobSystem.h" +#include "taskflow/taskflow.hpp" + +namespace cc { + +using TFJobToken = void; + +class TFJobGraph final { +public: + explicit TFJobGraph(TFJobSystem *system) noexcept : _executor(&system->_executor) {} + + template + uint createJob(Function &&func) noexcept; + + template + uint createForEachIndexJob(uint begin, uint end, uint step, Function &&func) noexcept; + + void makeEdge(uint j1, uint j2) noexcept; + + void run() noexcept; + + CC_INLINE void waitForAll() { + if (_pending) { + _future.wait(); + _pending = false; + } + } + +private: + tf::Executor *_executor = nullptr; + + tf::Taskflow _flow; + deque _tasks; // existing tasks cannot be invalidated + + std::future _future; + bool _pending = false; +}; + +template +uint TFJobGraph::createJob(Function &&func) noexcept { + _tasks.emplace_back(_flow.emplace(func)); + return static_cast(_tasks.size() - 1u); +} + +template +uint TFJobGraph::createForEachIndexJob(uint begin, uint end, uint step, Function &&func) noexcept { + _tasks.emplace_back(_flow.for_each_index(begin, end, step, func)); + return static_cast(_tasks.size() - 1u); +} + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp new file mode 100644 index 0000000000..90dad4c950 --- /dev/null +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "TFJobGraph.h" +#include "TFJobSystem.h" + +namespace cc { + +TFJobSystem *TFJobSystem::_instance = nullptr; + +TFJobSystem::TFJobSystem(uint threadCount) noexcept +: _executor(threadCount) { + CC_LOG_INFO("Taskflow Job system initialized: %d worker threads", threadCount); +} + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h new file mode 100644 index 0000000000..8ddf59d4d9 --- /dev/null +++ b/native/cocos/base/job-system/job-system-taskflow/TFJobSystem.h @@ -0,0 +1,60 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "taskflow/taskflow.hpp" +#include +#include + +namespace cc { + +class TFJobSystem final { +public: + static TFJobSystem *getInstance() { + if (!_instance) { + _instance = CC_NEW(TFJobSystem); + } + return _instance; + } + + static void destroyInstance() { + CC_SAFE_DELETE(_instance); + } + + TFJobSystem() noexcept : TFJobSystem(std::max(2u, std::thread::hardware_concurrency() - 2u)) {} + explicit TFJobSystem(uint threadCount) noexcept; + + CC_INLINE uint threadCount() { return static_cast(_executor.num_workers()); } + +private: + friend class TFJobGraph; + + static TFJobSystem *_instance; + + tf::Executor _executor; +}; + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp new file mode 100644 index 0000000000..294b5aa0c7 --- /dev/null +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "TBBJobGraph.h" + +namespace cc { + +void TBBJobGraph::makeEdge(uint j1, uint j2) noexcept { + if (j1 & PARALLEL_JOB_FLAG) { + j1 = _parallelJobs[j1 & PARALLEL_JOB_MASK].successor; + } + + if (j2 & PARALLEL_JOB_FLAG) { + j2 = _parallelJobs[j2 & PARALLEL_JOB_MASK].predecessor; + } + + tbb::flow::make_edge(_nodes[j1], _nodes[j2]); +} + +void TBBJobGraph::run() noexcept { + _nodes.front().try_put(tbb::flow::continue_msg()); + _pending = true; +} + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h new file mode 100644 index 0000000000..59abf64c52 --- /dev/null +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobGraph.h @@ -0,0 +1,106 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include + +namespace cc { + +using TBBJobToken = tbb::flow::continue_msg; + +class TBBJobSystem; + +class TBBJobGraph final { +public: + explicit TBBJobGraph(TBBJobSystem *system) noexcept { + _nodes.emplace_back(_graph, [](TBBJobToken t) {}); + } + + template + uint createJob(Function &&func) noexcept; + + template + uint createForEachIndexJob(uint begin, uint end, uint step, Function &&func) noexcept; + + void makeEdge(uint j1, uint j2) noexcept; + + void run() noexcept; + + CC_INLINE void waitForAll() { + if (_pending) { + _graph.wait_for_all(); + _pending = false; + } + } + +private: + static constexpr uint PARALLEL_JOB_FLAG = 1u << 20; + static constexpr uint PARALLEL_JOB_MASK = ~PARALLEL_JOB_FLAG; + + tbb::flow::graph _graph; + + using TBBJobNode = tbb::flow::continue_node; + deque _nodes; // existing nodes cannot be invalidated + + struct TBBParallelJob { + uint predecessor = 0u; + uint successor = 0u; + }; + vector _parallelJobs; + + bool _pending = false; +}; + +template +uint TBBJobGraph::createJob(Function &&func) noexcept { + _nodes.emplace_back(_graph, func); + tbb::flow::make_edge(_nodes.front(), _nodes.back()); + return static_cast(_nodes.size() - 1u); +} + +template +uint TBBJobGraph::createForEachIndexJob(uint begin, uint end, uint step, Function &&func) noexcept { + _nodes.emplace_back(_graph, [](TBBJobToken t) {}); + uint predecessorIdx = static_cast(_nodes.size() - 1u); + TBBJobNode &predecessor = _nodes.back(); + + tbb::flow::make_edge(_nodes.front(), predecessor); + + _nodes.emplace_back(_graph, [](TBBJobToken t) {}); + uint successorIdx = static_cast(_nodes.size() - 1u); + TBBJobNode &successor = _nodes.back(); + + for (uint i = begin; i < end; i += step) { + _nodes.emplace_back(_graph, [i, &func](TBBJobToken t) { func(i); }); + tbb::flow::make_edge(predecessor, _nodes.back()); + tbb::flow::make_edge(_nodes.back(), successor); + } + + _parallelJobs.push_back({predecessorIdx, successorIdx}); + return static_cast((_parallelJobs.size() - 1u)) | PARALLEL_JOB_FLAG; +} + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp new file mode 100644 index 0000000000..ac2a2a0b19 --- /dev/null +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "TBBJobGraph.h" +#include "TBBJobSystem.h" + +namespace cc { + +TBBJobSystem *TBBJobSystem::_instance = nullptr; + +TBBJobSystem::TBBJobSystem(uint threadCount) noexcept +: _control(tbb::global_control::max_allowed_parallelism, threadCount), + _threadCount(threadCount) { + CC_LOG_INFO("TBB Job system initialized: %d worker threads", threadCount); +} + +} // namespace cc diff --git a/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h new file mode 100644 index 0000000000..27da4aebd0 --- /dev/null +++ b/native/cocos/base/job-system/job-system-tbb/TBBJobSystem.h @@ -0,0 +1,61 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "tbb/global_control.h" +#include +#include + +namespace cc { + +class TBBJobGraph; + +class TBBJobSystem final { +public: + static TBBJobSystem *getInstance() { + if (!_instance) { + _instance = CC_NEW(TBBJobSystem); + } + return _instance; + } + + static void destroyInstance() { + CC_SAFE_DELETE(_instance); + } + + TBBJobSystem() noexcept : TBBJobSystem(std::max(2u, std::thread::hardware_concurrency() - 2u)) {} + explicit TBBJobSystem(uint threadCount) noexcept; + + CC_INLINE uint threadCount() { return _threadCount; } + +private: + static TBBJobSystem *_instance; + + tbb::global_control _control; + uint _threadCount = 0u; +}; + +} // namespace cc diff --git a/native/cocos/base/memory/AllocatedObj.cpp b/native/cocos/base/memory/AllocatedObj.cpp index bb4e3c1c6d..0b88a23ce7 100755 --- a/native/cocos/base/memory/AllocatedObj.cpp +++ b/native/cocos/base/memory/AllocatedObj.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "MemDef.h" #include "AllocatedObj.h" diff --git a/native/cocos/base/memory/AllocatedObj.h b/native/cocos/base/memory/AllocatedObj.h index c2b02aa547..e56f5e7887 100755 --- a/native/cocos/base/memory/AllocatedObj.h +++ b/native/cocos/base/memory/AllocatedObj.h @@ -1,5 +1,29 @@ -#ifndef CC_CORE_ALLOCATED_OBJ_H_ -#define CC_CORE_ALLOCATED_OBJ_H_ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once #include "../Macros.h" @@ -22,8 +46,8 @@ namespace cc { template class CC_DLL AllocatedObject { public: - explicit AllocatedObject() {} - ~AllocatedObject() {} + explicit AllocatedObject() = default; + virtual ~AllocatedObject() = default; // operator new, with debug line info void *operator new(size_t sz, const char *file, int line, const char *func) { @@ -56,12 +80,12 @@ public: } // Corresponding operator for placement delete (second param same as the first) - void operator delete(void *ptr, void *) { + void operator delete(void *ptr, void * /*unused*/) { Alloc::DeallocateBytes(ptr); } // only called if there is an exception in corresponding 'new' - void operator delete(void *ptr, const char *, int, const char *) { + void operator delete(void *ptr, const char * /*unused*/, int /*unused*/, const char * /*unused*/) { Alloc::DeallocateBytes(ptr); } @@ -69,11 +93,9 @@ public: Alloc::DeallocateBytes(ptr); } - void operator delete[](void *ptr, const char *, int, const char *) { + void operator delete[](void *ptr, const char * /*unused*/, int /*unused*/, const char * /*unused*/) { Alloc::DeallocateBytes(ptr); } }; } // namespace cc - -#endif // CC_CORE_ALLOCATED_OBJ_H_ diff --git a/native/cocos/base/memory/JeAlloc.cpp b/native/cocos/base/memory/JeAlloc.cpp index f8c956e258..84be0d9084 100755 --- a/native/cocos/base/memory/JeAlloc.cpp +++ b/native/cocos/base/memory/JeAlloc.cpp @@ -1,4 +1,29 @@ -#include "CoreStd.h" +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" #include "JeAlloc.h" #include "MemTracker.h" diff --git a/native/cocos/base/memory/JeAlloc.h b/native/cocos/base/memory/JeAlloc.h index 4b87502435..353b445e98 100755 --- a/native/cocos/base/memory/JeAlloc.h +++ b/native/cocos/base/memory/JeAlloc.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_JE_ALLOC_H_ #define CC_JE_ALLOC_H_ diff --git a/native/cocos/base/memory/MemDef.h b/native/cocos/base/memory/MemDef.h index 6d32458b6e..d0b03567be 100755 --- a/native/cocos/base/memory/MemDef.h +++ b/native/cocos/base/memory/MemDef.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_MEM_DEF_H_ #define CC_MEM_DEF_H_ diff --git a/native/cocos/base/memory/MemTracker.cpp b/native/cocos/base/memory/MemTracker.cpp index b04d3099cf..d70ac9aa02 100755 --- a/native/cocos/base/memory/MemTracker.cpp +++ b/native/cocos/base/memory/MemTracker.cpp @@ -1,4 +1,29 @@ -#include "CoreStd.h" +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" #include "MemTracker.h" #include "../StringUtil.h" @@ -60,7 +85,7 @@ static int HashNodeCompare(const void *arg, const void *obj) { static void HashNodeListAndFree(void *arg, void *obj) { AllocHashNode *node = (AllocHashNode *)obj; AllocListParam *param = (AllocListParam *)arg; - int len = StringUtil::Printf(param->buf, param->last, "%s(%u): {%u bytes} functions: %s\n", (node->filename ? node->filename : "(unknown source)"), + int len = StringUtil::printf(param->buf, param->last, "%s(%u): {%u bytes} functions: %s\n", (node->filename ? node->filename : "(unknown source)"), node->line, node->bytes, (node->function ? node->function : "")); param->buf += len; FreeHashNode(node); diff --git a/native/cocos/base/memory/MemTracker.h b/native/cocos/base/memory/MemTracker.h index aca94a0fdf..1d10d13d9c 100755 --- a/native/cocos/base/memory/MemTracker.h +++ b/native/cocos/base/memory/MemTracker.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_CORE_MEM_TRACKER_H_ #define CC_CORE_MEM_TRACKER_H_ diff --git a/native/cocos/base/memory/Memory.cpp b/native/cocos/base/memory/Memory.cpp index 97d2660a24..d5cafdbe3d 100755 --- a/native/cocos/base/memory/Memory.cpp +++ b/native/cocos/base/memory/Memory.cpp @@ -1,4 +1,30 @@ -#include "CoreStd.h" +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + #include "Memory.h" #include "StlAlloc.h" diff --git a/native/cocos/base/memory/Memory.h b/native/cocos/base/memory/Memory.h index b0f7b0fd86..e5807e785e 100755 --- a/native/cocos/base/memory/Memory.h +++ b/native/cocos/base/memory/Memory.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "AllocatedObj.h" diff --git a/native/cocos/base/memory/NedPooling.cpp b/native/cocos/base/memory/NedPooling.cpp index 73e0953526..448d0be966 100755 --- a/native/cocos/base/memory/NedPooling.cpp +++ b/native/cocos/base/memory/NedPooling.cpp @@ -1,4 +1,29 @@ -#include "CoreStd.h" +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" #include "NedPooling.h" #include "MemTracker.h" diff --git a/native/cocos/base/memory/NedPooling.h b/native/cocos/base/memory/NedPooling.h index 0693b6e9a7..2acb4f3a11 100755 --- a/native/cocos/base/memory/NedPooling.h +++ b/native/cocos/base/memory/NedPooling.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_CORE_NED_POOLING_H_ #define CC_CORE_NED_POOLING_H_ diff --git a/native/cocos/base/memory/StdAlloc.h b/native/cocos/base/memory/StdAlloc.h index 7e342a0a22..184582779e 100755 --- a/native/cocos/base/memory/StdAlloc.h +++ b/native/cocos/base/memory/StdAlloc.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_CORE_STD_ALLOC_H_ #define CC_CORE_STD_ALLOC_H_ diff --git a/native/cocos/base/memory/StlAlloc.h b/native/cocos/base/memory/StlAlloc.h index b5ca8ef221..8553c85bd7 100755 --- a/native/cocos/base/memory/StlAlloc.h +++ b/native/cocos/base/memory/StlAlloc.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_CORE_STL_ALLOC_H_ #define CC_CORE_STL_ALLOC_H_ @@ -239,7 +264,7 @@ template ::type, typename P = std::l using priority_queue = std::priority_queue; template > -using dequeue = std::deque; +using deque = std::deque; template , typename A = SA> using set = std::set; @@ -269,7 +294,7 @@ template ::type, typename P = std::l using priority_queue = std::priority_queue; template -using dequeue = std::deque; +using deque = std::deque; template > using set = std::set; diff --git a/native/cocos/base/threading/ConditionVariable.cpp b/native/cocos/base/threading/ConditionVariable.cpp new file mode 100644 index 0000000000..d77b1ed1ef --- /dev/null +++ b/native/cocos/base/threading/ConditionVariable.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "ConditionVariable.h" + +namespace cc { + +void ConditionVariable::wait() noexcept { + std::unique_lock lock(_mutex); + _condVar.wait(lock); +} + +void ConditionVariable::signal() noexcept { + std::lock_guard lock(_mutex); + _condVar.notify_one(); +} + +void ConditionVariable::SignalAll() noexcept { + std::lock_guard lock(_mutex); + _condVar.notify_all(); +} + +} // namespace cc diff --git a/native/cocos/base/threading/ConditionVariable.h b/native/cocos/base/threading/ConditionVariable.h new file mode 100644 index 0000000000..15ed23c82d --- /dev/null +++ b/native/cocos/base/threading/ConditionVariable.h @@ -0,0 +1,54 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include +#include + +namespace cc { + +class ConditionVariable final { +public: + void wait() noexcept; + template + void wait(Function func, Args &&... args) noexcept; + void signal() noexcept; + void SignalAll() noexcept; + +private: + std::mutex _mutex; + std::condition_variable _condVar; +}; + +// DO NOT MANIPULATE ANY SYCHRONIZATION PRIMITIVES INSIDE THE CALLBACK +template +void ConditionVariable::wait(Function func, Args &&... args) noexcept { + std::unique_lock lock(_mutex); + _condVar.wait(lock, std::bind(std::forward(func), std::forward(args)...)); +} + +} // namespace cc diff --git a/native/cocos/base/threading/Event.h b/native/cocos/base/threading/Event.h new file mode 100644 index 0000000000..c77ebeb524 --- /dev/null +++ b/native/cocos/base/threading/Event.h @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "ConditionVariable.h" +#include "Semaphore.h" + +namespace cc { + +template +class Event final { +public: + inline void wait() noexcept { _syncObject.wait(); } + inline void signal() noexcept { _syncObject.signal(); }; + inline void signalAll() noexcept { _syncObject.signalAll(); } + +private: + T _syncObject{}; +}; + +using EventCV = Event; +using EventSem = Event; + +} // namespace cc diff --git a/native/cocos/base/threading/MessageQueue.cpp b/native/cocos/base/threading/MessageQueue.cpp new file mode 100644 index 0000000000..dce0ab17fc --- /dev/null +++ b/native/cocos/base/threading/MessageQueue.cpp @@ -0,0 +1,301 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "MessageQueue.h" +#include + +namespace cc { + +namespace { +uint32_t constexpr MEMORY_CHUNK_SIZE = 4096 * 16; +uint32_t constexpr MEMORY_CHUNK_POOL_CAPACITY = 64; +uint32_t constexpr SWITCH_CHUNK_MEMORY_REQUIREMENT = sizeof(MemoryChunkSwitchMessage) + sizeof(DummyMessage); +} // namespace + +MessageQueue::MemoryAllocator &MessageQueue::MemoryAllocator::getInstance() noexcept { + static MessageQueue::MemoryAllocator instance; + return instance; +} + +uint8_t *MessageQueue::MemoryAllocator::request() noexcept { + uint8_t *newChunk = nullptr; + + if (_chunkPool.try_dequeue(newChunk)) { + _chunkCount.fetch_sub(1, std::memory_order_acq_rel); + } else { + newChunk = memoryAllocateForMultiThread(MEMORY_CHUNK_SIZE); + } + + return newChunk; +} + +void MessageQueue::MemoryAllocator::recycle(uint8_t *const chunk, bool const freeByUser) noexcept { + if (freeByUser) { + _chunkFreeQueue.enqueue(chunk); + } else { + free(chunk); + } +} + +void MessageQueue::MemoryAllocator::freeByUser(MessageQueue *const mainMessageQueue) noexcept { + auto queue = &_chunkFreeQueue; + + ENQUEUE_MESSAGE_1( + mainMessageQueue, FreeChunksInFreeQueue, + queue, queue, + { + uint8_t *chunk = nullptr; + + while (queue->try_dequeue(chunk)) { + MessageQueue::MemoryAllocator::getInstance().free(chunk); + } + }); + + mainMessageQueue->kick(); +} + +void MessageQueue::MemoryAllocator::free(uint8_t *const chunk) noexcept { + if (_chunkCount.load(std::memory_order_acquire) >= MEMORY_CHUNK_POOL_CAPACITY) { + memoryFreeForMultiThread(chunk); + } else { + _chunkPool.enqueue(chunk); + _chunkCount.fetch_add(1, std::memory_order_acq_rel); + } +} + +MessageQueue::MessageQueue() { + uint8_t *const chunk = MemoryAllocator::getInstance().request(); + + _writer.currentMemoryChunk = chunk; + _reader.currentMemoryChunk = chunk; + + // sentinel node will not be executed + Message *const msg = allocate(1); + pushMessages(); + pullMessages(); + _reader.lastMessage = msg; + --_reader.newMessageCount; +} + +void MessageQueue::kick() noexcept { + pushMessages(); + _event.signal(); +} + +void MessageQueue::kickAndWait() noexcept { + EventSem event; + EventSem *const pEvent = &event; + + ENQUEUE_MESSAGE_1(this, WaitUntilFinish, + pEvent, pEvent, + { + pEvent->signal(); + }); + + kick(); + event.wait(); +} + +void MessageQueue::runConsumerThread() noexcept { + if (_immediateMode || _workerAttached) return; + + _reader.terminateConsumerThread = false; + _reader.flushingFinished = false; + + std::thread consumerThread(&MessageQueue::consumerThreadLoop, this); + consumerThread.detach(); + _workerAttached = true; +} + +void MessageQueue::terminateConsumerThread() noexcept { + if (_immediateMode || !_workerAttached) return; + + EventSem event; + EventSem *const pEvent = &event; + + ReaderContext *const pR = &_reader; + + new (allocate(1)) TerminateConsumerThreadMessage(pEvent, pR); + + kick(); + event.wait(); +} + +void MessageQueue::finishWriting(bool wait) noexcept { + if (!_immediateMode) { + bool *const flushingFinished = &_reader.flushingFinished; + + ENQUEUE_MESSAGE_1(this, finishWriting, + flushingFinished, flushingFinished, + { + *flushingFinished = true; + }); + + if (wait) { + kickAndWait(); + } else { + kick(); + } + } +} + +void MessageQueue::recycleMemoryChunk(uint8_t *const chunk) const noexcept { + MessageQueue::MemoryAllocator::getInstance().recycle(chunk, _freeChunksByUser); +} + +void MessageQueue::freeChunksInFreeQueue(MessageQueue *const mainMessageQueue) noexcept { + MessageQueue::MemoryAllocator::getInstance().freeByUser(mainMessageQueue); +} + +uint8_t *MessageQueue::allocateImpl(uint32_t &allocatedSize, uint32_t const requestSize) noexcept { + uint32_t const alignedSize = align(requestSize, 16); + assert(alignedSize + SWITCH_CHUNK_MEMORY_REQUIREMENT <= MEMORY_CHUNK_SIZE); // exceeds the block size + + uint32_t const newOffset = _writer.offset + alignedSize; + + if (newOffset + SWITCH_CHUNK_MEMORY_REQUIREMENT <= MEMORY_CHUNK_SIZE) { + allocatedSize = alignedSize; + uint8_t *const allocatedMemory = _writer.currentMemoryChunk + _writer.offset; + _writer.offset = newOffset; + return allocatedMemory; + } else { + uint8_t *const newChunk = MessageQueue::MemoryAllocator::getInstance().request(); + MemoryChunkSwitchMessage *const switchMessage = reinterpret_cast(_writer.currentMemoryChunk + _writer.offset); + new (switchMessage) MemoryChunkSwitchMessage(this, newChunk, _writer.currentMemoryChunk); + switchMessage->_next = reinterpret_cast(newChunk); // point to start position + _writer.lastMessage = switchMessage; + ++_writer.pendingMessageCount; + _writer.currentMemoryChunk = newChunk; + _writer.offset = 0; + + DummyMessage *const head = allocate(1); + new (head) DummyMessage; + + if (_immediateMode) { + pushMessages(); + pullMessages(); + assert(_reader.newMessageCount == 2); + executeMessages(); + executeMessages(); + } + + return allocateImpl(allocatedSize, requestSize); + } +} + +void MessageQueue::pushMessages() noexcept { + _writer.writtenMessageCount.fetch_add(_writer.pendingMessageCount, std::memory_order_acq_rel); + _writer.pendingMessageCount = 0; +} + +void MessageQueue::pullMessages() noexcept { + uint32_t const writtenMessageCountNew = _writer.writtenMessageCount.load(std::memory_order_acquire); + _reader.newMessageCount += writtenMessageCountNew - _reader.writtenMessageCountSnap; + _reader.writtenMessageCountSnap = writtenMessageCountNew; +} + +void MessageQueue::flushMessages() noexcept { + while (!_reader.flushingFinished) { + executeMessages(); + } + + _reader.flushingFinished = false; +} + +void MessageQueue::executeMessages() noexcept { + Message *const msg = readMessage(); + + if (!msg) { + return; + } + + msg->execute(); + msg->~Message(); +} + +Message *MessageQueue::readMessage() noexcept { + while (!hasNewMessage()) { // if empty + pullMessages(); // try pulling data from consumer + + if (!hasNewMessage()) { // still empty + _event.wait(); // wait for the producer to wake me up + pullMessages(); // pulling again + } + } + + Message *const msg = _reader.lastMessage->getNext(); + _reader.lastMessage = msg; + --_reader.newMessageCount; + assert(msg); + return msg; +} + +void MessageQueue::consumerThreadLoop() noexcept { + while (!_reader.terminateConsumerThread) { + flushMessages(); + } + + _workerAttached = false; +} + +char const *DummyMessage::getName() const noexcept { + return "Dummy"; +} + +MemoryChunkSwitchMessage::MemoryChunkSwitchMessage(MessageQueue *const queue, uint8_t *const newChunk, uint8_t *const oldChunk) noexcept +: _messageQueue(queue), + _newChunk(newChunk), + _oldChunk(oldChunk) { +} + +MemoryChunkSwitchMessage::~MemoryChunkSwitchMessage() { + _messageQueue->recycleMemoryChunk(_oldChunk); +} + +void MemoryChunkSwitchMessage::execute() noexcept { + _messageQueue->_reader.currentMemoryChunk = _newChunk; + _messageQueue->pullMessages(); +} + +char const *MemoryChunkSwitchMessage::getName() const noexcept { + return "MemoryChunkSwitch"; +} + +TerminateConsumerThreadMessage::TerminateConsumerThreadMessage(EventSem *const pEvent, ReaderContext *const pR) noexcept +: _event(pEvent), + _reader(pR) { +} + +void TerminateConsumerThreadMessage::execute() noexcept { + _reader->terminateConsumerThread = true; + _reader->flushingFinished = true; + _event->signal(); +} + +char const *TerminateConsumerThreadMessage::getName() const noexcept { + return "TerminateConsumerThread"; +} + +} // namespace cc diff --git a/native/cocos/base/threading/MessageQueue.h b/native/cocos/base/threading/MessageQueue.h new file mode 100644 index 0000000000..5c4725b49f --- /dev/null +++ b/native/cocos/base/threading/MessageQueue.h @@ -0,0 +1,723 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Event.h" +#include "concurrentqueue/concurrentqueue.h" +#include + +namespace cc { + +// TODO: thread-specific allocators +template +inline T *memoryAllocateForMultiThread(uint32_t const count) noexcept { + return static_cast(malloc(sizeof(T) * count)); +} + +template +inline void memoryFreeForMultiThread(T *const p) noexcept { + free(p); +} + +inline uint32_t constexpr align(uint32_t const val, uint32_t const alignment) noexcept { + return (val + alignment - 1) & ~(alignment - 1); +} + +class Message { +public: + Message() = default; + virtual ~Message() {} + Message(Message const &) = delete; + Message(Message &&) = delete; + Message &operator=(Message const &) = delete; + Message &operator=(Message &&) = delete; + + virtual void execute() noexcept = 0; + virtual char const *getName() const noexcept = 0; + inline Message * getNext() const noexcept { return _next; } + +private: + Message *_next; + + friend class MessageQueue; +}; + +struct alignas(64) WriterContext final { + uint8_t * currentMemoryChunk{nullptr}; + Message * lastMessage{nullptr}; + uint32_t offset{0}; + uint32_t pendingMessageCount{0}; + std::atomic writtenMessageCount{0}; +}; + +struct alignas(64) ReaderContext final { + uint8_t *currentMemoryChunk{nullptr}; + Message *lastMessage{nullptr}; + uint32_t offset{0}; + uint32_t writtenMessageCountSnap{0}; + uint32_t newMessageCount{0}; + bool terminateConsumerThread{false}; + bool flushingFinished{false}; +}; + +// A single-producer single-consumer circular buffer queue. +// Both the messages and their submitting data should be allocated from here. +class alignas(64) MessageQueue final { +public: + MessageQueue(); + ~MessageQueue() = default; + MessageQueue(MessageQueue const &) = delete; + MessageQueue(MessageQueue &&) = delete; + MessageQueue &operator=(MessageQueue const &) = delete; + MessageQueue &operator=(MessageQueue &&) = delete; + + // message allocation + template + std::enable_if_t::value, T *> + allocate(uint32_t const count) noexcept; + + // general-purpose allocation + template + std::enable_if_t::value, T *> + allocate(uint32_t const count) noexcept; + template + T *allocateAndCopy(uint32_t const count, void const *data) noexcept; + template + T *allocateAndZero(uint32_t const count) noexcept; + + // notify the consumer to start working + void kick() noexcept; + + // notify the consumer to start working and block the producer until finished + void kickAndWait() noexcept; + + void runConsumerThread() noexcept; + void terminateConsumerThread() noexcept; + void finishWriting(bool wait) noexcept; + void flushMessages() noexcept; + + inline bool isImmediateMode() const noexcept { return _immediateMode; } + inline void finishWriting() noexcept { finishWriting(false); } + + void recycleMemoryChunk(uint8_t *const chunk) const noexcept; + static void freeChunksInFreeQueue(MessageQueue *const mainMessagesQueue) noexcept; + + inline void setImmediateMode(bool immediateMode) noexcept { _immediateMode = immediateMode; } + inline int getPendingMessageCount() const noexcept { return _writer.pendingMessageCount; } + inline int getWrittenMessageCount() const noexcept { return _writer.writtenMessageCount; } + inline int getNewMessageCount() const noexcept { return _reader.newMessageCount; } + +private: + class alignas(64) MemoryAllocator final { + public: + MemoryAllocator() = default; + ~MemoryAllocator() = default; + MemoryAllocator(MemoryAllocator const &) = delete; + MemoryAllocator(MemoryAllocator &&) = delete; + MemoryAllocator &operator=(MemoryAllocator const &) = delete; + MemoryAllocator &operator=(MemoryAllocator &&) = delete; + + static MemoryAllocator &getInstance() noexcept; + uint8_t * request() noexcept; + void recycle(uint8_t *const chunk, bool const freeByUser) noexcept; + void freeByUser(MessageQueue *const mainMessageQueue) noexcept; + + private: + using ChunkQueue = moodycamel::ConcurrentQueue; + + void free(uint8_t *const chunk) noexcept; + std::atomic _chunkCount{0}; + ChunkQueue _chunkPool{}; + ChunkQueue _chunkFreeQueue{}; + }; + + uint8_t *allocateImpl(uint32_t &allocatedSize, uint32_t const requestSize) noexcept; + void pushMessages() noexcept; + + // consumer thread specifics + void pullMessages() noexcept; + void executeMessages() noexcept; + Message * readMessage() noexcept; + inline bool hasNewMessage() const noexcept { return _reader.newMessageCount > 0 && !_reader.flushingFinished; } + void consumerThreadLoop() noexcept; + + WriterContext _writer; + ReaderContext _reader; + EventCV _event; + bool _immediateMode{true}; + bool _workerAttached{false}; + bool _freeChunksByUser{true}; // recycled chunks will be stashed until explicit free instruction + + friend class MemoryChunkSwitchMessage; +}; + +class DummyMessage final : public Message { +public: + virtual void execute() noexcept override {} + virtual char const *getName() const noexcept override; +}; + +class MemoryChunkSwitchMessage final : public Message { +public: + MemoryChunkSwitchMessage(MessageQueue *const cb, uint8_t *const newChunk, uint8_t *const oldChunk) noexcept; + ~MemoryChunkSwitchMessage(); + + virtual void execute() noexcept override; + virtual char const *getName() const noexcept override; + +private: + MessageQueue *_messageQueue{nullptr}; + uint8_t * _newChunk{nullptr}; + uint8_t * _oldChunk{nullptr}; +}; + +class TerminateConsumerThreadMessage final : public Message { +public: + TerminateConsumerThreadMessage(EventSem *const pEvent, ReaderContext *const pR) noexcept; + + virtual void execute() noexcept override; + virtual char const *getName() const noexcept override; + +private: + EventSem * _event{nullptr}; + ReaderContext *_reader{nullptr}; +}; + +template +std::enable_if_t::value, T *> +MessageQueue::allocate(uint32_t const count) noexcept { + uint32_t allocatedSize = 0; + T *const msg = reinterpret_cast(allocateImpl(allocatedSize, sizeof(T))); + msg->_next = reinterpret_cast(_writer.currentMemoryChunk + _writer.offset); + ++_writer.pendingMessageCount; + _writer.lastMessage = msg; + return msg; +} + +template +std::enable_if_t::value, T *> +MessageQueue::allocate(uint32_t const count) noexcept { + uint32_t const requestSize = sizeof(T) * count; + assert(requestSize); + uint32_t allocatedSize = 0; + uint8_t *const allocatedMemory = allocateImpl(allocatedSize, requestSize); + _writer.lastMessage->_next = reinterpret_cast(_writer.currentMemoryChunk + _writer.offset); + return reinterpret_cast(allocatedMemory); +} + +template +T *MessageQueue::allocateAndCopy(uint32_t const count, void const *data) noexcept { + T *const allocatedMemory = allocate(count); + memcpy(allocatedMemory, data, sizeof(T) * count); + return allocatedMemory; +} + +template +T *MessageQueue::allocateAndZero(uint32_t const count) noexcept { + T *const allocatedMemory = allocate(count); + memset(allocatedMemory, 0, sizeof(T) * count); + return allocatedMemory; +} + +// utility macros for the producer thread to enqueue messages + +#define WRITE_MESSAGE(queue, MessageName, Params) \ + { \ + if (!queue->isImmediateMode()) { \ + new (queue->allocate(1)) MessageName Params; \ + } else { \ + MessageName msg Params; \ + msg.execute(); \ + } \ + } + +#define ENQUEUE_MESSAGE_0(queue, MessageName, Code) \ + { \ + class MessageName final : public Message { \ + public: \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + }; \ + WRITE_MESSAGE(queue, MessageName, ); \ + } + +#define ENQUEUE_MESSAGE_1(queue, MessageName, \ + Param1, Value1, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + \ + class MessageName final : public Message { \ + public: \ + explicit MessageName(Type1 const &In##Param1) \ + : Param1(In##Param1) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + }; \ + WRITE_MESSAGE(queue, MessageName, (Value1)) \ + } + +#define ENQUEUE_MESSAGE_2(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + \ + class MessageName final : public Message { \ + public: \ + MessageName( \ + Type1 const &In##Param1, Type2 const &In##Param2) \ + : Param1(In##Param1), \ + Param2(In##Param2) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + }; \ + WRITE_MESSAGE(queue, MessageName, (Value1, Value2)) \ + } + +#define ENQUEUE_MESSAGE_3(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + \ + class MessageName final : public Message { \ + public: \ + MessageName( \ + Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3)) \ + } + +#define ENQUEUE_MESSAGE_4(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Param4, Value4, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + using Type4 = std::decay::type; \ + \ + class MessageName : public Message { \ + public: \ + MessageName( \ + Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3, \ + Type4 const &In##Param4) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3), \ + Param4(In##Param4) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + Type4 Param4; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3, \ + Value4)) \ + } + +#define ENQUEUE_MESSAGE_5(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Param4, Value4, \ + Param5, Value5, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + using Type4 = std::decay::type; \ + using Type5 = std::decay::type; \ + \ + class MessageName : public Message { \ + public: \ + MessageName( \ + Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3, \ + Type4 const &In##Param4, \ + Type5 const &In##Param5) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3), \ + Param4(In##Param4), \ + Param5(In##Param5) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + Type4 Param4; \ + Type5 Param5; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3, \ + Value4, \ + Value5)) \ + } + +#define ENQUEUE_MESSAGE_6(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Param4, Value4, \ + Param5, Value5, \ + Param6, Value6, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + using Type4 = std::decay::type; \ + using Type5 = std::decay::type; \ + using Type6 = std::decay::type; \ + \ + class MessageName : public Message { \ + public: \ + MessageName( \ + Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3, \ + Type4 const &In##Param4, \ + Type5 const &In##Param5, \ + Type6 const &In##Param6) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3), \ + Param4(In##Param4), \ + Param5(In##Param5), \ + Param6(In##Param6) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + Type4 Param4; \ + Type5 Param5; \ + Type6 Param6; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3, \ + Value4, \ + Value5, \ + Value6)) \ + } + +#define ENQUEUE_MESSAGE_7(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Param4, Value4, \ + Param5, Value5, \ + Param6, Value6, \ + Param7, Value7, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + using Type4 = std::decay::type; \ + using Type5 = std::decay::type; \ + using Type6 = std::decay::type; \ + using Type7 = std::decay::type; \ + \ + class MessageName : public Message { \ + public: \ + MessageName( \ + Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3, \ + Type4 const &In##Param4, \ + Type5 const &In##Param5, \ + Type6 const &In##Param6, \ + Type7 const &In##Param7) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3), \ + Param4(In##Param4), \ + Param5(In##Param5), \ + Param6(In##Param6), \ + Param7(In##Param7) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual const char *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + Type4 Param4; \ + Type5 Param5; \ + Type6 Param6; \ + Type7 Param7; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3, \ + Value4, \ + Value5, \ + Value6, \ + Value7)) \ + } + +#define ENQUEUE_MESSAGE_8(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Param4, Value4, \ + Param5, Value5, \ + Param6, Value6, \ + Param7, Value7, \ + Param8, Value8, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + using Type4 = std::decay::type; \ + using Type5 = std::decay::type; \ + using Type6 = std::decay::type; \ + using Type7 = std::decay::type; \ + using Type8 = std::decay::type; \ + \ + class MessageName : public Message { \ + public: \ + MessageName(Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3, \ + Type4 const &In##Param4, \ + Type5 const &In##Param5, \ + Type6 const &In##Param6, \ + Type7 const &In##Param7, \ + Type8 const &In##Param8) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3), \ + Param4(In##Param4), \ + Param5(In##Param5), \ + Param6(In##Param6), \ + Param7(In##Param7), \ + Param8(In##Param8) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + Type4 Param4; \ + Type5 Param5; \ + Type6 Param6; \ + Type7 Param7; \ + Type8 Param8; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3, \ + Value4, \ + Value5, \ + Value6, \ + Value7, \ + Value8)) \ + } + +#define ENQUEUE_MESSAGE_9(queue, MessageName, \ + Param1, Value1, \ + Param2, Value2, \ + Param3, Value3, \ + Param4, Value4, \ + Param5, Value5, \ + Param6, Value6, \ + Param7, Value7, \ + Param8, Value8, \ + Param9, Value9, \ + Code) \ + { \ + \ + using Type1 = std::decay::type; \ + using Type2 = std::decay::type; \ + using Type3 = std::decay::type; \ + using Type4 = std::decay::type; \ + using Type5 = std::decay::type; \ + using Type6 = std::decay::type; \ + using Type7 = std::decay::type; \ + using Type8 = std::decay::type; \ + using Type9 = std::decay::type; \ + \ + class MessageName : public Message { \ + public: \ + MessageName(Type1 const &In##Param1, \ + Type2 const &In##Param2, \ + Type3 const &In##Param3, \ + Type4 const &In##Param4, \ + Type5 const &In##Param5, \ + Type6 const &In##Param6, \ + Type7 const &In##Param7, \ + Type8 const &In##Param8, \ + Type9 const &In##Param9) \ + : Param1(In##Param1), \ + Param2(In##Param2), \ + Param3(In##Param3), \ + Param4(In##Param4), \ + Param5(In##Param5), \ + Param6(In##Param6), \ + Param7(In##Param7), \ + Param8(In##Param8), \ + Param9(In##Param9) { \ + } \ + virtual void execute() noexcept override { \ + Code \ + } \ + virtual char const *getName() const noexcept override { \ + return (#MessageName); \ + } \ + \ + private: \ + Type1 Param1; \ + Type2 Param2; \ + Type3 Param3; \ + Type4 Param4; \ + Type5 Param5; \ + Type6 Param6; \ + Type7 Param7; \ + Type8 Param8; \ + Type9 Param9; \ + }; \ + WRITE_MESSAGE(queue, MessageName, \ + (Value1, \ + Value2, \ + Value3, \ + Value4, \ + Value5, \ + Value6, \ + Value7, \ + Value8, \ + Value9)) \ + } + +} // namespace cc diff --git a/native/cocos/base/threading/ReadWriteLock.h b/native/cocos/base/threading/ReadWriteLock.h new file mode 100644 index 0000000000..0576fe53f3 --- /dev/null +++ b/native/cocos/base/threading/ReadWriteLock.h @@ -0,0 +1,58 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include + +namespace cc { + +class ReadWriteLock final { +public: + ReadWriteLock() = default; + + template + auto lockRead(Function &&func, Args &&...args) noexcept -> decltype(func(std::forward(args)...)); + + template + auto lockWrite(Function &&func, Args &&...args) noexcept -> decltype(func(std::forward(args)...)); + +private: + std::shared_mutex _mutex; +}; + +template +auto ReadWriteLock::lockRead(Function &&func, Args &&...args) noexcept -> decltype(func(std::forward(args)...)) { + std::shared_lock lock(_mutex); + return func(std::forward(args)...); +} + +template +auto ReadWriteLock::lockWrite(Function &&func, Args &&...args) noexcept -> decltype(func(std::forward(args)...)) { + std::lock_guard lock(_mutex); + return func(std::forward(args)...); +} + +} // namespace cc diff --git a/native/cocos/base/threading/Semaphore.cpp b/native/cocos/base/threading/Semaphore.cpp new file mode 100644 index 0000000000..d8a990593d --- /dev/null +++ b/native/cocos/base/threading/Semaphore.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "Semaphore.h" + +namespace cc { + +Semaphore::Semaphore() noexcept +: _semaphore(0) { +} + +Semaphore::Semaphore(uint32_t const initialCount) noexcept +: _semaphore(initialCount) { +} + +void Semaphore::wait() noexcept { + _semaphore.wait(); +} + +void Semaphore::signal() noexcept { + _semaphore.signal(); +} + +} // namespace cc diff --git a/native/cocos/base/threading/Semaphore.h b/native/cocos/base/threading/Semaphore.h new file mode 100644 index 0000000000..7db2fa1738 --- /dev/null +++ b/native/cocos/base/threading/Semaphore.h @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "concurrentqueue/concurrentqueue.h" +#include "concurrentqueue/lightweightsemaphore.h" +#include + +namespace cc { + +class Semaphore final { +public: + Semaphore() noexcept; + explicit Semaphore(uint32_t const initialCount) noexcept; + + void wait() noexcept; + void signal() noexcept; + void signalAll() noexcept { assert(false); } + +private: + moodycamel::details::Semaphore _semaphore; +}; + +} // namespace cc diff --git a/native/cocos/base/threading/ThreadPool.cpp b/native/cocos/base/threading/ThreadPool.cpp new file mode 100644 index 0000000000..29a2a97221 --- /dev/null +++ b/native/cocos/base/threading/ThreadPool.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "ThreadPool.h" + +namespace cc { + +uint8_t const ThreadPool::CPU_CORE_COUNT = std::thread::hardware_concurrency(); +uint8_t const ThreadPool::MAX_THREAD_COUNT = CPU_CORE_COUNT - 1; + +void ThreadPool::start() noexcept { + if (_running) { + return; + } + + _running = true; + + for (uint8_t i = 0; i < MAX_THREAD_COUNT; ++i) { + addThread(); + } +} + +void ThreadPool::stop() noexcept { + if (!_running) { + return; + } + + _running = false; + _event.SignalAll(); + + for (auto &worker : _workers) { + if (worker.joinable()) { + worker.join(); + } + } + + _workers.clear(); +} + +void ThreadPool::addThread() noexcept { + assert(_workers.size() < MAX_THREAD_COUNT); + + auto workerLoop = [this]() { + while (_running) { + Task task = nullptr; + + if (_tasks.try_dequeue(task)) { + task(); + } else { + // Double Check + _event.wait([this]() { + return _tasks.size_approx() != 0; + }); + } + } + }; + + _workers.emplace_back(workerLoop); +} + +} // namespace cc diff --git a/native/cocos/base/threading/ThreadPool.h b/native/cocos/base/threading/ThreadPool.h new file mode 100644 index 0000000000..21d60c2c38 --- /dev/null +++ b/native/cocos/base/threading/ThreadPool.h @@ -0,0 +1,87 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Event.h" +#include "concurrentqueue/concurrentqueue.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cc { + +class ThreadPool final { +public: + using Task = std::function; + using TaskQueue = moodycamel::ConcurrentQueue; + + static uint8_t const CPU_CORE_COUNT; + static uint8_t const MAX_THREAD_COUNT; + + ThreadPool() = default; + ~ThreadPool() = default; + ThreadPool(ThreadPool const &) = delete; + ThreadPool(ThreadPool &&) = delete; + ThreadPool &operator=(ThreadPool const &) = delete; + ThreadPool &operator=(ThreadPool &&) = delete; + + template + auto dispatchTask(Function &&func, Args &&... args) noexcept -> std::future(args)...))>; + void start() noexcept; + void stop() noexcept; + +private: + using Event = ConditionVariable; + + void addThread() noexcept; + + TaskQueue _tasks{}; + std::list _workers{}; + Event _event{}; + std::atomic _running{false}; + uint8_t _workerCount{MAX_THREAD_COUNT}; +}; + +template +auto ThreadPool::dispatchTask(Function &&func, Args &&... args) noexcept -> std::future(args)...))> { + assert(_running); + + using ReturnType = decltype(func(std::forward(args)...)); + auto task = std::make_shared>(std::bind(std::forward(func), std::forward(args)...)); + bool const succeed = _tasks.enqueue([task]() { + (*task)(); + }); + assert(succeed); + _event.signal(); + return task->get_future(); +} + +} // namespace cc diff --git a/native/cocos/base/threading/ThreadSafeCounter.h b/native/cocos/base/threading/ThreadSafeCounter.h new file mode 100644 index 0000000000..40a4ab5ef9 --- /dev/null +++ b/native/cocos/base/threading/ThreadSafeCounter.h @@ -0,0 +1,48 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include + +namespace cc { + +template >> +class ThreadSafeCounter final { +public: + inline T increment() noexcept { return add(1); } + inline T add(T const v) noexcept { return _counter.fetch_add(v, std::memory_order_relaxed); } + inline T decrement() noexcept { return subtract(1); } + inline T subtract(T const v) noexcept { return _counter.fetch_sub(v, std::memory_order_relaxed); } + inline void set(T const v) noexcept { _counter.store(v, std::memory_order_relaxed); } + inline T get() const noexcept { return _counter.load(std::memory_order_relaxed); } + inline void reset() noexcept { set(0); } + +private: + std::atomic _counter{0}; +}; + +} // namespace cc diff --git a/native/cocos/base/threading/ThreadSafeLinearAllocator.cpp b/native/cocos/base/threading/ThreadSafeLinearAllocator.cpp new file mode 100644 index 0000000000..a367d771b9 --- /dev/null +++ b/native/cocos/base/threading/ThreadSafeLinearAllocator.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "ThreadSafeLinearAllocator.h" +#include "acl/core/memory_utils.h" + +namespace cc { + +ThreadSafeLinearAllocator::ThreadSafeLinearAllocator(uint32_t size) noexcept +: _capacity(size) { + _buffer = malloc(size); +} + +ThreadSafeLinearAllocator::~ThreadSafeLinearAllocator() { + free(_buffer); +} + +void *ThreadSafeLinearAllocator::allocate(size_t size, size_t alignment) noexcept { + if (size == 0) { + return nullptr; + } + + void * allocatedMemory = nullptr; + uint32_t oldUsedSize = 0; + uint64_t newUsedSize = 0; // using 64-bit integer to correctly detect overflows + + do { + oldUsedSize = getUsedSize(); + allocatedMemory = acl::align_to(acl::add_offset_to_ptr(_buffer, oldUsedSize), alignment); + newUsedSize = reinterpret_cast(allocatedMemory) - reinterpret_cast(_buffer) + size; + + if (newUsedSize > _capacity) { + return nullptr; // overflows + } + } while (!_usedSize.compare_exchange_weak(oldUsedSize, static_cast(newUsedSize), std::memory_order_relaxed, std::memory_order_relaxed)); // no ABA possible + + return allocatedMemory; +} + +} // namespace cc diff --git a/native/cocos/base/threading/ThreadSafeLinearAllocator.h b/native/cocos/base/threading/ThreadSafeLinearAllocator.h new file mode 100644 index 0000000000..ac89bbfb7f --- /dev/null +++ b/native/cocos/base/threading/ThreadSafeLinearAllocator.h @@ -0,0 +1,59 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include +#include + +namespace cc { + +class alignas(16) ThreadSafeLinearAllocator final { +public: + explicit ThreadSafeLinearAllocator(uint32_t size) noexcept; + ~ThreadSafeLinearAllocator(); + ThreadSafeLinearAllocator(ThreadSafeLinearAllocator const &) = delete; + ThreadSafeLinearAllocator(ThreadSafeLinearAllocator &&) = delete; + ThreadSafeLinearAllocator &operator=(ThreadSafeLinearAllocator const &) = delete; + ThreadSafeLinearAllocator &operator=(ThreadSafeLinearAllocator &&) = delete; + + void *allocate(size_t size, size_t alignment) noexcept; + + inline void * getBuffer() const noexcept { return _buffer; } + inline uint32_t getCapacity() const noexcept { return _capacity; } + inline uint32_t getUsedSize() const noexcept { return _usedSize.load(std::memory_order_relaxed); } + inline uint32_t getBalance() const noexcept { return getCapacity() - getUsedSize(); } + + inline void recycle() noexcept { _usedSize.store(0, std::memory_order_relaxed); } + +private: + void * _buffer{nullptr}; + uint32_t _capacity{0}; + std::atomic _usedSize{0}; + // 16 bytes +}; + +} // namespace cc diff --git a/native/cocos/base/uthash.h b/native/cocos/base/uthash.h deleted file mode 100644 index cebdf3e72f..0000000000 --- a/native/cocos/base/uthash.h +++ /dev/null @@ -1,969 +0,0 @@ -/* -Copyright (c) 2003-2013, Troy D. Hanson http://troydhanson.github.com/uthash/ -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. - -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. -*/ - -#ifndef UTHASH_H -#define UTHASH_H -/// @cond DO_NOT_SHOW - -#include /* memcmp,strlen */ -#include /* ptrdiff_t */ -#include /* exit() */ - -/* These macros use decltype or the earlier __typeof GNU extension. - As decltype is only available in newer compilers (VS2010 or gcc 4.3+ - when compiling c++ source) this code uses whatever method is needed - or, for VS2008 where neither is available, uses casting workarounds. */ -#ifdef _MSC_VER /* MS compiler */ - #if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ - #define DECLTYPE(x) (decltype(x)) - #else /* VS2008 or older (or VS2010 in C mode) */ - #define NO_DECLTYPE - #define DECLTYPE(x) - #endif -#else /* GNU, Sun and other compilers */ - #define DECLTYPE(x) (__typeof(x)) -#endif - -#ifdef NO_DECLTYPE - #define DECLTYPE_ASSIGN(dst, src) \ - do { \ - char **_da_dst = (char **)(&(dst)); \ - *_da_dst = (char *)(src); \ - } while (0) -#else - #define DECLTYPE_ASSIGN(dst, src) \ - do { \ - (dst) = DECLTYPE(dst)(src); \ - } while (0) -#endif - -/* a number of the hash function use uint32_t which isn't defined on win32 */ -#ifdef _MSC_VER -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#else - #include /* uint32_t */ -#endif - -#define UTHASH_VERSION 1.9.8 - -#ifndef uthash_fatal - #define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */ -#endif -#ifndef uthash_malloc - #define uthash_malloc(sz) malloc(sz) /* malloc fcn */ -#endif -#ifndef uthash_free - #define uthash_free(ptr, sz) free(ptr) /* free fcn */ -#endif - -#ifndef uthash_noexpand_fyi - #define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ -#endif -#ifndef uthash_expand_fyi - #define uthash_expand_fyi(tbl) /* can be defined to log expands */ -#endif - -/* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS 32 /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS_LOG2 5 /* lg2 of initial number of buckets */ -#define HASH_BKT_CAPACITY_THRESH 10 /* expand when bucket count reaches */ - -/* calculate the element whose hash handle address is hhe */ -#define ELMT_FROM_HH(tbl, hhp) ((void *)(((char *)(hhp)) - ((tbl)->hho))) - -#define HASH_FIND(hh, head, keyptr, keylen, out) \ - do { \ - unsigned _hf_bkt, _hf_hashv; \ - out = NULL; \ - if (head) { \ - HASH_FCN(keyptr, keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \ - if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) { \ - HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[_hf_bkt], \ - keyptr, keylen, out); \ - } \ - } \ - } while (0) - -#ifdef HASH_BLOOM - #define HASH_BLOOM_BITLEN (1ULL << HASH_BLOOM) - #define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN / 8) + ((HASH_BLOOM_BITLEN % 8) ? 1 : 0) - #define HASH_BLOOM_MAKE(tbl) \ - do { \ - (tbl)->bloom_nbits = HASH_BLOOM; \ - (tbl)->bloom_bv = (uint8_t *)uthash_malloc(HASH_BLOOM_BYTELEN); \ - if (!((tbl)->bloom_bv)) { \ - uthash_fatal("out of memory"); \ - } \ - memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \ - (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ - } while (0) - - #define HASH_BLOOM_FREE(tbl) \ - do { \ - uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ - } while (0) - - #define HASH_BLOOM_BITSET(bv, idx) (bv[(idx) / 8] |= (1U << ((idx) % 8))) - #define HASH_BLOOM_BITTEST(bv, idx) (bv[(idx) / 8] & (1U << ((idx) % 8))) - - #define HASH_BLOOM_ADD(tbl, hashv) \ - HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1))) - - #define HASH_BLOOM_TEST(tbl, hashv) \ - HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1))) - -#else - #define HASH_BLOOM_MAKE(tbl) - #define HASH_BLOOM_FREE(tbl) - #define HASH_BLOOM_ADD(tbl, hashv) - #define HASH_BLOOM_TEST(tbl, hashv) (1) - #define HASH_BLOOM_BYTELEN 0 -#endif - -#define HASH_MAKE_TABLE(hh, head) \ - do { \ - (head)->hh.tbl = (UT_hash_table *)uthash_malloc( \ - sizeof(UT_hash_table)); \ - if (!((head)->hh.tbl)) { \ - uthash_fatal("out of memory"); \ - } \ - memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \ - (head)->hh.tbl->tail = &((head)->hh); \ - (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ - (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ - (head)->hh.tbl->hho = (char *)(&(head)->hh) - (char *)(head); \ - (head)->hh.tbl->buckets = (UT_hash_bucket *)uthash_malloc( \ - HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ - if (!(head)->hh.tbl->buckets) { \ - uthash_fatal("out of memory"); \ - } \ - memset((head)->hh.tbl->buckets, 0, \ - HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ - HASH_BLOOM_MAKE((head)->hh.tbl); \ - (head)->hh.tbl->signature = HASH_SIGNATURE; \ - } while (0) - -#define HASH_ADD(hh, head, fieldname, keylen_in, add) \ - HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add) - -#define HASH_REPLACE(hh, head, fieldname, keylen_in, add, replaced) \ - do { \ - replaced = NULL; \ - HASH_FIND(hh, head, &((add)->fieldname), keylen_in, replaced); \ - if (replaced != NULL) { \ - HASH_DELETE(hh, head, replaced); \ - }; \ - HASH_ADD(hh, head, fieldname, keylen_in, add); \ - } while (0) - -#define HASH_ADD_KEYPTR(hh, head, keyptr, keylen_in, add) \ - do { \ - unsigned _ha_bkt; \ - (add)->hh.next = NULL; \ - (add)->hh.key = (char *)keyptr; \ - (add)->hh.keylen = (unsigned)keylen_in; \ - if (!(head)) { \ - head = (add); \ - (head)->hh.prev = NULL; \ - HASH_MAKE_TABLE(hh, head); \ - } else { \ - (head)->hh.tbl->tail->next = (add); \ - (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ - (head)->hh.tbl->tail = &((add)->hh); \ - } \ - (head)->hh.tbl->num_items++; \ - (add)->hh.tbl = (head)->hh.tbl; \ - HASH_FCN(keyptr, keylen_in, (head)->hh.tbl->num_buckets, \ - (add)->hh.hashv, _ha_bkt); \ - HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], &(add)->hh); \ - HASH_BLOOM_ADD((head)->hh.tbl, (add)->hh.hashv); \ - HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ - HASH_FSCK(hh, head); \ - } while (0) - -#define HASH_TO_BKT(hashv, num_bkts, bkt) \ - do { \ - bkt = ((hashv) & ((num_bkts)-1)); \ - } while (0) - -/* delete "delptr" from the hash table. - * "the usual" patch-up process for the app-order doubly-linked-list. - * The use of _hd_hh_del below deserves special explanation. - * These used to be expressed using (delptr) but that led to a bug - * if someone used the same symbol for the head and deletee, like - * HASH_DELETE(hh,users,users); - * We want that to work, but by changing the head (users) below - * we were forfeiting our ability to further refer to the deletee (users) - * in the patch-up process. Solution: use scratch space to - * copy the deletee pointer, then the latter references are via that - * scratch pointer rather than through the repointed (users) symbol. - */ -#define HASH_DELETE(hh, head, delptr) \ - do { \ - unsigned _hd_bkt; \ - struct UT_hash_handle *_hd_hh_del; \ - if (((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL)) { \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - head = NULL; \ - } else { \ - _hd_hh_del = &((delptr)->hh); \ - if ((delptr) == ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail)) { \ - (head)->hh.tbl->tail = \ - (UT_hash_handle *)((ptrdiff_t)((delptr)->hh.prev) + \ - (head)->hh.tbl->hho); \ - } \ - if ((delptr)->hh.prev) { \ - ((UT_hash_handle *)((ptrdiff_t)((delptr)->hh.prev) + \ - (head)->hh.tbl->hho)) \ - ->next = (delptr)->hh.next; \ - } else { \ - DECLTYPE_ASSIGN(head, (delptr)->hh.next); \ - } \ - if (_hd_hh_del->next) { \ - ((UT_hash_handle *)((ptrdiff_t)_hd_hh_del->next + \ - (head)->hh.tbl->hho)) \ - ->prev = \ - _hd_hh_del->prev; \ - } \ - HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ - HASH_DEL_IN_BKT(hh, (head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ - (head)->hh.tbl->num_items--; \ - } \ - HASH_FSCK(hh, head); \ - } while (0) - -/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ -#define HASH_FIND_STR(head, findstr, out) \ - HASH_FIND(hh, head, findstr, strlen(findstr), out) -#define HASH_ADD_STR(head, strfield, add) \ - HASH_ADD(hh, head, strfield, strlen(add->strfield), add) -#define HASH_REPLACE_STR(head, strfield, add, replaced) \ - HASH_REPLACE(hh, head, strfield, strlen(add->strfield), add, replaced) -#define HASH_FIND_INT(head, findint, out) \ - HASH_FIND(hh, head, findint, sizeof(int), out) -#define HASH_ADD_INT(head, intfield, add) \ - HASH_ADD(hh, head, intfield, sizeof(int), add) -#define HASH_REPLACE_INT(head, intfield, add, replaced) \ - HASH_REPLACE(hh, head, intfield, sizeof(int), add, replaced) -#define HASH_FIND_PTR(head, findptr, out) \ - HASH_FIND(hh, head, findptr, sizeof(void *), out) -#define HASH_ADD_PTR(head, ptrfield, add) \ - HASH_ADD(hh, head, ptrfield, sizeof(void *), add) -#define HASH_REPLACE_PTR(head, ptrfield, add) \ - HASH_REPLACE(hh, head, ptrfield, sizeof(void *), add, replaced) -#define HASH_DEL(head, delptr) \ - HASH_DELETE(hh, head, delptr) - -/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. - * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. - */ -#ifdef HASH_DEBUG - #define HASH_OOPS(...) \ - do { \ - fprintf(stderr, __VA_ARGS__); \ - exit(-1); \ - } while (0) - #define HASH_FSCK(hh, head) \ - do { \ - unsigned _bkt_i; \ - unsigned _count, _bkt_count; \ - char *_prev; \ - struct UT_hash_handle *_thh; \ - if (head) { \ - _count = 0; \ - for (_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \ - _bkt_count = 0; \ - _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ - _prev = NULL; \ - while (_thh) { \ - if (_prev != (char *)(_thh->hh_prev)) { \ - HASH_OOPS("invalid hh_prev %p, actual %p\n", \ - _thh->hh_prev, _prev); \ - } \ - _bkt_count++; \ - _prev = (char *)(_thh); \ - _thh = _thh->hh_next; \ - } \ - _count += _bkt_count; \ - if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ - HASH_OOPS("invalid bucket count %d, actual %d\n", \ - (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ - } \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("invalid hh item count %d, actual %d\n", \ - (head)->hh.tbl->num_items, _count); \ - } \ - /* traverse hh in app order; check next/prev integrity, count */ \ - _count = 0; \ - _prev = NULL; \ - _thh = &(head)->hh; \ - while (_thh) { \ - _count++; \ - if (_prev != (char *)(_thh->prev)) { \ - HASH_OOPS("invalid prev %p, actual %p\n", \ - _thh->prev, _prev); \ - } \ - _prev = (char *)ELMT_FROM_HH((head)->hh.tbl, _thh); \ - _thh = (_thh->next ? (UT_hash_handle *)((char *)(_thh->next) + \ - (head)->hh.tbl->hho) \ - : NULL); \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("invalid app item count %d, actual %d\n", \ - (head)->hh.tbl->num_items, _count); \ - } \ - } \ - } while (0) -#else - #define HASH_FSCK(hh, head) -#endif - -/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to - * the descriptor to which this macro is defined for tuning the hash function. - * The app can #include to get the prototype for write(2). */ -#ifdef HASH_EMIT_KEYS - #define HASH_EMIT_KEY(hh, head, keyptr, fieldlen) \ - do { \ - unsigned _klen = fieldlen; \ - write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ - write(HASH_EMIT_KEYS, keyptr, fieldlen); \ - } while (0) -#else - #define HASH_EMIT_KEY(hh, head, keyptr, fieldlen) -#endif - -/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ -#ifdef HASH_FUNCTION - #define HASH_FCN HASH_FUNCTION -#else - #define HASH_FCN HASH_JEN -#endif - -/* The Bernstein hash function, used in Perl prior to v5.6 */ -#define HASH_BER(key, keylen, num_bkts, hashv, bkt) \ - do { \ - unsigned _hb_keylen = keylen; \ - char *_hb_key = (char *)(key); \ - (hashv) = 0; \ - while (_hb_keylen--) { \ - (hashv) = ((hashv)*33) + *_hb_key++; \ - } \ - bkt = (hashv) & (num_bkts - 1); \ - } while (0) - -/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at - * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ -#define HASH_SAX(key, keylen, num_bkts, hashv, bkt) \ - do { \ - unsigned _sx_i; \ - char *_hs_key = (char *)(key); \ - hashv = 0; \ - for (_sx_i = 0; _sx_i < keylen; _sx_i++) \ - hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ - bkt = hashv & (num_bkts - 1); \ - } while (0) - -#define HASH_FNV(key, keylen, num_bkts, hashv, bkt) \ - do { \ - unsigned _fn_i; \ - char *_hf_key = (char *)(key); \ - hashv = 2166136261UL; \ - for (_fn_i = 0; _fn_i < keylen; _fn_i++) \ - hashv = (hashv * 16777619) ^ _hf_key[_fn_i]; \ - bkt = hashv & (num_bkts - 1); \ - } while (0) - -#define HASH_OAT(key, keylen, num_bkts, hashv, bkt) \ - do { \ - unsigned _ho_i; \ - char *_ho_key = (char *)(key); \ - hashv = 0; \ - for (_ho_i = 0; _ho_i < keylen; _ho_i++) { \ - hashv += _ho_key[_ho_i]; \ - hashv += (hashv << 10); \ - hashv ^= (hashv >> 6); \ - } \ - hashv += (hashv << 3); \ - hashv ^= (hashv >> 11); \ - hashv += (hashv << 15); \ - bkt = hashv & (num_bkts - 1); \ - } while (0) - -#define HASH_JEN_MIX(a, b, c) \ - do { \ - a -= b; \ - a -= c; \ - a ^= (c >> 13); \ - b -= c; \ - b -= a; \ - b ^= (a << 8); \ - c -= a; \ - c -= b; \ - c ^= (b >> 13); \ - a -= b; \ - a -= c; \ - a ^= (c >> 12); \ - b -= c; \ - b -= a; \ - b ^= (a << 16); \ - c -= a; \ - c -= b; \ - c ^= (b >> 5); \ - a -= b; \ - a -= c; \ - a ^= (c >> 3); \ - b -= c; \ - b -= a; \ - b ^= (a << 10); \ - c -= a; \ - c -= b; \ - c ^= (b >> 15); \ - } while (0) - -#define HASH_JEN(key, keylen, num_bkts, hashv, bkt) \ - do { \ - unsigned _hj_i, _hj_j, _hj_k; \ - unsigned char *_hj_key = (unsigned char *)(key); \ - hashv = 0xfeedbeef; \ - _hj_i = _hj_j = 0x9e3779b9; \ - _hj_k = (unsigned)keylen; \ - while (_hj_k >= 12) { \ - _hj_i += (_hj_key[0] + ((unsigned)_hj_key[1] << 8) + ((unsigned)_hj_key[2] << 16) + ((unsigned)_hj_key[3] << 24)); \ - _hj_j += (_hj_key[4] + ((unsigned)_hj_key[5] << 8) + ((unsigned)_hj_key[6] << 16) + ((unsigned)_hj_key[7] << 24)); \ - hashv += (_hj_key[8] + ((unsigned)_hj_key[9] << 8) + ((unsigned)_hj_key[10] << 16) + ((unsigned)_hj_key[11] << 24)); \ - \ - HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ - \ - _hj_key += 12; \ - _hj_k -= 12; \ - } \ - hashv += keylen; \ - switch (_hj_k) { \ - case 11: hashv += ((unsigned)_hj_key[10] << 24); \ - case 10: hashv += ((unsigned)_hj_key[9] << 16); \ - case 9: hashv += ((unsigned)_hj_key[8] << 8); \ - case 8: _hj_j += ((unsigned)_hj_key[7] << 24); \ - case 7: _hj_j += ((unsigned)_hj_key[6] << 16); \ - case 6: _hj_j += ((unsigned)_hj_key[5] << 8); \ - case 5: _hj_j += _hj_key[4]; \ - case 4: _hj_i += ((unsigned)_hj_key[3] << 24); \ - case 3: _hj_i += ((unsigned)_hj_key[2] << 16); \ - case 2: _hj_i += ((unsigned)_hj_key[1] << 8); \ - case 1: _hj_i += _hj_key[0]; \ - } \ - HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ - bkt = hashv & (num_bkts - 1); \ - } while (0) - -/* The Paul Hsieh hash function */ -#undef get16bits -#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TURBOC__) - #define get16bits(d) (*((const uint16_t *)(d))) -#endif - -#if !defined(get16bits) - #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) + (uint32_t)(((const uint8_t *)(d))[0])) -#endif -#define HASH_SFH(key, keylen, num_bkts, hashv, bkt) \ - do { \ - unsigned char *_sfh_key = (unsigned char *)(key); \ - uint32_t _sfh_tmp, _sfh_len = keylen; \ - \ - int _sfh_rem = _sfh_len & 3; \ - _sfh_len >>= 2; \ - hashv = 0xcafebabe; \ - \ - /* Main loop */ \ - for (; _sfh_len > 0; _sfh_len--) { \ - hashv += get16bits(_sfh_key); \ - _sfh_tmp = (uint32_t)(get16bits(_sfh_key + 2)) << 11 ^ hashv; \ - hashv = (hashv << 16) ^ _sfh_tmp; \ - _sfh_key += 2 * sizeof(uint16_t); \ - hashv += hashv >> 11; \ - } \ - \ - /* Handle end cases */ \ - switch (_sfh_rem) { \ - case 3: \ - hashv += get16bits(_sfh_key); \ - hashv ^= hashv << 16; \ - hashv ^= (uint32_t)(_sfh_key[sizeof(uint16_t)] << 18); \ - hashv += hashv >> 11; \ - break; \ - case 2: \ - hashv += get16bits(_sfh_key); \ - hashv ^= hashv << 11; \ - hashv += hashv >> 17; \ - break; \ - case 1: \ - hashv += *_sfh_key; \ - hashv ^= hashv << 10; \ - hashv += hashv >> 1; \ - } \ - \ - /* Force "avalanching" of final 127 bits */ \ - hashv ^= hashv << 3; \ - hashv += hashv >> 5; \ - hashv ^= hashv << 4; \ - hashv += hashv >> 17; \ - hashv ^= hashv << 25; \ - hashv += hashv >> 6; \ - bkt = hashv & (num_bkts - 1); \ - } while (0) - -#ifdef HASH_USING_NO_STRICT_ALIASING - /* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. - * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. - * MurmurHash uses the faster approach only on CPU's where we know it's safe. - * - * Note the preprocessor built-in defines can be emitted using: - * - * gcc -m64 -dM -E - < /dev/null (on gcc) - * cc -## a.c (where a.c is a simple test file) (Sun Studio) - */ - #if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) - #define MUR_GETBLOCK(p, i) p[i] - #else /* non intel */ - #define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 0x3) == 0) - #define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 0x3) == 1) - #define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 0x3) == 2) - #define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 0x3) == 3) - #define WP(p) ((uint32_t *)((unsigned long)(p) & ~3UL)) - #if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) - #define MUR_THREE_ONE(p) ((((*WP(p)) & 0x00ffffff) << 8) | (((*(WP(p) + 1)) & 0xff000000) >> 24)) - #define MUR_TWO_TWO(p) ((((*WP(p)) & 0x0000ffff) << 16) | (((*(WP(p) + 1)) & 0xffff0000) >> 16)) - #define MUR_ONE_THREE(p) ((((*WP(p)) & 0x000000ff) << 24) | (((*(WP(p) + 1)) & 0xffffff00) >> 8)) - #else /* assume little endian non-intel */ - #define MUR_THREE_ONE(p) ((((*WP(p)) & 0xffffff00) >> 8) | (((*(WP(p) + 1)) & 0x000000ff) << 24)) - #define MUR_TWO_TWO(p) ((((*WP(p)) & 0xffff0000) >> 16) | (((*(WP(p) + 1)) & 0x0000ffff) << 16)) - #define MUR_ONE_THREE(p) ((((*WP(p)) & 0xff000000) >> 24) | (((*(WP(p) + 1)) & 0x00ffffff) << 8)) - #endif - #define MUR_GETBLOCK(p, i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : MUR_ONE_THREE(p)))) - #endif - #define MUR_ROTL32(x, r) (((x) << (r)) | ((x) >> (32 - (r)))) - #define MUR_FMIX(_h) \ - do { \ - _h ^= _h >> 16; \ - _h *= 0x85ebca6b; \ - _h ^= _h >> 13; \ - _h *= 0xc2b2ae35l; \ - _h ^= _h >> 16; \ - } while (0) - - #define HASH_MUR(key, keylen, num_bkts, hashv, bkt) \ - do { \ - const uint8_t *_mur_data = (const uint8_t *)(key); \ - const int _mur_nblocks = (keylen) / 4; \ - uint32_t _mur_h1 = 0xf88D5353; \ - uint32_t _mur_c1 = 0xcc9e2d51; \ - uint32_t _mur_c2 = 0x1b873593; \ - uint32_t _mur_k1 = 0; \ - const uint8_t *_mur_tail; \ - const uint32_t *_mur_blocks = (const uint32_t *)(_mur_data + _mur_nblocks * 4); \ - int _mur_i; \ - for (_mur_i = -_mur_nblocks; _mur_i; _mur_i++) { \ - _mur_k1 = MUR_GETBLOCK(_mur_blocks, _mur_i); \ - _mur_k1 *= _mur_c1; \ - _mur_k1 = MUR_ROTL32(_mur_k1, 15); \ - _mur_k1 *= _mur_c2; \ - \ - _mur_h1 ^= _mur_k1; \ - _mur_h1 = MUR_ROTL32(_mur_h1, 13); \ - _mur_h1 = _mur_h1 * 5 + 0xe6546b64; \ - } \ - _mur_tail = (const uint8_t *)(_mur_data + _mur_nblocks * 4); \ - _mur_k1 = 0; \ - switch ((keylen)&3) { \ - case 3: _mur_k1 ^= _mur_tail[2] << 16; \ - case 2: _mur_k1 ^= _mur_tail[1] << 8; \ - case 1: \ - _mur_k1 ^= _mur_tail[0]; \ - _mur_k1 *= _mur_c1; \ - _mur_k1 = MUR_ROTL32(_mur_k1, 15); \ - _mur_k1 *= _mur_c2; \ - _mur_h1 ^= _mur_k1; \ - } \ - _mur_h1 ^= (keylen); \ - MUR_FMIX(_mur_h1); \ - hashv = _mur_h1; \ - bkt = hashv & (num_bkts - 1); \ - } while (0) -#endif /* HASH_USING_NO_STRICT_ALIASING */ - -/* key comparison function; return 0 if keys equal */ -#define HASH_KEYCMP(a, b, len) memcmp(a, b, len) - -/* iterate over items in a known bucket to find desired item */ -#define HASH_FIND_IN_BKT(tbl, hh, head, keyptr, keylen_in, out) \ - do { \ - if (head.hh_head) \ - DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, head.hh_head)); \ - else \ - out = NULL; \ - while (out) { \ - if ((out)->hh.keylen == keylen_in) { \ - if ((HASH_KEYCMP((out)->hh.key, keyptr, keylen_in)) == 0) break; \ - } \ - if ((out)->hh.hh_next) \ - DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \ - else \ - out = NULL; \ - } \ - } while (0) - -/* add an item to a bucket */ -#define HASH_ADD_TO_BKT(head, addhh) \ - do { \ - head.count++; \ - (addhh)->hh_next = head.hh_head; \ - (addhh)->hh_prev = NULL; \ - if (head.hh_head) { \ - (head).hh_head->hh_prev = (addhh); \ - } \ - (head).hh_head = addhh; \ - if (head.count >= ((head.expand_mult + 1) * HASH_BKT_CAPACITY_THRESH) && (addhh)->tbl->noexpand != 1) { \ - HASH_EXPAND_BUCKETS((addhh)->tbl); \ - } \ - } while (0) - -/* remove an item from a given bucket */ -#define HASH_DEL_IN_BKT(hh, head, hh_del) \ - (head).count--; \ - if ((head).hh_head == hh_del) { \ - (head).hh_head = hh_del->hh_next; \ - } \ - if (hh_del->hh_prev) { \ - hh_del->hh_prev->hh_next = hh_del->hh_next; \ - } \ - if (hh_del->hh_next) { \ - hh_del->hh_next->hh_prev = hh_del->hh_prev; \ - } - -/* Bucket expansion has the effect of doubling the number of buckets - * and redistributing the items into the new buckets. Ideally the - * items will distribute more or less evenly into the new buckets - * (the extent to which this is true is a measure of the quality of - * the hash function as it applies to the key domain). - * - * With the items distributed into more buckets, the chain length - * (item count) in each bucket is reduced. Thus by expanding buckets - * the hash keeps a bound on the chain length. This bounded chain - * length is the essence of how a hash provides constant time lookup. - * - * The calculation of tbl->ideal_chain_maxlen below deserves some - * explanation. First, keep in mind that we're calculating the ideal - * maximum chain length based on the *new* (doubled) bucket count. - * In fractions this is just n/b (n=number of items,b=new num buckets). - * Since the ideal chain length is an integer, we want to calculate - * ceil(n/b). We don't depend on floating point arithmetic in this - * hash, so to calculate ceil(n/b) with integers we could write - * - * ceil(n/b) = (n/b) + ((n%b)?1:0) - * - * and in fact a previous version of this hash did just that. - * But now we have improved things a bit by recognizing that b is - * always a power of two. We keep its base 2 log handy (call it lb), - * so now we can write this with a bit shift and logical AND: - * - * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) - * - */ -#define HASH_EXPAND_BUCKETS(tbl) \ - do { \ - unsigned _he_bkt; \ - unsigned _he_bkt_i; \ - struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ - UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ - _he_new_buckets = (UT_hash_bucket *)uthash_malloc( \ - 2 * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - if (!_he_new_buckets) { \ - uthash_fatal("out of memory"); \ - } \ - memset(_he_new_buckets, 0, \ - 2 * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - tbl->ideal_chain_maxlen = \ - (tbl->num_items >> (tbl->log2_num_buckets + 1)) + \ - ((tbl->num_items & ((tbl->num_buckets * 2) - 1)) ? 1 : 0); \ - tbl->nonideal_items = 0; \ - for (_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++) { \ - _he_thh = tbl->buckets[_he_bkt_i].hh_head; \ - while (_he_thh) { \ - _he_hh_nxt = _he_thh->hh_next; \ - HASH_TO_BKT(_he_thh->hashv, tbl->num_buckets * 2, _he_bkt); \ - _he_newbkt = &(_he_new_buckets[_he_bkt]); \ - if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) { \ - tbl->nonideal_items++; \ - _he_newbkt->expand_mult = _he_newbkt->count / \ - tbl->ideal_chain_maxlen; \ - } \ - _he_thh->hh_prev = NULL; \ - _he_thh->hh_next = _he_newbkt->hh_head; \ - if (_he_newbkt->hh_head) _he_newbkt->hh_head->hh_prev = \ - _he_thh; \ - _he_newbkt->hh_head = _he_thh; \ - _he_thh = _he_hh_nxt; \ - } \ - } \ - uthash_free(tbl->buckets, tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - tbl->num_buckets *= 2; \ - tbl->log2_num_buckets++; \ - tbl->buckets = _he_new_buckets; \ - tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ? (tbl->ineff_expands + 1) : 0; \ - if (tbl->ineff_expands > 1) { \ - tbl->noexpand = 1; \ - uthash_noexpand_fyi(tbl); \ - } \ - uthash_expand_fyi(tbl); \ - } while (0) - -/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ -/* Note that HASH_SORT assumes the hash handle name to be hh. - * HASH_SRT was added to allow the hash handle name to be passed in. */ -#define HASH_SORT(head, cmpfcn) HASH_SRT(hh, head, cmpfcn) -#define HASH_SRT(hh, head, cmpfcn) \ - do { \ - unsigned _hs_i; \ - unsigned _hs_looping, _hs_nmerges, _hs_insize, _hs_psize, _hs_qsize; \ - struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ - if (head) { \ - _hs_insize = 1; \ - _hs_looping = 1; \ - _hs_list = &((head)->hh); \ - while (_hs_looping) { \ - _hs_p = _hs_list; \ - _hs_list = NULL; \ - _hs_tail = NULL; \ - _hs_nmerges = 0; \ - while (_hs_p) { \ - _hs_nmerges++; \ - _hs_q = _hs_p; \ - _hs_psize = 0; \ - for (_hs_i = 0; _hs_i < _hs_insize; _hs_i++) { \ - _hs_psize++; \ - _hs_q = (UT_hash_handle *)((_hs_q->next) ? ((void *)((char *)(_hs_q->next) + \ - (head)->hh.tbl->hho)) \ - : NULL); \ - if (!(_hs_q)) break; \ - } \ - _hs_qsize = _hs_insize; \ - while ((_hs_psize > 0) || ((_hs_qsize > 0) && _hs_q)) { \ - if (_hs_psize == 0) { \ - _hs_e = _hs_q; \ - _hs_q = (UT_hash_handle *)((_hs_q->next) ? ((void *)((char *)(_hs_q->next) + \ - (head)->hh.tbl->hho)) \ - : NULL); \ - _hs_qsize--; \ - } else if ((_hs_qsize == 0) || !(_hs_q)) { \ - _hs_e = _hs_p; \ - _hs_p = (UT_hash_handle *)((_hs_p->next) ? ((void *)((char *)(_hs_p->next) + \ - (head)->hh.tbl->hho)) \ - : NULL); \ - _hs_psize--; \ - } else if (( \ - cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_p)), \ - DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_q)))) <= 0) { \ - _hs_e = _hs_p; \ - _hs_p = (UT_hash_handle *)((_hs_p->next) ? ((void *)((char *)(_hs_p->next) + \ - (head)->hh.tbl->hho)) \ - : NULL); \ - _hs_psize--; \ - } else { \ - _hs_e = _hs_q; \ - _hs_q = (UT_hash_handle *)((_hs_q->next) ? ((void *)((char *)(_hs_q->next) + \ - (head)->hh.tbl->hho)) \ - : NULL); \ - _hs_qsize--; \ - } \ - if (_hs_tail) { \ - _hs_tail->next = ((_hs_e) ? ELMT_FROM_HH((head)->hh.tbl, _hs_e) : NULL); \ - } else { \ - _hs_list = _hs_e; \ - } \ - _hs_e->prev = ((_hs_tail) ? ELMT_FROM_HH((head)->hh.tbl, _hs_tail) : NULL); \ - _hs_tail = _hs_e; \ - } \ - _hs_p = _hs_q; \ - } \ - _hs_tail->next = NULL; \ - if (_hs_nmerges <= 1) { \ - _hs_looping = 0; \ - (head)->hh.tbl->tail = _hs_tail; \ - DECLTYPE_ASSIGN(head, ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ - } \ - _hs_insize *= 2; \ - } \ - HASH_FSCK(hh, head); \ - } \ - } while (0) - -/* This function selects items from one hash into another hash. - * The end result is that the selected items have dual presence - * in both hashes. There is no copy of the items made; rather - * they are added into the new hash through a secondary hash - * hash handle that must be present in the structure. */ -#define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ - do { \ - unsigned _src_bkt, _dst_bkt; \ - void *_last_elt = NULL, *_elt; \ - UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh = NULL; \ - ptrdiff_t _dst_hho = ((char *)(&(dst)->hh_dst) - (char *)(dst)); \ - if (src) { \ - for (_src_bkt = 0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ - for (_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ - _src_hh; \ - _src_hh = _src_hh->hh_next) { \ - _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ - if (cond(_elt)) { \ - _dst_hh = (UT_hash_handle *)(((char *)_elt) + _dst_hho); \ - _dst_hh->key = _src_hh->key; \ - _dst_hh->keylen = _src_hh->keylen; \ - _dst_hh->hashv = _src_hh->hashv; \ - _dst_hh->prev = _last_elt; \ - _dst_hh->next = NULL; \ - if (_last_elt_hh) { \ - _last_elt_hh->next = _elt; \ - } \ - if (!dst) { \ - DECLTYPE_ASSIGN(dst, _elt); \ - HASH_MAKE_TABLE(hh_dst, dst); \ - } else { \ - _dst_hh->tbl = (dst)->hh_dst.tbl; \ - } \ - HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ - HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt], _dst_hh); \ - (dst)->hh_dst.tbl->num_items++; \ - _last_elt = _elt; \ - _last_elt_hh = _dst_hh; \ - } \ - } \ - } \ - } \ - HASH_FSCK(hh_dst, dst); \ - } while (0) - -#define HASH_CLEAR(hh, head) \ - do { \ - if (head) { \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head) = NULL; \ - } \ - } while (0) - -#define HASH_OVERHEAD(hh, head) \ - (size_t)((((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ - ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ - (sizeof(UT_hash_table)) + \ - (HASH_BLOOM_BYTELEN))) - -#ifdef NO_DECLTYPE - #define HASH_ITER(hh, head, el, tmp) \ - for ((el) = (head), (*(char **)(&(tmp))) = (char *)((head) ? (head)->hh.next : NULL); \ - el; (el) = (tmp), (*(char **)(&(tmp))) = (char *)((tmp) ? (tmp)->hh.next : NULL)) -#else - #define HASH_ITER(hh, head, el, tmp) \ - for ((el) = (head), (tmp) = DECLTYPE(el)((head) ? (head)->hh.next : NULL); \ - el; (el) = (tmp), (tmp) = DECLTYPE(el)((tmp) ? (tmp)->hh.next : NULL)) -#endif - -/* obtain a count of items in the hash */ -#define HASH_COUNT(head) HASH_CNT(hh, head) -#define HASH_CNT(hh, head) ((head) ? ((head)->hh.tbl->num_items) : 0) - -typedef struct UT_hash_bucket { - struct UT_hash_handle *hh_head; - unsigned count; - - /* expand_mult is normally set to 0. In this situation, the max chain length - * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If - * the bucket's chain exceeds this length, bucket expansion is triggered). - * However, setting expand_mult to a non-zero value delays bucket expansion - * (that would be triggered by additions to this particular bucket) - * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. - * (The multiplier is simply expand_mult+1). The whole idea of this - * multiplier is to reduce bucket expansions, since they are expensive, in - * situations where we know that a particular bucket tends to be overused. - * It is better to let its chain length grow to a longer yet-still-bounded - * value, than to do an O(n) bucket expansion too often. - */ - unsigned expand_mult; - -} UT_hash_bucket; - -/* random signature used only to find hash tables in external analysis */ -#define HASH_SIGNATURE 0xa0111fe1 -#define HASH_BLOOM_SIGNATURE 0xb12220f2 - -typedef struct UT_hash_table { - UT_hash_bucket *buckets; - unsigned num_buckets, log2_num_buckets; - unsigned num_items; - struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ - ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ - - /* in an ideal situation (all buckets used equally), no bucket would have - * more than ceil(#items/#buckets) items. that's the ideal chain length. */ - unsigned ideal_chain_maxlen; - - /* nonideal_items is the number of items in the hash whose chain position - * exceeds the ideal chain maxlen. these items pay the penalty for an uneven - * hash distribution; reaching them in a chain traversal takes >ideal steps */ - unsigned nonideal_items; - - /* ineffective expands occur when a bucket doubling was performed, but - * afterward, more than half the items in the hash had nonideal chain - * positions. If this happens on two consecutive expansions we inhibit any - * further expansion, as it's not helping; this happens when the hash - * function isn't a good fit for the key domain. When expansion is inhibited - * the hash will still work, albeit no longer in constant time. */ - unsigned ineff_expands, noexpand; - - uint32_t signature; /* used only to find hash tables in external analysis */ -#ifdef HASH_BLOOM - uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ - uint8_t *bloom_bv; - char bloom_nbits; -#endif - -} UT_hash_table; - -typedef struct UT_hash_handle { - struct UT_hash_table *tbl; - void *prev; /* prev element in app order */ - void *next; /* next element in app order */ - struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ - struct UT_hash_handle *hh_next; /* next hh in bucket order */ - void *key; /* ptr to enclosing struct's key */ - unsigned keylen; /* enclosing struct's key len */ - unsigned hashv; /* result of hash-fcn(key) */ -} UT_hash_handle; - -/// @endcond -#endif /* UTHASH_H */ diff --git a/native/cocos/bindings/auto/jsb_audio_auto.cpp b/native/cocos/bindings/auto/jsb_audio_auto.cpp index 0b0f5e6764..43e9c1bfbb 100644 --- a/native/cocos/bindings/auto/jsb_audio_auto.cpp +++ b/native/cocos/bindings/auto/jsb_audio_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_audio_auto.h" #if (USE_AUDIO > 0) #include "cocos/bindings/manual/jsb_conversions.h" @@ -139,7 +164,6 @@ bool js_register_audio_AudioProfile(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_AudioEngine_proto = nullptr; se::Class* __jsb_cc_AudioEngine_class = nullptr; @@ -828,7 +852,6 @@ bool js_register_audio_AudioEngine(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_audio(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_audio_auto.h b/native/cocos/bindings/auto/jsb_audio_auto.h index bca7e300f4..0464119f65 100644 --- a/native/cocos/bindings/auto/jsb_audio_auto.h +++ b/native/cocos/bindings/auto/jsb_audio_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #if (USE_AUDIO > 0) diff --git a/native/cocos/bindings/auto/jsb_cocos_auto.cpp b/native/cocos/bindings/auto/jsb_cocos_auto.cpp index c1115b45ee..7afb69a26d 100644 --- a/native/cocos/bindings/auto/jsb_cocos_auto.cpp +++ b/native/cocos/bindings/auto/jsb_cocos_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_cocos_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" @@ -314,7 +339,7 @@ static bool js_engine_FileUtils_getValueMapFromData(se::State& s) ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getValueMapFromData : Error processing arguments"); - cc::ValueMap result = cobj->getValueMapFromData(arg0.value(), arg1.value()); + std::unordered_map result = cobj->getValueMapFromData(arg0.value(), arg1.value()); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getValueMapFromData : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); @@ -336,7 +361,7 @@ static bool js_engine_FileUtils_getValueMapFromFile(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getValueMapFromFile : Error processing arguments"); - cc::ValueMap result = cobj->getValueMapFromFile(arg0.value()); + std::unordered_map result = cobj->getValueMapFromFile(arg0.value()); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getValueMapFromFile : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); @@ -358,7 +383,7 @@ static bool js_engine_FileUtils_getValueVectorFromFile(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getValueVectorFromFile : Error processing arguments"); - cc::ValueVector result = cobj->getValueVectorFromFile(arg0.value()); + std::vector result = cobj->getValueVectorFromFile(arg0.value()); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); SE_PRECONDITION2(ok, false, "js_engine_FileUtils_getValueVectorFromFile : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); @@ -719,7 +744,7 @@ static bool js_engine_FileUtils_writeToFile(se::State& s) size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 2) { - HolderType arg0 = {}; + HolderType, true> arg0 = {}; HolderType arg1 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); @@ -743,7 +768,7 @@ static bool js_engine_FileUtils_writeValueMapToFile(se::State& s) size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 2) { - HolderType arg0 = {}; + HolderType, true> arg0 = {}; HolderType arg1 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); @@ -767,7 +792,7 @@ static bool js_engine_FileUtils_writeValueVectorToFile(se::State& s) size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 2) { - HolderType arg0 = {}; + HolderType, true> arg0 = {}; HolderType arg1 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); @@ -882,7 +907,6 @@ bool js_register_engine_FileUtils(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_CanvasGradient_proto = nullptr; se::Class* __jsb_cc_CanvasGradient_class = nullptr; @@ -949,7 +973,6 @@ bool js_register_engine_CanvasGradient(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_CanvasRenderingContext2D_proto = nullptr; se::Class* __jsb_cc_CanvasRenderingContext2D_class = nullptr; @@ -1374,7 +1397,6 @@ bool js_register_engine_CanvasRenderingContext2D(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_Device_proto = nullptr; se::Class* __jsb_cc_Device_class = nullptr; @@ -1592,7 +1614,6 @@ bool js_register_engine_Device(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_SAXParser_proto = nullptr; se::Class* __jsb_cc_SAXParser_class = nullptr; @@ -1635,7 +1656,6 @@ bool js_register_engine_SAXParser(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_engine(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_cocos_auto.h b/native/cocos/bindings/auto/jsb_cocos_auto.h index d0b1b443c8..83c5375e6c 100644 --- a/native/cocos/bindings/auto/jsb_cocos_auto.h +++ b/native/cocos/bindings/auto/jsb_cocos_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include diff --git a/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp b/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp index 2b8312d0e5..40cbb3e53e 100644 --- a/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp +++ b/native/cocos/bindings/auto/jsb_dragonbones_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_dragonbones_auto.h" #if USE_DRAGONBONES > 0 #include "cocos/bindings/manual/jsb_conversions.h" @@ -88,7 +113,6 @@ bool js_register_dragonbones_BaseObject(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Rectangle_proto = nullptr; se::Class* __jsb_dragonBones_Rectangle_class = nullptr; @@ -149,7 +173,6 @@ bool js_register_dragonbones_Rectangle(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Matrix_proto = nullptr; se::Class* __jsb_dragonBones_Matrix_class = nullptr; @@ -337,7 +360,6 @@ bool js_register_dragonbones_Matrix(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Transform_proto = nullptr; se::Class* __jsb_dragonBones_Transform_class = nullptr; @@ -546,7 +568,6 @@ bool js_register_dragonbones_Transform(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_TextureAtlasData_proto = nullptr; se::Class* __jsb_dragonBones_TextureAtlasData_class = nullptr; @@ -658,7 +679,6 @@ bool js_register_dragonbones_TextureAtlasData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_TextureData_proto = nullptr; se::Class* __jsb_dragonBones_TextureData_class = nullptr; @@ -797,7 +817,6 @@ bool js_register_dragonbones_TextureData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_ArmatureData_proto = nullptr; se::Class* __jsb_dragonBones_ArmatureData_class = nullptr; @@ -1209,7 +1228,6 @@ bool js_register_dragonbones_ArmatureData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_BoneData_proto = nullptr; se::Class* __jsb_dragonBones_BoneData_class = nullptr; @@ -1346,7 +1364,6 @@ bool js_register_dragonbones_BoneData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_SlotData_proto = nullptr; se::Class* __jsb_dragonBones_SlotData_class = nullptr; @@ -1503,7 +1520,6 @@ bool js_register_dragonbones_SlotData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_DragonBonesData_proto = nullptr; se::Class* __jsb_dragonBones_DragonBonesData_class = nullptr; @@ -1635,7 +1651,6 @@ bool js_register_dragonbones_DragonBonesData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_SkinData_proto = nullptr; se::Class* __jsb_dragonBones_SkinData_class = nullptr; @@ -1684,7 +1699,6 @@ bool js_register_dragonbones_SkinData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_AnimationData_proto = nullptr; se::Class* __jsb_dragonBones_AnimationData_class = nullptr; @@ -1950,7 +1964,6 @@ bool js_register_dragonbones_AnimationData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Armature_proto = nullptr; se::Class* __jsb_dragonBones_Armature_class = nullptr; @@ -2469,7 +2482,6 @@ bool js_register_dragonbones_Armature(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_TransformObject_proto = nullptr; se::Class* __jsb_dragonBones_TransformObject_class = nullptr; @@ -2606,7 +2618,6 @@ bool js_register_dragonbones_TransformObject(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_AnimationState_proto = nullptr; se::Class* __jsb_dragonBones_AnimationState_class = nullptr; @@ -3251,7 +3262,6 @@ bool js_register_dragonbones_AnimationState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Bone_proto = nullptr; se::Class* __jsb_dragonBones_Bone_class = nullptr; @@ -3509,7 +3519,6 @@ bool js_register_dragonbones_Bone(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Slot_proto = nullptr; se::Class* __jsb_dragonBones_Slot_class = nullptr; @@ -3861,7 +3870,6 @@ bool js_register_dragonbones_Slot(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_WorldClock_proto = nullptr; se::Class* __jsb_dragonBones_WorldClock_class = nullptr; @@ -3991,7 +3999,6 @@ bool js_register_dragonbones_WorldClock(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_Animation_proto = nullptr; se::Class* __jsb_dragonBones_Animation_class = nullptr; @@ -4659,7 +4666,6 @@ bool js_register_dragonbones_Animation(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_EventObject_proto = nullptr; se::Class* __jsb_dragonBones_EventObject_class = nullptr; @@ -4928,7 +4934,6 @@ bool js_register_dragonbones_EventObject(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_BaseFactory_proto = nullptr; se::Class* __jsb_dragonBones_BaseFactory_class = nullptr; @@ -5426,7 +5431,6 @@ bool js_register_dragonbones_BaseFactory(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_CCSlot_proto = nullptr; se::Class* __jsb_dragonBones_CCSlot_class = nullptr; @@ -5463,7 +5467,6 @@ bool js_register_dragonbones_CCSlot(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_CCArmatureDisplay_proto = nullptr; se::Class* __jsb_dragonBones_CCArmatureDisplay_class = nullptr; @@ -6060,7 +6063,6 @@ bool js_register_dragonbones_CCArmatureDisplay(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_ArmatureCacheMgr_proto = nullptr; se::Class* __jsb_dragonBones_ArmatureCacheMgr_class = nullptr; @@ -6172,7 +6174,6 @@ bool js_register_dragonbones_ArmatureCacheMgr(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_CCArmatureCacheDisplay_proto = nullptr; se::Class* __jsb_dragonBones_CCArmatureCacheDisplay_class = nullptr; @@ -6717,7 +6718,6 @@ bool js_register_dragonbones_CCArmatureCacheDisplay(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_CCFactory_proto = nullptr; se::Class* __jsb_dragonBones_CCFactory_class = nullptr; @@ -7197,7 +7197,6 @@ bool js_register_dragonbones_CCFactory(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_CCTextureAtlasData_proto = nullptr; se::Class* __jsb_dragonBones_CCTextureAtlasData_class = nullptr; @@ -7218,7 +7217,6 @@ bool js_register_dragonbones_CCTextureAtlasData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_dragonBones_CCTextureData_proto = nullptr; se::Class* __jsb_dragonBones_CCTextureData_class = nullptr; @@ -7239,7 +7237,6 @@ bool js_register_dragonbones_CCTextureData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_dragonbones(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_dragonbones_auto.h b/native/cocos/bindings/auto/jsb_dragonbones_auto.h index 1e03c56c6d..5d93da4d3c 100644 --- a/native/cocos/bindings/auto/jsb_dragonbones_auto.h +++ b/native/cocos/bindings/auto/jsb_dragonbones_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #if USE_DRAGONBONES > 0 diff --git a/native/cocos/bindings/auto/jsb_editor_support_auto.cpp b/native/cocos/bindings/auto/jsb_editor_support_auto.cpp index 4e7ec132e2..ef9a471c09 100644 --- a/native/cocos/bindings/auto/jsb_editor_support_auto.cpp +++ b/native/cocos/bindings/auto/jsb_editor_support_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_editor_support_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" @@ -243,7 +268,6 @@ bool js_register_editor_support_Texture2D(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_middleware_SharedBufferManager_proto = nullptr; se::Class* __jsb_cc_middleware_SharedBufferManager_class = nullptr; @@ -358,7 +382,6 @@ bool js_register_editor_support_SharedBufferManager(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_middleware_MiddlewareManager_proto = nullptr; se::Class* __jsb_cc_middleware_MiddlewareManager_class = nullptr; @@ -656,7 +679,6 @@ bool js_register_editor_support_MiddlewareManager(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_editor_support(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_editor_support_auto.h b/native/cocos/bindings/auto/jsb_editor_support_auto.h index 8519067673..a626254d58 100644 --- a/native/cocos/bindings/auto/jsb_editor_support_auto.h +++ b/native/cocos/bindings/auto/jsb_editor_support_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include diff --git a/native/cocos/bindings/auto/jsb_extension_auto.cpp b/native/cocos/bindings/auto/jsb_extension_auto.cpp index 2ea37171d8..896852876d 100644 --- a/native/cocos/bindings/auto/jsb_extension_auto.cpp +++ b/native/cocos/bindings/auto/jsb_extension_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_extension_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" @@ -317,7 +342,6 @@ bool js_register_extension_EventAssetsManagerEx(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_extension_Manifest_proto = nullptr; se::Class* __jsb_cc_extension_Manifest_class = nullptr; @@ -630,7 +654,6 @@ bool js_register_extension_Manifest(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_extension_AssetsManagerEx_proto = nullptr; se::Class* __jsb_cc_extension_AssetsManagerEx_class = nullptr; @@ -1266,7 +1289,6 @@ bool js_register_extension_AssetsManagerEx(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_extension(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_extension_auto.h b/native/cocos/bindings/auto/jsb_extension_auto.h index dcfd3d411f..d15a95a10f 100644 --- a/native/cocos/bindings/auto/jsb_extension_auto.h +++ b/native/cocos/bindings/auto/jsb_extension_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include diff --git a/native/cocos/bindings/auto/jsb_gfx_auto.cpp b/native/cocos/bindings/auto/jsb_gfx_auto.cpp index e57aef87c3..d83a6245dc 100644 --- a/native/cocos/bindings/auto/jsb_gfx_auto.cpp +++ b/native/cocos/bindings/auto/jsb_gfx_auto.cpp @@ -1,7 +1,32 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_gfx_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" -#include "renderer/core/Core.h" +#include "renderer/gfx-base/GFXBase.h" #ifndef JSB_ALLOC #define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) @@ -10,201 +35,1116 @@ #ifndef JSB_FREE #define JSB_FREE(ptr) delete ptr #endif +se::Object* __jsb_cc_gfx_Size_proto = nullptr; +se::Class* __jsb_cc_gfx_Size_class = nullptr; - -template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::Format *to, se::Object *ctx) +static bool js_gfx_Size_get_x(se::State& s) { - typedef typename std::underlying_type_t under_type; - under_type tmp; - if(sevalue_to_native(from, &tmp, ctx)) { *to = static_cast(tmp); return true;} - return false; -} + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Size_get_x : Invalid Native Object"); -int js_register_gfx_Format(se::Object* obj) -{ - auto enum_kls = se::Object::createPlainObject(); - enum_kls->setProperty("UNKNOWN", se::Value(0)); - enum_kls->setProperty("A8", se::Value(1)); - enum_kls->setProperty("L8", se::Value(2)); - enum_kls->setProperty("LA8", se::Value(3)); - enum_kls->setProperty("R8", se::Value(4)); - enum_kls->setProperty("R8SN", se::Value(5)); - enum_kls->setProperty("R8UI", se::Value(6)); - enum_kls->setProperty("R8I", se::Value(7)); - enum_kls->setProperty("R16F", se::Value(8)); - enum_kls->setProperty("R16UI", se::Value(9)); - enum_kls->setProperty("R16I", se::Value(10)); - enum_kls->setProperty("R32F", se::Value(11)); - enum_kls->setProperty("R32UI", se::Value(12)); - enum_kls->setProperty("R32I", se::Value(13)); - enum_kls->setProperty("RG8", se::Value(14)); - enum_kls->setProperty("RG8SN", se::Value(15)); - enum_kls->setProperty("RG8UI", se::Value(16)); - enum_kls->setProperty("RG8I", se::Value(17)); - enum_kls->setProperty("RG16F", se::Value(18)); - enum_kls->setProperty("RG16UI", se::Value(19)); - enum_kls->setProperty("RG16I", se::Value(20)); - enum_kls->setProperty("RG32F", se::Value(21)); - enum_kls->setProperty("RG32UI", se::Value(22)); - enum_kls->setProperty("RG32I", se::Value(23)); - enum_kls->setProperty("RGB8", se::Value(24)); - enum_kls->setProperty("SRGB8", se::Value(25)); - enum_kls->setProperty("RGB8SN", se::Value(26)); - enum_kls->setProperty("RGB8UI", se::Value(27)); - enum_kls->setProperty("RGB8I", se::Value(28)); - enum_kls->setProperty("RGB16F", se::Value(29)); - enum_kls->setProperty("RGB16UI", se::Value(30)); - enum_kls->setProperty("RGB16I", se::Value(31)); - enum_kls->setProperty("RGB32F", se::Value(32)); - enum_kls->setProperty("RGB32UI", se::Value(33)); - enum_kls->setProperty("RGB32I", se::Value(34)); - enum_kls->setProperty("RGBA8", se::Value(35)); - enum_kls->setProperty("BGRA8", se::Value(36)); - enum_kls->setProperty("SRGB8_A8", se::Value(37)); - enum_kls->setProperty("RGBA8SN", se::Value(38)); - enum_kls->setProperty("RGBA8UI", se::Value(39)); - enum_kls->setProperty("RGBA8I", se::Value(40)); - enum_kls->setProperty("RGBA16F", se::Value(41)); - enum_kls->setProperty("RGBA16UI", se::Value(42)); - enum_kls->setProperty("RGBA16I", se::Value(43)); - enum_kls->setProperty("RGBA32F", se::Value(44)); - enum_kls->setProperty("RGBA32UI", se::Value(45)); - enum_kls->setProperty("RGBA32I", se::Value(46)); - enum_kls->setProperty("R5G6B5", se::Value(47)); - enum_kls->setProperty("R11G11B10F", se::Value(48)); - enum_kls->setProperty("RGB5A1", se::Value(49)); - enum_kls->setProperty("RGBA4", se::Value(50)); - enum_kls->setProperty("RGB10A2", se::Value(51)); - enum_kls->setProperty("RGB10A2UI", se::Value(52)); - enum_kls->setProperty("RGB9E5", se::Value(53)); - enum_kls->setProperty("D16", se::Value(54)); - enum_kls->setProperty("D16S8", se::Value(55)); - enum_kls->setProperty("D24", se::Value(56)); - enum_kls->setProperty("D24S8", se::Value(57)); - enum_kls->setProperty("D32F", se::Value(58)); - enum_kls->setProperty("D32F_S8", se::Value(59)); - enum_kls->setProperty("BC1", se::Value(60)); - enum_kls->setProperty("BC1_ALPHA", se::Value(61)); - enum_kls->setProperty("BC1_SRGB", se::Value(62)); - enum_kls->setProperty("BC1_SRGB_ALPHA", se::Value(63)); - enum_kls->setProperty("BC2", se::Value(64)); - enum_kls->setProperty("BC2_SRGB", se::Value(65)); - enum_kls->setProperty("BC3", se::Value(66)); - enum_kls->setProperty("BC3_SRGB", se::Value(67)); - enum_kls->setProperty("BC4", se::Value(68)); - enum_kls->setProperty("BC4_SNORM", se::Value(69)); - enum_kls->setProperty("BC5", se::Value(70)); - enum_kls->setProperty("BC5_SNORM", se::Value(71)); - enum_kls->setProperty("BC6H_UF16", se::Value(72)); - enum_kls->setProperty("BC6H_SF16", se::Value(73)); - enum_kls->setProperty("BC7", se::Value(74)); - enum_kls->setProperty("BC7_SRGB", se::Value(75)); - enum_kls->setProperty("ETC_RGB8", se::Value(76)); - enum_kls->setProperty("ETC2_RGB8", se::Value(77)); - enum_kls->setProperty("ETC2_SRGB8", se::Value(78)); - enum_kls->setProperty("ETC2_RGB8_A1", se::Value(79)); - enum_kls->setProperty("ETC2_SRGB8_A1", se::Value(80)); - enum_kls->setProperty("ETC2_RGBA8", se::Value(81)); - enum_kls->setProperty("ETC2_SRGB8_A8", se::Value(82)); - enum_kls->setProperty("EAC_R11", se::Value(83)); - enum_kls->setProperty("EAC_R11SN", se::Value(84)); - enum_kls->setProperty("EAC_RG11", se::Value(85)); - enum_kls->setProperty("EAC_RG11SN", se::Value(86)); - enum_kls->setProperty("PVRTC_RGB2", se::Value(87)); - enum_kls->setProperty("PVRTC_RGBA2", se::Value(88)); - enum_kls->setProperty("PVRTC_RGB4", se::Value(89)); - enum_kls->setProperty("PVRTC_RGBA4", se::Value(90)); - enum_kls->setProperty("PVRTC2_2BPP", se::Value(91)); - enum_kls->setProperty("PVRTC2_4BPP", se::Value(92)); - enum_kls->setProperty("ASTC_RGBA_4x4", se::Value(93)); - enum_kls->setProperty("ASTC_RGBA_5x4", se::Value(94)); - enum_kls->setProperty("ASTC_RGBA_5x5", se::Value(95)); - enum_kls->setProperty("ASTC_RGBA_6x5", se::Value(96)); - enum_kls->setProperty("ASTC_RGBA_6x6", se::Value(97)); - enum_kls->setProperty("ASTC_RGBA_8x5", se::Value(98)); - enum_kls->setProperty("ASTC_RGBA_8x6", se::Value(99)); - enum_kls->setProperty("ASTC_RGBA_8x8", se::Value(100)); - enum_kls->setProperty("ASTC_RGBA_10x5", se::Value(101)); - enum_kls->setProperty("ASTC_RGBA_10x6", se::Value(102)); - enum_kls->setProperty("ASTC_RGBA_10x8", se::Value(103)); - enum_kls->setProperty("ASTC_RGBA_10x10", se::Value(104)); - enum_kls->setProperty("ASTC_RGBA_12x10", se::Value(105)); - enum_kls->setProperty("ASTC_RGBA_12x12", se::Value(106)); - enum_kls->setProperty("ASTC_SRGBA_4x4", se::Value(107)); - enum_kls->setProperty("ASTC_SRGBA_5x4", se::Value(108)); - enum_kls->setProperty("ASTC_SRGBA_5x5", se::Value(109)); - enum_kls->setProperty("ASTC_SRGBA_6x5", se::Value(110)); - enum_kls->setProperty("ASTC_SRGBA_6x6", se::Value(111)); - enum_kls->setProperty("ASTC_SRGBA_8x5", se::Value(112)); - enum_kls->setProperty("ASTC_SRGBA_8x6", se::Value(113)); - enum_kls->setProperty("ASTC_SRGBA_8x8", se::Value(114)); - enum_kls->setProperty("ASTC_SRGBA_10x5", se::Value(115)); - enum_kls->setProperty("ASTC_SRGBA_10x6", se::Value(116)); - enum_kls->setProperty("ASTC_SRGBA_10x8", se::Value(117)); - enum_kls->setProperty("ASTC_SRGBA_10x10", se::Value(118)); - enum_kls->setProperty("ASTC_SRGBA_12x10", se::Value(119)); - enum_kls->setProperty("ASTC_SRGBA_12x12", se::Value(120)); - enum_kls->setProperty("COUNT", se::Value(121)); - obj->setProperty("Format", se::Value(enum_kls)); + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->x, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->x, s.thisObject(), s.rval()); return true; } +SE_BIND_PROP_GET(js_gfx_Size_get_x) - -template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::TextureLayout *to, se::Object *ctx) +static bool js_gfx_Size_set_x(se::State& s) { - typedef typename std::underlying_type_t under_type; - under_type tmp; - if(sevalue_to_native(from, &tmp, ctx)) { *to = static_cast(tmp); return true;} - return false; -} + const auto& args = s.args(); + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Size_set_x : Invalid Native Object"); -int js_register_gfx_TextureLayout(se::Object* obj) -{ - auto enum_kls = se::Object::createPlainObject(); - enum_kls->setProperty("UNDEFINED", se::Value(0)); - enum_kls->setProperty("GENERAL", se::Value(1)); - enum_kls->setProperty("COLOR_ATTACHMENT_OPTIMAL", se::Value(2)); - enum_kls->setProperty("DEPTH_STENCIL_ATTACHMENT_OPTIMAL", se::Value(3)); - enum_kls->setProperty("DEPTH_STENCIL_READONLY_OPTIMAL", se::Value(4)); - enum_kls->setProperty("SHADER_READONLY_OPTIMAL", se::Value(5)); - enum_kls->setProperty("TRANSFER_SRC_OPTIMAL", se::Value(6)); - enum_kls->setProperty("TRANSFER_DST_OPTIMAL", se::Value(7)); - enum_kls->setProperty("PREINITIALIZED", se::Value(8)); - enum_kls->setProperty("PRESENT_SRC", se::Value(9)); - obj->setProperty("TextureLayout", se::Value(enum_kls)); + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->x, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Size_set_x : Error processing new value"); return true; } +SE_BIND_PROP_SET(js_gfx_Size_set_x) + +static bool js_gfx_Size_get_y(se::State& s) +{ + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Size_get_y : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->y, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->y, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Size_get_y) + +static bool js_gfx_Size_set_y(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Size_set_y : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->y, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Size_set_y : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Size_set_y) + +static bool js_gfx_Size_get_z(se::State& s) +{ + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Size_get_z : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->z, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->z, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Size_get_z) + +static bool js_gfx_Size_set_z(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Size_set_z : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->z, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Size_set_z : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Size_set_z) template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::PrimitiveMode *to, se::Object *ctx) +bool sevalue_to_native(const se::Value &from, cc::gfx::Size * to, se::Object *ctx) { - typedef typename std::underlying_type_t under_type; - under_type tmp; - if(sevalue_to_native(from, &tmp, ctx)) { *to = static_cast(tmp); return true;} - return false; + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::Size*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("x", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->x), ctx); + } + json->getProperty("y", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->y), ctx); + } + json->getProperty("z", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->z), ctx); + } + return ok; } -int js_register_gfx_PrimitiveMode(se::Object* obj) +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Size_finalize) + +static bool js_gfx_Size_constructor(se::State& s) { - auto enum_kls = se::Object::createPlainObject(); - enum_kls->setProperty("POINT_LIST", se::Value(0)); - enum_kls->setProperty("LINE_LIST", se::Value(1)); - enum_kls->setProperty("LINE_STRIP", se::Value(2)); - enum_kls->setProperty("LINE_LOOP", se::Value(3)); - enum_kls->setProperty("LINE_LIST_ADJACENCY", se::Value(4)); - enum_kls->setProperty("LINE_STRIP_ADJACENCY", se::Value(5)); - enum_kls->setProperty("ISO_LINE_LIST", se::Value(6)); - enum_kls->setProperty("TRIANGLE_LIST", se::Value(7)); - enum_kls->setProperty("TRIANGLE_STRIP", se::Value(8)); - enum_kls->setProperty("TRIANGLE_FAN", se::Value(9)); - enum_kls->setProperty("TRIANGLE_LIST_ADJACENCY", se::Value(10)); - enum_kls->setProperty("TRIANGLE_STRIP_ADJACENCY", se::Value(11)); - enum_kls->setProperty("TRIANGLE_PATCH_ADJACENCY", se::Value(12)); - enum_kls->setProperty("QUAD_PATCH_LIST", se::Value(13)); - obj->setProperty("PrimitiveMode", se::Value(enum_kls)); + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::Size* cobj = JSB_ALLOC(cc::gfx::Size); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::Size* cobj = JSB_ALLOC(cc::gfx::Size); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::Size* cobj = JSB_ALLOC(cc::gfx::Size); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->x), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->y), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->z), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_Size_constructor, __jsb_cc_gfx_Size_class, js_cc_gfx_Size_finalize) + + + + +static bool js_cc_gfx_Size_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::Size* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_Size_finalize) + +bool js_register_gfx_Size(se::Object* obj) +{ + auto cls = se::Class::create("Size", obj, nullptr, _SE(js_gfx_Size_constructor)); + + cls->defineProperty("x", _SE(js_gfx_Size_get_x), _SE(js_gfx_Size_set_x)); + cls->defineProperty("y", _SE(js_gfx_Size_get_y), _SE(js_gfx_Size_set_y)); + cls->defineProperty("z", _SE(js_gfx_Size_get_z), _SE(js_gfx_Size_set_z)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_Size_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_Size_proto = cls->getProto(); + __jsb_cc_gfx_Size_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_DeviceCaps_proto = nullptr; +se::Class* __jsb_cc_gfx_DeviceCaps_class = nullptr; + +static bool js_gfx_DeviceCaps_get_maxVertexAttributes(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxVertexAttributes : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxVertexAttributes, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxVertexAttributes, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxVertexAttributes) + +static bool js_gfx_DeviceCaps_set_maxVertexAttributes(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxVertexAttributes : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxVertexAttributes, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxVertexAttributes : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxVertexAttributes) + +static bool js_gfx_DeviceCaps_get_maxVertexUniformVectors(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxVertexUniformVectors : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxVertexUniformVectors, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxVertexUniformVectors, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxVertexUniformVectors) + +static bool js_gfx_DeviceCaps_set_maxVertexUniformVectors(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxVertexUniformVectors : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxVertexUniformVectors, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxVertexUniformVectors : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxVertexUniformVectors) + +static bool js_gfx_DeviceCaps_get_maxFragmentUniformVectors(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxFragmentUniformVectors : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxFragmentUniformVectors, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxFragmentUniformVectors, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxFragmentUniformVectors) + +static bool js_gfx_DeviceCaps_set_maxFragmentUniformVectors(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxFragmentUniformVectors : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxFragmentUniformVectors, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxFragmentUniformVectors : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxFragmentUniformVectors) + +static bool js_gfx_DeviceCaps_get_maxTextureUnits(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxTextureUnits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxTextureUnits, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxTextureUnits, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxTextureUnits) + +static bool js_gfx_DeviceCaps_set_maxTextureUnits(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxTextureUnits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxTextureUnits, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxTextureUnits : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxTextureUnits) + +static bool js_gfx_DeviceCaps_get_maxImageUnits(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxImageUnits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxImageUnits, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxImageUnits, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxImageUnits) + +static bool js_gfx_DeviceCaps_set_maxImageUnits(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxImageUnits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxImageUnits, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxImageUnits : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxImageUnits) + +static bool js_gfx_DeviceCaps_get_maxVertexTextureUnits(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxVertexTextureUnits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxVertexTextureUnits, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxVertexTextureUnits, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxVertexTextureUnits) + +static bool js_gfx_DeviceCaps_set_maxVertexTextureUnits(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxVertexTextureUnits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxVertexTextureUnits, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxVertexTextureUnits : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxVertexTextureUnits) + +static bool js_gfx_DeviceCaps_get_maxColorRenderTargets(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxColorRenderTargets : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxColorRenderTargets, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxColorRenderTargets, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxColorRenderTargets) + +static bool js_gfx_DeviceCaps_set_maxColorRenderTargets(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxColorRenderTargets : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxColorRenderTargets, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxColorRenderTargets : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxColorRenderTargets) + +static bool js_gfx_DeviceCaps_get_maxShaderStorageBufferBindings(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxShaderStorageBufferBindings : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxShaderStorageBufferBindings, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxShaderStorageBufferBindings, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxShaderStorageBufferBindings) + +static bool js_gfx_DeviceCaps_set_maxShaderStorageBufferBindings(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxShaderStorageBufferBindings : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxShaderStorageBufferBindings, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxShaderStorageBufferBindings : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxShaderStorageBufferBindings) + +static bool js_gfx_DeviceCaps_get_maxShaderStorageBlockSize(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxShaderStorageBlockSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxShaderStorageBlockSize, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxShaderStorageBlockSize, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxShaderStorageBlockSize) + +static bool js_gfx_DeviceCaps_set_maxShaderStorageBlockSize(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxShaderStorageBlockSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxShaderStorageBlockSize, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxShaderStorageBlockSize : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxShaderStorageBlockSize) + +static bool js_gfx_DeviceCaps_get_maxUniformBufferBindings(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxUniformBufferBindings : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxUniformBufferBindings, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxUniformBufferBindings, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxUniformBufferBindings) + +static bool js_gfx_DeviceCaps_set_maxUniformBufferBindings(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxUniformBufferBindings : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxUniformBufferBindings, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxUniformBufferBindings : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxUniformBufferBindings) + +static bool js_gfx_DeviceCaps_get_maxUniformBlockSize(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxUniformBlockSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxUniformBlockSize, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxUniformBlockSize, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxUniformBlockSize) + +static bool js_gfx_DeviceCaps_set_maxUniformBlockSize(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxUniformBlockSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxUniformBlockSize, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxUniformBlockSize : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxUniformBlockSize) + +static bool js_gfx_DeviceCaps_get_maxTextureSize(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxTextureSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxTextureSize, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxTextureSize, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxTextureSize) + +static bool js_gfx_DeviceCaps_set_maxTextureSize(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxTextureSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxTextureSize, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxTextureSize : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxTextureSize) + +static bool js_gfx_DeviceCaps_get_maxCubeMapTextureSize(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxCubeMapTextureSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxCubeMapTextureSize, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxCubeMapTextureSize, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxCubeMapTextureSize) + +static bool js_gfx_DeviceCaps_set_maxCubeMapTextureSize(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxCubeMapTextureSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxCubeMapTextureSize, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxCubeMapTextureSize : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxCubeMapTextureSize) + +static bool js_gfx_DeviceCaps_get_depthBits(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_depthBits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->depthBits, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->depthBits, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_depthBits) + +static bool js_gfx_DeviceCaps_set_depthBits(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_depthBits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->depthBits, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_depthBits : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_depthBits) + +static bool js_gfx_DeviceCaps_get_stencilBits(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_stencilBits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->stencilBits, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->stencilBits, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_stencilBits) + +static bool js_gfx_DeviceCaps_set_stencilBits(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_stencilBits : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->stencilBits, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_stencilBits : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_stencilBits) + +static bool js_gfx_DeviceCaps_get_uboOffsetAlignment(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_uboOffsetAlignment : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->uboOffsetAlignment, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->uboOffsetAlignment, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_uboOffsetAlignment) + +static bool js_gfx_DeviceCaps_set_uboOffsetAlignment(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_uboOffsetAlignment : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->uboOffsetAlignment, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_uboOffsetAlignment : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_uboOffsetAlignment) + +static bool js_gfx_DeviceCaps_get_maxComputeSharedMemorySize(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxComputeSharedMemorySize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxComputeSharedMemorySize, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxComputeSharedMemorySize, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxComputeSharedMemorySize) + +static bool js_gfx_DeviceCaps_set_maxComputeSharedMemorySize(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxComputeSharedMemorySize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxComputeSharedMemorySize, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxComputeSharedMemorySize : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxComputeSharedMemorySize) + +static bool js_gfx_DeviceCaps_get_maxComputeWorkGroupInvocations(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxComputeWorkGroupInvocations : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxComputeWorkGroupInvocations, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxComputeWorkGroupInvocations, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxComputeWorkGroupInvocations) + +static bool js_gfx_DeviceCaps_set_maxComputeWorkGroupInvocations(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxComputeWorkGroupInvocations : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxComputeWorkGroupInvocations, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxComputeWorkGroupInvocations : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxComputeWorkGroupInvocations) + +static bool js_gfx_DeviceCaps_get_maxComputeWorkGroupSize(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxComputeWorkGroupSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxComputeWorkGroupSize, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxComputeWorkGroupSize, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxComputeWorkGroupSize) + +static bool js_gfx_DeviceCaps_set_maxComputeWorkGroupSize(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxComputeWorkGroupSize : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxComputeWorkGroupSize, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxComputeWorkGroupSize : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxComputeWorkGroupSize) + +static bool js_gfx_DeviceCaps_get_maxComputeWorkGroupCount(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_maxComputeWorkGroupCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxComputeWorkGroupCount, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxComputeWorkGroupCount, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_maxComputeWorkGroupCount) + +static bool js_gfx_DeviceCaps_set_maxComputeWorkGroupCount(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_maxComputeWorkGroupCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxComputeWorkGroupCount, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_maxComputeWorkGroupCount : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_maxComputeWorkGroupCount) + +static bool js_gfx_DeviceCaps_get_clipSpaceMinZ(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_clipSpaceMinZ : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->clipSpaceMinZ, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->clipSpaceMinZ, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_clipSpaceMinZ) + +static bool js_gfx_DeviceCaps_set_clipSpaceMinZ(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_clipSpaceMinZ : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->clipSpaceMinZ, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_clipSpaceMinZ : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_clipSpaceMinZ) + +static bool js_gfx_DeviceCaps_get_screenSpaceSignY(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_screenSpaceSignY : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->screenSpaceSignY, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->screenSpaceSignY, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_screenSpaceSignY) + +static bool js_gfx_DeviceCaps_set_screenSpaceSignY(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_screenSpaceSignY : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->screenSpaceSignY, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_screenSpaceSignY : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_screenSpaceSignY) + +static bool js_gfx_DeviceCaps_get_clipSpaceSignY(se::State& s) +{ + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_get_clipSpaceSignY : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->clipSpaceSignY, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->clipSpaceSignY, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceCaps_get_clipSpaceSignY) + +static bool js_gfx_DeviceCaps_set_clipSpaceSignY(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceCaps_set_clipSpaceSignY : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->clipSpaceSignY, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceCaps_set_clipSpaceSignY : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceCaps_set_clipSpaceSignY) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::DeviceCaps * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::DeviceCaps*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("maxVertexAttributes", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxVertexAttributes), ctx); + } + json->getProperty("maxVertexUniformVectors", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxVertexUniformVectors), ctx); + } + json->getProperty("maxFragmentUniformVectors", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxFragmentUniformVectors), ctx); + } + json->getProperty("maxTextureUnits", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxTextureUnits), ctx); + } + json->getProperty("maxImageUnits", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxImageUnits), ctx); + } + json->getProperty("maxVertexTextureUnits", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxVertexTextureUnits), ctx); + } + json->getProperty("maxColorRenderTargets", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxColorRenderTargets), ctx); + } + json->getProperty("maxShaderStorageBufferBindings", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxShaderStorageBufferBindings), ctx); + } + json->getProperty("maxShaderStorageBlockSize", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxShaderStorageBlockSize), ctx); + } + json->getProperty("maxUniformBufferBindings", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxUniformBufferBindings), ctx); + } + json->getProperty("maxUniformBlockSize", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxUniformBlockSize), ctx); + } + json->getProperty("maxTextureSize", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxTextureSize), ctx); + } + json->getProperty("maxCubeMapTextureSize", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxCubeMapTextureSize), ctx); + } + json->getProperty("depthBits", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->depthBits), ctx); + } + json->getProperty("stencilBits", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->stencilBits), ctx); + } + json->getProperty("uboOffsetAlignment", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->uboOffsetAlignment), ctx); + } + json->getProperty("maxComputeSharedMemorySize", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxComputeSharedMemorySize), ctx); + } + json->getProperty("maxComputeWorkGroupInvocations", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxComputeWorkGroupInvocations), ctx); + } + json->getProperty("maxComputeWorkGroupSize", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxComputeWorkGroupSize), ctx); + } + json->getProperty("maxComputeWorkGroupCount", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxComputeWorkGroupCount), ctx); + } + json->getProperty("clipSpaceMinZ", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->clipSpaceMinZ), ctx); + } + json->getProperty("screenSpaceSignY", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->screenSpaceSignY), ctx); + } + json->getProperty("clipSpaceSignY", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->clipSpaceSignY), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_DeviceCaps_finalize) + +static bool js_gfx_DeviceCaps_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::DeviceCaps* cobj = JSB_ALLOC(cc::gfx::DeviceCaps); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::DeviceCaps* cobj = JSB_ALLOC(cc::gfx::DeviceCaps); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::DeviceCaps* cobj = JSB_ALLOC(cc::gfx::DeviceCaps); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->maxVertexAttributes), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->maxVertexUniformVectors), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->maxFragmentUniformVectors), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->maxTextureUnits), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->maxImageUnits), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->maxVertexTextureUnits), nullptr); + } + if (argc > 6 && !args[6].isUndefined()) { + ok &= sevalue_to_native(args[6], &(cobj->maxColorRenderTargets), nullptr); + } + if (argc > 7 && !args[7].isUndefined()) { + ok &= sevalue_to_native(args[7], &(cobj->maxShaderStorageBufferBindings), nullptr); + } + if (argc > 8 && !args[8].isUndefined()) { + ok &= sevalue_to_native(args[8], &(cobj->maxShaderStorageBlockSize), nullptr); + } + if (argc > 9 && !args[9].isUndefined()) { + ok &= sevalue_to_native(args[9], &(cobj->maxUniformBufferBindings), nullptr); + } + if (argc > 10 && !args[10].isUndefined()) { + ok &= sevalue_to_native(args[10], &(cobj->maxUniformBlockSize), nullptr); + } + if (argc > 11 && !args[11].isUndefined()) { + ok &= sevalue_to_native(args[11], &(cobj->maxTextureSize), nullptr); + } + if (argc > 12 && !args[12].isUndefined()) { + ok &= sevalue_to_native(args[12], &(cobj->maxCubeMapTextureSize), nullptr); + } + if (argc > 13 && !args[13].isUndefined()) { + ok &= sevalue_to_native(args[13], &(cobj->depthBits), nullptr); + } + if (argc > 14 && !args[14].isUndefined()) { + ok &= sevalue_to_native(args[14], &(cobj->stencilBits), nullptr); + } + if (argc > 15 && !args[15].isUndefined()) { + ok &= sevalue_to_native(args[15], &(cobj->uboOffsetAlignment), nullptr); + } + if (argc > 16 && !args[16].isUndefined()) { + ok &= sevalue_to_native(args[16], &(cobj->maxComputeSharedMemorySize), nullptr); + } + if (argc > 17 && !args[17].isUndefined()) { + ok &= sevalue_to_native(args[17], &(cobj->maxComputeWorkGroupInvocations), nullptr); + } + if (argc > 18 && !args[18].isUndefined()) { + ok &= sevalue_to_native(args[18], &(cobj->maxComputeWorkGroupSize), nullptr); + } + if (argc > 19 && !args[19].isUndefined()) { + ok &= sevalue_to_native(args[19], &(cobj->maxComputeWorkGroupCount), nullptr); + } + if (argc > 20 && !args[20].isUndefined()) { + ok &= sevalue_to_native(args[20], &(cobj->clipSpaceMinZ), nullptr); + } + if (argc > 21 && !args[21].isUndefined()) { + ok &= sevalue_to_native(args[21], &(cobj->screenSpaceSignY), nullptr); + } + if (argc > 22 && !args[22].isUndefined()) { + ok &= sevalue_to_native(args[22], &(cobj->clipSpaceSignY), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_DeviceCaps_constructor, __jsb_cc_gfx_DeviceCaps_class, js_cc_gfx_DeviceCaps_finalize) + + + + +static bool js_cc_gfx_DeviceCaps_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::DeviceCaps* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_DeviceCaps_finalize) + +bool js_register_gfx_DeviceCaps(se::Object* obj) +{ + auto cls = se::Class::create("DeviceCaps", obj, nullptr, _SE(js_gfx_DeviceCaps_constructor)); + + cls->defineProperty("maxVertexAttributes", _SE(js_gfx_DeviceCaps_get_maxVertexAttributes), _SE(js_gfx_DeviceCaps_set_maxVertexAttributes)); + cls->defineProperty("maxVertexUniformVectors", _SE(js_gfx_DeviceCaps_get_maxVertexUniformVectors), _SE(js_gfx_DeviceCaps_set_maxVertexUniformVectors)); + cls->defineProperty("maxFragmentUniformVectors", _SE(js_gfx_DeviceCaps_get_maxFragmentUniformVectors), _SE(js_gfx_DeviceCaps_set_maxFragmentUniformVectors)); + cls->defineProperty("maxTextureUnits", _SE(js_gfx_DeviceCaps_get_maxTextureUnits), _SE(js_gfx_DeviceCaps_set_maxTextureUnits)); + cls->defineProperty("maxImageUnits", _SE(js_gfx_DeviceCaps_get_maxImageUnits), _SE(js_gfx_DeviceCaps_set_maxImageUnits)); + cls->defineProperty("maxVertexTextureUnits", _SE(js_gfx_DeviceCaps_get_maxVertexTextureUnits), _SE(js_gfx_DeviceCaps_set_maxVertexTextureUnits)); + cls->defineProperty("maxColorRenderTargets", _SE(js_gfx_DeviceCaps_get_maxColorRenderTargets), _SE(js_gfx_DeviceCaps_set_maxColorRenderTargets)); + cls->defineProperty("maxShaderStorageBufferBindings", _SE(js_gfx_DeviceCaps_get_maxShaderStorageBufferBindings), _SE(js_gfx_DeviceCaps_set_maxShaderStorageBufferBindings)); + cls->defineProperty("maxShaderStorageBlockSize", _SE(js_gfx_DeviceCaps_get_maxShaderStorageBlockSize), _SE(js_gfx_DeviceCaps_set_maxShaderStorageBlockSize)); + cls->defineProperty("maxUniformBufferBindings", _SE(js_gfx_DeviceCaps_get_maxUniformBufferBindings), _SE(js_gfx_DeviceCaps_set_maxUniformBufferBindings)); + cls->defineProperty("maxUniformBlockSize", _SE(js_gfx_DeviceCaps_get_maxUniformBlockSize), _SE(js_gfx_DeviceCaps_set_maxUniformBlockSize)); + cls->defineProperty("maxTextureSize", _SE(js_gfx_DeviceCaps_get_maxTextureSize), _SE(js_gfx_DeviceCaps_set_maxTextureSize)); + cls->defineProperty("maxCubeMapTextureSize", _SE(js_gfx_DeviceCaps_get_maxCubeMapTextureSize), _SE(js_gfx_DeviceCaps_set_maxCubeMapTextureSize)); + cls->defineProperty("depthBits", _SE(js_gfx_DeviceCaps_get_depthBits), _SE(js_gfx_DeviceCaps_set_depthBits)); + cls->defineProperty("stencilBits", _SE(js_gfx_DeviceCaps_get_stencilBits), _SE(js_gfx_DeviceCaps_set_stencilBits)); + cls->defineProperty("uboOffsetAlignment", _SE(js_gfx_DeviceCaps_get_uboOffsetAlignment), _SE(js_gfx_DeviceCaps_set_uboOffsetAlignment)); + cls->defineProperty("maxComputeSharedMemorySize", _SE(js_gfx_DeviceCaps_get_maxComputeSharedMemorySize), _SE(js_gfx_DeviceCaps_set_maxComputeSharedMemorySize)); + cls->defineProperty("maxComputeWorkGroupInvocations", _SE(js_gfx_DeviceCaps_get_maxComputeWorkGroupInvocations), _SE(js_gfx_DeviceCaps_set_maxComputeWorkGroupInvocations)); + cls->defineProperty("maxComputeWorkGroupSize", _SE(js_gfx_DeviceCaps_get_maxComputeWorkGroupSize), _SE(js_gfx_DeviceCaps_set_maxComputeWorkGroupSize)); + cls->defineProperty("maxComputeWorkGroupCount", _SE(js_gfx_DeviceCaps_get_maxComputeWorkGroupCount), _SE(js_gfx_DeviceCaps_set_maxComputeWorkGroupCount)); + cls->defineProperty("clipSpaceMinZ", _SE(js_gfx_DeviceCaps_get_clipSpaceMinZ), _SE(js_gfx_DeviceCaps_set_clipSpaceMinZ)); + cls->defineProperty("screenSpaceSignY", _SE(js_gfx_DeviceCaps_get_screenSpaceSignY), _SE(js_gfx_DeviceCaps_set_screenSpaceSignY)); + cls->defineProperty("clipSpaceSignY", _SE(js_gfx_DeviceCaps_get_clipSpaceSignY), _SE(js_gfx_DeviceCaps_set_clipSpaceSignY)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_DeviceCaps_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_DeviceCaps_proto = cls->getProto(); + __jsb_cc_gfx_DeviceCaps_class = cls; + + se::ScriptEngine::getInstance()->clearException(); return true; } se::Object* __jsb_cc_gfx_Offset_proto = nullptr; @@ -413,7 +1353,6 @@ bool js_register_gfx_Offset(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_Rect_proto = nullptr; se::Class* __jsb_cc_gfx_Rect_class = nullptr; @@ -655,7 +1594,6 @@ bool js_register_gfx_Rect(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_Extent_proto = nullptr; se::Class* __jsb_cc_gfx_Extent_class = nullptr; @@ -862,14 +1800,13 @@ bool js_register_gfx_Extent(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_TextureSubresLayers_proto = nullptr; +se::Class* __jsb_cc_gfx_TextureSubresLayers_class = nullptr; -se::Object* __jsb_cc_gfx_TextureSubres_proto = nullptr; -se::Class* __jsb_cc_gfx_TextureSubres_class = nullptr; - -static bool js_gfx_TextureSubres_get_mipLevel(se::State& s) +static bool js_gfx_TextureSubresLayers_get_mipLevel(se::State& s) { - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubres_get_mipLevel : Invalid Native Object"); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresLayers_get_mipLevel : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -878,25 +1815,25 @@ static bool js_gfx_TextureSubres_get_mipLevel(se::State& s) SE_HOLD_RETURN_VALUE(cobj->mipLevel, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_TextureSubres_get_mipLevel) +SE_BIND_PROP_GET(js_gfx_TextureSubresLayers_get_mipLevel) -static bool js_gfx_TextureSubres_set_mipLevel(se::State& s) +static bool js_gfx_TextureSubresLayers_set_mipLevel(se::State& s) { const auto& args = s.args(); - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubres_set_mipLevel : Invalid Native Object"); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresLayers_set_mipLevel : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->mipLevel, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_TextureSubres_set_mipLevel : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresLayers_set_mipLevel : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_TextureSubres_set_mipLevel) +SE_BIND_PROP_SET(js_gfx_TextureSubresLayers_set_mipLevel) -static bool js_gfx_TextureSubres_get_baseArrayLayer(se::State& s) +static bool js_gfx_TextureSubresLayers_get_baseArrayLayer(se::State& s) { - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubres_get_baseArrayLayer : Invalid Native Object"); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresLayers_get_baseArrayLayer : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -905,25 +1842,25 @@ static bool js_gfx_TextureSubres_get_baseArrayLayer(se::State& s) SE_HOLD_RETURN_VALUE(cobj->baseArrayLayer, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_TextureSubres_get_baseArrayLayer) +SE_BIND_PROP_GET(js_gfx_TextureSubresLayers_get_baseArrayLayer) -static bool js_gfx_TextureSubres_set_baseArrayLayer(se::State& s) +static bool js_gfx_TextureSubresLayers_set_baseArrayLayer(se::State& s) { const auto& args = s.args(); - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubres_set_baseArrayLayer : Invalid Native Object"); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresLayers_set_baseArrayLayer : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->baseArrayLayer, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_TextureSubres_set_baseArrayLayer : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresLayers_set_baseArrayLayer : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_TextureSubres_set_baseArrayLayer) +SE_BIND_PROP_SET(js_gfx_TextureSubresLayers_set_baseArrayLayer) -static bool js_gfx_TextureSubres_get_layerCount(se::State& s) +static bool js_gfx_TextureSubresLayers_get_layerCount(se::State& s) { - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubres_get_layerCount : Invalid Native Object"); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresLayers_get_layerCount : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -932,28 +1869,28 @@ static bool js_gfx_TextureSubres_get_layerCount(se::State& s) SE_HOLD_RETURN_VALUE(cobj->layerCount, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_TextureSubres_get_layerCount) +SE_BIND_PROP_GET(js_gfx_TextureSubresLayers_get_layerCount) -static bool js_gfx_TextureSubres_set_layerCount(se::State& s) +static bool js_gfx_TextureSubresLayers_set_layerCount(se::State& s) { const auto& args = s.args(); - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubres_set_layerCount : Invalid Native Object"); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresLayers_set_layerCount : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->layerCount, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_TextureSubres_set_layerCount : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresLayers_set_layerCount : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_TextureSubres_set_layerCount) +SE_BIND_PROP_SET(js_gfx_TextureSubresLayers_set_layerCount) template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::TextureSubres * to, se::Object *ctx) +bool sevalue_to_native(const se::Value &from, cc::gfx::TextureSubresLayers * to, se::Object *ctx) { assert(from.isObject()); se::Object *json = from.toObject(); - auto* data = (cc::gfx::TextureSubres*)json->getPrivateData(); + auto* data = (cc::gfx::TextureSubresLayers*)json->getPrivateData(); if (data) { *to = *data; return true; @@ -975,9 +1912,9 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::TextureSubres * to, se::O return ok; } -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureSubres_finalize) +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureSubresLayers_finalize) -static bool js_gfx_TextureSubres_constructor(se::State& s) +static bool js_gfx_TextureSubresLayers_constructor(se::State& s) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -985,7 +1922,7 @@ static bool js_gfx_TextureSubres_constructor(se::State& s) if(argc == 0) { - cc::gfx::TextureSubres* cobj = JSB_ALLOC(cc::gfx::TextureSubres); + cc::gfx::TextureSubresLayers* cobj = JSB_ALLOC(cc::gfx::TextureSubresLayers); s.thisObject()->setPrivateData(cobj); se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); return true; @@ -995,7 +1932,7 @@ static bool js_gfx_TextureSubres_constructor(se::State& s) se::Object *json = args[0].toObject(); se::Value field; - cc::gfx::TextureSubres* cobj = JSB_ALLOC(cc::gfx::TextureSubres); + cc::gfx::TextureSubresLayers* cobj = JSB_ALLOC(cc::gfx::TextureSubresLayers); ok &= sevalue_to_native(args[0], cobj, s.thisObject()); if(!ok) { JSB_FREE(cobj); @@ -1009,7 +1946,7 @@ static bool js_gfx_TextureSubres_constructor(se::State& s) } else { - cc::gfx::TextureSubres* cobj = JSB_ALLOC(cc::gfx::TextureSubres); + cc::gfx::TextureSubresLayers* cobj = JSB_ALLOC(cc::gfx::TextureSubresLayers); if (argc > 0 && !args[0].isUndefined()) { ok &= sevalue_to_native(args[0], &(cobj->mipLevel), nullptr); } @@ -1034,42 +1971,869 @@ static bool js_gfx_TextureSubres_constructor(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_CTOR(js_gfx_TextureSubres_constructor, __jsb_cc_gfx_TextureSubres_class, js_cc_gfx_TextureSubres_finalize) +SE_BIND_CTOR(js_gfx_TextureSubresLayers_constructor, __jsb_cc_gfx_TextureSubresLayers_class, js_cc_gfx_TextureSubresLayers_finalize) -static bool js_cc_gfx_TextureSubres_finalize(se::State& s) +static bool js_cc_gfx_TextureSubresLayers_finalize(se::State& s) { - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::TextureSubres* cobj = SE_THIS_OBJECT(s); + cc::gfx::TextureSubresLayers* cobj = SE_THIS_OBJECT(s); JSB_FREE(cobj); } return true; } -SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureSubres_finalize) +SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureSubresLayers_finalize) -bool js_register_gfx_TextureSubres(se::Object* obj) +bool js_register_gfx_TextureSubresLayers(se::Object* obj) { - auto cls = se::Class::create("TextureSubres", obj, nullptr, _SE(js_gfx_TextureSubres_constructor)); + auto cls = se::Class::create("TextureSubresLayers", obj, nullptr, _SE(js_gfx_TextureSubresLayers_constructor)); - cls->defineProperty("mipLevel", _SE(js_gfx_TextureSubres_get_mipLevel), _SE(js_gfx_TextureSubres_set_mipLevel)); - cls->defineProperty("baseArrayLayer", _SE(js_gfx_TextureSubres_get_baseArrayLayer), _SE(js_gfx_TextureSubres_set_baseArrayLayer)); - cls->defineProperty("layerCount", _SE(js_gfx_TextureSubres_get_layerCount), _SE(js_gfx_TextureSubres_set_layerCount)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureSubres_finalize)); + cls->defineProperty("mipLevel", _SE(js_gfx_TextureSubresLayers_get_mipLevel), _SE(js_gfx_TextureSubresLayers_set_mipLevel)); + cls->defineProperty("baseArrayLayer", _SE(js_gfx_TextureSubresLayers_get_baseArrayLayer), _SE(js_gfx_TextureSubresLayers_set_baseArrayLayer)); + cls->defineProperty("layerCount", _SE(js_gfx_TextureSubresLayers_get_layerCount), _SE(js_gfx_TextureSubresLayers_set_layerCount)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureSubresLayers_finalize)); cls->install(); - JSBClassType::registerClass(cls); + JSBClassType::registerClass(cls); - __jsb_cc_gfx_TextureSubres_proto = cls->getProto(); - __jsb_cc_gfx_TextureSubres_class = cls; + __jsb_cc_gfx_TextureSubresLayers_proto = cls->getProto(); + __jsb_cc_gfx_TextureSubresLayers_class = cls; se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_TextureSubresRange_proto = nullptr; +se::Class* __jsb_cc_gfx_TextureSubresRange_class = nullptr; +static bool js_gfx_TextureSubresRange_get_baseMipLevel(se::State& s) +{ + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_get_baseMipLevel : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->baseMipLevel, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->baseMipLevel, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureSubresRange_get_baseMipLevel) + +static bool js_gfx_TextureSubresRange_set_baseMipLevel(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_set_baseMipLevel : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->baseMipLevel, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresRange_set_baseMipLevel : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureSubresRange_set_baseMipLevel) + +static bool js_gfx_TextureSubresRange_get_levelCount(se::State& s) +{ + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_get_levelCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->levelCount, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->levelCount, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureSubresRange_get_levelCount) + +static bool js_gfx_TextureSubresRange_set_levelCount(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_set_levelCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->levelCount, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresRange_set_levelCount : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureSubresRange_set_levelCount) + +static bool js_gfx_TextureSubresRange_get_baseArrayLayer(se::State& s) +{ + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_get_baseArrayLayer : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->baseArrayLayer, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->baseArrayLayer, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureSubresRange_get_baseArrayLayer) + +static bool js_gfx_TextureSubresRange_set_baseArrayLayer(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_set_baseArrayLayer : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->baseArrayLayer, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresRange_set_baseArrayLayer : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureSubresRange_set_baseArrayLayer) + +static bool js_gfx_TextureSubresRange_get_layerCount(se::State& s) +{ + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_get_layerCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->layerCount, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->layerCount, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureSubresRange_get_layerCount) + +static bool js_gfx_TextureSubresRange_set_layerCount(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureSubresRange_set_layerCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->layerCount, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureSubresRange_set_layerCount : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureSubresRange_set_layerCount) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::TextureSubresRange * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::TextureSubresRange*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("baseMipLevel", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->baseMipLevel), ctx); + } + json->getProperty("levelCount", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->levelCount), ctx); + } + json->getProperty("baseArrayLayer", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->baseArrayLayer), ctx); + } + json->getProperty("layerCount", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->layerCount), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureSubresRange_finalize) + +static bool js_gfx_TextureSubresRange_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::TextureSubresRange* cobj = JSB_ALLOC(cc::gfx::TextureSubresRange); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::TextureSubresRange* cobj = JSB_ALLOC(cc::gfx::TextureSubresRange); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::TextureSubresRange* cobj = JSB_ALLOC(cc::gfx::TextureSubresRange); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->baseMipLevel), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->levelCount), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->baseArrayLayer), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->layerCount), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_TextureSubresRange_constructor, __jsb_cc_gfx_TextureSubresRange_class, js_cc_gfx_TextureSubresRange_finalize) + + + + +static bool js_cc_gfx_TextureSubresRange_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::TextureSubresRange* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureSubresRange_finalize) + +bool js_register_gfx_TextureSubresRange(se::Object* obj) +{ + auto cls = se::Class::create("TextureSubresRange", obj, nullptr, _SE(js_gfx_TextureSubresRange_constructor)); + + cls->defineProperty("baseMipLevel", _SE(js_gfx_TextureSubresRange_get_baseMipLevel), _SE(js_gfx_TextureSubresRange_set_baseMipLevel)); + cls->defineProperty("levelCount", _SE(js_gfx_TextureSubresRange_get_levelCount), _SE(js_gfx_TextureSubresRange_set_levelCount)); + cls->defineProperty("baseArrayLayer", _SE(js_gfx_TextureSubresRange_get_baseArrayLayer), _SE(js_gfx_TextureSubresRange_set_baseArrayLayer)); + cls->defineProperty("layerCount", _SE(js_gfx_TextureSubresRange_get_layerCount), _SE(js_gfx_TextureSubresRange_set_layerCount)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureSubresRange_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_TextureSubresRange_proto = cls->getProto(); + __jsb_cc_gfx_TextureSubresRange_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_TextureCopy_proto = nullptr; +se::Class* __jsb_cc_gfx_TextureCopy_class = nullptr; + +static bool js_gfx_TextureCopy_get_srcSubres(se::State& s) +{ + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_get_srcSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->srcSubres, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->srcSubres, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureCopy_get_srcSubres) + +static bool js_gfx_TextureCopy_set_srcSubres(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_set_srcSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->srcSubres, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureCopy_set_srcSubres : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureCopy_set_srcSubres) + +static bool js_gfx_TextureCopy_get_srcOffset(se::State& s) +{ + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_get_srcOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->srcOffset, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->srcOffset, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureCopy_get_srcOffset) + +static bool js_gfx_TextureCopy_set_srcOffset(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_set_srcOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->srcOffset, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureCopy_set_srcOffset : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureCopy_set_srcOffset) + +static bool js_gfx_TextureCopy_get_dstSubres(se::State& s) +{ + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_get_dstSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dstSubres, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dstSubres, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureCopy_get_dstSubres) + +static bool js_gfx_TextureCopy_set_dstSubres(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_set_dstSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dstSubres, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureCopy_set_dstSubres : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureCopy_set_dstSubres) + +static bool js_gfx_TextureCopy_get_dstOffset(se::State& s) +{ + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_get_dstOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dstOffset, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dstOffset, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureCopy_get_dstOffset) + +static bool js_gfx_TextureCopy_set_dstOffset(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_set_dstOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dstOffset, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureCopy_set_dstOffset : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureCopy_set_dstOffset) + +static bool js_gfx_TextureCopy_get_extent(se::State& s) +{ + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_get_extent : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->extent, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->extent, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureCopy_get_extent) + +static bool js_gfx_TextureCopy_set_extent(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureCopy_set_extent : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->extent, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureCopy_set_extent : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureCopy_set_extent) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::TextureCopy * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::TextureCopy*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("srcSubres", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->srcSubres), ctx); + } + json->getProperty("srcOffset", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->srcOffset), ctx); + } + json->getProperty("dstSubres", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dstSubres), ctx); + } + json->getProperty("dstOffset", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dstOffset), ctx); + } + json->getProperty("extent", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->extent), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureCopy_finalize) + +static bool js_gfx_TextureCopy_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::TextureCopy* cobj = JSB_ALLOC(cc::gfx::TextureCopy); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::TextureCopy* cobj = JSB_ALLOC(cc::gfx::TextureCopy); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::TextureCopy* cobj = JSB_ALLOC(cc::gfx::TextureCopy); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->srcSubres), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->srcOffset), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->dstSubres), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->dstOffset), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->extent), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_TextureCopy_constructor, __jsb_cc_gfx_TextureCopy_class, js_cc_gfx_TextureCopy_finalize) + + + + +static bool js_cc_gfx_TextureCopy_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::TextureCopy* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureCopy_finalize) + +bool js_register_gfx_TextureCopy(se::Object* obj) +{ + auto cls = se::Class::create("TextureCopy", obj, nullptr, _SE(js_gfx_TextureCopy_constructor)); + + cls->defineProperty("srcSubres", _SE(js_gfx_TextureCopy_get_srcSubres), _SE(js_gfx_TextureCopy_set_srcSubres)); + cls->defineProperty("srcOffset", _SE(js_gfx_TextureCopy_get_srcOffset), _SE(js_gfx_TextureCopy_set_srcOffset)); + cls->defineProperty("dstSubres", _SE(js_gfx_TextureCopy_get_dstSubres), _SE(js_gfx_TextureCopy_set_dstSubres)); + cls->defineProperty("dstOffset", _SE(js_gfx_TextureCopy_get_dstOffset), _SE(js_gfx_TextureCopy_set_dstOffset)); + cls->defineProperty("extent", _SE(js_gfx_TextureCopy_get_extent), _SE(js_gfx_TextureCopy_set_extent)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureCopy_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_TextureCopy_proto = cls->getProto(); + __jsb_cc_gfx_TextureCopy_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_TextureBlit_proto = nullptr; +se::Class* __jsb_cc_gfx_TextureBlit_class = nullptr; + +static bool js_gfx_TextureBlit_get_srcSubres(se::State& s) +{ + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_get_srcSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->srcSubres, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->srcSubres, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBlit_get_srcSubres) + +static bool js_gfx_TextureBlit_set_srcSubres(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_set_srcSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->srcSubres, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBlit_set_srcSubres : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBlit_set_srcSubres) + +static bool js_gfx_TextureBlit_get_srcOffset(se::State& s) +{ + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_get_srcOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->srcOffset, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->srcOffset, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBlit_get_srcOffset) + +static bool js_gfx_TextureBlit_set_srcOffset(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_set_srcOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->srcOffset, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBlit_set_srcOffset : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBlit_set_srcOffset) + +static bool js_gfx_TextureBlit_get_srcExtent(se::State& s) +{ + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_get_srcExtent : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->srcExtent, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->srcExtent, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBlit_get_srcExtent) + +static bool js_gfx_TextureBlit_set_srcExtent(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_set_srcExtent : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->srcExtent, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBlit_set_srcExtent : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBlit_set_srcExtent) + +static bool js_gfx_TextureBlit_get_dstSubres(se::State& s) +{ + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_get_dstSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dstSubres, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dstSubres, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBlit_get_dstSubres) + +static bool js_gfx_TextureBlit_set_dstSubres(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_set_dstSubres : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dstSubres, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBlit_set_dstSubres : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBlit_set_dstSubres) + +static bool js_gfx_TextureBlit_get_dstOffset(se::State& s) +{ + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_get_dstOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dstOffset, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dstOffset, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBlit_get_dstOffset) + +static bool js_gfx_TextureBlit_set_dstOffset(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_set_dstOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dstOffset, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBlit_set_dstOffset : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBlit_set_dstOffset) + +static bool js_gfx_TextureBlit_get_dstExtent(se::State& s) +{ + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_get_dstExtent : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dstExtent, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dstExtent, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBlit_get_dstExtent) + +static bool js_gfx_TextureBlit_set_dstExtent(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBlit_set_dstExtent : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dstExtent, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBlit_set_dstExtent : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBlit_set_dstExtent) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::TextureBlit * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::TextureBlit*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("srcSubres", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->srcSubres), ctx); + } + json->getProperty("srcOffset", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->srcOffset), ctx); + } + json->getProperty("srcExtent", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->srcExtent), ctx); + } + json->getProperty("dstSubres", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dstSubres), ctx); + } + json->getProperty("dstOffset", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dstOffset), ctx); + } + json->getProperty("dstExtent", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dstExtent), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureBlit_finalize) + +static bool js_gfx_TextureBlit_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::TextureBlit* cobj = JSB_ALLOC(cc::gfx::TextureBlit); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::TextureBlit* cobj = JSB_ALLOC(cc::gfx::TextureBlit); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::TextureBlit* cobj = JSB_ALLOC(cc::gfx::TextureBlit); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->srcSubres), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->srcOffset), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->srcExtent), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->dstSubres), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->dstOffset), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->dstExtent), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_TextureBlit_constructor, __jsb_cc_gfx_TextureBlit_class, js_cc_gfx_TextureBlit_finalize) + + + + +static bool js_cc_gfx_TextureBlit_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::TextureBlit* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureBlit_finalize) + +bool js_register_gfx_TextureBlit(se::Object* obj) +{ + auto cls = se::Class::create("TextureBlit", obj, nullptr, _SE(js_gfx_TextureBlit_constructor)); + + cls->defineProperty("srcSubres", _SE(js_gfx_TextureBlit_get_srcSubres), _SE(js_gfx_TextureBlit_set_srcSubres)); + cls->defineProperty("srcOffset", _SE(js_gfx_TextureBlit_get_srcOffset), _SE(js_gfx_TextureBlit_set_srcOffset)); + cls->defineProperty("srcExtent", _SE(js_gfx_TextureBlit_get_srcExtent), _SE(js_gfx_TextureBlit_set_srcExtent)); + cls->defineProperty("dstSubres", _SE(js_gfx_TextureBlit_get_dstSubres), _SE(js_gfx_TextureBlit_set_dstSubres)); + cls->defineProperty("dstOffset", _SE(js_gfx_TextureBlit_get_dstOffset), _SE(js_gfx_TextureBlit_set_dstOffset)); + cls->defineProperty("dstExtent", _SE(js_gfx_TextureBlit_get_dstExtent), _SE(js_gfx_TextureBlit_set_dstExtent)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureBlit_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_TextureBlit_proto = cls->getProto(); + __jsb_cc_gfx_TextureBlit_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_BufferTextureCopy_proto = nullptr; se::Class* __jsb_cc_gfx_BufferTextureCopy_class = nullptr; @@ -1346,7 +3110,317 @@ bool js_register_gfx_BufferTextureCopy(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_Viewport_proto = nullptr; +se::Class* __jsb_cc_gfx_Viewport_class = nullptr; +static bool js_gfx_Viewport_get_left(se::State& s) +{ + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_get_left : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->left, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->left, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Viewport_get_left) + +static bool js_gfx_Viewport_set_left(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_set_left : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->left, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Viewport_set_left : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Viewport_set_left) + +static bool js_gfx_Viewport_get_top(se::State& s) +{ + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_get_top : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->top, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->top, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Viewport_get_top) + +static bool js_gfx_Viewport_set_top(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_set_top : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->top, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Viewport_set_top : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Viewport_set_top) + +static bool js_gfx_Viewport_get_width(se::State& s) +{ + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_get_width : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->width, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->width, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Viewport_get_width) + +static bool js_gfx_Viewport_set_width(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_set_width : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->width, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Viewport_set_width : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Viewport_set_width) + +static bool js_gfx_Viewport_get_height(se::State& s) +{ + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_get_height : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->height, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->height, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Viewport_get_height) + +static bool js_gfx_Viewport_set_height(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_set_height : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->height, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Viewport_set_height : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Viewport_set_height) + +static bool js_gfx_Viewport_get_minDepth(se::State& s) +{ + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_get_minDepth : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->minDepth, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->minDepth, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Viewport_get_minDepth) + +static bool js_gfx_Viewport_set_minDepth(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_set_minDepth : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->minDepth, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Viewport_set_minDepth : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Viewport_set_minDepth) + +static bool js_gfx_Viewport_get_maxDepth(se::State& s) +{ + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_get_maxDepth : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->maxDepth, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->maxDepth, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_Viewport_get_maxDepth) + +static bool js_gfx_Viewport_set_maxDepth(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Viewport_set_maxDepth : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->maxDepth, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Viewport_set_maxDepth : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_Viewport_set_maxDepth) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::Viewport * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::Viewport*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("left", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->left), ctx); + } + json->getProperty("top", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->top), ctx); + } + json->getProperty("width", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->width), ctx); + } + json->getProperty("height", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->height), ctx); + } + json->getProperty("minDepth", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->minDepth), ctx); + } + json->getProperty("maxDepth", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->maxDepth), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Viewport_finalize) + +static bool js_gfx_Viewport_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::Viewport* cobj = JSB_ALLOC(cc::gfx::Viewport); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::Viewport* cobj = JSB_ALLOC(cc::gfx::Viewport); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::Viewport* cobj = JSB_ALLOC(cc::gfx::Viewport); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->left), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->top), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->width), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->height), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->minDepth), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->maxDepth), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_Viewport_constructor, __jsb_cc_gfx_Viewport_class, js_cc_gfx_Viewport_finalize) + + + + +static bool js_cc_gfx_Viewport_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::Viewport* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_Viewport_finalize) + +bool js_register_gfx_Viewport(se::Object* obj) +{ + auto cls = se::Class::create("Viewport", obj, nullptr, _SE(js_gfx_Viewport_constructor)); + + cls->defineProperty("left", _SE(js_gfx_Viewport_get_left), _SE(js_gfx_Viewport_set_left)); + cls->defineProperty("top", _SE(js_gfx_Viewport_get_top), _SE(js_gfx_Viewport_set_top)); + cls->defineProperty("width", _SE(js_gfx_Viewport_get_width), _SE(js_gfx_Viewport_set_width)); + cls->defineProperty("height", _SE(js_gfx_Viewport_get_height), _SE(js_gfx_Viewport_set_height)); + cls->defineProperty("minDepth", _SE(js_gfx_Viewport_get_minDepth), _SE(js_gfx_Viewport_set_minDepth)); + cls->defineProperty("maxDepth", _SE(js_gfx_Viewport_get_maxDepth), _SE(js_gfx_Viewport_set_maxDepth)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_Viewport_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_Viewport_proto = cls->getProto(); + __jsb_cc_gfx_Viewport_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_Color_proto = nullptr; se::Class* __jsb_cc_gfx_Color_class = nullptr; @@ -1588,7 +3662,6 @@ bool js_register_gfx_Color(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_BindingMappingInfo_proto = nullptr; se::Class* __jsb_cc_gfx_BindingMappingInfo_class = nullptr; @@ -1795,561 +3868,6 @@ bool js_register_gfx_BindingMappingInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - -se::Object* __jsb_cc_gfx_DeviceInfo_proto = nullptr; -se::Class* __jsb_cc_gfx_DeviceInfo_class = nullptr; - -static bool js_gfx_DeviceInfo_get_windowHandle(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_windowHandle : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->windowHandle, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->windowHandle, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_windowHandle) - -static bool js_gfx_DeviceInfo_set_windowHandle(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_windowHandle : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->windowHandle, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_windowHandle : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_windowHandle) - -static bool js_gfx_DeviceInfo_get_width(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_width : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->width, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->width, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_width) - -static bool js_gfx_DeviceInfo_set_width(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_width : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->width, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_width : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_width) - -static bool js_gfx_DeviceInfo_get_height(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_height : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->height, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->height, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_height) - -static bool js_gfx_DeviceInfo_set_height(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_height : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->height, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_height : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_height) - -static bool js_gfx_DeviceInfo_get_nativeWidth(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_nativeWidth : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->nativeWidth, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->nativeWidth, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_nativeWidth) - -static bool js_gfx_DeviceInfo_set_nativeWidth(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_nativeWidth : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->nativeWidth, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_nativeWidth : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_nativeWidth) - -static bool js_gfx_DeviceInfo_get_nativeHeight(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_nativeHeight : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->nativeHeight, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->nativeHeight, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_nativeHeight) - -static bool js_gfx_DeviceInfo_set_nativeHeight(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_nativeHeight : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->nativeHeight, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_nativeHeight : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_nativeHeight) - -static bool js_gfx_DeviceInfo_get_sharedCtx(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_sharedCtx : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->sharedCtx, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->sharedCtx, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_sharedCtx) - -static bool js_gfx_DeviceInfo_set_sharedCtx(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_sharedCtx : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->sharedCtx, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_sharedCtx : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_sharedCtx) - -static bool js_gfx_DeviceInfo_get_bindingMappingInfo(se::State& s) -{ - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_bindingMappingInfo : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->bindingMappingInfo, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->bindingMappingInfo, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_bindingMappingInfo) - -static bool js_gfx_DeviceInfo_set_bindingMappingInfo(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_bindingMappingInfo : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->bindingMappingInfo, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_bindingMappingInfo : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_bindingMappingInfo) - - -template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::DeviceInfo * to, se::Object *ctx) -{ - assert(from.isObject()); - se::Object *json = from.toObject(); - auto* data = (cc::gfx::DeviceInfo*)json->getPrivateData(); - if (data) { - *to = *data; - return true; - } - se::Value field; - bool ok = true; - json->getProperty("windowHandle", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->windowHandle), ctx); - } - json->getProperty("width", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->width), ctx); - } - json->getProperty("height", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->height), ctx); - } - json->getProperty("nativeWidth", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->nativeWidth), ctx); - } - json->getProperty("nativeHeight", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->nativeHeight), ctx); - } - json->getProperty("sharedCtx", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->sharedCtx), ctx); - } - json->getProperty("bindingMappingInfo", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->bindingMappingInfo), ctx); - } - return ok; -} - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_DeviceInfo_finalize) - -static bool js_gfx_DeviceInfo_constructor(se::State& s) -{ - CC_UNUSED bool ok = true; - const auto& args = s.args(); - size_t argc = args.size(); - - if(argc == 0) - { - cc::gfx::DeviceInfo* cobj = JSB_ALLOC(cc::gfx::DeviceInfo); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else if(argc == 1 && args[0].isObject()) - { - se::Object *json = args[0].toObject(); - se::Value field; - - cc::gfx::DeviceInfo* cobj = JSB_ALLOC(cc::gfx::DeviceInfo); - ok &= sevalue_to_native(args[0], cobj, s.thisObject()); - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else - { - cc::gfx::DeviceInfo* cobj = JSB_ALLOC(cc::gfx::DeviceInfo); - if (argc > 0 && !args[0].isUndefined()) { - ok &= sevalue_to_native(args[0], &(cobj->windowHandle), nullptr); - } - if (argc > 1 && !args[1].isUndefined()) { - ok &= sevalue_to_native(args[1], &(cobj->width), nullptr); - } - if (argc > 2 && !args[2].isUndefined()) { - ok &= sevalue_to_native(args[2], &(cobj->height), nullptr); - } - if (argc > 3 && !args[3].isUndefined()) { - ok &= sevalue_to_native(args[3], &(cobj->nativeWidth), nullptr); - } - if (argc > 4 && !args[4].isUndefined()) { - ok &= sevalue_to_native(args[4], &(cobj->nativeHeight), nullptr); - } - if (argc > 5 && !args[5].isUndefined()) { - ok &= sevalue_to_native(args[5], &(cobj->sharedCtx), nullptr); - } - if (argc > 6 && !args[6].isUndefined()) { - ok &= sevalue_to_native(args[6], &(cobj->bindingMappingInfo), nullptr); - } - - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("Argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; -} -SE_BIND_CTOR(js_gfx_DeviceInfo_constructor, __jsb_cc_gfx_DeviceInfo_class, js_cc_gfx_DeviceInfo_finalize) - - - - -static bool js_cc_gfx_DeviceInfo_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_DeviceInfo_finalize) - -bool js_register_gfx_DeviceInfo(se::Object* obj) -{ - auto cls = se::Class::create("DeviceInfo", obj, nullptr, _SE(js_gfx_DeviceInfo_constructor)); - - cls->defineProperty("windowHandle", _SE(js_gfx_DeviceInfo_get_windowHandle), _SE(js_gfx_DeviceInfo_set_windowHandle)); - cls->defineProperty("width", _SE(js_gfx_DeviceInfo_get_width), _SE(js_gfx_DeviceInfo_set_width)); - cls->defineProperty("height", _SE(js_gfx_DeviceInfo_get_height), _SE(js_gfx_DeviceInfo_set_height)); - cls->defineProperty("nativeWidth", _SE(js_gfx_DeviceInfo_get_nativeWidth), _SE(js_gfx_DeviceInfo_set_nativeWidth)); - cls->defineProperty("nativeHeight", _SE(js_gfx_DeviceInfo_get_nativeHeight), _SE(js_gfx_DeviceInfo_set_nativeHeight)); - cls->defineProperty("sharedCtx", _SE(js_gfx_DeviceInfo_get_sharedCtx), _SE(js_gfx_DeviceInfo_set_sharedCtx)); - cls->defineProperty("bindingMappingInfo", _SE(js_gfx_DeviceInfo_get_bindingMappingInfo), _SE(js_gfx_DeviceInfo_set_bindingMappingInfo)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_DeviceInfo_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_DeviceInfo_proto = cls->getProto(); - __jsb_cc_gfx_DeviceInfo_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -se::Object* __jsb_cc_gfx_ContextInfo_proto = nullptr; -se::Class* __jsb_cc_gfx_ContextInfo_class = nullptr; - -static bool js_gfx_ContextInfo_get_windowHandle(se::State& s) -{ - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ContextInfo_get_windowHandle : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->windowHandle, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->windowHandle, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_ContextInfo_get_windowHandle) - -static bool js_gfx_ContextInfo_set_windowHandle(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ContextInfo_set_windowHandle : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->windowHandle, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ContextInfo_set_windowHandle : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_ContextInfo_set_windowHandle) - -static bool js_gfx_ContextInfo_get_sharedCtx(se::State& s) -{ - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ContextInfo_get_sharedCtx : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->sharedCtx, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->sharedCtx, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_ContextInfo_get_sharedCtx) - -static bool js_gfx_ContextInfo_set_sharedCtx(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ContextInfo_set_sharedCtx : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->sharedCtx, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ContextInfo_set_sharedCtx : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_ContextInfo_set_sharedCtx) - -static bool js_gfx_ContextInfo_get_vsyncMode(se::State& s) -{ - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ContextInfo_get_vsyncMode : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->vsyncMode, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->vsyncMode, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_ContextInfo_get_vsyncMode) - -static bool js_gfx_ContextInfo_set_vsyncMode(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ContextInfo_set_vsyncMode : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->vsyncMode, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ContextInfo_set_vsyncMode : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_ContextInfo_set_vsyncMode) - - -template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::ContextInfo * to, se::Object *ctx) -{ - assert(from.isObject()); - se::Object *json = from.toObject(); - auto* data = (cc::gfx::ContextInfo*)json->getPrivateData(); - if (data) { - *to = *data; - return true; - } - se::Value field; - bool ok = true; - json->getProperty("windowHandle", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->windowHandle), ctx); - } - json->getProperty("sharedCtx", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->sharedCtx), ctx); - } - json->getProperty("vsyncMode", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->vsyncMode), ctx); - } - return ok; -} - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_ContextInfo_finalize) - -static bool js_gfx_ContextInfo_constructor(se::State& s) -{ - CC_UNUSED bool ok = true; - const auto& args = s.args(); - size_t argc = args.size(); - - if(argc == 0) - { - cc::gfx::ContextInfo* cobj = JSB_ALLOC(cc::gfx::ContextInfo); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else if(argc == 1 && args[0].isObject()) - { - se::Object *json = args[0].toObject(); - se::Value field; - - cc::gfx::ContextInfo* cobj = JSB_ALLOC(cc::gfx::ContextInfo); - ok &= sevalue_to_native(args[0], cobj, s.thisObject()); - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else - { - cc::gfx::ContextInfo* cobj = JSB_ALLOC(cc::gfx::ContextInfo); - if (argc > 0 && !args[0].isUndefined()) { - ok &= sevalue_to_native(args[0], &(cobj->windowHandle), nullptr); - } - if (argc > 1 && !args[1].isUndefined()) { - ok &= sevalue_to_native(args[1], &(cobj->sharedCtx), nullptr); - } - if (argc > 2 && !args[2].isUndefined()) { - ok &= sevalue_to_native(args[2], &(cobj->vsyncMode), nullptr); - } - - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("Argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; -} -SE_BIND_CTOR(js_gfx_ContextInfo_constructor, __jsb_cc_gfx_ContextInfo_class, js_cc_gfx_ContextInfo_finalize) - - - - -static bool js_cc_gfx_ContextInfo_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::ContextInfo* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_ContextInfo_finalize) - -bool js_register_gfx_ContextInfo(se::Object* obj) -{ - auto cls = se::Class::create("ContextInfo", obj, nullptr, _SE(js_gfx_ContextInfo_constructor)); - - cls->defineProperty("windowHandle", _SE(js_gfx_ContextInfo_get_windowHandle), _SE(js_gfx_ContextInfo_set_windowHandle)); - cls->defineProperty("sharedCtx", _SE(js_gfx_ContextInfo_get_sharedCtx), _SE(js_gfx_ContextInfo_set_sharedCtx)); - cls->defineProperty("vsyncMode", _SE(js_gfx_ContextInfo_get_vsyncMode), _SE(js_gfx_ContextInfo_set_vsyncMode)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_ContextInfo_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_ContextInfo_proto = cls->getProto(); - __jsb_cc_gfx_ContextInfo_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - se::Object* __jsb_cc_gfx_BufferInfo_proto = nullptr; se::Class* __jsb_cc_gfx_BufferInfo_class = nullptr; @@ -2626,7 +4144,6 @@ bool js_register_gfx_BufferInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_BufferViewInfo_proto = nullptr; se::Class* __jsb_cc_gfx_BufferViewInfo_class = nullptr; @@ -2833,7 +4350,747 @@ bool js_register_gfx_BufferViewInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_DrawInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_DrawInfo_class = nullptr; +static bool js_gfx_DrawInfo_get_vertexCount(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_vertexCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->vertexCount, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->vertexCount, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_vertexCount) + +static bool js_gfx_DrawInfo_set_vertexCount(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_vertexCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->vertexCount, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_vertexCount : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_vertexCount) + +static bool js_gfx_DrawInfo_get_firstVertex(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_firstVertex : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->firstVertex, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->firstVertex, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_firstVertex) + +static bool js_gfx_DrawInfo_set_firstVertex(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_firstVertex : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->firstVertex, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_firstVertex : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_firstVertex) + +static bool js_gfx_DrawInfo_get_indexCount(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_indexCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->indexCount, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->indexCount, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_indexCount) + +static bool js_gfx_DrawInfo_set_indexCount(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_indexCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->indexCount, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_indexCount : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_indexCount) + +static bool js_gfx_DrawInfo_get_firstIndex(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_firstIndex : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->firstIndex, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->firstIndex, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_firstIndex) + +static bool js_gfx_DrawInfo_set_firstIndex(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_firstIndex : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->firstIndex, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_firstIndex : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_firstIndex) + +static bool js_gfx_DrawInfo_get_vertexOffset(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_vertexOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->vertexOffset, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->vertexOffset, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_vertexOffset) + +static bool js_gfx_DrawInfo_set_vertexOffset(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_vertexOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->vertexOffset, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_vertexOffset : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_vertexOffset) + +static bool js_gfx_DrawInfo_get_instanceCount(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_instanceCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->instanceCount, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->instanceCount, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_instanceCount) + +static bool js_gfx_DrawInfo_set_instanceCount(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_instanceCount : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->instanceCount, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_instanceCount : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_instanceCount) + +static bool js_gfx_DrawInfo_get_firstInstance(se::State& s) +{ + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_get_firstInstance : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->firstInstance, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->firstInstance, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DrawInfo_get_firstInstance) + +static bool js_gfx_DrawInfo_set_firstInstance(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DrawInfo_set_firstInstance : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->firstInstance, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DrawInfo_set_firstInstance : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DrawInfo_set_firstInstance) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::DrawInfo * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::DrawInfo*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("vertexCount", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->vertexCount), ctx); + } + json->getProperty("firstVertex", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->firstVertex), ctx); + } + json->getProperty("indexCount", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->indexCount), ctx); + } + json->getProperty("firstIndex", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->firstIndex), ctx); + } + json->getProperty("vertexOffset", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->vertexOffset), ctx); + } + json->getProperty("instanceCount", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->instanceCount), ctx); + } + json->getProperty("firstInstance", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->firstInstance), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_DrawInfo_finalize) + +static bool js_gfx_DrawInfo_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::DrawInfo* cobj = JSB_ALLOC(cc::gfx::DrawInfo); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::DrawInfo* cobj = JSB_ALLOC(cc::gfx::DrawInfo); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::DrawInfo* cobj = JSB_ALLOC(cc::gfx::DrawInfo); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->vertexCount), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->firstVertex), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->indexCount), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->firstIndex), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->vertexOffset), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->instanceCount), nullptr); + } + if (argc > 6 && !args[6].isUndefined()) { + ok &= sevalue_to_native(args[6], &(cobj->firstInstance), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_DrawInfo_constructor, __jsb_cc_gfx_DrawInfo_class, js_cc_gfx_DrawInfo_finalize) + + + + +static bool js_cc_gfx_DrawInfo_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::DrawInfo* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_DrawInfo_finalize) + +bool js_register_gfx_DrawInfo(se::Object* obj) +{ + auto cls = se::Class::create("DrawInfo", obj, nullptr, _SE(js_gfx_DrawInfo_constructor)); + + cls->defineProperty("vertexCount", _SE(js_gfx_DrawInfo_get_vertexCount), _SE(js_gfx_DrawInfo_set_vertexCount)); + cls->defineProperty("firstVertex", _SE(js_gfx_DrawInfo_get_firstVertex), _SE(js_gfx_DrawInfo_set_firstVertex)); + cls->defineProperty("indexCount", _SE(js_gfx_DrawInfo_get_indexCount), _SE(js_gfx_DrawInfo_set_indexCount)); + cls->defineProperty("firstIndex", _SE(js_gfx_DrawInfo_get_firstIndex), _SE(js_gfx_DrawInfo_set_firstIndex)); + cls->defineProperty("vertexOffset", _SE(js_gfx_DrawInfo_get_vertexOffset), _SE(js_gfx_DrawInfo_set_vertexOffset)); + cls->defineProperty("instanceCount", _SE(js_gfx_DrawInfo_get_instanceCount), _SE(js_gfx_DrawInfo_set_instanceCount)); + cls->defineProperty("firstInstance", _SE(js_gfx_DrawInfo_get_firstInstance), _SE(js_gfx_DrawInfo_set_firstInstance)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_DrawInfo_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_DrawInfo_proto = cls->getProto(); + __jsb_cc_gfx_DrawInfo_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_DispatchInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_DispatchInfo_class = nullptr; + +static bool js_gfx_DispatchInfo_get_groupCountX(se::State& s) +{ + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_get_groupCountX : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->groupCountX, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->groupCountX, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DispatchInfo_get_groupCountX) + +static bool js_gfx_DispatchInfo_set_groupCountX(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_set_groupCountX : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->groupCountX, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DispatchInfo_set_groupCountX : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DispatchInfo_set_groupCountX) + +static bool js_gfx_DispatchInfo_get_groupCountY(se::State& s) +{ + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_get_groupCountY : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->groupCountY, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->groupCountY, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DispatchInfo_get_groupCountY) + +static bool js_gfx_DispatchInfo_set_groupCountY(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_set_groupCountY : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->groupCountY, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DispatchInfo_set_groupCountY : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DispatchInfo_set_groupCountY) + +static bool js_gfx_DispatchInfo_get_groupCountZ(se::State& s) +{ + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_get_groupCountZ : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->groupCountZ, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->groupCountZ, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DispatchInfo_get_groupCountZ) + +static bool js_gfx_DispatchInfo_set_groupCountZ(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_set_groupCountZ : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->groupCountZ, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DispatchInfo_set_groupCountZ : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DispatchInfo_set_groupCountZ) + +static bool js_gfx_DispatchInfo_get_indirectBuffer(se::State& s) +{ + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_get_indirectBuffer : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->indirectBuffer, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->indirectBuffer, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DispatchInfo_get_indirectBuffer) + +static bool js_gfx_DispatchInfo_set_indirectBuffer(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_set_indirectBuffer : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->indirectBuffer, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DispatchInfo_set_indirectBuffer : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DispatchInfo_set_indirectBuffer) + +static bool js_gfx_DispatchInfo_get_indirectOffset(se::State& s) +{ + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_get_indirectOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->indirectOffset, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->indirectOffset, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DispatchInfo_get_indirectOffset) + +static bool js_gfx_DispatchInfo_set_indirectOffset(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DispatchInfo_set_indirectOffset : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->indirectOffset, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DispatchInfo_set_indirectOffset : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DispatchInfo_set_indirectOffset) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::DispatchInfo * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::DispatchInfo*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("groupCountX", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->groupCountX), ctx); + } + json->getProperty("groupCountY", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->groupCountY), ctx); + } + json->getProperty("groupCountZ", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->groupCountZ), ctx); + } + json->getProperty("indirectBuffer", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->indirectBuffer), ctx); + } + json->getProperty("indirectOffset", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->indirectOffset), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_DispatchInfo_finalize) + +static bool js_gfx_DispatchInfo_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::DispatchInfo* cobj = JSB_ALLOC(cc::gfx::DispatchInfo); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::DispatchInfo* cobj = JSB_ALLOC(cc::gfx::DispatchInfo); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::DispatchInfo* cobj = JSB_ALLOC(cc::gfx::DispatchInfo); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->groupCountX), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->groupCountY), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->groupCountZ), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->indirectBuffer), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->indirectOffset), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_DispatchInfo_constructor, __jsb_cc_gfx_DispatchInfo_class, js_cc_gfx_DispatchInfo_finalize) + + + + +static bool js_cc_gfx_DispatchInfo_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::DispatchInfo* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_DispatchInfo_finalize) + +bool js_register_gfx_DispatchInfo(se::Object* obj) +{ + auto cls = se::Class::create("DispatchInfo", obj, nullptr, _SE(js_gfx_DispatchInfo_constructor)); + + cls->defineProperty("groupCountX", _SE(js_gfx_DispatchInfo_get_groupCountX), _SE(js_gfx_DispatchInfo_set_groupCountX)); + cls->defineProperty("groupCountY", _SE(js_gfx_DispatchInfo_get_groupCountY), _SE(js_gfx_DispatchInfo_set_groupCountY)); + cls->defineProperty("groupCountZ", _SE(js_gfx_DispatchInfo_get_groupCountZ), _SE(js_gfx_DispatchInfo_set_groupCountZ)); + cls->defineProperty("indirectBuffer", _SE(js_gfx_DispatchInfo_get_indirectBuffer), _SE(js_gfx_DispatchInfo_set_indirectBuffer)); + cls->defineProperty("indirectOffset", _SE(js_gfx_DispatchInfo_get_indirectOffset), _SE(js_gfx_DispatchInfo_set_indirectOffset)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_DispatchInfo_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_DispatchInfo_proto = cls->getProto(); + __jsb_cc_gfx_DispatchInfo_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_IndirectBuffer_proto = nullptr; +se::Class* __jsb_cc_gfx_IndirectBuffer_class = nullptr; + +static bool js_gfx_IndirectBuffer_get_drawInfos(se::State& s) +{ + cc::gfx::IndirectBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_IndirectBuffer_get_drawInfos : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->drawInfos, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->drawInfos, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_IndirectBuffer_get_drawInfos) + +static bool js_gfx_IndirectBuffer_set_drawInfos(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::IndirectBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_IndirectBuffer_set_drawInfos : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->drawInfos, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_IndirectBuffer_set_drawInfos : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_IndirectBuffer_set_drawInfos) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::IndirectBuffer * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::IndirectBuffer*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("drawInfos", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->drawInfos), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_IndirectBuffer_finalize) + +static bool js_gfx_IndirectBuffer_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::IndirectBuffer* cobj = JSB_ALLOC(cc::gfx::IndirectBuffer); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::IndirectBuffer* cobj = JSB_ALLOC(cc::gfx::IndirectBuffer); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->drawInfos), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_IndirectBuffer_constructor, __jsb_cc_gfx_IndirectBuffer_class, js_cc_gfx_IndirectBuffer_finalize) + + + + +static bool js_cc_gfx_IndirectBuffer_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::IndirectBuffer* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_IndirectBuffer_finalize) + +bool js_register_gfx_IndirectBuffer(se::Object* obj) +{ + auto cls = se::Class::create("IndirectBuffer", obj, nullptr, _SE(js_gfx_IndirectBuffer_constructor)); + + cls->defineProperty("drawInfos", _SE(js_gfx_IndirectBuffer_get_drawInfos), _SE(js_gfx_IndirectBuffer_set_drawInfos)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_IndirectBuffer_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_IndirectBuffer_proto = cls->getProto(); + __jsb_cc_gfx_IndirectBuffer_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_TextureInfo_proto = nullptr; se::Class* __jsb_cc_gfx_TextureInfo_class = nullptr; @@ -3285,7 +5542,6 @@ bool js_register_gfx_TextureInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_TextureViewInfo_proto = nullptr; se::Class* __jsb_cc_gfx_TextureViewInfo_class = nullptr; @@ -3632,7 +5888,6 @@ bool js_register_gfx_TextureViewInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_SamplerInfo_proto = nullptr; se::Class* __jsb_cc_gfx_SamplerInfo_class = nullptr; @@ -3879,60 +6134,6 @@ static bool js_gfx_SamplerInfo_set_borderColor(se::State& s) } SE_BIND_PROP_SET(js_gfx_SamplerInfo_set_borderColor) -static bool js_gfx_SamplerInfo_get_minLOD(se::State& s) -{ - cc::gfx::SamplerInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SamplerInfo_get_minLOD : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->minLOD, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->minLOD, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_SamplerInfo_get_minLOD) - -static bool js_gfx_SamplerInfo_set_minLOD(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::SamplerInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SamplerInfo_set_minLOD : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->minLOD, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SamplerInfo_set_minLOD : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_SamplerInfo_set_minLOD) - -static bool js_gfx_SamplerInfo_get_maxLOD(se::State& s) -{ - cc::gfx::SamplerInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SamplerInfo_get_maxLOD : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->maxLOD, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->maxLOD, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_SamplerInfo_get_maxLOD) - -static bool js_gfx_SamplerInfo_set_maxLOD(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::SamplerInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SamplerInfo_set_maxLOD : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->maxLOD, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SamplerInfo_set_maxLOD : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_SamplerInfo_set_maxLOD) - static bool js_gfx_SamplerInfo_get_mipLODBias(se::State& s) { cc::gfx::SamplerInfo* cobj = SE_THIS_OBJECT(s); @@ -4009,14 +6210,6 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::SamplerInfo * to, se::Obj if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->borderColor), ctx); } - json->getProperty("minLOD", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->minLOD), ctx); - } - json->getProperty("maxLOD", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->maxLOD), ctx); - } json->getProperty("mipLODBias", &field); if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->mipLODBias), ctx); @@ -4087,13 +6280,7 @@ static bool js_gfx_SamplerInfo_constructor(se::State& s) ok &= sevalue_to_native(args[8], &(cobj->borderColor), nullptr); } if (argc > 9 && !args[9].isUndefined()) { - ok &= sevalue_to_native(args[9], &(cobj->minLOD), nullptr); - } - if (argc > 10 && !args[10].isUndefined()) { - ok &= sevalue_to_native(args[10], &(cobj->maxLOD), nullptr); - } - if (argc > 11 && !args[11].isUndefined()) { - ok &= sevalue_to_native(args[11], &(cobj->mipLODBias), nullptr); + ok &= sevalue_to_native(args[9], &(cobj->mipLODBias), nullptr); } if(!ok) { @@ -4141,8 +6328,6 @@ bool js_register_gfx_SamplerInfo(se::Object* obj) cls->defineProperty("maxAnisotropy", _SE(js_gfx_SamplerInfo_get_maxAnisotropy), _SE(js_gfx_SamplerInfo_set_maxAnisotropy)); cls->defineProperty("cmpFunc", _SE(js_gfx_SamplerInfo_get_cmpFunc), _SE(js_gfx_SamplerInfo_set_cmpFunc)); cls->defineProperty("borderColor", _SE(js_gfx_SamplerInfo_get_borderColor), _SE(js_gfx_SamplerInfo_set_borderColor)); - cls->defineProperty("minLOD", _SE(js_gfx_SamplerInfo_get_minLOD), _SE(js_gfx_SamplerInfo_set_minLOD)); - cls->defineProperty("maxLOD", _SE(js_gfx_SamplerInfo_get_maxLOD), _SE(js_gfx_SamplerInfo_set_maxLOD)); cls->defineProperty("mipLODBias", _SE(js_gfx_SamplerInfo_get_mipLODBias), _SE(js_gfx_SamplerInfo_set_mipLODBias)); cls->defineFinalizeFunction(_SE(js_cc_gfx_SamplerInfo_finalize)); cls->install(); @@ -4154,179 +6339,6 @@ bool js_register_gfx_SamplerInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - -se::Object* __jsb_cc_gfx_ShaderMacro_proto = nullptr; -se::Class* __jsb_cc_gfx_ShaderMacro_class = nullptr; - -static bool js_gfx_ShaderMacro_get_macro(se::State& s) -{ - cc::gfx::ShaderMacro* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ShaderMacro_get_macro : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->macro, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->macro, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_ShaderMacro_get_macro) - -static bool js_gfx_ShaderMacro_set_macro(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::ShaderMacro* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ShaderMacro_set_macro : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->macro, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ShaderMacro_set_macro : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_ShaderMacro_set_macro) - -static bool js_gfx_ShaderMacro_get_value(se::State& s) -{ - cc::gfx::ShaderMacro* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ShaderMacro_get_value : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->value, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->value, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_ShaderMacro_get_value) - -static bool js_gfx_ShaderMacro_set_value(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::ShaderMacro* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ShaderMacro_set_value : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->value, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ShaderMacro_set_value : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_ShaderMacro_set_value) - - -template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::ShaderMacro * to, se::Object *ctx) -{ - assert(from.isObject()); - se::Object *json = from.toObject(); - auto* data = (cc::gfx::ShaderMacro*)json->getPrivateData(); - if (data) { - *to = *data; - return true; - } - se::Value field; - bool ok = true; - json->getProperty("macro", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->macro), ctx); - } - json->getProperty("value", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->value), ctx); - } - return ok; -} - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_ShaderMacro_finalize) - -static bool js_gfx_ShaderMacro_constructor(se::State& s) -{ - CC_UNUSED bool ok = true; - const auto& args = s.args(); - size_t argc = args.size(); - - if(argc == 0) - { - cc::gfx::ShaderMacro* cobj = JSB_ALLOC(cc::gfx::ShaderMacro); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else if(argc == 1 && args[0].isObject()) - { - se::Object *json = args[0].toObject(); - se::Value field; - - cc::gfx::ShaderMacro* cobj = JSB_ALLOC(cc::gfx::ShaderMacro); - ok &= sevalue_to_native(args[0], cobj, s.thisObject()); - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else - { - cc::gfx::ShaderMacro* cobj = JSB_ALLOC(cc::gfx::ShaderMacro); - if (argc > 0 && !args[0].isUndefined()) { - ok &= sevalue_to_native(args[0], &(cobj->macro), nullptr); - } - if (argc > 1 && !args[1].isUndefined()) { - ok &= sevalue_to_native(args[1], &(cobj->value), nullptr); - } - - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("Argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; -} -SE_BIND_CTOR(js_gfx_ShaderMacro_constructor, __jsb_cc_gfx_ShaderMacro_class, js_cc_gfx_ShaderMacro_finalize) - - - - -static bool js_cc_gfx_ShaderMacro_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::ShaderMacro* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_ShaderMacro_finalize) - -bool js_register_gfx_ShaderMacro(se::Object* obj) -{ - auto cls = se::Class::create("ShaderMacro", obj, nullptr, _SE(js_gfx_ShaderMacro_constructor)); - - cls->defineProperty("macro", _SE(js_gfx_ShaderMacro_get_macro), _SE(js_gfx_ShaderMacro_set_macro)); - cls->defineProperty("value", _SE(js_gfx_ShaderMacro_get_value), _SE(js_gfx_ShaderMacro_set_value)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_ShaderMacro_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_ShaderMacro_proto = cls->getProto(); - __jsb_cc_gfx_ShaderMacro_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - se::Object* __jsb_cc_gfx_Uniform_proto = nullptr; se::Class* __jsb_cc_gfx_Uniform_class = nullptr; @@ -4533,7 +6545,6 @@ bool js_register_gfx_Uniform(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_UniformBlock_proto = nullptr; se::Class* __jsb_cc_gfx_UniformBlock_class = nullptr; @@ -4810,7 +6821,282 @@ bool js_register_gfx_UniformBlock(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_UniformSamplerTexture_proto = nullptr; +se::Class* __jsb_cc_gfx_UniformSamplerTexture_class = nullptr; +static bool js_gfx_UniformSamplerTexture_get_set(se::State& s) +{ + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_get_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->set, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->set, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformSamplerTexture_get_set) + +static bool js_gfx_UniformSamplerTexture_set_set(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_set_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->set, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformSamplerTexture_set_set : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformSamplerTexture_set_set) + +static bool js_gfx_UniformSamplerTexture_get_binding(se::State& s) +{ + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_get_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->binding, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->binding, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformSamplerTexture_get_binding) + +static bool js_gfx_UniformSamplerTexture_set_binding(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_set_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->binding, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformSamplerTexture_set_binding : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformSamplerTexture_set_binding) + +static bool js_gfx_UniformSamplerTexture_get_name(se::State& s) +{ + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_get_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->name, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->name, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformSamplerTexture_get_name) + +static bool js_gfx_UniformSamplerTexture_set_name(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_set_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->name, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformSamplerTexture_set_name : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformSamplerTexture_set_name) + +static bool js_gfx_UniformSamplerTexture_get_type(se::State& s) +{ + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_get_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->type, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->type, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformSamplerTexture_get_type) + +static bool js_gfx_UniformSamplerTexture_set_type(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_set_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->type, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformSamplerTexture_set_type : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformSamplerTexture_set_type) + +static bool js_gfx_UniformSamplerTexture_get_count(se::State& s) +{ + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_get_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->count, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->count, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformSamplerTexture_get_count) + +static bool js_gfx_UniformSamplerTexture_set_count(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformSamplerTexture_set_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->count, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformSamplerTexture_set_count : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformSamplerTexture_set_count) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::UniformSamplerTexture * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::UniformSamplerTexture*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("set", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->set), ctx); + } + json->getProperty("binding", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->binding), ctx); + } + json->getProperty("name", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->name), ctx); + } + json->getProperty("type", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->type), ctx); + } + json->getProperty("count", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->count), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_UniformSamplerTexture_finalize) + +static bool js_gfx_UniformSamplerTexture_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::UniformSamplerTexture* cobj = JSB_ALLOC(cc::gfx::UniformSamplerTexture); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::UniformSamplerTexture* cobj = JSB_ALLOC(cc::gfx::UniformSamplerTexture); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::UniformSamplerTexture* cobj = JSB_ALLOC(cc::gfx::UniformSamplerTexture); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->set), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->binding), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->name), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->type), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->count), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_UniformSamplerTexture_constructor, __jsb_cc_gfx_UniformSamplerTexture_class, js_cc_gfx_UniformSamplerTexture_finalize) + + + + +static bool js_cc_gfx_UniformSamplerTexture_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::UniformSamplerTexture* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_UniformSamplerTexture_finalize) + +bool js_register_gfx_UniformSamplerTexture(se::Object* obj) +{ + auto cls = se::Class::create("UniformSamplerTexture", obj, nullptr, _SE(js_gfx_UniformSamplerTexture_constructor)); + + cls->defineProperty("set", _SE(js_gfx_UniformSamplerTexture_get_set), _SE(js_gfx_UniformSamplerTexture_set_set)); + cls->defineProperty("binding", _SE(js_gfx_UniformSamplerTexture_get_binding), _SE(js_gfx_UniformSamplerTexture_set_binding)); + cls->defineProperty("name", _SE(js_gfx_UniformSamplerTexture_get_name), _SE(js_gfx_UniformSamplerTexture_set_name)); + cls->defineProperty("type", _SE(js_gfx_UniformSamplerTexture_get_type), _SE(js_gfx_UniformSamplerTexture_set_type)); + cls->defineProperty("count", _SE(js_gfx_UniformSamplerTexture_get_count), _SE(js_gfx_UniformSamplerTexture_set_count)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_UniformSamplerTexture_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_UniformSamplerTexture_proto = cls->getProto(); + __jsb_cc_gfx_UniformSamplerTexture_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_UniformSampler_proto = nullptr; se::Class* __jsb_cc_gfx_UniformSampler_class = nullptr; @@ -4895,33 +7181,6 @@ static bool js_gfx_UniformSampler_set_name(se::State& s) } SE_BIND_PROP_SET(js_gfx_UniformSampler_set_name) -static bool js_gfx_UniformSampler_get_type(se::State& s) -{ - cc::gfx::UniformSampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_UniformSampler_get_type : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->type, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->type, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_UniformSampler_get_type) - -static bool js_gfx_UniformSampler_set_type(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::UniformSampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_UniformSampler_set_type : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->type, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_UniformSampler_set_type : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_UniformSampler_set_type) - static bool js_gfx_UniformSampler_get_count(se::State& s) { cc::gfx::UniformSampler* cobj = SE_THIS_OBJECT(s); @@ -4974,10 +7233,6 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::UniformSampler * to, se:: if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->name), ctx); } - json->getProperty("type", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->type), ctx); - } json->getProperty("count", &field); if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->count), ctx); @@ -5030,10 +7285,7 @@ static bool js_gfx_UniformSampler_constructor(se::State& s) ok &= sevalue_to_native(args[2], &(cobj->name), nullptr); } if (argc > 3 && !args[3].isUndefined()) { - ok &= sevalue_to_native(args[3], &(cobj->type), nullptr); - } - if (argc > 4 && !args[4].isUndefined()) { - ok &= sevalue_to_native(args[4], &(cobj->count), nullptr); + ok &= sevalue_to_native(args[3], &(cobj->count), nullptr); } if(!ok) { @@ -5075,7 +7327,6 @@ bool js_register_gfx_UniformSampler(se::Object* obj) cls->defineProperty("set", _SE(js_gfx_UniformSampler_get_set), _SE(js_gfx_UniformSampler_set_set)); cls->defineProperty("binding", _SE(js_gfx_UniformSampler_get_binding), _SE(js_gfx_UniformSampler_set_binding)); cls->defineProperty("name", _SE(js_gfx_UniformSampler_get_name), _SE(js_gfx_UniformSampler_set_name)); - cls->defineProperty("type", _SE(js_gfx_UniformSampler_get_type), _SE(js_gfx_UniformSampler_set_type)); cls->defineProperty("count", _SE(js_gfx_UniformSampler_get_count), _SE(js_gfx_UniformSampler_set_count)); cls->defineFinalizeFunction(_SE(js_cc_gfx_UniformSampler_finalize)); cls->install(); @@ -5087,7 +7338,1110 @@ bool js_register_gfx_UniformSampler(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_UniformTexture_proto = nullptr; +se::Class* __jsb_cc_gfx_UniformTexture_class = nullptr; +static bool js_gfx_UniformTexture_get_set(se::State& s) +{ + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_get_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->set, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->set, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformTexture_get_set) + +static bool js_gfx_UniformTexture_set_set(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_set_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->set, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformTexture_set_set : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformTexture_set_set) + +static bool js_gfx_UniformTexture_get_binding(se::State& s) +{ + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_get_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->binding, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->binding, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformTexture_get_binding) + +static bool js_gfx_UniformTexture_set_binding(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_set_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->binding, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformTexture_set_binding : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformTexture_set_binding) + +static bool js_gfx_UniformTexture_get_name(se::State& s) +{ + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_get_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->name, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->name, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformTexture_get_name) + +static bool js_gfx_UniformTexture_set_name(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_set_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->name, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformTexture_set_name : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformTexture_set_name) + +static bool js_gfx_UniformTexture_get_type(se::State& s) +{ + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_get_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->type, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->type, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformTexture_get_type) + +static bool js_gfx_UniformTexture_set_type(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_set_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->type, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformTexture_set_type : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformTexture_set_type) + +static bool js_gfx_UniformTexture_get_count(se::State& s) +{ + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_get_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->count, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->count, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformTexture_get_count) + +static bool js_gfx_UniformTexture_set_count(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformTexture_set_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->count, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformTexture_set_count : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformTexture_set_count) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::UniformTexture * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::UniformTexture*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("set", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->set), ctx); + } + json->getProperty("binding", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->binding), ctx); + } + json->getProperty("name", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->name), ctx); + } + json->getProperty("type", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->type), ctx); + } + json->getProperty("count", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->count), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_UniformTexture_finalize) + +static bool js_gfx_UniformTexture_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::UniformTexture* cobj = JSB_ALLOC(cc::gfx::UniformTexture); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::UniformTexture* cobj = JSB_ALLOC(cc::gfx::UniformTexture); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::UniformTexture* cobj = JSB_ALLOC(cc::gfx::UniformTexture); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->set), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->binding), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->name), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->type), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->count), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_UniformTexture_constructor, __jsb_cc_gfx_UniformTexture_class, js_cc_gfx_UniformTexture_finalize) + + + + +static bool js_cc_gfx_UniformTexture_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::UniformTexture* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_UniformTexture_finalize) + +bool js_register_gfx_UniformTexture(se::Object* obj) +{ + auto cls = se::Class::create("UniformTexture", obj, nullptr, _SE(js_gfx_UniformTexture_constructor)); + + cls->defineProperty("set", _SE(js_gfx_UniformTexture_get_set), _SE(js_gfx_UniformTexture_set_set)); + cls->defineProperty("binding", _SE(js_gfx_UniformTexture_get_binding), _SE(js_gfx_UniformTexture_set_binding)); + cls->defineProperty("name", _SE(js_gfx_UniformTexture_get_name), _SE(js_gfx_UniformTexture_set_name)); + cls->defineProperty("type", _SE(js_gfx_UniformTexture_get_type), _SE(js_gfx_UniformTexture_set_type)); + cls->defineProperty("count", _SE(js_gfx_UniformTexture_get_count), _SE(js_gfx_UniformTexture_set_count)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_UniformTexture_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_UniformTexture_proto = cls->getProto(); + __jsb_cc_gfx_UniformTexture_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_UniformStorageImage_proto = nullptr; +se::Class* __jsb_cc_gfx_UniformStorageImage_class = nullptr; + +static bool js_gfx_UniformStorageImage_get_set(se::State& s) +{ + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_get_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->set, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->set, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageImage_get_set) + +static bool js_gfx_UniformStorageImage_set_set(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_set_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->set, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageImage_set_set : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageImage_set_set) + +static bool js_gfx_UniformStorageImage_get_binding(se::State& s) +{ + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_get_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->binding, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->binding, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageImage_get_binding) + +static bool js_gfx_UniformStorageImage_set_binding(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_set_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->binding, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageImage_set_binding : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageImage_set_binding) + +static bool js_gfx_UniformStorageImage_get_name(se::State& s) +{ + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_get_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->name, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->name, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageImage_get_name) + +static bool js_gfx_UniformStorageImage_set_name(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_set_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->name, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageImage_set_name : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageImage_set_name) + +static bool js_gfx_UniformStorageImage_get_type(se::State& s) +{ + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_get_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->type, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->type, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageImage_get_type) + +static bool js_gfx_UniformStorageImage_set_type(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_set_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->type, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageImage_set_type : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageImage_set_type) + +static bool js_gfx_UniformStorageImage_get_count(se::State& s) +{ + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_get_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->count, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->count, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageImage_get_count) + +static bool js_gfx_UniformStorageImage_set_count(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_set_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->count, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageImage_set_count : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageImage_set_count) + +static bool js_gfx_UniformStorageImage_get_memoryAccess(se::State& s) +{ + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_get_memoryAccess : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->memoryAccess, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->memoryAccess, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageImage_get_memoryAccess) + +static bool js_gfx_UniformStorageImage_set_memoryAccess(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageImage_set_memoryAccess : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->memoryAccess, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageImage_set_memoryAccess : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageImage_set_memoryAccess) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::UniformStorageImage * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::UniformStorageImage*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("set", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->set), ctx); + } + json->getProperty("binding", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->binding), ctx); + } + json->getProperty("name", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->name), ctx); + } + json->getProperty("type", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->type), ctx); + } + json->getProperty("count", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->count), ctx); + } + json->getProperty("memoryAccess", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->memoryAccess), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_UniformStorageImage_finalize) + +static bool js_gfx_UniformStorageImage_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::UniformStorageImage* cobj = JSB_ALLOC(cc::gfx::UniformStorageImage); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::UniformStorageImage* cobj = JSB_ALLOC(cc::gfx::UniformStorageImage); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::UniformStorageImage* cobj = JSB_ALLOC(cc::gfx::UniformStorageImage); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->set), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->binding), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->name), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->type), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->count), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->memoryAccess), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_UniformStorageImage_constructor, __jsb_cc_gfx_UniformStorageImage_class, js_cc_gfx_UniformStorageImage_finalize) + + + + +static bool js_cc_gfx_UniformStorageImage_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::UniformStorageImage* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_UniformStorageImage_finalize) + +bool js_register_gfx_UniformStorageImage(se::Object* obj) +{ + auto cls = se::Class::create("UniformStorageImage", obj, nullptr, _SE(js_gfx_UniformStorageImage_constructor)); + + cls->defineProperty("set", _SE(js_gfx_UniformStorageImage_get_set), _SE(js_gfx_UniformStorageImage_set_set)); + cls->defineProperty("binding", _SE(js_gfx_UniformStorageImage_get_binding), _SE(js_gfx_UniformStorageImage_set_binding)); + cls->defineProperty("name", _SE(js_gfx_UniformStorageImage_get_name), _SE(js_gfx_UniformStorageImage_set_name)); + cls->defineProperty("type", _SE(js_gfx_UniformStorageImage_get_type), _SE(js_gfx_UniformStorageImage_set_type)); + cls->defineProperty("count", _SE(js_gfx_UniformStorageImage_get_count), _SE(js_gfx_UniformStorageImage_set_count)); + cls->defineProperty("memoryAccess", _SE(js_gfx_UniformStorageImage_get_memoryAccess), _SE(js_gfx_UniformStorageImage_set_memoryAccess)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_UniformStorageImage_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_UniformStorageImage_proto = cls->getProto(); + __jsb_cc_gfx_UniformStorageImage_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_UniformStorageBuffer_proto = nullptr; +se::Class* __jsb_cc_gfx_UniformStorageBuffer_class = nullptr; + +static bool js_gfx_UniformStorageBuffer_get_set(se::State& s) +{ + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_get_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->set, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->set, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageBuffer_get_set) + +static bool js_gfx_UniformStorageBuffer_set_set(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_set_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->set, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageBuffer_set_set : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageBuffer_set_set) + +static bool js_gfx_UniformStorageBuffer_get_binding(se::State& s) +{ + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_get_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->binding, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->binding, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageBuffer_get_binding) + +static bool js_gfx_UniformStorageBuffer_set_binding(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_set_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->binding, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageBuffer_set_binding : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageBuffer_set_binding) + +static bool js_gfx_UniformStorageBuffer_get_name(se::State& s) +{ + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_get_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->name, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->name, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageBuffer_get_name) + +static bool js_gfx_UniformStorageBuffer_set_name(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_set_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->name, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageBuffer_set_name : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageBuffer_set_name) + +static bool js_gfx_UniformStorageBuffer_get_count(se::State& s) +{ + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_get_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->count, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->count, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageBuffer_get_count) + +static bool js_gfx_UniformStorageBuffer_set_count(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_set_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->count, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageBuffer_set_count : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageBuffer_set_count) + +static bool js_gfx_UniformStorageBuffer_get_memoryAccess(se::State& s) +{ + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_get_memoryAccess : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->memoryAccess, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->memoryAccess, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformStorageBuffer_get_memoryAccess) + +static bool js_gfx_UniformStorageBuffer_set_memoryAccess(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformStorageBuffer_set_memoryAccess : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->memoryAccess, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformStorageBuffer_set_memoryAccess : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformStorageBuffer_set_memoryAccess) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::UniformStorageBuffer * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::UniformStorageBuffer*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("set", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->set), ctx); + } + json->getProperty("binding", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->binding), ctx); + } + json->getProperty("name", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->name), ctx); + } + json->getProperty("count", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->count), ctx); + } + json->getProperty("memoryAccess", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->memoryAccess), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_UniformStorageBuffer_finalize) + +static bool js_gfx_UniformStorageBuffer_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::UniformStorageBuffer* cobj = JSB_ALLOC(cc::gfx::UniformStorageBuffer); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::UniformStorageBuffer* cobj = JSB_ALLOC(cc::gfx::UniformStorageBuffer); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::UniformStorageBuffer* cobj = JSB_ALLOC(cc::gfx::UniformStorageBuffer); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->set), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->binding), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->name), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->count), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->memoryAccess), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_UniformStorageBuffer_constructor, __jsb_cc_gfx_UniformStorageBuffer_class, js_cc_gfx_UniformStorageBuffer_finalize) + + + + +static bool js_cc_gfx_UniformStorageBuffer_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::UniformStorageBuffer* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_UniformStorageBuffer_finalize) + +bool js_register_gfx_UniformStorageBuffer(se::Object* obj) +{ + auto cls = se::Class::create("UniformStorageBuffer", obj, nullptr, _SE(js_gfx_UniformStorageBuffer_constructor)); + + cls->defineProperty("set", _SE(js_gfx_UniformStorageBuffer_get_set), _SE(js_gfx_UniformStorageBuffer_set_set)); + cls->defineProperty("binding", _SE(js_gfx_UniformStorageBuffer_get_binding), _SE(js_gfx_UniformStorageBuffer_set_binding)); + cls->defineProperty("name", _SE(js_gfx_UniformStorageBuffer_get_name), _SE(js_gfx_UniformStorageBuffer_set_name)); + cls->defineProperty("count", _SE(js_gfx_UniformStorageBuffer_get_count), _SE(js_gfx_UniformStorageBuffer_set_count)); + cls->defineProperty("memoryAccess", _SE(js_gfx_UniformStorageBuffer_get_memoryAccess), _SE(js_gfx_UniformStorageBuffer_set_memoryAccess)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_UniformStorageBuffer_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_UniformStorageBuffer_proto = cls->getProto(); + __jsb_cc_gfx_UniformStorageBuffer_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_UniformInputAttachment_proto = nullptr; +se::Class* __jsb_cc_gfx_UniformInputAttachment_class = nullptr; + +static bool js_gfx_UniformInputAttachment_get_set(se::State& s) +{ + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_get_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->set, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->set, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformInputAttachment_get_set) + +static bool js_gfx_UniformInputAttachment_set_set(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_set_set : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->set, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformInputAttachment_set_set : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformInputAttachment_set_set) + +static bool js_gfx_UniformInputAttachment_get_binding(se::State& s) +{ + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_get_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->binding, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->binding, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformInputAttachment_get_binding) + +static bool js_gfx_UniformInputAttachment_set_binding(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_set_binding : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->binding, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformInputAttachment_set_binding : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformInputAttachment_set_binding) + +static bool js_gfx_UniformInputAttachment_get_name(se::State& s) +{ + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_get_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->name, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->name, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformInputAttachment_get_name) + +static bool js_gfx_UniformInputAttachment_set_name(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_set_name : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->name, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformInputAttachment_set_name : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformInputAttachment_set_name) + +static bool js_gfx_UniformInputAttachment_get_count(se::State& s) +{ + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_get_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->count, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->count, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_UniformInputAttachment_get_count) + +static bool js_gfx_UniformInputAttachment_set_count(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_UniformInputAttachment_set_count : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->count, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_UniformInputAttachment_set_count : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_UniformInputAttachment_set_count) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::UniformInputAttachment * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::UniformInputAttachment*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("set", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->set), ctx); + } + json->getProperty("binding", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->binding), ctx); + } + json->getProperty("name", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->name), ctx); + } + json->getProperty("count", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->count), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_UniformInputAttachment_finalize) + +static bool js_gfx_UniformInputAttachment_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::UniformInputAttachment* cobj = JSB_ALLOC(cc::gfx::UniformInputAttachment); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::UniformInputAttachment* cobj = JSB_ALLOC(cc::gfx::UniformInputAttachment); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::UniformInputAttachment* cobj = JSB_ALLOC(cc::gfx::UniformInputAttachment); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->set), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->binding), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->name), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->count), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_UniformInputAttachment_constructor, __jsb_cc_gfx_UniformInputAttachment_class, js_cc_gfx_UniformInputAttachment_finalize) + + + + +static bool js_cc_gfx_UniformInputAttachment_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::UniformInputAttachment* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_UniformInputAttachment_finalize) + +bool js_register_gfx_UniformInputAttachment(se::Object* obj) +{ + auto cls = se::Class::create("UniformInputAttachment", obj, nullptr, _SE(js_gfx_UniformInputAttachment_constructor)); + + cls->defineProperty("set", _SE(js_gfx_UniformInputAttachment_get_set), _SE(js_gfx_UniformInputAttachment_set_set)); + cls->defineProperty("binding", _SE(js_gfx_UniformInputAttachment_get_binding), _SE(js_gfx_UniformInputAttachment_set_binding)); + cls->defineProperty("name", _SE(js_gfx_UniformInputAttachment_get_name), _SE(js_gfx_UniformInputAttachment_set_name)); + cls->defineProperty("count", _SE(js_gfx_UniformInputAttachment_get_count), _SE(js_gfx_UniformInputAttachment_set_count)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_UniformInputAttachment_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_UniformInputAttachment_proto = cls->getProto(); + __jsb_cc_gfx_UniformInputAttachment_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_ShaderStage_proto = nullptr; se::Class* __jsb_cc_gfx_ShaderStage_class = nullptr; @@ -5259,7 +8613,6 @@ bool js_register_gfx_ShaderStage(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_Attribute_proto = nullptr; se::Class* __jsb_cc_gfx_Attribute_class = nullptr; @@ -5571,7 +8924,6 @@ bool js_register_gfx_Attribute(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_ShaderInfo_proto = nullptr; se::Class* __jsb_cc_gfx_ShaderInfo_class = nullptr; @@ -5683,6 +9035,60 @@ static bool js_gfx_ShaderInfo_set_blocks(se::State& s) } SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_blocks) +static bool js_gfx_ShaderInfo_get_buffers(se::State& s) +{ + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_get_buffers : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->buffers, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->buffers, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_ShaderInfo_get_buffers) + +static bool js_gfx_ShaderInfo_set_buffers(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_set_buffers : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->buffers, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ShaderInfo_set_buffers : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_buffers) + +static bool js_gfx_ShaderInfo_get_samplerTextures(se::State& s) +{ + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_get_samplerTextures : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->samplerTextures, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->samplerTextures, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_ShaderInfo_get_samplerTextures) + +static bool js_gfx_ShaderInfo_set_samplerTextures(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_set_samplerTextures : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->samplerTextures, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ShaderInfo_set_samplerTextures : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_samplerTextures) + static bool js_gfx_ShaderInfo_get_samplers(se::State& s) { cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); @@ -5710,6 +9116,87 @@ static bool js_gfx_ShaderInfo_set_samplers(se::State& s) } SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_samplers) +static bool js_gfx_ShaderInfo_get_textures(se::State& s) +{ + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_get_textures : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->textures, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->textures, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_ShaderInfo_get_textures) + +static bool js_gfx_ShaderInfo_set_textures(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_set_textures : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->textures, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ShaderInfo_set_textures : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_textures) + +static bool js_gfx_ShaderInfo_get_images(se::State& s) +{ + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_get_images : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->images, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->images, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_ShaderInfo_get_images) + +static bool js_gfx_ShaderInfo_set_images(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_set_images : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->images, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ShaderInfo_set_images : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_images) + +static bool js_gfx_ShaderInfo_get_subpassInputs(se::State& s) +{ + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_get_subpassInputs : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->subpassInputs, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->subpassInputs, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_ShaderInfo_get_subpassInputs) + +static bool js_gfx_ShaderInfo_set_subpassInputs(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::ShaderInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_ShaderInfo_set_subpassInputs : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->subpassInputs, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ShaderInfo_set_subpassInputs : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_ShaderInfo_set_subpassInputs) + template<> bool sevalue_to_native(const se::Value &from, cc::gfx::ShaderInfo * to, se::Object *ctx) @@ -5739,10 +9226,30 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::ShaderInfo * to, se::Obje if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->blocks), ctx); } + json->getProperty("buffers", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->buffers), ctx); + } + json->getProperty("samplerTextures", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->samplerTextures), ctx); + } json->getProperty("samplers", &field); if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->samplers), ctx); } + json->getProperty("textures", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->textures), ctx); + } + json->getProperty("images", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->images), ctx); + } + json->getProperty("subpassInputs", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->subpassInputs), ctx); + } return ok; } @@ -5794,7 +9301,22 @@ static bool js_gfx_ShaderInfo_constructor(se::State& s) ok &= sevalue_to_native(args[3], &(cobj->blocks), nullptr); } if (argc > 4 && !args[4].isUndefined()) { - ok &= sevalue_to_native(args[4], &(cobj->samplers), nullptr); + ok &= sevalue_to_native(args[4], &(cobj->buffers), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->samplerTextures), nullptr); + } + if (argc > 6 && !args[6].isUndefined()) { + ok &= sevalue_to_native(args[6], &(cobj->samplers), nullptr); + } + if (argc > 7 && !args[7].isUndefined()) { + ok &= sevalue_to_native(args[7], &(cobj->textures), nullptr); + } + if (argc > 8 && !args[8].isUndefined()) { + ok &= sevalue_to_native(args[8], &(cobj->images), nullptr); + } + if (argc > 9 && !args[9].isUndefined()) { + ok &= sevalue_to_native(args[9], &(cobj->subpassInputs), nullptr); } if(!ok) { @@ -5837,7 +9359,12 @@ bool js_register_gfx_ShaderInfo(se::Object* obj) cls->defineProperty("stages", _SE(js_gfx_ShaderInfo_get_stages), _SE(js_gfx_ShaderInfo_set_stages)); cls->defineProperty("attributes", _SE(js_gfx_ShaderInfo_get_attributes), _SE(js_gfx_ShaderInfo_set_attributes)); cls->defineProperty("blocks", _SE(js_gfx_ShaderInfo_get_blocks), _SE(js_gfx_ShaderInfo_set_blocks)); + cls->defineProperty("buffers", _SE(js_gfx_ShaderInfo_get_buffers), _SE(js_gfx_ShaderInfo_set_buffers)); + cls->defineProperty("samplerTextures", _SE(js_gfx_ShaderInfo_get_samplerTextures), _SE(js_gfx_ShaderInfo_set_samplerTextures)); cls->defineProperty("samplers", _SE(js_gfx_ShaderInfo_get_samplers), _SE(js_gfx_ShaderInfo_set_samplers)); + cls->defineProperty("textures", _SE(js_gfx_ShaderInfo_get_textures), _SE(js_gfx_ShaderInfo_set_textures)); + cls->defineProperty("images", _SE(js_gfx_ShaderInfo_get_images), _SE(js_gfx_ShaderInfo_set_images)); + cls->defineProperty("subpassInputs", _SE(js_gfx_ShaderInfo_get_subpassInputs), _SE(js_gfx_ShaderInfo_set_subpassInputs)); cls->defineFinalizeFunction(_SE(js_cc_gfx_ShaderInfo_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -5848,7 +9375,6 @@ bool js_register_gfx_ShaderInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_InputAssemblerInfo_proto = nullptr; se::Class* __jsb_cc_gfx_InputAssemblerInfo_class = nullptr; @@ -6090,7 +9616,6 @@ bool js_register_gfx_InputAssemblerInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_ColorAttachment_proto = nullptr; se::Class* __jsb_cc_gfx_ColorAttachment_class = nullptr; @@ -6202,59 +9727,59 @@ static bool js_gfx_ColorAttachment_set_storeOp(se::State& s) } SE_BIND_PROP_SET(js_gfx_ColorAttachment_set_storeOp) -static bool js_gfx_ColorAttachment_get_beginLayout(se::State& s) +static bool js_gfx_ColorAttachment_get_beginAccesses(se::State& s) { cc::gfx::ColorAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_get_beginLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_get_beginAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; - ok &= nativevalue_to_se(cobj->beginLayout, jsret, s.thisObject() /*ctx*/); + ok &= nativevalue_to_se(cobj->beginAccesses, jsret, s.thisObject() /*ctx*/); s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->beginLayout, s.thisObject(), s.rval()); + SE_HOLD_RETURN_VALUE(cobj->beginAccesses, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_ColorAttachment_get_beginLayout) +SE_BIND_PROP_GET(js_gfx_ColorAttachment_get_beginAccesses) -static bool js_gfx_ColorAttachment_set_beginLayout(se::State& s) +static bool js_gfx_ColorAttachment_set_beginAccesses(se::State& s) { const auto& args = s.args(); cc::gfx::ColorAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_set_beginLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_set_beginAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->beginLayout, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ColorAttachment_set_beginLayout : Error processing new value"); + ok &= sevalue_to_native(args[0], &cobj->beginAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ColorAttachment_set_beginAccesses : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_ColorAttachment_set_beginLayout) +SE_BIND_PROP_SET(js_gfx_ColorAttachment_set_beginAccesses) -static bool js_gfx_ColorAttachment_get_endLayout(se::State& s) +static bool js_gfx_ColorAttachment_get_endAccesses(se::State& s) { cc::gfx::ColorAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_get_endLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_get_endAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; - ok &= nativevalue_to_se(cobj->endLayout, jsret, s.thisObject() /*ctx*/); + ok &= nativevalue_to_se(cobj->endAccesses, jsret, s.thisObject() /*ctx*/); s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->endLayout, s.thisObject(), s.rval()); + SE_HOLD_RETURN_VALUE(cobj->endAccesses, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_ColorAttachment_get_endLayout) +SE_BIND_PROP_GET(js_gfx_ColorAttachment_get_endAccesses) -static bool js_gfx_ColorAttachment_set_endLayout(se::State& s) +static bool js_gfx_ColorAttachment_set_endAccesses(se::State& s) { const auto& args = s.args(); cc::gfx::ColorAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_set_endLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_ColorAttachment_set_endAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->endLayout, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_ColorAttachment_set_endLayout : Error processing new value"); + ok &= sevalue_to_native(args[0], &cobj->endAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_ColorAttachment_set_endAccesses : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_ColorAttachment_set_endLayout) +SE_BIND_PROP_SET(js_gfx_ColorAttachment_set_endAccesses) template<> @@ -6285,13 +9810,13 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::ColorAttachment * to, se: if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->storeOp), ctx); } - json->getProperty("beginLayout", &field); + json->getProperty("beginAccesses", &field); if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->beginLayout), ctx); + ok &= sevalue_to_native(field, &(to->beginAccesses), ctx); } - json->getProperty("endLayout", &field); + json->getProperty("endAccesses", &field); if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->endLayout), ctx); + ok &= sevalue_to_native(field, &(to->endAccesses), ctx); } return ok; } @@ -6344,10 +9869,10 @@ static bool js_gfx_ColorAttachment_constructor(se::State& s) ok &= sevalue_to_native(args[3], &(cobj->storeOp), nullptr); } if (argc > 4 && !args[4].isUndefined()) { - ok &= sevalue_to_native(args[4], &(cobj->beginLayout), nullptr); + ok &= sevalue_to_native(args[4], &(cobj->beginAccesses), nullptr); } if (argc > 5 && !args[5].isUndefined()) { - ok &= sevalue_to_native(args[5], &(cobj->endLayout), nullptr); + ok &= sevalue_to_native(args[5], &(cobj->endAccesses), nullptr); } if(!ok) { @@ -6390,8 +9915,8 @@ bool js_register_gfx_ColorAttachment(se::Object* obj) cls->defineProperty("sampleCount", _SE(js_gfx_ColorAttachment_get_sampleCount), _SE(js_gfx_ColorAttachment_set_sampleCount)); cls->defineProperty("loadOp", _SE(js_gfx_ColorAttachment_get_loadOp), _SE(js_gfx_ColorAttachment_set_loadOp)); cls->defineProperty("storeOp", _SE(js_gfx_ColorAttachment_get_storeOp), _SE(js_gfx_ColorAttachment_set_storeOp)); - cls->defineProperty("beginLayout", _SE(js_gfx_ColorAttachment_get_beginLayout), _SE(js_gfx_ColorAttachment_set_beginLayout)); - cls->defineProperty("endLayout", _SE(js_gfx_ColorAttachment_get_endLayout), _SE(js_gfx_ColorAttachment_set_endLayout)); + cls->defineProperty("beginAccesses", _SE(js_gfx_ColorAttachment_get_beginAccesses), _SE(js_gfx_ColorAttachment_set_beginAccesses)); + cls->defineProperty("endAccesses", _SE(js_gfx_ColorAttachment_get_endAccesses), _SE(js_gfx_ColorAttachment_set_endAccesses)); cls->defineFinalizeFunction(_SE(js_cc_gfx_ColorAttachment_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -6402,7 +9927,6 @@ bool js_register_gfx_ColorAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DepthStencilAttachment_proto = nullptr; se::Class* __jsb_cc_gfx_DepthStencilAttachment_class = nullptr; @@ -6568,59 +10092,59 @@ static bool js_gfx_DepthStencilAttachment_set_stencilStoreOp(se::State& s) } SE_BIND_PROP_SET(js_gfx_DepthStencilAttachment_set_stencilStoreOp) -static bool js_gfx_DepthStencilAttachment_get_beginLayout(se::State& s) +static bool js_gfx_DepthStencilAttachment_get_beginAccesses(se::State& s) { cc::gfx::DepthStencilAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_get_beginLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_get_beginAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; - ok &= nativevalue_to_se(cobj->beginLayout, jsret, s.thisObject() /*ctx*/); + ok &= nativevalue_to_se(cobj->beginAccesses, jsret, s.thisObject() /*ctx*/); s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->beginLayout, s.thisObject(), s.rval()); + SE_HOLD_RETURN_VALUE(cobj->beginAccesses, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_DepthStencilAttachment_get_beginLayout) +SE_BIND_PROP_GET(js_gfx_DepthStencilAttachment_get_beginAccesses) -static bool js_gfx_DepthStencilAttachment_set_beginLayout(se::State& s) +static bool js_gfx_DepthStencilAttachment_set_beginAccesses(se::State& s) { const auto& args = s.args(); cc::gfx::DepthStencilAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_set_beginLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_set_beginAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->beginLayout, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DepthStencilAttachment_set_beginLayout : Error processing new value"); + ok &= sevalue_to_native(args[0], &cobj->beginAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DepthStencilAttachment_set_beginAccesses : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_DepthStencilAttachment_set_beginLayout) +SE_BIND_PROP_SET(js_gfx_DepthStencilAttachment_set_beginAccesses) -static bool js_gfx_DepthStencilAttachment_get_endLayout(se::State& s) +static bool js_gfx_DepthStencilAttachment_get_endAccesses(se::State& s) { cc::gfx::DepthStencilAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_get_endLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_get_endAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; - ok &= nativevalue_to_se(cobj->endLayout, jsret, s.thisObject() /*ctx*/); + ok &= nativevalue_to_se(cobj->endAccesses, jsret, s.thisObject() /*ctx*/); s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->endLayout, s.thisObject(), s.rval()); + SE_HOLD_RETURN_VALUE(cobj->endAccesses, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_DepthStencilAttachment_get_endLayout) +SE_BIND_PROP_GET(js_gfx_DepthStencilAttachment_get_endAccesses) -static bool js_gfx_DepthStencilAttachment_set_endLayout(se::State& s) +static bool js_gfx_DepthStencilAttachment_set_endAccesses(se::State& s) { const auto& args = s.args(); cc::gfx::DepthStencilAttachment* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_set_endLayout : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_DepthStencilAttachment_set_endAccesses : Invalid Native Object"); CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->endLayout, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_DepthStencilAttachment_set_endLayout : Error processing new value"); + ok &= sevalue_to_native(args[0], &cobj->endAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DepthStencilAttachment_set_endAccesses : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_DepthStencilAttachment_set_endLayout) +SE_BIND_PROP_SET(js_gfx_DepthStencilAttachment_set_endAccesses) template<> @@ -6659,13 +10183,13 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::DepthStencilAttachment * if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->stencilStoreOp), ctx); } - json->getProperty("beginLayout", &field); + json->getProperty("beginAccesses", &field); if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->beginLayout), ctx); + ok &= sevalue_to_native(field, &(to->beginAccesses), ctx); } - json->getProperty("endLayout", &field); + json->getProperty("endAccesses", &field); if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->endLayout), ctx); + ok &= sevalue_to_native(field, &(to->endAccesses), ctx); } return ok; } @@ -6724,10 +10248,10 @@ static bool js_gfx_DepthStencilAttachment_constructor(se::State& s) ok &= sevalue_to_native(args[5], &(cobj->stencilStoreOp), nullptr); } if (argc > 6 && !args[6].isUndefined()) { - ok &= sevalue_to_native(args[6], &(cobj->beginLayout), nullptr); + ok &= sevalue_to_native(args[6], &(cobj->beginAccesses), nullptr); } if (argc > 7 && !args[7].isUndefined()) { - ok &= sevalue_to_native(args[7], &(cobj->endLayout), nullptr); + ok &= sevalue_to_native(args[7], &(cobj->endAccesses), nullptr); } if(!ok) { @@ -6772,8 +10296,8 @@ bool js_register_gfx_DepthStencilAttachment(se::Object* obj) cls->defineProperty("depthStoreOp", _SE(js_gfx_DepthStencilAttachment_get_depthStoreOp), _SE(js_gfx_DepthStencilAttachment_set_depthStoreOp)); cls->defineProperty("stencilLoadOp", _SE(js_gfx_DepthStencilAttachment_get_stencilLoadOp), _SE(js_gfx_DepthStencilAttachment_set_stencilLoadOp)); cls->defineProperty("stencilStoreOp", _SE(js_gfx_DepthStencilAttachment_get_stencilStoreOp), _SE(js_gfx_DepthStencilAttachment_set_stencilStoreOp)); - cls->defineProperty("beginLayout", _SE(js_gfx_DepthStencilAttachment_get_beginLayout), _SE(js_gfx_DepthStencilAttachment_set_beginLayout)); - cls->defineProperty("endLayout", _SE(js_gfx_DepthStencilAttachment_get_endLayout), _SE(js_gfx_DepthStencilAttachment_set_endLayout)); + cls->defineProperty("beginAccesses", _SE(js_gfx_DepthStencilAttachment_get_beginAccesses), _SE(js_gfx_DepthStencilAttachment_set_beginAccesses)); + cls->defineProperty("endAccesses", _SE(js_gfx_DepthStencilAttachment_get_endAccesses), _SE(js_gfx_DepthStencilAttachment_set_endAccesses)); cls->defineFinalizeFunction(_SE(js_cc_gfx_DepthStencilAttachment_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -6784,41 +10308,13 @@ bool js_register_gfx_DepthStencilAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_SubpassInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_SubpassInfo_class = nullptr; -se::Object* __jsb_cc_gfx_SubPassInfo_proto = nullptr; -se::Class* __jsb_cc_gfx_SubPassInfo_class = nullptr; - -static bool js_gfx_SubPassInfo_get_bindPoint(se::State& s) +static bool js_gfx_SubpassInfo_get_inputs(se::State& s) { - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_get_bindPoint : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->bindPoint, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->bindPoint, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_SubPassInfo_get_bindPoint) - -static bool js_gfx_SubPassInfo_set_bindPoint(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_set_bindPoint : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->bindPoint, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SubPassInfo_set_bindPoint : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_SubPassInfo_set_bindPoint) - -static bool js_gfx_SubPassInfo_get_inputs(se::State& s) -{ - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_get_inputs : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_get_inputs : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -6827,25 +10323,25 @@ static bool js_gfx_SubPassInfo_get_inputs(se::State& s) SE_HOLD_RETURN_VALUE(cobj->inputs, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_SubPassInfo_get_inputs) +SE_BIND_PROP_GET(js_gfx_SubpassInfo_get_inputs) -static bool js_gfx_SubPassInfo_set_inputs(se::State& s) +static bool js_gfx_SubpassInfo_set_inputs(se::State& s) { const auto& args = s.args(); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_set_inputs : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_set_inputs : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->inputs, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SubPassInfo_set_inputs : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_SubpassInfo_set_inputs : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_SubPassInfo_set_inputs) +SE_BIND_PROP_SET(js_gfx_SubpassInfo_set_inputs) -static bool js_gfx_SubPassInfo_get_colors(se::State& s) +static bool js_gfx_SubpassInfo_get_colors(se::State& s) { - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_get_colors : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_get_colors : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -6854,25 +10350,25 @@ static bool js_gfx_SubPassInfo_get_colors(se::State& s) SE_HOLD_RETURN_VALUE(cobj->colors, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_SubPassInfo_get_colors) +SE_BIND_PROP_GET(js_gfx_SubpassInfo_get_colors) -static bool js_gfx_SubPassInfo_set_colors(se::State& s) +static bool js_gfx_SubpassInfo_set_colors(se::State& s) { const auto& args = s.args(); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_set_colors : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_set_colors : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->colors, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SubPassInfo_set_colors : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_SubpassInfo_set_colors : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_SubPassInfo_set_colors) +SE_BIND_PROP_SET(js_gfx_SubpassInfo_set_colors) -static bool js_gfx_SubPassInfo_get_resolves(se::State& s) +static bool js_gfx_SubpassInfo_get_resolves(se::State& s) { - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_get_resolves : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_get_resolves : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -6881,52 +10377,25 @@ static bool js_gfx_SubPassInfo_get_resolves(se::State& s) SE_HOLD_RETURN_VALUE(cobj->resolves, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_SubPassInfo_get_resolves) +SE_BIND_PROP_GET(js_gfx_SubpassInfo_get_resolves) -static bool js_gfx_SubPassInfo_set_resolves(se::State& s) +static bool js_gfx_SubpassInfo_set_resolves(se::State& s) { const auto& args = s.args(); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_set_resolves : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_set_resolves : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->resolves, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SubPassInfo_set_resolves : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_SubpassInfo_set_resolves : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_SubPassInfo_set_resolves) +SE_BIND_PROP_SET(js_gfx_SubpassInfo_set_resolves) -static bool js_gfx_SubPassInfo_get_depthStencil(se::State& s) +static bool js_gfx_SubpassInfo_get_preserves(se::State& s) { - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_get_depthStencil : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->depthStencil, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->depthStencil, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_SubPassInfo_get_depthStencil) - -static bool js_gfx_SubPassInfo_set_depthStencil(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_set_depthStencil : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->depthStencil, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SubPassInfo_set_depthStencil : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_SubPassInfo_set_depthStencil) - -static bool js_gfx_SubPassInfo_get_preserves(se::State& s) -{ - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_get_preserves : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_get_preserves : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -6935,38 +10404,61 @@ static bool js_gfx_SubPassInfo_get_preserves(se::State& s) SE_HOLD_RETURN_VALUE(cobj->preserves, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_SubPassInfo_get_preserves) +SE_BIND_PROP_GET(js_gfx_SubpassInfo_get_preserves) -static bool js_gfx_SubPassInfo_set_preserves(se::State& s) +static bool js_gfx_SubpassInfo_set_preserves(se::State& s) { const auto& args = s.args(); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_SubPassInfo_set_preserves : Invalid Native Object"); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_set_preserves : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->preserves, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_SubPassInfo_set_preserves : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_SubpassInfo_set_preserves : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_SubPassInfo_set_preserves) +SE_BIND_PROP_SET(js_gfx_SubpassInfo_set_preserves) + +static bool js_gfx_SubpassInfo_get_depthStencil(se::State& s) +{ + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_get_depthStencil : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->depthStencil, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->depthStencil, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_SubpassInfo_get_depthStencil) + +static bool js_gfx_SubpassInfo_set_depthStencil(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_SubpassInfo_set_depthStencil : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->depthStencil, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_SubpassInfo_set_depthStencil : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_SubpassInfo_set_depthStencil) template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::SubPassInfo * to, se::Object *ctx) +bool sevalue_to_native(const se::Value &from, cc::gfx::SubpassInfo * to, se::Object *ctx) { assert(from.isObject()); se::Object *json = from.toObject(); - auto* data = (cc::gfx::SubPassInfo*)json->getPrivateData(); + auto* data = (cc::gfx::SubpassInfo*)json->getPrivateData(); if (data) { *to = *data; return true; } se::Value field; bool ok = true; - json->getProperty("bindPoint", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->bindPoint), ctx); - } json->getProperty("inputs", &field); if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->inputs), ctx); @@ -6979,20 +10471,20 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::SubPassInfo * to, se::Obj if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->resolves), ctx); } - json->getProperty("depthStencil", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->depthStencil), ctx); - } json->getProperty("preserves", &field); if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->preserves), ctx); } + json->getProperty("depthStencil", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->depthStencil), ctx); + } return ok; } -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_SubPassInfo_finalize) +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_SubpassInfo_finalize) -static bool js_gfx_SubPassInfo_constructor(se::State& s) +static bool js_gfx_SubpassInfo_constructor(se::State& s) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -7000,7 +10492,7 @@ static bool js_gfx_SubPassInfo_constructor(se::State& s) if(argc == 0) { - cc::gfx::SubPassInfo* cobj = JSB_ALLOC(cc::gfx::SubPassInfo); + cc::gfx::SubpassInfo* cobj = JSB_ALLOC(cc::gfx::SubpassInfo); s.thisObject()->setPrivateData(cobj); se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); return true; @@ -7010,7 +10502,7 @@ static bool js_gfx_SubPassInfo_constructor(se::State& s) se::Object *json = args[0].toObject(); se::Value field; - cc::gfx::SubPassInfo* cobj = JSB_ALLOC(cc::gfx::SubPassInfo); + cc::gfx::SubpassInfo* cobj = JSB_ALLOC(cc::gfx::SubpassInfo); ok &= sevalue_to_native(args[0], cobj, s.thisObject()); if(!ok) { JSB_FREE(cobj); @@ -7024,25 +10516,22 @@ static bool js_gfx_SubPassInfo_constructor(se::State& s) } else { - cc::gfx::SubPassInfo* cobj = JSB_ALLOC(cc::gfx::SubPassInfo); + cc::gfx::SubpassInfo* cobj = JSB_ALLOC(cc::gfx::SubpassInfo); if (argc > 0 && !args[0].isUndefined()) { - ok &= sevalue_to_native(args[0], &(cobj->bindPoint), nullptr); + ok &= sevalue_to_native(args[0], &(cobj->inputs), nullptr); } if (argc > 1 && !args[1].isUndefined()) { - ok &= sevalue_to_native(args[1], &(cobj->inputs), nullptr); + ok &= sevalue_to_native(args[1], &(cobj->colors), nullptr); } if (argc > 2 && !args[2].isUndefined()) { - ok &= sevalue_to_native(args[2], &(cobj->colors), nullptr); + ok &= sevalue_to_native(args[2], &(cobj->resolves), nullptr); } if (argc > 3 && !args[3].isUndefined()) { - ok &= sevalue_to_native(args[3], &(cobj->resolves), nullptr); + ok &= sevalue_to_native(args[3], &(cobj->preserves), nullptr); } if (argc > 4 && !args[4].isUndefined()) { ok &= sevalue_to_native(args[4], &(cobj->depthStencil), nullptr); } - if (argc > 5 && !args[5].isUndefined()) { - ok &= sevalue_to_native(args[5], &(cobj->preserves), nullptr); - } if(!ok) { JSB_FREE(cobj); @@ -7058,45 +10547,43 @@ static bool js_gfx_SubPassInfo_constructor(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_CTOR(js_gfx_SubPassInfo_constructor, __jsb_cc_gfx_SubPassInfo_class, js_cc_gfx_SubPassInfo_finalize) +SE_BIND_CTOR(js_gfx_SubpassInfo_constructor, __jsb_cc_gfx_SubpassInfo_class, js_cc_gfx_SubpassInfo_finalize) -static bool js_cc_gfx_SubPassInfo_finalize(se::State& s) +static bool js_cc_gfx_SubpassInfo_finalize(se::State& s) { - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::SubPassInfo* cobj = SE_THIS_OBJECT(s); + cc::gfx::SubpassInfo* cobj = SE_THIS_OBJECT(s); JSB_FREE(cobj); } return true; } -SE_BIND_FINALIZE_FUNC(js_cc_gfx_SubPassInfo_finalize) +SE_BIND_FINALIZE_FUNC(js_cc_gfx_SubpassInfo_finalize) -bool js_register_gfx_SubPassInfo(se::Object* obj) +bool js_register_gfx_SubpassInfo(se::Object* obj) { - auto cls = se::Class::create("SubPassInfo", obj, nullptr, _SE(js_gfx_SubPassInfo_constructor)); + auto cls = se::Class::create("SubpassInfo", obj, nullptr, _SE(js_gfx_SubpassInfo_constructor)); - cls->defineProperty("bindPoint", _SE(js_gfx_SubPassInfo_get_bindPoint), _SE(js_gfx_SubPassInfo_set_bindPoint)); - cls->defineProperty("inputs", _SE(js_gfx_SubPassInfo_get_inputs), _SE(js_gfx_SubPassInfo_set_inputs)); - cls->defineProperty("colors", _SE(js_gfx_SubPassInfo_get_colors), _SE(js_gfx_SubPassInfo_set_colors)); - cls->defineProperty("resolves", _SE(js_gfx_SubPassInfo_get_resolves), _SE(js_gfx_SubPassInfo_set_resolves)); - cls->defineProperty("depthStencil", _SE(js_gfx_SubPassInfo_get_depthStencil), _SE(js_gfx_SubPassInfo_set_depthStencil)); - cls->defineProperty("preserves", _SE(js_gfx_SubPassInfo_get_preserves), _SE(js_gfx_SubPassInfo_set_preserves)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_SubPassInfo_finalize)); + cls->defineProperty("inputs", _SE(js_gfx_SubpassInfo_get_inputs), _SE(js_gfx_SubpassInfo_set_inputs)); + cls->defineProperty("colors", _SE(js_gfx_SubpassInfo_get_colors), _SE(js_gfx_SubpassInfo_set_colors)); + cls->defineProperty("resolves", _SE(js_gfx_SubpassInfo_get_resolves), _SE(js_gfx_SubpassInfo_set_resolves)); + cls->defineProperty("preserves", _SE(js_gfx_SubpassInfo_get_preserves), _SE(js_gfx_SubpassInfo_set_preserves)); + cls->defineProperty("depthStencil", _SE(js_gfx_SubpassInfo_get_depthStencil), _SE(js_gfx_SubpassInfo_set_depthStencil)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_SubpassInfo_finalize)); cls->install(); - JSBClassType::registerClass(cls); + JSBClassType::registerClass(cls); - __jsb_cc_gfx_SubPassInfo_proto = cls->getProto(); - __jsb_cc_gfx_SubPassInfo_class = cls; + __jsb_cc_gfx_SubpassInfo_proto = cls->getProto(); + __jsb_cc_gfx_SubpassInfo_class = cls; se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_RenderPassInfo_proto = nullptr; se::Class* __jsb_cc_gfx_RenderPassInfo_class = nullptr; @@ -7154,32 +10641,59 @@ static bool js_gfx_RenderPassInfo_set_depthStencilAttachment(se::State& s) } SE_BIND_PROP_SET(js_gfx_RenderPassInfo_set_depthStencilAttachment) -static bool js_gfx_RenderPassInfo_get_subPasses(se::State& s) +static bool js_gfx_RenderPassInfo_get_subpasses(se::State& s) { cc::gfx::RenderPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPassInfo_get_subPasses : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPassInfo_get_subpasses : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; - ok &= nativevalue_to_se(cobj->subPasses, jsret, s.thisObject() /*ctx*/); + ok &= nativevalue_to_se(cobj->subpasses, jsret, s.thisObject() /*ctx*/); s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->subPasses, s.thisObject(), s.rval()); + SE_HOLD_RETURN_VALUE(cobj->subpasses, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_RenderPassInfo_get_subPasses) +SE_BIND_PROP_GET(js_gfx_RenderPassInfo_get_subpasses) -static bool js_gfx_RenderPassInfo_set_subPasses(se::State& s) +static bool js_gfx_RenderPassInfo_set_subpasses(se::State& s) { const auto& args = s.args(); cc::gfx::RenderPassInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPassInfo_set_subPasses : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPassInfo_set_subpasses : Invalid Native Object"); CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->subPasses, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_RenderPassInfo_set_subPasses : Error processing new value"); + ok &= sevalue_to_native(args[0], &cobj->subpasses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPassInfo_set_subpasses : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_RenderPassInfo_set_subPasses) +SE_BIND_PROP_SET(js_gfx_RenderPassInfo_set_subpasses) + +static bool js_gfx_RenderPassInfo_get_dependencies(se::State& s) +{ + cc::gfx::RenderPassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPassInfo_get_dependencies : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dependencies, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dependencies, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_RenderPassInfo_get_dependencies) + +static bool js_gfx_RenderPassInfo_set_dependencies(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::RenderPassInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPassInfo_set_dependencies : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dependencies, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPassInfo_set_dependencies : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_RenderPassInfo_set_dependencies) template<> @@ -7202,9 +10716,13 @@ bool sevalue_to_native(const se::Value &from, cc::gfx::RenderPassInfo * to, se:: if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->depthStencilAttachment), ctx); } - json->getProperty("subPasses", &field); + json->getProperty("subpasses", &field); if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->subPasses), ctx); + ok &= sevalue_to_native(field, &(to->subpasses), ctx); + } + json->getProperty("dependencies", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dependencies), ctx); } return ok; } @@ -7251,7 +10769,10 @@ static bool js_gfx_RenderPassInfo_constructor(se::State& s) ok &= sevalue_to_native(args[1], &(cobj->depthStencilAttachment), nullptr); } if (argc > 2 && !args[2].isUndefined()) { - ok &= sevalue_to_native(args[2], &(cobj->subPasses), nullptr); + ok &= sevalue_to_native(args[2], &(cobj->subpasses), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->dependencies), nullptr); } if(!ok) { @@ -7292,7 +10813,8 @@ bool js_register_gfx_RenderPassInfo(se::Object* obj) cls->defineProperty("colorAttachments", _SE(js_gfx_RenderPassInfo_get_colorAttachments), _SE(js_gfx_RenderPassInfo_set_colorAttachments)); cls->defineProperty("depthStencilAttachment", _SE(js_gfx_RenderPassInfo_get_depthStencilAttachment), _SE(js_gfx_RenderPassInfo_set_depthStencilAttachment)); - cls->defineProperty("subPasses", _SE(js_gfx_RenderPassInfo_get_subPasses), _SE(js_gfx_RenderPassInfo_set_subPasses)); + cls->defineProperty("subpasses", _SE(js_gfx_RenderPassInfo_get_subpasses), _SE(js_gfx_RenderPassInfo_set_subpasses)); + cls->defineProperty("dependencies", _SE(js_gfx_RenderPassInfo_get_dependencies), _SE(js_gfx_RenderPassInfo_set_dependencies)); cls->defineFinalizeFunction(_SE(js_cc_gfx_RenderPassInfo_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -7303,7 +10825,453 @@ bool js_register_gfx_RenderPassInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_GlobalBarrierInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_GlobalBarrierInfo_class = nullptr; +static bool js_gfx_GlobalBarrierInfo_get_prevAccesses(se::State& s) +{ + cc::gfx::GlobalBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_GlobalBarrierInfo_get_prevAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->prevAccesses, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->prevAccesses, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_GlobalBarrierInfo_get_prevAccesses) + +static bool js_gfx_GlobalBarrierInfo_set_prevAccesses(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::GlobalBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_GlobalBarrierInfo_set_prevAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->prevAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_GlobalBarrierInfo_set_prevAccesses : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_GlobalBarrierInfo_set_prevAccesses) + +static bool js_gfx_GlobalBarrierInfo_get_nextAccesses(se::State& s) +{ + cc::gfx::GlobalBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_GlobalBarrierInfo_get_nextAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->nextAccesses, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->nextAccesses, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_GlobalBarrierInfo_get_nextAccesses) + +static bool js_gfx_GlobalBarrierInfo_set_nextAccesses(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::GlobalBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_GlobalBarrierInfo_set_nextAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->nextAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_GlobalBarrierInfo_set_nextAccesses : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_GlobalBarrierInfo_set_nextAccesses) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::GlobalBarrierInfo * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::GlobalBarrierInfo*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("prevAccesses", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->prevAccesses), ctx); + } + json->getProperty("nextAccesses", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->nextAccesses), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_GlobalBarrierInfo_finalize) + +static bool js_gfx_GlobalBarrierInfo_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::GlobalBarrierInfo* cobj = JSB_ALLOC(cc::gfx::GlobalBarrierInfo); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::GlobalBarrierInfo* cobj = JSB_ALLOC(cc::gfx::GlobalBarrierInfo); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::GlobalBarrierInfo* cobj = JSB_ALLOC(cc::gfx::GlobalBarrierInfo); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->prevAccesses), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->nextAccesses), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_GlobalBarrierInfo_constructor, __jsb_cc_gfx_GlobalBarrierInfo_class, js_cc_gfx_GlobalBarrierInfo_finalize) + + + + +static bool js_cc_gfx_GlobalBarrierInfo_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::GlobalBarrierInfo* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_GlobalBarrierInfo_finalize) + +bool js_register_gfx_GlobalBarrierInfo(se::Object* obj) +{ + auto cls = se::Class::create("GlobalBarrierInfo", obj, nullptr, _SE(js_gfx_GlobalBarrierInfo_constructor)); + + cls->defineProperty("prevAccesses", _SE(js_gfx_GlobalBarrierInfo_get_prevAccesses), _SE(js_gfx_GlobalBarrierInfo_set_prevAccesses)); + cls->defineProperty("nextAccesses", _SE(js_gfx_GlobalBarrierInfo_get_nextAccesses), _SE(js_gfx_GlobalBarrierInfo_set_nextAccesses)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_GlobalBarrierInfo_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_GlobalBarrierInfo_proto = cls->getProto(); + __jsb_cc_gfx_GlobalBarrierInfo_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_TextureBarrierInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_TextureBarrierInfo_class = nullptr; + +static bool js_gfx_TextureBarrierInfo_get_prevAccesses(se::State& s) +{ + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_get_prevAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->prevAccesses, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->prevAccesses, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBarrierInfo_get_prevAccesses) + +static bool js_gfx_TextureBarrierInfo_set_prevAccesses(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_set_prevAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->prevAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrierInfo_set_prevAccesses : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBarrierInfo_set_prevAccesses) + +static bool js_gfx_TextureBarrierInfo_get_nextAccesses(se::State& s) +{ + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_get_nextAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->nextAccesses, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->nextAccesses, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBarrierInfo_get_nextAccesses) + +static bool js_gfx_TextureBarrierInfo_set_nextAccesses(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_set_nextAccesses : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->nextAccesses, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrierInfo_set_nextAccesses : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBarrierInfo_set_nextAccesses) + +static bool js_gfx_TextureBarrierInfo_get_discardContents(se::State& s) +{ + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_get_discardContents : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->discardContents, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->discardContents, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBarrierInfo_get_discardContents) + +static bool js_gfx_TextureBarrierInfo_set_discardContents(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_set_discardContents : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->discardContents, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrierInfo_set_discardContents : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBarrierInfo_set_discardContents) + +static bool js_gfx_TextureBarrierInfo_get_srcQueue(se::State& s) +{ + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_get_srcQueue : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->srcQueue, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->srcQueue, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBarrierInfo_get_srcQueue) + +static bool js_gfx_TextureBarrierInfo_set_srcQueue(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_set_srcQueue : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->srcQueue, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrierInfo_set_srcQueue : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBarrierInfo_set_srcQueue) + +static bool js_gfx_TextureBarrierInfo_get_dstQueue(se::State& s) +{ + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_get_dstQueue : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->dstQueue, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->dstQueue, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_TextureBarrierInfo_get_dstQueue) + +static bool js_gfx_TextureBarrierInfo_set_dstQueue(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrierInfo_set_dstQueue : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->dstQueue, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrierInfo_set_dstQueue : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_TextureBarrierInfo_set_dstQueue) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::TextureBarrierInfo * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::TextureBarrierInfo*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("prevAccesses", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->prevAccesses), ctx); + } + json->getProperty("nextAccesses", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->nextAccesses), ctx); + } + json->getProperty("discardContents", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->discardContents), ctx); + } + json->getProperty("srcQueue", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->srcQueue), ctx); + } + json->getProperty("dstQueue", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->dstQueue), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureBarrierInfo_finalize) + +static bool js_gfx_TextureBarrierInfo_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::TextureBarrierInfo* cobj = JSB_ALLOC(cc::gfx::TextureBarrierInfo); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::TextureBarrierInfo* cobj = JSB_ALLOC(cc::gfx::TextureBarrierInfo); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::TextureBarrierInfo* cobj = JSB_ALLOC(cc::gfx::TextureBarrierInfo); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->prevAccesses), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->nextAccesses), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->discardContents), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->srcQueue), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->dstQueue), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_TextureBarrierInfo_constructor, __jsb_cc_gfx_TextureBarrierInfo_class, js_cc_gfx_TextureBarrierInfo_finalize) + + + + +static bool js_cc_gfx_TextureBarrierInfo_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::TextureBarrierInfo* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureBarrierInfo_finalize) + +bool js_register_gfx_TextureBarrierInfo(se::Object* obj) +{ + auto cls = se::Class::create("TextureBarrierInfo", obj, nullptr, _SE(js_gfx_TextureBarrierInfo_constructor)); + + cls->defineProperty("prevAccesses", _SE(js_gfx_TextureBarrierInfo_get_prevAccesses), _SE(js_gfx_TextureBarrierInfo_set_prevAccesses)); + cls->defineProperty("nextAccesses", _SE(js_gfx_TextureBarrierInfo_get_nextAccesses), _SE(js_gfx_TextureBarrierInfo_set_nextAccesses)); + cls->defineProperty("discardContents", _SE(js_gfx_TextureBarrierInfo_get_discardContents), _SE(js_gfx_TextureBarrierInfo_set_discardContents)); + cls->defineProperty("srcQueue", _SE(js_gfx_TextureBarrierInfo_get_srcQueue), _SE(js_gfx_TextureBarrierInfo_set_srcQueue)); + cls->defineProperty("dstQueue", _SE(js_gfx_TextureBarrierInfo_get_dstQueue), _SE(js_gfx_TextureBarrierInfo_set_dstQueue)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureBarrierInfo_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_TextureBarrierInfo_proto = cls->getProto(); + __jsb_cc_gfx_TextureBarrierInfo_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_FramebufferInfo_proto = nullptr; se::Class* __jsb_cc_gfx_FramebufferInfo_class = nullptr; @@ -7580,7 +11548,6 @@ bool js_register_gfx_FramebufferInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DescriptorSetLayoutBinding_proto = nullptr; se::Class* __jsb_cc_gfx_DescriptorSetLayoutBinding_class = nullptr; @@ -7857,7 +11824,6 @@ bool js_register_gfx_DescriptorSetLayoutBinding(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DescriptorSetLayoutInfo_proto = nullptr; se::Class* __jsb_cc_gfx_DescriptorSetLayoutInfo_class = nullptr; @@ -7977,7 +11943,6 @@ bool js_register_gfx_DescriptorSetLayoutInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DescriptorSetInfo_proto = nullptr; se::Class* __jsb_cc_gfx_DescriptorSetInfo_class = nullptr; @@ -8097,7 +12062,6 @@ bool js_register_gfx_DescriptorSetInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_PipelineLayoutInfo_proto = nullptr; se::Class* __jsb_cc_gfx_PipelineLayoutInfo_class = nullptr; @@ -8217,7 +12181,6 @@ bool js_register_gfx_PipelineLayoutInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_InputState_proto = nullptr; se::Class* __jsb_cc_gfx_InputState_class = nullptr; @@ -8337,7 +12300,6 @@ bool js_register_gfx_InputState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_RasterizerState_proto = nullptr; se::Class* __jsb_cc_gfx_RasterizerState_class = nullptr; @@ -8859,7 +12821,6 @@ bool js_register_gfx_RasterizerState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DepthStencilState_proto = nullptr; se::Class* __jsb_cc_gfx_DepthStencilState_class = nullptr; @@ -9626,7 +13587,6 @@ bool js_register_gfx_DepthStencilState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_BlendTarget_proto = nullptr; se::Class* __jsb_cc_gfx_BlendTarget_class = nullptr; @@ -10008,7 +13968,6 @@ bool js_register_gfx_BlendTarget(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_BlendState_proto = nullptr; se::Class* __jsb_cc_gfx_BlendState_class = nullptr; @@ -10250,512 +14209,40 @@ bool js_register_gfx_BlendState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_CommandBufferInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_CommandBufferInfo_class = nullptr; -se::Object* __jsb_cc_gfx_PipelineStateInfo_proto = nullptr; -se::Class* __jsb_cc_gfx_PipelineStateInfo_class = nullptr; - -static bool js_gfx_PipelineStateInfo_get_shader(se::State& s) +static bool js_gfx_CommandBufferInfo_get_queue(se::State& s) { - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_shader : Invalid Native Object"); + cc::gfx::CommandBufferInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_CommandBufferInfo_get_queue : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; - ok &= nativevalue_to_se(cobj->shader, jsret, s.thisObject() /*ctx*/); + ok &= nativevalue_to_se(cobj->queue, jsret, s.thisObject() /*ctx*/); s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->shader, s.thisObject(), s.rval()); + SE_HOLD_RETURN_VALUE(cobj->queue, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_shader) +SE_BIND_PROP_GET(js_gfx_CommandBufferInfo_get_queue) -static bool js_gfx_PipelineStateInfo_set_shader(se::State& s) +static bool js_gfx_CommandBufferInfo_set_queue(se::State& s) { const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_shader : Invalid Native Object"); + cc::gfx::CommandBufferInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_CommandBufferInfo_set_queue : Invalid Native Object"); CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->shader, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_shader : Error processing new value"); + ok &= sevalue_to_native(args[0], &cobj->queue, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_CommandBufferInfo_set_queue : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_shader) +SE_BIND_PROP_SET(js_gfx_CommandBufferInfo_set_queue) -static bool js_gfx_PipelineStateInfo_get_pipelineLayout(se::State& s) +static bool js_gfx_CommandBufferInfo_get_type(se::State& s) { - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_pipelineLayout : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->pipelineLayout, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->pipelineLayout, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_pipelineLayout) - -static bool js_gfx_PipelineStateInfo_set_pipelineLayout(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_pipelineLayout : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->pipelineLayout, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_pipelineLayout : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_pipelineLayout) - -static bool js_gfx_PipelineStateInfo_get_renderPass(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_renderPass : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->renderPass, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->renderPass, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_renderPass) - -static bool js_gfx_PipelineStateInfo_set_renderPass(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_renderPass : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->renderPass, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_renderPass : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_renderPass) - -static bool js_gfx_PipelineStateInfo_get_inputState(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_inputState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->inputState, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->inputState, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_inputState) - -static bool js_gfx_PipelineStateInfo_set_inputState(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_inputState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->inputState, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_inputState : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_inputState) - -static bool js_gfx_PipelineStateInfo_get_rasterizerState(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_rasterizerState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->rasterizerState, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->rasterizerState, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_rasterizerState) - -static bool js_gfx_PipelineStateInfo_set_rasterizerState(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_rasterizerState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->rasterizerState, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_rasterizerState : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_rasterizerState) - -static bool js_gfx_PipelineStateInfo_get_depthStencilState(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_depthStencilState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->depthStencilState, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->depthStencilState, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_depthStencilState) - -static bool js_gfx_PipelineStateInfo_set_depthStencilState(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_depthStencilState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->depthStencilState, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_depthStencilState : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_depthStencilState) - -static bool js_gfx_PipelineStateInfo_get_blendState(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_blendState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->blendState, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->blendState, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_blendState) - -static bool js_gfx_PipelineStateInfo_set_blendState(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_blendState : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->blendState, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_blendState : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_blendState) - -static bool js_gfx_PipelineStateInfo_get_primitive(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_primitive : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->primitive, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->primitive, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_primitive) - -static bool js_gfx_PipelineStateInfo_set_primitive(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_primitive : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->primitive, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_primitive : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_primitive) - -static bool js_gfx_PipelineStateInfo_get_dynamicStates(se::State& s) -{ - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_get_dynamicStates : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->dynamicStates, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->dynamicStates, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_PipelineStateInfo_get_dynamicStates) - -static bool js_gfx_PipelineStateInfo_set_dynamicStates(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_PipelineStateInfo_set_dynamicStates : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->dynamicStates, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineStateInfo_set_dynamicStates : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_PipelineStateInfo_set_dynamicStates) - - -template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::PipelineStateInfo * to, se::Object *ctx) -{ - assert(from.isObject()); - se::Object *json = from.toObject(); - auto* data = (cc::gfx::PipelineStateInfo*)json->getPrivateData(); - if (data) { - *to = *data; - return true; - } - se::Value field; - bool ok = true; - json->getProperty("shader", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->shader), ctx); - } - json->getProperty("pipelineLayout", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->pipelineLayout), ctx); - } - json->getProperty("renderPass", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->renderPass), ctx); - } - json->getProperty("inputState", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->inputState), ctx); - } - json->getProperty("rasterizerState", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->rasterizerState), ctx); - } - json->getProperty("depthStencilState", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->depthStencilState), ctx); - } - json->getProperty("blendState", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->blendState), ctx); - } - json->getProperty("primitive", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->primitive), ctx); - } - json->getProperty("dynamicStates", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->dynamicStates), ctx); - } - return ok; -} - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_PipelineStateInfo_finalize) - -static bool js_gfx_PipelineStateInfo_constructor(se::State& s) -{ - CC_UNUSED bool ok = true; - const auto& args = s.args(); - size_t argc = args.size(); - - if(argc == 0) - { - cc::gfx::PipelineStateInfo* cobj = JSB_ALLOC(cc::gfx::PipelineStateInfo); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else if(argc == 1 && args[0].isObject()) - { - se::Object *json = args[0].toObject(); - se::Value field; - - cc::gfx::PipelineStateInfo* cobj = JSB_ALLOC(cc::gfx::PipelineStateInfo); - ok &= sevalue_to_native(args[0], cobj, s.thisObject()); - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - else - { - cc::gfx::PipelineStateInfo* cobj = JSB_ALLOC(cc::gfx::PipelineStateInfo); - if (argc > 0 && !args[0].isUndefined()) { - ok &= sevalue_to_native(args[0], &(cobj->shader), nullptr); - } - if (argc > 1 && !args[1].isUndefined()) { - ok &= sevalue_to_native(args[1], &(cobj->pipelineLayout), nullptr); - } - if (argc > 2 && !args[2].isUndefined()) { - ok &= sevalue_to_native(args[2], &(cobj->renderPass), nullptr); - } - if (argc > 3 && !args[3].isUndefined()) { - ok &= sevalue_to_native(args[3], &(cobj->inputState), nullptr); - } - if (argc > 4 && !args[4].isUndefined()) { - ok &= sevalue_to_native(args[4], &(cobj->rasterizerState), nullptr); - } - if (argc > 5 && !args[5].isUndefined()) { - ok &= sevalue_to_native(args[5], &(cobj->depthStencilState), nullptr); - } - if (argc > 6 && !args[6].isUndefined()) { - ok &= sevalue_to_native(args[6], &(cobj->blendState), nullptr); - } - if (argc > 7 && !args[7].isUndefined()) { - ok &= sevalue_to_native(args[7], &(cobj->primitive), nullptr); - } - if (argc > 8 && !args[8].isUndefined()) { - ok &= sevalue_to_native(args[8], &(cobj->dynamicStates), nullptr); - } - - if(!ok) { - JSB_FREE(cobj); - SE_REPORT_ERROR("Argument convertion error"); - return false; - } - - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; - } - - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; -} -SE_BIND_CTOR(js_gfx_PipelineStateInfo_constructor, __jsb_cc_gfx_PipelineStateInfo_class, js_cc_gfx_PipelineStateInfo_finalize) - - - - -static bool js_cc_gfx_PipelineStateInfo_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::PipelineStateInfo* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_PipelineStateInfo_finalize) - -bool js_register_gfx_PipelineStateInfo(se::Object* obj) -{ - auto cls = se::Class::create("PipelineStateInfo", obj, nullptr, _SE(js_gfx_PipelineStateInfo_constructor)); - - cls->defineProperty("shader", _SE(js_gfx_PipelineStateInfo_get_shader), _SE(js_gfx_PipelineStateInfo_set_shader)); - cls->defineProperty("pipelineLayout", _SE(js_gfx_PipelineStateInfo_get_pipelineLayout), _SE(js_gfx_PipelineStateInfo_set_pipelineLayout)); - cls->defineProperty("renderPass", _SE(js_gfx_PipelineStateInfo_get_renderPass), _SE(js_gfx_PipelineStateInfo_set_renderPass)); - cls->defineProperty("inputState", _SE(js_gfx_PipelineStateInfo_get_inputState), _SE(js_gfx_PipelineStateInfo_set_inputState)); - cls->defineProperty("rasterizerState", _SE(js_gfx_PipelineStateInfo_get_rasterizerState), _SE(js_gfx_PipelineStateInfo_set_rasterizerState)); - cls->defineProperty("depthStencilState", _SE(js_gfx_PipelineStateInfo_get_depthStencilState), _SE(js_gfx_PipelineStateInfo_set_depthStencilState)); - cls->defineProperty("blendState", _SE(js_gfx_PipelineStateInfo_get_blendState), _SE(js_gfx_PipelineStateInfo_set_blendState)); - cls->defineProperty("primitive", _SE(js_gfx_PipelineStateInfo_get_primitive), _SE(js_gfx_PipelineStateInfo_set_primitive)); - cls->defineProperty("dynamicStates", _SE(js_gfx_PipelineStateInfo_get_dynamicStates), _SE(js_gfx_PipelineStateInfo_set_dynamicStates)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_PipelineStateInfo_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_PipelineStateInfo_proto = cls->getProto(); - __jsb_cc_gfx_PipelineStateInfo_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -se::Object* __jsb_cc_gfx_FormatInfo_proto = nullptr; -se::Class* __jsb_cc_gfx_FormatInfo_class = nullptr; - -static bool js_gfx_FormatInfo_get_name(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_name : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->name, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->name, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_name) - -static bool js_gfx_FormatInfo_set_name(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_name : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->name, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_name : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_name) - -static bool js_gfx_FormatInfo_get_size(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_size : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->size, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->size, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_size) - -static bool js_gfx_FormatInfo_set_size(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_size : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->size, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_size : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_size) - -static bool js_gfx_FormatInfo_get_count(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_count : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->count, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->count, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_count) - -static bool js_gfx_FormatInfo_set_count(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_count : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->count, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_count : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_count) - -static bool js_gfx_FormatInfo_get_type(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_type : Invalid Native Object"); + cc::gfx::CommandBufferInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_CommandBufferInfo_get_type : Invalid Native Object"); CC_UNUSED bool ok = true; se::Value jsret; @@ -10764,180 +14251,48 @@ static bool js_gfx_FormatInfo_get_type(se::State& s) SE_HOLD_RETURN_VALUE(cobj->type, s.thisObject(), s.rval()); return true; } -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_type) +SE_BIND_PROP_GET(js_gfx_CommandBufferInfo_get_type) -static bool js_gfx_FormatInfo_set_type(se::State& s) +static bool js_gfx_CommandBufferInfo_set_type(se::State& s) { const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_type : Invalid Native Object"); + cc::gfx::CommandBufferInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_CommandBufferInfo_set_type : Invalid Native Object"); CC_UNUSED bool ok = true; ok &= sevalue_to_native(args[0], &cobj->type, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_type : Error processing new value"); + SE_PRECONDITION2(ok, false, "js_gfx_CommandBufferInfo_set_type : Error processing new value"); return true; } -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_type) - -static bool js_gfx_FormatInfo_get_hasAlpha(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_hasAlpha : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->hasAlpha, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->hasAlpha, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_hasAlpha) - -static bool js_gfx_FormatInfo_set_hasAlpha(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_hasAlpha : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->hasAlpha, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_hasAlpha : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_hasAlpha) - -static bool js_gfx_FormatInfo_get_hasDepth(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_hasDepth : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->hasDepth, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->hasDepth, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_hasDepth) - -static bool js_gfx_FormatInfo_set_hasDepth(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_hasDepth : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->hasDepth, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_hasDepth : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_hasDepth) - -static bool js_gfx_FormatInfo_get_hasStencil(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_hasStencil : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->hasStencil, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->hasStencil, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_hasStencil) - -static bool js_gfx_FormatInfo_set_hasStencil(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_hasStencil : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->hasStencil, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_hasStencil : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_hasStencil) - -static bool js_gfx_FormatInfo_get_isCompressed(se::State& s) -{ - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_get_isCompressed : Invalid Native Object"); - - CC_UNUSED bool ok = true; - se::Value jsret; - ok &= nativevalue_to_se(cobj->isCompressed, jsret, s.thisObject() /*ctx*/); - s.rval() = jsret; - SE_HOLD_RETURN_VALUE(cobj->isCompressed, s.thisObject(), s.rval()); - return true; -} -SE_BIND_PROP_GET(js_gfx_FormatInfo_get_isCompressed) - -static bool js_gfx_FormatInfo_set_isCompressed(se::State& s) -{ - const auto& args = s.args(); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_FormatInfo_set_isCompressed : Invalid Native Object"); - - CC_UNUSED bool ok = true; - ok &= sevalue_to_native(args[0], &cobj->isCompressed, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_FormatInfo_set_isCompressed : Error processing new value"); - return true; -} -SE_BIND_PROP_SET(js_gfx_FormatInfo_set_isCompressed) +SE_BIND_PROP_SET(js_gfx_CommandBufferInfo_set_type) template<> -bool sevalue_to_native(const se::Value &from, cc::gfx::FormatInfo * to, se::Object *ctx) +bool sevalue_to_native(const se::Value &from, cc::gfx::CommandBufferInfo * to, se::Object *ctx) { assert(from.isObject()); se::Object *json = from.toObject(); - auto* data = (cc::gfx::FormatInfo*)json->getPrivateData(); + auto* data = (cc::gfx::CommandBufferInfo*)json->getPrivateData(); if (data) { *to = *data; return true; } se::Value field; bool ok = true; - json->getProperty("name", &field); + json->getProperty("queue", &field); if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->name), ctx); - } - json->getProperty("size", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->size), ctx); - } - json->getProperty("count", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->count), ctx); + ok &= sevalue_to_native(field, &(to->queue), ctx); } json->getProperty("type", &field); if(!field.isNullOrUndefined()) { ok &= sevalue_to_native(field, &(to->type), ctx); } - json->getProperty("hasAlpha", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->hasAlpha), ctx); - } - json->getProperty("hasDepth", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->hasDepth), ctx); - } - json->getProperty("hasStencil", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->hasStencil), ctx); - } - json->getProperty("isCompressed", &field); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->isCompressed), ctx); - } return ok; } -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_FormatInfo_finalize) +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_CommandBufferInfo_finalize) -static bool js_gfx_FormatInfo_constructor(se::State& s) +static bool js_gfx_CommandBufferInfo_constructor(se::State& s) { CC_UNUSED bool ok = true; const auto& args = s.args(); @@ -10945,7 +14300,7 @@ static bool js_gfx_FormatInfo_constructor(se::State& s) if(argc == 0) { - cc::gfx::FormatInfo* cobj = JSB_ALLOC(cc::gfx::FormatInfo); + cc::gfx::CommandBufferInfo* cobj = JSB_ALLOC(cc::gfx::CommandBufferInfo); s.thisObject()->setPrivateData(cobj); se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); return true; @@ -10955,7 +14310,7 @@ static bool js_gfx_FormatInfo_constructor(se::State& s) se::Object *json = args[0].toObject(); se::Value field; - cc::gfx::FormatInfo* cobj = JSB_ALLOC(cc::gfx::FormatInfo); + cc::gfx::CommandBufferInfo* cobj = JSB_ALLOC(cc::gfx::CommandBufferInfo); ok &= sevalue_to_native(args[0], cobj, s.thisObject()); if(!ok) { JSB_FREE(cobj); @@ -10969,30 +14324,12 @@ static bool js_gfx_FormatInfo_constructor(se::State& s) } else { - cc::gfx::FormatInfo* cobj = JSB_ALLOC(cc::gfx::FormatInfo); + cc::gfx::CommandBufferInfo* cobj = JSB_ALLOC(cc::gfx::CommandBufferInfo); if (argc > 0 && !args[0].isUndefined()) { - ok &= sevalue_to_native(args[0], &(cobj->name), nullptr); + ok &= sevalue_to_native(args[0], &(cobj->queue), nullptr); } if (argc > 1 && !args[1].isUndefined()) { - ok &= sevalue_to_native(args[1], &(cobj->size), nullptr); - } - if (argc > 2 && !args[2].isUndefined()) { - ok &= sevalue_to_native(args[2], &(cobj->count), nullptr); - } - if (argc > 3 && !args[3].isUndefined()) { - ok &= sevalue_to_native(args[3], &(cobj->type), nullptr); - } - if (argc > 4 && !args[4].isUndefined()) { - ok &= sevalue_to_native(args[4], &(cobj->hasAlpha), nullptr); - } - if (argc > 5 && !args[5].isUndefined()) { - ok &= sevalue_to_native(args[5], &(cobj->hasDepth), nullptr); - } - if (argc > 6 && !args[6].isUndefined()) { - ok &= sevalue_to_native(args[6], &(cobj->hasStencil), nullptr); - } - if (argc > 7 && !args[7].isUndefined()) { - ok &= sevalue_to_native(args[7], &(cobj->isCompressed), nullptr); + ok &= sevalue_to_native(args[1], &(cobj->type), nullptr); } if(!ok) { @@ -11009,47 +14346,159 @@ static bool js_gfx_FormatInfo_constructor(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_CTOR(js_gfx_FormatInfo_constructor, __jsb_cc_gfx_FormatInfo_class, js_cc_gfx_FormatInfo_finalize) +SE_BIND_CTOR(js_gfx_CommandBufferInfo_constructor, __jsb_cc_gfx_CommandBufferInfo_class, js_cc_gfx_CommandBufferInfo_finalize) -static bool js_cc_gfx_FormatInfo_finalize(se::State& s) +static bool js_cc_gfx_CommandBufferInfo_finalize(se::State& s) { - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::FormatInfo* cobj = SE_THIS_OBJECT(s); + cc::gfx::CommandBufferInfo* cobj = SE_THIS_OBJECT(s); JSB_FREE(cobj); } return true; } -SE_BIND_FINALIZE_FUNC(js_cc_gfx_FormatInfo_finalize) +SE_BIND_FINALIZE_FUNC(js_cc_gfx_CommandBufferInfo_finalize) -bool js_register_gfx_FormatInfo(se::Object* obj) +bool js_register_gfx_CommandBufferInfo(se::Object* obj) { - auto cls = se::Class::create("FormatInfo", obj, nullptr, _SE(js_gfx_FormatInfo_constructor)); + auto cls = se::Class::create("CommandBufferInfo", obj, nullptr, _SE(js_gfx_CommandBufferInfo_constructor)); - cls->defineProperty("name", _SE(js_gfx_FormatInfo_get_name), _SE(js_gfx_FormatInfo_set_name)); - cls->defineProperty("size", _SE(js_gfx_FormatInfo_get_size), _SE(js_gfx_FormatInfo_set_size)); - cls->defineProperty("count", _SE(js_gfx_FormatInfo_get_count), _SE(js_gfx_FormatInfo_set_count)); - cls->defineProperty("type", _SE(js_gfx_FormatInfo_get_type), _SE(js_gfx_FormatInfo_set_type)); - cls->defineProperty("hasAlpha", _SE(js_gfx_FormatInfo_get_hasAlpha), _SE(js_gfx_FormatInfo_set_hasAlpha)); - cls->defineProperty("hasDepth", _SE(js_gfx_FormatInfo_get_hasDepth), _SE(js_gfx_FormatInfo_set_hasDepth)); - cls->defineProperty("hasStencil", _SE(js_gfx_FormatInfo_get_hasStencil), _SE(js_gfx_FormatInfo_set_hasStencil)); - cls->defineProperty("isCompressed", _SE(js_gfx_FormatInfo_get_isCompressed), _SE(js_gfx_FormatInfo_set_isCompressed)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_FormatInfo_finalize)); + cls->defineProperty("queue", _SE(js_gfx_CommandBufferInfo_get_queue), _SE(js_gfx_CommandBufferInfo_set_queue)); + cls->defineProperty("type", _SE(js_gfx_CommandBufferInfo_get_type), _SE(js_gfx_CommandBufferInfo_set_type)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_CommandBufferInfo_finalize)); cls->install(); - JSBClassType::registerClass(cls); + JSBClassType::registerClass(cls); - __jsb_cc_gfx_FormatInfo_proto = cls->getProto(); - __jsb_cc_gfx_FormatInfo_class = cls; + __jsb_cc_gfx_CommandBufferInfo_proto = cls->getProto(); + __jsb_cc_gfx_CommandBufferInfo_class = cls; se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_QueueInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_QueueInfo_class = nullptr; +static bool js_gfx_QueueInfo_get_type(se::State& s) +{ + cc::gfx::QueueInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_QueueInfo_get_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->type, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->type, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_QueueInfo_get_type) + +static bool js_gfx_QueueInfo_set_type(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::QueueInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_QueueInfo_set_type : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->type, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_QueueInfo_set_type : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_QueueInfo_set_type) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::QueueInfo * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::QueueInfo*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("type", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->type), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_QueueInfo_finalize) + +static bool js_gfx_QueueInfo_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::QueueInfo* cobj = JSB_ALLOC(cc::gfx::QueueInfo); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::QueueInfo* cobj = JSB_ALLOC(cc::gfx::QueueInfo); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->type), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_QueueInfo_constructor, __jsb_cc_gfx_QueueInfo_class, js_cc_gfx_QueueInfo_finalize) + + + + +static bool js_cc_gfx_QueueInfo_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::QueueInfo* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_QueueInfo_finalize) + +bool js_register_gfx_QueueInfo(se::Object* obj) +{ + auto cls = se::Class::create("QueueInfo", obj, nullptr, _SE(js_gfx_QueueInfo_constructor)); + + cls->defineProperty("type", _SE(js_gfx_QueueInfo_get_type), _SE(js_gfx_QueueInfo_set_type)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_QueueInfo_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_QueueInfo_proto = cls->getProto(); + __jsb_cc_gfx_QueueInfo_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_MemoryStatus_proto = nullptr; se::Class* __jsb_cc_gfx_MemoryStatus_class = nullptr; @@ -11221,7 +14670,352 @@ bool js_register_gfx_MemoryStatus(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_DeviceInfo_proto = nullptr; +se::Class* __jsb_cc_gfx_DeviceInfo_class = nullptr; +static bool js_gfx_DeviceInfo_get_isAntiAlias(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_isAntiAlias : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->isAntiAlias, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->isAntiAlias, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_isAntiAlias) + +static bool js_gfx_DeviceInfo_set_isAntiAlias(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_isAntiAlias : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->isAntiAlias, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_isAntiAlias : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_isAntiAlias) + +static bool js_gfx_DeviceInfo_get_windowHandle(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_windowHandle : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->windowHandle, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->windowHandle, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_windowHandle) + +static bool js_gfx_DeviceInfo_set_windowHandle(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_windowHandle : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->windowHandle, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_windowHandle : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_windowHandle) + +static bool js_gfx_DeviceInfo_get_width(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_width : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->width, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->width, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_width) + +static bool js_gfx_DeviceInfo_set_width(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_width : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->width, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_width : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_width) + +static bool js_gfx_DeviceInfo_get_height(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_height : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->height, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->height, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_height) + +static bool js_gfx_DeviceInfo_set_height(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_height : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->height, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_height : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_height) + +static bool js_gfx_DeviceInfo_get_nativeWidth(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_nativeWidth : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->nativeWidth, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->nativeWidth, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_nativeWidth) + +static bool js_gfx_DeviceInfo_set_nativeWidth(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_nativeWidth : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->nativeWidth, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_nativeWidth : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_nativeWidth) + +static bool js_gfx_DeviceInfo_get_nativeHeight(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_nativeHeight : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->nativeHeight, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->nativeHeight, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_nativeHeight) + +static bool js_gfx_DeviceInfo_set_nativeHeight(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_nativeHeight : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->nativeHeight, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_nativeHeight : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_nativeHeight) + +static bool js_gfx_DeviceInfo_get_bindingMappingInfo(se::State& s) +{ + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_get_bindingMappingInfo : Invalid Native Object"); + + CC_UNUSED bool ok = true; + se::Value jsret; + ok &= nativevalue_to_se(cobj->bindingMappingInfo, jsret, s.thisObject() /*ctx*/); + s.rval() = jsret; + SE_HOLD_RETURN_VALUE(cobj->bindingMappingInfo, s.thisObject(), s.rval()); + return true; +} +SE_BIND_PROP_GET(js_gfx_DeviceInfo_get_bindingMappingInfo) + +static bool js_gfx_DeviceInfo_set_bindingMappingInfo(se::State& s) +{ + const auto& args = s.args(); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_DeviceInfo_set_bindingMappingInfo : Invalid Native Object"); + + CC_UNUSED bool ok = true; + ok &= sevalue_to_native(args[0], &cobj->bindingMappingInfo, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_DeviceInfo_set_bindingMappingInfo : Error processing new value"); + return true; +} +SE_BIND_PROP_SET(js_gfx_DeviceInfo_set_bindingMappingInfo) + + +template<> +bool sevalue_to_native(const se::Value &from, cc::gfx::DeviceInfo * to, se::Object *ctx) +{ + assert(from.isObject()); + se::Object *json = from.toObject(); + auto* data = (cc::gfx::DeviceInfo*)json->getPrivateData(); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + json->getProperty("isAntiAlias", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->isAntiAlias), ctx); + } + json->getProperty("windowHandle", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->windowHandle), ctx); + } + json->getProperty("width", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->width), ctx); + } + json->getProperty("height", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->height), ctx); + } + json->getProperty("nativeWidth", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->nativeWidth), ctx); + } + json->getProperty("nativeHeight", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->nativeHeight), ctx); + } + json->getProperty("bindingMappingInfo", &field); + if(!field.isNullOrUndefined()) { + ok &= sevalue_to_native(field, &(to->bindingMappingInfo), ctx); + } + return ok; +} + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_DeviceInfo_finalize) + +static bool js_gfx_DeviceInfo_constructor(se::State& s) +{ + CC_UNUSED bool ok = true; + const auto& args = s.args(); + size_t argc = args.size(); + + if(argc == 0) + { + cc::gfx::DeviceInfo* cobj = JSB_ALLOC(cc::gfx::DeviceInfo); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else if(argc == 1 && args[0].isObject()) + { + se::Object *json = args[0].toObject(); + se::Value field; + + cc::gfx::DeviceInfo* cobj = JSB_ALLOC(cc::gfx::DeviceInfo); + ok &= sevalue_to_native(args[0], cobj, s.thisObject()); + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + else + { + cc::gfx::DeviceInfo* cobj = JSB_ALLOC(cc::gfx::DeviceInfo); + if (argc > 0 && !args[0].isUndefined()) { + ok &= sevalue_to_native(args[0], &(cobj->isAntiAlias), nullptr); + } + if (argc > 1 && !args[1].isUndefined()) { + ok &= sevalue_to_native(args[1], &(cobj->windowHandle), nullptr); + } + if (argc > 2 && !args[2].isUndefined()) { + ok &= sevalue_to_native(args[2], &(cobj->width), nullptr); + } + if (argc > 3 && !args[3].isUndefined()) { + ok &= sevalue_to_native(args[3], &(cobj->height), nullptr); + } + if (argc > 4 && !args[4].isUndefined()) { + ok &= sevalue_to_native(args[4], &(cobj->nativeWidth), nullptr); + } + if (argc > 5 && !args[5].isUndefined()) { + ok &= sevalue_to_native(args[5], &(cobj->nativeHeight), nullptr); + } + if (argc > 6 && !args[6].isUndefined()) { + ok &= sevalue_to_native(args[6], &(cobj->bindingMappingInfo), nullptr); + } + + if(!ok) { + JSB_FREE(cobj); + SE_REPORT_ERROR("Argument convertion error"); + return false; + } + + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; + } + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_CTOR(js_gfx_DeviceInfo_constructor, __jsb_cc_gfx_DeviceInfo_class, js_cc_gfx_DeviceInfo_finalize) + + + + +static bool js_cc_gfx_DeviceInfo_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::DeviceInfo* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_DeviceInfo_finalize) + +bool js_register_gfx_DeviceInfo(se::Object* obj) +{ + auto cls = se::Class::create("DeviceInfo", obj, nullptr, _SE(js_gfx_DeviceInfo_constructor)); + + cls->defineProperty("isAntiAlias", _SE(js_gfx_DeviceInfo_get_isAntiAlias), _SE(js_gfx_DeviceInfo_set_isAntiAlias)); + cls->defineProperty("windowHandle", _SE(js_gfx_DeviceInfo_get_windowHandle), _SE(js_gfx_DeviceInfo_set_windowHandle)); + cls->defineProperty("width", _SE(js_gfx_DeviceInfo_get_width), _SE(js_gfx_DeviceInfo_set_width)); + cls->defineProperty("height", _SE(js_gfx_DeviceInfo_get_height), _SE(js_gfx_DeviceInfo_set_height)); + cls->defineProperty("nativeWidth", _SE(js_gfx_DeviceInfo_get_nativeWidth), _SE(js_gfx_DeviceInfo_set_nativeWidth)); + cls->defineProperty("nativeHeight", _SE(js_gfx_DeviceInfo_get_nativeHeight), _SE(js_gfx_DeviceInfo_set_nativeHeight)); + cls->defineProperty("bindingMappingInfo", _SE(js_gfx_DeviceInfo_get_bindingMappingInfo), _SE(js_gfx_DeviceInfo_set_bindingMappingInfo)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_DeviceInfo_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_DeviceInfo_proto = cls->getProto(); + __jsb_cc_gfx_DeviceInfo_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_GFXObject_proto = nullptr; se::Class* __jsb_cc_gfx_GFXObject_class = nullptr; @@ -11291,7 +15085,6 @@ bool js_register_gfx_GFXObject(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_Buffer_proto = nullptr; se::Class* __jsb_cc_gfx_Buffer_class = nullptr; @@ -11443,6 +15236,26 @@ static bool js_gfx_Buffer_resize(se::State& s) } SE_BIND_FUNC(js_gfx_Buffer_resize) +static bool js_gfx_Buffer_computeHash(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, nullptr); + SE_PRECONDITION2(ok, false, "js_gfx_Buffer_computeHash : Error processing arguments"); + unsigned int result = cc::gfx::Buffer::computeHash(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Buffer_computeHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Buffer_computeHash) + SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Buffer_finalize) static bool js_gfx_Buffer_constructor(se::State& s) // constructor.c @@ -11482,6 +15295,7 @@ bool js_register_gfx_Buffer(se::Object* obj) cls->defineProperty("size", _SE(js_gfx_Buffer_getSize), nullptr); cls->defineFunction("destroy", _SE(js_gfx_Buffer_destroy)); cls->defineFunction("resize", _SE(js_gfx_Buffer_resize)); + cls->defineStaticFunction("computeHash", _SE(js_gfx_Buffer_computeHash)); cls->defineFinalizeFunction(_SE(js_cc_gfx_Buffer_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -11492,7 +15306,459 @@ bool js_register_gfx_Buffer(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_InputAssembler_proto = nullptr; +se::Class* __jsb_cc_gfx_InputAssembler_class = nullptr; +static bool js_gfx_InputAssembler_destroy(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_destroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->destroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_InputAssembler_destroy) + +static bool js_gfx_InputAssembler_getAttributes(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getAttributes : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getAttributes(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getAttributes : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getAttributes) + +static bool js_gfx_InputAssembler_getAttributesHash(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getAttributesHash : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getAttributesHash(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getAttributesHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getAttributesHash) + +static bool js_gfx_InputAssembler_getFirstIndex(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getFirstIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getFirstIndex(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getFirstIndex : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getFirstIndex) + +static bool js_gfx_InputAssembler_getFirstInstance(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getFirstInstance : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getFirstInstance(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getFirstInstance : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getFirstInstance) + +static bool js_gfx_InputAssembler_getFirstVertex(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getFirstVertex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getFirstVertex(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getFirstVertex : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getFirstVertex) + +static bool js_gfx_InputAssembler_getIndexBuffer(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getIndexBuffer : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::gfx::Buffer* result = cobj->getIndexBuffer(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getIndexBuffer : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getIndexBuffer) + +static bool js_gfx_InputAssembler_getIndexCount(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getIndexCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getIndexCount(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getIndexCount : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getIndexCount) + +static bool js_gfx_InputAssembler_getIndirectBuffer(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getIndirectBuffer : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::gfx::Buffer* result = cobj->getIndirectBuffer(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getIndirectBuffer : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getIndirectBuffer) + +static bool js_gfx_InputAssembler_getInstanceCount(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getInstanceCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getInstanceCount(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getInstanceCount : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getInstanceCount) + +static bool js_gfx_InputAssembler_getVertexBuffers(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getVertexBuffers : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getVertexBuffers(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getVertexBuffers : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getVertexBuffers) + +static bool js_gfx_InputAssembler_getVertexCount(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getVertexCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getVertexCount(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getVertexCount : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getVertexCount) + +static bool js_gfx_InputAssembler_getVertexOffset(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getVertexOffset : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getVertexOffset(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getVertexOffset : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_InputAssembler_getVertexOffset) + +static bool js_gfx_InputAssembler_initialize(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_InputAssembler_initialize) + +static bool js_gfx_InputAssembler_setFirstIndex(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setFirstIndex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setFirstIndex : Error processing arguments"); + cobj->setFirstIndex(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setFirstIndex) + +static bool js_gfx_InputAssembler_setFirstInstance(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setFirstInstance : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setFirstInstance : Error processing arguments"); + cobj->setFirstInstance(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setFirstInstance) + +static bool js_gfx_InputAssembler_setFirstVertex(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setFirstVertex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setFirstVertex : Error processing arguments"); + cobj->setFirstVertex(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setFirstVertex) + +static bool js_gfx_InputAssembler_setIndexCount(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setIndexCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setIndexCount : Error processing arguments"); + cobj->setIndexCount(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setIndexCount) + +static bool js_gfx_InputAssembler_setInstanceCount(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setInstanceCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setInstanceCount : Error processing arguments"); + cobj->setInstanceCount(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setInstanceCount) + +static bool js_gfx_InputAssembler_setVertexCount(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setVertexCount : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setVertexCount : Error processing arguments"); + cobj->setVertexCount(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setVertexCount) + +static bool js_gfx_InputAssembler_setVertexOffset(se::State& s) +{ + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setVertexOffset : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setVertexOffset : Error processing arguments"); + cobj->setVertexOffset(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_PROP_SET(js_gfx_InputAssembler_setVertexOffset) + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_InputAssembler_finalize) + +static bool js_gfx_InputAssembler_constructor(se::State& s) // constructor.c +{ + //#3 cc::gfx::InputAssembler: is_skip_construtor True + se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::InputAssembler constructor is skipped\")"); + return false; +} +SE_BIND_CTOR(js_gfx_InputAssembler_constructor, __jsb_cc_gfx_InputAssembler_class, js_cc_gfx_InputAssembler_finalize) + + + +extern se::Object* __jsb_cc_gfx_GFXObject_proto; + +static bool js_cc_gfx_InputAssembler_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_InputAssembler_finalize) + +bool js_register_gfx_InputAssembler(se::Object* obj) +{ + auto cls = se::Class::create("InputAssembler", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_InputAssembler_constructor)); + + cls->defineProperty("instanceCount", _SE(js_gfx_InputAssembler_getInstanceCount), _SE(js_gfx_InputAssembler_setInstanceCount)); + cls->defineProperty("vertexBuffers", _SE(js_gfx_InputAssembler_getVertexBuffers), nullptr); + cls->defineProperty("attributesHash", _SE(js_gfx_InputAssembler_getAttributesHash), nullptr); + cls->defineProperty("firstInstance", _SE(js_gfx_InputAssembler_getFirstInstance), _SE(js_gfx_InputAssembler_setFirstInstance)); + cls->defineProperty("vertexCount", _SE(js_gfx_InputAssembler_getVertexCount), _SE(js_gfx_InputAssembler_setVertexCount)); + cls->defineProperty("indexBuffer", _SE(js_gfx_InputAssembler_getIndexBuffer), nullptr); + cls->defineProperty("vertexOffset", _SE(js_gfx_InputAssembler_getVertexOffset), _SE(js_gfx_InputAssembler_setVertexOffset)); + cls->defineProperty("attributes", _SE(js_gfx_InputAssembler_getAttributes), nullptr); + cls->defineProperty("indexCount", _SE(js_gfx_InputAssembler_getIndexCount), _SE(js_gfx_InputAssembler_setIndexCount)); + cls->defineProperty("firstIndex", _SE(js_gfx_InputAssembler_getFirstIndex), _SE(js_gfx_InputAssembler_setFirstIndex)); + cls->defineProperty("indirectBuffer", _SE(js_gfx_InputAssembler_getIndirectBuffer), nullptr); + cls->defineProperty("firstVertex", _SE(js_gfx_InputAssembler_getFirstVertex), _SE(js_gfx_InputAssembler_setFirstVertex)); + cls->defineFunction("destroy", _SE(js_gfx_InputAssembler_destroy)); + cls->defineFunction("initialize", _SE(js_gfx_InputAssembler_initialize)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_InputAssembler_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_InputAssembler_proto = cls->getProto(); + __jsb_cc_gfx_InputAssembler_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_CommandBuffer_proto = nullptr; se::Class* __jsb_cc_gfx_CommandBuffer_class = nullptr; @@ -11512,11 +15778,10 @@ static bool js_gfx_CommandBuffer_begin(se::State& s) } while(false); do { - if (argc == 4) { + if (argc == 3) { HolderType arg0 = {}; HolderType arg1 = {}; HolderType arg2 = {}; - HolderType arg3 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); if (!ok) { ok = true; break; } @@ -11524,20 +15789,7 @@ static bool js_gfx_CommandBuffer_begin(se::State& s) if (!ok) { ok = true; break; } ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->begin(arg0.value(), arg1.value(), arg2.value(), arg3.value()); - return true; - } - } while(false); - - do { - if (argc == 1) { - HolderType arg0 = {}; - - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->begin(arg0.value()); + cobj->begin(arg0.value(), arg1.value(), arg2.value()); return true; } } while(false); @@ -11567,33 +15819,16 @@ static bool js_gfx_CommandBuffer_begin(se::State& s) } } while(false); - do { - if (argc == 3) { - HolderType arg0 = {}; - HolderType arg1 = {}; - HolderType arg2 = {}; - - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->begin(arg0.value(), arg1.value(), arg2.value()); - return true; - } - } while(false); - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } SE_BIND_FUNC(js_gfx_CommandBuffer_begin) -static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) +static bool js_gfx_CommandBuffer_beginRenderPassForJS(se::State& s) { CC_UNUSED bool ok = true; cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2( cobj, false, "js_gfx_CommandBuffer_beginRenderPass : Invalid Native Object"); + SE_PRECONDITION2( cobj, false, "js_gfx_CommandBuffer_beginRenderPassForJS : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); do { @@ -11601,7 +15836,7 @@ static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) HolderType arg0 = {}; HolderType arg1 = {}; HolderType arg2 = {}; - HolderType arg3 = {}; + HolderType, true> arg3 = {}; HolderType arg4 = {}; HolderType arg5 = {}; @@ -11617,7 +15852,7 @@ static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) if (!ok) { ok = true; break; } ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); if (!ok) { ok = true; break; } - cobj->beginRenderPass(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + cobj->beginRenderPassForJS(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); return true; } } while(false); @@ -11627,10 +15862,10 @@ static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) HolderType arg0 = {}; HolderType arg1 = {}; HolderType arg2 = {}; - HolderType arg3 = {}; + HolderType, true> arg3 = {}; HolderType arg4 = {}; HolderType arg5 = {}; - HolderType arg6 = {}; + HolderType, true> arg6 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); if (!ok) { ok = true; break; } @@ -11645,33 +15880,8 @@ static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); if (!ok) { ok = true; break; } ok &= sevalue_to_native(args[6], &arg6, s.thisObject()); - cobj->beginRenderPass(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value(), arg6.value()); - return true; - } - } while(false); - - do { - if (argc == 6) { - HolderType arg0 = {}; - HolderType arg1 = {}; - HolderType arg2 = {}; - HolderType arg3 = {}; - HolderType arg4 = {}; - HolderType arg5 = {}; - - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->beginRenderPass(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + cobj->beginRenderPassForJS(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value(), arg6.value()); return true; } } while(false); @@ -11679,7 +15889,7 @@ static bool js_gfx_CommandBuffer_beginRenderPass(se::State& s) SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_FUNC(js_gfx_CommandBuffer_beginRenderPass) +SE_BIND_FUNC(js_gfx_CommandBuffer_beginRenderPassForJS) static bool js_gfx_CommandBuffer_bindDescriptorSetForJS(se::State& s) { @@ -11762,6 +15972,61 @@ static bool js_gfx_CommandBuffer_bindPipelineState(se::State& s) } SE_BIND_FUNC(js_gfx_CommandBuffer_bindPipelineState) +static bool js_gfx_CommandBuffer_blitTexture(se::State& s) +{ + CC_UNUSED bool ok = true; + cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2( cobj, false, "js_gfx_CommandBuffer_blitTexture : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 4) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType, true> arg2 = {}; + HolderType arg3 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->blitTexture(arg0.value(), arg1.value(), arg2.value(), arg3.value()); + return true; + } + } while(false); + + do { + if (argc == 5) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->blitTexture(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value()); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_FUNC(js_gfx_CommandBuffer_blitTexture) + static bool js_gfx_CommandBuffer_destroy(se::State& s) { cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); @@ -11777,23 +16042,57 @@ static bool js_gfx_CommandBuffer_destroy(se::State& s) } SE_BIND_FUNC(js_gfx_CommandBuffer_destroy) -static bool js_gfx_CommandBuffer_draw(se::State& s) +static bool js_gfx_CommandBuffer_dispatch(se::State& s) { cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_draw : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_dispatch : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - HolderType arg0 = {}; + HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_CommandBuffer_draw : Error processing arguments"); - cobj->draw(arg0.value()); + SE_PRECONDITION2(ok, false, "js_gfx_CommandBuffer_dispatch : Error processing arguments"); + cobj->dispatch(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } +SE_BIND_FUNC(js_gfx_CommandBuffer_dispatch) + +static bool js_gfx_CommandBuffer_draw(se::State& s) +{ + CC_UNUSED bool ok = true; + cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2( cobj, false, "js_gfx_CommandBuffer_draw : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 1) { + HolderType arg0 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->draw(arg0.value()); + return true; + } + } while(false); + + do { + if (argc == 1) { + HolderType arg0 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->draw(arg0.value()); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} SE_BIND_FUNC(js_gfx_CommandBuffer_draw) static bool js_gfx_CommandBuffer_end(se::State& s) @@ -11932,10 +16231,7 @@ static bool js_gfx_CommandBuffer_initialize(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_gfx_CommandBuffer_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_CommandBuffer_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + cobj->initialize(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); @@ -11943,6 +16239,81 @@ static bool js_gfx_CommandBuffer_initialize(se::State& s) } SE_BIND_FUNC(js_gfx_CommandBuffer_initialize) +static bool js_gfx_CommandBuffer_nextSubpass(se::State& s) +{ + cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_CommandBuffer_nextSubpass : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->nextSubpass(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_CommandBuffer_nextSubpass) + +static bool js_gfx_CommandBuffer_pipelineBarrier(se::State& s) +{ + CC_UNUSED bool ok = true; + cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2( cobj, false, "js_gfx_CommandBuffer_pipelineBarrier : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + do { + if (argc == 1) { + HolderType arg0 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->pipelineBarrier(arg0.value()); + return true; + } + } while(false); + + do { + if (argc == 4) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->pipelineBarrier(arg0.value(), arg1.value(), arg2.value(), arg3.value()); + return true; + } + } while(false); + + do { + if (argc == 3) { + HolderType arg0 = {}; + HolderType, true> arg1 = {}; + HolderType, true> arg2 = {}; + + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + if (!ok) { ok = true; break; } + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + if (!ok) { ok = true; break; } + cobj->pipelineBarrier(arg0.value(), arg1.value(), arg2.value()); + return true; + } + } while(false); + + SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); + return false; +} +SE_BIND_FUNC(js_gfx_CommandBuffer_pipelineBarrier) + static bool js_gfx_CommandBuffer_setBlendConstants(se::State& s) { cc::gfx::CommandBuffer* cobj = SE_THIS_OBJECT(s); @@ -12139,11 +16510,13 @@ bool js_register_gfx_CommandBuffer(se::Object* obj) auto cls = se::Class::create("CommandBuffer", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_CommandBuffer_constructor)); cls->defineFunction("begin", _SE(js_gfx_CommandBuffer_begin)); - cls->defineFunction("beginRenderPass", _SE(js_gfx_CommandBuffer_beginRenderPass)); + cls->defineFunction("beginRenderPass", _SE(js_gfx_CommandBuffer_beginRenderPassForJS)); cls->defineFunction("bindDescriptorSet", _SE(js_gfx_CommandBuffer_bindDescriptorSetForJS)); cls->defineFunction("bindInputAssembler", _SE(js_gfx_CommandBuffer_bindInputAssembler)); cls->defineFunction("bindPipelineState", _SE(js_gfx_CommandBuffer_bindPipelineState)); + cls->defineFunction("blitTexture", _SE(js_gfx_CommandBuffer_blitTexture)); cls->defineFunction("destroy", _SE(js_gfx_CommandBuffer_destroy)); + cls->defineFunction("dispatch", _SE(js_gfx_CommandBuffer_dispatch)); cls->defineFunction("draw", _SE(js_gfx_CommandBuffer_draw)); cls->defineFunction("end", _SE(js_gfx_CommandBuffer_end)); cls->defineFunction("endRenderPass", _SE(js_gfx_CommandBuffer_endRenderPass)); @@ -12153,6 +16526,8 @@ bool js_register_gfx_CommandBuffer(se::Object* obj) cls->defineFunction("getQueue", _SE(js_gfx_CommandBuffer_getQueue)); cls->defineFunction("getType", _SE(js_gfx_CommandBuffer_getType)); cls->defineFunction("initialize", _SE(js_gfx_CommandBuffer_initialize)); + cls->defineFunction("nextSubpass", _SE(js_gfx_CommandBuffer_nextSubpass)); + cls->defineFunction("pipelineBarrier", _SE(js_gfx_CommandBuffer_pipelineBarrier)); cls->defineFunction("setBlendConstants", _SE(js_gfx_CommandBuffer_setBlendConstants)); cls->defineFunction("setDepthBias", _SE(js_gfx_CommandBuffer_setDepthBias)); cls->defineFunction("setDepthBound", _SE(js_gfx_CommandBuffer_setDepthBound)); @@ -12171,7 +16546,6 @@ bool js_register_gfx_CommandBuffer(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_Context_proto = nullptr; se::Class* __jsb_cc_gfx_Context_class = nullptr; @@ -12228,25 +16602,6 @@ static bool js_gfx_Context_getDepthStencilFormat(se::State& s) } SE_BIND_PROP_GET(js_gfx_Context_getDepthStencilFormat) -static bool js_gfx_Context_getDevice(se::State& s) -{ - cc::gfx::Context* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Context_getDevice : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - cc::gfx::Device* result = cobj->getDevice(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Context_getDevice : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Context_getDevice) - static bool js_gfx_Context_getSharedContext(se::State& s) { cc::gfx::Context* cobj = SE_THIS_OBJECT(s); @@ -12357,7 +16712,6 @@ bool js_register_gfx_Context(se::Object* obj) cls->defineProperty("colorFormat", _SE(js_gfx_Context_getColorFormat), nullptr); cls->defineProperty("depthStencilFormat", _SE(js_gfx_Context_getDepthStencilFormat), nullptr); cls->defineFunction("destroy", _SE(js_gfx_Context_destroy)); - cls->defineFunction("getDevice", _SE(js_gfx_Context_getDevice)); cls->defineFunction("initialize", _SE(js_gfx_Context_initialize)); cls->defineFunction("present", _SE(js_gfx_Context_present)); cls->defineFinalizeFunction(_SE(js_cc_gfx_Context_finalize)); @@ -12370,7 +16724,6 @@ bool js_register_gfx_Context(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DescriptorSet_proto = nullptr; se::Class* __jsb_cc_gfx_DescriptorSet_class = nullptr; @@ -12736,10 +17089,7 @@ static bool js_gfx_DescriptorSet_initialize(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_gfx_DescriptorSet_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_DescriptorSet_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + cobj->initialize(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); @@ -12815,7 +17165,6 @@ bool js_register_gfx_DescriptorSet(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_DescriptorSetLayout_proto = nullptr; se::Class* __jsb_cc_gfx_DescriptorSetLayout_class = nullptr; @@ -12883,10 +17232,7 @@ static bool js_gfx_DescriptorSetLayout_initialize(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_gfx_DescriptorSetLayout_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_DescriptorSetLayout_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + cobj->initialize(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); @@ -12939,1227 +17285,6 @@ bool js_register_gfx_DescriptorSetLayout(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - -se::Object* __jsb_cc_gfx_Fence_proto = nullptr; -se::Class* __jsb_cc_gfx_Fence_class = nullptr; - -static bool js_gfx_Fence_destroy(se::State& s) -{ - cc::gfx::Fence* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Fence_destroy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->destroy(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Fence_destroy) - -static bool js_gfx_Fence_initialize(se::State& s) -{ - cc::gfx::Fence* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Fence_initialize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_Fence_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Fence_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gfx_Fence_initialize) - -static bool js_gfx_Fence_reset(se::State& s) -{ - cc::gfx::Fence* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Fence_reset : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->reset(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Fence_reset) - -static bool js_gfx_Fence_wait(se::State& s) -{ - cc::gfx::Fence* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Fence_wait : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->wait(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Fence_wait) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Fence_finalize) - -static bool js_gfx_Fence_constructor(se::State& s) // constructor.c -{ - //#3 cc::gfx::Fence: is_skip_construtor True - se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Fence constructor is skipped\")"); - return false; -} -SE_BIND_CTOR(js_gfx_Fence_constructor, __jsb_cc_gfx_Fence_class, js_cc_gfx_Fence_finalize) - - - -extern se::Object* __jsb_cc_gfx_GFXObject_proto; - -static bool js_cc_gfx_Fence_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::Fence* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_Fence_finalize) - -bool js_register_gfx_Fence(se::Object* obj) -{ - auto cls = se::Class::create("Fence", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Fence_constructor)); - - cls->defineFunction("destroy", _SE(js_gfx_Fence_destroy)); - cls->defineFunction("initialize", _SE(js_gfx_Fence_initialize)); - cls->defineFunction("reset", _SE(js_gfx_Fence_reset)); - cls->defineFunction("wait", _SE(js_gfx_Fence_wait)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_Fence_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_Fence_proto = cls->getProto(); - __jsb_cc_gfx_Fence_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -se::Object* __jsb_cc_gfx_Queue_proto = nullptr; -se::Class* __jsb_cc_gfx_Queue_class = nullptr; - -static bool js_gfx_Queue_destroy(se::State& s) -{ - cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Queue_destroy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->destroy(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Queue_destroy) - -static bool js_gfx_Queue_getType(se::State& s) -{ - cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Queue_getType : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getType(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Queue_getType : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Queue_getType) - -static bool js_gfx_Queue_initialize(se::State& s) -{ - cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Queue_initialize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_Queue_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Queue_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gfx_Queue_initialize) - -static bool js_gfx_Queue_isAsync(se::State& s) -{ - cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Queue_isAsync : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - bool result = cobj->isAsync(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Queue_isAsync : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Queue_isAsync) - -static bool js_gfx_Queue_submit(se::State& s) -{ - CC_UNUSED bool ok = true; - cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2( cobj, false, "js_gfx_Queue_submit : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - do { - if (argc == 1) { - HolderType, true> arg0 = {}; - - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->submit(arg0.value()); - return true; - } - } while(false); - - do { - if (argc == 3) { - HolderType arg0 = {}; - HolderType arg1 = {}; - HolderType arg2 = {}; - - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->submit(arg0.value(), arg1.value(), arg2.value()); - return true; - } - } while(false); - - do { - if (argc == 2) { - HolderType, true> arg0 = {}; - HolderType arg1 = {}; - - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - if (!ok) { ok = true; break; } - ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); - if (!ok) { ok = true; break; } - cobj->submit(arg0.value(), arg1.value()); - return true; - } - } while(false); - - SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc); - return false; -} -SE_BIND_FUNC(js_gfx_Queue_submit) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Queue_finalize) - -static bool js_gfx_Queue_constructor(se::State& s) // constructor.c -{ - //#3 cc::gfx::Queue: is_skip_construtor True - se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Queue constructor is skipped\")"); - return false; -} -SE_BIND_CTOR(js_gfx_Queue_constructor, __jsb_cc_gfx_Queue_class, js_cc_gfx_Queue_finalize) - - - -extern se::Object* __jsb_cc_gfx_GFXObject_proto; - -static bool js_cc_gfx_Queue_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_Queue_finalize) - -bool js_register_gfx_Queue(se::Object* obj) -{ - auto cls = se::Class::create("Queue", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Queue_constructor)); - - cls->defineProperty("type", _SE(js_gfx_Queue_getType), nullptr); - cls->defineFunction("destroy", _SE(js_gfx_Queue_destroy)); - cls->defineFunction("initialize", _SE(js_gfx_Queue_initialize)); - cls->defineFunction("isAsync", _SE(js_gfx_Queue_isAsync)); - cls->defineFunction("submit", _SE(js_gfx_Queue_submit)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_Queue_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_Queue_proto = cls->getProto(); - __jsb_cc_gfx_Queue_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -se::Object* __jsb_cc_gfx_Sampler_proto = nullptr; -se::Class* __jsb_cc_gfx_Sampler_class = nullptr; - -static bool js_gfx_Sampler_destroy(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_destroy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->destroy(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Sampler_destroy) - -static bool js_gfx_Sampler_getAddressU(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getAddressU : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getAddressU(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getAddressU : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getAddressU) - -static bool js_gfx_Sampler_getAddressV(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getAddressV : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getAddressV(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getAddressV : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getAddressV) - -static bool js_gfx_Sampler_getAddressW(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getAddressW : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getAddressW(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getAddressW : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getAddressW) - -static bool js_gfx_Sampler_getBorderColor(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getBorderColor : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const cc::gfx::Color& result = cobj->getBorderColor(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getBorderColor : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getBorderColor) - -static bool js_gfx_Sampler_getCmpFunc(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getCmpFunc : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getCmpFunc(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getCmpFunc : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getCmpFunc) - -static bool js_gfx_Sampler_getMagFilter(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMagFilter : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getMagFilter(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMagFilter : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMagFilter) - -static bool js_gfx_Sampler_getMaxAnisotropy(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMaxAnisotropy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getMaxAnisotropy(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMaxAnisotropy : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMaxAnisotropy) - -static bool js_gfx_Sampler_getMaxLOD(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMaxLOD : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getMaxLOD(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMaxLOD : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMaxLOD) - -static bool js_gfx_Sampler_getMinFilter(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMinFilter : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getMinFilter(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMinFilter : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMinFilter) - -static bool js_gfx_Sampler_getMinLOD(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMinLOD : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getMinLOD(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMinLOD : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMinLOD) - -static bool js_gfx_Sampler_getMipFilter(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMipFilter : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = (int)cobj->getMipFilter(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMipFilter : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMipFilter) - -static bool js_gfx_Sampler_getMipLODBias(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMipLODBias : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - float result = cobj->getMipLODBias(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMipLODBias : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Sampler_getMipLODBias) - -static bool js_gfx_Sampler_initialize(se::State& s) -{ - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_initialize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Sampler_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gfx_Sampler_initialize) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Sampler_finalize) - -static bool js_gfx_Sampler_constructor(se::State& s) // constructor.c -{ - //#3 cc::gfx::Sampler: is_skip_construtor True - se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Sampler constructor is skipped\")"); - return false; -} -SE_BIND_CTOR(js_gfx_Sampler_constructor, __jsb_cc_gfx_Sampler_class, js_cc_gfx_Sampler_finalize) - - - -extern se::Object* __jsb_cc_gfx_GFXObject_proto; - -static bool js_cc_gfx_Sampler_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_Sampler_finalize) - -bool js_register_gfx_Sampler(se::Object* obj) -{ - auto cls = se::Class::create("Sampler", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Sampler_constructor)); - - cls->defineProperty("borderColor", _SE(js_gfx_Sampler_getBorderColor), nullptr); - cls->defineProperty("mipFilter", _SE(js_gfx_Sampler_getMipFilter), nullptr); - cls->defineProperty("minFilter", _SE(js_gfx_Sampler_getMinFilter), nullptr); - cls->defineProperty("maxLOD", _SE(js_gfx_Sampler_getMaxLOD), nullptr); - cls->defineProperty("magFilter", _SE(js_gfx_Sampler_getMagFilter), nullptr); - cls->defineProperty("addressU", _SE(js_gfx_Sampler_getAddressU), nullptr); - cls->defineProperty("addressV", _SE(js_gfx_Sampler_getAddressV), nullptr); - cls->defineProperty("addressW", _SE(js_gfx_Sampler_getAddressW), nullptr); - cls->defineProperty("cmpFunc", _SE(js_gfx_Sampler_getCmpFunc), nullptr); - cls->defineProperty("maxAnisotropy", _SE(js_gfx_Sampler_getMaxAnisotropy), nullptr); - cls->defineProperty("mipLODBias", _SE(js_gfx_Sampler_getMipLODBias), nullptr); - cls->defineProperty("minLOD", _SE(js_gfx_Sampler_getMinLOD), nullptr); - cls->defineFunction("destroy", _SE(js_gfx_Sampler_destroy)); - cls->defineFunction("initialize", _SE(js_gfx_Sampler_initialize)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_Sampler_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_Sampler_proto = cls->getProto(); - __jsb_cc_gfx_Sampler_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -se::Object* __jsb_cc_gfx_InputAssembler_proto = nullptr; -se::Class* __jsb_cc_gfx_InputAssembler_class = nullptr; - -static bool js_gfx_InputAssembler_destroy(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_destroy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->destroy(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_InputAssembler_destroy) - -static bool js_gfx_InputAssembler_getAttributes(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getAttributes : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const std::vector& result = cobj->getAttributes(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getAttributes : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getAttributes) - -static bool js_gfx_InputAssembler_getAttributesHash(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getAttributesHash : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getAttributesHash(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getAttributesHash : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getAttributesHash) - -static bool js_gfx_InputAssembler_getFirstIndex(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getFirstIndex : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getFirstIndex(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getFirstIndex : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getFirstIndex) - -static bool js_gfx_InputAssembler_getFirstInstance(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getFirstInstance : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getFirstInstance(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getFirstInstance : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getFirstInstance) - -static bool js_gfx_InputAssembler_getFirstVertex(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getFirstVertex : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getFirstVertex(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getFirstVertex : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getFirstVertex) - -static bool js_gfx_InputAssembler_getIndexBuffer(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getIndexBuffer : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - cc::gfx::Buffer* result = cobj->getIndexBuffer(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getIndexBuffer : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getIndexBuffer) - -static bool js_gfx_InputAssembler_getIndexCount(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getIndexCount : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getIndexCount(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getIndexCount : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getIndexCount) - -static bool js_gfx_InputAssembler_getIndirectBuffer(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getIndirectBuffer : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - cc::gfx::Buffer* result = cobj->getIndirectBuffer(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getIndirectBuffer : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getIndirectBuffer) - -static bool js_gfx_InputAssembler_getInstanceCount(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getInstanceCount : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getInstanceCount(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getInstanceCount : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getInstanceCount) - -static bool js_gfx_InputAssembler_getVertexBuffers(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getVertexBuffers : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const std::vector& result = cobj->getVertexBuffers(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getVertexBuffers : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getVertexBuffers) - -static bool js_gfx_InputAssembler_getVertexCount(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getVertexCount : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getVertexCount(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getVertexCount : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getVertexCount) - -static bool js_gfx_InputAssembler_getVertexOffset(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_getVertexOffset : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getVertexOffset(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_getVertexOffset : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_InputAssembler_getVertexOffset) - -static bool js_gfx_InputAssembler_initialize(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_initialize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gfx_InputAssembler_initialize) - -static bool js_gfx_InputAssembler_setFirstIndex(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setFirstIndex : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setFirstIndex : Error processing arguments"); - cobj->setFirstIndex(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setFirstIndex) - -static bool js_gfx_InputAssembler_setFirstInstance(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setFirstInstance : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setFirstInstance : Error processing arguments"); - cobj->setFirstInstance(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setFirstInstance) - -static bool js_gfx_InputAssembler_setFirstVertex(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setFirstVertex : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setFirstVertex : Error processing arguments"); - cobj->setFirstVertex(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setFirstVertex) - -static bool js_gfx_InputAssembler_setIndexCount(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setIndexCount : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setIndexCount : Error processing arguments"); - cobj->setIndexCount(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setIndexCount) - -static bool js_gfx_InputAssembler_setInstanceCount(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setInstanceCount : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setInstanceCount : Error processing arguments"); - cobj->setInstanceCount(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setInstanceCount) - -static bool js_gfx_InputAssembler_setVertexCount(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setVertexCount : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setVertexCount : Error processing arguments"); - cobj->setVertexCount(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setVertexCount) - -static bool js_gfx_InputAssembler_setVertexOffset(se::State& s) -{ - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_InputAssembler_setVertexOffset : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_InputAssembler_setVertexOffset : Error processing arguments"); - cobj->setVertexOffset(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_PROP_SET(js_gfx_InputAssembler_setVertexOffset) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_InputAssembler_finalize) - -static bool js_gfx_InputAssembler_constructor(se::State& s) // constructor.c -{ - //#3 cc::gfx::InputAssembler: is_skip_construtor True - se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::InputAssembler constructor is skipped\")"); - return false; -} -SE_BIND_CTOR(js_gfx_InputAssembler_constructor, __jsb_cc_gfx_InputAssembler_class, js_cc_gfx_InputAssembler_finalize) - - - -extern se::Object* __jsb_cc_gfx_GFXObject_proto; - -static bool js_cc_gfx_InputAssembler_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::InputAssembler* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_InputAssembler_finalize) - -bool js_register_gfx_InputAssembler(se::Object* obj) -{ - auto cls = se::Class::create("InputAssembler", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_InputAssembler_constructor)); - - cls->defineProperty("instanceCount", _SE(js_gfx_InputAssembler_getInstanceCount), _SE(js_gfx_InputAssembler_setInstanceCount)); - cls->defineProperty("vertexBuffers", _SE(js_gfx_InputAssembler_getVertexBuffers), nullptr); - cls->defineProperty("attributesHash", _SE(js_gfx_InputAssembler_getAttributesHash), nullptr); - cls->defineProperty("firstInstance", _SE(js_gfx_InputAssembler_getFirstInstance), _SE(js_gfx_InputAssembler_setFirstInstance)); - cls->defineProperty("vertexCount", _SE(js_gfx_InputAssembler_getVertexCount), _SE(js_gfx_InputAssembler_setVertexCount)); - cls->defineProperty("indexBuffer", _SE(js_gfx_InputAssembler_getIndexBuffer), nullptr); - cls->defineProperty("vertexOffset", _SE(js_gfx_InputAssembler_getVertexOffset), _SE(js_gfx_InputAssembler_setVertexOffset)); - cls->defineProperty("attributes", _SE(js_gfx_InputAssembler_getAttributes), nullptr); - cls->defineProperty("indexCount", _SE(js_gfx_InputAssembler_getIndexCount), _SE(js_gfx_InputAssembler_setIndexCount)); - cls->defineProperty("firstIndex", _SE(js_gfx_InputAssembler_getFirstIndex), _SE(js_gfx_InputAssembler_setFirstIndex)); - cls->defineProperty("indirectBuffer", _SE(js_gfx_InputAssembler_getIndirectBuffer), nullptr); - cls->defineProperty("firstVertex", _SE(js_gfx_InputAssembler_getFirstVertex), _SE(js_gfx_InputAssembler_setFirstVertex)); - cls->defineFunction("destroy", _SE(js_gfx_InputAssembler_destroy)); - cls->defineFunction("initialize", _SE(js_gfx_InputAssembler_initialize)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_InputAssembler_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_InputAssembler_proto = cls->getProto(); - __jsb_cc_gfx_InputAssembler_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -se::Object* __jsb_cc_gfx_RenderPass_proto = nullptr; -se::Class* __jsb_cc_gfx_RenderPass_class = nullptr; - -static bool js_gfx_RenderPass_destroy(se::State& s) -{ - cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_destroy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->destroy(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_RenderPass_destroy) - -static bool js_gfx_RenderPass_getDepthStencilAttachment(se::State& s) -{ - cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getDepthStencilAttachment : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const cc::gfx::DepthStencilAttachment& result = cobj->getDepthStencilAttachment(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getDepthStencilAttachment : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_RenderPass_getDepthStencilAttachment) - -static bool js_gfx_RenderPass_getHash(se::State& s) -{ - cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getHash : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getHash(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getHash : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_RenderPass_getHash) - -static bool js_gfx_RenderPass_getSubPasses(se::State& s) -{ - cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getSubPasses : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const std::vector& result = cobj->getSubPasses(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getSubPasses : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_RenderPass_getSubPasses) - -static bool js_gfx_RenderPass_initialize(se::State& s) -{ - cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_initialize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gfx_RenderPass_initialize) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_RenderPass_finalize) - -static bool js_gfx_RenderPass_constructor(se::State& s) // constructor.c -{ - //#3 cc::gfx::RenderPass: is_skip_construtor True - se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::RenderPass constructor is skipped\")"); - return false; -} -SE_BIND_CTOR(js_gfx_RenderPass_constructor, __jsb_cc_gfx_RenderPass_class, js_cc_gfx_RenderPass_finalize) - - - -extern se::Object* __jsb_cc_gfx_GFXObject_proto; - -static bool js_cc_gfx_RenderPass_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_RenderPass_finalize) - -bool js_register_gfx_RenderPass(se::Object* obj) -{ - auto cls = se::Class::create("RenderPass", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_RenderPass_constructor)); - - cls->defineProperty("hash", _SE(js_gfx_RenderPass_getHash), nullptr); - cls->defineFunction("destroy", _SE(js_gfx_RenderPass_destroy)); - cls->defineFunction("getDepthStencilAttachment", _SE(js_gfx_RenderPass_getDepthStencilAttachment)); - cls->defineFunction("getSubPasses", _SE(js_gfx_RenderPass_getSubPasses)); - cls->defineFunction("initialize", _SE(js_gfx_RenderPass_initialize)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_RenderPass_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_RenderPass_proto = cls->getProto(); - __jsb_cc_gfx_RenderPass_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - se::Object* __jsb_cc_gfx_Framebuffer_proto = nullptr; se::Class* __jsb_cc_gfx_Framebuffer_class = nullptr; @@ -14246,10 +17371,7 @@ static bool js_gfx_Framebuffer_initialize(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_gfx_Framebuffer_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Framebuffer_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + cobj->initialize(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); @@ -14257,6 +17379,26 @@ static bool js_gfx_Framebuffer_initialize(se::State& s) } SE_BIND_FUNC(js_gfx_Framebuffer_initialize) +static bool js_gfx_Framebuffer_computeHash(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, nullptr); + SE_PRECONDITION2(ok, false, "js_gfx_Framebuffer_computeHash : Error processing arguments"); + unsigned int result = cc::gfx::Framebuffer::computeHash(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Framebuffer_computeHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Framebuffer_computeHash) + SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Framebuffer_finalize) static bool js_gfx_Framebuffer_constructor(se::State& s) // constructor.c @@ -14293,6 +17435,7 @@ bool js_register_gfx_Framebuffer(se::Object* obj) cls->defineProperty("depthStencilTexture", _SE(js_gfx_Framebuffer_getDepthStencilTexture), nullptr); cls->defineFunction("destroy", _SE(js_gfx_Framebuffer_destroy)); cls->defineFunction("initialize", _SE(js_gfx_Framebuffer_initialize)); + cls->defineStaticFunction("computeHash", _SE(js_gfx_Framebuffer_computeHash)); cls->defineFinalizeFunction(_SE(js_cc_gfx_Framebuffer_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -14303,7 +17446,92 @@ bool js_register_gfx_Framebuffer(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_GlobalBarrier_proto = nullptr; +se::Class* __jsb_cc_gfx_GlobalBarrier_class = nullptr; +static bool js_gfx_GlobalBarrier_info(se::State& s) +{ + cc::gfx::GlobalBarrier* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_GlobalBarrier_info : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::gfx::GlobalBarrierInfo& result = cobj->info(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_GlobalBarrier_info : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_GlobalBarrier_info) + +static bool js_gfx_GlobalBarrier_computeHash(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, nullptr); + SE_PRECONDITION2(ok, false, "js_gfx_GlobalBarrier_computeHash : Error processing arguments"); + unsigned int result = cc::gfx::GlobalBarrier::computeHash(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_GlobalBarrier_computeHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_GlobalBarrier_computeHash) + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_GlobalBarrier_finalize) + +static bool js_gfx_GlobalBarrier_constructor(se::State& s) // constructor.c +{ + cc::gfx::GlobalBarrier* cobj = JSB_ALLOC(cc::gfx::GlobalBarrier); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_gfx_GlobalBarrier_constructor, __jsb_cc_gfx_GlobalBarrier_class, js_cc_gfx_GlobalBarrier_finalize) + + + +extern se::Object* __jsb_cc_gfx_GFXObject_proto; + +static bool js_cc_gfx_GlobalBarrier_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::GlobalBarrier* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_GlobalBarrier_finalize) + +bool js_register_gfx_GlobalBarrier(se::Object* obj) +{ + auto cls = se::Class::create("GlobalBarrier", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_GlobalBarrier_constructor)); + + cls->defineFunction("info", _SE(js_gfx_GlobalBarrier_info)); + cls->defineStaticFunction("computeHash", _SE(js_gfx_GlobalBarrier_computeHash)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_GlobalBarrier_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_GlobalBarrier_proto = cls->getProto(); + __jsb_cc_gfx_GlobalBarrier_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_PipelineLayout_proto = nullptr; se::Class* __jsb_cc_gfx_PipelineLayout_class = nullptr; @@ -14352,10 +17580,7 @@ static bool js_gfx_PipelineLayout_initialize(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_gfx_PipelineLayout_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineLayout_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + cobj->initialize(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); @@ -14407,7 +17632,6 @@ bool js_register_gfx_PipelineLayout(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_PipelineState_proto = nullptr; se::Class* __jsb_cc_gfx_PipelineState_class = nullptr; @@ -14426,6 +17650,25 @@ static bool js_gfx_PipelineState_destroy(se::State& s) } SE_BIND_FUNC(js_gfx_PipelineState_destroy) +static bool js_gfx_PipelineState_getBindPoint(se::State& s) +{ + cc::gfx::PipelineState* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_PipelineState_getBindPoint : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getBindPoint(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_PipelineState_getBindPoint : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_PipelineState_getBindPoint) + static bool js_gfx_PipelineState_getBlendState(se::State& s) { cc::gfx::PipelineState* cobj = SE_THIS_OBJECT(s); @@ -14608,10 +17851,7 @@ static bool js_gfx_PipelineState_initialize(se::State& s) HolderType arg0 = {}; ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); SE_PRECONDITION2(ok, false, "js_gfx_PipelineState_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_PipelineState_initialize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + cobj->initialize(arg0.value()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); @@ -14656,6 +17896,7 @@ bool js_register_gfx_PipelineState(se::Object* obj) cls->defineProperty("blendState", _SE(js_gfx_PipelineState_getBlendState), nullptr); cls->defineProperty("renderPass", _SE(js_gfx_PipelineState_getRenderPass), nullptr); cls->defineProperty("inputState", _SE(js_gfx_PipelineState_getInputState), nullptr); + cls->defineProperty("bindPoint", _SE(js_gfx_PipelineState_getBindPoint), nullptr); cls->defineProperty("depthStencilState", _SE(js_gfx_PipelineState_getDepthStencilState), nullptr); cls->defineFunction("destroy", _SE(js_gfx_PipelineState_destroy)); cls->defineFunction("getDynamicStates", _SE(js_gfx_PipelineState_getDynamicStates)); @@ -14671,7 +17912,887 @@ bool js_register_gfx_PipelineState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_Queue_proto = nullptr; +se::Class* __jsb_cc_gfx_Queue_class = nullptr; +static bool js_gfx_Queue_destroy(se::State& s) +{ + cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Queue_destroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->destroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Queue_destroy) + +static bool js_gfx_Queue_getType(se::State& s) +{ + cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Queue_getType : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getType(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Queue_getType : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Queue_getType) + +static bool js_gfx_Queue_initialize(se::State& s) +{ + cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Queue_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Queue_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Queue_initialize) + +static bool js_gfx_Queue_submitForJS(se::State& s) +{ + cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Queue_submitForJS : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType, true> arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Queue_submitForJS : Error processing arguments"); + cobj->submitForJS(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Queue_submitForJS) + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Queue_finalize) + +static bool js_gfx_Queue_constructor(se::State& s) // constructor.c +{ + //#3 cc::gfx::Queue: is_skip_construtor True + se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Queue constructor is skipped\")"); + return false; +} +SE_BIND_CTOR(js_gfx_Queue_constructor, __jsb_cc_gfx_Queue_class, js_cc_gfx_Queue_finalize) + + + +extern se::Object* __jsb_cc_gfx_GFXObject_proto; + +static bool js_cc_gfx_Queue_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::Queue* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_Queue_finalize) + +bool js_register_gfx_Queue(se::Object* obj) +{ + auto cls = se::Class::create("Queue", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Queue_constructor)); + + cls->defineProperty("type", _SE(js_gfx_Queue_getType), nullptr); + cls->defineFunction("destroy", _SE(js_gfx_Queue_destroy)); + cls->defineFunction("initialize", _SE(js_gfx_Queue_initialize)); + cls->defineFunction("submit", _SE(js_gfx_Queue_submitForJS)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_Queue_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_Queue_proto = cls->getProto(); + __jsb_cc_gfx_Queue_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_RenderPass_proto = nullptr; +se::Class* __jsb_cc_gfx_RenderPass_class = nullptr; + +static bool js_gfx_RenderPass_destroy(se::State& s) +{ + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_destroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->destroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_RenderPass_destroy) + +static bool js_gfx_RenderPass_getDependencies(se::State& s) +{ + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getDependencies : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getDependencies(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getDependencies : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_RenderPass_getDependencies) + +static bool js_gfx_RenderPass_getDepthStencilAttachment(se::State& s) +{ + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getDepthStencilAttachment : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::gfx::DepthStencilAttachment& result = cobj->getDepthStencilAttachment(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getDepthStencilAttachment : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_RenderPass_getDepthStencilAttachment) + +static bool js_gfx_RenderPass_getHash(se::State& s) +{ + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getHash : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getHash(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_RenderPass_getHash) + +static bool js_gfx_RenderPass_getSubpasses(se::State& s) +{ + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_getSubpasses : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getSubpasses(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_getSubpasses : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_RenderPass_getSubpasses) + +static bool js_gfx_RenderPass_initialize(se::State& s) +{ + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_RenderPass_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_RenderPass_initialize) + +static bool js_gfx_RenderPass_computeHash(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, nullptr); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_computeHash : Error processing arguments"); + unsigned int result = cc::gfx::RenderPass::computeHash(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_RenderPass_computeHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_RenderPass_computeHash) + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_RenderPass_finalize) + +static bool js_gfx_RenderPass_constructor(se::State& s) // constructor.c +{ + //#3 cc::gfx::RenderPass: is_skip_construtor True + se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::RenderPass constructor is skipped\")"); + return false; +} +SE_BIND_CTOR(js_gfx_RenderPass_constructor, __jsb_cc_gfx_RenderPass_class, js_cc_gfx_RenderPass_finalize) + + + +extern se::Object* __jsb_cc_gfx_GFXObject_proto; + +static bool js_cc_gfx_RenderPass_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::RenderPass* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_RenderPass_finalize) + +bool js_register_gfx_RenderPass(se::Object* obj) +{ + auto cls = se::Class::create("RenderPass", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_RenderPass_constructor)); + + cls->defineProperty("hash", _SE(js_gfx_RenderPass_getHash), nullptr); + cls->defineFunction("destroy", _SE(js_gfx_RenderPass_destroy)); + cls->defineFunction("getDependencies", _SE(js_gfx_RenderPass_getDependencies)); + cls->defineFunction("getDepthStencilAttachment", _SE(js_gfx_RenderPass_getDepthStencilAttachment)); + cls->defineFunction("getSubpasses", _SE(js_gfx_RenderPass_getSubpasses)); + cls->defineFunction("initialize", _SE(js_gfx_RenderPass_initialize)); + cls->defineStaticFunction("computeHash", _SE(js_gfx_RenderPass_computeHash)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_RenderPass_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_RenderPass_proto = cls->getProto(); + __jsb_cc_gfx_RenderPass_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_Sampler_proto = nullptr; +se::Class* __jsb_cc_gfx_Sampler_class = nullptr; + +static bool js_gfx_Sampler_destroy(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_destroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->destroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Sampler_destroy) + +static bool js_gfx_Sampler_getAddressU(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getAddressU : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getAddressU(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getAddressU : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getAddressU) + +static bool js_gfx_Sampler_getAddressV(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getAddressV : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getAddressV(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getAddressV : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getAddressV) + +static bool js_gfx_Sampler_getAddressW(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getAddressW : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getAddressW(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getAddressW : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getAddressW) + +static bool js_gfx_Sampler_getBorderColor(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getBorderColor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::gfx::Color& result = cobj->getBorderColor(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getBorderColor : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getBorderColor) + +static bool js_gfx_Sampler_getCmpFunc(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getCmpFunc : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getCmpFunc(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getCmpFunc : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getCmpFunc) + +static bool js_gfx_Sampler_getMagFilter(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMagFilter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getMagFilter(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMagFilter : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getMagFilter) + +static bool js_gfx_Sampler_getMaxAnisotropy(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMaxAnisotropy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMaxAnisotropy(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMaxAnisotropy : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getMaxAnisotropy) + +static bool js_gfx_Sampler_getMinFilter(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMinFilter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getMinFilter(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMinFilter : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getMinFilter) + +static bool js_gfx_Sampler_getMipFilter(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMipFilter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + int result = (int)cobj->getMipFilter(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMipFilter : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getMipFilter) + +static bool js_gfx_Sampler_getMipLODBias(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_getMipLODBias : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getMipLODBias(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_getMipLODBias : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Sampler_getMipLODBias) + +static bool js_gfx_Sampler_initialize(se::State& s) +{ + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Sampler_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Sampler_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Sampler_initialize) + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Sampler_finalize) + +static bool js_gfx_Sampler_constructor(se::State& s) // constructor.c +{ + //#3 cc::gfx::Sampler: is_skip_construtor True + se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Sampler constructor is skipped\")"); + return false; +} +SE_BIND_CTOR(js_gfx_Sampler_constructor, __jsb_cc_gfx_Sampler_class, js_cc_gfx_Sampler_finalize) + + + +extern se::Object* __jsb_cc_gfx_GFXObject_proto; + +static bool js_cc_gfx_Sampler_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::Sampler* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_Sampler_finalize) + +bool js_register_gfx_Sampler(se::Object* obj) +{ + auto cls = se::Class::create("Sampler", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Sampler_constructor)); + + cls->defineProperty("borderColor", _SE(js_gfx_Sampler_getBorderColor), nullptr); + cls->defineProperty("mipFilter", _SE(js_gfx_Sampler_getMipFilter), nullptr); + cls->defineProperty("minFilter", _SE(js_gfx_Sampler_getMinFilter), nullptr); + cls->defineProperty("magFilter", _SE(js_gfx_Sampler_getMagFilter), nullptr); + cls->defineProperty("addressU", _SE(js_gfx_Sampler_getAddressU), nullptr); + cls->defineProperty("addressV", _SE(js_gfx_Sampler_getAddressV), nullptr); + cls->defineProperty("addressW", _SE(js_gfx_Sampler_getAddressW), nullptr); + cls->defineProperty("cmpFunc", _SE(js_gfx_Sampler_getCmpFunc), nullptr); + cls->defineProperty("maxAnisotropy", _SE(js_gfx_Sampler_getMaxAnisotropy), nullptr); + cls->defineProperty("mipLODBias", _SE(js_gfx_Sampler_getMipLODBias), nullptr); + cls->defineFunction("destroy", _SE(js_gfx_Sampler_destroy)); + cls->defineFunction("initialize", _SE(js_gfx_Sampler_initialize)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_Sampler_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_Sampler_proto = cls->getProto(); + __jsb_cc_gfx_Sampler_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_gfx_Shader_proto = nullptr; +se::Class* __jsb_cc_gfx_Shader_class = nullptr; + +static bool js_gfx_Shader_destroy(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_destroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->destroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_destroy) + +static bool js_gfx_Shader_getAttributes(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getAttributes : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getAttributes(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getAttributes : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Shader_getAttributes) + +static bool js_gfx_Shader_getBlocks(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getBlocks : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getBlocks(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getBlocks : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Shader_getBlocks) + +static bool js_gfx_Shader_getBuffers(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getBuffers : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getBuffers(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getBuffers : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_getBuffers) + +static bool js_gfx_Shader_getID(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getID : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getID(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getID : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Shader_getID) + +static bool js_gfx_Shader_getImages(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getImages : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getImages(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getImages : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_getImages) + +static bool js_gfx_Shader_getName(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getName : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::String& result = cobj->getName(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getName : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Shader_getName) + +static bool js_gfx_Shader_getSamplerTextures(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getSamplerTextures : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getSamplerTextures(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getSamplerTextures : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_getSamplerTextures) + +static bool js_gfx_Shader_getSamplers(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getSamplers : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getSamplers(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getSamplers : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Shader_getSamplers) + +static bool js_gfx_Shader_getStages(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getStages : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getStages(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getStages : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_gfx_Shader_getStages) + +static bool js_gfx_Shader_getSubpassInputs(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getSubpassInputs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getSubpassInputs(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getSubpassInputs : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_getSubpassInputs) + +static bool js_gfx_Shader_getTextures(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getTextures : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const std::vector& result = cobj->getTextures(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_getTextures : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_getTextures) + +static bool js_gfx_Shader_initialize(se::State& s) +{ + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Shader_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Shader_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Shader_initialize) + +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Shader_finalize) + +static bool js_gfx_Shader_constructor(se::State& s) // constructor.c +{ + //#3 cc::gfx::Shader: is_skip_construtor True + se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Shader constructor is skipped\")"); + return false; +} +SE_BIND_CTOR(js_gfx_Shader_constructor, __jsb_cc_gfx_Shader_class, js_cc_gfx_Shader_finalize) + + + +extern se::Object* __jsb_cc_gfx_GFXObject_proto; + +static bool js_cc_gfx_Shader_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_gfx_Shader_finalize) + +bool js_register_gfx_Shader(se::Object* obj) +{ + auto cls = se::Class::create("Shader", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Shader_constructor)); + + cls->defineProperty("blocks", _SE(js_gfx_Shader_getBlocks), nullptr); + cls->defineProperty("name", _SE(js_gfx_Shader_getName), nullptr); + cls->defineProperty("samplers", _SE(js_gfx_Shader_getSamplers), nullptr); + cls->defineProperty("shaderID", _SE(js_gfx_Shader_getID), nullptr); + cls->defineProperty("attributes", _SE(js_gfx_Shader_getAttributes), nullptr); + cls->defineProperty("stages", _SE(js_gfx_Shader_getStages), nullptr); + cls->defineFunction("destroy", _SE(js_gfx_Shader_destroy)); + cls->defineFunction("getBuffers", _SE(js_gfx_Shader_getBuffers)); + cls->defineFunction("getImages", _SE(js_gfx_Shader_getImages)); + cls->defineFunction("getSamplerTextures", _SE(js_gfx_Shader_getSamplerTextures)); + cls->defineFunction("getSubpassInputs", _SE(js_gfx_Shader_getSubpassInputs)); + cls->defineFunction("getTextures", _SE(js_gfx_Shader_getTextures)); + cls->defineFunction("initialize", _SE(js_gfx_Shader_initialize)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_Shader_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_gfx_Shader_proto = cls->getProto(); + __jsb_cc_gfx_Shader_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} se::Object* __jsb_cc_gfx_Texture_proto = nullptr; se::Class* __jsb_cc_gfx_Texture_class = nullptr; @@ -14690,25 +18811,6 @@ static bool js_gfx_Texture_destroy(se::State& s) } SE_BIND_FUNC(js_gfx_Texture_destroy) -static bool js_gfx_Texture_getBuffer(se::State& s) -{ - cc::gfx::Texture* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Texture_getBuffer : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned char* result = cobj->getBuffer(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Texture_getBuffer : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Texture_getBuffer) - static bool js_gfx_Texture_getDepth(se::State& s) { cc::gfx::Texture* cobj = SE_THIS_OBJECT(s); @@ -14861,6 +18963,25 @@ static bool js_gfx_Texture_getSize(se::State& s) } SE_BIND_PROP_GET(js_gfx_Texture_getSize) +static bool js_gfx_Texture_getTextureID(se::State& s) +{ + cc::gfx::Texture* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Texture_getTextureID : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getTextureID(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Texture_getTextureID : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_gfx_Texture_getTextureID) + static bool js_gfx_Texture_getType(se::State& s) { cc::gfx::Texture* cobj = SE_THIS_OBJECT(s); @@ -14958,6 +19079,26 @@ static bool js_gfx_Texture_resize(se::State& s) } SE_BIND_FUNC(js_gfx_Texture_resize) +static bool js_gfx_Texture_computeHash(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, nullptr); + SE_PRECONDITION2(ok, false, "js_gfx_Texture_computeHash : Error processing arguments"); + unsigned int result = cc::gfx::Texture::computeHash(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Texture_computeHash : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Texture_computeHash) + SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Texture_finalize) static bool js_gfx_Texture_constructor(se::State& s) // constructor.c @@ -14991,7 +19132,6 @@ bool js_register_gfx_Texture(se::Object* obj) cls->defineProperty("samples", _SE(js_gfx_Texture_getSamples), nullptr); cls->defineProperty("format", _SE(js_gfx_Texture_getFormat), nullptr); - cls->defineProperty("buffer", _SE(js_gfx_Texture_getBuffer), nullptr); cls->defineProperty("levelCount", _SE(js_gfx_Texture_getLevelCount), nullptr); cls->defineProperty("height", _SE(js_gfx_Texture_getHeight), nullptr); cls->defineProperty("width", _SE(js_gfx_Texture_getWidth), nullptr); @@ -15002,8 +19142,10 @@ bool js_register_gfx_Texture(se::Object* obj) cls->defineProperty("type", _SE(js_gfx_Texture_getType), nullptr); cls->defineProperty("size", _SE(js_gfx_Texture_getSize), nullptr); cls->defineFunction("destroy", _SE(js_gfx_Texture_destroy)); + cls->defineFunction("getTextureID", _SE(js_gfx_Texture_getTextureID)); cls->defineFunction("isTextureView", _SE(js_gfx_Texture_isTextureView)); cls->defineFunction("resize", _SE(js_gfx_Texture_resize)); + cls->defineStaticFunction("computeHash", _SE(js_gfx_Texture_computeHash)); cls->defineFinalizeFunction(_SE(js_cc_gfx_Texture_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -15014,211 +19156,92 @@ bool js_register_gfx_Texture(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_gfx_TextureBarrier_proto = nullptr; +se::Class* __jsb_cc_gfx_TextureBarrier_class = nullptr; -se::Object* __jsb_cc_gfx_Shader_proto = nullptr; -se::Class* __jsb_cc_gfx_Shader_class = nullptr; - -static bool js_gfx_Shader_destroy(se::State& s) +static bool js_gfx_TextureBarrier_info(se::State& s) { - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_destroy : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - if (argc == 0) { - cobj->destroy(); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Shader_destroy) - -static bool js_gfx_Shader_getAttributes(se::State& s) -{ - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getAttributes : Invalid Native Object"); + cc::gfx::TextureBarrier* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_TextureBarrier_info : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - const std::vector& result = cobj->getAttributes(); + const cc::gfx::TextureBarrierInfo& result = cobj->info(); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_getAttributes : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrier_info : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_PROP_GET(js_gfx_Shader_getAttributes) +SE_BIND_FUNC(js_gfx_TextureBarrier_info) -static bool js_gfx_Shader_getBlocks(se::State& s) +static bool js_gfx_TextureBarrier_computeHash(se::State& s) { - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getBlocks : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const std::vector& result = cobj->getBlocks(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_getBlocks : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Shader_getBlocks) - -static bool js_gfx_Shader_getID(se::State& s) -{ - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getID : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getID(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_getID : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Shader_getID) - -static bool js_gfx_Shader_getName(se::State& s) -{ - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getName : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const cc::String& result = cobj->getName(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_getName : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Shader_getName) - -static bool js_gfx_Shader_getSamplers(se::State& s) -{ - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getSamplers : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const std::vector& result = cobj->getSamplers(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_getSamplers : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Shader_getSamplers) - -static bool js_gfx_Shader_getStages(se::State& s) -{ - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_getStages : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - const std::vector& result = cobj->getStages(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_getStages : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Shader_getStages) - -static bool js_gfx_Shader_initialize(se::State& s) -{ - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Shader_initialize : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_initialize : Error processing arguments"); - bool result = cobj->initialize(arg0.value()); + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, nullptr); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrier_computeHash : Error processing arguments"); + unsigned int result = cc::gfx::TextureBarrier::computeHash(arg0.value()); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Shader_initialize : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_gfx_TextureBarrier_computeHash : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_gfx_Shader_initialize) +SE_BIND_FUNC(js_gfx_TextureBarrier_computeHash) -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_Shader_finalize) +SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_TextureBarrier_finalize) -static bool js_gfx_Shader_constructor(se::State& s) // constructor.c +static bool js_gfx_TextureBarrier_constructor(se::State& s) // constructor.c { - //#3 cc::gfx::Shader: is_skip_construtor True - se::ScriptEngine::getInstance()->evalString("throw new Error(\"cc::gfx::Shader constructor is skipped\")"); - return false; + cc::gfx::TextureBarrier* cobj = JSB_ALLOC(cc::gfx::TextureBarrier); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; } -SE_BIND_CTOR(js_gfx_Shader_constructor, __jsb_cc_gfx_Shader_class, js_cc_gfx_Shader_finalize) +SE_BIND_CTOR(js_gfx_TextureBarrier_constructor, __jsb_cc_gfx_TextureBarrier_class, js_cc_gfx_TextureBarrier_finalize) extern se::Object* __jsb_cc_gfx_GFXObject_proto; -static bool js_cc_gfx_Shader_finalize(se::State& s) +static bool js_cc_gfx_TextureBarrier_finalize(se::State& s) { - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::Shader* cobj = SE_THIS_OBJECT(s); + cc::gfx::TextureBarrier* cobj = SE_THIS_OBJECT(s); JSB_FREE(cobj); } return true; } -SE_BIND_FINALIZE_FUNC(js_cc_gfx_Shader_finalize) +SE_BIND_FINALIZE_FUNC(js_cc_gfx_TextureBarrier_finalize) -bool js_register_gfx_Shader(se::Object* obj) +bool js_register_gfx_TextureBarrier(se::Object* obj) { - auto cls = se::Class::create("Shader", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_Shader_constructor)); + auto cls = se::Class::create("TextureBarrier", obj, __jsb_cc_gfx_GFXObject_proto, _SE(js_gfx_TextureBarrier_constructor)); - cls->defineProperty("blocks", _SE(js_gfx_Shader_getBlocks), nullptr); - cls->defineProperty("name", _SE(js_gfx_Shader_getName), nullptr); - cls->defineProperty("samplers", _SE(js_gfx_Shader_getSamplers), nullptr); - cls->defineProperty("shaderID", _SE(js_gfx_Shader_getID), nullptr); - cls->defineProperty("attributes", _SE(js_gfx_Shader_getAttributes), nullptr); - cls->defineProperty("stages", _SE(js_gfx_Shader_getStages), nullptr); - cls->defineFunction("destroy", _SE(js_gfx_Shader_destroy)); - cls->defineFunction("initialize", _SE(js_gfx_Shader_initialize)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_Shader_finalize)); + cls->defineFunction("info", _SE(js_gfx_TextureBarrier_info)); + cls->defineStaticFunction("computeHash", _SE(js_gfx_TextureBarrier_computeHash)); + cls->defineFinalizeFunction(_SE(js_cc_gfx_TextureBarrier_finalize)); cls->install(); - JSBClassType::registerClass(cls); + JSBClassType::registerClass(cls); - __jsb_cc_gfx_Shader_proto = cls->getProto(); - __jsb_cc_gfx_Shader_class = cls; + __jsb_cc_gfx_TextureBarrier_proto = cls->getProto(); + __jsb_cc_gfx_TextureBarrier_class = cls; se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_gfx_Device_proto = nullptr; se::Class* __jsb_cc_gfx_Device_class = nullptr; @@ -15325,29 +19348,6 @@ static bool js_gfx_Device_createDescriptorSetLayout(se::State& s) } SE_BIND_FUNC(js_gfx_Device_createDescriptorSetLayout) -static bool js_gfx_Device_createFence(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_createFence : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gfx_Device_createFence : Error processing arguments"); - cc::gfx::Fence* result = cobj->createFence(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_createFence : Error processing arguments"); - se::NonRefNativePtrCreatedByCtorMap::emplace(result); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gfx_Device_createFence) - static bool js_gfx_Device_createFramebuffer(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); @@ -15371,6 +19371,29 @@ static bool js_gfx_Device_createFramebuffer(se::State& s) } SE_BIND_FUNC(js_gfx_Device_createFramebuffer) +static bool js_gfx_Device_createGlobalBarrier(se::State& s) +{ + cc::gfx::Device* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_gfx_Device_createGlobalBarrier : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Device_createGlobalBarrier : Error processing arguments"); + cc::gfx::GlobalBarrier* result = cobj->createGlobalBarrier(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_gfx_Device_createGlobalBarrier : Error processing arguments"); + se::NonRefNativePtrCreatedByCtorMap::emplace(result); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_gfx_Device_createGlobalBarrier) + static bool js_gfx_Device_createInputAssembler(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); @@ -15547,43 +19570,43 @@ static bool js_gfx_Device_destroy(se::State& s) } SE_BIND_FUNC(js_gfx_Device_destroy) -static bool js_gfx_Device_genShaderId(se::State& s) +static bool js_gfx_Device_flushCommandsForJS(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_genShaderId : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_Device_flushCommandsForJS : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->genShaderId(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_genShaderId : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + if (argc == 1) { + HolderType, true> arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_gfx_Device_flushCommandsForJS : Error processing arguments"); + cobj->flushCommandsForJS(arg0.value()); return true; } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); return false; } -SE_BIND_FUNC(js_gfx_Device_genShaderId) +SE_BIND_FUNC(js_gfx_Device_flushCommandsForJS) -static bool js_gfx_Device_getClipSpaceMinZ(se::State& s) +static bool js_gfx_Device_getCapabilities(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getClipSpaceMinZ : Invalid Native Object"); + SE_PRECONDITION2(cobj, false, "js_gfx_Device_getCapabilities : Invalid Native Object"); const auto& args = s.args(); size_t argc = args.size(); CC_UNUSED bool ok = true; if (argc == 0) { - float result = cobj->getClipSpaceMinZ(); + const cc::gfx::DeviceCaps& result = cobj->getCapabilities(); ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getClipSpaceMinZ : Error processing arguments"); + SE_PRECONDITION2(ok, false, "js_gfx_Device_getCapabilities : Error processing arguments"); SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); return true; } SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); return false; } -SE_BIND_PROP_GET(js_gfx_Device_getClipSpaceMinZ) +SE_BIND_PROP_GET(js_gfx_Device_getCapabilities) static bool js_gfx_Device_getColorFormat(se::State& s) { @@ -15623,44 +19646,6 @@ static bool js_gfx_Device_getCommandBuffer(se::State& s) } SE_BIND_PROP_GET(js_gfx_Device_getCommandBuffer) -static bool js_gfx_Device_getContext(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getContext : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - cc::gfx::Context* result = cobj->getContext(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getContext : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getContext) - -static bool js_gfx_Device_getDepthBits(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getDepthBits : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getDepthBits(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getDepthBits : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getDepthBits) - static bool js_gfx_Device_getDepthStencilFormat(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); @@ -15737,177 +19722,6 @@ static bool js_gfx_Device_getHeight(se::State& s) } SE_BIND_PROP_GET(js_gfx_Device_getHeight) -static bool js_gfx_Device_getMaxCubeMapTextureSize(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxCubeMapTextureSize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxCubeMapTextureSize(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxCubeMapTextureSize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxCubeMapTextureSize) - -static bool js_gfx_Device_getMaxFragmentUniformVectors(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxFragmentUniformVectors : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxFragmentUniformVectors(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxFragmentUniformVectors : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxFragmentUniformVectors) - -static bool js_gfx_Device_getMaxTextureSize(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxTextureSize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxTextureSize(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxTextureSize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxTextureSize) - -static bool js_gfx_Device_getMaxTextureUnits(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxTextureUnits : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxTextureUnits(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxTextureUnits : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxTextureUnits) - -static bool js_gfx_Device_getMaxUniformBlockSize(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxUniformBlockSize : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxUniformBlockSize(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxUniformBlockSize : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxUniformBlockSize) - -static bool js_gfx_Device_getMaxUniformBufferBindings(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxUniformBufferBindings : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxUniformBufferBindings(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxUniformBufferBindings : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxUniformBufferBindings) - -static bool js_gfx_Device_getMaxVertexAttributes(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxVertexAttributes : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxVertexAttributes(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxVertexAttributes : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxVertexAttributes) - -static bool js_gfx_Device_getMaxVertexTextureUnits(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxVertexTextureUnits : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxVertexTextureUnits(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxVertexTextureUnits : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxVertexTextureUnits) - -static bool js_gfx_Device_getMaxVertexUniformVectors(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getMaxVertexUniformVectors : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getMaxVertexUniformVectors(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getMaxVertexUniformVectors : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getMaxVertexUniformVectors) - static bool js_gfx_Device_getMemoryStatus(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); @@ -16060,44 +19874,6 @@ static bool js_gfx_Device_getRenderer(se::State& s) } SE_BIND_PROP_GET(js_gfx_Device_getRenderer) -static bool js_gfx_Device_getScreenSpaceSignY(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getScreenSpaceSignY : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - float result = cobj->getScreenSpaceSignY(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getScreenSpaceSignY : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getScreenSpaceSignY) - -static bool js_gfx_Device_getStencilBits(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getStencilBits : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getStencilBits(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getStencilBits : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getStencilBits) - static bool js_gfx_Device_getSurfaceTransform(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); @@ -16117,44 +19893,6 @@ static bool js_gfx_Device_getSurfaceTransform(se::State& s) } SE_BIND_PROP_GET(js_gfx_Device_getSurfaceTransform) -static bool js_gfx_Device_getUVSpaceSignY(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getUVSpaceSignY : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - float result = cobj->getUVSpaceSignY(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getUVSpaceSignY : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_PROP_GET(js_gfx_Device_getUVSpaceSignY) - -static bool js_gfx_Device_getUboOffsetAlignment(se::State& s) -{ - cc::gfx::Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gfx_Device_getUboOffsetAlignment : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - int result = cobj->getUboOffsetAlignment(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gfx_Device_getUboOffsetAlignment : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gfx_Device_getUboOffsetAlignment) - static bool js_gfx_Device_getVendor(se::State& s) { cc::gfx::Device* cobj = SE_THIS_OBJECT(s); @@ -16299,45 +20037,31 @@ bool js_register_gfx_Device(se::Object* obj) { auto cls = se::Class::create("GFXDevice", obj, nullptr, nullptr); + cls->defineProperty("nativeHeight", _SE(js_gfx_Device_getNativeHeight), nullptr); cls->defineProperty("deviceName", _SE(js_gfx_Device_getDeviceName), nullptr); - cls->defineProperty("clipSpaceMinZ", _SE(js_gfx_Device_getClipSpaceMinZ), nullptr); - cls->defineProperty("numInstances", _SE(js_gfx_Device_getNumInstances), nullptr); - cls->defineProperty("maxTextureUnits", _SE(js_gfx_Device_getMaxTextureUnits), nullptr); - cls->defineProperty("height", _SE(js_gfx_Device_getHeight), nullptr); - cls->defineProperty("renderer", _SE(js_gfx_Device_getRenderer), nullptr); - cls->defineProperty("maxUniformBufferBindings", _SE(js_gfx_Device_getMaxUniformBufferBindings), nullptr); - cls->defineProperty("UVSpaceSignY", _SE(js_gfx_Device_getUVSpaceSignY), nullptr); - cls->defineProperty("commandBuffer", _SE(js_gfx_Device_getCommandBuffer), nullptr); - cls->defineProperty("vendor", _SE(js_gfx_Device_getVendor), nullptr); - cls->defineProperty("depthBits", _SE(js_gfx_Device_getDepthBits), nullptr); - cls->defineProperty("maxFragmentUniformVectors", _SE(js_gfx_Device_getMaxFragmentUniformVectors), nullptr); - cls->defineProperty("maxVertexAttributes", _SE(js_gfx_Device_getMaxVertexAttributes), nullptr); - cls->defineProperty("width", _SE(js_gfx_Device_getWidth), nullptr); - cls->defineProperty("maxVertexUniformVectors", _SE(js_gfx_Device_getMaxVertexUniformVectors), nullptr); - cls->defineProperty("maxCubeMapTextureSize", _SE(js_gfx_Device_getMaxCubeMapTextureSize), nullptr); - cls->defineProperty("maxVertexTextureUnits", _SE(js_gfx_Device_getMaxVertexTextureUnits), nullptr); + cls->defineProperty("colorFormat", _SE(js_gfx_Device_getColorFormat), nullptr); cls->defineProperty("nativeWidth", _SE(js_gfx_Device_getNativeWidth), nullptr); + cls->defineProperty("depthStencilFormat", _SE(js_gfx_Device_getDepthStencilFormat), nullptr); + cls->defineProperty("numTris", _SE(js_gfx_Device_getNumTris), nullptr); cls->defineProperty("numDrawCalls", _SE(js_gfx_Device_getNumDrawCalls), nullptr); cls->defineProperty("memoryStatus", _SE(js_gfx_Device_getMemoryStatus), nullptr); cls->defineProperty("gfxAPI", _SE(js_gfx_Device_getGfxAPI), nullptr); - cls->defineProperty("maxUniformBlockSize", _SE(js_gfx_Device_getMaxUniformBlockSize), nullptr); - cls->defineProperty("surfaceTransform", _SE(js_gfx_Device_getSurfaceTransform), nullptr); - cls->defineProperty("maxTextureSize", _SE(js_gfx_Device_getMaxTextureSize), nullptr); - cls->defineProperty("nativeHeight", _SE(js_gfx_Device_getNativeHeight), nullptr); - cls->defineProperty("depthStencilFormat", _SE(js_gfx_Device_getDepthStencilFormat), nullptr); - cls->defineProperty("numTris", _SE(js_gfx_Device_getNumTris), nullptr); - cls->defineProperty("screenSpaceSignY", _SE(js_gfx_Device_getScreenSpaceSignY), nullptr); - cls->defineProperty("stencilBits", _SE(js_gfx_Device_getStencilBits), nullptr); + cls->defineProperty("capabilities", _SE(js_gfx_Device_getCapabilities), nullptr); + cls->defineProperty("height", _SE(js_gfx_Device_getHeight), nullptr); cls->defineProperty("queue", _SE(js_gfx_Device_getQueue), nullptr); - cls->defineProperty("context", _SE(js_gfx_Device_getContext), nullptr); - cls->defineProperty("colorFormat", _SE(js_gfx_Device_getColorFormat), nullptr); + cls->defineProperty("width", _SE(js_gfx_Device_getWidth), nullptr); + cls->defineProperty("renderer", _SE(js_gfx_Device_getRenderer), nullptr); + cls->defineProperty("commandBuffer", _SE(js_gfx_Device_getCommandBuffer), nullptr); + cls->defineProperty("vendor", _SE(js_gfx_Device_getVendor), nullptr); + cls->defineProperty("surfaceTransform", _SE(js_gfx_Device_getSurfaceTransform), nullptr); + cls->defineProperty("numInstances", _SE(js_gfx_Device_getNumInstances), nullptr); cls->defineFunction("acquire", _SE(js_gfx_Device_acquire)); cls->defineFunction("bindingMappingInfo", _SE(js_gfx_Device_bindingMappingInfo)); cls->defineFunction("createCommandBuffer", _SE(js_gfx_Device_createCommandBuffer)); cls->defineFunction("createDescriptorSet", _SE(js_gfx_Device_createDescriptorSet)); cls->defineFunction("createDescriptorSetLayout", _SE(js_gfx_Device_createDescriptorSetLayout)); - cls->defineFunction("createFence", _SE(js_gfx_Device_createFence)); cls->defineFunction("createFramebuffer", _SE(js_gfx_Device_createFramebuffer)); + cls->defineFunction("createGlobalBarrier", _SE(js_gfx_Device_createGlobalBarrier)); cls->defineFunction("createInputAssembler", _SE(js_gfx_Device_createInputAssembler)); cls->defineFunction("createPipelineLayout", _SE(js_gfx_Device_createPipelineLayout)); cls->defineFunction("createPipelineState", _SE(js_gfx_Device_createPipelineState)); @@ -16346,8 +20070,7 @@ bool js_register_gfx_Device(se::Object* obj) cls->defineFunction("createSampler", _SE(js_gfx_Device_createSampler)); cls->defineFunction("createShader", _SE(js_gfx_Device_createShader)); cls->defineFunction("destroy", _SE(js_gfx_Device_destroy)); - cls->defineFunction("genShaderId", _SE(js_gfx_Device_genShaderId)); - cls->defineFunction("getUboOffsetAlignment", _SE(js_gfx_Device_getUboOffsetAlignment)); + cls->defineFunction("flushCommands", _SE(js_gfx_Device_flushCommandsForJS)); cls->defineFunction("hasFeature", _SE(js_gfx_Device_hasFeature)); cls->defineFunction("initialize", _SE(js_gfx_Device_initialize)); cls->defineFunction("present", _SE(js_gfx_Device_present)); @@ -16362,7 +20085,6 @@ bool js_register_gfx_Device(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_gfx(se::Object* obj) { // Get the ns @@ -16375,65 +20097,77 @@ bool register_all_gfx(se::Object* obj) } se::Object* ns = nsVal.toObject(); - js_register_gfx_RasterizerState(ns); - js_register_gfx_MemoryStatus(ns); js_register_gfx_Context(ns); + js_register_gfx_SubpassInfo(ns); js_register_gfx_GFXObject(ns); js_register_gfx_Buffer(ns); + js_register_gfx_TextureBarrier(ns); + js_register_gfx_Device(ns); js_register_gfx_Texture(ns); js_register_gfx_Uniform(ns); js_register_gfx_DescriptorSet(ns); js_register_gfx_BlendTarget(ns); - js_register_gfx_DescriptorSetLayoutBinding(ns); - js_register_gfx_FormatInfo(ns); + js_register_gfx_DispatchInfo(ns); + js_register_gfx_PipelineState(ns); + js_register_gfx_TextureBarrierInfo(ns); js_register_gfx_PipelineLayout(ns); js_register_gfx_Sampler(ns); js_register_gfx_InputAssembler(ns); js_register_gfx_RenderPass(ns); js_register_gfx_BufferInfo(ns); js_register_gfx_SamplerInfo(ns); - js_register_gfx_TextureViewInfo(ns); - js_register_gfx_ShaderMacro(ns); - js_register_gfx_PrimitiveMode(ns); - js_register_gfx_TextureSubres(ns); + js_register_gfx_QueueInfo(ns); + js_register_gfx_UniformStorageBuffer(ns); + js_register_gfx_UniformSamplerTexture(ns); + js_register_gfx_BufferTextureCopy(ns); + js_register_gfx_PipelineLayoutInfo(ns); js_register_gfx_InputAssemblerInfo(ns); + js_register_gfx_TextureBlit(ns); js_register_gfx_TextureInfo(ns); - js_register_gfx_PipelineState(ns); + js_register_gfx_GlobalBarrierInfo(ns); js_register_gfx_RenderPassInfo(ns); - js_register_gfx_TextureLayout(ns); + js_register_gfx_Extent(ns); js_register_gfx_Offset(ns); js_register_gfx_CommandBuffer(ns); js_register_gfx_Framebuffer(ns); - js_register_gfx_Rect(ns); + js_register_gfx_Viewport(ns); + js_register_gfx_TextureSubresLayers(ns); js_register_gfx_BufferViewInfo(ns); - js_register_gfx_Extent(ns); + js_register_gfx_UniformInputAttachment(ns); js_register_gfx_UniformSampler(ns); js_register_gfx_ShaderInfo(ns); - js_register_gfx_PipelineStateInfo(ns); js_register_gfx_Shader(ns); js_register_gfx_BlendState(ns); - js_register_gfx_Device(ns); + js_register_gfx_GlobalBarrier(ns); js_register_gfx_DescriptorSetInfo(ns); js_register_gfx_DescriptorSetLayoutInfo(ns); - js_register_gfx_ContextInfo(ns); + js_register_gfx_DrawInfo(ns); + js_register_gfx_InputState(ns); + js_register_gfx_CommandBufferInfo(ns); + js_register_gfx_UniformStorageImage(ns); js_register_gfx_UniformBlock(ns); js_register_gfx_DepthStencilAttachment(ns); - js_register_gfx_PipelineLayoutInfo(ns); - js_register_gfx_BufferTextureCopy(ns); + js_register_gfx_TextureSubresRange(ns); + js_register_gfx_TextureViewInfo(ns); js_register_gfx_Queue(ns); js_register_gfx_ColorAttachment(ns); - js_register_gfx_SubPassInfo(ns); - js_register_gfx_Fence(ns); + js_register_gfx_RasterizerState(ns); js_register_gfx_Color(ns); js_register_gfx_Attribute(ns); - js_register_gfx_Format(ns); + js_register_gfx_MemoryStatus(ns); js_register_gfx_DeviceInfo(ns); + js_register_gfx_DepthStencilState(ns); js_register_gfx_BindingMappingInfo(ns); js_register_gfx_FramebufferInfo(ns); + js_register_gfx_DeviceCaps(ns); + js_register_gfx_Rect(ns); js_register_gfx_ShaderStage(ns); - js_register_gfx_InputState(ns); + js_register_gfx_DescriptorSetLayoutBinding(ns); + js_register_gfx_UniformTexture(ns); js_register_gfx_DescriptorSetLayout(ns); - js_register_gfx_DepthStencilState(ns); + js_register_gfx_TextureCopy(ns); + js_register_gfx_IndirectBuffer(ns); + js_register_gfx_Size(ns); return true; } diff --git a/native/cocos/bindings/auto/jsb_gfx_auto.h b/native/cocos/bindings/auto/jsb_gfx_auto.h index b685e5c733..a6e5ab9482 100644 --- a/native/cocos/bindings/auto/jsb_gfx_auto.h +++ b/native/cocos/bindings/auto/jsb_gfx_auto.h @@ -1,9 +1,54 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/renderer/core/Core.h" +#include "cocos/renderer/gfx-base/GFXBase.h" + +extern se::Object* __jsb_cc_gfx_Size_proto; +extern se::Class* __jsb_cc_gfx_Size_class; + +bool js_register_cc_gfx_Size(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::Size *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::Size); + +extern se::Object* __jsb_cc_gfx_DeviceCaps_proto; +extern se::Class* __jsb_cc_gfx_DeviceCaps_class; + +bool js_register_cc_gfx_DeviceCaps(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::DeviceCaps *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceCaps); extern se::Object* __jsb_cc_gfx_Offset_proto; extern se::Class* __jsb_cc_gfx_Offset_class; @@ -35,15 +80,45 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::Extent *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::Extent); -extern se::Object* __jsb_cc_gfx_TextureSubres_proto; -extern se::Class* __jsb_cc_gfx_TextureSubres_class; +extern se::Object* __jsb_cc_gfx_TextureSubresLayers_proto; +extern se::Class* __jsb_cc_gfx_TextureSubresLayers_class; -bool js_register_cc_gfx_TextureSubres(se::Object* obj); +bool js_register_cc_gfx_TextureSubresLayers(se::Object* obj); bool register_all_gfx(se::Object* obj); template<> -bool sevalue_to_native(const se::Value &, cc::gfx::TextureSubres *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureSubres); +bool sevalue_to_native(const se::Value &, cc::gfx::TextureSubresLayers *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureSubresLayers); + +extern se::Object* __jsb_cc_gfx_TextureSubresRange_proto; +extern se::Class* __jsb_cc_gfx_TextureSubresRange_class; + +bool js_register_cc_gfx_TextureSubresRange(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::TextureSubresRange *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureSubresRange); + +extern se::Object* __jsb_cc_gfx_TextureCopy_proto; +extern se::Class* __jsb_cc_gfx_TextureCopy_class; + +bool js_register_cc_gfx_TextureCopy(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::TextureCopy *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureCopy); + +extern se::Object* __jsb_cc_gfx_TextureBlit_proto; +extern se::Class* __jsb_cc_gfx_TextureBlit_class; + +bool js_register_cc_gfx_TextureBlit(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::TextureBlit *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureBlit); extern se::Object* __jsb_cc_gfx_BufferTextureCopy_proto; extern se::Class* __jsb_cc_gfx_BufferTextureCopy_class; @@ -55,6 +130,16 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::BufferTextureCopy *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::BufferTextureCopy); +extern se::Object* __jsb_cc_gfx_Viewport_proto; +extern se::Class* __jsb_cc_gfx_Viewport_class; + +bool js_register_cc_gfx_Viewport(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::Viewport *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::Viewport); + extern se::Object* __jsb_cc_gfx_Color_proto; extern se::Class* __jsb_cc_gfx_Color_class; @@ -75,26 +160,6 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::BindingMappingInfo *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::BindingMappingInfo); -extern se::Object* __jsb_cc_gfx_DeviceInfo_proto; -extern se::Class* __jsb_cc_gfx_DeviceInfo_class; - -bool js_register_cc_gfx_DeviceInfo(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -template<> -bool sevalue_to_native(const se::Value &, cc::gfx::DeviceInfo *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceInfo); - -extern se::Object* __jsb_cc_gfx_ContextInfo_proto; -extern se::Class* __jsb_cc_gfx_ContextInfo_class; - -bool js_register_cc_gfx_ContextInfo(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -template<> -bool sevalue_to_native(const se::Value &, cc::gfx::ContextInfo *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::ContextInfo); - extern se::Object* __jsb_cc_gfx_BufferInfo_proto; extern se::Class* __jsb_cc_gfx_BufferInfo_class; @@ -115,6 +180,36 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::BufferViewInfo *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::BufferViewInfo); +extern se::Object* __jsb_cc_gfx_DrawInfo_proto; +extern se::Class* __jsb_cc_gfx_DrawInfo_class; + +bool js_register_cc_gfx_DrawInfo(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::DrawInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::DrawInfo); + +extern se::Object* __jsb_cc_gfx_DispatchInfo_proto; +extern se::Class* __jsb_cc_gfx_DispatchInfo_class; + +bool js_register_cc_gfx_DispatchInfo(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::DispatchInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::DispatchInfo); + +extern se::Object* __jsb_cc_gfx_IndirectBuffer_proto; +extern se::Class* __jsb_cc_gfx_IndirectBuffer_class; + +bool js_register_cc_gfx_IndirectBuffer(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::IndirectBuffer *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::IndirectBuffer); + extern se::Object* __jsb_cc_gfx_TextureInfo_proto; extern se::Class* __jsb_cc_gfx_TextureInfo_class; @@ -145,16 +240,6 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::SamplerInfo *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::SamplerInfo); -extern se::Object* __jsb_cc_gfx_ShaderMacro_proto; -extern se::Class* __jsb_cc_gfx_ShaderMacro_class; - -bool js_register_cc_gfx_ShaderMacro(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -template<> -bool sevalue_to_native(const se::Value &, cc::gfx::ShaderMacro *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::ShaderMacro); - extern se::Object* __jsb_cc_gfx_Uniform_proto; extern se::Class* __jsb_cc_gfx_Uniform_class; @@ -175,6 +260,16 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::UniformBlock *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformBlock); +extern se::Object* __jsb_cc_gfx_UniformSamplerTexture_proto; +extern se::Class* __jsb_cc_gfx_UniformSamplerTexture_class; + +bool js_register_cc_gfx_UniformSamplerTexture(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::UniformSamplerTexture *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformSamplerTexture); + extern se::Object* __jsb_cc_gfx_UniformSampler_proto; extern se::Class* __jsb_cc_gfx_UniformSampler_class; @@ -185,6 +280,46 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::UniformSampler *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformSampler); +extern se::Object* __jsb_cc_gfx_UniformTexture_proto; +extern se::Class* __jsb_cc_gfx_UniformTexture_class; + +bool js_register_cc_gfx_UniformTexture(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::UniformTexture *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformTexture); + +extern se::Object* __jsb_cc_gfx_UniformStorageImage_proto; +extern se::Class* __jsb_cc_gfx_UniformStorageImage_class; + +bool js_register_cc_gfx_UniformStorageImage(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::UniformStorageImage *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformStorageImage); + +extern se::Object* __jsb_cc_gfx_UniformStorageBuffer_proto; +extern se::Class* __jsb_cc_gfx_UniformStorageBuffer_class; + +bool js_register_cc_gfx_UniformStorageBuffer(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::UniformStorageBuffer *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformStorageBuffer); + +extern se::Object* __jsb_cc_gfx_UniformInputAttachment_proto; +extern se::Class* __jsb_cc_gfx_UniformInputAttachment_class; + +bool js_register_cc_gfx_UniformInputAttachment(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::UniformInputAttachment *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::UniformInputAttachment); + extern se::Object* __jsb_cc_gfx_ShaderStage_proto; extern se::Class* __jsb_cc_gfx_ShaderStage_class; @@ -245,15 +380,15 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::DepthStencilAttachment *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::DepthStencilAttachment); -extern se::Object* __jsb_cc_gfx_SubPassInfo_proto; -extern se::Class* __jsb_cc_gfx_SubPassInfo_class; +extern se::Object* __jsb_cc_gfx_SubpassInfo_proto; +extern se::Class* __jsb_cc_gfx_SubpassInfo_class; -bool js_register_cc_gfx_SubPassInfo(se::Object* obj); +bool js_register_cc_gfx_SubpassInfo(se::Object* obj); bool register_all_gfx(se::Object* obj); template<> -bool sevalue_to_native(const se::Value &, cc::gfx::SubPassInfo *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::SubPassInfo); +bool sevalue_to_native(const se::Value &, cc::gfx::SubpassInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::SubpassInfo); extern se::Object* __jsb_cc_gfx_RenderPassInfo_proto; extern se::Class* __jsb_cc_gfx_RenderPassInfo_class; @@ -265,6 +400,26 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::RenderPassInfo *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::RenderPassInfo); +extern se::Object* __jsb_cc_gfx_GlobalBarrierInfo_proto; +extern se::Class* __jsb_cc_gfx_GlobalBarrierInfo_class; + +bool js_register_cc_gfx_GlobalBarrierInfo(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::GlobalBarrierInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::GlobalBarrierInfo); + +extern se::Object* __jsb_cc_gfx_TextureBarrierInfo_proto; +extern se::Class* __jsb_cc_gfx_TextureBarrierInfo_class; + +bool js_register_cc_gfx_TextureBarrierInfo(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::TextureBarrierInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureBarrierInfo); + extern se::Object* __jsb_cc_gfx_FramebufferInfo_proto; extern se::Class* __jsb_cc_gfx_FramebufferInfo_class; @@ -365,25 +520,25 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::BlendState *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::BlendState); -extern se::Object* __jsb_cc_gfx_PipelineStateInfo_proto; -extern se::Class* __jsb_cc_gfx_PipelineStateInfo_class; +extern se::Object* __jsb_cc_gfx_CommandBufferInfo_proto; +extern se::Class* __jsb_cc_gfx_CommandBufferInfo_class; -bool js_register_cc_gfx_PipelineStateInfo(se::Object* obj); +bool js_register_cc_gfx_CommandBufferInfo(se::Object* obj); bool register_all_gfx(se::Object* obj); template<> -bool sevalue_to_native(const se::Value &, cc::gfx::PipelineStateInfo *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::PipelineStateInfo); +bool sevalue_to_native(const se::Value &, cc::gfx::CommandBufferInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::CommandBufferInfo); -extern se::Object* __jsb_cc_gfx_FormatInfo_proto; -extern se::Class* __jsb_cc_gfx_FormatInfo_class; +extern se::Object* __jsb_cc_gfx_QueueInfo_proto; +extern se::Class* __jsb_cc_gfx_QueueInfo_class; -bool js_register_cc_gfx_FormatInfo(se::Object* obj); +bool js_register_cc_gfx_QueueInfo(se::Object* obj); bool register_all_gfx(se::Object* obj); template<> -bool sevalue_to_native(const se::Value &, cc::gfx::FormatInfo *, se::Object *ctx); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::FormatInfo); +bool sevalue_to_native(const se::Value &, cc::gfx::QueueInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::QueueInfo); extern se::Object* __jsb_cc_gfx_MemoryStatus_proto; extern se::Class* __jsb_cc_gfx_MemoryStatus_class; @@ -395,6 +550,16 @@ template<> bool sevalue_to_native(const se::Value &, cc::gfx::MemoryStatus *, se::Object *ctx); JSB_REGISTER_OBJECT_TYPE(cc::gfx::MemoryStatus); +extern se::Object* __jsb_cc_gfx_DeviceInfo_proto; +extern se::Class* __jsb_cc_gfx_DeviceInfo_class; + +bool js_register_cc_gfx_DeviceInfo(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +template<> +bool sevalue_to_native(const se::Value &, cc::gfx::DeviceInfo *, se::Object *ctx); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::DeviceInfo); + extern se::Object* __jsb_cc_gfx_GFXObject_proto; extern se::Class* __jsb_cc_gfx_GFXObject_class; @@ -413,8 +578,20 @@ bool register_all_gfx(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::gfx::Buffer); SE_DECLARE_FUNC(js_gfx_Buffer_destroy); SE_DECLARE_FUNC(js_gfx_Buffer_resize); +SE_DECLARE_FUNC(js_gfx_Buffer_computeHash); SE_DECLARE_FUNC(js_gfx_Buffer_Buffer); +extern se::Object* __jsb_cc_gfx_InputAssembler_proto; +extern se::Class* __jsb_cc_gfx_InputAssembler_class; + +bool js_register_cc_gfx_InputAssembler(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::gfx::InputAssembler); +SE_DECLARE_FUNC(js_gfx_InputAssembler_destroy); +SE_DECLARE_FUNC(js_gfx_InputAssembler_initialize); +SE_DECLARE_FUNC(js_gfx_InputAssembler_InputAssembler); + extern se::Object* __jsb_cc_gfx_CommandBuffer_proto; extern se::Class* __jsb_cc_gfx_CommandBuffer_class; @@ -423,11 +600,13 @@ bool register_all_gfx(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::gfx::CommandBuffer); SE_DECLARE_FUNC(js_gfx_CommandBuffer_begin); -SE_DECLARE_FUNC(js_gfx_CommandBuffer_beginRenderPass); +SE_DECLARE_FUNC(js_gfx_CommandBuffer_beginRenderPassForJS); SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindDescriptorSetForJS); SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindInputAssembler); SE_DECLARE_FUNC(js_gfx_CommandBuffer_bindPipelineState); +SE_DECLARE_FUNC(js_gfx_CommandBuffer_blitTexture); SE_DECLARE_FUNC(js_gfx_CommandBuffer_destroy); +SE_DECLARE_FUNC(js_gfx_CommandBuffer_dispatch); SE_DECLARE_FUNC(js_gfx_CommandBuffer_draw); SE_DECLARE_FUNC(js_gfx_CommandBuffer_end); SE_DECLARE_FUNC(js_gfx_CommandBuffer_endRenderPass); @@ -437,6 +616,8 @@ SE_DECLARE_FUNC(js_gfx_CommandBuffer_getNumTris); SE_DECLARE_FUNC(js_gfx_CommandBuffer_getQueue); SE_DECLARE_FUNC(js_gfx_CommandBuffer_getType); SE_DECLARE_FUNC(js_gfx_CommandBuffer_initialize); +SE_DECLARE_FUNC(js_gfx_CommandBuffer_nextSubpass); +SE_DECLARE_FUNC(js_gfx_CommandBuffer_pipelineBarrier); SE_DECLARE_FUNC(js_gfx_CommandBuffer_setBlendConstants); SE_DECLARE_FUNC(js_gfx_CommandBuffer_setDepthBias); SE_DECLARE_FUNC(js_gfx_CommandBuffer_setDepthBound); @@ -455,7 +636,6 @@ bool register_all_gfx(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::gfx::Context); SE_DECLARE_FUNC(js_gfx_Context_destroy); -SE_DECLARE_FUNC(js_gfx_Context_getDevice); SE_DECLARE_FUNC(js_gfx_Context_initialize); SE_DECLARE_FUNC(js_gfx_Context_present); SE_DECLARE_FUNC(js_gfx_Context_Context); @@ -494,67 +674,6 @@ SE_DECLARE_FUNC(js_gfx_DescriptorSetLayout_getDescriptorCount); SE_DECLARE_FUNC(js_gfx_DescriptorSetLayout_initialize); SE_DECLARE_FUNC(js_gfx_DescriptorSetLayout_DescriptorSetLayout); -extern se::Object* __jsb_cc_gfx_Fence_proto; -extern se::Class* __jsb_cc_gfx_Fence_class; - -bool js_register_cc_gfx_Fence(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::Fence); -SE_DECLARE_FUNC(js_gfx_Fence_destroy); -SE_DECLARE_FUNC(js_gfx_Fence_initialize); -SE_DECLARE_FUNC(js_gfx_Fence_reset); -SE_DECLARE_FUNC(js_gfx_Fence_wait); -SE_DECLARE_FUNC(js_gfx_Fence_Fence); - -extern se::Object* __jsb_cc_gfx_Queue_proto; -extern se::Class* __jsb_cc_gfx_Queue_class; - -bool js_register_cc_gfx_Queue(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::Queue); -SE_DECLARE_FUNC(js_gfx_Queue_destroy); -SE_DECLARE_FUNC(js_gfx_Queue_initialize); -SE_DECLARE_FUNC(js_gfx_Queue_isAsync); -SE_DECLARE_FUNC(js_gfx_Queue_submit); -SE_DECLARE_FUNC(js_gfx_Queue_Queue); - -extern se::Object* __jsb_cc_gfx_Sampler_proto; -extern se::Class* __jsb_cc_gfx_Sampler_class; - -bool js_register_cc_gfx_Sampler(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::Sampler); -SE_DECLARE_FUNC(js_gfx_Sampler_destroy); -SE_DECLARE_FUNC(js_gfx_Sampler_initialize); -SE_DECLARE_FUNC(js_gfx_Sampler_Sampler); - -extern se::Object* __jsb_cc_gfx_InputAssembler_proto; -extern se::Class* __jsb_cc_gfx_InputAssembler_class; - -bool js_register_cc_gfx_InputAssembler(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::InputAssembler); -SE_DECLARE_FUNC(js_gfx_InputAssembler_destroy); -SE_DECLARE_FUNC(js_gfx_InputAssembler_initialize); -SE_DECLARE_FUNC(js_gfx_InputAssembler_InputAssembler); - -extern se::Object* __jsb_cc_gfx_RenderPass_proto; -extern se::Class* __jsb_cc_gfx_RenderPass_class; - -bool js_register_cc_gfx_RenderPass(se::Object* obj); -bool register_all_gfx(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::RenderPass); -SE_DECLARE_FUNC(js_gfx_RenderPass_destroy); -SE_DECLARE_FUNC(js_gfx_RenderPass_getDepthStencilAttachment); -SE_DECLARE_FUNC(js_gfx_RenderPass_getSubPasses); -SE_DECLARE_FUNC(js_gfx_RenderPass_initialize); -SE_DECLARE_FUNC(js_gfx_RenderPass_RenderPass); - extern se::Object* __jsb_cc_gfx_Framebuffer_proto; extern se::Class* __jsb_cc_gfx_Framebuffer_class; @@ -564,8 +683,20 @@ bool register_all_gfx(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::gfx::Framebuffer); SE_DECLARE_FUNC(js_gfx_Framebuffer_destroy); SE_DECLARE_FUNC(js_gfx_Framebuffer_initialize); +SE_DECLARE_FUNC(js_gfx_Framebuffer_computeHash); SE_DECLARE_FUNC(js_gfx_Framebuffer_Framebuffer); +extern se::Object* __jsb_cc_gfx_GlobalBarrier_proto; +extern se::Class* __jsb_cc_gfx_GlobalBarrier_class; + +bool js_register_cc_gfx_GlobalBarrier(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::gfx::GlobalBarrier); +SE_DECLARE_FUNC(js_gfx_GlobalBarrier_info); +SE_DECLARE_FUNC(js_gfx_GlobalBarrier_computeHash); +SE_DECLARE_FUNC(js_gfx_GlobalBarrier_GlobalBarrier); + extern se::Object* __jsb_cc_gfx_PipelineLayout_proto; extern se::Class* __jsb_cc_gfx_PipelineLayout_class; @@ -591,17 +722,43 @@ SE_DECLARE_FUNC(js_gfx_PipelineState_getPipelineLayout); SE_DECLARE_FUNC(js_gfx_PipelineState_initialize); SE_DECLARE_FUNC(js_gfx_PipelineState_PipelineState); -extern se::Object* __jsb_cc_gfx_Texture_proto; -extern se::Class* __jsb_cc_gfx_Texture_class; +extern se::Object* __jsb_cc_gfx_Queue_proto; +extern se::Class* __jsb_cc_gfx_Queue_class; -bool js_register_cc_gfx_Texture(se::Object* obj); +bool js_register_cc_gfx_Queue(se::Object* obj); bool register_all_gfx(se::Object* obj); -JSB_REGISTER_OBJECT_TYPE(cc::gfx::Texture); -SE_DECLARE_FUNC(js_gfx_Texture_destroy); -SE_DECLARE_FUNC(js_gfx_Texture_isTextureView); -SE_DECLARE_FUNC(js_gfx_Texture_resize); -SE_DECLARE_FUNC(js_gfx_Texture_Texture); +JSB_REGISTER_OBJECT_TYPE(cc::gfx::Queue); +SE_DECLARE_FUNC(js_gfx_Queue_destroy); +SE_DECLARE_FUNC(js_gfx_Queue_initialize); +SE_DECLARE_FUNC(js_gfx_Queue_submitForJS); +SE_DECLARE_FUNC(js_gfx_Queue_Queue); + +extern se::Object* __jsb_cc_gfx_RenderPass_proto; +extern se::Class* __jsb_cc_gfx_RenderPass_class; + +bool js_register_cc_gfx_RenderPass(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::gfx::RenderPass); +SE_DECLARE_FUNC(js_gfx_RenderPass_destroy); +SE_DECLARE_FUNC(js_gfx_RenderPass_getDependencies); +SE_DECLARE_FUNC(js_gfx_RenderPass_getDepthStencilAttachment); +SE_DECLARE_FUNC(js_gfx_RenderPass_getSubpasses); +SE_DECLARE_FUNC(js_gfx_RenderPass_initialize); +SE_DECLARE_FUNC(js_gfx_RenderPass_computeHash); +SE_DECLARE_FUNC(js_gfx_RenderPass_RenderPass); + +extern se::Object* __jsb_cc_gfx_Sampler_proto; +extern se::Class* __jsb_cc_gfx_Sampler_class; + +bool js_register_cc_gfx_Sampler(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::gfx::Sampler); +SE_DECLARE_FUNC(js_gfx_Sampler_destroy); +SE_DECLARE_FUNC(js_gfx_Sampler_initialize); +SE_DECLARE_FUNC(js_gfx_Sampler_Sampler); extern se::Object* __jsb_cc_gfx_Shader_proto; extern se::Class* __jsb_cc_gfx_Shader_class; @@ -611,9 +768,39 @@ bool register_all_gfx(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::gfx::Shader); SE_DECLARE_FUNC(js_gfx_Shader_destroy); +SE_DECLARE_FUNC(js_gfx_Shader_getBuffers); +SE_DECLARE_FUNC(js_gfx_Shader_getImages); +SE_DECLARE_FUNC(js_gfx_Shader_getSamplerTextures); +SE_DECLARE_FUNC(js_gfx_Shader_getSubpassInputs); +SE_DECLARE_FUNC(js_gfx_Shader_getTextures); SE_DECLARE_FUNC(js_gfx_Shader_initialize); SE_DECLARE_FUNC(js_gfx_Shader_Shader); +extern se::Object* __jsb_cc_gfx_Texture_proto; +extern se::Class* __jsb_cc_gfx_Texture_class; + +bool js_register_cc_gfx_Texture(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::gfx::Texture); +SE_DECLARE_FUNC(js_gfx_Texture_destroy); +SE_DECLARE_FUNC(js_gfx_Texture_getTextureID); +SE_DECLARE_FUNC(js_gfx_Texture_isTextureView); +SE_DECLARE_FUNC(js_gfx_Texture_resize); +SE_DECLARE_FUNC(js_gfx_Texture_computeHash); +SE_DECLARE_FUNC(js_gfx_Texture_Texture); + +extern se::Object* __jsb_cc_gfx_TextureBarrier_proto; +extern se::Class* __jsb_cc_gfx_TextureBarrier_class; + +bool js_register_cc_gfx_TextureBarrier(se::Object* obj); +bool register_all_gfx(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::gfx::TextureBarrier); +SE_DECLARE_FUNC(js_gfx_TextureBarrier_info); +SE_DECLARE_FUNC(js_gfx_TextureBarrier_computeHash); +SE_DECLARE_FUNC(js_gfx_TextureBarrier_TextureBarrier); + extern se::Object* __jsb_cc_gfx_Device_proto; extern se::Class* __jsb_cc_gfx_Device_class; @@ -626,8 +813,8 @@ SE_DECLARE_FUNC(js_gfx_Device_bindingMappingInfo); SE_DECLARE_FUNC(js_gfx_Device_createCommandBuffer); SE_DECLARE_FUNC(js_gfx_Device_createDescriptorSet); SE_DECLARE_FUNC(js_gfx_Device_createDescriptorSetLayout); -SE_DECLARE_FUNC(js_gfx_Device_createFence); SE_DECLARE_FUNC(js_gfx_Device_createFramebuffer); +SE_DECLARE_FUNC(js_gfx_Device_createGlobalBarrier); SE_DECLARE_FUNC(js_gfx_Device_createInputAssembler); SE_DECLARE_FUNC(js_gfx_Device_createPipelineLayout); SE_DECLARE_FUNC(js_gfx_Device_createPipelineState); @@ -636,8 +823,7 @@ SE_DECLARE_FUNC(js_gfx_Device_createRenderPass); SE_DECLARE_FUNC(js_gfx_Device_createSampler); SE_DECLARE_FUNC(js_gfx_Device_createShader); SE_DECLARE_FUNC(js_gfx_Device_destroy); -SE_DECLARE_FUNC(js_gfx_Device_genShaderId); -SE_DECLARE_FUNC(js_gfx_Device_getUboOffsetAlignment); +SE_DECLARE_FUNC(js_gfx_Device_flushCommandsForJS); SE_DECLARE_FUNC(js_gfx_Device_hasFeature); SE_DECLARE_FUNC(js_gfx_Device_initialize); SE_DECLARE_FUNC(js_gfx_Device_present); diff --git a/native/cocos/bindings/auto/jsb_gles2_auto.cpp b/native/cocos/bindings/auto/jsb_gles2_auto.cpp deleted file mode 100644 index 54a0b0ff83..0000000000 --- a/native/cocos/bindings/auto/jsb_gles2_auto.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "cocos/bindings/auto/jsb_gles2_auto.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/bindings/manual/jsb_global.h" -#include "renderer/gfx-gles2/GFXGLES2.h" - -#ifndef JSB_ALLOC -#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) -#endif - -#ifndef JSB_FREE -#define JSB_FREE(ptr) delete ptr -#endif -se::Object* __jsb_cc_gfx_GLES2Device_proto = nullptr; -se::Class* __jsb_cc_gfx_GLES2Device_class = nullptr; - -static bool js_gles2_GLES2Device_checkExtension(se::State& s) -{ - cc::gfx::GLES2Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_checkExtension : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_checkExtension : Error processing arguments"); - bool result = cobj->checkExtension(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_checkExtension : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gles2_GLES2Device_checkExtension) - -static bool js_gles2_GLES2Device_getThreadID(se::State& s) -{ - cc::gfx::GLES2Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gles2_GLES2Device_getThreadID : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getThreadID(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gles2_GLES2Device_getThreadID : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gles2_GLES2Device_getThreadID) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_GLES2Device_finalize) - -static bool js_gles2_GLES2Device_constructor(se::State& s) // constructor.c -{ - cc::gfx::GLES2Device* cobj = JSB_ALLOC(cc::gfx::GLES2Device); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; -} -SE_BIND_CTOR(js_gles2_GLES2Device_constructor, __jsb_cc_gfx_GLES2Device_class, js_cc_gfx_GLES2Device_finalize) - - - -extern se::Object* __jsb_cc_gfx_Device_proto; - -static bool js_cc_gfx_GLES2Device_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::GLES2Device* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_GLES2Device_finalize) - -bool js_register_gles2_GLES2Device(se::Object* obj) -{ - auto cls = se::Class::create("GLES2Device", obj, __jsb_cc_gfx_Device_proto, _SE(js_gles2_GLES2Device_constructor)); - - cls->defineFunction("checkExtension", _SE(js_gles2_GLES2Device_checkExtension)); - cls->defineFunction("getThreadID", _SE(js_gles2_GLES2Device_getThreadID)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_GLES2Device_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_GLES2Device_proto = cls->getProto(); - __jsb_cc_gfx_GLES2Device_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -bool register_all_gles2(se::Object* obj) -{ - // Get the ns - se::Value nsVal; - if (!obj->getProperty("gfx", &nsVal)) - { - se::HandleObject jsobj(se::Object::createPlainObject()); - nsVal.setObject(jsobj); - obj->setProperty("gfx", nsVal); - } - se::Object* ns = nsVal.toObject(); - - js_register_gles2_GLES2Device(ns); - return true; -} - diff --git a/native/cocos/bindings/auto/jsb_gles2_auto.h b/native/cocos/bindings/auto/jsb_gles2_auto.h deleted file mode 100644 index b5a1c46afd..0000000000 --- a/native/cocos/bindings/auto/jsb_gles2_auto.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "base/Config.h" -#include -#include "cocos/bindings/jswrapper/SeApi.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/renderer/gfx-gles2/GFXGLES2.h" - -extern se::Object* __jsb_cc_gfx_GLES2Device_proto; -extern se::Class* __jsb_cc_gfx_GLES2Device_class; - -bool js_register_cc_gfx_GLES2Device(se::Object* obj); -bool register_all_gles2(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::GLES2Device); -SE_DECLARE_FUNC(js_gles2_GLES2Device_checkExtension); -SE_DECLARE_FUNC(js_gles2_GLES2Device_getThreadID); -SE_DECLARE_FUNC(js_gles2_GLES2Device_GLES2Device); - diff --git a/native/cocos/bindings/auto/jsb_gles3_auto.cpp b/native/cocos/bindings/auto/jsb_gles3_auto.cpp deleted file mode 100644 index d6965f909f..0000000000 --- a/native/cocos/bindings/auto/jsb_gles3_auto.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "cocos/bindings/auto/jsb_gles3_auto.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/bindings/manual/jsb_global.h" -#include "renderer/gfx-gles3/GFXGLES3.h" - -#ifndef JSB_ALLOC -#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) -#endif - -#ifndef JSB_FREE -#define JSB_FREE(ptr) delete ptr -#endif -se::Object* __jsb_cc_gfx_GLES3Device_proto = nullptr; -se::Class* __jsb_cc_gfx_GLES3Device_class = nullptr; - -static bool js_gles3_GLES3Device_checkExtension(se::State& s) -{ - cc::gfx::GLES3Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gles3_GLES3Device_checkExtension : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_gles3_GLES3Device_checkExtension : Error processing arguments"); - bool result = cobj->checkExtension(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gles3_GLES3Device_checkExtension : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_gles3_GLES3Device_checkExtension) - -static bool js_gles3_GLES3Device_getThreadID(se::State& s) -{ - cc::gfx::GLES3Device* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_gles3_GLES3Device_getThreadID : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - unsigned int result = cobj->getThreadID(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_gles3_GLES3Device_getThreadID : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_gles3_GLES3Device_getThreadID) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_GLES3Device_finalize) - -static bool js_gles3_GLES3Device_constructor(se::State& s) // constructor.c -{ - cc::gfx::GLES3Device* cobj = JSB_ALLOC(cc::gfx::GLES3Device); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; -} -SE_BIND_CTOR(js_gles3_GLES3Device_constructor, __jsb_cc_gfx_GLES3Device_class, js_cc_gfx_GLES3Device_finalize) - - - -extern se::Object* __jsb_cc_gfx_Device_proto; - -static bool js_cc_gfx_GLES3Device_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::GLES3Device* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_GLES3Device_finalize) - -bool js_register_gles3_GLES3Device(se::Object* obj) -{ - auto cls = se::Class::create("GLES3Device", obj, __jsb_cc_gfx_Device_proto, _SE(js_gles3_GLES3Device_constructor)); - - cls->defineFunction("checkExtension", _SE(js_gles3_GLES3Device_checkExtension)); - cls->defineFunction("getThreadID", _SE(js_gles3_GLES3Device_getThreadID)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_GLES3Device_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_GLES3Device_proto = cls->getProto(); - __jsb_cc_gfx_GLES3Device_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -bool register_all_gles3(se::Object* obj) -{ - // Get the ns - se::Value nsVal; - if (!obj->getProperty("gfx", &nsVal)) - { - se::HandleObject jsobj(se::Object::createPlainObject()); - nsVal.setObject(jsobj); - obj->setProperty("gfx", nsVal); - } - se::Object* ns = nsVal.toObject(); - - js_register_gles3_GLES3Device(ns); - return true; -} - diff --git a/native/cocos/bindings/auto/jsb_gles3_auto.h b/native/cocos/bindings/auto/jsb_gles3_auto.h deleted file mode 100644 index e2dafa53f8..0000000000 --- a/native/cocos/bindings/auto/jsb_gles3_auto.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "base/Config.h" -#include -#include "cocos/bindings/jswrapper/SeApi.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/renderer/gfx-gles3/GFXGLES3.h" - -extern se::Object* __jsb_cc_gfx_GLES3Device_proto; -extern se::Class* __jsb_cc_gfx_GLES3Device_class; - -bool js_register_cc_gfx_GLES3Device(se::Object* obj); -bool register_all_gles3(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::GLES3Device); -SE_DECLARE_FUNC(js_gles3_GLES3Device_checkExtension); -SE_DECLARE_FUNC(js_gles3_GLES3Device_getThreadID); -SE_DECLARE_FUNC(js_gles3_GLES3Device_GLES3Device); - diff --git a/native/cocos/bindings/auto/jsb_mtl_auto.cpp b/native/cocos/bindings/auto/jsb_mtl_auto.cpp deleted file mode 100644 index 369fe2e0d0..0000000000 --- a/native/cocos/bindings/auto/jsb_mtl_auto.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "cocos/bindings/auto/jsb_mtl_auto.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/bindings/manual/jsb_global.h" -#include "renderer/gfx-metal/GFXMTL.h" - -#ifndef JSB_ALLOC -#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) -#endif - -#ifndef JSB_FREE -#define JSB_FREE(ptr) delete ptr -#endif -se::Object* __jsb_cc_gfx_CCMTLDevice_proto = nullptr; -se::Class* __jsb_cc_gfx_CCMTLDevice_class = nullptr; - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_CCMTLDevice_finalize) - -static bool js_mtl_CCMTLDevice_constructor(se::State& s) // constructor.c -{ - cc::gfx::CCMTLDevice* cobj = JSB_ALLOC(cc::gfx::CCMTLDevice); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; -} -SE_BIND_CTOR(js_mtl_CCMTLDevice_constructor, __jsb_cc_gfx_CCMTLDevice_class, js_cc_gfx_CCMTLDevice_finalize) - - - -extern se::Object* __jsb_cc_gfx_Device_proto; - -static bool js_cc_gfx_CCMTLDevice_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::CCMTLDevice* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_CCMTLDevice_finalize) - -bool js_register_mtl_CCMTLDevice(se::Object* obj) -{ - auto cls = se::Class::create("CCMTLDevice", obj, __jsb_cc_gfx_Device_proto, _SE(js_mtl_CCMTLDevice_constructor)); - - cls->defineFinalizeFunction(_SE(js_cc_gfx_CCMTLDevice_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_CCMTLDevice_proto = cls->getProto(); - __jsb_cc_gfx_CCMTLDevice_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -bool register_all_mtl(se::Object* obj) -{ - // Get the ns - se::Value nsVal; - if (!obj->getProperty("gfx", &nsVal)) - { - se::HandleObject jsobj(se::Object::createPlainObject()); - nsVal.setObject(jsobj); - obj->setProperty("gfx", nsVal); - } - se::Object* ns = nsVal.toObject(); - - js_register_mtl_CCMTLDevice(ns); - return true; -} - diff --git a/native/cocos/bindings/auto/jsb_mtl_auto.h b/native/cocos/bindings/auto/jsb_mtl_auto.h deleted file mode 100644 index d7cd9b191c..0000000000 --- a/native/cocos/bindings/auto/jsb_mtl_auto.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "base/Config.h" -#include -#include "cocos/bindings/jswrapper/SeApi.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/renderer/gfx-metal/GFXMTL.h" - -extern se::Object* __jsb_cc_gfx_CCMTLDevice_proto; -extern se::Class* __jsb_cc_gfx_CCMTLDevice_class; - -bool js_register_cc_gfx_CCMTLDevice(se::Object* obj); -bool register_all_mtl(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::CCMTLDevice); -SE_DECLARE_FUNC(js_mtl_CCMTLDevice_CCMTLDevice); - diff --git a/native/cocos/bindings/auto/jsb_network_auto.cpp b/native/cocos/bindings/auto/jsb_network_auto.cpp index 5c99f9faae..5c0f3b501d 100644 --- a/native/cocos/bindings/auto/jsb_network_auto.cpp +++ b/native/cocos/bindings/auto/jsb_network_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_network_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" @@ -216,7 +241,6 @@ bool js_register_network_DownloaderHints(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_network_Downloader_proto = nullptr; se::Class* __jsb_cc_network_Downloader_class = nullptr; @@ -333,7 +357,6 @@ bool js_register_network_Downloader(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_network(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_network_auto.h b/native/cocos/bindings/auto/jsb_network_auto.h index ebca293de1..50de010214 100644 --- a/native/cocos/bindings/auto/jsb_network_auto.h +++ b/native/cocos/bindings/auto/jsb_network_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include diff --git a/native/cocos/bindings/auto/jsb_physics_auto.cpp b/native/cocos/bindings/auto/jsb_physics_auto.cpp new file mode 100644 index 0000000000..f5b45bca00 --- /dev/null +++ b/native/cocos/bindings/auto/jsb_physics_auto.cpp @@ -0,0 +1,4835 @@ +#include "cocos/bindings/auto/jsb_physics_auto.h" +#include "cocos/bindings/manual/jsb_conversions.h" +#include "cocos/bindings/manual/jsb_global.h" +#include "physics/PhysicsSDK.h" + +#ifndef JSB_ALLOC +#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) +#endif + +#ifndef JSB_FREE +#define JSB_FREE(ptr) delete ptr +#endif +se::Object* __jsb_cc_physics_World_proto = nullptr; +se::Class* __jsb_cc_physics_World_class = nullptr; + +static bool js_physics_World_createConvex(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_createConvex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_createConvex : Error processing arguments"); + uintptr_t result = cobj->createConvex(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_createConvex : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_createConvex) + +static bool js_physics_World_createHeightField(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_createHeightField : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_createHeightField : Error processing arguments"); + uintptr_t result = cobj->createHeightField(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_createHeightField : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_createHeightField) + +static bool js_physics_World_createMaterial(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_createMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_createMaterial : Error processing arguments"); + uintptr_t result = cobj->createMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_createMaterial : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_World_createMaterial) + +static bool js_physics_World_createTrimesh(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_createTrimesh : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_createTrimesh : Error processing arguments"); + uintptr_t result = cobj->createTrimesh(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_createTrimesh : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_createTrimesh) + +static bool js_physics_World_destroy(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_destroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->destroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_destroy) + +static bool js_physics_World_emitEvents(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_emitEvents : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->emitEvents(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_emitEvents) + +static bool js_physics_World_getContactEventPairs(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_getContactEventPairs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + std::vector>& result = cobj->getContactEventPairs(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_getContactEventPairs : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_getContactEventPairs) + +static bool js_physics_World_getTriggerEventPairs(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_getTriggerEventPairs : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + std::vector>& result = cobj->getTriggerEventPairs(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_getTriggerEventPairs : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_getTriggerEventPairs) + +static bool js_physics_World_raycast(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_raycast : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_raycast : Error processing arguments"); + bool result = cobj->raycast(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_raycast : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_raycast) + +static bool js_physics_World_raycastClosest(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_raycastClosest : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_raycastClosest : Error processing arguments"); + bool result = cobj->raycastClosest(arg0.value()); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_raycastClosest : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_raycastClosest) + +static bool js_physics_World_raycastClosestResult(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_raycastClosestResult : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::physics::RaycastResult& result = cobj->raycastClosestResult(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_raycastClosestResult : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_raycastClosestResult) + +static bool js_physics_World_raycastResult(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_raycastResult : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + std::vector& result = cobj->raycastResult(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_World_raycastResult : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_raycastResult) + +static bool js_physics_World_setAllowSleep(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_setAllowSleep : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_setAllowSleep : Error processing arguments"); + cobj->setAllowSleep(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_setAllowSleep) + +static bool js_physics_World_setCollisionMatrix(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_setCollisionMatrix : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + HolderType arg0 = {}; + HolderType arg1 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_setCollisionMatrix : Error processing arguments"); + cobj->setCollisionMatrix(arg0.value(), arg1.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2); + return false; +} +SE_BIND_FUNC(js_physics_World_setCollisionMatrix) + +static bool js_physics_World_setGravity(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_setGravity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_setGravity : Error processing arguments"); + cobj->setGravity(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_World_setGravity) + +static bool js_physics_World_step(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_step : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_World_step : Error processing arguments"); + cobj->step(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_World_step) + +static bool js_physics_World_syncSceneToPhysics(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_syncSceneToPhysics : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->syncSceneToPhysics(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_syncSceneToPhysics) + +static bool js_physics_World_syncSceneWithCheck(se::State& s) +{ + cc::physics::World* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_World_syncSceneWithCheck : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->syncSceneWithCheck(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_World_syncSceneWithCheck) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_World_finalize) + +static bool js_physics_World_constructor(se::State& s) // constructor.c +{ + cc::physics::World* cobj = JSB_ALLOC(cc::physics::World); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_World_constructor, __jsb_cc_physics_World_class, js_cc_physics_World_finalize) + + + + +static bool js_cc_physics_World_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::World* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_World_finalize) + +bool js_register_physics_World(se::Object* obj) +{ + auto cls = se::Class::create("World", obj, nullptr, _SE(js_physics_World_constructor)); + + cls->defineFunction("createConvex", _SE(js_physics_World_createConvex)); + cls->defineFunction("createHeightField", _SE(js_physics_World_createHeightField)); + cls->defineFunction("createMaterial", _SE(js_physics_World_createMaterial)); + cls->defineFunction("createTrimesh", _SE(js_physics_World_createTrimesh)); + cls->defineFunction("destroy", _SE(js_physics_World_destroy)); + cls->defineFunction("emitEvents", _SE(js_physics_World_emitEvents)); + cls->defineFunction("getContactEventPairs", _SE(js_physics_World_getContactEventPairs)); + cls->defineFunction("getTriggerEventPairs", _SE(js_physics_World_getTriggerEventPairs)); + cls->defineFunction("raycast", _SE(js_physics_World_raycast)); + cls->defineFunction("raycastClosest", _SE(js_physics_World_raycastClosest)); + cls->defineFunction("raycastClosestResult", _SE(js_physics_World_raycastClosestResult)); + cls->defineFunction("raycastResult", _SE(js_physics_World_raycastResult)); + cls->defineFunction("setAllowSleep", _SE(js_physics_World_setAllowSleep)); + cls->defineFunction("setCollisionMatrix", _SE(js_physics_World_setCollisionMatrix)); + cls->defineFunction("setGravity", _SE(js_physics_World_setGravity)); + cls->defineFunction("step", _SE(js_physics_World_step)); + cls->defineFunction("syncSceneToPhysics", _SE(js_physics_World_syncSceneToPhysics)); + cls->defineFunction("syncSceneWithCheck", _SE(js_physics_World_syncSceneWithCheck)); + cls->defineFinalizeFunction(_SE(js_cc_physics_World_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_World_proto = cls->getProto(); + __jsb_cc_physics_World_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_RigidBody_proto = nullptr; +se::Class* __jsb_cc_physics_RigidBody_class = nullptr; + +static bool js_physics_RigidBody_applyForce(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_applyForce : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_applyForce : Error processing arguments"); + cobj->applyForce(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_applyForce) + +static bool js_physics_RigidBody_applyImpulse(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_applyImpulse : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_applyImpulse : Error processing arguments"); + cobj->applyImpulse(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_applyImpulse) + +static bool js_physics_RigidBody_applyLocalForce(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_applyLocalForce : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_applyLocalForce : Error processing arguments"); + cobj->applyLocalForce(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_applyLocalForce) + +static bool js_physics_RigidBody_applyLocalImpulse(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_applyLocalImpulse : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_applyLocalImpulse : Error processing arguments"); + cobj->applyLocalImpulse(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_applyLocalImpulse) + +static bool js_physics_RigidBody_applyLocalTorque(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_applyLocalTorque : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_applyLocalTorque : Error processing arguments"); + cobj->applyLocalTorque(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_applyLocalTorque) + +static bool js_physics_RigidBody_applyTorque(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_applyTorque : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_applyTorque : Error processing arguments"); + cobj->applyTorque(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_applyTorque) + +static bool js_physics_RigidBody_clearForces(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_clearForces : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->clearForces(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_clearForces) + +static bool js_physics_RigidBody_clearState(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_clearState : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->clearState(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_clearState) + +static bool js_physics_RigidBody_clearVelocity(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_clearVelocity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->clearVelocity(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_clearVelocity) + +static bool js_physics_RigidBody_getAngularVelocity(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getAngularVelocity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::Vec3 result = cobj->getAngularVelocity(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getAngularVelocity : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getAngularVelocity) + +static bool js_physics_RigidBody_getGroup(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getGroup) + +static bool js_physics_RigidBody_getImpl(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getImpl) + +static bool js_physics_RigidBody_getLinearVelocity(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getLinearVelocity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::Vec3 result = cobj->getLinearVelocity(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getLinearVelocity : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getLinearVelocity) + +static bool js_physics_RigidBody_getMask(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getMask) + +static bool js_physics_RigidBody_getNodeHandle(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getNodeHandle : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getNodeHandle(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getNodeHandle : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getNodeHandle) + +static bool js_physics_RigidBody_getSleepThreshold(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_getSleepThreshold : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + float result = cobj->getSleepThreshold(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_getSleepThreshold : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_getSleepThreshold) + +static bool js_physics_RigidBody_initialize(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_initialize : Error processing arguments"); + cobj->initialize(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_initialize) + +static bool js_physics_RigidBody_isAwake(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_isAwake : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isAwake(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_isAwake : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_isAwake) + +static bool js_physics_RigidBody_isSleeping(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_isSleeping : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isSleeping(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_isSleeping : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_isSleeping) + +static bool js_physics_RigidBody_isSleepy(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_isSleepy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + bool result = cobj->isSleepy(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_isSleepy : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_isSleepy) + +static bool js_physics_RigidBody_onDestroy(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_onDestroy) + +static bool js_physics_RigidBody_onDisable(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_onDisable) + +static bool js_physics_RigidBody_onEnable(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_onEnable) + +static bool js_physics_RigidBody_setAllowSleep(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setAllowSleep : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setAllowSleep : Error processing arguments"); + cobj->setAllowSleep(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setAllowSleep) + +static bool js_physics_RigidBody_setAngularDamping(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setAngularDamping : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setAngularDamping : Error processing arguments"); + cobj->setAngularDamping(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setAngularDamping) + +static bool js_physics_RigidBody_setAngularFactor(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setAngularFactor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setAngularFactor : Error processing arguments"); + cobj->setAngularFactor(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setAngularFactor) + +static bool js_physics_RigidBody_setAngularVelocity(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setAngularVelocity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setAngularVelocity : Error processing arguments"); + cobj->setAngularVelocity(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setAngularVelocity) + +static bool js_physics_RigidBody_setGroup(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setGroup) + +static bool js_physics_RigidBody_setLinearDamping(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setLinearDamping : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setLinearDamping : Error processing arguments"); + cobj->setLinearDamping(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setLinearDamping) + +static bool js_physics_RigidBody_setLinearFactor(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setLinearFactor : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setLinearFactor : Error processing arguments"); + cobj->setLinearFactor(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setLinearFactor) + +static bool js_physics_RigidBody_setLinearVelocity(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setLinearVelocity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setLinearVelocity : Error processing arguments"); + cobj->setLinearVelocity(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setLinearVelocity) + +static bool js_physics_RigidBody_setMask(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setMask) + +static bool js_physics_RigidBody_setMass(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setMass : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setMass : Error processing arguments"); + cobj->setMass(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setMass) + +static bool js_physics_RigidBody_setSleepThreshold(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setSleepThreshold : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setSleepThreshold : Error processing arguments"); + cobj->setSleepThreshold(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setSleepThreshold) + +static bool js_physics_RigidBody_setType(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_setType : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_setType : Error processing arguments"); + cobj->setType(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_setType) + +static bool js_physics_RigidBody_sleep(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_sleep : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->sleep(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_sleep) + +static bool js_physics_RigidBody_useGravity(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_useGravity : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RigidBody_useGravity : Error processing arguments"); + cobj->useGravity(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_useGravity) + +static bool js_physics_RigidBody_wakeUp(se::State& s) +{ + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RigidBody_wakeUp : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->wakeUp(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RigidBody_wakeUp) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_RigidBody_finalize) + +static bool js_physics_RigidBody_constructor(se::State& s) // constructor.c +{ + cc::physics::RigidBody* cobj = JSB_ALLOC(cc::physics::RigidBody); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_RigidBody_constructor, __jsb_cc_physics_RigidBody_class, js_cc_physics_RigidBody_finalize) + + + + +static bool js_cc_physics_RigidBody_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::RigidBody* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_RigidBody_finalize) + +bool js_register_physics_RigidBody(se::Object* obj) +{ + auto cls = se::Class::create("RigidBody", obj, nullptr, _SE(js_physics_RigidBody_constructor)); + + cls->defineFunction("applyForce", _SE(js_physics_RigidBody_applyForce)); + cls->defineFunction("applyImpulse", _SE(js_physics_RigidBody_applyImpulse)); + cls->defineFunction("applyLocalForce", _SE(js_physics_RigidBody_applyLocalForce)); + cls->defineFunction("applyLocalImpulse", _SE(js_physics_RigidBody_applyLocalImpulse)); + cls->defineFunction("applyLocalTorque", _SE(js_physics_RigidBody_applyLocalTorque)); + cls->defineFunction("applyTorque", _SE(js_physics_RigidBody_applyTorque)); + cls->defineFunction("clearForces", _SE(js_physics_RigidBody_clearForces)); + cls->defineFunction("clearState", _SE(js_physics_RigidBody_clearState)); + cls->defineFunction("clearVelocity", _SE(js_physics_RigidBody_clearVelocity)); + cls->defineFunction("getAngularVelocity", _SE(js_physics_RigidBody_getAngularVelocity)); + cls->defineFunction("getGroup", _SE(js_physics_RigidBody_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_RigidBody_getImpl)); + cls->defineFunction("getLinearVelocity", _SE(js_physics_RigidBody_getLinearVelocity)); + cls->defineFunction("getMask", _SE(js_physics_RigidBody_getMask)); + cls->defineFunction("getNodeHandle", _SE(js_physics_RigidBody_getNodeHandle)); + cls->defineFunction("getSleepThreshold", _SE(js_physics_RigidBody_getSleepThreshold)); + cls->defineFunction("initialize", _SE(js_physics_RigidBody_initialize)); + cls->defineFunction("isAwake", _SE(js_physics_RigidBody_isAwake)); + cls->defineFunction("isSleeping", _SE(js_physics_RigidBody_isSleeping)); + cls->defineFunction("isSleepy", _SE(js_physics_RigidBody_isSleepy)); + cls->defineFunction("onDestroy", _SE(js_physics_RigidBody_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_RigidBody_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_RigidBody_onEnable)); + cls->defineFunction("setAllowSleep", _SE(js_physics_RigidBody_setAllowSleep)); + cls->defineFunction("setAngularDamping", _SE(js_physics_RigidBody_setAngularDamping)); + cls->defineFunction("setAngularFactor", _SE(js_physics_RigidBody_setAngularFactor)); + cls->defineFunction("setAngularVelocity", _SE(js_physics_RigidBody_setAngularVelocity)); + cls->defineFunction("setGroup", _SE(js_physics_RigidBody_setGroup)); + cls->defineFunction("setLinearDamping", _SE(js_physics_RigidBody_setLinearDamping)); + cls->defineFunction("setLinearFactor", _SE(js_physics_RigidBody_setLinearFactor)); + cls->defineFunction("setLinearVelocity", _SE(js_physics_RigidBody_setLinearVelocity)); + cls->defineFunction("setMask", _SE(js_physics_RigidBody_setMask)); + cls->defineFunction("setMass", _SE(js_physics_RigidBody_setMass)); + cls->defineFunction("setSleepThreshold", _SE(js_physics_RigidBody_setSleepThreshold)); + cls->defineFunction("setType", _SE(js_physics_RigidBody_setType)); + cls->defineFunction("sleep", _SE(js_physics_RigidBody_sleep)); + cls->defineFunction("useGravity", _SE(js_physics_RigidBody_useGravity)); + cls->defineFunction("wakeUp", _SE(js_physics_RigidBody_wakeUp)); + cls->defineFinalizeFunction(_SE(js_cc_physics_RigidBody_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_RigidBody_proto = cls->getProto(); + __jsb_cc_physics_RigidBody_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_SphereShape_proto = nullptr; +se::Class* __jsb_cc_physics_SphereShape_class = nullptr; + +static bool js_physics_SphereShape_getAABB(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_getAABB) + +static bool js_physics_SphereShape_getBoundingSphere(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_getBoundingSphere) + +static bool js_physics_SphereShape_getGroup(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_getGroup) + +static bool js_physics_SphereShape_getImpl(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_getImpl) + +static bool js_physics_SphereShape_getMask(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_getMask) + +static bool js_physics_SphereShape_initialize(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_initialize) + +static bool js_physics_SphereShape_onDestroy(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_onDestroy) + +static bool js_physics_SphereShape_onDisable(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_onDisable) + +static bool js_physics_SphereShape_onEnable(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_onEnable) + +static bool js_physics_SphereShape_setAsTrigger(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_setAsTrigger) + +static bool js_physics_SphereShape_setCenter(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_setCenter) + +static bool js_physics_SphereShape_setGroup(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_setGroup) + +static bool js_physics_SphereShape_setMask(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_setMask) + +static bool js_physics_SphereShape_setMaterial(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_setMaterial) + +static bool js_physics_SphereShape_setRadius(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_setRadius : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_setRadius : Error processing arguments"); + cobj->setRadius(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_setRadius) + +static bool js_physics_SphereShape_updateEventListener(se::State& s) +{ + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_SphereShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_SphereShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_SphereShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_SphereShape_finalize) + +static bool js_physics_SphereShape_constructor(se::State& s) // constructor.c +{ + cc::physics::SphereShape* cobj = JSB_ALLOC(cc::physics::SphereShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_SphereShape_constructor, __jsb_cc_physics_SphereShape_class, js_cc_physics_SphereShape_finalize) + + + + +static bool js_cc_physics_SphereShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::SphereShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_SphereShape_finalize) + +bool js_register_physics_SphereShape(se::Object* obj) +{ + auto cls = se::Class::create("SphereShape", obj, nullptr, _SE(js_physics_SphereShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_SphereShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_SphereShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_SphereShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_SphereShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_SphereShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_SphereShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_SphereShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_SphereShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_SphereShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_SphereShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_SphereShape_setCenter)); + cls->defineFunction("setGroup", _SE(js_physics_SphereShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_SphereShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_SphereShape_setMaterial)); + cls->defineFunction("setRadius", _SE(js_physics_SphereShape_setRadius)); + cls->defineFunction("updateEventListener", _SE(js_physics_SphereShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_SphereShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_SphereShape_proto = cls->getProto(); + __jsb_cc_physics_SphereShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_BoxShape_proto = nullptr; +se::Class* __jsb_cc_physics_BoxShape_class = nullptr; + +static bool js_physics_BoxShape_getAABB(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_getAABB) + +static bool js_physics_BoxShape_getBoundingSphere(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_getBoundingSphere) + +static bool js_physics_BoxShape_getGroup(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_getGroup) + +static bool js_physics_BoxShape_getImpl(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_getImpl) + +static bool js_physics_BoxShape_getMask(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_getMask) + +static bool js_physics_BoxShape_initialize(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_initialize) + +static bool js_physics_BoxShape_onDestroy(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_onDestroy) + +static bool js_physics_BoxShape_onDisable(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_onDisable) + +static bool js_physics_BoxShape_onEnable(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_onEnable) + +static bool js_physics_BoxShape_setAsTrigger(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_setAsTrigger) + +static bool js_physics_BoxShape_setCenter(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_setCenter) + +static bool js_physics_BoxShape_setGroup(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_setGroup) + +static bool js_physics_BoxShape_setMask(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_setMask) + +static bool js_physics_BoxShape_setMaterial(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_setMaterial) + +static bool js_physics_BoxShape_setSize(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_setSize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_setSize : Error processing arguments"); + cobj->setSize(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_setSize) + +static bool js_physics_BoxShape_updateEventListener(se::State& s) +{ + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_BoxShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_BoxShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_BoxShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_BoxShape_finalize) + +static bool js_physics_BoxShape_constructor(se::State& s) // constructor.c +{ + cc::physics::BoxShape* cobj = JSB_ALLOC(cc::physics::BoxShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_BoxShape_constructor, __jsb_cc_physics_BoxShape_class, js_cc_physics_BoxShape_finalize) + + + + +static bool js_cc_physics_BoxShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::BoxShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_BoxShape_finalize) + +bool js_register_physics_BoxShape(se::Object* obj) +{ + auto cls = se::Class::create("BoxShape", obj, nullptr, _SE(js_physics_BoxShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_BoxShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_BoxShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_BoxShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_BoxShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_BoxShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_BoxShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_BoxShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_BoxShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_BoxShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_BoxShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_BoxShape_setCenter)); + cls->defineFunction("setGroup", _SE(js_physics_BoxShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_BoxShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_BoxShape_setMaterial)); + cls->defineFunction("setSize", _SE(js_physics_BoxShape_setSize)); + cls->defineFunction("updateEventListener", _SE(js_physics_BoxShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_BoxShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_BoxShape_proto = cls->getProto(); + __jsb_cc_physics_BoxShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_CapsuleShape_proto = nullptr; +se::Class* __jsb_cc_physics_CapsuleShape_class = nullptr; + +static bool js_physics_CapsuleShape_getAABB(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_getAABB) + +static bool js_physics_CapsuleShape_getBoundingSphere(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_getBoundingSphere) + +static bool js_physics_CapsuleShape_getGroup(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_getGroup) + +static bool js_physics_CapsuleShape_getImpl(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_getImpl) + +static bool js_physics_CapsuleShape_getMask(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_getMask) + +static bool js_physics_CapsuleShape_initialize(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_initialize) + +static bool js_physics_CapsuleShape_onDestroy(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_onDestroy) + +static bool js_physics_CapsuleShape_onDisable(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_onDisable) + +static bool js_physics_CapsuleShape_onEnable(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_onEnable) + +static bool js_physics_CapsuleShape_setAsTrigger(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setAsTrigger) + +static bool js_physics_CapsuleShape_setCenter(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setCenter) + +static bool js_physics_CapsuleShape_setCylinderHeight(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setCylinderHeight : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setCylinderHeight : Error processing arguments"); + cobj->setCylinderHeight(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setCylinderHeight) + +static bool js_physics_CapsuleShape_setDirection(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setDirection : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setDirection : Error processing arguments"); + cobj->setDirection(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setDirection) + +static bool js_physics_CapsuleShape_setGroup(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setGroup) + +static bool js_physics_CapsuleShape_setMask(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setMask) + +static bool js_physics_CapsuleShape_setMaterial(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setMaterial) + +static bool js_physics_CapsuleShape_setRadius(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_setRadius : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_setRadius : Error processing arguments"); + cobj->setRadius(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_setRadius) + +static bool js_physics_CapsuleShape_updateEventListener(se::State& s) +{ + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CapsuleShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CapsuleShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_CapsuleShape_finalize) + +static bool js_physics_CapsuleShape_constructor(se::State& s) // constructor.c +{ + cc::physics::CapsuleShape* cobj = JSB_ALLOC(cc::physics::CapsuleShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_CapsuleShape_constructor, __jsb_cc_physics_CapsuleShape_class, js_cc_physics_CapsuleShape_finalize) + + + + +static bool js_cc_physics_CapsuleShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::CapsuleShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_CapsuleShape_finalize) + +bool js_register_physics_CapsuleShape(se::Object* obj) +{ + auto cls = se::Class::create("CapsuleShape", obj, nullptr, _SE(js_physics_CapsuleShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_CapsuleShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_CapsuleShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_CapsuleShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_CapsuleShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_CapsuleShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_CapsuleShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_CapsuleShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_CapsuleShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_CapsuleShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_CapsuleShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_CapsuleShape_setCenter)); + cls->defineFunction("setCylinderHeight", _SE(js_physics_CapsuleShape_setCylinderHeight)); + cls->defineFunction("setDirection", _SE(js_physics_CapsuleShape_setDirection)); + cls->defineFunction("setGroup", _SE(js_physics_CapsuleShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_CapsuleShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_CapsuleShape_setMaterial)); + cls->defineFunction("setRadius", _SE(js_physics_CapsuleShape_setRadius)); + cls->defineFunction("updateEventListener", _SE(js_physics_CapsuleShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_CapsuleShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_CapsuleShape_proto = cls->getProto(); + __jsb_cc_physics_CapsuleShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_PlaneShape_proto = nullptr; +se::Class* __jsb_cc_physics_PlaneShape_class = nullptr; + +static bool js_physics_PlaneShape_getAABB(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_getAABB) + +static bool js_physics_PlaneShape_getBoundingSphere(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_getBoundingSphere) + +static bool js_physics_PlaneShape_getGroup(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_getGroup) + +static bool js_physics_PlaneShape_getImpl(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_getImpl) + +static bool js_physics_PlaneShape_getMask(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_getMask) + +static bool js_physics_PlaneShape_initialize(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_initialize) + +static bool js_physics_PlaneShape_onDestroy(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_onDestroy) + +static bool js_physics_PlaneShape_onDisable(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_onDisable) + +static bool js_physics_PlaneShape_onEnable(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_onEnable) + +static bool js_physics_PlaneShape_setAsTrigger(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setAsTrigger) + +static bool js_physics_PlaneShape_setCenter(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setCenter) + +static bool js_physics_PlaneShape_setConstant(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setConstant : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setConstant : Error processing arguments"); + cobj->setConstant(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setConstant) + +static bool js_physics_PlaneShape_setGroup(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setGroup) + +static bool js_physics_PlaneShape_setMask(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setMask) + +static bool js_physics_PlaneShape_setMaterial(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setMaterial) + +static bool js_physics_PlaneShape_setNormal(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_setNormal : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_setNormal : Error processing arguments"); + cobj->setNormal(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_setNormal) + +static bool js_physics_PlaneShape_updateEventListener(se::State& s) +{ + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_PlaneShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_PlaneShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_PlaneShape_finalize) + +static bool js_physics_PlaneShape_constructor(se::State& s) // constructor.c +{ + cc::physics::PlaneShape* cobj = JSB_ALLOC(cc::physics::PlaneShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_PlaneShape_constructor, __jsb_cc_physics_PlaneShape_class, js_cc_physics_PlaneShape_finalize) + + + + +static bool js_cc_physics_PlaneShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::PlaneShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_PlaneShape_finalize) + +bool js_register_physics_PlaneShape(se::Object* obj) +{ + auto cls = se::Class::create("PlaneShape", obj, nullptr, _SE(js_physics_PlaneShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_PlaneShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_PlaneShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_PlaneShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_PlaneShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_PlaneShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_PlaneShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_PlaneShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_PlaneShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_PlaneShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_PlaneShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_PlaneShape_setCenter)); + cls->defineFunction("setConstant", _SE(js_physics_PlaneShape_setConstant)); + cls->defineFunction("setGroup", _SE(js_physics_PlaneShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_PlaneShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_PlaneShape_setMaterial)); + cls->defineFunction("setNormal", _SE(js_physics_PlaneShape_setNormal)); + cls->defineFunction("updateEventListener", _SE(js_physics_PlaneShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_PlaneShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_PlaneShape_proto = cls->getProto(); + __jsb_cc_physics_PlaneShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_TrimeshShape_proto = nullptr; +se::Class* __jsb_cc_physics_TrimeshShape_class = nullptr; + +static bool js_physics_TrimeshShape_getAABB(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_getAABB) + +static bool js_physics_TrimeshShape_getBoundingSphere(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_getBoundingSphere) + +static bool js_physics_TrimeshShape_getGroup(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_getGroup) + +static bool js_physics_TrimeshShape_getImpl(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_getImpl) + +static bool js_physics_TrimeshShape_getMask(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_getMask) + +static bool js_physics_TrimeshShape_initialize(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_initialize) + +static bool js_physics_TrimeshShape_onDestroy(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_onDestroy) + +static bool js_physics_TrimeshShape_onDisable(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_onDisable) + +static bool js_physics_TrimeshShape_onEnable(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_onEnable) + +static bool js_physics_TrimeshShape_setAsTrigger(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_setAsTrigger) + +static bool js_physics_TrimeshShape_setCenter(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_setCenter) + +static bool js_physics_TrimeshShape_setGroup(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_setGroup) + +static bool js_physics_TrimeshShape_setMask(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_setMask) + +static bool js_physics_TrimeshShape_setMaterial(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_setMaterial) + +static bool js_physics_TrimeshShape_setMesh(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_setMesh : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_setMesh : Error processing arguments"); + cobj->setMesh(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_setMesh) + +static bool js_physics_TrimeshShape_updateEventListener(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_updateEventListener) + +static bool js_physics_TrimeshShape_useConvex(se::State& s) +{ + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TrimeshShape_useConvex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_useConvex : Error processing arguments"); + cobj->useConvex(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TrimeshShape_useConvex) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_TrimeshShape_finalize) + +static bool js_physics_TrimeshShape_constructor(se::State& s) // constructor.c +{ + cc::physics::TrimeshShape* cobj = JSB_ALLOC(cc::physics::TrimeshShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_TrimeshShape_constructor, __jsb_cc_physics_TrimeshShape_class, js_cc_physics_TrimeshShape_finalize) + + + + +static bool js_cc_physics_TrimeshShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::TrimeshShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_TrimeshShape_finalize) + +bool js_register_physics_TrimeshShape(se::Object* obj) +{ + auto cls = se::Class::create("TrimeshShape", obj, nullptr, _SE(js_physics_TrimeshShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_TrimeshShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_TrimeshShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_TrimeshShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_TrimeshShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_TrimeshShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_TrimeshShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_TrimeshShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_TrimeshShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_TrimeshShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_TrimeshShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_TrimeshShape_setCenter)); + cls->defineFunction("setGroup", _SE(js_physics_TrimeshShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_TrimeshShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_TrimeshShape_setMaterial)); + cls->defineFunction("setMesh", _SE(js_physics_TrimeshShape_setMesh)); + cls->defineFunction("updateEventListener", _SE(js_physics_TrimeshShape_updateEventListener)); + cls->defineFunction("useConvex", _SE(js_physics_TrimeshShape_useConvex)); + cls->defineFinalizeFunction(_SE(js_cc_physics_TrimeshShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_TrimeshShape_proto = cls->getProto(); + __jsb_cc_physics_TrimeshShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_CylinderShape_proto = nullptr; +se::Class* __jsb_cc_physics_CylinderShape_class = nullptr; + +static bool js_physics_CylinderShape_getAABB(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_getAABB) + +static bool js_physics_CylinderShape_getBoundingSphere(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_getBoundingSphere) + +static bool js_physics_CylinderShape_getGroup(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_getGroup) + +static bool js_physics_CylinderShape_getImpl(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_getImpl) + +static bool js_physics_CylinderShape_getMask(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_getMask) + +static bool js_physics_CylinderShape_initialize(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_initialize) + +static bool js_physics_CylinderShape_onDestroy(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_onDestroy) + +static bool js_physics_CylinderShape_onDisable(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_onDisable) + +static bool js_physics_CylinderShape_onEnable(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_onEnable) + +static bool js_physics_CylinderShape_setAsTrigger(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setAsTrigger) + +static bool js_physics_CylinderShape_setCenter(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setCenter) + +static bool js_physics_CylinderShape_setConvex(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setConvex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setConvex : Error processing arguments"); + cobj->setConvex(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setConvex) + +static bool js_physics_CylinderShape_setCylinder(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setCylinder : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setCylinder : Error processing arguments"); + cobj->setCylinder(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setCylinder) + +static bool js_physics_CylinderShape_setGroup(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setGroup) + +static bool js_physics_CylinderShape_setMask(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setMask) + +static bool js_physics_CylinderShape_setMaterial(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_setMaterial) + +static bool js_physics_CylinderShape_updateEventListener(se::State& s) +{ + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_CylinderShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_CylinderShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_CylinderShape_finalize) + +static bool js_physics_CylinderShape_constructor(se::State& s) // constructor.c +{ + cc::physics::CylinderShape* cobj = JSB_ALLOC(cc::physics::CylinderShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_CylinderShape_constructor, __jsb_cc_physics_CylinderShape_class, js_cc_physics_CylinderShape_finalize) + + + + +static bool js_cc_physics_CylinderShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::CylinderShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_CylinderShape_finalize) + +bool js_register_physics_CylinderShape(se::Object* obj) +{ + auto cls = se::Class::create("CylinderShape", obj, nullptr, _SE(js_physics_CylinderShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_CylinderShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_CylinderShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_CylinderShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_CylinderShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_CylinderShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_CylinderShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_CylinderShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_CylinderShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_CylinderShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_CylinderShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_CylinderShape_setCenter)); + cls->defineFunction("setConvex", _SE(js_physics_CylinderShape_setConvex)); + cls->defineFunction("setCylinder", _SE(js_physics_CylinderShape_setCylinder)); + cls->defineFunction("setGroup", _SE(js_physics_CylinderShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_CylinderShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_CylinderShape_setMaterial)); + cls->defineFunction("updateEventListener", _SE(js_physics_CylinderShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_CylinderShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_CylinderShape_proto = cls->getProto(); + __jsb_cc_physics_CylinderShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_ConeShape_proto = nullptr; +se::Class* __jsb_cc_physics_ConeShape_class = nullptr; + +static bool js_physics_ConeShape_getAABB(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_getAABB) + +static bool js_physics_ConeShape_getBoundingSphere(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_getBoundingSphere) + +static bool js_physics_ConeShape_getGroup(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_getGroup) + +static bool js_physics_ConeShape_getImpl(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_getImpl) + +static bool js_physics_ConeShape_getMask(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_getMask) + +static bool js_physics_ConeShape_initialize(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_initialize) + +static bool js_physics_ConeShape_onDestroy(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_onDestroy) + +static bool js_physics_ConeShape_onDisable(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_onDisable) + +static bool js_physics_ConeShape_onEnable(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_onEnable) + +static bool js_physics_ConeShape_setAsTrigger(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setAsTrigger) + +static bool js_physics_ConeShape_setCenter(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setCenter) + +static bool js_physics_ConeShape_setCone(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setCone : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setCone : Error processing arguments"); + cobj->setCone(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setCone) + +static bool js_physics_ConeShape_setConvex(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setConvex : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setConvex : Error processing arguments"); + cobj->setConvex(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setConvex) + +static bool js_physics_ConeShape_setGroup(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setGroup) + +static bool js_physics_ConeShape_setMask(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setMask) + +static bool js_physics_ConeShape_setMaterial(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_setMaterial) + +static bool js_physics_ConeShape_updateEventListener(se::State& s) +{ + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_ConeShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_ConeShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_ConeShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_ConeShape_finalize) + +static bool js_physics_ConeShape_constructor(se::State& s) // constructor.c +{ + cc::physics::ConeShape* cobj = JSB_ALLOC(cc::physics::ConeShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_ConeShape_constructor, __jsb_cc_physics_ConeShape_class, js_cc_physics_ConeShape_finalize) + + + + +static bool js_cc_physics_ConeShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::ConeShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_ConeShape_finalize) + +bool js_register_physics_ConeShape(se::Object* obj) +{ + auto cls = se::Class::create("ConeShape", obj, nullptr, _SE(js_physics_ConeShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_ConeShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_ConeShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_ConeShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_ConeShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_ConeShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_ConeShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_ConeShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_ConeShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_ConeShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_ConeShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_ConeShape_setCenter)); + cls->defineFunction("setCone", _SE(js_physics_ConeShape_setCone)); + cls->defineFunction("setConvex", _SE(js_physics_ConeShape_setConvex)); + cls->defineFunction("setGroup", _SE(js_physics_ConeShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_ConeShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_ConeShape_setMaterial)); + cls->defineFunction("updateEventListener", _SE(js_physics_ConeShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_ConeShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_ConeShape_proto = cls->getProto(); + __jsb_cc_physics_ConeShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_TerrainShape_proto = nullptr; +se::Class* __jsb_cc_physics_TerrainShape_class = nullptr; + +static bool js_physics_TerrainShape_getAABB(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_getAABB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::AABB& result = cobj->getAABB(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getAABB : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_getAABB) + +static bool js_physics_TerrainShape_getBoundingSphere(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_getBoundingSphere : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::Sphere& result = cobj->getBoundingSphere(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getBoundingSphere : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_getBoundingSphere) + +static bool js_physics_TerrainShape_getGroup(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_getGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getGroup(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getGroup : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_getGroup) + +static bool js_physics_TerrainShape_getImpl(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_getImpl) + +static bool js_physics_TerrainShape_getMask(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_getMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + unsigned int result = cobj->getMask(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getMask : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_getMask) + +static bool js_physics_TerrainShape_initialize(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_initialize) + +static bool js_physics_TerrainShape_onDestroy(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_onDestroy) + +static bool js_physics_TerrainShape_onDisable(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_onDisable) + +static bool js_physics_TerrainShape_onEnable(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_onEnable) + +static bool js_physics_TerrainShape_setAsTrigger(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_setAsTrigger : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_setAsTrigger : Error processing arguments"); + cobj->setAsTrigger(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_setAsTrigger) + +static bool js_physics_TerrainShape_setCenter(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_setCenter : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_setCenter : Error processing arguments"); + cobj->setCenter(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_setCenter) + +static bool js_physics_TerrainShape_setGroup(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_setGroup : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_setGroup : Error processing arguments"); + cobj->setGroup(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_setGroup) + +static bool js_physics_TerrainShape_setMask(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_setMask : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_setMask : Error processing arguments"); + cobj->setMask(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_setMask) + +static bool js_physics_TerrainShape_setMaterial(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_setMaterial : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 6) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + HolderType arg4 = {}; + HolderType arg5 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + ok &= sevalue_to_native(args[4], &arg4, s.thisObject()); + ok &= sevalue_to_native(args[5], &arg5, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_setMaterial : Error processing arguments"); + cobj->setMaterial(arg0.value(), arg1.value(), arg2.value(), arg3.value(), arg4.value(), arg5.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 6); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_setMaterial) + +static bool js_physics_TerrainShape_setTerrain(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_setTerrain : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 4) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + HolderType arg3 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + ok &= sevalue_to_native(args[3], &arg3, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_setTerrain : Error processing arguments"); + cobj->setTerrain(arg0.value(), arg1.value(), arg2.value(), arg3.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 4); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_setTerrain) + +static bool js_physics_TerrainShape_updateEventListener(se::State& s) +{ + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_TerrainShape_updateEventListener : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_updateEventListener : Error processing arguments"); + cobj->updateEventListener(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_TerrainShape_updateEventListener) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_TerrainShape_finalize) + +static bool js_physics_TerrainShape_constructor(se::State& s) // constructor.c +{ + cc::physics::TerrainShape* cobj = JSB_ALLOC(cc::physics::TerrainShape); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_TerrainShape_constructor, __jsb_cc_physics_TerrainShape_class, js_cc_physics_TerrainShape_finalize) + + + + +static bool js_cc_physics_TerrainShape_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::TerrainShape* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_TerrainShape_finalize) + +bool js_register_physics_TerrainShape(se::Object* obj) +{ + auto cls = se::Class::create("TerrainShape", obj, nullptr, _SE(js_physics_TerrainShape_constructor)); + + cls->defineFunction("getAABB", _SE(js_physics_TerrainShape_getAABB)); + cls->defineFunction("getBoundingSphere", _SE(js_physics_TerrainShape_getBoundingSphere)); + cls->defineFunction("getGroup", _SE(js_physics_TerrainShape_getGroup)); + cls->defineFunction("getImpl", _SE(js_physics_TerrainShape_getImpl)); + cls->defineFunction("getMask", _SE(js_physics_TerrainShape_getMask)); + cls->defineFunction("initialize", _SE(js_physics_TerrainShape_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_TerrainShape_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_TerrainShape_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_TerrainShape_onEnable)); + cls->defineFunction("setAsTrigger", _SE(js_physics_TerrainShape_setAsTrigger)); + cls->defineFunction("setCenter", _SE(js_physics_TerrainShape_setCenter)); + cls->defineFunction("setGroup", _SE(js_physics_TerrainShape_setGroup)); + cls->defineFunction("setMask", _SE(js_physics_TerrainShape_setMask)); + cls->defineFunction("setMaterial", _SE(js_physics_TerrainShape_setMaterial)); + cls->defineFunction("setTerrain", _SE(js_physics_TerrainShape_setTerrain)); + cls->defineFunction("updateEventListener", _SE(js_physics_TerrainShape_updateEventListener)); + cls->defineFinalizeFunction(_SE(js_cc_physics_TerrainShape_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_TerrainShape_proto = cls->getProto(); + __jsb_cc_physics_TerrainShape_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_RevoluteJoint_proto = nullptr; +se::Class* __jsb_cc_physics_RevoluteJoint_class = nullptr; + +static bool js_physics_RevoluteJoint_getImpl(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_getImpl) + +static bool js_physics_RevoluteJoint_initialize(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_initialize) + +static bool js_physics_RevoluteJoint_onDestroy(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_onDestroy) + +static bool js_physics_RevoluteJoint_onDisable(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_onDisable) + +static bool js_physics_RevoluteJoint_onEnable(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_onEnable) + +static bool js_physics_RevoluteJoint_setAxis(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_setAxis : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_setAxis : Error processing arguments"); + cobj->setAxis(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_setAxis) + +static bool js_physics_RevoluteJoint_setConnectedBody(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_setConnectedBody : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_setConnectedBody : Error processing arguments"); + cobj->setConnectedBody(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_setConnectedBody) + +static bool js_physics_RevoluteJoint_setEnableCollision(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_setEnableCollision : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_setEnableCollision : Error processing arguments"); + cobj->setEnableCollision(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_setEnableCollision) + +static bool js_physics_RevoluteJoint_setPivotA(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_setPivotA : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_setPivotA : Error processing arguments"); + cobj->setPivotA(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_setPivotA) + +static bool js_physics_RevoluteJoint_setPivotB(se::State& s) +{ + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_RevoluteJoint_setPivotB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_setPivotB : Error processing arguments"); + cobj->setPivotB(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_RevoluteJoint_setPivotB) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_RevoluteJoint_finalize) + +static bool js_physics_RevoluteJoint_constructor(se::State& s) // constructor.c +{ + cc::physics::RevoluteJoint* cobj = JSB_ALLOC(cc::physics::RevoluteJoint); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_RevoluteJoint_constructor, __jsb_cc_physics_RevoluteJoint_class, js_cc_physics_RevoluteJoint_finalize) + + + + +static bool js_cc_physics_RevoluteJoint_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::RevoluteJoint* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_RevoluteJoint_finalize) + +bool js_register_physics_RevoluteJoint(se::Object* obj) +{ + auto cls = se::Class::create("RevoluteJoint", obj, nullptr, _SE(js_physics_RevoluteJoint_constructor)); + + cls->defineFunction("getImpl", _SE(js_physics_RevoluteJoint_getImpl)); + cls->defineFunction("initialize", _SE(js_physics_RevoluteJoint_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_RevoluteJoint_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_RevoluteJoint_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_RevoluteJoint_onEnable)); + cls->defineFunction("setAxis", _SE(js_physics_RevoluteJoint_setAxis)); + cls->defineFunction("setConnectedBody", _SE(js_physics_RevoluteJoint_setConnectedBody)); + cls->defineFunction("setEnableCollision", _SE(js_physics_RevoluteJoint_setEnableCollision)); + cls->defineFunction("setPivotA", _SE(js_physics_RevoluteJoint_setPivotA)); + cls->defineFunction("setPivotB", _SE(js_physics_RevoluteJoint_setPivotB)); + cls->defineFinalizeFunction(_SE(js_cc_physics_RevoluteJoint_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_RevoluteJoint_proto = cls->getProto(); + __jsb_cc_physics_RevoluteJoint_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_physics_DistanceJoint_proto = nullptr; +se::Class* __jsb_cc_physics_DistanceJoint_class = nullptr; + +static bool js_physics_DistanceJoint_getImpl(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_getImpl : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + uintptr_t result = cobj->getImpl(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_getImpl : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_getImpl) + +static bool js_physics_DistanceJoint_initialize(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_initialize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_initialize : Error processing arguments"); + cobj->initialize(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_initialize) + +static bool js_physics_DistanceJoint_onDestroy(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_onDestroy : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDestroy(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_onDestroy) + +static bool js_physics_DistanceJoint_onDisable(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_onDisable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onDisable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_onDisable) + +static bool js_physics_DistanceJoint_onEnable(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_onEnable : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + if (argc == 0) { + cobj->onEnable(); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_onEnable) + +static bool js_physics_DistanceJoint_setConnectedBody(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_setConnectedBody : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_setConnectedBody : Error processing arguments"); + cobj->setConnectedBody(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_setConnectedBody) + +static bool js_physics_DistanceJoint_setEnableCollision(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_setEnableCollision : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_setEnableCollision : Error processing arguments"); + cobj->setEnableCollision(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_setEnableCollision) + +static bool js_physics_DistanceJoint_setPivotA(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_setPivotA : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_setPivotA : Error processing arguments"); + cobj->setPivotA(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_setPivotA) + +static bool js_physics_DistanceJoint_setPivotB(se::State& s) +{ + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_physics_DistanceJoint_setPivotB : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 3) { + HolderType arg0 = {}; + HolderType arg1 = {}; + HolderType arg2 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + ok &= sevalue_to_native(args[2], &arg2, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_setPivotB : Error processing arguments"); + cobj->setPivotB(arg0.value(), arg1.value(), arg2.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3); + return false; +} +SE_BIND_FUNC(js_physics_DistanceJoint_setPivotB) + +SE_DECLARE_FINALIZE_FUNC(js_cc_physics_DistanceJoint_finalize) + +static bool js_physics_DistanceJoint_constructor(se::State& s) // constructor.c +{ + cc::physics::DistanceJoint* cobj = JSB_ALLOC(cc::physics::DistanceJoint); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_physics_DistanceJoint_constructor, __jsb_cc_physics_DistanceJoint_class, js_cc_physics_DistanceJoint_finalize) + + + + +static bool js_cc_physics_DistanceJoint_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::physics::DistanceJoint* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_physics_DistanceJoint_finalize) + +bool js_register_physics_DistanceJoint(se::Object* obj) +{ + auto cls = se::Class::create("DistanceJoint", obj, nullptr, _SE(js_physics_DistanceJoint_constructor)); + + cls->defineFunction("getImpl", _SE(js_physics_DistanceJoint_getImpl)); + cls->defineFunction("initialize", _SE(js_physics_DistanceJoint_initialize)); + cls->defineFunction("onDestroy", _SE(js_physics_DistanceJoint_onDestroy)); + cls->defineFunction("onDisable", _SE(js_physics_DistanceJoint_onDisable)); + cls->defineFunction("onEnable", _SE(js_physics_DistanceJoint_onEnable)); + cls->defineFunction("setConnectedBody", _SE(js_physics_DistanceJoint_setConnectedBody)); + cls->defineFunction("setEnableCollision", _SE(js_physics_DistanceJoint_setEnableCollision)); + cls->defineFunction("setPivotA", _SE(js_physics_DistanceJoint_setPivotA)); + cls->defineFunction("setPivotB", _SE(js_physics_DistanceJoint_setPivotB)); + cls->defineFinalizeFunction(_SE(js_cc_physics_DistanceJoint_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_physics_DistanceJoint_proto = cls->getProto(); + __jsb_cc_physics_DistanceJoint_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +bool register_all_physics(se::Object* obj) +{ + // Get the ns + se::Value nsVal; + if (!obj->getProperty("jsb.physics", &nsVal)) + { + se::HandleObject jsobj(se::Object::createPlainObject()); + nsVal.setObject(jsobj); + obj->setProperty("jsb.physics", nsVal); + } + se::Object* ns = nsVal.toObject(); + + js_register_physics_RigidBody(ns); + js_register_physics_SphereShape(ns); + js_register_physics_CylinderShape(ns); + js_register_physics_TrimeshShape(ns); + js_register_physics_PlaneShape(ns); + js_register_physics_DistanceJoint(ns); + js_register_physics_RevoluteJoint(ns); + js_register_physics_CapsuleShape(ns); + js_register_physics_BoxShape(ns); + js_register_physics_World(ns); + js_register_physics_ConeShape(ns); + js_register_physics_TerrainShape(ns); + return true; +} + diff --git a/native/cocos/bindings/auto/jsb_physics_auto.h b/native/cocos/bindings/auto/jsb_physics_auto.h new file mode 100644 index 0000000000..50833ca74b --- /dev/null +++ b/native/cocos/bindings/auto/jsb_physics_auto.h @@ -0,0 +1,324 @@ +#pragma once +#include "base/Config.h" +#include +#include "cocos/bindings/jswrapper/SeApi.h" +#include "cocos/bindings/manual/jsb_conversions.h" +#include "cocos/physics/PhysicsSDK.h" + +extern se::Object* __jsb_cc_physics_World_proto; +extern se::Class* __jsb_cc_physics_World_class; + +bool js_register_cc_physics_World(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::World); +SE_DECLARE_FUNC(js_physics_World_createConvex); +SE_DECLARE_FUNC(js_physics_World_createHeightField); +SE_DECLARE_FUNC(js_physics_World_createMaterial); +SE_DECLARE_FUNC(js_physics_World_createTrimesh); +SE_DECLARE_FUNC(js_physics_World_destroy); +SE_DECLARE_FUNC(js_physics_World_emitEvents); +SE_DECLARE_FUNC(js_physics_World_getContactEventPairs); +SE_DECLARE_FUNC(js_physics_World_getTriggerEventPairs); +SE_DECLARE_FUNC(js_physics_World_raycast); +SE_DECLARE_FUNC(js_physics_World_raycastClosest); +SE_DECLARE_FUNC(js_physics_World_raycastClosestResult); +SE_DECLARE_FUNC(js_physics_World_raycastResult); +SE_DECLARE_FUNC(js_physics_World_setAllowSleep); +SE_DECLARE_FUNC(js_physics_World_setCollisionMatrix); +SE_DECLARE_FUNC(js_physics_World_setGravity); +SE_DECLARE_FUNC(js_physics_World_step); +SE_DECLARE_FUNC(js_physics_World_syncSceneToPhysics); +SE_DECLARE_FUNC(js_physics_World_syncSceneWithCheck); +SE_DECLARE_FUNC(js_physics_World_World); + +extern se::Object* __jsb_cc_physics_RigidBody_proto; +extern se::Class* __jsb_cc_physics_RigidBody_class; + +bool js_register_cc_physics_RigidBody(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::RigidBody); +SE_DECLARE_FUNC(js_physics_RigidBody_applyForce); +SE_DECLARE_FUNC(js_physics_RigidBody_applyImpulse); +SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalForce); +SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalImpulse); +SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalTorque); +SE_DECLARE_FUNC(js_physics_RigidBody_applyTorque); +SE_DECLARE_FUNC(js_physics_RigidBody_clearForces); +SE_DECLARE_FUNC(js_physics_RigidBody_clearState); +SE_DECLARE_FUNC(js_physics_RigidBody_clearVelocity); +SE_DECLARE_FUNC(js_physics_RigidBody_getAngularVelocity); +SE_DECLARE_FUNC(js_physics_RigidBody_getGroup); +SE_DECLARE_FUNC(js_physics_RigidBody_getImpl); +SE_DECLARE_FUNC(js_physics_RigidBody_getLinearVelocity); +SE_DECLARE_FUNC(js_physics_RigidBody_getMask); +SE_DECLARE_FUNC(js_physics_RigidBody_getNodeHandle); +SE_DECLARE_FUNC(js_physics_RigidBody_getSleepThreshold); +SE_DECLARE_FUNC(js_physics_RigidBody_initialize); +SE_DECLARE_FUNC(js_physics_RigidBody_isAwake); +SE_DECLARE_FUNC(js_physics_RigidBody_isSleeping); +SE_DECLARE_FUNC(js_physics_RigidBody_isSleepy); +SE_DECLARE_FUNC(js_physics_RigidBody_onDestroy); +SE_DECLARE_FUNC(js_physics_RigidBody_onDisable); +SE_DECLARE_FUNC(js_physics_RigidBody_onEnable); +SE_DECLARE_FUNC(js_physics_RigidBody_setAllowSleep); +SE_DECLARE_FUNC(js_physics_RigidBody_setAngularDamping); +SE_DECLARE_FUNC(js_physics_RigidBody_setAngularFactor); +SE_DECLARE_FUNC(js_physics_RigidBody_setAngularVelocity); +SE_DECLARE_FUNC(js_physics_RigidBody_setGroup); +SE_DECLARE_FUNC(js_physics_RigidBody_setLinearDamping); +SE_DECLARE_FUNC(js_physics_RigidBody_setLinearFactor); +SE_DECLARE_FUNC(js_physics_RigidBody_setLinearVelocity); +SE_DECLARE_FUNC(js_physics_RigidBody_setMask); +SE_DECLARE_FUNC(js_physics_RigidBody_setMass); +SE_DECLARE_FUNC(js_physics_RigidBody_setSleepThreshold); +SE_DECLARE_FUNC(js_physics_RigidBody_setType); +SE_DECLARE_FUNC(js_physics_RigidBody_sleep); +SE_DECLARE_FUNC(js_physics_RigidBody_useGravity); +SE_DECLARE_FUNC(js_physics_RigidBody_wakeUp); +SE_DECLARE_FUNC(js_physics_RigidBody_RigidBody); + +extern se::Object* __jsb_cc_physics_SphereShape_proto; +extern se::Class* __jsb_cc_physics_SphereShape_class; + +bool js_register_cc_physics_SphereShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::SphereShape); +SE_DECLARE_FUNC(js_physics_SphereShape_getAABB); +SE_DECLARE_FUNC(js_physics_SphereShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_SphereShape_getGroup); +SE_DECLARE_FUNC(js_physics_SphereShape_getImpl); +SE_DECLARE_FUNC(js_physics_SphereShape_getMask); +SE_DECLARE_FUNC(js_physics_SphereShape_initialize); +SE_DECLARE_FUNC(js_physics_SphereShape_onDestroy); +SE_DECLARE_FUNC(js_physics_SphereShape_onDisable); +SE_DECLARE_FUNC(js_physics_SphereShape_onEnable); +SE_DECLARE_FUNC(js_physics_SphereShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_SphereShape_setCenter); +SE_DECLARE_FUNC(js_physics_SphereShape_setGroup); +SE_DECLARE_FUNC(js_physics_SphereShape_setMask); +SE_DECLARE_FUNC(js_physics_SphereShape_setMaterial); +SE_DECLARE_FUNC(js_physics_SphereShape_setRadius); +SE_DECLARE_FUNC(js_physics_SphereShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_SphereShape_SphereShape); + +extern se::Object* __jsb_cc_physics_BoxShape_proto; +extern se::Class* __jsb_cc_physics_BoxShape_class; + +bool js_register_cc_physics_BoxShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::BoxShape); +SE_DECLARE_FUNC(js_physics_BoxShape_getAABB); +SE_DECLARE_FUNC(js_physics_BoxShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_BoxShape_getGroup); +SE_DECLARE_FUNC(js_physics_BoxShape_getImpl); +SE_DECLARE_FUNC(js_physics_BoxShape_getMask); +SE_DECLARE_FUNC(js_physics_BoxShape_initialize); +SE_DECLARE_FUNC(js_physics_BoxShape_onDestroy); +SE_DECLARE_FUNC(js_physics_BoxShape_onDisable); +SE_DECLARE_FUNC(js_physics_BoxShape_onEnable); +SE_DECLARE_FUNC(js_physics_BoxShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_BoxShape_setCenter); +SE_DECLARE_FUNC(js_physics_BoxShape_setGroup); +SE_DECLARE_FUNC(js_physics_BoxShape_setMask); +SE_DECLARE_FUNC(js_physics_BoxShape_setMaterial); +SE_DECLARE_FUNC(js_physics_BoxShape_setSize); +SE_DECLARE_FUNC(js_physics_BoxShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_BoxShape_BoxShape); + +extern se::Object* __jsb_cc_physics_CapsuleShape_proto; +extern se::Class* __jsb_cc_physics_CapsuleShape_class; + +bool js_register_cc_physics_CapsuleShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::CapsuleShape); +SE_DECLARE_FUNC(js_physics_CapsuleShape_getAABB); +SE_DECLARE_FUNC(js_physics_CapsuleShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_CapsuleShape_getGroup); +SE_DECLARE_FUNC(js_physics_CapsuleShape_getImpl); +SE_DECLARE_FUNC(js_physics_CapsuleShape_getMask); +SE_DECLARE_FUNC(js_physics_CapsuleShape_initialize); +SE_DECLARE_FUNC(js_physics_CapsuleShape_onDestroy); +SE_DECLARE_FUNC(js_physics_CapsuleShape_onDisable); +SE_DECLARE_FUNC(js_physics_CapsuleShape_onEnable); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setCenter); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setCylinderHeight); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setDirection); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setGroup); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setMask); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setMaterial); +SE_DECLARE_FUNC(js_physics_CapsuleShape_setRadius); +SE_DECLARE_FUNC(js_physics_CapsuleShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_CapsuleShape_CapsuleShape); + +extern se::Object* __jsb_cc_physics_PlaneShape_proto; +extern se::Class* __jsb_cc_physics_PlaneShape_class; + +bool js_register_cc_physics_PlaneShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::PlaneShape); +SE_DECLARE_FUNC(js_physics_PlaneShape_getAABB); +SE_DECLARE_FUNC(js_physics_PlaneShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_PlaneShape_getGroup); +SE_DECLARE_FUNC(js_physics_PlaneShape_getImpl); +SE_DECLARE_FUNC(js_physics_PlaneShape_getMask); +SE_DECLARE_FUNC(js_physics_PlaneShape_initialize); +SE_DECLARE_FUNC(js_physics_PlaneShape_onDestroy); +SE_DECLARE_FUNC(js_physics_PlaneShape_onDisable); +SE_DECLARE_FUNC(js_physics_PlaneShape_onEnable); +SE_DECLARE_FUNC(js_physics_PlaneShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_PlaneShape_setCenter); +SE_DECLARE_FUNC(js_physics_PlaneShape_setConstant); +SE_DECLARE_FUNC(js_physics_PlaneShape_setGroup); +SE_DECLARE_FUNC(js_physics_PlaneShape_setMask); +SE_DECLARE_FUNC(js_physics_PlaneShape_setMaterial); +SE_DECLARE_FUNC(js_physics_PlaneShape_setNormal); +SE_DECLARE_FUNC(js_physics_PlaneShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_PlaneShape_PlaneShape); + +extern se::Object* __jsb_cc_physics_TrimeshShape_proto; +extern se::Class* __jsb_cc_physics_TrimeshShape_class; + +bool js_register_cc_physics_TrimeshShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::TrimeshShape); +SE_DECLARE_FUNC(js_physics_TrimeshShape_getAABB); +SE_DECLARE_FUNC(js_physics_TrimeshShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_TrimeshShape_getGroup); +SE_DECLARE_FUNC(js_physics_TrimeshShape_getImpl); +SE_DECLARE_FUNC(js_physics_TrimeshShape_getMask); +SE_DECLARE_FUNC(js_physics_TrimeshShape_initialize); +SE_DECLARE_FUNC(js_physics_TrimeshShape_onDestroy); +SE_DECLARE_FUNC(js_physics_TrimeshShape_onDisable); +SE_DECLARE_FUNC(js_physics_TrimeshShape_onEnable); +SE_DECLARE_FUNC(js_physics_TrimeshShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_TrimeshShape_setCenter); +SE_DECLARE_FUNC(js_physics_TrimeshShape_setGroup); +SE_DECLARE_FUNC(js_physics_TrimeshShape_setMask); +SE_DECLARE_FUNC(js_physics_TrimeshShape_setMaterial); +SE_DECLARE_FUNC(js_physics_TrimeshShape_setMesh); +SE_DECLARE_FUNC(js_physics_TrimeshShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_TrimeshShape_useConvex); +SE_DECLARE_FUNC(js_physics_TrimeshShape_TrimeshShape); + +extern se::Object* __jsb_cc_physics_CylinderShape_proto; +extern se::Class* __jsb_cc_physics_CylinderShape_class; + +bool js_register_cc_physics_CylinderShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::CylinderShape); +SE_DECLARE_FUNC(js_physics_CylinderShape_getAABB); +SE_DECLARE_FUNC(js_physics_CylinderShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_CylinderShape_getGroup); +SE_DECLARE_FUNC(js_physics_CylinderShape_getImpl); +SE_DECLARE_FUNC(js_physics_CylinderShape_getMask); +SE_DECLARE_FUNC(js_physics_CylinderShape_initialize); +SE_DECLARE_FUNC(js_physics_CylinderShape_onDestroy); +SE_DECLARE_FUNC(js_physics_CylinderShape_onDisable); +SE_DECLARE_FUNC(js_physics_CylinderShape_onEnable); +SE_DECLARE_FUNC(js_physics_CylinderShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_CylinderShape_setCenter); +SE_DECLARE_FUNC(js_physics_CylinderShape_setConvex); +SE_DECLARE_FUNC(js_physics_CylinderShape_setCylinder); +SE_DECLARE_FUNC(js_physics_CylinderShape_setGroup); +SE_DECLARE_FUNC(js_physics_CylinderShape_setMask); +SE_DECLARE_FUNC(js_physics_CylinderShape_setMaterial); +SE_DECLARE_FUNC(js_physics_CylinderShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_CylinderShape_CylinderShape); + +extern se::Object* __jsb_cc_physics_ConeShape_proto; +extern se::Class* __jsb_cc_physics_ConeShape_class; + +bool js_register_cc_physics_ConeShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::ConeShape); +SE_DECLARE_FUNC(js_physics_ConeShape_getAABB); +SE_DECLARE_FUNC(js_physics_ConeShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_ConeShape_getGroup); +SE_DECLARE_FUNC(js_physics_ConeShape_getImpl); +SE_DECLARE_FUNC(js_physics_ConeShape_getMask); +SE_DECLARE_FUNC(js_physics_ConeShape_initialize); +SE_DECLARE_FUNC(js_physics_ConeShape_onDestroy); +SE_DECLARE_FUNC(js_physics_ConeShape_onDisable); +SE_DECLARE_FUNC(js_physics_ConeShape_onEnable); +SE_DECLARE_FUNC(js_physics_ConeShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_ConeShape_setCenter); +SE_DECLARE_FUNC(js_physics_ConeShape_setCone); +SE_DECLARE_FUNC(js_physics_ConeShape_setConvex); +SE_DECLARE_FUNC(js_physics_ConeShape_setGroup); +SE_DECLARE_FUNC(js_physics_ConeShape_setMask); +SE_DECLARE_FUNC(js_physics_ConeShape_setMaterial); +SE_DECLARE_FUNC(js_physics_ConeShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_ConeShape_ConeShape); + +extern se::Object* __jsb_cc_physics_TerrainShape_proto; +extern se::Class* __jsb_cc_physics_TerrainShape_class; + +bool js_register_cc_physics_TerrainShape(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::TerrainShape); +SE_DECLARE_FUNC(js_physics_TerrainShape_getAABB); +SE_DECLARE_FUNC(js_physics_TerrainShape_getBoundingSphere); +SE_DECLARE_FUNC(js_physics_TerrainShape_getGroup); +SE_DECLARE_FUNC(js_physics_TerrainShape_getImpl); +SE_DECLARE_FUNC(js_physics_TerrainShape_getMask); +SE_DECLARE_FUNC(js_physics_TerrainShape_initialize); +SE_DECLARE_FUNC(js_physics_TerrainShape_onDestroy); +SE_DECLARE_FUNC(js_physics_TerrainShape_onDisable); +SE_DECLARE_FUNC(js_physics_TerrainShape_onEnable); +SE_DECLARE_FUNC(js_physics_TerrainShape_setAsTrigger); +SE_DECLARE_FUNC(js_physics_TerrainShape_setCenter); +SE_DECLARE_FUNC(js_physics_TerrainShape_setGroup); +SE_DECLARE_FUNC(js_physics_TerrainShape_setMask); +SE_DECLARE_FUNC(js_physics_TerrainShape_setMaterial); +SE_DECLARE_FUNC(js_physics_TerrainShape_setTerrain); +SE_DECLARE_FUNC(js_physics_TerrainShape_updateEventListener); +SE_DECLARE_FUNC(js_physics_TerrainShape_TerrainShape); + +extern se::Object* __jsb_cc_physics_RevoluteJoint_proto; +extern se::Class* __jsb_cc_physics_RevoluteJoint_class; + +bool js_register_cc_physics_RevoluteJoint(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::RevoluteJoint); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_getImpl); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_initialize); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_onDestroy); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_onDisable); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_onEnable); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_setAxis); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_setConnectedBody); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_setEnableCollision); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_setPivotA); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_setPivotB); +SE_DECLARE_FUNC(js_physics_RevoluteJoint_RevoluteJoint); + +extern se::Object* __jsb_cc_physics_DistanceJoint_proto; +extern se::Class* __jsb_cc_physics_DistanceJoint_class; + +bool js_register_cc_physics_DistanceJoint(se::Object* obj); +bool register_all_physics(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::physics::DistanceJoint); +SE_DECLARE_FUNC(js_physics_DistanceJoint_getImpl); +SE_DECLARE_FUNC(js_physics_DistanceJoint_initialize); +SE_DECLARE_FUNC(js_physics_DistanceJoint_onDestroy); +SE_DECLARE_FUNC(js_physics_DistanceJoint_onDisable); +SE_DECLARE_FUNC(js_physics_DistanceJoint_onEnable); +SE_DECLARE_FUNC(js_physics_DistanceJoint_setConnectedBody); +SE_DECLARE_FUNC(js_physics_DistanceJoint_setEnableCollision); +SE_DECLARE_FUNC(js_physics_DistanceJoint_setPivotA); +SE_DECLARE_FUNC(js_physics_DistanceJoint_setPivotB); +SE_DECLARE_FUNC(js_physics_DistanceJoint_DistanceJoint); + diff --git a/native/cocos/bindings/auto/jsb_pipeline_auto.cpp b/native/cocos/bindings/auto/jsb_pipeline_auto.cpp index 40cf1dff70..8502adffdc 100644 --- a/native/cocos/bindings/auto/jsb_pipeline_auto.cpp +++ b/native/cocos/bindings/auto/jsb_pipeline_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_pipeline_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" @@ -12,8 +37,13 @@ #include "renderer/pipeline/Define.h" #include "renderer/pipeline/helper/SharedMemory.h" #include "renderer/pipeline/InstancedBuffer.h" -#include "cocos/renderer/core/Core.h" -#include "cocos/renderer/core/gfx/GFXDescriptorSet.h" +#include "renderer/pipeline/deferred/DeferredPipeline.h" +#include "renderer/pipeline/deferred/GbufferFlow.h" +#include "renderer/pipeline/deferred/GbufferStage.h" +#include "renderer/pipeline/deferred/LightingFlow.h" +#include "renderer/pipeline/deferred/LightingStage.h" +#include "renderer/pipeline/deferred/PostprocessStage.h" +#include "cocos/renderer/gfx-base/GFXBase.h" #ifndef JSB_ALLOC #define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) @@ -228,7 +258,6 @@ bool js_register_pipeline_RenderQueueDesc(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_Light_proto = nullptr; se::Class* __jsb_cc_pipeline_Light_class = nullptr; @@ -900,7 +929,6 @@ bool js_register_pipeline_Light(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_PassView_proto = nullptr; se::Class* __jsb_cc_pipeline_PassView_class = nullptr; @@ -1582,7 +1610,6 @@ bool js_register_pipeline_PassView(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderWindow_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderWindow_class = nullptr; @@ -1809,7 +1836,6 @@ bool js_register_pipeline_RenderWindow(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderPipelineInfo_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderPipelineInfo_class = nullptr; @@ -1981,7 +2007,6 @@ bool js_register_pipeline_RenderPipelineInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderPipeline_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderPipeline_class = nullptr; @@ -2019,6 +2044,25 @@ static bool js_pipeline_RenderPipeline_destroy(se::State& s) } SE_BIND_FUNC(js_pipeline_RenderPipeline_destroy) +static bool js_pipeline_RenderPipeline_getConstantMacros(se::State& s) +{ + cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getConstantMacros : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::String& result = cobj->getConstantMacros(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_getConstantMacros : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getConstantMacros) + static bool js_pipeline_RenderPipeline_getDescriptorSet(se::State& s) { cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); @@ -2057,6 +2101,25 @@ static bool js_pipeline_RenderPipeline_getDescriptorSetLayout(se::State& s) } SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getDescriptorSetLayout) +static bool js_pipeline_RenderPipeline_getDevice(se::State& s) +{ + cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getDevice : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::gfx::Device* result = cobj->getDevice(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_getDevice : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_RenderPipeline_getDevice) + static bool js_pipeline_RenderPipeline_initialize(se::State& s) { cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); @@ -2098,6 +2161,46 @@ static bool js_pipeline_RenderPipeline_render(se::State& s) } SE_BIND_FUNC(js_pipeline_RenderPipeline_render) +static bool js_pipeline_RenderPipeline_resize(se::State& s) +{ + cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_resize : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + HolderType arg0 = {}; + HolderType arg1 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + ok &= sevalue_to_native(args[1], &arg1, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_resize : Error processing arguments"); + cobj->resize(arg0.value(), arg1.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2); + return false; +} +SE_BIND_FUNC(js_pipeline_RenderPipeline_resize) + +static bool js_pipeline_RenderPipeline_setPipelineSharedSceneData(se::State& s) +{ + cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_setPipelineSharedSceneData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + HolderType arg0 = {}; + ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); + SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_setPipelineSharedSceneData : Error processing arguments"); + cobj->setPipelineSharedSceneData(arg0.value()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_pipeline_RenderPipeline_setPipelineSharedSceneData) + static bool js_pipeline_RenderPipeline_setValue(se::State& s) { cc::pipeline::RenderPipeline* cobj = SE_THIS_OBJECT(s); @@ -2145,10 +2248,14 @@ bool js_register_pipeline_RenderPipeline(se::Object* obj) cls->defineProperty("descriptorSet", _SE(js_pipeline_RenderPipeline_getDescriptorSet), nullptr); cls->defineProperty("descriptorSetLayout", _SE(js_pipeline_RenderPipeline_getDescriptorSetLayout), nullptr); + cls->defineProperty("constantMacros", _SE(js_pipeline_RenderPipeline_getConstantMacros), nullptr); cls->defineFunction("activate", _SE(js_pipeline_RenderPipeline_activate)); cls->defineFunction("destroy", _SE(js_pipeline_RenderPipeline_destroy)); + cls->defineFunction("getDevice", _SE(js_pipeline_RenderPipeline_getDevice)); cls->defineFunction("initialize", _SE(js_pipeline_RenderPipeline_initialize)); cls->defineFunction("render", _SE(js_pipeline_RenderPipeline_render)); + cls->defineFunction("resize", _SE(js_pipeline_RenderPipeline_resize)); + cls->defineFunction("setPipelineSharedSceneData", _SE(js_pipeline_RenderPipeline_setPipelineSharedSceneData)); cls->defineFunction("setValue", _SE(js_pipeline_RenderPipeline_setValue)); cls->defineStaticFunction("getInstance", _SE(js_pipeline_RenderPipeline_getInstance)); cls->install(); @@ -2160,105 +2267,9 @@ bool js_register_pipeline_RenderPipeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_ForwardPipeline_proto = nullptr; se::Class* __jsb_cc_pipeline_ForwardPipeline_class = nullptr; -static bool js_pipeline_ForwardPipeline_getSphere(se::State& s) -{ - cc::pipeline::ForwardPipeline* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_pipeline_ForwardPipeline_getSphere : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 0) { - cc::pipeline::Sphere* result = cobj->getSphere(); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_pipeline_ForwardPipeline_getSphere : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); - return false; -} -SE_BIND_FUNC(js_pipeline_ForwardPipeline_getSphere) - -static bool js_pipeline_ForwardPipeline_setAmbient(se::State& s) -{ - cc::pipeline::ForwardPipeline* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_pipeline_ForwardPipeline_setAmbient : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_pipeline_ForwardPipeline_setAmbient : Error processing arguments"); - cobj->setAmbient(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_pipeline_ForwardPipeline_setAmbient) - -static bool js_pipeline_ForwardPipeline_setFog(se::State& s) -{ - cc::pipeline::ForwardPipeline* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_pipeline_ForwardPipeline_setFog : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_pipeline_ForwardPipeline_setFog : Error processing arguments"); - cobj->setFog(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_pipeline_ForwardPipeline_setFog) - -static bool js_pipeline_ForwardPipeline_setShadows(se::State& s) -{ - cc::pipeline::ForwardPipeline* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_pipeline_ForwardPipeline_setShadows : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_pipeline_ForwardPipeline_setShadows : Error processing arguments"); - cobj->setShadows(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_pipeline_ForwardPipeline_setShadows) - -static bool js_pipeline_ForwardPipeline_setSkybox(se::State& s) -{ - cc::pipeline::ForwardPipeline* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_pipeline_ForwardPipeline_setSkybox : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_pipeline_ForwardPipeline_setSkybox : Error processing arguments"); - cobj->setSkybox(arg0.value()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_pipeline_ForwardPipeline_setSkybox) - SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_ForwardPipeline_finalize) static bool js_pipeline_ForwardPipeline_constructor(se::State& s) // constructor.c @@ -2291,11 +2302,6 @@ bool js_register_pipeline_ForwardPipeline(se::Object* obj) { auto cls = se::Class::create("ForwardPipeline", obj, __jsb_cc_pipeline_RenderPipeline_proto, _SE(js_pipeline_ForwardPipeline_constructor)); - cls->defineFunction("getSphere", _SE(js_pipeline_ForwardPipeline_getSphere)); - cls->defineFunction("setAmbient", _SE(js_pipeline_ForwardPipeline_setAmbient)); - cls->defineFunction("setFog", _SE(js_pipeline_ForwardPipeline_setFog)); - cls->defineFunction("setShadows", _SE(js_pipeline_ForwardPipeline_setShadows)); - cls->defineFunction("setSkybox", _SE(js_pipeline_ForwardPipeline_setSkybox)); cls->defineFinalizeFunction(_SE(js_cc_pipeline_ForwardPipeline_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -2306,7 +2312,6 @@ bool js_register_pipeline_ForwardPipeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderFlowInfo_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderFlowInfo_class = nullptr; @@ -2548,7 +2553,6 @@ bool js_register_pipeline_RenderFlowInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderFlow_class = nullptr; @@ -2631,7 +2635,6 @@ bool js_register_pipeline_RenderFlow(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_ForwardFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_ForwardFlow_class = nullptr; @@ -2695,7 +2698,6 @@ bool js_register_pipeline_ForwardFlow(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderStageInfo_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderStageInfo_class = nullptr; @@ -2937,7 +2939,6 @@ bool js_register_pipeline_RenderStageInfo(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_RenderStage_proto = nullptr; se::Class* __jsb_cc_pipeline_RenderStage_class = nullptr; @@ -2962,6 +2963,25 @@ static bool js_pipeline_RenderStage_activate(se::State& s) } SE_BIND_FUNC(js_pipeline_RenderStage_activate) +static bool js_pipeline_RenderStage_getFlow(se::State& s) +{ + cc::pipeline::RenderStage* cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_pipeline_RenderStage_getFlow : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + cc::pipeline::RenderFlow* result = cobj->getFlow(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_RenderStage_getFlow : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_RenderStage_getFlow) + static bool js_pipeline_RenderStage_getTag(se::State& s) { cc::pipeline::RenderStage* cobj = SE_THIS_OBJECT(s); @@ -3011,6 +3031,7 @@ bool js_register_pipeline_RenderStage(se::Object* obj) auto cls = se::Class::create("RenderStage", obj, nullptr, nullptr); cls->defineFunction("activate", _SE(js_pipeline_RenderStage_activate)); + cls->defineFunction("getFlow", _SE(js_pipeline_RenderStage_getFlow)); cls->defineFunction("getTag", _SE(js_pipeline_RenderStage_getTag)); cls->defineFunction("initialize", _SE(js_pipeline_RenderStage_initialize)); cls->install(); @@ -3022,7 +3043,6 @@ bool js_register_pipeline_RenderStage(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_ForwardStage_proto = nullptr; se::Class* __jsb_cc_pipeline_ForwardStage_class = nullptr; @@ -3086,7 +3106,6 @@ bool js_register_pipeline_ForwardStage(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_ShadowFlow_proto = nullptr; se::Class* __jsb_cc_pipeline_ShadowFlow_class = nullptr; @@ -3150,7 +3169,6 @@ bool js_register_pipeline_ShadowFlow(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_ShadowStage_proto = nullptr; se::Class* __jsb_cc_pipeline_ShadowStage_class = nullptr; @@ -3256,7 +3274,6 @@ bool js_register_pipeline_ShadowStage(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_cc_pipeline_InstancedBuffer_proto = nullptr; se::Class* __jsb_cc_pipeline_InstancedBuffer_class = nullptr; @@ -3382,7 +3399,348 @@ bool js_register_pipeline_InstancedBuffer(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } +se::Object* __jsb_cc_pipeline_DeferredPipeline_proto = nullptr; +se::Class* __jsb_cc_pipeline_DeferredPipeline_class = nullptr; +SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_DeferredPipeline_finalize) + +static bool js_pipeline_DeferredPipeline_constructor(se::State& s) // constructor.c +{ + cc::pipeline::DeferredPipeline* cobj = JSB_ALLOC(cc::pipeline::DeferredPipeline); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_pipeline_DeferredPipeline_constructor, __jsb_cc_pipeline_DeferredPipeline_class, js_cc_pipeline_DeferredPipeline_finalize) + + + +extern se::Object* __jsb_cc_pipeline_RenderPipeline_proto; + +static bool js_cc_pipeline_DeferredPipeline_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::pipeline::DeferredPipeline* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_pipeline_DeferredPipeline_finalize) + +bool js_register_pipeline_DeferredPipeline(se::Object* obj) +{ + auto cls = se::Class::create("DeferredPipeline", obj, __jsb_cc_pipeline_RenderPipeline_proto, _SE(js_pipeline_DeferredPipeline_constructor)); + + cls->defineFinalizeFunction(_SE(js_cc_pipeline_DeferredPipeline_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_pipeline_DeferredPipeline_proto = cls->getProto(); + __jsb_cc_pipeline_DeferredPipeline_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_pipeline_GbufferFlow_proto = nullptr; +se::Class* __jsb_cc_pipeline_GbufferFlow_class = nullptr; + +static bool js_pipeline_GbufferFlow_getInitializeInfo(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::pipeline::RenderFlowInfo& result = cc::pipeline::GbufferFlow::getInitializeInfo(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_GbufferFlow_getInitializeInfo : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_GbufferFlow_getInitializeInfo) + +SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_GbufferFlow_finalize) + +static bool js_pipeline_GbufferFlow_constructor(se::State& s) // constructor.c +{ + cc::pipeline::GbufferFlow* cobj = JSB_ALLOC(cc::pipeline::GbufferFlow); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_pipeline_GbufferFlow_constructor, __jsb_cc_pipeline_GbufferFlow_class, js_cc_pipeline_GbufferFlow_finalize) + + + +extern se::Object* __jsb_cc_pipeline_RenderFlow_proto; + +static bool js_cc_pipeline_GbufferFlow_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::pipeline::GbufferFlow* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_pipeline_GbufferFlow_finalize) + +bool js_register_pipeline_GbufferFlow(se::Object* obj) +{ + auto cls = se::Class::create("GbufferFlow", obj, __jsb_cc_pipeline_RenderFlow_proto, _SE(js_pipeline_GbufferFlow_constructor)); + + cls->defineStaticFunction("getInitializeInfo", _SE(js_pipeline_GbufferFlow_getInitializeInfo)); + cls->defineFinalizeFunction(_SE(js_cc_pipeline_GbufferFlow_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_pipeline_GbufferFlow_proto = cls->getProto(); + __jsb_cc_pipeline_GbufferFlow_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_pipeline_GbufferStage_proto = nullptr; +se::Class* __jsb_cc_pipeline_GbufferStage_class = nullptr; + +static bool js_pipeline_GbufferStage_getInitializeInfo(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::pipeline::RenderStageInfo& result = cc::pipeline::GbufferStage::getInitializeInfo(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_GbufferStage_getInitializeInfo : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_GbufferStage_getInitializeInfo) + +SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_GbufferStage_finalize) + +static bool js_pipeline_GbufferStage_constructor(se::State& s) // constructor.c +{ + cc::pipeline::GbufferStage* cobj = JSB_ALLOC(cc::pipeline::GbufferStage); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_pipeline_GbufferStage_constructor, __jsb_cc_pipeline_GbufferStage_class, js_cc_pipeline_GbufferStage_finalize) + + + +extern se::Object* __jsb_cc_pipeline_RenderStage_proto; + +static bool js_cc_pipeline_GbufferStage_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::pipeline::GbufferStage* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_pipeline_GbufferStage_finalize) + +bool js_register_pipeline_GbufferStage(se::Object* obj) +{ + auto cls = se::Class::create("GbufferStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_GbufferStage_constructor)); + + cls->defineStaticFunction("getInitializeInfo", _SE(js_pipeline_GbufferStage_getInitializeInfo)); + cls->defineFinalizeFunction(_SE(js_cc_pipeline_GbufferStage_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_pipeline_GbufferStage_proto = cls->getProto(); + __jsb_cc_pipeline_GbufferStage_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_pipeline_LightingFlow_proto = nullptr; +se::Class* __jsb_cc_pipeline_LightingFlow_class = nullptr; + +static bool js_pipeline_LightingFlow_getInitializeInfo(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::pipeline::RenderFlowInfo& result = cc::pipeline::LightingFlow::getInitializeInfo(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_LightingFlow_getInitializeInfo : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_LightingFlow_getInitializeInfo) + +SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_LightingFlow_finalize) + +static bool js_pipeline_LightingFlow_constructor(se::State& s) // constructor.c +{ + cc::pipeline::LightingFlow* cobj = JSB_ALLOC(cc::pipeline::LightingFlow); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_pipeline_LightingFlow_constructor, __jsb_cc_pipeline_LightingFlow_class, js_cc_pipeline_LightingFlow_finalize) + + + +extern se::Object* __jsb_cc_pipeline_RenderFlow_proto; + +static bool js_cc_pipeline_LightingFlow_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::pipeline::LightingFlow* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_pipeline_LightingFlow_finalize) + +bool js_register_pipeline_LightingFlow(se::Object* obj) +{ + auto cls = se::Class::create("LightingFlow", obj, __jsb_cc_pipeline_RenderFlow_proto, _SE(js_pipeline_LightingFlow_constructor)); + + cls->defineStaticFunction("getInitializeInfo", _SE(js_pipeline_LightingFlow_getInitializeInfo)); + cls->defineFinalizeFunction(_SE(js_cc_pipeline_LightingFlow_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_pipeline_LightingFlow_proto = cls->getProto(); + __jsb_cc_pipeline_LightingFlow_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_pipeline_LightingStage_proto = nullptr; +se::Class* __jsb_cc_pipeline_LightingStage_class = nullptr; + +static bool js_pipeline_LightingStage_getInitializeInfo(se::State& s) +{ + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 0) { + const cc::pipeline::RenderStageInfo& result = cc::pipeline::LightingStage::getInitializeInfo(); + ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); + SE_PRECONDITION2(ok, false, "js_pipeline_LightingStage_getInitializeInfo : Error processing arguments"); + SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0); + return false; +} +SE_BIND_FUNC(js_pipeline_LightingStage_getInitializeInfo) + +SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_LightingStage_finalize) + +static bool js_pipeline_LightingStage_constructor(se::State& s) // constructor.c +{ + cc::pipeline::LightingStage* cobj = JSB_ALLOC(cc::pipeline::LightingStage); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_pipeline_LightingStage_constructor, __jsb_cc_pipeline_LightingStage_class, js_cc_pipeline_LightingStage_finalize) + + + +extern se::Object* __jsb_cc_pipeline_RenderStage_proto; + +static bool js_cc_pipeline_LightingStage_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::pipeline::LightingStage* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_pipeline_LightingStage_finalize) + +bool js_register_pipeline_LightingStage(se::Object* obj) +{ + auto cls = se::Class::create("LightingStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_LightingStage_constructor)); + + cls->defineStaticFunction("getInitializeInfo", _SE(js_pipeline_LightingStage_getInitializeInfo)); + cls->defineFinalizeFunction(_SE(js_cc_pipeline_LightingStage_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_pipeline_LightingStage_proto = cls->getProto(); + __jsb_cc_pipeline_LightingStage_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} +se::Object* __jsb_cc_pipeline_PostprocessStage_proto = nullptr; +se::Class* __jsb_cc_pipeline_PostprocessStage_class = nullptr; + +SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_PostprocessStage_finalize) + +static bool js_pipeline_PostprocessStage_constructor(se::State& s) // constructor.c +{ + cc::pipeline::PostprocessStage* cobj = JSB_ALLOC(cc::pipeline::PostprocessStage); + s.thisObject()->setPrivateData(cobj); + se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); + return true; +} +SE_BIND_CTOR(js_pipeline_PostprocessStage_constructor, __jsb_cc_pipeline_PostprocessStage_class, js_cc_pipeline_PostprocessStage_finalize) + + + +extern se::Object* __jsb_cc_pipeline_RenderStage_proto; + +static bool js_cc_pipeline_PostprocessStage_finalize(se::State& s) +{ + auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); + if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) + { + se::NonRefNativePtrCreatedByCtorMap::erase(iter); + cc::pipeline::PostprocessStage* cobj = SE_THIS_OBJECT(s); + JSB_FREE(cobj); + } + return true; +} +SE_BIND_FINALIZE_FUNC(js_cc_pipeline_PostprocessStage_finalize) + +bool js_register_pipeline_PostprocessStage(se::Object* obj) +{ + auto cls = se::Class::create("PostprocessStage", obj, __jsb_cc_pipeline_RenderStage_proto, _SE(js_pipeline_PostprocessStage_constructor)); + + cls->defineFinalizeFunction(_SE(js_cc_pipeline_PostprocessStage_finalize)); + cls->install(); + JSBClassType::registerClass(cls); + + __jsb_cc_pipeline_PostprocessStage_proto = cls->getProto(); + __jsb_cc_pipeline_PostprocessStage_class = cls; + + se::ScriptEngine::getInstance()->clearException(); + return true; +} bool register_all_pipeline(se::Object* obj) { // Get the ns @@ -3395,21 +3753,27 @@ bool register_all_pipeline(se::Object* obj) } se::Object* ns = nsVal.toObject(); - js_register_pipeline_RenderQueueDesc(ns); - js_register_pipeline_RenderFlow(ns); - js_register_pipeline_PassView(ns); - js_register_pipeline_RenderStageInfo(ns); - js_register_pipeline_RenderPipeline(ns); - js_register_pipeline_ForwardPipeline(ns); - js_register_pipeline_RenderPipelineInfo(ns); - js_register_pipeline_Light(ns); js_register_pipeline_RenderStage(ns); + js_register_pipeline_PostprocessStage(ns); js_register_pipeline_ForwardStage(ns); - js_register_pipeline_ShadowStage(ns); - js_register_pipeline_RenderFlowInfo(ns); - js_register_pipeline_ForwardFlow(ns); + js_register_pipeline_GbufferStage(ns); js_register_pipeline_InstancedBuffer(ns); + js_register_pipeline_RenderStageInfo(ns); + js_register_pipeline_LightingStage(ns); + js_register_pipeline_ShadowStage(ns); + js_register_pipeline_RenderFlow(ns); + js_register_pipeline_ForwardFlow(ns); + js_register_pipeline_RenderPipeline(ns); + js_register_pipeline_DeferredPipeline(ns); + js_register_pipeline_GbufferFlow(ns); + js_register_pipeline_PassView(ns); + js_register_pipeline_ForwardPipeline(ns); + js_register_pipeline_Light(ns); + js_register_pipeline_RenderFlowInfo(ns); js_register_pipeline_RenderWindow(ns); + js_register_pipeline_RenderQueueDesc(ns); + js_register_pipeline_RenderPipelineInfo(ns); + js_register_pipeline_LightingFlow(ns); js_register_pipeline_ShadowFlow(ns); return true; } diff --git a/native/cocos/bindings/auto/jsb_pipeline_auto.h b/native/cocos/bindings/auto/jsb_pipeline_auto.h index ffdff6555d..b1eec35d2c 100644 --- a/native/cocos/bindings/auto/jsb_pipeline_auto.h +++ b/native/cocos/bindings/auto/jsb_pipeline_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include @@ -15,6 +40,12 @@ #include "cocos/renderer/pipeline/Define.h" #include "cocos/renderer/pipeline/helper/SharedMemory.h" #include "cocos/renderer/pipeline/InstancedBuffer.h" +#include "cocos/renderer/pipeline/deferred/DeferredPipeline.h" +#include "cocos/renderer/pipeline/deferred/GbufferFlow.h" +#include "cocos/renderer/pipeline/deferred/GbufferStage.h" +#include "cocos/renderer/pipeline/deferred/LightingFlow.h" +#include "cocos/renderer/pipeline/deferred/LightingStage.h" +#include "cocos/renderer/pipeline/deferred/PostprocessStage.h" extern se::Object* __jsb_cc_pipeline_RenderQueueDesc_proto; extern se::Class* __jsb_cc_pipeline_RenderQueueDesc_class; @@ -88,8 +119,11 @@ bool register_all_pipeline(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderPipeline); SE_DECLARE_FUNC(js_pipeline_RenderPipeline_activate); SE_DECLARE_FUNC(js_pipeline_RenderPipeline_destroy); +SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getDevice); SE_DECLARE_FUNC(js_pipeline_RenderPipeline_initialize); SE_DECLARE_FUNC(js_pipeline_RenderPipeline_render); +SE_DECLARE_FUNC(js_pipeline_RenderPipeline_resize); +SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setPipelineSharedSceneData); SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setValue); SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getInstance); @@ -100,11 +134,6 @@ bool js_register_cc_pipeline_ForwardPipeline(se::Object* obj); bool register_all_pipeline(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardPipeline); -SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_getSphere); -SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_setAmbient); -SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_setFog); -SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_setShadows); -SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_setSkybox); SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_ForwardPipeline); extern se::Object* __jsb_cc_pipeline_RenderFlowInfo_proto; @@ -156,6 +185,7 @@ bool register_all_pipeline(se::Object* obj); JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderStage); SE_DECLARE_FUNC(js_pipeline_RenderStage_activate); +SE_DECLARE_FUNC(js_pipeline_RenderStage_getFlow); SE_DECLARE_FUNC(js_pipeline_RenderStage_getTag); SE_DECLARE_FUNC(js_pipeline_RenderStage_initialize); @@ -203,3 +233,61 @@ SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_setDynamicOffset); SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_get); SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_InstancedBuffer); +extern se::Object* __jsb_cc_pipeline_DeferredPipeline_proto; +extern se::Class* __jsb_cc_pipeline_DeferredPipeline_class; + +bool js_register_cc_pipeline_DeferredPipeline(se::Object* obj); +bool register_all_pipeline(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::pipeline::DeferredPipeline); +SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_DeferredPipeline); + +extern se::Object* __jsb_cc_pipeline_GbufferFlow_proto; +extern se::Class* __jsb_cc_pipeline_GbufferFlow_class; + +bool js_register_cc_pipeline_GbufferFlow(se::Object* obj); +bool register_all_pipeline(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GbufferFlow); +SE_DECLARE_FUNC(js_pipeline_GbufferFlow_getInitializeInfo); +SE_DECLARE_FUNC(js_pipeline_GbufferFlow_GbufferFlow); + +extern se::Object* __jsb_cc_pipeline_GbufferStage_proto; +extern se::Class* __jsb_cc_pipeline_GbufferStage_class; + +bool js_register_cc_pipeline_GbufferStage(se::Object* obj); +bool register_all_pipeline(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GbufferStage); +SE_DECLARE_FUNC(js_pipeline_GbufferStage_getInitializeInfo); +SE_DECLARE_FUNC(js_pipeline_GbufferStage_GbufferStage); + +extern se::Object* __jsb_cc_pipeline_LightingFlow_proto; +extern se::Class* __jsb_cc_pipeline_LightingFlow_class; + +bool js_register_cc_pipeline_LightingFlow(se::Object* obj); +bool register_all_pipeline(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::pipeline::LightingFlow); +SE_DECLARE_FUNC(js_pipeline_LightingFlow_getInitializeInfo); +SE_DECLARE_FUNC(js_pipeline_LightingFlow_LightingFlow); + +extern se::Object* __jsb_cc_pipeline_LightingStage_proto; +extern se::Class* __jsb_cc_pipeline_LightingStage_class; + +bool js_register_cc_pipeline_LightingStage(se::Object* obj); +bool register_all_pipeline(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::pipeline::LightingStage); +SE_DECLARE_FUNC(js_pipeline_LightingStage_getInitializeInfo); +SE_DECLARE_FUNC(js_pipeline_LightingStage_LightingStage); + +extern se::Object* __jsb_cc_pipeline_PostprocessStage_proto; +extern se::Class* __jsb_cc_pipeline_PostprocessStage_class; + +bool js_register_cc_pipeline_PostprocessStage(se::Object* obj); +bool register_all_pipeline(se::Object* obj); + +JSB_REGISTER_OBJECT_TYPE(cc::pipeline::PostprocessStage); +SE_DECLARE_FUNC(js_pipeline_PostprocessStage_PostprocessStage); + diff --git a/native/cocos/bindings/auto/jsb_spine_auto.cpp b/native/cocos/bindings/auto/jsb_spine_auto.cpp index 80c1f01736..b0dd676baf 100644 --- a/native/cocos/bindings/auto/jsb_spine_auto.cpp +++ b/native/cocos/bindings/auto/jsb_spine_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_spine_auto.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" @@ -132,7 +157,6 @@ bool js_register_spine_Animation(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_TrackEntry_proto = nullptr; se::Class* __jsb_spine_TrackEntry_class = nullptr; @@ -948,7 +972,6 @@ bool js_register_spine_TrackEntry(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_AnimationState_proto = nullptr; se::Class* __jsb_spine_AnimationState_class = nullptr; @@ -1339,7 +1362,6 @@ bool js_register_spine_AnimationState(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_AnimationStateData_proto = nullptr; se::Class* __jsb_spine_AnimationStateData_class = nullptr; @@ -1491,7 +1513,6 @@ bool js_register_spine_AnimationStateData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Attachment_proto = nullptr; se::Class* __jsb_spine_Attachment_class = nullptr; @@ -1603,7 +1624,6 @@ bool js_register_spine_Attachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Timeline_proto = nullptr; se::Class* __jsb_spine_Timeline_class = nullptr; @@ -1643,7 +1663,6 @@ bool js_register_spine_Timeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_AttachmentTimeline_proto = nullptr; se::Class* __jsb_spine_AttachmentTimeline_class = nullptr; @@ -1808,7 +1827,6 @@ bool js_register_spine_AttachmentTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Bone_proto = nullptr; se::Class* __jsb_spine_Bone_class = nullptr; @@ -3046,7 +3064,6 @@ bool js_register_spine_Bone(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_BoneData_proto = nullptr; se::Class* __jsb_spine_BoneData_class = nullptr; @@ -3526,7 +3543,6 @@ bool js_register_spine_BoneData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_VertexAttachment_proto = nullptr; se::Class* __jsb_spine_VertexAttachment_class = nullptr; @@ -3687,7 +3703,6 @@ bool js_register_spine_VertexAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_BoundingBoxAttachment_proto = nullptr; se::Class* __jsb_spine_BoundingBoxAttachment_class = nullptr; @@ -3728,7 +3743,6 @@ bool js_register_spine_BoundingBoxAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_ClippingAttachment_proto = nullptr; se::Class* __jsb_spine_ClippingAttachment_class = nullptr; @@ -3809,7 +3823,6 @@ bool js_register_spine_ClippingAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Color_proto = nullptr; se::Class* __jsb_spine_Color_class = nullptr; @@ -3961,7 +3974,6 @@ bool js_register_spine_Color(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_CurveTimeline_proto = nullptr; se::Class* __jsb_spine_CurveTimeline_class = nullptr; @@ -4138,7 +4150,6 @@ bool js_register_spine_CurveTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_ColorTimeline_proto = nullptr; se::Class* __jsb_spine_ColorTimeline_class = nullptr; @@ -4269,7 +4280,6 @@ bool js_register_spine_ColorTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_ConstraintData_proto = nullptr; se::Class* __jsb_spine_ConstraintData_class = nullptr; @@ -4389,7 +4399,6 @@ bool js_register_spine_ConstraintData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_DeformTimeline_proto = nullptr; se::Class* __jsb_spine_DeformTimeline_class = nullptr; @@ -4530,7 +4539,6 @@ bool js_register_spine_DeformTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_DrawOrderTimeline_proto = nullptr; se::Class* __jsb_spine_DrawOrderTimeline_class = nullptr; @@ -4611,7 +4619,6 @@ bool js_register_spine_DrawOrderTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Event_proto = nullptr; se::Class* __jsb_spine_Event_class = nullptr; @@ -4871,7 +4878,6 @@ bool js_register_spine_Event(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_EventData_proto = nullptr; se::Class* __jsb_spine_EventData_class = nullptr; @@ -5151,7 +5157,6 @@ bool js_register_spine_EventData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_EventTimeline_proto = nullptr; se::Class* __jsb_spine_EventTimeline_class = nullptr; @@ -5274,7 +5279,6 @@ bool js_register_spine_EventTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_IkConstraint_proto = nullptr; se::Class* __jsb_spine_IkConstraint_class = nullptr; @@ -5650,7 +5654,6 @@ bool js_register_spine_IkConstraint(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_IkConstraintData_proto = nullptr; se::Class* __jsb_spine_IkConstraintData_class = nullptr; @@ -5971,7 +5974,6 @@ bool js_register_spine_IkConstraintData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_IkConstraintTimeline_proto = nullptr; se::Class* __jsb_spine_IkConstraintTimeline_class = nullptr; @@ -6044,7 +6046,6 @@ bool js_register_spine_IkConstraintTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_MeshAttachment_proto = nullptr; se::Class* __jsb_spine_MeshAttachment_class = nullptr; @@ -6901,7 +6902,6 @@ bool js_register_spine_MeshAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PathAttachment_proto = nullptr; se::Class* __jsb_spine_PathAttachment_class = nullptr; @@ -7042,7 +7042,6 @@ bool js_register_spine_PathAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PathConstraint_proto = nullptr; se::Class* __jsb_spine_PathConstraint_class = nullptr; @@ -7394,7 +7393,6 @@ bool js_register_spine_PathConstraint(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PathConstraintData_proto = nullptr; se::Class* __jsb_spine_PathConstraintData_class = nullptr; @@ -7795,7 +7793,6 @@ bool js_register_spine_PathConstraintData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PathConstraintMixTimeline_proto = nullptr; se::Class* __jsb_spine_PathConstraintMixTimeline_class = nullptr; @@ -7836,7 +7833,6 @@ bool js_register_spine_PathConstraintMixTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PathConstraintPositionTimeline_proto = nullptr; se::Class* __jsb_spine_PathConstraintPositionTimeline_class = nullptr; @@ -7901,7 +7897,6 @@ bool js_register_spine_PathConstraintPositionTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PathConstraintSpacingTimeline_proto = nullptr; se::Class* __jsb_spine_PathConstraintSpacingTimeline_class = nullptr; @@ -7942,7 +7937,6 @@ bool js_register_spine_PathConstraintSpacingTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_PointAttachment_proto = nullptr; se::Class* __jsb_spine_PointAttachment_class = nullptr; @@ -8103,7 +8097,6 @@ bool js_register_spine_PointAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_RegionAttachment_proto = nullptr; se::Class* __jsb_spine_RegionAttachment_class = nullptr; @@ -8808,7 +8801,6 @@ bool js_register_spine_RegionAttachment(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_RotateTimeline_proto = nullptr; se::Class* __jsb_spine_RotateTimeline_class = nullptr; @@ -8933,7 +8925,6 @@ bool js_register_spine_RotateTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_TranslateTimeline_proto = nullptr; se::Class* __jsb_spine_TranslateTimeline_class = nullptr; @@ -9000,7 +8991,6 @@ bool js_register_spine_TranslateTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_ScaleTimeline_proto = nullptr; se::Class* __jsb_spine_ScaleTimeline_class = nullptr; @@ -9041,7 +9031,6 @@ bool js_register_spine_ScaleTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_ShearTimeline_proto = nullptr; se::Class* __jsb_spine_ShearTimeline_class = nullptr; @@ -9082,7 +9071,6 @@ bool js_register_spine_ShearTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Skeleton_proto = nullptr; se::Class* __jsb_spine_Skeleton_class = nullptr; @@ -9925,7 +9913,6 @@ bool js_register_spine_Skeleton(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonBounds_proto = nullptr; se::Class* __jsb_spine_SkeletonBounds_class = nullptr; @@ -10174,7 +10161,6 @@ bool js_register_spine_SkeletonBounds(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Polygon_proto = nullptr; se::Class* __jsb_spine_Polygon_class = nullptr; @@ -10194,7 +10180,6 @@ bool js_register_spine_Polygon(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonData_proto = nullptr; se::Class* __jsb_spine_SkeletonData_class = nullptr; @@ -11067,7 +11052,6 @@ bool js_register_spine_SkeletonData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Skin_proto = nullptr; se::Class* __jsb_spine_Skin_class = nullptr; @@ -11258,7 +11242,6 @@ bool js_register_spine_Skin(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_Slot_proto = nullptr; se::Class* __jsb_spine_Slot_class = nullptr; @@ -11514,7 +11497,6 @@ bool js_register_spine_Slot(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SlotData_proto = nullptr; se::Class* __jsb_spine_SlotData_class = nullptr; @@ -11754,7 +11736,6 @@ bool js_register_spine_SlotData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_TransformConstraint_proto = nullptr; se::Class* __jsb_spine_TransformConstraint_class = nullptr; @@ -12106,7 +12087,6 @@ bool js_register_spine_TransformConstraint(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_TransformConstraintData_proto = nullptr; se::Class* __jsb_spine_TransformConstraintData_class = nullptr; @@ -12407,7 +12387,6 @@ bool js_register_spine_TransformConstraintData(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_TransformConstraintTimeline_proto = nullptr; se::Class* __jsb_spine_TransformConstraintTimeline_class = nullptr; @@ -12478,7 +12457,6 @@ bool js_register_spine_TransformConstraintTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_TwoColorTimeline_proto = nullptr; se::Class* __jsb_spine_TwoColorTimeline_class = nullptr; @@ -12595,7 +12573,6 @@ bool js_register_spine_TwoColorTimeline(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_VertexEffect_proto = nullptr; se::Class* __jsb_spine_VertexEffect_class = nullptr; @@ -12615,7 +12592,6 @@ bool js_register_spine_VertexEffect(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_JitterVertexEffect_proto = nullptr; se::Class* __jsb_spine_JitterVertexEffect_class = nullptr; @@ -12716,7 +12692,6 @@ bool js_register_spine_JitterVertexEffect(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SwirlVertexEffect_proto = nullptr; se::Class* __jsb_spine_SwirlVertexEffect_class = nullptr; @@ -12977,7 +12952,6 @@ bool js_register_spine_SwirlVertexEffect(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_VertexEffectDelegate_proto = nullptr; se::Class* __jsb_spine_VertexEffectDelegate_class = nullptr; @@ -13187,7 +13161,6 @@ bool js_register_spine_VertexEffectDelegate(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonRenderer_proto = nullptr; se::Class* __jsb_spine_SkeletonRenderer_class = nullptr; @@ -14143,7 +14116,6 @@ bool js_register_spine_SkeletonRenderer(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonAnimation_proto = nullptr; se::Class* __jsb_spine_SkeletonAnimation_class = nullptr; @@ -15222,7 +15194,6 @@ bool js_register_spine_SkeletonAnimation(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonCacheAnimation_proto = nullptr; se::Class* __jsb_spine_SkeletonCacheAnimation_class = nullptr; @@ -16060,7 +16031,6 @@ bool js_register_spine_SkeletonCacheAnimation(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonCacheMgr_proto = nullptr; se::Class* __jsb_spine_SkeletonCacheMgr_class = nullptr; @@ -16168,7 +16138,6 @@ bool js_register_spine_SkeletonCacheMgr(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - se::Object* __jsb_spine_SkeletonDataMgr_proto = nullptr; se::Class* __jsb_spine_SkeletonDataMgr_class = nullptr; @@ -16280,7 +16249,6 @@ bool js_register_spine_SkeletonDataMgr(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_spine(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_spine_auto.h b/native/cocos/bindings/auto/jsb_spine_auto.h index 43191dea27..e757ada5b9 100644 --- a/native/cocos/bindings/auto/jsb_spine_auto.h +++ b/native/cocos/bindings/auto/jsb_spine_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #include diff --git a/native/cocos/bindings/auto/jsb_video_auto.cpp b/native/cocos/bindings/auto/jsb_video_auto.cpp index 73f9ec939a..0b430ba103 100644 --- a/native/cocos/bindings/auto/jsb_video_auto.cpp +++ b/native/cocos/bindings/auto/jsb_video_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_video_auto.h" #if (USE_VIDEO > 0) #include "cocos/bindings/manual/jsb_conversions.h" @@ -363,7 +388,6 @@ bool js_register_video_VideoPlayer(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_video(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_video_auto.h b/native/cocos/bindings/auto/jsb_video_auto.h index 7409e55cb1..14f39b0034 100644 --- a/native/cocos/bindings/auto/jsb_video_auto.h +++ b/native/cocos/bindings/auto/jsb_video_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #if (USE_VIDEO > 0) diff --git a/native/cocos/bindings/auto/jsb_vk_auto.cpp b/native/cocos/bindings/auto/jsb_vk_auto.cpp deleted file mode 100644 index 9d723e393f..0000000000 --- a/native/cocos/bindings/auto/jsb_vk_auto.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "cocos/bindings/auto/jsb_vk_auto.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/bindings/manual/jsb_global.h" -#include "renderer/gfx-vulkan/GFXVulkan.h" - -#ifndef JSB_ALLOC -#define JSB_ALLOC(kls, ...) new (std::nothrow) kls(__VA_ARGS__) -#endif - -#ifndef JSB_FREE -#define JSB_FREE(ptr) delete ptr -#endif -se::Object* __jsb_cc_gfx_CCVKDevice_proto = nullptr; -se::Class* __jsb_cc_gfx_CCVKDevice_class = nullptr; - -static bool js_vk_CCVKDevice_checkExtension(se::State& s) -{ - cc::gfx::CCVKDevice* cobj = SE_THIS_OBJECT(s); - SE_PRECONDITION2(cobj, false, "js_vk_CCVKDevice_checkExtension : Invalid Native Object"); - const auto& args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; - if (argc == 1) { - HolderType arg0 = {}; - ok &= sevalue_to_native(args[0], &arg0, s.thisObject()); - SE_PRECONDITION2(ok, false, "js_vk_CCVKDevice_checkExtension : Error processing arguments"); - bool result = cobj->checkExtension(arg0.value()); - ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/); - SE_PRECONDITION2(ok, false, "js_vk_CCVKDevice_checkExtension : Error processing arguments"); - SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval()); - return true; - } - SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); - return false; -} -SE_BIND_FUNC(js_vk_CCVKDevice_checkExtension) - -SE_DECLARE_FINALIZE_FUNC(js_cc_gfx_CCVKDevice_finalize) - -static bool js_vk_CCVKDevice_constructor(se::State& s) // constructor.c -{ - cc::gfx::CCVKDevice* cobj = JSB_ALLOC(cc::gfx::CCVKDevice); - s.thisObject()->setPrivateData(cobj); - se::NonRefNativePtrCreatedByCtorMap::emplace(cobj); - return true; -} -SE_BIND_CTOR(js_vk_CCVKDevice_constructor, __jsb_cc_gfx_CCVKDevice_class, js_cc_gfx_CCVKDevice_finalize) - - - -extern se::Object* __jsb_cc_gfx_Device_proto; - -static bool js_cc_gfx_CCVKDevice_finalize(se::State& s) -{ - auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT(s)); - if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) - { - se::NonRefNativePtrCreatedByCtorMap::erase(iter); - cc::gfx::CCVKDevice* cobj = SE_THIS_OBJECT(s); - JSB_FREE(cobj); - } - return true; -} -SE_BIND_FINALIZE_FUNC(js_cc_gfx_CCVKDevice_finalize) - -bool js_register_vk_CCVKDevice(se::Object* obj) -{ - auto cls = se::Class::create("CCVKDevice", obj, __jsb_cc_gfx_Device_proto, _SE(js_vk_CCVKDevice_constructor)); - - cls->defineFunction("checkExtension", _SE(js_vk_CCVKDevice_checkExtension)); - cls->defineFinalizeFunction(_SE(js_cc_gfx_CCVKDevice_finalize)); - cls->install(); - JSBClassType::registerClass(cls); - - __jsb_cc_gfx_CCVKDevice_proto = cls->getProto(); - __jsb_cc_gfx_CCVKDevice_class = cls; - - se::ScriptEngine::getInstance()->clearException(); - return true; -} - -bool register_all_vk(se::Object* obj) -{ - // Get the ns - se::Value nsVal; - if (!obj->getProperty("gfx", &nsVal)) - { - se::HandleObject jsobj(se::Object::createPlainObject()); - nsVal.setObject(jsobj); - obj->setProperty("gfx", nsVal); - } - se::Object* ns = nsVal.toObject(); - - js_register_vk_CCVKDevice(ns); - return true; -} - diff --git a/native/cocos/bindings/auto/jsb_vk_auto.h b/native/cocos/bindings/auto/jsb_vk_auto.h deleted file mode 100644 index c85af8e604..0000000000 --- a/native/cocos/bindings/auto/jsb_vk_auto.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -#include "base/Config.h" -#include -#include "cocos/bindings/jswrapper/SeApi.h" -#include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/renderer/gfx-vulkan/GFXVulkan.h" - -extern se::Object* __jsb_cc_gfx_CCVKDevice_proto; -extern se::Class* __jsb_cc_gfx_CCVKDevice_class; - -bool js_register_cc_gfx_CCVKDevice(se::Object* obj); -bool register_all_vk(se::Object* obj); - -JSB_REGISTER_OBJECT_TYPE(cc::gfx::CCVKDevice); -SE_DECLARE_FUNC(js_vk_CCVKDevice_checkExtension); -SE_DECLARE_FUNC(js_vk_CCVKDevice_CCVKDevice); - diff --git a/native/cocos/bindings/auto/jsb_webview_auto.cpp b/native/cocos/bindings/auto/jsb_webview_auto.cpp index 2e1eca1ece..b09c0a65af 100644 --- a/native/cocos/bindings/auto/jsb_webview_auto.cpp +++ b/native/cocos/bindings/auto/jsb_webview_auto.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_webview_auto.h" #if (USE_WEBVIEW > 0) && (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_MAC_IOS) #include "cocos/bindings/manual/jsb_conversions.h" @@ -699,7 +724,6 @@ bool js_register_webview_WebView(se::Object* obj) se::ScriptEngine::getInstance()->clearException(); return true; } - bool register_all_webview(se::Object* obj) { // Get the ns diff --git a/native/cocos/bindings/auto/jsb_webview_auto.h b/native/cocos/bindings/auto/jsb_webview_auto.h index 70d1eff7ce..586a70ad04 100644 --- a/native/cocos/bindings/auto/jsb_webview_auto.h +++ b/native/cocos/bindings/auto/jsb_webview_auto.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "base/Config.h" #if (USE_WEBVIEW > 0) && (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_MAC_IOS) diff --git a/native/cocos/bindings/dop/BufferAllocator.cpp b/native/cocos/bindings/dop/BufferAllocator.cpp index 1084833bb9..845787fa18 100644 --- a/native/cocos/bindings/dop/BufferAllocator.cpp +++ b/native/cocos/bindings/dop/BufferAllocator.cpp @@ -1,14 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "BufferAllocator.h" #include "base/Log.h" #include "base/memory/Memory.h" namespace se { -cc::map BufferAllocator::_pools; +cc::vector BufferAllocator::pools(BUFFER_ALLOCATOR_SIZE); BufferAllocator::BufferAllocator(PoolType type) : _type(type) { - BufferAllocator::_pools[_type] = this; + if (IS_BUFFER_ALLOCATOR_TYPE(type)) { + BufferAllocator::pools[GET_ARRAY_POOL_ID(type)] = this; + } } BufferAllocator::~BufferAllocator() { @@ -16,7 +43,7 @@ BufferAllocator::~BufferAllocator() { buffer.second->decRef(); } _buffers.clear(); - BufferAllocator::_pools.erase(_type); + _caches.clear(); } Object *BufferAllocator::alloc(uint index, uint bytes) { @@ -28,6 +55,11 @@ Object *BufferAllocator::alloc(uint index, uint bytes) { obj->incRef(); _buffers[index] = obj; + uint8_t *ret = nullptr; + size_t len; + obj->getArrayBufferData(static_cast(&ret), &len); + _caches[index] = ret; + return obj; } @@ -37,6 +69,10 @@ void BufferAllocator::free(uint index) { oldObj->decRef(); _buffers.erase(index); } + + if (_caches.count(index)) { + _caches.erase(index); + } } } // namespace se diff --git a/native/cocos/bindings/dop/BufferAllocator.h b/native/cocos/bindings/dop/BufferAllocator.h index d0b9e8584f..8393d54a03 100644 --- a/native/cocos/bindings/dop/BufferAllocator.h +++ b/native/cocos/bindings/dop/BufferAllocator.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once #include "PoolType.h" @@ -12,42 +37,58 @@ namespace se { class CC_DLL BufferAllocator final : public cc::Object { public: template - CC_INLINE static T *getBuffer(PoolType type, uint index) { - uint size = 0; - return BufferAllocator::getBuffer(type, index, &size); + static T *getBuffer(PoolType type, uint index) { + index &= BUFFER_MASK; + const auto p = GET_ARRAY_POOL_ID(type); + +#ifdef CC_DEBUG + CCASSERT(BufferAllocator::pools[p] != nullptr, "BufferPool: Invalid buffer pool type"); +#endif + + auto *const pool = BufferAllocator::pools[p]; + +#ifdef CC_DEBUG + CCASSERT(pool->_caches.count(index) != 0, "BufferPool: Invalid buffer pool index"); +#endif + + return reinterpret_cast(pool->_caches[index]); } template static T *getBuffer(PoolType type, uint index, uint *size) { - index &= _bufferMask; - if (BufferAllocator::_pools.count(type) != 0) { - const auto pool = BufferAllocator::_pools[type]; - if (pool->_buffers.count(index) != 0) { - T *ret = nullptr; - size_t len; - pool->_buffers[index]->getArrayBufferData((uint8_t **)&ret, &len); - *size = (uint)len; - return ret; - } else { - return nullptr; - } - } else { - return nullptr; - } + index &= BUFFER_MASK; + const auto p = GET_ARRAY_POOL_ID(type); + +#ifdef CC_DEBUG + CCASSERT(BufferAllocator::pools[p] != nullptr, "BufferPool: Invalid buffer pool type"); +#endif + + auto *const pool = BufferAllocator::pools[p]; + +#ifdef CC_DEBUG + CCASSERT(pool->_buffers.count(index) != 0, "BufferPool: Invalid buffer pool index"); +#endif + + T * ret = nullptr; + size_t len; + pool->_buffers[index]->getArrayBufferData(static_cast(&ret), &len); + *size = static_cast(len); + return ret; } - BufferAllocator(PoolType type); - ~BufferAllocator(); + explicit BufferAllocator(PoolType type); + ~BufferAllocator() override; Object *alloc(uint index, uint bytes); - void free(uint index); + void free(uint index); private: - static cc::map _pools; - static constexpr uint _bufferMask = ~(1 << 30); + static cc::vector pools; + static constexpr uint BUFFER_MASK = ~(1 << 30); - cc::map _buffers; - PoolType _type = PoolType::UNKNOWN; + cc::map _buffers; + cc::map _caches; + PoolType _type = PoolType::UNKNOWN; }; } // namespace se diff --git a/native/cocos/bindings/dop/BufferPool.cpp b/native/cocos/bindings/dop/BufferPool.cpp index 79e10248ae..c579543d89 100644 --- a/native/cocos/bindings/dop/BufferPool.cpp +++ b/native/cocos/bindings/dop/BufferPool.cpp @@ -1,62 +1,61 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "BufferPool.h" #include "base/Macros.h" #include "base/memory/Memory.h" -using namespace se; +namespace se { -cc::map BufferPool::_poolMap; +cc::vector BufferPool::poolMap(BUFFER_POOL_SIZE); BufferPool::BufferPool(PoolType type, uint entryBits, uint bytesPerEntry) : _allocator(type), _entryBits(entryBits), _bytesPerEntry(bytesPerEntry), _type(type) { - CCASSERT(BufferPool::_poolMap.count(type) == 0, "The type of pool is already exist"); - _entriesPerChunk = 1 << entryBits; - _entryMask = _entriesPerChunk - 1; - _chunkMask = 0xffffffff & ~(_entryMask | _poolFlag); + _entryMask = _entriesPerChunk - 1; + _chunkMask = 0xffffffff & ~(_entryMask | POOL_FLAG); _bytesPerChunk = _bytesPerEntry * _entriesPerChunk; - BufferPool::_poolMap[type] = this; + BufferPool::poolMap[GET_BUFFER_POOL_ID(type)] = this; } -BufferPool::~BufferPool() { - BufferPool::_poolMap.erase(_type); -} +BufferPool::~BufferPool() = default; Object *BufferPool::allocateNewChunk() { - Object *jsObj = _allocator.alloc((uint)_chunks.size(), _bytesPerChunk); + Object *jsObj = _allocator.alloc(static_cast(_chunks.size()), _bytesPerChunk); uint8_t *realPtr = nullptr; - size_t len = 0; + size_t len = 0; jsObj->getArrayBufferData(&realPtr, &len); _chunks.push_back(realPtr); return jsObj; } + +} // namespace se diff --git a/native/cocos/bindings/dop/BufferPool.h b/native/cocos/bindings/dop/BufferPool.h index ee6e60e093..86b331d5e2 100644 --- a/native/cocos/bindings/dop/BufferPool.h +++ b/native/cocos/bindings/dop/BufferPool.h @@ -1,31 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #pragma once -#include "PoolType.h" #include "BufferAllocator.h" +#include "PoolType.h" #include "cocos/base/Macros.h" #include "cocos/base/Object.h" #include "cocos/base/TypeDef.h" @@ -38,11 +39,11 @@ class CC_DLL BufferPool final : public cc::Object { public: using Chunk = uint8_t *; - CC_INLINE static const cc::map &getPoolMap() { return BufferPool::_poolMap; } - CC_INLINE static const uint getPoolFlag() { return _poolFlag; } + CC_INLINE static const cc::vector &getPoolMap() { return BufferPool::poolMap; } + CC_INLINE static uint getPoolFlag() { return POOL_FLAG; } BufferPool(PoolType type, uint entryBits, uint bytesPerEntry); - ~BufferPool(); + ~BufferPool() override; template T *getTypedObject(uint id) const { @@ -55,18 +56,18 @@ public: Object *allocateNewChunk(); private: - static cc::map _poolMap; - static constexpr uint _poolFlag = 1 << 30; + static cc::vector poolMap; + static constexpr uint POOL_FLAG = 1 << 30; - BufferAllocator _allocator; + BufferAllocator _allocator; cc::vector _chunks; - uint _entryBits = 1 << 8; - uint _chunkMask = 0; - uint _entryMask = 0; - uint _bytesPerChunk = 0; - uint _entriesPerChunk = 0; - uint _bytesPerEntry = 0; - PoolType _type = PoolType::UNKNOWN; + uint _entryBits = 1 << 8; + uint _chunkMask = 0; + uint _entryMask = 0; + uint _bytesPerChunk = 0; + uint _entriesPerChunk = 0; + uint _bytesPerEntry = 0; + PoolType _type = PoolType::UNKNOWN; }; } // namespace se diff --git a/native/cocos/bindings/dop/ObjectPool.cpp b/native/cocos/bindings/dop/ObjectPool.cpp index cf1ee23652..87db199dd8 100644 --- a/native/cocos/bindings/dop/ObjectPool.cpp +++ b/native/cocos/bindings/dop/ObjectPool.cpp @@ -1,45 +1,54 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "ObjectPool.h" #include "base/memory/Memory.h" -using namespace se; - -cc::map ObjectPool::_poolMap; +namespace se { +cc::vector ObjectPool::poolMap(OBJECT_POOL_SIZE); ObjectPool::ObjectPool(PoolType type, Object *jsArr) : _type(type), _jsArr(jsArr) { CCASSERT(jsArr->isArray(), "ObjectPool: It must be initialized with a JavaScript array"); - CCASSERT(ObjectPool::_poolMap.count(type) == 0, "This type of ObjectPool already exists."); _jsArr->incRef(); - _indexMask = 0xffffffff & ~_poolFlag; - ObjectPool::_poolMap.emplace(type, this); + _indexMask = 0xffffffff & ~_poolFlag; + ObjectPool::poolMap[GET_OBJECT_POOL_ID(type)] = this; } ObjectPool::~ObjectPool() { _jsArr->decRef(); - ObjectPool::_poolMap.erase(_type); + _array.clear(); } + +void ObjectPool::bind(uint id, Object *obj) { + if (id >= _array.size()) { + _array.push_back(obj); + } else { + _array[id] = obj; + } +} +} // namespace se diff --git a/native/cocos/bindings/dop/ObjectPool.h b/native/cocos/bindings/dop/ObjectPool.h index 6a850a75bf..b3cb67baef 100644 --- a/native/cocos/bindings/dop/ObjectPool.h +++ b/native/cocos/bindings/dop/ObjectPool.h @@ -1,71 +1,67 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #pragma once -#include "cocos/base/Object.h" -#include "cocos/bindings/jswrapper/Object.h" -#include "cocos/base/memory/StlAlloc.h" -#include "cocos/base/Macros.h" -#include "cocos/base/TypeDef.h" #include "PoolType.h" +#include "cocos/base/Macros.h" +#include "cocos/base/Object.h" +#include "cocos/base/TypeDef.h" +#include "cocos/base/memory/StlAlloc.h" +#include "cocos/bindings/jswrapper/Object.h" namespace se { class CC_DLL ObjectPool final : public cc::Object { public: - CC_INLINE static const cc::map &getPoolMap() { return ObjectPool::_poolMap; } + CC_INLINE static const cc::vector &getPoolMap() { return ObjectPool::poolMap; } ObjectPool(PoolType type, Object *jsArr); - ~ObjectPool(); + ~ObjectPool() override; template Type *getTypedObject(uint id) const { id = _indexMask & id; - bool ok = true; + #ifdef CC_DEBUG - uint len = 0; - ok = _jsArr->getArrayLength(&len); - CCASSERT(ok && id < len, "ObjectPool: Invalid buffer pool entry id"); + CCASSERT(id < _array.size(), "ObjectPool: Invalid buffer pool entry id"); #endif - se::Value jsEntry; - ok = _jsArr->getArrayElement(id, &jsEntry); - if (!ok || !jsEntry.isObject()) { - return nullptr; - } - Type *entry = (Type *)jsEntry.toObject()->getPrivateData(); - return entry; + return static_cast(_array[id]->getPrivateData()); } -private: - static cc::map _poolMap; + void bind(uint id, Object *); - PoolType _type = PoolType::SHADER; - Object *_jsArr = nullptr; - uint _poolFlag = 1 << 29; - uint _indexMask = 0; +private: + static cc::vector poolMap; + + cc::vector _array; + PoolType _type = PoolType::SHADER; + Object * _jsArr = nullptr; + uint _poolFlag = 1 << 29; + uint _indexMask = 0; }; } // namespace se diff --git a/native/cocos/bindings/dop/PoolType.h b/native/cocos/bindings/dop/PoolType.h index 6000a0d720..648c095568 100644 --- a/native/cocos/bindings/dop/PoolType.h +++ b/native/cocos/bindings/dop/PoolType.h @@ -1,6 +1,52 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once namespace se { + +#define CAST_POOL_TYPE(type) static_cast(type) + +#define BUFFER_POOL_BEGIN CAST_POOL_TYPE(se::PoolType::PASS) +#define ARRAY_POOL_BEGIN CAST_POOL_TYPE(se::PoolType::SUB_MODEL_ARRAY) +#define RAW_BUFFER_BEGIN CAST_POOL_TYPE(se::PoolType::RAW_BUFFER) +#define RAW_OBJECT_BEGIN CAST_POOL_TYPE(se::PoolType::RAW_OBJECT) + +#define OBJECTS_SIZE CAST_POOL_TYPE(se::PoolType::FRAMEBUFFER) + 1 +#define BUFFER_POOL_SIZE CAST_POOL_TYPE(se::PoolType::PIPELINE_SHARED_SCENE_DATA) - BUFFER_POOL_BEGIN + 1 +#define ARRAY_POOL_SIZE CAST_POOL_TYPE(se::PoolType::UI_BATCH_ARRAY) - ARRAY_POOL_BEGIN + 1 +#define RAW_BUFFER_SIZE CAST_POOL_TYPE(se::PoolType::RAW_BUFFER) - CAST_POOL_TYPE(se::PoolType::RAW_BUFFER) + 1 +#define RAW_OBJECT_SIZE CAST_POOL_TYPE(se::PoolType::RAW_OBJECT) - CAST_POOL_TYPE(se::PoolType::RAW_OBJECT) + 1 +#define BUFFER_ALLOCATOR_SIZE (ARRAY_POOL_SIZE + RAW_BUFFER_SIZE) +#define OBJECT_POOL_SIZE (OBJECTS_SIZE + RAW_OBJECT_SIZE) + +#define GET_OBJECT_POOL_ID(type) CAST_POOL_TYPE(type) >= CAST_POOL_TYPE(se::PoolType::RAW_OBJECT) ? (CAST_POOL_TYPE(type) - RAW_OBJECT_BEGIN + OBJECTS_SIZE) : CAST_POOL_TYPE(type) +#define GET_BUFFER_POOL_ID(type) CAST_POOL_TYPE(type) - BUFFER_POOL_BEGIN +#define GET_ARRAY_POOL_ID(type) CAST_POOL_TYPE(type) >= RAW_BUFFER_BEGIN ? (CAST_POOL_TYPE(type) - RAW_BUFFER_BEGIN + ARRAY_POOL_SIZE) : CAST_POOL_TYPE(type) - ARRAY_POOL_BEGIN +#define IS_BUFFER_ALLOCATOR_TYPE(type) CAST_POOL_TYPE(type) >= ARRAY_POOL_BEGIN + enum class PoolType { // objects ATTRIBUTE, @@ -35,6 +81,7 @@ enum class PoolType { BLEND_TARGET, BLEND_STATE, UI_BATCH, + PIPELINE_SHARED_SCENE_DATA, // array SUB_MODEL_ARRAY = 200, @@ -48,6 +95,8 @@ enum class PoolType { // raw buffer RAW_BUFFER = 300, + // raw Object + RAW_OBJECT = 400, UNKNOWN }; -} +} // namespace se diff --git a/native/cocos/bindings/dop/jsb_dop.cpp b/native/cocos/bindings/dop/jsb_dop.cpp index 0dbea4caed..96b1b68545 100644 --- a/native/cocos/bindings/dop/jsb_dop.cpp +++ b/native/cocos/bindings/dop/jsb_dop.cpp @@ -1,43 +1,44 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "jsb_dop.h" +#include "BufferAllocator.h" #include "BufferPool.h" #include "ObjectPool.h" -#include "BufferAllocator.h" -#include "cocos/bindings/manual/jsb_global.h" #include "cocos/bindings/manual/jsb_classtype.h" #include "cocos/bindings/manual/jsb_conversions.h" +#include "cocos/bindings/manual/jsb_global.h" /******************************************************** BufferPool binding *******************************************************/ -se::Class *jsb_BufferPool_class = nullptr; +se::Class *jsb_BufferPool_class = nullptr; // NOLINT -static bool jsb_BufferPool_allocateNewChunk(se::State &s) { - se::BufferPool *pool = (se::BufferPool *)s.nativeThisObject(); +static bool jsb_BufferPool_allocateNewChunk(se::State &s) { // NOLINT + auto *pool = static_cast(s.nativeThisObject()); SE_PRECONDITION2(pool, false, "jsb_BufferPool_allocateNewChunk : Invalid Native Object"); s.rval().setObject(pool->allocateNewChunk()); return true; @@ -46,12 +47,12 @@ SE_BIND_FUNC(jsb_BufferPool_allocateNewChunk); SE_DECLARE_FINALIZE_FUNC(jsb_BufferPool_finalize) -static bool jsb_BufferPool_constructor(se::State &s) { +static bool jsb_BufferPool_constructor(se::State &s) { // NOLINT const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 3) { - uint poolType = 0; - uint entryBits = 0; + uint poolType = 0; + uint entryBits = 0; uint bytesPerEntry = 0; bool ok = true; @@ -72,27 +73,27 @@ static bool jsb_BufferPool_constructor(se::State &s) { SE_REPORT_ERROR("jsb_BufferPool_constructor: wrong number of arguments: %d", (int)argc); return false; } -SE_BIND_CTOR(jsb_BufferPool_constructor, jsb_BufferPool_class, jsb_BufferPool_finalize) +SE_BIND_CTOR(jsb_BufferPool_constructor, jsb_BufferPool_class, jsb_BufferPool_finalize) // NOLINT -static bool jsb_BufferPool_finalize(se::State &s) { +static bool jsb_BufferPool_finalize(se::State &s) { // NOLINT auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - se::BufferPool *cobj = (se::BufferPool *)s.nativeThisObject(); + auto *cobj = static_cast(s.nativeThisObject()); JSB_FREE(cobj); } return true; } SE_BIND_FINALIZE_FUNC(jsb_BufferPool_finalize) -static bool js_register_se_BufferPool(se::Object *obj) { +static bool js_register_se_BufferPool(se::Object *obj) { // NOLINT se::Class *cls = se::Class::create("NativeBufferPool", obj, nullptr, _SE(jsb_BufferPool_constructor)); cls->defineFunction("allocateNewChunk", _SE(jsb_BufferPool_allocateNewChunk)); cls->install(); JSBClassType::registerClass(cls); - jsb_BufferPool_class = cls; + jsb_BufferPool_class = cls; // NOLINT se::ScriptEngine::getInstance()->clearException(); return true; @@ -101,16 +102,16 @@ static bool js_register_se_BufferPool(se::Object *obj) { /*************************************************** ObjectPool binding *****************************************************/ -static se::Class *jsb_ObjectPool_class = nullptr; +static se::Class *jsb_ObjectPool_class = nullptr; // NOLINT SE_DECLARE_FINALIZE_FUNC(jsb_ObjectPool_finalize) -static bool jsb_ObjectPool_constructor(se::State &s) { +static bool jsb_ObjectPool_constructor(se::State &s) { // NOLINT const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 2) { uint poolType = 0; - bool ok = true; + bool ok = true; ok &= seval_to_uint(args[0], &poolType); if (!args[1].isObject()) { @@ -130,23 +131,48 @@ static bool jsb_ObjectPool_constructor(se::State &s) { } SE_BIND_CTOR(jsb_ObjectPool_constructor, jsb_ObjectPool_class, jsb_ObjectPool_finalize) -static bool jsb_ObjectPool_finalize(se::State &s) { +static bool jsb_ObjectPool_finalize(se::State &s) { // NOLINT auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - se::ObjectPool *cobj = (se::ObjectPool *)s.nativeThisObject(); + auto *cobj = static_cast(s.nativeThisObject()); JSB_FREE(cobj); } return true; } SE_BIND_FINALIZE_FUNC(jsb_ObjectPool_finalize) -static bool js_register_se_ObjectPool(se::Object *obj) { +static bool js_ObjectPool_bind(se::State &s) { // NOLINT + auto *cobj = SE_THIS_OBJECT(s); + SE_PRECONDITION2(cobj, false, "js_ObjectPool_bind : Invalid Native Object"); + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 2) { + bool ok = true; + uint id = 0; + ok &= seval_to_uint(args[0], &id); + SE_PRECONDITION2(ok, false, "jsb_ObjectPool_bind : Error processing arguments"); + + if (!args[1].isObject()) { + SE_REPORT_ERROR("jsb_ObjectPool_bind: parameter 2 wants a Object"); + return false; + } + se::Object *value = args[1].toObject(); + cobj->bind(id, value); + return true; + } + SE_REPORT_ERROR("jsb_ObjectPool_bind: wrong number of arguments: %d, was expecting %d", (int)argc, 1); +} +SE_BIND_FUNC(js_ObjectPool_bind) + +static bool js_register_se_ObjectPool(se::Object *obj) { // NOLINT se::Class *cls = se::Class::create("NativeObjectPool", obj, nullptr, _SE(jsb_ObjectPool_constructor)); + cls->defineFunction("bind", _SE(js_ObjectPool_bind)); cls->install(); JSBClassType::registerClass(cls); - jsb_ObjectPool_class = cls; + jsb_ObjectPool_class = cls; // NOLINT se::ScriptEngine::getInstance()->clearException(); return true; @@ -155,20 +181,20 @@ static bool js_register_se_ObjectPool(se::Object *obj) { /***************************************************** Array binding ******************************************************/ -static se::Class *jsb_BufferAllocator_class = nullptr; +static se::Class *jsb_BufferAllocator_class = nullptr; // NOLINT SE_DECLARE_FINALIZE_FUNC(jsb_BufferAllocator_finalize) -static bool jsb_BufferAllocator_constructor(se::State &s) { +static bool jsb_BufferAllocator_constructor(se::State &s) { // NOLINT const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 1) { uint type = 0; - bool ok = seval_to_uint(args[0], &type); + bool ok = seval_to_uint(args[0], &type); - se::BufferAllocator *BufferAllocator = JSB_ALLOC(se::BufferAllocator, static_cast(type)); - s.thisObject()->setPrivateData(BufferAllocator); - se::NonRefNativePtrCreatedByCtorMap::emplace(BufferAllocator); + se::BufferAllocator *bufferAllocator = JSB_ALLOC(se::BufferAllocator, static_cast(type)); + s.thisObject()->setPrivateData(bufferAllocator); + se::NonRefNativePtrCreatedByCtorMap::emplace(bufferAllocator); return true; } @@ -177,23 +203,23 @@ static bool jsb_BufferAllocator_constructor(se::State &s) { } SE_BIND_CTOR(jsb_BufferAllocator_constructor, jsb_BufferAllocator_class, jsb_BufferAllocator_finalize) -static bool jsb_BufferAllocator_finalize(se::State &s) { +static bool jsb_BufferAllocator_finalize(se::State &s) { // NOLINT auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { se::NonRefNativePtrCreatedByCtorMap::erase(iter); - se::BufferAllocator *cobj = (se::BufferAllocator *)s.nativeThisObject(); + auto *cobj = static_cast(s.nativeThisObject()); JSB_FREE(cobj); } return true; } SE_BIND_FINALIZE_FUNC(jsb_BufferAllocator_finalize) -static bool jsb_BufferAllocator_alloc(se::State &s) { - se::BufferAllocator *bufferAllocator = (se::BufferAllocator *)s.nativeThisObject(); +static bool jsb_BufferAllocator_alloc(se::State &s) { // NOLINT + auto *bufferAllocator = static_cast(s.nativeThisObject()); SE_PRECONDITION2(bufferAllocator, false, "jsb_Array_alloc : Invalid Native Object"); const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 2) { uint index = 0; seval_to_uint(args[0], &index); @@ -208,12 +234,12 @@ static bool jsb_BufferAllocator_alloc(se::State &s) { } SE_BIND_FUNC(jsb_BufferAllocator_alloc); -static bool jsb_BufferAllocator_free(se::State &s) { - se::BufferAllocator *bufferAllocator = (se::BufferAllocator *)s.nativeThisObject(); +static bool jsb_BufferAllocator_free(se::State &s) { // NOLINT + auto *bufferAllocator = static_cast(s.nativeThisObject()); SE_PRECONDITION2(bufferAllocator, false, "jsb_Array_alloc : Invalid Native Object"); const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 1) { uint index = 0; seval_to_uint(args[0], &index); @@ -226,21 +252,21 @@ static bool jsb_BufferAllocator_free(se::State &s) { } SE_BIND_FUNC(jsb_BufferAllocator_free); -static bool js_register_se_BufferAllocator(se::Object *obj) { +static bool js_register_se_BufferAllocator(se::Object *obj) { // NOLINT se::Class *cls = se::Class::create("NativeBufferAllocator", obj, nullptr, _SE(jsb_BufferAllocator_constructor)); cls->defineFunction("alloc", _SE(jsb_BufferAllocator_alloc)); cls->defineFunction("free", _SE(jsb_BufferAllocator_free)); cls->install(); JSBClassType::registerClass(cls); - jsb_BufferAllocator_class = cls; + jsb_BufferAllocator_class = cls; // NOLINT se::ScriptEngine::getInstance()->clearException(); return true; } -bool register_all_dop_bindings(se::Object *obj) { - // TODO: Don't make dop into jsb namespace. Currently put it into jsb namesapce just to test codes. +bool register_all_dop_bindings(se::Object *obj) { // NOLINT + // TODO(liuhang): Don't make dop into jsb namespace. Currently put it into jsb namesapce just to test codes. se::Value nsVal; if (!obj->getProperty("jsb", &nsVal)) { se::HandleObject jsobj(se::Object::createPlainObject()); @@ -249,8 +275,8 @@ bool register_all_dop_bindings(se::Object *obj) { } se::Object *ns = nsVal.toObject(); - js_register_se_BufferAllocator(ns); - js_register_se_BufferPool(ns); - js_register_se_ObjectPool(ns); + js_register_se_BufferAllocator(ns); // NOLINT + js_register_se_BufferPool(ns); // NOLINT + js_register_se_ObjectPool(ns); // NOLINT return true; } diff --git a/native/cocos/bindings/dop/jsb_dop.h b/native/cocos/bindings/dop/jsb_dop.h index d13a2b3fdb..062d188d8c 100644 --- a/native/cocos/bindings/dop/jsb_dop.h +++ b/native/cocos/bindings/dop/jsb_dop.h @@ -1,25 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #pragma once @@ -28,4 +29,4 @@ namespace se { class Object; } -bool register_all_dop_bindings(se::Object *obj); +bool register_all_dop_bindings(se::Object *obj); // NOLINT diff --git a/native/cocos/bindings/event/CustomEventTypes.h b/native/cocos/bindings/event/CustomEventTypes.h index 865b44d59a..f832679050 100644 --- a/native/cocos/bindings/event/CustomEventTypes.h +++ b/native/cocos/bindings/event/CustomEventTypes.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/event/EventDispatcher.cpp b/native/cocos/bindings/event/EventDispatcher.cpp index 90ecbc625e..bbfcd62b80 100644 --- a/native/cocos/bindings/event/EventDispatcher.cpp +++ b/native/cocos/bindings/event/EventDispatcher.cpp @@ -1,17 +1,18 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,12 +21,13 @@ 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 "EventDispatcher.h" #include "cocos/bindings/event/CustomEventTypes.h" #include "cocos/bindings/jswrapper/SeApi.h" -#include "cocos/bindings/manual/jsb_global.h" +#include "cocos/bindings/manual/jsb_global_init.h" namespace { se::Value _tickVal; @@ -92,7 +94,7 @@ void EventDispatcher::dispatchTouchEvent(const struct TouchEvent &touchEvent) { _jsTouchObjArray->root(); } - _jsTouchObjArray->setProperty("length", se::Value(touchEvent.touches.size())); + _jsTouchObjArray->setProperty("length", se::Value((uint32_t)touchEvent.touches.size())); while (_jsTouchObjPool.size() < touchEvent.touches.size()) { se::Object *touchObj = se::Object::createPlainObject(); diff --git a/native/cocos/bindings/event/EventDispatcher.h b/native/cocos/bindings/event/EventDispatcher.h index 44f126d918..c62f016591 100644 --- a/native/cocos/bindings/event/EventDispatcher.h +++ b/native/cocos/bindings/event/EventDispatcher.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/bindings/jswrapper/HandleObject.cpp b/native/cocos/bindings/jswrapper/HandleObject.cpp index 09ac50740d..b4a3f80bc7 100644 --- a/native/cocos/bindings/jswrapper/HandleObject.cpp +++ b/native/cocos/bindings/jswrapper/HandleObject.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "HandleObject.h" #include "Object.h" diff --git a/native/cocos/bindings/jswrapper/HandleObject.h b/native/cocos/bindings/jswrapper/HandleObject.h index 92db2cbb87..1510a56b2b 100644 --- a/native/cocos/bindings/jswrapper/HandleObject.h +++ b/native/cocos/bindings/jswrapper/HandleObject.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/bindings/jswrapper/MappingUtils.cpp b/native/cocos/bindings/jswrapper/MappingUtils.cpp index b59766d1b6..8247b5989c 100644 --- a/native/cocos/bindings/jswrapper/MappingUtils.cpp +++ b/native/cocos/bindings/jswrapper/MappingUtils.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "MappingUtils.h" namespace se { diff --git a/native/cocos/bindings/jswrapper/MappingUtils.h b/native/cocos/bindings/jswrapper/MappingUtils.h index b6d79691e9..90b70f9d38 100644 --- a/native/cocos/bindings/jswrapper/MappingUtils.h +++ b/native/cocos/bindings/jswrapper/MappingUtils.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/bindings/jswrapper/Object.h b/native/cocos/bindings/jswrapper/Object.h index 8e277feb52..48e2e463c4 100644 --- a/native/cocos/bindings/jswrapper/Object.h +++ b/native/cocos/bindings/jswrapper/Object.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "config.h" diff --git a/native/cocos/bindings/jswrapper/RefCounter.cpp b/native/cocos/bindings/jswrapper/RefCounter.cpp index be62266a07..e1d1840dc0 100644 --- a/native/cocos/bindings/jswrapper/RefCounter.cpp +++ b/native/cocos/bindings/jswrapper/RefCounter.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "RefCounter.h" namespace se { diff --git a/native/cocos/bindings/jswrapper/RefCounter.h b/native/cocos/bindings/jswrapper/RefCounter.h index 592595f2eb..5fe3bc249a 100644 --- a/native/cocos/bindings/jswrapper/RefCounter.h +++ b/native/cocos/bindings/jswrapper/RefCounter.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once namespace se { diff --git a/native/cocos/bindings/jswrapper/SeApi.h b/native/cocos/bindings/jswrapper/SeApi.h index ea860209f8..fb9263d8ee 100644 --- a/native/cocos/bindings/jswrapper/SeApi.h +++ b/native/cocos/bindings/jswrapper/SeApi.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "config.h" diff --git a/native/cocos/bindings/jswrapper/State.cpp b/native/cocos/bindings/jswrapper/State.cpp index ce3bf9e30d..497ac03b3f 100644 --- a/native/cocos/bindings/jswrapper/State.cpp +++ b/native/cocos/bindings/jswrapper/State.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "State.h" #include "Object.h" diff --git a/native/cocos/bindings/jswrapper/State.h b/native/cocos/bindings/jswrapper/State.h index 5e37609488..b98b69ca1b 100644 --- a/native/cocos/bindings/jswrapper/State.h +++ b/native/cocos/bindings/jswrapper/State.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "Value.h" diff --git a/native/cocos/bindings/jswrapper/Value.cpp b/native/cocos/bindings/jswrapper/Value.cpp index 1551f7a240..1fffb9af9f 100644 --- a/native/cocos/bindings/jswrapper/Value.cpp +++ b/native/cocos/bindings/jswrapper/Value.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Value.h" #include "Object.h" diff --git a/native/cocos/bindings/jswrapper/Value.h b/native/cocos/bindings/jswrapper/Value.h index 1cb359d41f..4f82d2b373 100644 --- a/native/cocos/bindings/jswrapper/Value.h +++ b/native/cocos/bindings/jswrapper/Value.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/bindings/jswrapper/chakracore/Base.h b/native/cocos/bindings/jswrapper/chakracore/Base.h index 27602c8b01..4b989c356d 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Base.h +++ b/native/cocos/bindings/jswrapper/chakracore/Base.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "ChakraCore.h" diff --git a/native/cocos/bindings/jswrapper/chakracore/Class.cpp b/native/cocos/bindings/jswrapper/chakracore/Class.cpp index 6d44ee2b09..7a2a4a8a96 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Class.cpp +++ b/native/cocos/bindings/jswrapper/chakracore/Class.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Class.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_CHAKRACORE diff --git a/native/cocos/bindings/jswrapper/chakracore/Class.h b/native/cocos/bindings/jswrapper/chakracore/Class.h index c4f792a07a..9eca101a9f 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Class.h +++ b/native/cocos/bindings/jswrapper/chakracore/Class.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/chakracore/HelperMacros.h b/native/cocos/bindings/jswrapper/chakracore/HelperMacros.h index 9bf380cc12..53ad884838 100644 --- a/native/cocos/bindings/jswrapper/chakracore/HelperMacros.h +++ b/native/cocos/bindings/jswrapper/chakracore/HelperMacros.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/chakracore/Object.cpp b/native/cocos/bindings/jswrapper/chakracore/Object.cpp index 2f097df610..0156abd058 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Object.cpp +++ b/native/cocos/bindings/jswrapper/chakracore/Object.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Object.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_CHAKRACORE diff --git a/native/cocos/bindings/jswrapper/chakracore/Object.h b/native/cocos/bindings/jswrapper/chakracore/Object.h index 16cf1cfdc4..efe8f91c07 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Object.h +++ b/native/cocos/bindings/jswrapper/chakracore/Object.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.cpp b/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.cpp index 9586f1b399..4b93fc14bf 100644 --- a/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.cpp +++ b/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "ScriptEngine.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_CHAKRACORE diff --git a/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.h b/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.h index 8402169940..9d761e133c 100644 --- a/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.h +++ b/native/cocos/bindings/jswrapper/chakracore/ScriptEngine.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/chakracore/SeApi.h b/native/cocos/bindings/jswrapper/chakracore/SeApi.h index 7c6c89b2e9..b812e1c781 100644 --- a/native/cocos/bindings/jswrapper/chakracore/SeApi.h +++ b/native/cocos/bindings/jswrapper/chakracore/SeApi.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "ScriptEngine.h" diff --git a/native/cocos/bindings/jswrapper/chakracore/Utils.cpp b/native/cocos/bindings/jswrapper/chakracore/Utils.cpp index e11783b8db..69479cc309 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Utils.cpp +++ b/native/cocos/bindings/jswrapper/chakracore/Utils.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Utils.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_CHAKRACORE diff --git a/native/cocos/bindings/jswrapper/chakracore/Utils.h b/native/cocos/bindings/jswrapper/chakracore/Utils.h index 883e1bd52e..c26e27b26b 100644 --- a/native/cocos/bindings/jswrapper/chakracore/Utils.h +++ b/native/cocos/bindings/jswrapper/chakracore/Utils.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/config.cpp b/native/cocos/bindings/jswrapper/config.cpp index 9d422fd99a..07b6c4eaca 100644 --- a/native/cocos/bindings/jswrapper/config.cpp +++ b/native/cocos/bindings/jswrapper/config.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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 "config.h" #include diff --git a/native/cocos/bindings/jswrapper/config.h b/native/cocos/bindings/jswrapper/config.h index 2fcafa08af..b4612db88c 100644 --- a/native/cocos/bindings/jswrapper/config.h +++ b/native/cocos/bindings/jswrapper/config.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #define SCRIPT_ENGINE_NONE 0 diff --git a/native/cocos/bindings/jswrapper/jsc/Base.h b/native/cocos/bindings/jswrapper/jsc/Base.h index ccbffcf56d..05ff0e72be 100644 --- a/native/cocos/bindings/jswrapper/jsc/Base.h +++ b/native/cocos/bindings/jswrapper/jsc/Base.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/bindings/jswrapper/jsc/Class.cpp b/native/cocos/bindings/jswrapper/jsc/Class.cpp index bcfa681046..5a1af73f5d 100644 --- a/native/cocos/bindings/jswrapper/jsc/Class.cpp +++ b/native/cocos/bindings/jswrapper/jsc/Class.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Class.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_JSC diff --git a/native/cocos/bindings/jswrapper/jsc/Class.h b/native/cocos/bindings/jswrapper/jsc/Class.h index 3a30057046..78323c1086 100644 --- a/native/cocos/bindings/jswrapper/jsc/Class.h +++ b/native/cocos/bindings/jswrapper/jsc/Class.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/jsc/EJConvert.h b/native/cocos/bindings/jswrapper/jsc/EJConvert.h index 13e4acc9ca..22a6b2aac3 100644 --- a/native/cocos/bindings/jswrapper/jsc/EJConvert.h +++ b/native/cocos/bindings/jswrapper/jsc/EJConvert.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #import #import diff --git a/native/cocos/bindings/jswrapper/jsc/EJConvertTypedArray.h b/native/cocos/bindings/jswrapper/jsc/EJConvertTypedArray.h index 78b099aa20..07c5383766 100644 --- a/native/cocos/bindings/jswrapper/jsc/EJConvertTypedArray.h +++ b/native/cocos/bindings/jswrapper/jsc/EJConvertTypedArray.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #import #import diff --git a/native/cocos/bindings/jswrapper/jsc/HelperMacros.h b/native/cocos/bindings/jswrapper/jsc/HelperMacros.h index 9cd98127ee..979c3deff6 100644 --- a/native/cocos/bindings/jswrapper/jsc/HelperMacros.h +++ b/native/cocos/bindings/jswrapper/jsc/HelperMacros.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/jsc/Object.h b/native/cocos/bindings/jswrapper/jsc/Object.h index e463e7c190..31e6a8533d 100644 --- a/native/cocos/bindings/jswrapper/jsc/Object.h +++ b/native/cocos/bindings/jswrapper/jsc/Object.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/jsc/Object.mm b/native/cocos/bindings/jswrapper/jsc/Object.mm index 876b3eb378..8998a7bc81 100644 --- a/native/cocos/bindings/jswrapper/jsc/Object.mm +++ b/native/cocos/bindings/jswrapper/jsc/Object.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Object.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_JSC diff --git a/native/cocos/bindings/jswrapper/jsc/PlatformUtils.h b/native/cocos/bindings/jswrapper/jsc/PlatformUtils.h index cca5df950a..3a9c2387e7 100644 --- a/native/cocos/bindings/jswrapper/jsc/PlatformUtils.h +++ b/native/cocos/bindings/jswrapper/jsc/PlatformUtils.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once namespace se { diff --git a/native/cocos/bindings/jswrapper/jsc/PlatformUtils.mm b/native/cocos/bindings/jswrapper/jsc/PlatformUtils.mm index 8467d8180a..f02132829e 100644 --- a/native/cocos/bindings/jswrapper/jsc/PlatformUtils.mm +++ b/native/cocos/bindings/jswrapper/jsc/PlatformUtils.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 "PlatformUtils.h" #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/jsc/ScriptEngine.h b/native/cocos/bindings/jswrapper/jsc/ScriptEngine.h index 9990acc8ad..3dc755834d 100644 --- a/native/cocos/bindings/jswrapper/jsc/ScriptEngine.h +++ b/native/cocos/bindings/jswrapper/jsc/ScriptEngine.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/jsc/ScriptEngine.mm b/native/cocos/bindings/jswrapper/jsc/ScriptEngine.mm index 893ae397e9..72be0eb75f 100644 --- a/native/cocos/bindings/jswrapper/jsc/ScriptEngine.mm +++ b/native/cocos/bindings/jswrapper/jsc/ScriptEngine.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "ScriptEngine.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_JSC diff --git a/native/cocos/bindings/jswrapper/jsc/SeApi.h b/native/cocos/bindings/jswrapper/jsc/SeApi.h index abe85d1d90..77a80f751e 100644 --- a/native/cocos/bindings/jswrapper/jsc/SeApi.h +++ b/native/cocos/bindings/jswrapper/jsc/SeApi.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "ScriptEngine.h" diff --git a/native/cocos/bindings/jswrapper/jsc/Utils.cpp b/native/cocos/bindings/jswrapper/jsc/Utils.cpp index eb047d9ff7..a23e712e69 100644 --- a/native/cocos/bindings/jswrapper/jsc/Utils.cpp +++ b/native/cocos/bindings/jswrapper/jsc/Utils.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Utils.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_JSC diff --git a/native/cocos/bindings/jswrapper/jsc/Utils.h b/native/cocos/bindings/jswrapper/jsc/Utils.h index 96f2c03f9c..b1160e6ccf 100644 --- a/native/cocos/bindings/jswrapper/jsc/Utils.h +++ b/native/cocos/bindings/jswrapper/jsc/Utils.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/sm/Base.h b/native/cocos/bindings/jswrapper/sm/Base.h index 3e875841b2..8c5ba834c3 100644 --- a/native/cocos/bindings/jswrapper/sm/Base.h +++ b/native/cocos/bindings/jswrapper/sm/Base.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #ifndef UINT64_C diff --git a/native/cocos/bindings/jswrapper/sm/Class.cpp b/native/cocos/bindings/jswrapper/sm/Class.cpp index c2e3d31f53..c33a9573de 100644 --- a/native/cocos/bindings/jswrapper/sm/Class.cpp +++ b/native/cocos/bindings/jswrapper/sm/Class.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Class.h" #include "Object.h" #include "Utils.h" diff --git a/native/cocos/bindings/jswrapper/sm/Class.h b/native/cocos/bindings/jswrapper/sm/Class.h index 29fbe2117f..c4dad43d9d 100644 --- a/native/cocos/bindings/jswrapper/sm/Class.h +++ b/native/cocos/bindings/jswrapper/sm/Class.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/sm/HelperMacros.h b/native/cocos/bindings/jswrapper/sm/HelperMacros.h index e754f4df48..bc345a961b 100644 --- a/native/cocos/bindings/jswrapper/sm/HelperMacros.h +++ b/native/cocos/bindings/jswrapper/sm/HelperMacros.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/sm/Object.cpp b/native/cocos/bindings/jswrapper/sm/Object.cpp index 03b0ec2eea..20c57e8031 100644 --- a/native/cocos/bindings/jswrapper/sm/Object.cpp +++ b/native/cocos/bindings/jswrapper/sm/Object.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Object.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM diff --git a/native/cocos/bindings/jswrapper/sm/Object.h b/native/cocos/bindings/jswrapper/sm/Object.h index 42865d36e6..7815c144eb 100644 --- a/native/cocos/bindings/jswrapper/sm/Object.h +++ b/native/cocos/bindings/jswrapper/sm/Object.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp b/native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp index 9dccbd3fc1..9746cdd352 100644 --- a/native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp +++ b/native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "ScriptEngine.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM diff --git a/native/cocos/bindings/jswrapper/sm/ScriptEngine.h b/native/cocos/bindings/jswrapper/sm/ScriptEngine.h index 3102fac67c..2830b1dc7c 100644 --- a/native/cocos/bindings/jswrapper/sm/ScriptEngine.h +++ b/native/cocos/bindings/jswrapper/sm/ScriptEngine.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/sm/SeApi.h b/native/cocos/bindings/jswrapper/sm/SeApi.h index abe85d1d90..77a80f751e 100644 --- a/native/cocos/bindings/jswrapper/sm/SeApi.h +++ b/native/cocos/bindings/jswrapper/sm/SeApi.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "ScriptEngine.h" diff --git a/native/cocos/bindings/jswrapper/sm/Utils.cpp b/native/cocos/bindings/jswrapper/sm/Utils.cpp index 3a2c15f702..1cf35ee4ed 100644 --- a/native/cocos/bindings/jswrapper/sm/Utils.cpp +++ b/native/cocos/bindings/jswrapper/sm/Utils.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Utils.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM diff --git a/native/cocos/bindings/jswrapper/sm/Utils.h b/native/cocos/bindings/jswrapper/sm/Utils.h index f4a096e69f..b9f1e484ad 100644 --- a/native/cocos/bindings/jswrapper/sm/Utils.h +++ b/native/cocos/bindings/jswrapper/sm/Utils.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/v8/Base.h b/native/cocos/bindings/jswrapper/v8/Base.h index cb749a7887..3ca1c92e5d 100644 --- a/native/cocos/bindings/jswrapper/v8/Base.h +++ b/native/cocos/bindings/jswrapper/v8/Base.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "libplatform/libplatform.h" diff --git a/native/cocos/bindings/jswrapper/v8/Class.cpp b/native/cocos/bindings/jswrapper/v8/Class.cpp index 23a68c1c43..e9f1ceaf84 100644 --- a/native/cocos/bindings/jswrapper/v8/Class.cpp +++ b/native/cocos/bindings/jswrapper/v8/Class.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Class.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8 diff --git a/native/cocos/bindings/jswrapper/v8/Class.h b/native/cocos/bindings/jswrapper/v8/Class.h index 85848b70d7..c703463781 100644 --- a/native/cocos/bindings/jswrapper/v8/Class.h +++ b/native/cocos/bindings/jswrapper/v8/Class.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/v8/HelperMacros.h b/native/cocos/bindings/jswrapper/v8/HelperMacros.h index 1aaf772d60..ad8437666a 100644 --- a/native/cocos/bindings/jswrapper/v8/HelperMacros.h +++ b/native/cocos/bindings/jswrapper/v8/HelperMacros.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/v8/Object.cpp b/native/cocos/bindings/jswrapper/v8/Object.cpp index 4c1c2f70c3..08f2199eb5 100644 --- a/native/cocos/bindings/jswrapper/v8/Object.cpp +++ b/native/cocos/bindings/jswrapper/v8/Object.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Object.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8 diff --git a/native/cocos/bindings/jswrapper/v8/Object.h b/native/cocos/bindings/jswrapper/v8/Object.h index 778967c2a3..d092459e07 100644 --- a/native/cocos/bindings/jswrapper/v8/Object.h +++ b/native/cocos/bindings/jswrapper/v8/Object.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/v8/ObjectWrap.cpp b/native/cocos/bindings/jswrapper/v8/ObjectWrap.cpp index 4ef773e87d..814e1f5f45 100644 --- a/native/cocos/bindings/jswrapper/v8/ObjectWrap.cpp +++ b/native/cocos/bindings/jswrapper/v8/ObjectWrap.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/native/cocos/bindings/jswrapper/v8/ObjectWrap.h b/native/cocos/bindings/jswrapper/v8/ObjectWrap.h index 0c0108e687..eb814a974c 100644 --- a/native/cocos/bindings/jswrapper/v8/ObjectWrap.h +++ b/native/cocos/bindings/jswrapper/v8/ObjectWrap.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a diff --git a/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp b/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp index 537fac23b9..41a52e48cb 100644 --- a/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp +++ b/native/cocos/bindings/jswrapper/v8/ScriptEngine.cpp @@ -1,17 +1,18 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,7 +21,8 @@ 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 "ScriptEngine.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8 diff --git a/native/cocos/bindings/jswrapper/v8/ScriptEngine.h b/native/cocos/bindings/jswrapper/v8/ScriptEngine.h index 4b3eb8175f..e8c56e8898 100644 --- a/native/cocos/bindings/jswrapper/v8/ScriptEngine.h +++ b/native/cocos/bindings/jswrapper/v8/ScriptEngine.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/v8/SeApi.h b/native/cocos/bindings/jswrapper/v8/SeApi.h index 0579943688..8188bb150f 100644 --- a/native/cocos/bindings/jswrapper/v8/SeApi.h +++ b/native/cocos/bindings/jswrapper/v8/SeApi.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "ScriptEngine.h" diff --git a/native/cocos/bindings/jswrapper/v8/Utils.cpp b/native/cocos/bindings/jswrapper/v8/Utils.cpp index 4a42afb65d..a7983f9207 100644 --- a/native/cocos/bindings/jswrapper/v8/Utils.cpp +++ b/native/cocos/bindings/jswrapper/v8/Utils.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "Utils.h" #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8 diff --git a/native/cocos/bindings/jswrapper/v8/Utils.h b/native/cocos/bindings/jswrapper/v8/Utils.h index 349b9de48e..77b3369506 100644 --- a/native/cocos/bindings/jswrapper/v8/Utils.h +++ b/native/cocos/bindings/jswrapper/v8/Utils.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "../config.h" diff --git a/native/cocos/bindings/jswrapper/v8/debugger/v8_inspector_protocol_json.h b/native/cocos/bindings/jswrapper/v8/debugger/v8_inspector_protocol_json.h index da0d74d20f..2b4fc46b2f 100644 --- a/native/cocos/bindings/jswrapper/v8/debugger/v8_inspector_protocol_json.h +++ b/native/cocos/bindings/jswrapper/v8/debugger/v8_inspector_protocol_json.h @@ -498,4 +498,4 @@ 242, 248, 77, 121, 248, 230, 156, 82, 83, 227, 141, 164, 94, 199, 24, 105, 123, 150, 187, 171, 178, 50, 220, 148, 119, 156, 191, 42, 80, 135, 98, 150, 221, 242, 242, 28, 49, 191, 25, 31, 195, 23, 236, 7, 228, 19, 170, 103, 12, 155, 178, 203, 126, 172, 27, 104, 241, 39, 76, 147, - 48, 21, 253, 253, 239, 39, 63, 253, 244, 255, 1, 17, 146, 119, 172 \ No newline at end of file + 48, 21, 253, 253, 239, 39, 63, 253, 244, 255, 1, 17, 146, 119, 172 diff --git a/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp b/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp index 2faf45d146..066eda30e1 100644 --- a/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp +++ b/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp @@ -1,25 +1,28 @@ -/* - * Copyright (c) 2013-2016 Chukong Technologies Inc. - * Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - * - * 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. - */ +/**************************************************************************** + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/manual/JavaScriptJavaBridge.h" #include "platform/android/jni/JniHelper.h" diff --git a/native/cocos/bindings/manual/JavaScriptJavaBridge.h b/native/cocos/bindings/manual/JavaScriptJavaBridge.h index 65c3a8ccdf..3cacc10466 100644 --- a/native/cocos/bindings/manual/JavaScriptJavaBridge.h +++ b/native/cocos/bindings/manual/JavaScriptJavaBridge.h @@ -1,25 +1,28 @@ -/* - * Copyright (c) 2013-2016 Chukong Technologies Inc. - * Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - * - * 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. - */ +/**************************************************************************** + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ #pragma once @@ -27,4 +30,4 @@ namespace se { class Object; } -bool register_javascript_java_bridge(se::Object *obj); \ No newline at end of file +bool register_javascript_java_bridge(se::Object *obj); diff --git a/native/cocos/bindings/manual/JavaScriptObjCBridge.h b/native/cocos/bindings/manual/JavaScriptObjCBridge.h index 90cffeedd5..2edbf64be0 100644 --- a/native/cocos/bindings/manual/JavaScriptObjCBridge.h +++ b/native/cocos/bindings/manual/JavaScriptObjCBridge.h @@ -1,25 +1,28 @@ -/* - * Copyright (c) 2013-2016 Chukong Technologies Inc. - * Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - * - * 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. - */ +/**************************************************************************** + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/JavaScriptObjCBridge.mm b/native/cocos/bindings/manual/JavaScriptObjCBridge.mm index 3edab3d3a2..32b0719cea 100644 --- a/native/cocos/bindings/manual/JavaScriptObjCBridge.mm +++ b/native/cocos/bindings/manual/JavaScriptObjCBridge.mm @@ -1,5 +1,6 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +22,7 @@ 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 "JavaScriptObjCBridge.h" #include "cocos/bindings/manual/jsb_conversions.h" diff --git a/native/cocos/bindings/manual/jsb_classtype.cpp b/native/cocos/bindings/manual/jsb_classtype.cpp index 585d9d3428..3392accf41 100644 --- a/native/cocos/bindings/manual/jsb_classtype.cpp +++ b/native/cocos/bindings/manual/jsb_classtype.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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 "jsb_classtype.h" diff --git a/native/cocos/bindings/manual/jsb_classtype.h b/native/cocos/bindings/manual/jsb_classtype.h index 157dbb5fac..7f9a9527ad 100644 --- a/native/cocos/bindings/manual/jsb_classtype.h +++ b/native/cocos/bindings/manual/jsb_classtype.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_cocos_manual.cpp b/native/cocos/bindings/manual/jsb_cocos_manual.cpp index b53b7a1e25..fd28b9fac0 100644 --- a/native/cocos/bindings/manual/jsb_cocos_manual.cpp +++ b/native/cocos/bindings/manual/jsb_cocos_manual.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,13 +21,13 @@ 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 "jsb_cocos_manual.h" #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/bindings/manual/jsb_global.h" +#include "cocos/bindings/manual/jsb_global_init.h" #include "cocos/bindings/auto/jsb_cocos_auto.h" #include "storage/local-storage/LocalStorage.h" @@ -639,7 +639,7 @@ static bool js_engine_FileUtils_listFilesRecursively(se::State &s) { cobj->listFilesRecursively(arg0, &arg1); se::Object *list = args[1].toObject(); SE_PRECONDITION2(args[1].isObject() && list->isArray(), false, "js_engine_FileUtils_listFilesRecursively : 2nd argument should be an Array"); - for (size_t i = 0; i < arg1.size(); i++) { + for (uint i = 0; i < static_cast(arg1.size()); i++) { list->setArrayElement(i, se::Value(arg1[i])); } list->setProperty("length", se::Value(arg1.size())); diff --git a/native/cocos/bindings/manual/jsb_cocos_manual.h b/native/cocos/bindings/manual/jsb_cocos_manual.h index 963a8d2cf4..5e414cf1c8 100644 --- a/native/cocos/bindings/manual/jsb_cocos_manual.h +++ b/native/cocos/bindings/manual/jsb_cocos_manual.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_conversions.cpp b/native/cocos/bindings/manual/jsb_conversions.cpp index 1bb567ad7c..b871419e79 100644 --- a/native/cocos/bindings/manual/jsb_conversions.cpp +++ b/native/cocos/bindings/manual/jsb_conversions.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,15 +21,17 @@ 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 "jsb_conversions.h" -#include "base/TypeDef.h" -#include "math/Math.h" -#include "renderer/core/gfx/GFXDef.h" + #include #include +#include "base/TypeDef.h" +#include "gfx-base/GFXDef.h" +#include "math/Math.h" + // seval to native bool seval_to_int32(const se::Value &v, int32_t *ret) { @@ -37,7 +39,8 @@ bool seval_to_int32(const se::Value &v, int32_t *ret) { if (v.isNumber()) { *ret = v.toInt32(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -50,7 +53,8 @@ bool seval_to_uint32(const se::Value &v, uint32_t *ret) { if (v.isNumber()) { *ret = v.toUint32(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -63,7 +67,8 @@ bool seval_to_uint(const se::Value &v, unsigned int *ret) { if (v.isNumber()) { *ret = v.toUint(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -76,7 +81,8 @@ bool seval_to_int8(const se::Value &v, int8_t *ret) { if (v.isNumber()) { *ret = v.toInt8(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -89,7 +95,8 @@ bool seval_to_uint8(const se::Value &v, uint8_t *ret) { if (v.isNumber()) { *ret = v.toUint8(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -102,7 +109,8 @@ bool seval_to_int16(const se::Value &v, int16_t *ret) { if (v.isNumber()) { *ret = v.toInt16(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -115,7 +123,8 @@ bool seval_to_uint16(const se::Value &v, uint16_t *ret) { if (v.isNumber()) { *ret = v.toUint16(); return true; - } else if (v.isBoolean()) { + } + if (v.isBoolean()) { *ret = v.toBoolean() ? 1 : 0; return true; } @@ -128,13 +137,13 @@ bool seval_to_boolean(const se::Value &v, bool *ret) { if (v.isBoolean()) { *ret = v.toBoolean(); } else if (v.isNumber()) { - *ret = v.toInt32() != 0 ? true : false; + *ret = v.toInt32() != 0; } else if (v.isNullOrUndefined()) { *ret = false; } else if (v.isObject()) { *ret = true; } else if (v.isString()) { - *ret = v.toString().empty() ? false : true; + *ret = !v.toString().empty(); } else { *ret = false; assert(false); @@ -147,8 +156,9 @@ bool seval_to_float(const se::Value &v, float *ret) { assert(ret != nullptr); if (v.isNumber()) { *ret = v.toFloat(); - if (!std::isnan(*ret)) + if (!std::isnan(*ret)) { return true; + } } *ret = 0.0f; return false; @@ -157,8 +167,9 @@ bool seval_to_float(const se::Value &v, float *ret) { bool seval_to_double(const se::Value &v, double *ret) { if (v.isNumber()) { *ret = v.toNumber(); - if (!std::isnan(*ret)) + if (!std::isnan(*ret)) { return true; + } } *ret = 0.0; return false; @@ -214,9 +225,9 @@ bool seval_to_Vec2(const se::Value &v, cc::Vec2 *pt) { assert(pt != nullptr); SE_PRECONDITION2(v.isObject(), false, "Convert parameter to Vec2 failed!"); se::Object *obj = v.toObject(); - se::Value x; - se::Value y; - bool ok = obj->getProperty("x", &x); + se::Value x; + se::Value y; + bool ok = obj->getProperty("x", &x); SE_PRECONDITION3(ok && x.isNumber(), false, *pt = cc::Vec2::ZERO); ok = obj->getProperty("y", &y); SE_PRECONDITION3(ok && y.isNumber(), false, *pt = cc::Vec2::ZERO); @@ -229,10 +240,10 @@ bool seval_to_Vec3(const se::Value &v, cc::Vec3 *pt) { assert(pt != nullptr); SE_PRECONDITION2(v.isObject(), false, "Convert parameter to Vec3 failed!"); se::Object *obj = v.toObject(); - se::Value x; - se::Value y; - se::Value z; - bool ok = obj->getProperty("x", &x); + se::Value x; + se::Value y; + se::Value z; + bool ok = obj->getProperty("x", &x); SE_PRECONDITION3(ok && x.isNumber(), false, *pt = cc::Vec3::ZERO); ok = obj->getProperty("y", &y); SE_PRECONDITION3(ok && y.isNumber(), false, *pt = cc::Vec3::ZERO); @@ -248,12 +259,12 @@ bool seval_to_Vec4(const se::Value &v, cc::Vec4 *pt) { assert(pt != nullptr); SE_PRECONDITION2(v.isObject(), false, "Convert parameter to Vec4 failed!"); pt->x = pt->y = pt->z = pt->w = 0.0f; - se::Object *obj = v.toObject(); - se::Value x; - se::Value y; - se::Value z; - se::Value w; - bool ok = obj->getProperty("x", &x); + se::Object *obj = v.toObject(); + se::Value x; + se::Value y; + se::Value z; + se::Value w; + bool ok = obj->getProperty("x", &x); SE_PRECONDITION3(ok && x.isNumber(), false, *pt = cc::Vec4::ZERO); ok = obj->getProperty("y", &y); SE_PRECONDITION3(ok && y.isNumber(), false, *pt = cc::Vec4::ZERO); @@ -274,7 +285,7 @@ bool seval_to_mat(const se::Value &v, int length, float *out) { se::Object *obj = v.toObject(); se::Value tmp; - char propName[3] = {0}; + char propName[3] = {0}; for (int i = 0; i < length; ++i) { snprintf(propName, 3, "m%2d", i); obj->getProperty(propName, &tmp); @@ -293,14 +304,14 @@ bool seval_to_Mat4(const se::Value &v, cc::Mat4 *mat) { // typed array SE_PRECONDITION2(obj->isTypedArray(), false, "Convert parameter to Matrix4 failed!"); - size_t length = 0; - uint8_t *ptr = nullptr; + size_t length = 0; + uint8_t *ptr = nullptr; obj->getTypedArrayData(&ptr, &length); memcpy(mat->m, ptr, length); } else { - bool ok = false; - se::Value tmp; + bool ok = false; + se::Value tmp; std::string prefix = "m"; for (uint32_t i = 0; i < 16; ++i) { std::string name; @@ -333,11 +344,11 @@ bool seval_to_Uint8Array(const se::Value &v, uint8_t *ret) { se::Object *obj = v.toObject(); SE_PRECONDITION2(obj->isArray(), false, "Convert parameter to Array failed!"); - CC_UNUSED bool ok = true; - uint32_t length = 0; + CC_UNUSED bool ok = true; + uint32_t length = 0; obj->getArrayLength(&length); se::Value value; - uint8_t data = 0; + uint8_t data = 0; for (uint32_t i = 0; i < length; ++i) { if (obj->getArrayElement(i, &value)) { ok = seval_to_uint8(value, &data); @@ -363,14 +374,14 @@ bool seval_to_Size(const se::Value &v, cc::Size *size) { assert(size != nullptr); SE_PRECONDITION2(v.isObject(), false, "Convert parameter to Size failed!"); se::Object *obj = v.toObject(); - se::Value width; - se::Value height; + se::Value width; + se::Value height; bool ok = obj->getProperty("width", &width); SE_PRECONDITION3(ok && width.isNumber(), false, *size = cc::Size::ZERO); ok = obj->getProperty("height", &height); SE_PRECONDITION3(ok && height.isNumber(), false, *size = cc::Size::ZERO); - size->width = width.toFloat(); + size->width = width.toFloat(); size->height = height.toFloat(); return true; } @@ -384,13 +395,13 @@ bool seval_to_ccvalue(const se::Value &v, cc::Value *ret) { // It's a normal js object. cc::ValueMap dictVal; ok = seval_to_ccvaluemap(v, &dictVal); - SE_PRECONDITION3(ok, false, *ret = cc::Value::Null); + SE_PRECONDITION3(ok, false, *ret = cc::Value::VALUE_NULL); *ret = cc::Value(dictVal); } else { // It's a js array object. cc::ValueVector arrVal; ok = seval_to_ccvaluevector(v, &arrVal); - SE_PRECONDITION3(ok, false, *ret = cc::Value::Null); + SE_PRECONDITION3(ok, false, *ret = cc::Value::VALUE_NULL); *ret = cc::Value(arrVal); } } else if (v.isString()) { @@ -400,7 +411,7 @@ bool seval_to_ccvalue(const se::Value &v, cc::Value *ret) { } else if (v.isBoolean()) { *ret = v.toBoolean(); } else if (v.isNullOrUndefined()) { - *ret = cc::Value::Null; + *ret = cc::Value::VALUE_NULL; } else { SE_PRECONDITION2(false, false, "type not supported!"); } @@ -426,7 +437,7 @@ bool seval_to_ccvaluemap(const se::Value &v, cc::ValueMap *ret) { std::vector allKeys; SE_PRECONDITION3(obj->getAllKeys(&allKeys), false, ret->clear()); - bool ok = false; + bool ok = false; se::Value value; cc::Value ccvalue; for (const auto &key : allKeys) { @@ -441,8 +452,9 @@ bool seval_to_ccvaluemap(const se::Value &v, cc::ValueMap *ret) { static bool isNumberString(const std::string &str) { for (const auto &c : str) { - if (!isdigit(c)) + if (!isdigit(c)) { return false; + } } return true; } @@ -464,7 +476,7 @@ bool seval_to_ccvaluemapintkey(const se::Value &v, cc::ValueMapIntKey *ret) { std::vector allKeys; SE_PRECONDITION3(obj->getAllKeys(&allKeys), false, ret->clear()); - bool ok = false; + bool ok = false; se::Value value; cc::Value ccvalue; for (const auto &key : allKeys) { @@ -496,7 +508,7 @@ bool seval_to_ccvaluevector(const se::Value &v, cc::ValueVector *ret) { uint32_t len = 0; obj->getArrayLength(&len); - bool ok = false; + bool ok = false; se::Value value; cc::Value ccvalue; for (uint32_t i = 0; i < len; ++i) { @@ -511,7 +523,7 @@ bool seval_to_ccvaluevector(const se::Value &v, cc::ValueVector *ret) { } bool sevals_variadic_to_ccvaluevector(const se::ValueArray &args, cc::ValueVector *ret) { - bool ok = false; + bool ok = false; cc::Value ccvalue; for (const auto &arg : args) { @@ -558,10 +570,10 @@ bool seval_to_std_vector_int(const se::Value &v, std::vector *ret) { return true; } } else if (obj->isTypedArray()) { - size_t bytesPerElements = 0; - uint8_t *data = nullptr; - size_t dataBytes = 0; - se::Object::TypedArrayType type = obj->getTypedArrayType(); + size_t bytesPerElements = 0; + uint8_t * data = nullptr; + size_t dataBytes = 0; + se::Object::TypedArrayType type = obj->getTypedArrayType(); #define SE_UINT8_PTR_TO_INT(ptr) (*((uint8_t *)(ptr))) #define SE_UINT16_PTR_TO_INT(ptr) (*((uint16_t *)(ptr))) @@ -623,10 +635,10 @@ bool seval_to_std_vector_uint16(const se::Value &v, std::vector *ret) return true; } } else if (obj->isTypedArray()) { - size_t bytesPerElements = 0; - uint8_t *data = nullptr; - size_t dataBytes = 0; - se::Object::TypedArrayType type = obj->getTypedArrayType(); + size_t bytesPerElements = 0; + uint8_t * data = nullptr; + size_t dataBytes = 0; + se::Object::TypedArrayType type = obj->getTypedArrayType(); if (obj->getTypedArrayData(&data, &dataBytes)) { for (size_t i = 0; i < dataBytes; i += bytesPerElements) { @@ -678,7 +690,7 @@ bool seval_to_std_vector_Vec2(const se::Value &v, std::vector *ret) { uint32_t len = 0; if (obj->getArrayLength(&len)) { se::Value value; - cc::Vec2 pt; + cc::Vec2 pt; for (uint32_t i = 0; i < len; ++i) { SE_PRECONDITION3(obj->getArrayElement(i, &value) && seval_to_Vec2(value, &pt), false, ret->clear()); ret->push_back(pt); @@ -706,8 +718,8 @@ bool seval_to_std_map_string_string(const se::Value &v, std::map allKeys; SE_PRECONDITION3(obj->getAllKeys(&allKeys), false, ret->clear()); - bool ok = false; - se::Value value; + bool ok = false; + se::Value value; std::string strValue; for (const auto &key : allKeys) { SE_PRECONDITION3(obj->getProperty(key.c_str(), &value), false, ret->clear()); @@ -722,9 +734,9 @@ bool seval_to_std_map_string_string(const se::Value &v, std::mapisTypedArray(), false, "Convert parameter to Data failed!"); - uint8_t *ptr = nullptr; - size_t length = 0; - bool ok = v.toObject()->getTypedArrayData(&ptr, &length); + uint8_t *ptr = nullptr; + size_t length = 0; + bool ok = v.toObject()->getTypedArrayData(&ptr, &length); if (ok) { ret->copy(ptr, length); } else { @@ -735,12 +747,12 @@ bool seval_to_Data(const se::Value &v, cc::Data *ret) { } bool seval_to_DownloaderHints(const se::Value &v, cc::network::DownloaderHints *ret) { - static cc::network::DownloaderHints ZERO = {0, 0, ""}; + const static cc::network::DownloaderHints ZERO{0, 0, ""}; assert(ret != nullptr); SE_PRECONDITION2(v.isObject(), false, "Convert parameter to DownloaderHints failed!"); - se::Value tmp; + se::Value tmp; se::Object *obj = v.toObject(); - bool ok = false; + bool ok = false; ok = obj->getProperty("countOfMaxProcessingTasks", &tmp); SE_PRECONDITION3(ok && tmp.isNumber(), false, *ret = ZERO); @@ -946,13 +958,14 @@ bool ccvaluemap_to_seval(const cc::ValueMap &v, se::Value *ret) { assert(ret != nullptr); se::HandleObject obj(se::Object::createPlainObject()); - bool ok = true; + bool ok = true; for (const auto &e : v) { - const std::string &key = e.first; - const cc::Value &value = e.second; + const std::string &key = e.first; + const cc::Value & value = e.second; - if (key.empty()) + if (key.empty()) { continue; + } se::Value tmp; if (!ccvalue_to_seval(value, &tmp)) { @@ -963,8 +976,9 @@ bool ccvaluemap_to_seval(const cc::ValueMap &v, se::Value *ret) { obj->setProperty(key.c_str(), tmp); } - if (ok) + if (ok) { ret->setObject(obj); + } return ok; } @@ -973,15 +987,16 @@ bool ccvaluemapintkey_to_seval(const cc::ValueMapIntKey &v, se::Value *ret) { assert(ret != nullptr); se::HandleObject obj(se::Object::createPlainObject()); - bool ok = true; + bool ok = true; for (const auto &e : v) { std::stringstream keyss; keyss << e.first; - std::string key = keyss.str(); + std::string key = keyss.str(); const cc::Value &value = e.second; - if (key.empty()) + if (key.empty()) { continue; + } se::Value tmp; if (!ccvalue_to_seval(value, &tmp)) { @@ -992,8 +1007,9 @@ bool ccvaluemapintkey_to_seval(const cc::ValueMapIntKey &v, se::Value *ret) { obj->setProperty(key.c_str(), tmp); } - if (ok) + if (ok) { ret->setObject(obj); + } return ok; } @@ -1001,7 +1017,7 @@ bool ccvaluemapintkey_to_seval(const cc::ValueMapIntKey &v, se::Value *ret) { bool ccvaluevector_to_seval(const cc::ValueVector &v, se::Value *ret) { assert(ret != nullptr); se::HandleObject obj(se::Object::createArrayObject(v.size())); - bool ok = true; + bool ok = true; uint32_t i = 0; for (const auto &value : v) { @@ -1015,8 +1031,9 @@ bool ccvaluevector_to_seval(const cc::ValueVector &v, se::Value *ret) { obj->setArrayElement(i, tmp); ++i; } - if (ok) + if (ok) { ret->setObject(obj); + } return ok; } @@ -1027,7 +1044,7 @@ template bool std_vector_T_to_seval(const std::vector &v, se::Value *ret) { assert(ret != nullptr); se::HandleObject obj(se::Object::createArrayObject(v.size())); - bool ok = true; + bool ok = true; uint32_t i = 0; for (const auto &value : v) { @@ -1039,8 +1056,9 @@ bool std_vector_T_to_seval(const std::vector &v, se::Value *ret) { ++i; } - if (ok) + if (ok) { ret->setObject(obj); + } return ok; } @@ -1067,13 +1085,14 @@ bool std_map_string_string_to_seval(const std::map &v, assert(ret != nullptr); se::HandleObject obj(se::Object::createPlainObject()); - bool ok = true; + bool ok = true; for (const auto &e : v) { - const std::string &key = e.first; + const std::string &key = e.first; const std::string &value = e.second; - if (key.empty()) + if (key.empty()) { continue; + } se::Value tmp; if (!std_string_to_seval(value, &tmp)) { @@ -1085,8 +1104,9 @@ bool std_map_string_string_to_seval(const std::map &v, obj->setProperty(key.c_str(), tmp); } - if (ok) + if (ok) { ret->setObject(obj); + } return ok; } @@ -1098,9 +1118,9 @@ enum class DataType { }; void toVec2(void *data, DataType type, se::Value *ret) { - int32_t *intptr = (int32_t *)data; - float *floatptr = (float *)data; - cc::Vec2 vec2; + auto *intptr = static_cast(data); + auto * floatptr = static_cast(data); + cc::Vec2 vec2; if (DataType::INT == type) { vec2.x = static_cast(intptr[0]); vec2.y = static_cast(intptr[1]); @@ -1113,8 +1133,8 @@ void toVec2(void *data, DataType type, se::Value *ret) { } void toVec3(void *data, DataType type, se::Value *ret) { - int32_t *intptr = (int32_t *)data; - float *floatptr = (float *)data; + auto * intptr = static_cast(data); + auto * floatptr = static_cast(data); cc::Vec3 vec3; if (DataType::INT == type) { vec3.x = static_cast(intptr[0]); @@ -1130,8 +1150,8 @@ void toVec3(void *data, DataType type, se::Value *ret) { } void toVec4(void *data, DataType type, se::Value *ret) { - int32_t *intptr = (int32_t *)data; - float *floatptr = (float *)data; + auto * intptr = static_cast(data); + auto * floatptr = static_cast(data); cc::Vec4 vec4; if (DataType::INT == type) { vec4.x = static_cast(intptr[0]); @@ -1153,10 +1173,13 @@ void toMat(float *data, int num, se::Value *ret) { char propName[4] = {0}; for (int i = 0; i < num; ++i) { - if (i < 10) + if (i < 10) { snprintf(propName, 3, "m0%d", i); - else + } + + else { snprintf(propName, 3, "m%d", i); + } obj->setProperty(propName, se::Value(*(data + i))); } @@ -1257,9 +1280,9 @@ bool sevalue_to_native(const se::Value &v, spine::Vector *ret, se se::Object *obj = v.toObject(); assert(obj->isArray()); - bool ok = true; + bool ok = true; uint32_t len = 0; - ok = obj->getArrayLength(&len); + ok = obj->getArrayLength(&len); if (!ok) { ret->clear(); return false; @@ -1289,7 +1312,7 @@ bool nativevalue_to_se(const spine::String &obj, se::Value &val, se::Object *) { template <> bool nativevalue_to_se(const spine::Vector &v, se::Value &ret, se::Object *) { se::HandleObject obj(se::Object::createArrayObject(v.size())); - bool ok = true; + bool ok = true; spine::Vector tmpv = v; for (uint32_t i = 0, count = (uint32_t)tmpv.size(); i < count; i++) { @@ -1313,7 +1336,7 @@ bool seval_to_Map_string_key(const se::Value &v, cc::Map allKeys; - bool ok = obj->getAllKeys(&allKeys); + bool ok = obj->getAllKeys(&allKeys); if (!ok) { ret->clear(); return false; @@ -1322,7 +1345,9 @@ bool seval_to_Map_string_key(const se::Value &v, cc::MapgetProperty(key.c_str(), &tmp); if (!ok || !tmp.isObject()) { @@ -1330,7 +1355,7 @@ bool seval_to_Map_string_key(const se::Value &v, cc::MapgetPrivateData(); + auto *nativeObj = static_cast(tmp.toObject()->getPrivateData()); ret->insert(key, nativeObj); } diff --git a/native/cocos/bindings/manual/jsb_conversions.h b/native/cocos/bindings/manual/jsb_conversions.h index 4c681425aa..0c02569909 100644 --- a/native/cocos/bindings/manual/jsb_conversions.h +++ b/native/cocos/bindings/manual/jsb_conversions.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once @@ -220,37 +220,6 @@ bool seval_to_native_ptr(const se::Value &v, T *ret) { return false; } -template -bool seval_to_Vector(const se::Value &v, cc::Vector *ret) { - assert(ret != nullptr); - assert(v.isObject()); - se::Object *obj = v.toObject(); - assert(obj->isArray()); - - bool ok = true; - uint32_t len = 0; - ok = obj->getArrayLength(&len); - if (!ok) { - ret->clear(); - return false; - } - - se::Value tmp; - for (uint32_t i = 0; i < len; ++i) { - ok = obj->getArrayElement(i, &tmp); - if (!ok || !tmp.isObject()) { - ret->clear(); - return false; - } - - T nativeObj = (T)tmp.toObject()->getPrivateData(); - - ret->pushBack(nativeObj); - } - - return true; -} - template typename std::enable_if::value && !std::is_same::value, T>::type seval_to_type(const se::Value &v, bool &ok) { @@ -884,7 +853,7 @@ bool sevalue_to_native(const se::Value &from, std::array *to, se:: se::Value tmp; assert(len >= CNT); for (size_t i = 0; i < CNT; i++) { - array->getArrayElement(i, &tmp); + array->getArrayElement((uint)i, &tmp); sevalue_to_native(tmp, &(*to)[i], ctx); } } else { @@ -1248,7 +1217,6 @@ inline bool nativevalue_to_se(const T &from, se::Value &to, se::Object *ctx) { to.setNumber((double)static_cast>(from)); return true; } else { - static_assert(!std::is_const::value, "Only non-const value accepted here"); return nativevalue_to_se::value, T, typename std::add_const::type>>(from, to, ctx); } return false; diff --git a/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp b/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp index 3d421e433b..2a599ef935 100644 --- a/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp +++ b/native/cocos/bindings/manual/jsb_dragonbones_manual.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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 "jsb_dragonbones_manual.h" #include "base/Config.h" diff --git a/native/cocos/bindings/manual/jsb_dragonbones_manual.h b/native/cocos/bindings/manual/jsb_dragonbones_manual.h index 6b4ae2b768..d7c3384625 100644 --- a/native/cocos/bindings/manual/jsb_dragonbones_manual.h +++ b/native/cocos/bindings/manual/jsb_dragonbones_manual.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_extension_manual.cpp b/native/cocos/bindings/manual/jsb_extension_manual.cpp index 21ba6f98c9..a62b8504fd 100644 --- a/native/cocos/bindings/manual/jsb_extension_manual.cpp +++ b/native/cocos/bindings/manual/jsb_extension_manual.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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 "jsb_cocos2dx_extension_manual.h" #include "cocos/scripting/js-bindings/jswrapper/SeApi.h" diff --git a/native/cocos/bindings/manual/jsb_extension_manual.h b/native/cocos/bindings/manual/jsb_extension_manual.h index 04d0a7d046..a065f6fc17 100644 --- a/native/cocos/bindings/manual/jsb_extension_manual.h +++ b/native/cocos/bindings/manual/jsb_extension_manual.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_gfx_manual.cpp b/native/cocos/bindings/manual/jsb_gfx_manual.cpp index 507d0e6e2f..4bd06120ef 100644 --- a/native/cocos/bindings/manual/jsb_gfx_manual.cpp +++ b/native/cocos/bindings/manual/jsb_gfx_manual.cpp @@ -1,43 +1,37 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "jsb_gfx_manual.h" #include "bindings/auto/jsb_gfx_auto.h" #include "bindings/jswrapper/SeApi.h" #include "bindings/manual/jsb_conversions.h" #include "bindings/manual/jsb_global.h" -#if !(defined(CC_USE_GLES2) || defined(CC_USE_GLES3) || defined(CC_USE_VULKAN) || defined(CC_USE_METAL)) - #error "gfx backend is not defined!" -#endif - -#ifdef CC_USE_VULKAN - #include "bindings/auto/jsb_vk_auto.h" - #include "renderer/gfx-vulkan/GFXVulkan.h" -#endif - -#ifdef CC_USE_METAL - #include "bindings/auto/jsb_mtl_auto.h" - #include "renderer/gfx-metal/GFXMTL.h" -#endif - -#ifdef CC_USE_GLES3 - #include "bindings/auto/jsb_gles3_auto.h" - #include "renderer/gfx-gles3/GFXGLES3.h" -#endif - -#ifdef CC_USE_GLES2 - #include "bindings/auto/jsb_gles2_auto.h" - #include "renderer/gfx-gles2/GFXGLES2.h" -#endif - #include #include -#define GFX_MAX_VERTEX_ATTRIBUTES 16 -#define GFX_MAX_TEXTURE_UNITS 16 -#define GFX_MAX_ATTACHMENTS 4 -#define GFX_MAX_BUFFER_BINDINGS 24 -#define GFX_INVALID_BINDING ((uint8_t)-1) -#define GFX_INVALID_HANDLE ((uint)-1) - bool js_gfx_Device_copyBuffersToTexture(se::State &s) { cc::gfx::Device *cobj = (cc::gfx::Device *)s.nativeThisObject(); SE_PRECONDITION2(cobj, false, "js_gfx_Device_copyBuffersToTexture : Invalid Native Object"); @@ -217,10 +211,10 @@ static bool js_gfx_Buffer_initialize(se::State &s) { if (initWithBufferViewInfo) { auto bufferViewInfo = (cc::gfx::BufferViewInfo *)(args[0].toObject()->getPrivateData()); - ok &= cobj->initialize(*bufferViewInfo); + cobj->initialize(*bufferViewInfo); } else { auto bufferInfo = (cc::gfx::BufferInfo *)(args[0].toObject()->getPrivateData()); - ok &= cobj->initialize(*bufferInfo); + cobj->initialize(*bufferInfo); } ok &= boolean_to_seval(ok, &s.rval()); @@ -246,10 +240,10 @@ static bool js_gfx_Texture_initialize(se::State &s) { if (initWithTextureViewInfo) { auto textureViewInfo = (cc::gfx::TextureViewInfo *)(args[0].toObject()->getPrivateData()); - ok &= cobj->initialize(*textureViewInfo); + cobj->initialize(*textureViewInfo); } else { auto textureInfo = (cc::gfx::TextureInfo *)(args[0].toObject()->getPrivateData()); - ok &= cobj->initialize(*textureInfo); + cobj->initialize(*textureInfo); } ok &= boolean_to_seval(ok, &s.rval()); @@ -491,20 +485,11 @@ bool register_all_gfx_manual(se::Object *obj) { } se::Object *ns = nsVal.toObject(); - // js_register_gfx_SubPass(ns); - -#ifdef CC_USE_VULKAN - register_all_vk(obj); -#endif -#ifdef CC_USE_GLES3 - register_all_gles3(obj); -#endif -#ifdef CC_USE_GLES2 - register_all_gles2(obj); -#endif -#ifdef CC_USE_METAL - register_all_mtl(obj); -#endif + { + se::Value jsret; + nativevalue_to_se(cc::gfx::Device::getInstance(), jsret, nullptr); + ns->setProperty("deviceInstance", jsret); + } return true; } diff --git a/native/cocos/bindings/manual/jsb_gfx_manual.h b/native/cocos/bindings/manual/jsb_gfx_manual.h index 2ef13fe69f..bae3d9ab63 100644 --- a/native/cocos/bindings/manual/jsb_gfx_manual.h +++ b/native/cocos/bindings/manual/jsb_gfx_manual.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once namespace se { diff --git a/native/cocos/bindings/manual/jsb_global.cpp b/native/cocos/bindings/manual/jsb_global.cpp index 6c9e56748a..5902dd9ae6 100644 --- a/native/cocos/bindings/manual/jsb_global.cpp +++ b/native/cocos/bindings/manual/jsb_global.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,47 +21,42 @@ 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 "jsb_global.h" -#include "jsb_conversions.h" -#include "xxtea/xxtea.h" -#include "base/ZipUtils.h" +#include "base/CoreStd.h" #include "base/Scheduler.h" #include "base/ThreadPool.h" +#include "base/ZipUtils.h" #include "base/base64.h" +#include "gfx-base/GFXDef.h" +#include "jsb_conversions.h" #include "network/HttpClient.h" #include "platform/Application.h" #include "platform/Image.h" -#include "renderer/core/Core.h" #include "ui/edit-box/EditBox.h" +#include "xxtea/xxtea.h" #if CC_PLATFORM == CC_PLATFORM_ANDROID #include "platform/android/jni/JniImp.h" #endif -#include #include +#include #include using namespace cc; -se::Object *__jsbObj = nullptr; -se::Object *__glObj = nullptr; +static LegacyThreadPool *__threadPool = nullptr; -static ThreadPool *__threadPool = nullptr; - -static std::shared_ptr _localDownloader = nullptr; +static std::shared_ptr _localDownloader = nullptr; static std::map> _localDownloaderHandlers; -static uint64_t _localDownloaderTaskId = 1000000; -static std::string xxteaKey = ""; -void jsb_set_xxtea_key(const std::string &key) { - xxteaKey = key; -} +static uint64_t _localDownloaderTaskId = 1000000; static cc::network::Downloader *localDownloader() { if (!_localDownloader) { - _localDownloader = std::make_shared(); - _localDownloader->onDataTaskSuccess = [=](const cc::network::DownloadTask &task, + _localDownloader = std::make_shared(); + _localDownloader->onDataTaskSuccess = [=](const cc::network::DownloadTask & task, const std::vector &data) { if (data.empty()) { SE_REPORT_ERROR("Getting image from (%s) failed!", task.requestURL.c_str()); @@ -73,8 +68,8 @@ static cc::network::Downloader *localDownloader() { SE_REPORT_ERROR("Getting image from (%s), callback not found!!", task.requestURL.c_str()); return; } - size_t imageBytes = data.size(); - unsigned char *imageData = (unsigned char *)malloc(imageBytes); + size_t imageBytes = data.size(); + unsigned char *imageData = (unsigned char *)malloc(imageBytes); memcpy(imageData, data.data(), imageBytes); (callback->second)("", imageData, static_cast(imageBytes)); @@ -82,9 +77,9 @@ static cc::network::Downloader *localDownloader() { _localDownloaderHandlers.erase(callback); }; _localDownloader->onTaskError = [=](const cc::network::DownloadTask &task, - int errorCode, - int errorCodeInternal, - const std::string &errorStr) { + int errorCode, + int errorCodeInternal, + const std::string & errorStr) { SE_REPORT_ERROR("Getting image from (%s) failed!", task.requestURL.c_str()); _localDownloaderHandlers.erase(task.identifier); }; @@ -95,150 +90,14 @@ static cc::network::Downloader *localDownloader() { static void localDownloaderCreateTask(const std::string &url, std::function callback) { std::stringstream ss; ss << "jsb_loadimage_" << (_localDownloaderTaskId++); - std::string key = ss.str(); - auto task = localDownloader()->createDownloadDataTask(url, key); + std::string key = ss.str(); + auto task = localDownloader()->createDownloadDataTask(url, key); _localDownloaderHandlers.emplace(std::make_pair(task->identifier, callback)); } -static const char *BYTE_CODE_FILE_EXT = ".jsc"; - -static std::string removeFileExt(const std::string &filePath) { - size_t pos = filePath.rfind('.'); - if (0 < pos) { - return filePath.substr(0, pos); - } - return filePath; -} - -void jsb_init_file_operation_delegate() { - static se::ScriptEngine::FileOperationDelegate delegate; - if (!delegate.isValid()) { - delegate.onGetDataFromFile = [](const std::string &path, const std::function &readCallback) -> void { - assert(!path.empty()); - - Data fileData; - - std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT; - if (FileUtils::getInstance()->isFileExist(byteCodePath)) { - fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath); - - size_t dataLen = 0; - uint8_t *data = xxtea_decrypt((unsigned char *)fileData.getBytes(), (uint32_t)fileData.getSize(), (unsigned char *)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), (uint32_t *)&dataLen); - - if (data == nullptr) { - SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); - return; - } - - if (ZipUtils::isGZipBuffer(data, dataLen)) { - uint8_t *unpackedData; - ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); - - if (unpackedData == nullptr) { - SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); - return; - } - - readCallback(unpackedData, unpackedLen); - free(data); - free(unpackedData); - } else { - readCallback(data, dataLen); - free(data); - } - - return; - } - - fileData = FileUtils::getInstance()->getDataFromFile(path); - readCallback(fileData.getBytes(), fileData.getSize()); - }; - - delegate.onGetStringFromFile = [](const std::string &path) -> std::string { - assert(!path.empty()); - - std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT; - if (FileUtils::getInstance()->isFileExist(byteCodePath)) { - Data fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath); - - uint32_t dataLen; - uint8_t *data = xxtea_decrypt((uint8_t *)fileData.getBytes(), (uint32_t)fileData.getSize(), (uint8_t *)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), &dataLen); - - if (data == nullptr) { - SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); - return ""; - } - - if (ZipUtils::isGZipBuffer(data, dataLen)) { - uint8_t *unpackedData; - ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); - if (unpackedData == nullptr) { - SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); - return ""; - } - - std::string ret(reinterpret_cast(unpackedData), unpackedLen); - free(unpackedData); - free(data); - - return ret; - } else { - std::string ret(reinterpret_cast(data), dataLen); - free(data); - return ret; - } - } - - if (FileUtils::getInstance()->isFileExist(path)) { - return FileUtils::getInstance()->getStringFromFile(path); - } else { - SE_LOGE("ScriptEngine::onGetStringFromFile %s not found, possible missing file.\n", path.c_str()); - } - return ""; - }; - - delegate.onGetFullPath = [](const std::string &path) -> std::string { - assert(!path.empty()); - std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT; - if (FileUtils::getInstance()->isFileExist(byteCodePath)) { - return FileUtils::getInstance()->fullPathForFilename(byteCodePath); - } - return FileUtils::getInstance()->fullPathForFilename(path); - }; - - delegate.onCheckFileExist = [](const std::string &path) -> bool { - assert(!path.empty()); - return FileUtils::getInstance()->isFileExist(path); - }; - - assert(delegate.isValid()); - - se::ScriptEngine::getInstance()->setFileOperationDelegate(delegate); - } -} - -bool jsb_enable_debugger(const std::string &debuggerServerAddr, uint32_t port, bool isWaitForConnect) { - if (debuggerServerAddr.empty() || port == 0) - return false; - - auto se = se::ScriptEngine::getInstance(); - se->enableDebugger(debuggerServerAddr.c_str(), port, isWaitForConnect); - - // For debugger main loop - class SimpleRunLoop { - public: - void update(float dt) { - se::ScriptEngine::getInstance()->mainLoopUpdate(); - } - }; - // static SimpleRunLoop runLoop; - //cjh IDEA: Director::getInstance()->getScheduler()->scheduleUpdate(&runLoop, 0, false); - return true; -} - bool jsb_set_extend_property(const char *ns, const char *clsName) { se::Object *globalObj = se::ScriptEngine::getInstance()->getGlobalObject(); - se::Value nsVal; + se::Value nsVal; if (globalObj->getProperty(ns, &nsVal) && nsVal.isObject()) { se::Value ccVal; if (globalObj->getProperty("cc", &ccVal) && ccVal.isObject()) { @@ -263,7 +122,7 @@ std::unordered_map __moduleCache; static bool require(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); assert(argc >= 1); assert(args[0].isString()); @@ -301,7 +160,7 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: secondPath += ".js"; } - fullPath = fileOperationDelegate.onGetFullPath(secondPath); + fullPath = fileOperationDelegate.onGetFullPath(secondPath); scriptBuffer = fileOperationDelegate.onGetStringFromFile(fullPath); } else { fullPath = fileOperationDelegate.onGetFullPath(pathWithSuffix); @@ -317,7 +176,7 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: std::string currentScriptFileDir = FileUtils::getInstance()->getFileDir(fullPath); // Add closure for evalutate the script - char prefix[] = "(function(currentScriptDir){ window.module = window.module || {}; var exports = window.module.exports = {}; "; + char prefix[] = "(function(currentScriptDir){ window.module = window.module || {}; var exports = window.module.exports = {}; "; char suffix[512] = {0}; snprintf(suffix, sizeof(suffix), "\nwindow.module.exports = window.module.exports || exports;\n})('%s'); ", currentScriptFileDir.c_str()); @@ -344,8 +203,8 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: // RENDERER_LOGD("Evaluate: %s", fullPath.c_str()); - auto se = se::ScriptEngine::getInstance(); - bool succeed = se->evalString(scriptBuffer.c_str(), scriptBuffer.length(), nullptr, reletivePath.c_str()); + auto se = se::ScriptEngine::getInstance(); + bool succeed = se->evalString(scriptBuffer.c_str(), scriptBuffer.length(), nullptr, reletivePath.c_str()); se::Value moduleVal; if (succeed && se->getGlobalObject()->getProperty("module", &moduleVal) && moduleVal.isObject()) { se::Value exportsVal; @@ -373,7 +232,7 @@ static bool doModuleRequire(const std::string &path, se::Value *ret, const std:: static bool moduleRequire(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); assert(argc >= 2); assert(args[0].isString()); assert(args[1].isString()); @@ -403,7 +262,7 @@ static bool jsc_dumpNativePtrToSeObjectMap(se::State &s) { struct NamePtrStruct { const char *name; - void *ptr; + void * ptr; }; std::vector namePtrArray; @@ -413,12 +272,12 @@ static bool jsc_dumpNativePtrToSeObjectMap(se::State &s) { assert(jsobj->_getClass() != nullptr); NamePtrStruct tmp; tmp.name = jsobj->_getClass()->getName(); - tmp.ptr = e.first; + tmp.ptr = e.first; namePtrArray.push_back(tmp); } std::sort(namePtrArray.begin(), namePtrArray.end(), [](const NamePtrStruct &a, const NamePtrStruct &b) -> bool { - std::string left = a.name; + std::string left = a.name; std::string right = b.name; for (std::string::const_iterator lit = left.begin(), rit = right.begin(); lit != left.end() && rit != right.end(); ++lit, ++rit) if (::tolower(*lit) < ::tolower(*rit)) @@ -473,7 +332,7 @@ static bool JSBCore_os(se::State &s) { SE_BIND_FUNC(JSBCore_os) static bool JSBCore_getCurrentLanguage(se::State &s) { - std::string languageStr; + std::string languageStr; Application::LanguageType language = Application::getInstance()->getCurrentLanguage(); switch (language) { case Application::LanguageType::ENGLISH: @@ -565,7 +424,7 @@ SE_BIND_FUNC(JSB_core_restartVM) static bool JSB_isObjectValid(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); if (argc == 1) { void *nativePtr = nullptr; seval_to_native_ptr(args[0], &nativePtr); @@ -580,7 +439,7 @@ SE_BIND_FUNC(JSB_isObjectValid) static bool JSB_setCursorEnabled(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); SE_PRECONDITION2(argc == 1, false, "Invalid number of arguments"); bool ok = true, value = true; ok &= seval_to_boolean(args[0], &value); @@ -593,9 +452,9 @@ SE_BIND_FUNC(JSB_setCursorEnabled) static bool JSB_saveByteCode(se::State &s) { const auto &args = s.args(); - int argc = (int)args.size(); + int argc = (int)args.size(); SE_PRECONDITION2(argc == 2, false, "Invalid number of arguments"); - bool ok = true; + bool ok = true; std::string srcfile; std::string dstfile; ok &= seval_to_std_string(args[0], &srcfile); @@ -624,7 +483,7 @@ static bool getOrCreatePlainObject_r(const char *name, se::Object *parent, se::O } static bool js_performance_now(se::State &s) { - auto now = std::chrono::steady_clock::now(); + auto now = std::chrono::steady_clock::now(); auto micro = std::chrono::duration_cast(now - se::ScriptEngine::getInstance()->getStartTime()).count(); s.rval().setNumber((double)micro * 0.001); return true; @@ -633,19 +492,19 @@ SE_BIND_FUNC(js_performance_now) namespace { struct ImageInfo { - uint32_t length = 0; - uint32_t width = 0; - uint32_t height = 0; - uint8_t *data = nullptr; - cc::gfx::Format format = cc::gfx::Format::UNKNOWN; - bool hasAlpha = false; - bool compressed = false; + uint32_t length = 0; + uint32_t width = 0; + uint32_t height = 0; + uint8_t * data = nullptr; + cc::gfx::Format format = cc::gfx::Format::UNKNOWN; + bool hasAlpha = false; + bool compressed = false; }; uint8_t *convertRGB2RGBA(uint32_t length, uint8_t *src) { uint8_t *dst = reinterpret_cast(malloc(length)); for (uint32_t i = 0; i < length; i += 4) { - dst[i] = *src++; + dst[i] = *src++; dst[i + 1] = *src++; dst[i + 2] = *src++; dst[i + 3] = 255; @@ -656,7 +515,7 @@ uint8_t *convertRGB2RGBA(uint32_t length, uint8_t *src) { uint8_t *convertIA2RGBA(uint32_t length, uint8_t *src) { uint8_t *dst = reinterpret_cast(malloc(length)); for (uint32_t i = 0; i < length; i += 4) { - dst[i] = *src; + dst[i] = *src; dst[i + 1] = *src; dst[i + 2] = *src++; dst[i + 3] = *src++; @@ -667,7 +526,7 @@ uint8_t *convertIA2RGBA(uint32_t length, uint8_t *src) { uint8_t *convertI2RGBA(uint32_t length, uint8_t *src) { uint8_t *dst = reinterpret_cast(malloc(length)); for (uint32_t i = 0; i < length; i += 4) { - dst[i] = *src; + dst[i] = *src; dst[i + 1] = *src; dst[i + 2] = *src++; dst[i + 3] = 255; @@ -677,11 +536,11 @@ uint8_t *convertI2RGBA(uint32_t length, uint8_t *src) { struct ImageInfo *createImageInfo(Image *img) { struct ImageInfo *imgInfo = new struct ImageInfo(); - imgInfo->length = (uint32_t)img->getDataLen(); - imgInfo->width = img->getWidth(); - imgInfo->height = img->getHeight(); + imgInfo->length = (uint32_t)img->getDataLen(); + imgInfo->width = img->getWidth(); + imgInfo->height = img->getHeight(); img->takeData(&imgInfo->data); - imgInfo->format = img->getRenderFormat(); + imgInfo->format = img->getRenderFormat(); imgInfo->compressed = img->isCompressed(); // Convert to RGBA888 because standard web api will return only RGBA888. @@ -691,9 +550,9 @@ struct ImageInfo *createImageInfo(Image *img) { // format, or it will cause 0x502 error on OpenGL ES 2. if (!imgInfo->compressed && imgInfo->format != cc::gfx::Format::RGBA8) { imgInfo->length = img->getWidth() * img->getHeight() * 4; - uint8_t *dst = nullptr; + uint8_t *dst = nullptr; uint32_t length = imgInfo->length; - uint8_t *src = imgInfo->data; + uint8_t *src = imgInfo->data; switch (imgInfo->format) { case cc::gfx::Format::A8: case cc::gfx::Format::LA8: @@ -713,7 +572,7 @@ struct ImageInfo *createImageInfo(Image *img) { } if (dst != imgInfo->data) free(imgInfo->data); - imgInfo->data = dst; + imgInfo->data = dst; imgInfo->hasAlpha = true; } @@ -754,8 +613,8 @@ bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal Application::getInstance()->getScheduler()->performFunctionInCocosThread([=]() { se::AutoHandleScope hs; - se::ValueArray seArgs; - se::Value dataVal; + se::ValueArray seArgs; + se::Value dataVal; if (loadSucceed) { se::HandleObject retObj(se::Object::createPlainObject()); @@ -780,12 +639,12 @@ bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal localDownloaderCreateTask(path, initImageFunc); } else if (path.find("data:") == 0 && (pos = path.find("base64,")) != std::string::npos) { - int imageBytes = 0; - unsigned char *imageData = nullptr; - size_t dataStartPos = pos + strlen("base64,"); - const char *base64Data = path.data() + dataStartPos; - size_t dataLen = path.length() - dataStartPos; - imageBytes = base64Decode((const unsigned char *)base64Data, (unsigned int)dataLen, &imageData); + int imageBytes = 0; + unsigned char *imageData = nullptr; + size_t dataStartPos = pos + strlen("base64,"); + const char * base64Data = path.data() + dataStartPos; + size_t dataLen = path.length() - dataStartPos; + imageBytes = base64Decode((const unsigned char *)base64Data, (unsigned int)dataLen, &imageData); if (imageBytes <= 0 || imageData == nullptr) { SE_REPORT_ERROR("Decode base64 image data failed!"); return false; @@ -806,9 +665,9 @@ bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal } static bool js_loadImage(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc == 2) { std::string path; ok &= seval_to_std_string(args[0], &path); @@ -826,9 +685,9 @@ static bool js_loadImage(se::State &s) { SE_BIND_FUNC(js_loadImage) static bool js_destroyImage(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc == 1) { unsigned long data = 0; ok &= seval_to_ulong(args[0], &data); @@ -843,9 +702,9 @@ static bool js_destroyImage(se::State &s) { SE_BIND_FUNC(js_destroyImage) static bool JSB_openURL(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc > 0) { std::string url; ok = seval_to_std_string(args[0], &url); @@ -860,9 +719,9 @@ static bool JSB_openURL(se::State &s) { SE_BIND_FUNC(JSB_openURL) static bool JSB_copyTextToClipboard(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc > 0) { std::string text; ok = seval_to_std_string(args[0], &text); @@ -877,9 +736,9 @@ static bool JSB_copyTextToClipboard(se::State &s) { SE_BIND_FUNC(JSB_copyTextToClipboard) static bool JSB_setPreferredFramesPerSecond(se::State &s) { - const auto &args = s.args(); - size_t argc = args.size(); - CC_UNUSED bool ok = true; + const auto & args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; if (argc > 0) { int32_t fps; ok = seval_to_int32(args[0], &fps); @@ -897,10 +756,10 @@ SE_BIND_FUNC(JSB_setPreferredFramesPerSecond) #if CC_USE_EDITBOX static bool JSB_showInputBox(se::State &s) { const auto &args = s.args(); - size_t argc = args.size(); + size_t argc = args.size(); if (argc == 1) { - bool ok; - se::Value tmp; + bool ok; + se::Value tmp; const auto &obj = args[0].toObject(); cc::EditBox::ShowInfo showInfo; @@ -978,7 +837,7 @@ SE_BIND_FUNC(JSB_hideInputBox) #endif bool jsb_register_global_variables(se::Object *global) { - __threadPool = ThreadPool::newFixedThreadPool(3); + __threadPool = LegacyThreadPool::newFixedThreadPool(3); global->defineFunction("require", _SE(require)); global->defineFunction("requireModule", _SE(moduleRequire)); diff --git a/native/cocos/bindings/manual/jsb_global.h b/native/cocos/bindings/manual/jsb_global.h index 94b7c86a90..9de4c006e3 100644 --- a/native/cocos/bindings/manual/jsb_global.h +++ b/native/cocos/bindings/manual/jsb_global.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,15 +21,11 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once -#include "base/memory/Memory.h" -#include "renderer/core/CoreStd.h" -#include -#include -#include +#include "jsb_global_init.h" template inline typename std::enable_if::value, T>::type * @@ -63,22 +59,14 @@ jsb_override_delete(T *arg) { #define JSB_FREE(kls) jsb_override_delete(kls) namespace se { -class Object; class Class; class Value; } // namespace se -extern se::Object *__jsbObj; -extern se::Object *__glObj; - bool jsb_register_global_variables(se::Object *global); -void jsb_init_file_operation_delegate(); -bool jsb_enable_debugger(const std::string &debuggerServerAddr, uint32_t port, bool isWaitForConnect = false); bool jsb_set_extend_property(const char *ns, const char *clsName); bool jsb_run_script(const std::string &filePath, se::Value *rval = nullptr); bool jsb_run_script_module(const std::string &filePath, se::Value *rval = nullptr); -void jsb_set_xxtea_key(const std::string &key); - bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal); diff --git a/native/cocos/bindings/manual/jsb_global_init.cpp b/native/cocos/bindings/manual/jsb_global_init.cpp new file mode 100644 index 0000000000..7b06342d9b --- /dev/null +++ b/native/cocos/bindings/manual/jsb_global_init.cpp @@ -0,0 +1,182 @@ +/**************************************************************************** + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "jsb_global_init.h" +#include "base/CoreStd.h" +#include "base/Scheduler.h" +#include "base/ZipUtils.h" +#include "base/base64.h" +#include "jsb_conversions.h" +#include "xxtea/xxtea.h" + +#include +#include +#include + +using namespace cc; + +se::Object *__jsbObj = nullptr; +se::Object *__glObj = nullptr; + +static std::string xxteaKey = ""; +void jsb_set_xxtea_key(const std::string &key) { + xxteaKey = key; +} + +static const char *BYTE_CODE_FILE_EXT = ".jsc"; + +static std::string removeFileExt(const std::string &filePath) { + size_t pos = filePath.rfind('.'); + if (0 < pos) { + return filePath.substr(0, pos); + } + return filePath; +} + +void jsb_init_file_operation_delegate() { + static se::ScriptEngine::FileOperationDelegate delegate; + if (!delegate.isValid()) { + delegate.onGetDataFromFile = [](const std::string &path, const std::function &readCallback) -> void { + assert(!path.empty()); + + Data fileData; + + std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT; + if (FileUtils::getInstance()->isFileExist(byteCodePath)) { + fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath); + + size_t dataLen = 0; + uint8_t *data = xxtea_decrypt((unsigned char *)fileData.getBytes(), (uint32_t)fileData.getSize(), (unsigned char *)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), (uint32_t *)&dataLen); + + if (data == nullptr) { + SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); + return; + } + + if (ZipUtils::isGZipBuffer(data, dataLen)) { + uint8_t *unpackedData; + ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); + + if (unpackedData == nullptr) { + SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); + return; + } + + readCallback(unpackedData, unpackedLen); + free(data); + free(unpackedData); + } else { + readCallback(data, dataLen); + free(data); + } + + return; + } + + fileData = FileUtils::getInstance()->getDataFromFile(path); + readCallback(fileData.getBytes(), fileData.getSize()); + }; + + delegate.onGetStringFromFile = [](const std::string &path) -> std::string { + assert(!path.empty()); + + std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT; + if (FileUtils::getInstance()->isFileExist(byteCodePath)) { + Data fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath); + + uint32_t dataLen; + uint8_t *data = xxtea_decrypt((uint8_t *)fileData.getBytes(), (uint32_t)fileData.getSize(), (uint8_t *)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), &dataLen); + + if (data == nullptr) { + SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); + return ""; + } + + if (ZipUtils::isGZipBuffer(data, dataLen)) { + uint8_t *unpackedData; + ssize_t unpackedLen = ZipUtils::inflateMemory(data, dataLen, &unpackedData); + if (unpackedData == nullptr) { + SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str()); + return ""; + } + + std::string ret(reinterpret_cast(unpackedData), unpackedLen); + free(unpackedData); + free(data); + + return ret; + } else { + std::string ret(reinterpret_cast(data), dataLen); + free(data); + return ret; + } + } + + if (FileUtils::getInstance()->isFileExist(path)) { + return FileUtils::getInstance()->getStringFromFile(path); + } else { + SE_LOGE("ScriptEngine::onGetStringFromFile %s not found, possible missing file.\n", path.c_str()); + } + return ""; + }; + + delegate.onGetFullPath = [](const std::string &path) -> std::string { + assert(!path.empty()); + std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT; + if (FileUtils::getInstance()->isFileExist(byteCodePath)) { + return FileUtils::getInstance()->fullPathForFilename(byteCodePath); + } + return FileUtils::getInstance()->fullPathForFilename(path); + }; + + delegate.onCheckFileExist = [](const std::string &path) -> bool { + assert(!path.empty()); + return FileUtils::getInstance()->isFileExist(path); + }; + + assert(delegate.isValid()); + + se::ScriptEngine::getInstance()->setFileOperationDelegate(delegate); + } +} + +bool jsb_enable_debugger(const std::string &debuggerServerAddr, uint32_t port, bool isWaitForConnect) { + if (debuggerServerAddr.empty() || port == 0) + return false; + + auto se = se::ScriptEngine::getInstance(); + se->enableDebugger(debuggerServerAddr.c_str(), port, isWaitForConnect); + + // For debugger main loop + class SimpleRunLoop { + public: + void update(float dt) { + se::ScriptEngine::getInstance()->mainLoopUpdate(); + } + }; + // static SimpleRunLoop runLoop; + //cjh IDEA: Director::getInstance()->getScheduler()->scheduleUpdate(&runLoop, 0, false); + return true; +} diff --git a/native/cocos/bindings/manual/jsb_global_init.h b/native/cocos/bindings/manual/jsb_global_init.h new file mode 100644 index 0000000000..b6ad1f0682 --- /dev/null +++ b/native/cocos/bindings/manual/jsb_global_init.h @@ -0,0 +1,43 @@ +/**************************************************************************** + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/CoreStd.h" +#include "base/memory/Memory.h" +#include +#include +#include + +namespace se { +class Object; +} // namespace se + +extern se::Object *__jsbObj; +extern se::Object *__glObj; + +void jsb_init_file_operation_delegate(); +void jsb_set_xxtea_key(const std::string &key); +bool jsb_enable_debugger(const std::string &debuggerServerAddr, uint32_t port, bool isWaitForConnect = false); diff --git a/native/cocos/bindings/manual/jsb_helper.cpp b/native/cocos/bindings/manual/jsb_helper.cpp index da208034c9..1160a5f5de 100644 --- a/native/cocos/bindings/manual/jsb_helper.cpp +++ b/native/cocos/bindings/manual/jsb_helper.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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 "jsb_helper.h" diff --git a/native/cocos/bindings/manual/jsb_helper.h b/native/cocos/bindings/manual/jsb_helper.h index f7357d10f9..1e43edfb21 100644 --- a/native/cocos/bindings/manual/jsb_helper.h +++ b/native/cocos/bindings/manual/jsb_helper.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_module_register.cpp b/native/cocos/bindings/manual/jsb_module_register.cpp index 1ded4cd0d0..ca5082d21a 100644 --- a/native/cocos/bindings/manual/jsb_module_register.cpp +++ b/native/cocos/bindings/manual/jsb_module_register.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_module_register.h" #include "cocos/bindings/auto/jsb_cocos_auto.h" @@ -91,6 +92,10 @@ #endif // USE_MIDDLEWARE +#if USE_PHYSICS_PHYSX + #include "cocos/bindings/auto/jsb_physics_auto.h" +#endif + using namespace cc; bool jsb_register_all_modules() { @@ -155,6 +160,10 @@ bool jsb_register_all_modules() { #endif // USE_MIDDLEWARE +#if USE_PHYSICS_PHYSX + se->addRegisterCallback(register_all_physics); +#endif + #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_ANDROID) #if USE_VIDEO diff --git a/native/cocos/bindings/manual/jsb_module_register.h b/native/cocos/bindings/manual/jsb_module_register.h index deea2af570..c0123167d5 100644 --- a/native/cocos/bindings/manual/jsb_module_register.h +++ b/native/cocos/bindings/manual/jsb_module_register.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_network_manual.cpp b/native/cocos/bindings/manual/jsb_network_manual.cpp index 34285417ef..4dbc37ea57 100644 --- a/native/cocos/bindings/manual/jsb_network_manual.cpp +++ b/native/cocos/bindings/manual/jsb_network_manual.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "base/Config.h" #include "jsb_network_manual.h" #include "bindings/manual/jsb_conversions.h" diff --git a/native/cocos/bindings/manual/jsb_network_manual.h b/native/cocos/bindings/manual/jsb_network_manual.h index 5c9ee04acb..7a23e2108e 100644 --- a/native/cocos/bindings/manual/jsb_network_manual.h +++ b/native/cocos/bindings/manual/jsb_network_manual.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_pipeline_manual.cpp b/native/cocos/bindings/manual/jsb_pipeline_manual.cpp index 42b9909f83..2db7174dec 100644 --- a/native/cocos/bindings/manual/jsb_pipeline_manual.cpp +++ b/native/cocos/bindings/manual/jsb_pipeline_manual.cpp @@ -1,9 +1,34 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "cocos/bindings/auto/jsb_gfx_auto.h" #include "cocos/bindings/auto/jsb_pipeline_auto.h" #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/bindings/manual/jsb_global.h" -#include "renderer/core/gfx/GFXPipelineState.h" +#include "gfx-base/GFXPipelineState.h" #include "renderer/pipeline/Define.h" #include "renderer/pipeline/PipelineStateManager.h" #include "renderer/pipeline/RenderPipeline.h" diff --git a/native/cocos/bindings/manual/jsb_pipeline_manual.h b/native/cocos/bindings/manual/jsb_pipeline_manual.h index d122b7d5cb..9fdcedc89b 100644 --- a/native/cocos/bindings/manual/jsb_pipeline_manual.h +++ b/native/cocos/bindings/manual/jsb_pipeline_manual.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once namespace se { diff --git a/native/cocos/bindings/manual/jsb_platform.h b/native/cocos/bindings/manual/jsb_platform.h index f606e4c6b1..f1d293e01a 100644 --- a/native/cocos/bindings/manual/jsb_platform.h +++ b/native/cocos/bindings/manual/jsb_platform.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_platform_android.cpp b/native/cocos/bindings/manual/jsb_platform_android.cpp index d5284033ce..d45ec1d29f 100644 --- a/native/cocos/bindings/manual/jsb_platform_android.cpp +++ b/native/cocos/bindings/manual/jsb_platform_android.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "jsb_platform.h" #include "cocos/bindings/jswrapper/SeApi.h" diff --git a/native/cocos/bindings/manual/jsb_platfrom_apple.mm b/native/cocos/bindings/manual/jsb_platfrom_apple.mm index 88ea31212b..dc8dc7dcfc 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_apple.mm +++ b/native/cocos/bindings/manual/jsb_platfrom_apple.mm @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #import "jsb_platform.h" diff --git a/native/cocos/bindings/manual/jsb_platfrom_win32.cpp b/native/cocos/bindings/manual/jsb_platfrom_win32.cpp index 23b8c41be8..6bb9106432 100644 --- a/native/cocos/bindings/manual/jsb_platfrom_win32.cpp +++ b/native/cocos/bindings/manual/jsb_platfrom_win32.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,13 +21,13 @@ 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 "jsb_platform.h" #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_conversions.h" -#include "cocos/bindings/manual/jsb_global.h" +#include "cocos/bindings/manual/jsb_global_init.h" #include "cocos/platform/FileUtils.h" #include diff --git a/native/cocos/bindings/manual/jsb_socketio.cpp b/native/cocos/bindings/manual/jsb_socketio.cpp index 9e9b3b5e98..960cd911b0 100644 --- a/native/cocos/bindings/manual/jsb_socketio.cpp +++ b/native/cocos/bindings/manual/jsb_socketio.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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 "jsb_socketio.h" diff --git a/native/cocos/bindings/manual/jsb_socketio.h b/native/cocos/bindings/manual/jsb_socketio.h index 33e79013e8..cbf1808c83 100644 --- a/native/cocos/bindings/manual/jsb_socketio.h +++ b/native/cocos/bindings/manual/jsb_socketio.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_spine_manual.cpp b/native/cocos/bindings/manual/jsb_spine_manual.cpp index 43f4f5dc9b..0a06f5b3c3 100644 --- a/native/cocos/bindings/manual/jsb_spine_manual.cpp +++ b/native/cocos/bindings/manual/jsb_spine_manual.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "jsb_spine_manual.h" #include "base/Config.h" diff --git a/native/cocos/bindings/manual/jsb_spine_manual.h b/native/cocos/bindings/manual/jsb_spine_manual.h index e65d923123..53cfb0048f 100644 --- a/native/cocos/bindings/manual/jsb_spine_manual.h +++ b/native/cocos/bindings/manual/jsb_spine_manual.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once #include "cocos/bindings/jswrapper/SeApi.h" diff --git a/native/cocos/bindings/manual/jsb_websocket.cpp b/native/cocos/bindings/manual/jsb_websocket.cpp index 4686288ff4..380e54c6bd 100644 --- a/native/cocos/bindings/manual/jsb_websocket.cpp +++ b/native/cocos/bindings/manual/jsb_websocket.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "base/Config.h" #include "jsb_websocket.h" #if (USE_SOCKET > 0) diff --git a/native/cocos/bindings/manual/jsb_websocket.h b/native/cocos/bindings/manual/jsb_websocket.h index 001a813356..8fa6af2926 100644 --- a/native/cocos/bindings/manual/jsb_websocket.h +++ b/native/cocos/bindings/manual/jsb_websocket.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/bindings/manual/jsb_websocket_server.cpp b/native/cocos/bindings/manual/jsb_websocket_server.cpp index f3de52c15a..e52845a4e3 100644 --- a/native/cocos/bindings/manual/jsb_websocket_server.cpp +++ b/native/cocos/bindings/manual/jsb_websocket_server.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #if (USE_SOCKET > 0) && (USE_WEBSOCKET_SERVER > 0) diff --git a/native/cocos/bindings/manual/jsb_websocket_server.h b/native/cocos/bindings/manual/jsb_websocket_server.h index abc87945a4..cb703aa311 100644 --- a/native/cocos/bindings/manual/jsb_websocket_server.h +++ b/native/cocos/bindings/manual/jsb_websocket_server.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once #if (USE_SOCKET > 0) && (USE_WEBSOCKET_SERVER > 0) diff --git a/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp b/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp index 84efa9a2ce..476cf7ba08 100644 --- a/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp +++ b/native/cocos/bindings/manual/jsb_xmlhttprequest.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ // // jsb_XMLHttpRequest.cpp diff --git a/native/cocos/bindings/manual/jsb_xmlhttprequest.h b/native/cocos/bindings/manual/jsb_xmlhttprequest.h index 0564b3cf44..ecc23ad143 100644 --- a/native/cocos/bindings/manual/jsb_xmlhttprequest.h +++ b/native/cocos/bindings/manual/jsb_xmlhttprequest.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/editor-support/IOBuffer.cpp b/native/cocos/editor-support/IOBuffer.cpp index 6f4d5c3862..f3d9c0fedb 100644 --- a/native/cocos/editor-support/IOBuffer.cpp +++ b/native/cocos/editor-support/IOBuffer.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "IOBuffer.h" MIDDLEWARE_BEGIN diff --git a/native/cocos/editor-support/IOBuffer.h b/native/cocos/editor-support/IOBuffer.h index 04a12970ff..3d2eb0ac60 100644 --- a/native/cocos/editor-support/IOBuffer.h +++ b/native/cocos/editor-support/IOBuffer.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "MiddlewareMacro.h" #include "base/Macros.h" diff --git a/native/cocos/editor-support/IOTypedArray.cpp b/native/cocos/editor-support/IOTypedArray.cpp index 15e404d87d..68ddfcb841 100644 --- a/native/cocos/editor-support/IOTypedArray.cpp +++ b/native/cocos/editor-support/IOTypedArray.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "IOTypedArray.h" #include "TypedArrayPool.h" diff --git a/native/cocos/editor-support/IOTypedArray.h b/native/cocos/editor-support/IOTypedArray.h index 1500179af9..d5a65af44b 100644 --- a/native/cocos/editor-support/IOTypedArray.h +++ b/native/cocos/editor-support/IOTypedArray.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "IOBuffer.h" diff --git a/native/cocos/editor-support/MeshBuffer.cpp b/native/cocos/editor-support/MeshBuffer.cpp index ebba74a32b..0d7a975da1 100644 --- a/native/cocos/editor-support/MeshBuffer.cpp +++ b/native/cocos/editor-support/MeshBuffer.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,7 @@ 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 "MeshBuffer.h" @@ -50,8 +51,8 @@ MeshBuffer::~MeshBuffer() { } void MeshBuffer::clear() { - auto num = _vbArr.size(); - for (auto i = 0; i < num; i++) { + size_t num = _vbArr.size(); + for (size_t i = 0; i < num; i++) { delete _ibArr[i]; delete _vbArr[i]; } @@ -61,46 +62,46 @@ void MeshBuffer::clear() { void MeshBuffer::afterCleanupHandle() { clear(); - se::ScriptEngine::getInstance()->addAfterInitHook(std::bind(&MeshBuffer::init, this)); + se::ScriptEngine::getInstance()->addAfterInitHook([this] { init(); }); } void MeshBuffer::init() { - auto rIB = new IOTypedArray(se::Object::TypedArrayType::UINT16, _ib.getCapacity()); + auto *rIB = new IOTypedArray(se::Object::TypedArrayType::UINT16, _ib.getCapacity()); _ibArr.push_back(rIB); - auto rVB = new IOTypedArray(se::Object::TypedArrayType::FLOAT32, _vb.getCapacity()); + auto *rVB = new IOTypedArray(se::Object::TypedArrayType::FLOAT32, _vb.getCapacity()); _vbArr.push_back(rVB); - se::ScriptEngine::getInstance()->addAfterCleanupHook(std::bind(&MeshBuffer::afterCleanupHandle, this)); + se::ScriptEngine::getInstance()->addAfterCleanupHook([this] { afterCleanupHandle(); }); } void MeshBuffer::uploadVB() { auto length = _vb.length(); if (length == 0) return; - auto rVB = _vbArr[_bufferPos]; + auto *rVB = _vbArr[_bufferPos]; rVB->reset(); - rVB->writeBytes((const char *)_vb.getBuffer(), _vb.length()); + rVB->writeBytes(reinterpret_cast(_vb.getBuffer()), _vb.length()); } void MeshBuffer::uploadIB() { auto length = _ib.length(); if (length == 0) return; - auto rIB = _ibArr[_bufferPos]; + auto *rIB = _ibArr[_bufferPos]; rIB->reset(); - rIB->writeBytes((const char *)_ib.getBuffer(), _ib.length()); + rIB->writeBytes(reinterpret_cast(_ib.getBuffer()), _ib.length()); } void MeshBuffer::next() { _bufferPos++; if (_ibArr.size() <= _bufferPos) { - auto rIB = new IOTypedArray(se::Object::TypedArrayType::UINT16, _ib.getCapacity()); + auto *rIB = new IOTypedArray(se::Object::TypedArrayType::UINT16, _ib.getCapacity()); _ibArr.push_back(rIB); } if (_vbArr.size() <= _bufferPos) { - auto rVB = new IOTypedArray(se::Object::TypedArrayType::FLOAT32, _vb.getCapacity()); + auto *rVB = new IOTypedArray(se::Object::TypedArrayType::FLOAT32, _vb.getCapacity()); _vbArr.push_back(rVB); } } diff --git a/native/cocos/editor-support/MeshBuffer.h b/native/cocos/editor-support/MeshBuffer.h index 8c491d2498..76066a4188 100644 --- a/native/cocos/editor-support/MeshBuffer.h +++ b/native/cocos/editor-support/MeshBuffer.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "IOBuffer.h" @@ -31,7 +33,7 @@ MIDDLEWARE_BEGIN class MeshBuffer { public: - MeshBuffer(int vertexFormat); + explicit MeshBuffer(int vertexFormat); MeshBuffer(int vertexFormat, size_t indexSize, size_t vertexSize); virtual ~MeshBuffer(); @@ -56,11 +58,11 @@ public: return _ibArr[bufferPos]->length(); } - std::size_t getBufferCount() { + std::size_t getBufferCount() const { return _bufferPos + 1; } - std::size_t getBufferPos() { + std::size_t getBufferPos() const { return _bufferPos; } @@ -82,10 +84,8 @@ private: void init(); void afterCleanupHandle(); -private: std::vector _ibArr; std::vector _vbArr; - std::size_t _bufferPos = 0; IOBuffer _vb; IOBuffer _ib; diff --git a/native/cocos/editor-support/MiddlewareMacro.h b/native/cocos/editor-support/MiddlewareMacro.h index ba9ef68091..ac7d292081 100644 --- a/native/cocos/editor-support/MiddlewareMacro.h +++ b/native/cocos/editor-support/MiddlewareMacro.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once // index buffer init capacity #define INIT_INDEX_BUFFER_SIZE 1024000 @@ -46,6 +48,6 @@ #define USING_NS_MW using namespace cc::middleware #endif -// R G B A ·ֱðռÓÃ32λ +// R G B A �ֱ�ռ��32λ #define VF_XYZUVC 9 #define VF_XYZUVCC 13 diff --git a/native/cocos/editor-support/MiddlewareManager.cpp b/native/cocos/editor-support/MiddlewareManager.cpp index d93f5d7f46..6bdb396b9a 100644 --- a/native/cocos/editor-support/MiddlewareManager.cpp +++ b/native/cocos/editor-support/MiddlewareManager.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "MiddlewareManager.h" #include "SeApi.h" #include diff --git a/native/cocos/editor-support/MiddlewareManager.h b/native/cocos/editor-support/MiddlewareManager.h index 87fcf0e7e5..7f3f4ae84b 100644 --- a/native/cocos/editor-support/MiddlewareManager.h +++ b/native/cocos/editor-support/MiddlewareManager.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "MeshBuffer.h" diff --git a/native/cocos/editor-support/SharedBufferManager.cpp b/native/cocos/editor-support/SharedBufferManager.cpp index f7fb8cfeec..d757983c12 100644 --- a/native/cocos/editor-support/SharedBufferManager.cpp +++ b/native/cocos/editor-support/SharedBufferManager.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,7 @@ 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 "SharedBufferManager.h" #include "base/Macros.h" diff --git a/native/cocos/editor-support/SharedBufferManager.h b/native/cocos/editor-support/SharedBufferManager.h index c4a0edeab5..b272fdb3fc 100644 --- a/native/cocos/editor-support/SharedBufferManager.h +++ b/native/cocos/editor-support/SharedBufferManager.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/editor-support/TypedArrayPool.cpp b/native/cocos/editor-support/TypedArrayPool.cpp index 153f240155..69887bad4c 100644 --- a/native/cocos/editor-support/TypedArrayPool.cpp +++ b/native/cocos/editor-support/TypedArrayPool.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "TypedArrayPool.h" #include "MiddlewareMacro.h" #include "base/Log.h" @@ -36,17 +38,17 @@ fflush(stdout); \ } while (false) #else -#define PoolLog(...) +#define POOL_LOG(...) #endif MIDDLEWARE_BEGIN -const static std::size_t maxPoolSize = 50; +const static std::size_t MAX_POOL_SIZE = 50; -TypedArrayPool *TypedArrayPool::_instance = nullptr; +TypedArrayPool *TypedArrayPool::instance = nullptr; TypedArrayPool::TypedArrayPool() { - se::ScriptEngine::getInstance()->addAfterCleanupHook(std::bind(&TypedArrayPool::afterCleanupHandle, this)); + se::ScriptEngine::getInstance()->addAfterCleanupHook([this] { afterCleanupHandle(); }); } TypedArrayPool::~TypedArrayPool() { @@ -54,30 +56,30 @@ TypedArrayPool::~TypedArrayPool() { } void TypedArrayPool::afterCleanupHandle() { - this->allowPush = false; + this->_allowPush = false; clearPool(); - se::ScriptEngine::getInstance()->addAfterInitHook(std::bind(&TypedArrayPool::afterInitHandle, this)); + se::ScriptEngine::getInstance()->addAfterInitHook([this] { afterInitHandle(); }); } void TypedArrayPool::afterInitHandle() { - this->allowPush = true; - se::ScriptEngine::getInstance()->addAfterCleanupHook(std::bind(&TypedArrayPool::afterCleanupHandle, this)); + this->_allowPush = true; + se::ScriptEngine::getInstance()->addAfterCleanupHook([this] { afterCleanupHandle(); }); } void TypedArrayPool::clearPool() { - PoolLog("*****clearPool TypeArray pool begin"); + POOL_LOG("*****clearPool TypeArray pool begin"); //map - for (auto it = _pool.begin(); it != _pool.end(); it++) { + for (auto & it : _pool) { //map - fitMap &mapPool = *(it->second); - for (auto itMapPool = mapPool.begin(); itMapPool != mapPool.end(); itMapPool++) { + fitMap &mapPool = *(it.second); + for (auto & itMapPool : mapPool) { //vector - objPool &itFitPool = *(itMapPool->second); - PoolLog("clear arrayType:%d,fitSize:%lu,objSize:%lu\n", it->first, itMapPool->first, itFitPool.size()); - for (auto itFit = itFitPool.begin(); itFit != itFitPool.end(); itFit++) { - (*itFit)->unroot(); - (*itFit)->decRef(); + objPool &itFitPool = *(itMapPool.second); + POOL_LOG("clear arrayType:%d,fitSize:%lu,objSize:%lu\n", it->first, itMapPool->first, itFitPool.size()); + for (auto & itFit : itFitPool) { + itFit->unroot(); + itFit->decRef(); } delete &itFitPool; } @@ -85,36 +87,36 @@ void TypedArrayPool::clearPool() { } _pool.clear(); - PoolLog("*****clearPool TypeArray pool end"); + POOL_LOG("*****clearPool TypeArray pool end"); } void TypedArrayPool::dump() { //map - for (auto it = _pool.begin(); it != _pool.end(); it++) { + for (auto & it : _pool) { //map - fitMap &mapPool = *(it->second); - for (auto itMapPool = mapPool.begin(); itMapPool != mapPool.end(); itMapPool++) { + fitMap &mapPool = *(it.second); + for (auto & itMapPool : mapPool) { //vector - CC_UNUSED objPool &itFitPool = *(itMapPool->second); - PoolLog("arrayType:%d,fitSize:%lu,objSize:%lu\n", it->first, itMapPool->first, itFitPool.size()); + CC_UNUSED objPool &itFitPool = *(itMapPool.second); + POOL_LOG("arrayType:%d,fitSize:%lu,objSize:%lu\n", it->first, itMapPool->first, itFitPool.size()); } } } se::Object *TypedArrayPool::pop(arrayType type, std::size_t size) { - std::size_t fitSize = ceil(size / float(MIN_TYPE_ARRAY_SIZE)) * MIN_TYPE_ARRAY_SIZE; + auto fitSize = static_cast(ceil(size / float(MIN_TYPE_ARRAY_SIZE)) * MIN_TYPE_ARRAY_SIZE); objPool *objPoolPtr = getObjPool(type, fitSize); - if (objPoolPtr->size() > 0) { + if (!objPoolPtr->empty()) { se::Object *obj = objPoolPtr->back(); objPoolPtr->pop_back(); - PoolLog("TypedArrayPool:pop result:success,type:%d,fitSize:%lu,objSize:%lu\n", (int)type, fitSize, objPoolPtr->size()); + POOL_LOG("TypedArrayPool:pop result:success,type:%d,fitSize:%lu,objSize:%lu\n", (int)type, fitSize, objPoolPtr->size()); return obj; } - PoolLog("TypedArrayPool:pop result:empty,type:%d,fitSize:%lu,objSize:%lu\n", (int)type, fitSize, objPoolPtr->size()); + POOL_LOG("TypedArrayPool:pop result:empty,type:%d,fitSize:%lu,objSize:%lu\n", (int)type, fitSize, objPoolPtr->size()); se::AutoHandleScope hs; - auto typeArray = se::Object::createTypedArray(type, nullptr, fitSize); + auto *typeArray = se::Object::createTypedArray(type, nullptr, fitSize); typeArray->root(); return typeArray; } @@ -145,24 +147,24 @@ void TypedArrayPool::push(arrayType type, std::size_t arrayCapacity, se::Object if (object == nullptr) return; // If script engine is cleaning,delete object directly - if (!allowPush) { + if (!_allowPush) { object->unroot(); object->decRef(); object = nullptr; - PoolLog("TypedArrayPool:push result:not allow,type:%d,arrayCapacity:%lu\n", (int)type, arrayCapacity); + POOL_LOG("TypedArrayPool:push result:not allow,type:%d,arrayCapacity:%lu\n", (int)type, arrayCapacity); return; } objPool *objPoolPtr = getObjPool(type, arrayCapacity); auto it = std::find(objPoolPtr->begin(), objPoolPtr->end(), object); if (it != objPoolPtr->end()) { - PoolLog("TypedArrayPool:push result:repeat\n"); + POOL_LOG("TypedArrayPool:push result:repeat\n"); return; } - if (objPoolPtr->size() < maxPoolSize) { + if (objPoolPtr->size() < MAX_POOL_SIZE) { objPoolPtr->push_back(object); - PoolLog("TypedArrayPool:push result:success,type:%d,arrayCapacity:%lu,objSize:%lu\n", (int)type, arrayCapacity, objPoolPtr->size()); + POOL_LOG("TypedArrayPool:push result:success,type:%d,arrayCapacity:%lu,objSize:%lu\n", (int)type, arrayCapacity, objPoolPtr->size()); } else { object->unroot(); object->decRef(); diff --git a/native/cocos/editor-support/TypedArrayPool.h b/native/cocos/editor-support/TypedArrayPool.h index f1b3751864..85bebbc780 100644 --- a/native/cocos/editor-support/TypedArrayPool.h +++ b/native/cocos/editor-support/TypedArrayPool.h @@ -1,19 +1,19 @@ - /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -21,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "MiddlewareMacro.h" #include "SeApi.h" @@ -34,28 +35,28 @@ MIDDLEWARE_BEGIN */ class TypedArrayPool { private: - static TypedArrayPool *_instance; + static TypedArrayPool *instance; public: static TypedArrayPool *getInstance() { - if (_instance == nullptr) { - _instance = new TypedArrayPool(); + if (instance == nullptr) { + instance = new TypedArrayPool(); } - return _instance; + return instance; } static void destroyInstance() { - if (_instance) { - delete _instance; - _instance = nullptr; + if (instance) { + delete instance; + instance = nullptr; } } private: - typedef se::Object::TypedArrayType arrayType; - typedef std::vector objPool; - typedef std::map fitMap; - typedef std::map typeMap; + using arrayType = se::Object::TypedArrayType; + using objPool = std::vector; + using fitMap = std::map; + using typeMap = std::map; objPool *getObjPool(arrayType type, std::size_t size); @@ -71,9 +72,9 @@ private: void afterCleanupHandle(); void afterInitHandle(); -private: + typeMap _pool; - bool allowPush = true; + bool _allowPush = true; public: /** diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp index 97933e7db8..452d3b1964 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureCacheDisplay.cpp @@ -29,7 +29,7 @@ #include "base/TypeDef.h" #include "base/memory/Memory.h" #include "math/Math.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" using namespace cc; using namespace cc::gfx; diff --git a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp index 684f5d3568..6f756de34a 100644 --- a/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp +++ b/native/cocos/editor-support/dragonbones-creator-support/CCArmatureDisplay.cpp @@ -29,7 +29,7 @@ #include "dragonbones-creator-support/CCSlot.h" #include "math/Math.h" #include "math/Vec3.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" USING_NS_MW; using namespace cc; diff --git a/native/cocos/editor-support/middleware-adapter.cpp b/native/cocos/editor-support/middleware-adapter.cpp index 0d7a579453..2cc426f9ed 100644 --- a/native/cocos/editor-support/middleware-adapter.cpp +++ b/native/cocos/editor-support/middleware-adapter.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "middleware-adapter.h" #include "base/Macros.h" diff --git a/native/cocos/editor-support/middleware-adapter.h b/native/cocos/editor-support/middleware-adapter.h index 5595583534..5dff899a4e 100644 --- a/native/cocos/editor-support/middleware-adapter.h +++ b/native/cocos/editor-support/middleware-adapter.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "MiddlewareMacro.h" diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp index a0979c52b2..02aff79ab9 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp @@ -34,7 +34,7 @@ #include "base/TypeDef.h" #include "base/memory/Memory.h" #include "math/Math.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" USING_NS_MW; diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp index 7aa5a5ca59..4fa960efe7 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp @@ -35,7 +35,7 @@ #include "base/memory/Memory.h" #include "math/Math.h" #include "math/Vec3.h" -#include "core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" #include "spine-creator-support/AttachmentVertices.h" #include "spine-creator-support/spine-cocos2dx.h" #include diff --git a/native/cocos/math/Mat3.cpp b/native/cocos/math/Mat3.cpp index 8455dad55f..a45174594f 100644 --- a/native/cocos/math/Mat3.cpp +++ b/native/cocos/math/Mat3.cpp @@ -118,7 +118,7 @@ void Mat3::inverse() { // Calculate the determinant float det = a00 * b01 + a01 * b11 + a02 * b21; - det = 1.0 / det; + det = 1.0f / det; m[0] = b01 * det; m[1] = (-a22 * a01 + a02 * a21) * det; m[2] = (a12 * a01 - a02 * a11) * det; diff --git a/native/cocos/math/Mat4.cpp b/native/cocos/math/Mat4.cpp index 52847c116d..be5d0634d3 100644 --- a/native/cocos/math/Mat4.cpp +++ b/native/cocos/math/Mat4.cpp @@ -147,7 +147,7 @@ void Mat4::createOrthographicOffCenter(float left, float right, float bottom, fl GP_ASSERT(top != bottom); GP_ASSERT(zFarPlane != zNearPlane); - memset(dst, 0.0f, MATRIX_SIZE); + memset(dst, 0, MATRIX_SIZE); dst->m[0] = 2.0f / (right - left); dst->m[5] = 2.0f / (top - bottom) * projectionSignY; dst->m[10] = (1.0f - minClipZ) / (zNearPlane - zFarPlane); diff --git a/native/cocos/network/Downloader-android.cpp b/native/cocos/network/Downloader-android.cpp index 4ade435588..19ec8b1d3d 100644 --- a/native/cocos/network/Downloader-android.cpp +++ b/native/cocos/network/Downloader-android.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 "network/Downloader-android.h" diff --git a/native/cocos/network/Downloader-android.h b/native/cocos/network/Downloader-android.h index 6972f7557d..a93e9c7525 100644 --- a/native/cocos/network/Downloader-android.h +++ b/native/cocos/network/Downloader-android.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/network/Downloader-curl.cpp b/native/cocos/network/Downloader-curl.cpp index 19fd004959..3f46c0e7a2 100644 --- a/native/cocos/network/Downloader-curl.cpp +++ b/native/cocos/network/Downloader-curl.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,8 @@ 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 "network/Downloader-curl.h" #include diff --git a/native/cocos/network/Downloader-curl.h b/native/cocos/network/Downloader-curl.h index c7695cc3fa..697959f961 100644 --- a/native/cocos/network/Downloader-curl.h +++ b/native/cocos/network/Downloader-curl.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/network/Downloader.cpp b/native/cocos/network/Downloader.cpp index 5ad64d1c11..433a05e2ee 100644 --- a/native/cocos/network/Downloader.cpp +++ b/native/cocos/network/Downloader.cpp @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2015-2016 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,7 @@ 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 "network/Downloader.h" diff --git a/native/cocos/network/Downloader.h b/native/cocos/network/Downloader.h index f330f4aea8..99a8fb4853 100644 --- a/native/cocos/network/Downloader.h +++ b/native/cocos/network/Downloader.h @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2015-2016 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/network/DownloaderImpl-apple.h b/native/cocos/network/DownloaderImpl-apple.h index 728a36bfd7..97c3ab7222 100644 --- a/native/cocos/network/DownloaderImpl-apple.h +++ b/native/cocos/network/DownloaderImpl-apple.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/network/DownloaderImpl-apple.mm b/native/cocos/network/DownloaderImpl-apple.mm index dab6a8752b..905cc30490 100644 --- a/native/cocos/network/DownloaderImpl-apple.mm +++ b/native/cocos/network/DownloaderImpl-apple.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2015-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 "network/DownloaderImpl-apple.h" #include diff --git a/native/cocos/network/DownloaderImpl.h b/native/cocos/network/DownloaderImpl.h index b9bdf33850..232262dbc1 100644 --- a/native/cocos/network/DownloaderImpl.h +++ b/native/cocos/network/DownloaderImpl.h @@ -1,26 +1,27 @@ /**************************************************************************** -Copyright (c) 2015-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2015-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #pragma once diff --git a/native/cocos/network/HttpAsynConnection-apple.h b/native/cocos/network/HttpAsynConnection-apple.h index c3db8d0fab..c9edd71e86 100644 --- a/native/cocos/network/HttpAsynConnection-apple.h +++ b/native/cocos/network/HttpAsynConnection-apple.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 __HTTPASYNCONNECTION_H__ #define __HTTPASYNCONNECTION_H__ diff --git a/native/cocos/network/HttpClient-android.cpp b/native/cocos/network/HttpClient-android.cpp index 34200a4f53..a5db27c179 100644 --- a/native/cocos/network/HttpClient-android.cpp +++ b/native/cocos/network/HttpClient-android.cpp @@ -1,21 +1,22 @@ /**************************************************************************** - Copyright (c) 2012 greathqy - Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2012 greathqy + Copyright (c) 2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -23,7 +24,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #if (CC_PLATFORM == CC_PLATFORM_ANDROID) diff --git a/native/cocos/network/HttpClient-apple.mm b/native/cocos/network/HttpClient-apple.mm index 398e9910cc..a89971feb8 100644 --- a/native/cocos/network/HttpClient-apple.mm +++ b/native/cocos/network/HttpClient-apple.mm @@ -1,20 +1,21 @@ /**************************************************************************** - Copyright (c) 2012 greathqy - Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2012 greathqy + Copyright (c) 2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -23,7 +24,8 @@ 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 "network/HttpClient.h" #include diff --git a/native/cocos/network/HttpClient.cpp b/native/cocos/network/HttpClient.cpp index e071e8fa97..6c63cf214d 100644 --- a/native/cocos/network/HttpClient.cpp +++ b/native/cocos/network/HttpClient.cpp @@ -1,21 +1,22 @@ /**************************************************************************** - Copyright (c) 2012 greathqy - Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2012 greathqy + Copyright (c) 2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -23,7 +24,7 @@ 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 "network/HttpClient.h" #include diff --git a/native/cocos/network/HttpClient.h b/native/cocos/network/HttpClient.h index 89179c2c32..49c4d2e784 100644 --- a/native/cocos/network/HttpClient.h +++ b/native/cocos/network/HttpClient.h @@ -1,20 +1,21 @@ /**************************************************************************** - Copyright (c) 2012 greathqy - Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2012 greathqy + Copyright (c) 2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -23,7 +24,7 @@ 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 __CCHTTPCLIENT_H__ #define __CCHTTPCLIENT_H__ diff --git a/native/cocos/network/HttpCookie.cpp b/native/cocos/network/HttpCookie.cpp index 639db65dd0..4323d7154c 100644 --- a/native/cocos/network/HttpCookie.cpp +++ b/native/cocos/network/HttpCookie.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 "network/HttpCookie.h" #include "platform/FileUtils.h" diff --git a/native/cocos/network/HttpCookie.h b/native/cocos/network/HttpCookie.h index 9371f41a51..2dd2b1d639 100644 --- a/native/cocos/network/HttpCookie.h +++ b/native/cocos/network/HttpCookie.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ****************************************************************************/ +****************************************************************************/ #ifndef HTTP_COOKIE_H #define HTTP_COOKIE_H diff --git a/native/cocos/network/HttpRequest.h b/native/cocos/network/HttpRequest.h index 53db9d094e..ae28776fb2 100644 --- a/native/cocos/network/HttpRequest.h +++ b/native/cocos/network/HttpRequest.h @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ****************************************************************************/ +****************************************************************************/ #ifndef __HTTP_REQUEST_H__ #define __HTTP_REQUEST_H__ diff --git a/native/cocos/network/HttpResponse.h b/native/cocos/network/HttpResponse.h index f5937a7f92..fd85586626 100644 --- a/native/cocos/network/HttpResponse.h +++ b/native/cocos/network/HttpResponse.h @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ****************************************************************************/ +****************************************************************************/ #ifndef __HTTP_RESPONSE__ #define __HTTP_RESPONSE__ diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index e95b3fa882..289484f1bd 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2015 Chris Hannon http://www.channon.us Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,11 +23,7 @@ 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. - -*based on the SocketIO library created by LearnBoost at http://socket.io -*using spec version 1 found at https://github.com/LearnBoost/socket.io-spec - - ****************************************************************************/ +****************************************************************************/ #include "network/SocketIO.h" #include "network/Uri.h" diff --git a/native/cocos/network/SocketIO.h b/native/cocos/network/SocketIO.h index da9f5fb901..a920ee8bdc 100644 --- a/native/cocos/network/SocketIO.h +++ b/native/cocos/network/SocketIO.h @@ -1,17 +1,20 @@ /**************************************************************************** Copyright (c) 2015 Chris Hannon http://www.channon.us Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,42 +23,8 @@ 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. +****************************************************************************/ -*based on the SocketIO library created by LearnBoost at http://socket.io -*using spec version 1 found at https://github.com/LearnBoost/socket.io-spec - -Usage is described below, a full working example can be found in TestCpp under ExtionsTest/NetworkTest/SocketIOTest - -creating a new connection to a socket.io server running at localhost:3000 - - SIOClient *client = SocketIO::connect(*delegate, "ws://localhost:3000"); - -the connection process will begin and if successful delegate::onOpen will be called -if the connection process results in an error, delegate::onError will be called with the err msg - -sending a message to the server - - client->send("Hello!"); - -emitting an event to be handled by the server, argument json formatting is up to you - - client->emit("eventname", "[{\"arg\":\"value\"}]"); - -registering an event callback, target should be a member function in a subclass of SIODelegate -CC_CALLBACK_2 is used to wrap the callback with std::bind and store as an SIOEvent - - client->on("eventname", CC_CALLBACK_2(TargetClass::targetfunc, *targetclass_instance)); - -event target function should match this pattern, *this pointer will be made available - - void TargetClass::targetfunc(SIOClient *, const std::string&) - -disconnect from the endpoint by calling disconnect(), onClose will be called on the delegate once complete -in the onClose method the pointer should be set to NULL or used to connect to a new endpoint - - client->disconnect(); - - ****************************************************************************/ #pragma once #include diff --git a/native/cocos/network/WebSocket-apple.mm b/native/cocos/network/WebSocket-apple.mm index 1d53003459..698cf74b20 100644 --- a/native/cocos/network/WebSocket-apple.mm +++ b/native/cocos/network/WebSocket-apple.mm @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "network/WebSocket.h" #include "base/Data.h" diff --git a/native/cocos/network/WebSocket-libwebsockets.cpp b/native/cocos/network/WebSocket-libwebsockets.cpp index 8120e309dc..0a9f6f2443 100644 --- a/native/cocos/network/WebSocket-libwebsockets.cpp +++ b/native/cocos/network/WebSocket-libwebsockets.cpp @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,30 +23,27 @@ 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. +****************************************************************************/ -"[WebSocket module] is based in part on the work of the libwebsockets project -(http://libwebsockets.org)" - - ****************************************************************************/ #include "websockets/libwebsockets.h" #include #include +#include #include -#include +#include #include -#include #include // for std::shared_ptr +#include #include #include -#include #include #include -#include "network/WebSocket.h" -#include "network/Uri.h" #include "base/Scheduler.h" -#include "platform/FileUtils.h" +#include "network/Uri.h" +#include "network/WebSocket.h" #include "platform/Application.h" +#include "platform/FileUtils.h" #include "platform/StdC.h" #define NS_NETWORK_BEGIN \ @@ -61,7 +59,7 @@ #define LOG_TAG "WebSocket.cpp" struct lws; -struct lws_protocols; +struct LwsProtocols; struct lws_vhost; #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) @@ -71,8 +69,8 @@ struct lws_vhost; //IDEA: Move _winLog, winLog to a separated file static void _winLog(const char *format, va_list args) { static const int MAX_LOG_LENGTH = 16 * 1024; - int bufferSize = MAX_LOG_LENGTH; - char *buf = nullptr; + int bufferSize = MAX_LOG_LENGTH; + char * buf = nullptr; do { buf = new (std::nothrow) char[bufferSize]; @@ -91,10 +89,10 @@ static void _winLog(const char *format, va_list args) { strcat(buf, "\n"); - int pos = 0; - int len = strlen(buf); - char tempBuf[MAX_LOG_LENGTH + 1] = {0}; - WCHAR wszBuf[MAX_LOG_LENGTH + 1] = {0}; + int pos = 0; + int len = strlen(buf); + char tempBuf[MAX_LOG_LENGTH + 1] = {0}; + WCHAR wszBuf[MAX_LOG_LENGTH + 1] = {0}; do { std::copy(buf + pos, buf + pos + MAX_LOG_LENGTH, tempBuf); @@ -119,11 +117,11 @@ static void wsLog(const char *format, ...) { } #else - #define wsLog printf + #define WS_LOG printf #endif -#define QUOTEME_(x) #x -#define QUOTEME(x) QUOTEME_(x) +#define DO_QUOTEME(x) #x +#define QUOTEME(x) DO_QUOTEME(x) // Since CC_LOG_DEBUG isn't thread safe, we uses LOGD for multi-thread logging. #ifdef ANDROID @@ -160,7 +158,7 @@ static void printWebSocketLog(int level, const char *line) { }; char buf[30] = {0}; - int n; + int n; for (n = 0; n < LLL_COUNT; n++) { if (level != (1 << n)) @@ -177,31 +175,31 @@ static void printWebSocketLog(int level, const char *line) { class WebSocketImpl { public: static void closeAllConnections(); - WebSocketImpl(cc::network::WebSocket *ws); + explicit WebSocketImpl(cc::network::WebSocket *ws); ~WebSocketImpl(); bool init(const cc::network::WebSocket::Delegate &delegate, - const std::string &url, - const std::vector *protocols = nullptr, - const std::string &caFilePath = ""); + const std::string & url, + const std::vector * protocols = nullptr, + const std::string & caFilePath = ""); - void send(const std::string &message); - void send(const unsigned char *binaryMsg, unsigned int len); - void close(); - void closeAsync(); - void closeAsync(int code, const std::string &reason); - cc::network::WebSocket::State getReadyState() const; - const std::string &getUrl() const; - const std::string &getProtocol() const; + void send(const std::string &message); + void send(const unsigned char *binaryMsg, unsigned int len); + void close(); + void closeAsync(); + void closeAsync(int code, const std::string &reason); + cc::network::WebSocket::State getReadyState() const; + const std::string & getUrl() const; + const std::string & getProtocol() const; cc::network::WebSocket::Delegate *getDelegate() const; - size_t getBufferedAmount() const; + size_t getBufferedAmount() const; std::string getExtensions() const; private: // The following callback functions are invoked in websocket thread void onClientOpenConnectionRequest(); - int onSocketCallback(struct lws *wsi, enum lws_callback_reasons reason, void *in, ssize_t len); + int onSocketCallback(struct lws *wsi, enum lws_callback_reasons reason, void *in, ssize_t len); int onClientWritable(); int onClientReceivedData(void *in, ssize_t len); @@ -209,24 +207,23 @@ private: int onConnectionError(); int onConnectionClosed(); - struct lws_vhost *createVhost(struct lws_protocols *protocols, int &sslConnection); + struct lws_vhost *createVhost(struct lws_protocols *protocols, int *sslConnection); -private: - cc::network::WebSocket *_ws; + cc::network::WebSocket * _ws; cc::network::WebSocket::State _readyState; - std::mutex _readyStateMutex; - std::string _url; - std::vector _receivedData; + std::mutex _readyStateMutex; + std::string _url; + std::vector _receivedData; - struct lws *_wsInstance; + struct lws * _wsInstance; struct lws_protocols *_lwsProtocols; - std::string _clientSupportedProtocols; - std::string _selectedProtocol; + std::string _clientSupportedProtocols; + std::string _selectedProtocol; std::shared_ptr> _isDestroyed; - cc::network::WebSocket::Delegate *_delegate; + cc::network::WebSocket::Delegate * _delegate; - std::mutex _closeMutex; + std::mutex _closeMutex; std::condition_variable _closeCondition; std::vector _enabledExtensions; @@ -245,7 +242,7 @@ private: friend class WebSocketCallbackWrapper; }; -enum WS_MSG { +enum WsMsg { WS_MSG_TO_SUBTRHEAD_SENDING_STRING = 0, WS_MSG_TO_SUBTRHEAD_SENDING_BINARY, WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION @@ -253,14 +250,14 @@ enum WS_MSG { class WsThreadHelper; -static std::vector *__websocketInstances = nullptr; -static std::mutex __instanceMutex; -static struct lws_context *__wsContext = nullptr; -static WsThreadHelper *__wsHelper = nullptr; +static std::vector *websocketInstances = nullptr; +static std::recursive_mutex instanceMutex; +static struct lws_context * wsContext = nullptr; +static WsThreadHelper * wsHelper = nullptr; #if (CC_PLATFORM == CC_PLATFORM_ANDROID) static std::string getFileNameForPath(const std::string &filePath) { - std::string fileName = filePath; + std::string fileName = filePath; const size_t lastSlashIdx = fileName.find_last_of("\\/"); if (std::string::npos != lastSlashIdx) { fileName.erase(0, lastSlashIdx + 1); @@ -269,7 +266,7 @@ static std::string getFileNameForPath(const std::string &filePath) { } #endif -static struct lws_protocols __defaultProtocols[2]; +static struct lws_protocols defaultProtocols[2]; static lws_context_creation_info convertToContextCreationInfo(const struct lws_protocols *protocols, bool peerServerCert) { lws_context_creation_info info; @@ -282,7 +279,7 @@ static lws_context_creation_info convertToContextCreationInfo(const struct lws_p * For this client-only demo, we tell it to not listen on any port. */ - info.port = CONTEXT_PORT_NO_LISTEN; + info.port = CONTEXT_PORT_NO_LISTEN; info.protocols = protocols; // IDEA: Disable 'permessage-deflate' extension temporarily because of issues: @@ -308,20 +305,17 @@ static lws_context_creation_info convertToContextCreationInfo(const struct lws_p class WsMessage { public: - WsMessage() : id(++__id), - what(0), - data(nullptr), - user(nullptr) {} - unsigned int id; - unsigned int what; // message type - cc::network::WebSocket::Data *data; - void *user; + WsMessage() : id(++idCount) {} + unsigned int id; + unsigned int what{0}; // message type + cc::network::WebSocket::Data *data{nullptr}; + void * user{nullptr}; private: - static unsigned int __id; + static unsigned int idCount; }; -unsigned int WsMessage::__id = 0; +unsigned int WsMessage::idCount = 0; /** * @brief Websocket thread helper, it's used for sending message between UI thread and websocket thread. @@ -337,7 +331,7 @@ public: void quitWebSocketThread(); // Sends message to Cocos thread. It's needed to be invoked in Websocket thread. - void sendMessageToCocosThread(const std::function &cb); + static void sendMessageToCocosThread(const std::function &cb); // Sends message to Websocket thread. It's needs to be invoked in Cocos thread. void sendMessageToWebSocketThread(WsMessage *msg); @@ -345,40 +339,43 @@ public: size_t countBufferdBytes(const WebSocketImpl *ws); // Waits the sub-thread (websocket thread) to exit, - void joinWebSocketThread(); + void joinWebSocketThread() const; - void onSubThreadStarted(); - void onSubThreadLoop(); - void onSubThreadEnded(); + static void onSubThreadStarted(); + static void onSubThreadLoop(); + static void onSubThreadEnded(); protected: - void wsThreadEntryFunc(); + void wsThreadEntryFunc() const; public: std::list *_subThreadWsMessageQueue; - std::mutex _subThreadWsMessageQueueMutex; - std::thread *_subThreadInstance; + std::mutex _subThreadWsMessageQueueMutex; + std::thread * _subThreadInstance{nullptr}; private: - bool _needQuit; + bool _needQuit{false}; }; // Wrapper for converting websocket callback from static function to member function of WebSocket class. class WebSocketCallbackWrapper { public: - static int onSocketCallback(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len) { + static int onSocketCallback(struct lws *wsi, enum lws_callback_reasons reason, void * /*user*/, void *in, size_t len) { // Gets the user data from context. We know that it's a 'WebSocket' instance. if (wsi == nullptr) { return 0; } int ret = 0; - WebSocketImpl *ws = (WebSocketImpl *)lws_wsi_user(wsi); - if (ws != nullptr && __websocketInstances != nullptr) { - if (std::find(__websocketInstances->begin(), __websocketInstances->end(), ws) != __websocketInstances->end()) { - ret = ws->onSocketCallback(wsi, reason, in, len); + { + std::lock_guard lk(instanceMutex); + auto * ws = static_cast(lws_wsi_user(wsi)); + if (ws != nullptr && websocketInstances != nullptr) { + if (std::find(websocketInstances->begin(), websocketInstances->end(), ws) != websocketInstances->end()) { + ret = ws->onSocketCallback(wsi, reason, in, len); + } + } else { + // LOGD("ws instance is nullptr.\n"); } - } else { - // LOGD("ws instance is nullptr.\n"); } return ret; @@ -387,8 +384,8 @@ public: // Implementation of WsThreadHelper WsThreadHelper::WsThreadHelper() -: _subThreadInstance(nullptr), - _needQuit(false) { + +{ _subThreadWsMessageQueue = new (std::nothrow) std::list(); } @@ -409,54 +406,54 @@ void WsThreadHelper::quitWebSocketThread() { } void WsThreadHelper::onSubThreadLoop() { - if (__wsContext) { + if (wsContext) { // _readyStateMutex.unlock(); - __wsHelper->_subThreadWsMessageQueueMutex.lock(); - bool isEmpty = __wsHelper->_subThreadWsMessageQueue->empty(); + wsHelper->_subThreadWsMessageQueueMutex.lock(); + bool isEmpty = wsHelper->_subThreadWsMessageQueue->empty(); if (!isEmpty) { - auto iter = __wsHelper->_subThreadWsMessageQueue->begin(); - for (; iter != __wsHelper->_subThreadWsMessageQueue->end();) { - auto msg = (*iter); - auto ws = (WebSocketImpl *)msg->user; + auto iter = wsHelper->_subThreadWsMessageQueue->begin(); + for (; iter != wsHelper->_subThreadWsMessageQueue->end();) { + auto *msg = (*iter); + auto *ws = static_cast(msg->user); // REFINE: ws may be a invalid pointer if (msg->what == WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION) { ws->onClientOpenConnectionRequest(); delete *iter; - iter = __wsHelper->_subThreadWsMessageQueue->erase(iter); + iter = wsHelper->_subThreadWsMessageQueue->erase(iter); } else { ++iter; } } } - __wsHelper->_subThreadWsMessageQueueMutex.unlock(); + wsHelper->_subThreadWsMessageQueueMutex.unlock(); // Cause delay 4ms for event WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION - lws_service(__wsContext, 4); + lws_service(wsContext, 4); } } void WsThreadHelper::onSubThreadStarted() { - int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO /* | LLL_DEBUG | LLL_PARSER | LLL_HEADER*/ | LLL_EXT | LLL_CLIENT | LLL_LATENCY; - lws_set_log_level(log_level, printWebSocketLog); + int logLevel = LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO /* | LLL_DEBUG | LLL_PARSER | LLL_HEADER*/ | LLL_EXT | LLL_CLIENT | LLL_LATENCY; + lws_set_log_level(logLevel, printWebSocketLog); - memset(__defaultProtocols, 0, 2 * sizeof(struct lws_protocols)); + memset(defaultProtocols, 0, 2 * sizeof(struct lws_protocols)); - __defaultProtocols[0].name = ""; - __defaultProtocols[0].callback = WebSocketCallbackWrapper::onSocketCallback; - __defaultProtocols[0].rx_buffer_size = WS_RX_BUFFER_SIZE; - __defaultProtocols[0].id = std::numeric_limits::max(); + defaultProtocols[0].name = ""; + defaultProtocols[0].callback = WebSocketCallbackWrapper::onSocketCallback; + defaultProtocols[0].rx_buffer_size = WS_RX_BUFFER_SIZE; + defaultProtocols[0].id = std::numeric_limits::max(); - lws_context_creation_info creationInfo = convertToContextCreationInfo(__defaultProtocols, true); - __wsContext = lws_create_context(&creationInfo); + lws_context_creation_info creationInfo = convertToContextCreationInfo(defaultProtocols, true); + wsContext = lws_create_context(&creationInfo); } void WsThreadHelper::onSubThreadEnded() { - if (__wsContext != nullptr) { - lws_context_destroy(__wsContext); + if (wsContext != nullptr) { + lws_context_destroy(wsContext); } } -void WsThreadHelper::wsThreadEntryFunc() { +void WsThreadHelper::wsThreadEntryFunc() const { LOGD("WebSocket thread start, helper instance: %p\n", this); onSubThreadStarted(); @@ -480,8 +477,8 @@ void WsThreadHelper::sendMessageToWebSocketThread(WsMessage *msg) { size_t WsThreadHelper::countBufferdBytes(const WebSocketImpl *ws) { std::lock_guard lk(_subThreadWsMessageQueueMutex); - size_t total = 0; - for (auto msg : *_subThreadWsMessageQueue) { + size_t total = 0; + for (auto *msg : *_subThreadWsMessageQueue) { if (msg->user == ws && msg->data && (msg->what == WS_MSG_TO_SUBTRHEAD_SENDING_STRING || msg->what == WS_MSG_TO_SUBTRHEAD_SENDING_BINARY)) { total += msg->data->getRemain(); } @@ -489,7 +486,7 @@ size_t WsThreadHelper::countBufferdBytes(const WebSocketImpl *ws) { return total; } -void WsThreadHelper::joinWebSocketThread() { +void WsThreadHelper::joinWebSocketThread() const { if (_subThreadInstance->joinable()) { _subThreadInstance->join(); } @@ -498,15 +495,10 @@ void WsThreadHelper::joinWebSocketThread() { // Define a WebSocket frame class WebSocketFrame { public: - WebSocketFrame() - : _payload(nullptr), - _payloadLength(0), - _frameLength(0) { - } - bool init(unsigned char *buf, ssize_t len) { - if (buf == nullptr && len > 0) + if (buf == nullptr && len > 0) { return false; + } if (!_data.empty()) { LOGD("WebSocketFrame was initialized, should not init it again!\n"); @@ -518,9 +510,9 @@ public: std::copy(buf, buf + len, _data.begin() + LWS_PRE); } - _payload = _data.data() + LWS_PRE; + _payload = _data.data() + LWS_PRE; _payloadLength = len; - _frameLength = len; + _frameLength = len; return true; } @@ -530,31 +522,31 @@ public: } unsigned char *getPayload() const { return _payload; } - ssize_t getPayloadLength() const { return _payloadLength; } - ssize_t getFrameLength() const { return _frameLength; } + ssize_t getPayloadLength() const { return _payloadLength; } + ssize_t getFrameLength() const { return _frameLength; } private: - unsigned char *_payload; - ssize_t _payloadLength; + unsigned char *_payload{nullptr}; + ssize_t _payloadLength{0}; - ssize_t _frameLength; + ssize_t _frameLength{0}; std::vector _data; }; // void WebSocketImpl::closeAllConnections() { - if (__websocketInstances != nullptr) { - ssize_t count = __websocketInstances->size(); + if (websocketInstances != nullptr) { + ssize_t count = websocketInstances->size(); for (ssize_t i = count - 1; i >= 0; i--) { - WebSocketImpl *instance = __websocketInstances->at(i); + WebSocketImpl *instance = websocketInstances->at(i); instance->close(); } - std::lock_guard lk(__instanceMutex); - __websocketInstances->clear(); - delete __websocketInstances; - __websocketInstances = nullptr; + std::lock_guard lk(instanceMutex); + websocketInstances->clear(); + delete websocketInstances; + websocketInstances = nullptr; } } @@ -568,11 +560,14 @@ WebSocketImpl::WebSocketImpl(cc::network::WebSocket *ws) _closeState(CloseState::NONE) { // reserve data buffer to avoid allocate memory frequently _receivedData.reserve(WS_RESERVE_RECEIVE_BUFFER_SIZE); - if (__websocketInstances == nullptr) { - __websocketInstances = new (std::nothrow) std::vector(); - } - __websocketInstances->push_back(this); + { + std::lock_guard lk(instanceMutex); + if (websocketInstances == nullptr) { + websocketInstances = new (std::nothrow) std::vector(); + } + websocketInstances->push_back(this); + } // NOTE: !!! Be careful while merging cocos2d-x-lite back to cocos2d-x. !!! // 'close' is a synchronous operation which may wait some seconds to make sure connection is closed. @@ -590,24 +585,24 @@ WebSocketImpl::WebSocketImpl(cc::network::WebSocket *ws) WebSocketImpl::~WebSocketImpl() { LOGD("In the destructor of WebSocket (%p)\n", this); - std::lock_guard lk(__instanceMutex); + std::lock_guard lk(instanceMutex); - if (__websocketInstances != nullptr) { - auto iter = std::find(__websocketInstances->begin(), __websocketInstances->end(), this); - if (iter != __websocketInstances->end()) { - __websocketInstances->erase(iter); + if (websocketInstances != nullptr) { + auto iter = std::find(websocketInstances->begin(), websocketInstances->end(), this); + if (iter != websocketInstances->end()) { + websocketInstances->erase(iter); } else { LOGD("ERROR: WebSocket instance (%p) wasn't added to the container which saves websocket instances!\n", this); } } - if (__websocketInstances == nullptr || __websocketInstances->empty()) { - __wsHelper->quitWebSocketThread(); + if (websocketInstances == nullptr || websocketInstances->empty()) { + wsHelper->quitWebSocketThread(); LOGD("before join ws thread\n"); - __wsHelper->joinWebSocketThread(); + wsHelper->joinWebSocketThread(); LOGD("after join ws thread\n"); - CC_SAFE_DELETE(__wsHelper); + CC_SAFE_DELETE(wsHelper); } // NOTE: Refer to the comment in constructor!!! @@ -617,34 +612,35 @@ WebSocketImpl::~WebSocketImpl() { } bool WebSocketImpl::init(const cc::network::WebSocket::Delegate &delegate, - const std::string &url, - const std::vector *protocols /* = nullptr*/, - const std::string &caFilePath /* = ""*/) { - _delegate = const_cast(&delegate); - _url = url; + const std::string & url, + const std::vector * protocols /* = nullptr*/, + const std::string & caFilePath /* = ""*/) { + _delegate = const_cast(&delegate); + _url = url; _caFilePath = caFilePath; - if (_url.empty()) + if (_url.empty()) { return false; + } if (protocols != nullptr && !protocols->empty()) { - size_t size = protocols->size(); - _lwsProtocols = (struct lws_protocols *)malloc((size + 1) * sizeof(struct lws_protocols)); + size_t size = protocols->size(); + _lwsProtocols = static_cast(malloc((size + 1) * sizeof(struct lws_protocols))); memset(_lwsProtocols, 0, (size + 1) * sizeof(struct lws_protocols)); - static uint32_t __wsId = 0; + static uint32_t wsId = 0; for (size_t i = 0; i < size; ++i) { _lwsProtocols[i].callback = WebSocketCallbackWrapper::onSocketCallback; - size_t nameLen = protocols->at(i).length(); - char *name = (char *)malloc(nameLen + 1); - name[nameLen] = '\0'; + size_t nameLen = protocols->at(i).length(); + char * name = static_cast(malloc(nameLen + 1)); + name[nameLen] = '\0'; strcpy(name, protocols->at(i).c_str()); - _lwsProtocols[i].name = name; - _lwsProtocols[i].id = ++__wsId; - _lwsProtocols[i].rx_buffer_size = WS_RX_BUFFER_SIZE; + _lwsProtocols[i].name = name; + _lwsProtocols[i].id = ++wsId; + _lwsProtocols[i].rx_buffer_size = WS_RX_BUFFER_SIZE; _lwsProtocols[i].per_session_data_size = 0; - _lwsProtocols[i].user = nullptr; + _lwsProtocols[i].user = nullptr; _clientSupportedProtocols += name; if (i < (size - 1)) { @@ -654,35 +650,35 @@ bool WebSocketImpl::init(const cc::network::WebSocket::Delegate &delegate, } bool isWebSocketThreadCreated = true; - if (__wsHelper == nullptr) { - __wsHelper = new (std::nothrow) WsThreadHelper(); + if (wsHelper == nullptr) { + wsHelper = new (std::nothrow) WsThreadHelper(); isWebSocketThreadCreated = false; } - WsMessage *msg = new (std::nothrow) WsMessage(); + auto *msg = new (std::nothrow) WsMessage(); msg->what = WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION; msg->user = this; - __wsHelper->sendMessageToWebSocketThread(msg); + wsHelper->sendMessageToWebSocketThread(msg); // fixed https://github.com/cocos2d/cocos2d-x/issues/17433 // createWebSocketThread has to be after message WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION was sent. // And websocket thread should only be created once. if (!isWebSocketThreadCreated) { - __wsHelper->createWebSocketThread(); + wsHelper->createWebSocketThread(); } return true; } size_t WebSocketImpl::getBufferedAmount() const { - return __wsHelper->countBufferdBytes(this); + return wsHelper->countBufferdBytes(this); } std::string WebSocketImpl::getExtensions() const { //join vector with ";" if (_enabledExtensions.empty()) return ""; std::string ret; - for (int i = 0; i < _enabledExtensions.size(); i++) ret += (_enabledExtensions[i] + "; "); + for (const auto &enabledExtension : _enabledExtensions) ret += (enabledExtension + "; "); ret += _enabledExtensions[_enabledExtensions.size() - 1]; return ret; } @@ -690,18 +686,18 @@ std::string WebSocketImpl::getExtensions() const { void WebSocketImpl::send(const std::string &message) { if (_readyState == cc::network::WebSocket::State::OPEN) { // In main thread - cc::network::WebSocket::Data *data = new (std::nothrow) cc::network::WebSocket::Data(); - data->bytes = (char *)malloc(message.length() + 1); + auto *data = new (std::nothrow) cc::network::WebSocket::Data(); + data->bytes = static_cast(malloc(message.length() + 1)); // Make sure the last byte is '\0' data->bytes[message.length()] = '\0'; strcpy(data->bytes, message.c_str()); data->len = static_cast(message.length()); - WsMessage *msg = new (std::nothrow) WsMessage(); + auto *msg = new (std::nothrow) WsMessage(); msg->what = WS_MSG_TO_SUBTRHEAD_SENDING_STRING; msg->data = data; msg->user = this; - __wsHelper->sendMessageToWebSocketThread(msg); + wsHelper->sendMessageToWebSocketThread(msg); } else { LOGD("Couldn't send message since websocket wasn't opened!\n"); } @@ -710,22 +706,22 @@ void WebSocketImpl::send(const std::string &message) { void WebSocketImpl::send(const unsigned char *binaryMsg, unsigned int len) { if (_readyState == cc::network::WebSocket::State::OPEN) { // In main thread - cc::network::WebSocket::Data *data = new (std::nothrow) cc::network::WebSocket::Data(); + auto *data = new (std::nothrow) cc::network::WebSocket::Data(); if (len == 0) { // If data length is zero, allocate 1 byte for safe. - data->bytes = (char *)malloc(1); + data->bytes = static_cast(malloc(1)); data->bytes[0] = '\0'; } else { - data->bytes = (char *)malloc(len); - memcpy((void *)data->bytes, (void *)binaryMsg, len); + data->bytes = static_cast(malloc(len)); + memcpy(data->bytes, binaryMsg, len); } data->len = len; - WsMessage *msg = new (std::nothrow) WsMessage(); + auto *msg = new (std::nothrow) WsMessage(); msg->what = WS_MSG_TO_SUBTRHEAD_SENDING_BINARY; msg->data = data; msg->user = this; - __wsHelper->sendMessageToWebSocketThread(msg); + wsHelper->sendMessageToWebSocketThread(msg); } else { LOGD("Couldn't send message since websocket wasn't opened!\n"); } @@ -766,7 +762,7 @@ void WebSocketImpl::close() { } void WebSocketImpl::closeAsync(int code, const std::string &reason) { - lws_close_reason(_wsInstance, (lws_close_status)code, (unsigned char *)const_cast(reason.c_str()), reason.length()); + lws_close_reason(_wsInstance, static_cast(code), reinterpret_cast(const_cast(reason.c_str())), reason.length()); closeAsync(); } @@ -805,8 +801,8 @@ cc::network::WebSocket::Delegate *WebSocketImpl::getDelegate() const { return _delegate; } -struct lws_vhost *WebSocketImpl::createVhost(struct lws_protocols *protocols, int &sslConnection) { - auto fileUtils = cc::FileUtils::getInstance(); +struct lws_vhost *WebSocketImpl::createVhost(struct lws_protocols *protocols, int *sslConnectionOut) { + auto *fileUtils = cc::FileUtils::getInstance(); bool isCAFileExist = fileUtils->isFileExist(_caFilePath); if (isCAFileExist) { _caFilePath = fileUtils->fullPathForFilename(_caFilePath); @@ -814,17 +810,18 @@ struct lws_vhost *WebSocketImpl::createVhost(struct lws_protocols *protocols, in lws_context_creation_info info = convertToContextCreationInfo(protocols, isCAFileExist); + int sslConnection = *sslConnectionOut; if (sslConnection != 0) { if (isCAFileExist) { #if (CC_PLATFORM == CC_PLATFORM_ANDROID) // if ca file is in the apk, try to extract it to writable path - std::string writablePath = fileUtils->getWritablePath(); - std::string caFileName = getFileNameForPath(_caFilePath); + std::string writablePath = fileUtils->getWritablePath(); + std::string caFileName = getFileNameForPath(_caFilePath); std::string newCaFilePath = writablePath + caFileName; if (fileUtils->isFileExist(newCaFilePath)) { LOGD("CA file (%s) in writable path exists!", newCaFilePath.c_str()); - _caFilePath = newCaFilePath; + _caFilePath = newCaFilePath; info.ssl_ca_filepath = _caFilePath.c_str(); } else { if (fileUtils->isFileExist(_caFilePath)) { @@ -839,7 +836,7 @@ struct lws_vhost *WebSocketImpl::createVhost(struct lws_protocols *protocols, in LOGD("New CA file path: %s", newCaFilePath.c_str()); fwrite(caData.getBytes(), caData.getSize(), 1, fp); fclose(fp); - _caFilePath = newCaFilePath; + _caFilePath = newCaFilePath; info.ssl_ca_filepath = _caFilePath.c_str(); } else { CCASSERT(false, "Open new CA file failed"); @@ -849,7 +846,7 @@ struct lws_vhost *WebSocketImpl::createVhost(struct lws_protocols *protocols, in } } else { LOGD("CA file isn't in APK!"); - _caFilePath = fullPath; + _caFilePath = fullPath; info.ssl_ca_filepath = _caFilePath.c_str(); } } else { @@ -861,18 +858,18 @@ struct lws_vhost *WebSocketImpl::createVhost(struct lws_protocols *protocols, in #endif } else { LOGD("WARNING: CA Root file isn't set. SSL connection will not peer server certificate\n"); - sslConnection = sslConnection | LCCSCF_ALLOW_SELFSIGNED | LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK; + *sslConnectionOut = sslConnection | LCCSCF_ALLOW_SELFSIGNED | LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK; } } - lws_vhost *vhost = lws_create_vhost(__wsContext, &info); + lws_vhost *vhost = lws_create_vhost(wsContext, &info); return vhost; } void WebSocketImpl::onClientOpenConnectionRequest() { - if (nullptr != __wsContext) { - static const struct lws_extension exts[] = { + if (nullptr != wsContext) { + static const struct lws_extension EXTS[] = { {"permessage-deflate", lws_extension_callback_pm_deflate, // client_no_context_takeover extension is not supported in the current version, it will cause connection fail @@ -892,40 +889,43 @@ void WebSocketImpl::onClientOpenConnectionRequest() { LOGD("scheme: %s, host: %s, port: %d, path: %s\n", uri.getScheme().c_str(), uri.getHostName().c_str(), static_cast(uri.getPort()), uri.getPathEtc().c_str()); int sslConnection = 0; - if (uri.isSecure()) + if (uri.isSecure()) { sslConnection = LCCSCF_USE_SSL; + } struct lws_vhost *vhost = nullptr; if (_lwsProtocols != nullptr) { - vhost = createVhost(_lwsProtocols, sslConnection); + vhost = createVhost(_lwsProtocols, &sslConnection); } else { - vhost = createVhost(__defaultProtocols, sslConnection); + vhost = createVhost(defaultProtocols, &sslConnection); } int port = static_cast(uri.getPort()); - if (port == 0) + if (port == 0) { port = uri.isSecure() ? 443 : 80; + } - const std::string &hostName = uri.getHostName(); - std::string path = uri.getPathEtc(); + const std::string &hostName = uri.getHostName(); + std::string path = uri.getPathEtc(); const std::string &authority = uri.getAuthority(); - if (path.empty()) + if (path.empty()) { path = "/"; + } struct lws_client_connect_info connectInfo; memset(&connectInfo, 0, sizeof(connectInfo)); - connectInfo.context = __wsContext; - connectInfo.address = hostName.c_str(); - connectInfo.port = port; - connectInfo.ssl_connection = sslConnection; - connectInfo.path = path.c_str(); - connectInfo.host = hostName.c_str(); - connectInfo.origin = authority.c_str(); - connectInfo.protocol = _clientSupportedProtocols.empty() ? nullptr : _clientSupportedProtocols.c_str(); + connectInfo.context = wsContext; + connectInfo.address = hostName.c_str(); + connectInfo.port = port; + connectInfo.ssl_connection = sslConnection; + connectInfo.path = path.c_str(); + connectInfo.host = hostName.c_str(); + connectInfo.origin = authority.c_str(); + connectInfo.protocol = _clientSupportedProtocols.empty() ? nullptr : _clientSupportedProtocols.c_str(); connectInfo.ietf_version_or_minus_one = -1; - connectInfo.userdata = this; - connectInfo.client_exts = exts; - connectInfo.vhost = vhost; + connectInfo.userdata = this; + connectInfo.client_exts = EXTS; + connectInfo.vhost = vhost; _wsInstance = lws_client_connect_via_info(&connectInfo); @@ -949,41 +949,40 @@ int WebSocketImpl::onClientWritable() { } do { - std::lock_guard lk(__wsHelper->_subThreadWsMessageQueueMutex); + std::lock_guard lk(wsHelper->_subThreadWsMessageQueueMutex); - if (__wsHelper->_subThreadWsMessageQueue->empty()) { + if (wsHelper->_subThreadWsMessageQueue->empty()) { break; } - std::list::iterator iter = __wsHelper->_subThreadWsMessageQueue->begin(); + auto iter = wsHelper->_subThreadWsMessageQueue->begin(); - while (iter != __wsHelper->_subThreadWsMessageQueue->end()) { + while (iter != wsHelper->_subThreadWsMessageQueue->end()) { WsMessage *msg = *iter; if (msg->user == this) { break; - } else { - ++iter; } + ++iter; } ssize_t bytesWrite = 0; - if (iter != __wsHelper->_subThreadWsMessageQueue->end()) { + if (iter != wsHelper->_subThreadWsMessageQueue->end()) { WsMessage *subThreadMsg = *iter; - cc::network::WebSocket::Data *data = (cc::network::WebSocket::Data *)subThreadMsg->data; + auto *data = subThreadMsg->data; - const ssize_t c_bufferSize = WS_RX_BUFFER_SIZE; + const ssize_t cBufferSize = WS_RX_BUFFER_SIZE; const ssize_t remaining = data->len - data->issued; - const ssize_t n = std::min(remaining, c_bufferSize); + const ssize_t n = std::min(remaining, cBufferSize); WebSocketFrame *frame = nullptr; if (data->ext) { - frame = (WebSocketFrame *)data->ext; + frame = static_cast(data->ext); } else { - frame = new (std::nothrow) WebSocketFrame(); - bool success = frame && frame->init((unsigned char *)(data->bytes + data->issued), n); + frame = new (std::nothrow) WebSocketFrame(); + bool success = frame && frame->init(reinterpret_cast(data->bytes + data->issued), n); if (success) { data->ext = frame; } else { // If frame initialization failed, delete the frame and drop the sending data @@ -992,7 +991,7 @@ int WebSocketImpl::onClientWritable() { delete frame; CC_SAFE_FREE(data->bytes); CC_SAFE_DELETE(data); - __wsHelper->_subThreadWsMessageQueue->erase(iter); + wsHelper->_subThreadWsMessageQueue->erase(iter); CC_SAFE_DELETE(subThreadMsg); break; } @@ -1008,17 +1007,19 @@ int WebSocketImpl::onClientWritable() { } // If we have more than 1 fragment - if (data->len > c_bufferSize) + if (data->len > cBufferSize) { writeProtocol |= LWS_WRITE_NO_FIN; + } } else { // we are in the middle of fragments writeProtocol = LWS_WRITE_CONTINUATION; // and if not in the last fragment - if (remaining != n) + if (remaining != n) { writeProtocol |= LWS_WRITE_NO_FIN; + } } - bytesWrite = lws_write(_wsInstance, frame->getPayload(), frame->getPayloadLength(), (lws_write_protocol)writeProtocol); + bytesWrite = lws_write(_wsInstance, frame->getPayload(), frame->getPayloadLength(), static_cast(writeProtocol)); // Handle the result of lws_write // Buffer overrun? @@ -1026,10 +1027,10 @@ int WebSocketImpl::onClientWritable() { LOGD("ERROR: msg(%u), lws_write return: %d, but it should be %d, drop this message.\n", subThreadMsg->id, (int)bytesWrite, (int)n); // socket error, we need to close the socket connection CC_SAFE_FREE(data->bytes); - delete ((WebSocketFrame *)data->ext); + delete (static_cast(data->ext)); data->ext = nullptr; CC_SAFE_DELETE(data); - __wsHelper->_subThreadWsMessageQueue->erase(iter); + wsHelper->_subThreadWsMessageQueue->erase(iter); CC_SAFE_DELETE(subThreadMsg); closeAsync(); @@ -1042,7 +1043,7 @@ int WebSocketImpl::onClientWritable() { // A frame was totally sent, plus data->issued to send next frame LOGD("msg(%u) append: %d + %d = %d\n", subThreadMsg->id, (int)data->issued, (int)frame->getFrameLength(), (int)(data->issued + frame->getFrameLength())); data->issued += frame->getFrameLength(); - delete ((WebSocketFrame *)data->ext); + delete (static_cast(data->ext)); data->ext = nullptr; } // Safely done! @@ -1058,10 +1059,10 @@ int WebSocketImpl::onClientWritable() { } CC_SAFE_FREE(data->bytes); - delete ((WebSocketFrame *)data->ext); + delete (static_cast(data->ext)); data->ext = nullptr; CC_SAFE_DELETE(data); - __wsHelper->_subThreadWsMessageQueue->erase(iter); + wsHelper->_subThreadWsMessageQueue->erase(iter); CC_SAFE_DELETE(subThreadMsg); LOGD("-----------------------------------------------------------\n"); @@ -1084,19 +1085,19 @@ int WebSocketImpl::onClientReceivedData(void *in, ssize_t len) { if (in != nullptr && len > 0) { LOGD("Receiving data:index:%d, len=%d\n", packageIndex, (int)len); - unsigned char *inData = (unsigned char *)in; + auto *inData = static_cast(in); _receivedData.insert(_receivedData.end(), inData, inData + len); } else { LOGD("Empty message received, index=%d!\n", packageIndex); } // If no more data pending, send it to the client thread - size_t remainingSize = lws_remaining_packet_payload(_wsInstance); - int isFinalFragment = lws_is_final_fragment(_wsInstance); + size_t remainingSize = lws_remaining_packet_payload(_wsInstance); + int isFinalFragment = lws_is_final_fragment(_wsInstance); // LOGD("remainingSize: %d, isFinalFragment: %d\n", (int)remainingSize, isFinalFragment); if (remainingSize == 0 && isFinalFragment) { - std::vector *frameData = new (std::nothrow) std::vector(std::move(_receivedData)); + auto *frameData = new (std::nothrow) std::vector(std::move(_receivedData)); // reset capacity of received data buffer _receivedData.reserve(WS_RESERVE_RECEIVE_BUFFER_SIZE); @@ -1110,14 +1111,14 @@ int WebSocketImpl::onClientReceivedData(void *in, ssize_t len) { } std::shared_ptr> isDestroyed = _isDestroyed; - __wsHelper->sendMessageToCocosThread([this, frameData, frameSize, isBinary, isDestroyed]() { + wsHelper->sendMessageToCocosThread([this, frameData, frameSize, isBinary, isDestroyed]() { // In UI thread LOGD("Notify data len %d to Cocos thread.\n", (int)frameSize); cc::network::WebSocket::Data data; data.isBinary = isBinary; - data.bytes = (char *)frameData->data(); - data.len = frameSize; + data.bytes = static_cast(frameData->data()); + data.len = frameSize; if (*isDestroyed) { LOGD("WebSocket instance was destroyed!\n"); @@ -1134,7 +1135,7 @@ int WebSocketImpl::onClientReceivedData(void *in, ssize_t len) { int WebSocketImpl::onConnectionOpened() { const lws_protocols *lwsSelectedProtocol = lws_get_protocol(_wsInstance); - _selectedProtocol = lwsSelectedProtocol->name; + _selectedProtocol = lwsSelectedProtocol->name; LOGD("onConnectionOpened...: %p, client protocols: %s, server selected protocol: %s\n", this, _clientSupportedProtocols.c_str(), _selectedProtocol.c_str()); /* * start the ball rolling, @@ -1151,7 +1152,7 @@ int WebSocketImpl::onConnectionOpened() { } std::shared_ptr> isDestroyed = _isDestroyed; - __wsHelper->sendMessageToCocosThread([this, isDestroyed]() { + wsHelper->sendMessageToCocosThread([this, isDestroyed]() { if (*isDestroyed) { LOGD("WebSocket instance was destroyed!\n"); } else { @@ -1172,7 +1173,7 @@ int WebSocketImpl::onConnectionError() { } std::shared_ptr> isDestroyed = _isDestroyed; - __wsHelper->sendMessageToCocosThread([this, isDestroyed]() { + wsHelper->sendMessageToCocosThread([this, isDestroyed]() { if (*isDestroyed) { LOGD("WebSocket instance was destroyed!\n"); } else { @@ -1206,7 +1207,9 @@ int WebSocketImpl::onConnectionClosed() { } return 0; - } else if (_closeState == CloseState::ASYNC_CLOSING) { + } + + if (_closeState == CloseState::ASYNC_CLOSING) { LOGD("onConnectionClosed, WebSocket (%p) is closing by client asynchronously.\n", this); } else { LOGD("onConnectionClosed, WebSocket (%p) is closing by server.\n", this); @@ -1219,7 +1222,7 @@ int WebSocketImpl::onConnectionClosed() { } std::shared_ptr> isDestroyed = _isDestroyed; - __wsHelper->sendMessageToCocosThread([this, isDestroyed]() { + wsHelper->sendMessageToCocosThread([this, isDestroyed]() { if (*isDestroyed) { LOGD("WebSocket instance (%p) was destroyed!\n", this); } else { @@ -1231,7 +1234,7 @@ int WebSocketImpl::onConnectionClosed() { return 0; } -int WebSocketImpl::onSocketCallback(struct lws *wsi, enum lws_callback_reasons reason, void *in, ssize_t len) { +int WebSocketImpl::onSocketCallback(struct lws * /*wsi*/, enum lws_callback_reasons reason, void *in, ssize_t len) { //LOGD("socket callback for %d reason\n", reason); int ret = 0; @@ -1267,7 +1270,7 @@ int WebSocketImpl::onSocketCallback(struct lws *wsi, enum lws_callback_reasons r break; case LWS_CALLBACK_CONFIRM_EXTENSION_OKAY: if (in && len > 0) { - _enabledExtensions.push_back(std::string((char *)in, 0, len)); + _enabledExtensions.emplace_back(static_cast(in), 0, len); } break; default: @@ -1293,10 +1296,10 @@ WebSocket::~WebSocket() { delete _impl; } -bool WebSocket::init(const Delegate &delegate, - const std::string &url, +bool WebSocket::init(const Delegate & delegate, + const std::string & url, const std::vector *protocols /* = nullptr*/, - const std::string &caFilePath /* = ""*/) { + const std::string & caFilePath /* = ""*/) { return _impl->init(delegate, url, protocols, caFilePath); } diff --git a/native/cocos/network/WebSocket.h b/native/cocos/network/WebSocket.h index cf22b2cb8e..7dbcf3ed4f 100644 --- a/native/cocos/network/WebSocket.h +++ b/native/cocos/network/WebSocket.h @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,8 +23,7 @@ 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. - - ****************************************************************************/ +****************************************************************************/ #pragma once @@ -53,8 +53,6 @@ namespace cc { namespace network { -class WebSocketFrame; - /** * WebSocket is wrapper of the libwebsockets-protocol, let the develop could call the websocket easily. * Please note that all public methods of WebSocket have to be invoked on Cocos Thread. @@ -81,23 +79,19 @@ private: * @js NA * @lua NA */ - virtual ~WebSocket(); + ~WebSocket() override; public: /** * Data structure for message */ struct Data { - Data() : bytes(nullptr), - len(0), - issued(0), - isBinary(false), - ext(nullptr) {} - char *bytes; - ssize_t len, issued; - bool isBinary; - void *ext; - ssize_t getRemain() { return std::max((ssize_t)0, len - issued); } + Data() = default; + char *bytes{nullptr}; + ssize_t len{0}, issued{0}; + bool isBinary{false}; + void *ext{nullptr}; + ssize_t getRemain() const { return std::max(static_cast(0), len - issued); } }; /** @@ -128,7 +122,7 @@ public: class Delegate { public: /** Destructor of Delegate. */ - virtual ~Delegate() {} + virtual ~Delegate() = default; /** * This function to be called after the client connection complete a handshake with the remote server. * This means that the WebSocket connection is ready to send and receive data. diff --git a/native/cocos/network/WebSocketServer.cpp b/native/cocos/network/WebSocketServer.cpp index d74b0fef09..4a86cdfeed 100644 --- a/native/cocos/network/WebSocketServer.cpp +++ b/native/cocos/network/WebSocketServer.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,18 +21,20 @@ 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 "base/Config.h" #if (USE_SOCKET > 0) && (USE_WEBSOCKET_SERVER > 0) - #include - #include #include + #include + #include - #include "cocos/base/Scheduler.h" #include "cocos/network/WebSocketServer.h" #include "cocos/platform/Application.h" + #include "cocos/base/Scheduler.h" + #include "cocos/base/Log.h" #define MAX_MSG_PAYLOAD 2048 #define SEND_BUFF 1024 @@ -540,7 +542,7 @@ void WebSocketServerConnection::onHTTP() { if (!len) { n++; continue; - } else if (len + 1 > (int)buf.size()) { + } else if (len + 1 > buf.size()) { buf.resize(len + 1); } lws_hdr_copy(_wsi, buf.data(), buf.size(), idx); diff --git a/native/cocos/network/WebSocketServer.h b/native/cocos/network/WebSocketServer.h index 2b7519da14..976f184860 100644 --- a/native/cocos/network/WebSocketServer.h +++ b/native/cocos/network/WebSocketServer.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #if (USE_SOCKET > 0) && (USE_WEBSOCKET_SERVER > 0) @@ -89,9 +90,9 @@ public: unsigned char *getData() { return _underlyingData.data() + LWS_PRE; } private: - std::vector _underlyingData; - int _consumed = 0; - bool _isBinary = false; + std::vector _underlyingData; + int _consumed = 0; + bool _isBinary = false; std::function _callback; }; @@ -102,9 +103,9 @@ public: enum ReadyState { CONNECTING = 1, - OPEN = 2, - CLOSING = 3, - CLOSED = 4 + OPEN = 2, + CLOSING = 3, + CLOSED = 4 }; void sendTextAsync(const std::string &, std::function callback); @@ -162,7 +163,7 @@ public: void onClientCloseInit(); - inline void setData(void *d) { _data = d; } + inline void setData(void *d) { _data = d; } inline void *getData() const { return _data; } private: @@ -176,31 +177,31 @@ private: void onConnected(); void onDataReceive(void *in, int len); - int onDrainData(); + int onDrainData(); void onHTTP(); void onClientCloseInit(int code, const std::string &msg); void onDestroyClient(); - struct lws *_wsi = nullptr; - std::map _headers; + struct lws * _wsi = nullptr; + std::map _headers; std::list> _sendQueue; - std::shared_ptr _prevPkg; - bool _closed = false; - std::string _closeReason = "close connection"; - int _closeCode = 1000; - std::atomic _readyState{ReadyState::CLOSED}; + std::shared_ptr _prevPkg; + bool _closed = false; + std::string _closeReason = "close connection"; + int _closeCode = 1000; + std::atomic _readyState{ReadyState::CLOSED}; // Attention: do not reference **this** in callbacks - std::function _onclose; - std::function _onerror; + std::function _onclose; + std::function _onerror; std::function)> _ontext; std::function)> _onbinary; std::function)> _ondata; - std::function _onconnect; - std::function _onend; - uv_async_t _async = {0}; - void *_data = nullptr; + std::function _onconnect; + std::function _onend; + uv_async_t _async = {0}; + void * _data = nullptr; friend class WebSocketServer; }; @@ -211,7 +212,7 @@ public: virtual ~WebSocketServer(); static void listenAsync(std::shared_ptr &server, int port, const std::string &host, std::function callback); - void closeAsync(std::function callback = nullptr); + void closeAsync(std::function callback = nullptr); std::vector> getConnections() const; @@ -239,39 +240,39 @@ public: _onbegin = cb; } - inline void setData(void *d) { _data = d; } + inline void setData(void *d) { _data = d; } inline void *getData() const { return _data; } protected: static void listen(std::shared_ptr server, int port, const std::string &host, std::function callback); - bool close(std::function callback = nullptr); + bool close(std::function callback = nullptr); void onCreateClient(struct lws *wsi); void onDestroyClient(struct lws *wsi); void onCloseClient(struct lws *wsi); void onCloseClientInit(struct lws *wsi, void *in, int len); void onClientReceive(struct lws *wsi, void *in, int len); - int onServerWritable(struct lws *wsi); + int onServerWritable(struct lws *wsi); void onClientHTTP(struct lws *wsi); private: std::shared_ptr findConnection(struct lws *wsi); - void destroyContext(); + void destroyContext(); - std::string _host; - lws_context *_ctx = nullptr; - uv_async_t _async = {0}; + std::string _host; + lws_context *_ctx = nullptr; + uv_async_t _async = {0}; - mutable std::mutex _connsMtx; + mutable std::mutex _connsMtx; std::unordered_map> _conns; // Attention: do not reference **this** in callbacks - std::function _onlistening; - std::function _onerror; - std::function _onclose; - std::function _onclose_cb; - std::function _onend; - std::function _onbegin; + std::function _onlistening; + std::function _onerror; + std::function _onclose; + std::function _onclose_cb; + std::function _onend; + std::function _onbegin; std::function)> _onconnection; enum class ServerThreadState { @@ -282,8 +283,8 @@ private: DESTROIED }; std::atomic _serverState{ServerThreadState::NOT_BOOTED}; - std::mutex _serverLock; - void *_data = nullptr; + std::mutex _serverLock; + void * _data = nullptr; public: static int _websocketServerCallback(struct lws *wsi, enum lws_callback_reasons reason, diff --git a/native/cocos/physics/PhysicsSDK.h b/native/cocos/physics/PhysicsSDK.h new file mode 100644 index 0000000000..433e865de6 --- /dev/null +++ b/native/cocos/physics/PhysicsSDK.h @@ -0,0 +1,31 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/sdk/World.h" +#include "physics/sdk/RigidBody.h" +#include "physics/sdk/Shape.h" +#include "physics/sdk/Joint.h" diff --git a/native/cocos/physics/PhysicsSelector.h b/native/cocos/physics/PhysicsSelector.h new file mode 100644 index 0000000000..6fdf4ba78d --- /dev/null +++ b/native/cocos/physics/PhysicsSelector.h @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#if defined(USE_PHYSICS_BULLET) + #include "physics/bullet/Bullet.h" +#else + #include "physics/physx/PhysX.h" + #define WrappedWorld PhysXWorld + #define WrappedRigidBody PhysXRigidBody + #define WrappedSphereShape PhysXSphere + #define WrappedBoxShape PhysXBox + #define WrappedPlaneShape PhysXPlane + #define WrappedCapsuleShape PhysXCapsule + #define WrappedTrimeshShape PhysXTrimesh + #define WrappedTerrainShape PhysXTerrain + #define WrappedConeShape PhysXCone + #define WrappedCylinderShape PhysXCylinder + #define WrappedRevoluteJoint PhysXRevolute + #define WrappedDistanceJoint PhysXDistance +#endif diff --git a/native/cocos/physics/physx/PhysX.h b/native/cocos/physics/physx/PhysX.h new file mode 100644 index 0000000000..f7ed2e8057 --- /dev/null +++ b/native/cocos/physics/physx/PhysX.h @@ -0,0 +1,42 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/PhysXWorld.h" + +#include "physics/physx/PhysXRigidBody.h" + +#include "physics/physx/shapes/PhysXBox.h" +#include "physics/physx/shapes/PhysXCapsule.h" +#include "physics/physx/shapes/PhysXCone.h" +#include "physics/physx/shapes/PhysXCylinder.h" +#include "physics/physx/shapes/PhysXPlane.h" +#include "physics/physx/shapes/PhysXSphere.h" +#include "physics/physx/shapes/PhysXTerrain.h" +#include "physics/physx/shapes/PhysXTrimesh.h" + +#include "physics/physx/joints/PhysXDistance.h" +#include "physics/physx/joints/PhysXRevolute.h" diff --git a/native/cocos/physics/physx/PhysXEventManager.cpp b/native/cocos/physics/physx/PhysXEventManager.cpp new file mode 100644 index 0000000000..7a92b46962 --- /dev/null +++ b/native/cocos/physics/physx/PhysXEventManager.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/PhysXInc.h" +#include "physics/physx/PhysXEventManager.h" +#include "physics/spec/IWorld.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/shapes/PhysXShape.h" +#include + +namespace cc { +namespace physics { + +void PhysXEventManager::SimulationEventCallback::onTrigger(physx::PxTriggerPair *pairs, physx::PxU32 count) { + for (physx::PxU32 i = 0; i < count; i++) { + const physx::PxTriggerPair &tp = pairs[i]; + if (tp.flags & (physx::PxTriggerPairFlag::eREMOVED_SHAPE_TRIGGER | physx::PxTriggerPairFlag::eREMOVED_SHAPE_OTHER)) { + continue; + } + + const auto &selfIter = getPxShapeMap().find(reinterpret_cast(tp.triggerShape)); + const auto &otherIter = getPxShapeMap().find(reinterpret_cast(tp.otherShape)); + if (selfIter == getPxShapeMap().end() || otherIter == getPxShapeMap().end()) { + continue; + } + + const auto &self = selfIter->second; + const auto &other = otherIter->second; + auto & pairs = mManager->getTriggerPairs(); + const auto &iter = std::find_if(pairs.begin(), pairs.end(), [self, other](std::shared_ptr &pair) { + return (pair->shapeA == self || pair->shapeA == other) && (pair->shapeB == self || pair->shapeB == other); + }); + if (tp.status & physx::PxPairFlag::eNOTIFY_TOUCH_FOUND) { + if (iter == pairs.end()) pairs.push_back(std::shared_ptr(new TriggerEventPair{self, other})); + } else if (tp.status & physx::PxPairFlag::eNOTIFY_TOUCH_LOST) { + if (iter != pairs.end()) iter->get()->state = ETouchState::EXIT; + } + } +} + +void PhysXEventManager::SimulationEventCallback::onContact(const physx::PxContactPairHeader & /*header*/, const physx::PxContactPair *pairs, physx::PxU32 count) { + for (physx::PxU32 i = 0; i < count; i++) { + const physx::PxContactPair &cp = pairs[i]; + if (cp.flags & (physx::PxContactPairFlag::eREMOVED_SHAPE_0 | physx::PxContactPairFlag::eREMOVED_SHAPE_1)) { + continue; + } + + const auto &selfIter = getPxShapeMap().find(reinterpret_cast(cp.shapes[0])); + const auto &otherIter = getPxShapeMap().find(reinterpret_cast(cp.shapes[1])); + if (selfIter == getPxShapeMap().end() || otherIter == getPxShapeMap().end()) { + continue; + } + + const auto &self = selfIter->second; + const auto &other = otherIter->second; + auto & pairs = mManager->getConatctPairs(); + auto iter = std::find_if(pairs.begin(), pairs.end(), [self, other](std::shared_ptr &pair) { + return (pair->shapeA == self || pair->shapeA == other) && (pair->shapeB == self || pair->shapeB == other); + }); + + if (cp.events & physx::PxPairFlag::eNOTIFY_TOUCH_PERSISTS) { + if (iter != pairs.end()) iter->get()->state = ETouchState::STAY; + } else if (cp.events & physx::PxPairFlag::eNOTIFY_TOUCH_FOUND) { + if (iter == pairs.end()) { + pairs.push_back(std::shared_ptr(new ContactEventPair{self, other})); + iter = pairs.end() - 1; + } + } else if (cp.events & physx::PxPairFlag::eNOTIFY_TOUCH_LOST) { + if (iter != pairs.end()) iter->get()->state = ETouchState::EXIT; + } + + if (iter != pairs.end()) { + const physx::PxU8 &contactCount = cp.contactCount; + iter->get()->contacts.resize(contactCount); + if (contactCount > 0) { + cp.extractContacts(reinterpret_cast(&iter->get()->contacts[0]), contactCount); + } + } + } +} + +void PhysXEventManager::refreshPairs() { + for (auto iter = getTriggerPairs().begin(); iter != getTriggerPairs().end();) { + const auto &selfIter = getPxShapeMap().find(reinterpret_cast(&(reinterpret_cast(iter->get()->shapeA)->getShape()))); + const auto &otherIter = getPxShapeMap().find(reinterpret_cast(&(reinterpret_cast(iter->get()->shapeB)->getShape()))); + if (selfIter == getPxShapeMap().end() || otherIter == getPxShapeMap().end()) { + iter = getTriggerPairs().erase(iter); + } else if (iter->get()->state == ETouchState::EXIT) { + iter = getTriggerPairs().erase(iter); + } else { + iter->get()->state = ETouchState::STAY; + iter++; + } + } + + for (auto iter = getConatctPairs().begin(); iter != getConatctPairs().end();) { + const auto &selfIter = getPxShapeMap().find(reinterpret_cast(&(reinterpret_cast(iter->get()->shapeA)->getShape()))); + const auto &otherIter = getPxShapeMap().find(reinterpret_cast(&(reinterpret_cast(iter->get()->shapeB)->getShape()))); + if (selfIter == getPxShapeMap().end() || otherIter == getPxShapeMap().end()) { + iter = getConatctPairs().erase(iter); + } else if (iter->get()->state == ETouchState::EXIT) { + iter = getConatctPairs().erase(iter); + } else { + iter++; + } + } +} + +} // namespace physics +} // namespace cc \ No newline at end of file diff --git a/native/cocos/physics/physx/PhysXEventManager.h b/native/cocos/physics/physx/PhysXEventManager.h new file mode 100644 index 0000000000..4499a5fcad --- /dev/null +++ b/native/cocos/physics/physx/PhysXEventManager.h @@ -0,0 +1,72 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IWorld.h" +#include "physics/physx/PhysXInc.h" +#include "base/Macros.h" +#include +#include + +namespace cc { +namespace physics { + +class PhysXEventManager final { +public: + PhysXEventManager() { + _mCallback = new SimulationEventCallback(this); + } + + ~PhysXEventManager() { + delete _mCallback; + } + + struct SimulationEventCallback : public physx::PxSimulationEventCallback { + void onConstraintBreak(physx::PxConstraintInfo * /*constraints*/, physx::PxU32 /*count*/) override{}; + void onWake(physx::PxActor ** /*actors*/, physx::PxU32 /*count*/) override{}; + void onSleep(physx::PxActor ** /*actors*/, physx::PxU32 /*count*/) override{}; + void onTrigger(physx::PxTriggerPair * /*pairs*/, physx::PxU32 /*count*/) override; + void onContact(const physx::PxContactPairHeader & /*pairHeader*/, const physx::PxContactPair * /*pairs*/, physx::PxU32 /*nbPairs*/) override; + void onAdvance(const physx::PxRigidBody *const * /*bodyBuffer*/, const physx::PxTransform * /*poseBuffer*/, const physx::PxU32 /*count*/) override{}; + PhysXEventManager *mManager; + + public: + explicit SimulationEventCallback(PhysXEventManager *m) : mManager(m) {} + }; + + CC_INLINE SimulationEventCallback &getEventCallback() { return *_mCallback; } + CC_INLINE std::vector> &getTriggerPairs() { return _mTriggerPairs; } + CC_INLINE std::vector> &getConatctPairs() { return _mConatctPairs; } + void refreshPairs(); + +private: + std::vector> _mTriggerPairs; + std::vector> _mConatctPairs; + SimulationEventCallback *_mCallback; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXFilterShader.cpp b/native/cocos/physics/physx/PhysXFilterShader.cpp new file mode 100644 index 0000000000..83b63a5406 --- /dev/null +++ b/native/cocos/physics/physx/PhysXFilterShader.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/PhysXInc.h" +#include "physics/physx/PhysXFilterShader.h" + +namespace cc { +namespace physics { + +physx::PxFilterFlags simpleFilterShader( + physx::PxFilterObjectAttributes attributes0, physx::PxFilterData fd0, + physx::PxFilterObjectAttributes attributes1, physx::PxFilterData fd1, + physx::PxPairFlags &pairFlags, const void* constantBlock, physx::PxU32 constantBlockSize){ + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + // group mask filter + if (!(fd0.word0 & fd1.word1) || !(fd0.word1 & fd1.word0)) { + return physx::PxFilterFlag::eSUPPRESS; + } + + if (physx::PxFilterObjectIsTrigger(attributes0) || physx::PxFilterObjectIsTrigger(attributes1)) { + pairFlags |= physx::PxPairFlag::eTRIGGER_DEFAULT | physx::PxPairFlag::eNOTIFY_TOUCH_CCD; + return physx::PxFilterFlag::eDEFAULT; + } + if (!physx::PxFilterObjectIsKinematic(attributes0) || !physx::PxFilterObjectIsKinematic(attributes1)) { + pairFlags |= physx::PxPairFlag::eSOLVE_CONTACT; + } + pairFlags |= physx::PxPairFlag::eDETECT_DISCRETE_CONTACT | + physx::PxPairFlag::eNOTIFY_TOUCH_FOUND | physx::PxPairFlag::eNOTIFY_TOUCH_LOST | physx::PxPairFlag::eNOTIFY_TOUCH_PERSISTS | + physx::PxPairFlag::eDETECT_CCD_CONTACT | physx::PxPairFlag::eNOTIFY_CONTACT_POINTS; + return physx::PxFilterFlag::eDEFAULT; +} + +physx::PxFilterFlags advanceFilterShader( + physx::PxFilterObjectAttributes attributes0, physx::PxFilterData fd0, + physx::PxFilterObjectAttributes attributes1, physx::PxFilterData fd1, + physx::PxPairFlags &pairFlags, const void* constantBlock, physx::PxU32 constantBlockSize){ + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + // group mask filter + if (!(fd0.word0 & fd1.word1) || !(fd0.word1 & fd1.word0)) { + return physx::PxFilterFlag::eSUPPRESS; + } + + pairFlags = physx::PxPairFlags(0); + + // trigger filter + if (physx::PxFilterObjectIsTrigger(attributes0) || physx::PxFilterObjectIsTrigger(attributes1)) { + pairFlags |= physx::PxPairFlag::eDETECT_DISCRETE_CONTACT; + + // need trigger event? + const physx::PxU16 needTriggerEvent = (fd0.word3 & DETECT_TRIGGER_EVENT) | (fd1.word3 & DETECT_TRIGGER_EVENT); + if (needTriggerEvent) { + pairFlags |= physx::PxPairFlag::eNOTIFY_TOUCH_FOUND | physx::PxPairFlag::eNOTIFY_TOUCH_LOST; + return physx::PxFilterFlag::eDEFAULT; + } + return physx::PxFilterFlag::eSUPPRESS; + } + + // need detect ccd contact? + const physx::PxU16 needDetectCCD = (fd0.word3 & DETECT_CONTACT_CCD) | (fd1.word3 & DETECT_CONTACT_CCD); + if (needDetectCCD) pairFlags |= physx::PxPairFlag::eDETECT_CCD_CONTACT; + + if (!physx::PxFilterObjectIsKinematic(attributes0) || !physx::PxFilterObjectIsKinematic(attributes1)) { + pairFlags |= physx::PxPairFlag::eSOLVE_CONTACT; + } + + // simple collision process + pairFlags |= physx::PxPairFlag::eDETECT_DISCRETE_CONTACT; + + // need contact event? + const physx::PxU16 needContactEvent = (fd0.word3 & DETECT_CONTACT_EVENT) | (fd1.word3 & DETECT_CONTACT_EVENT); + if (needContactEvent) pairFlags |= physx::PxPairFlag::eNOTIFY_TOUCH_FOUND | physx::PxPairFlag::eNOTIFY_TOUCH_LOST | physx::PxPairFlag::eNOTIFY_TOUCH_PERSISTS; + + // need contact point? + const physx::PxU16 needContactPoint = (fd0.word3 & DETECT_CONTACT_POINT) | (fd1.word3 & DETECT_CONTACT_POINT); + if (needContactPoint) pairFlags |= physx::PxPairFlag::eNOTIFY_CONTACT_POINTS; + + return physx::PxFilterFlag::eDEFAULT; +} + +physx::PxQueryHitType::Enum QueryFilterShader::preFilter(const physx::PxFilterData& filterData, const physx::PxShape* shape, + const physx::PxRigidActor* actor, physx::PxHitFlags& queryFlags) { + PX_UNUSED(actor); + PX_UNUSED(queryFlags); + if ((filterData.word3 & QUERY_CHECK_TRIGGER) && shape->getFlags().isSet(physx::PxShapeFlag::eTRIGGER_SHAPE)) { + return physx::PxQueryHitType::eNONE; + } + return filterData.word3 & QUERY_SINGLE_HIT ? physx::PxQueryHitType::eBLOCK : physx::PxQueryHitType::eTOUCH; +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXFilterShader.h b/native/cocos/physics/physx/PhysXFilterShader.h new file mode 100644 index 0000000000..b6fbf50df8 --- /dev/null +++ b/native/cocos/physics/physx/PhysXFilterShader.h @@ -0,0 +1,63 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/PhysXInc.h" + +namespace cc { +namespace physics { + +constexpr physx::PxU32 QUERY_FILTER = 1 << 0; +constexpr physx::PxU32 QUERY_CHECK_TRIGGER = 1 << 1; +constexpr physx::PxU32 QUERY_SINGLE_HIT = 1 << 2; +constexpr physx::PxU32 DETECT_TRIGGER_EVENT = 1 << 3; +constexpr physx::PxU32 DETECT_CONTACT_EVENT = 1 << 4; +constexpr physx::PxU32 DETECT_CONTACT_POINT = 1 << 5; +constexpr physx::PxU32 DETECT_CONTACT_CCD = 1 << 6; + +physx::PxFilterFlags simpleFilterShader( + physx::PxFilterObjectAttributes attributes0, physx::PxFilterData fd0, + physx::PxFilterObjectAttributes attributes1, physx::PxFilterData fd1, + physx::PxPairFlags &pairFlags, const void* constantBlock, physx::PxU32 constantBlockSize); + +physx::PxFilterFlags advanceFilterShader( + physx::PxFilterObjectAttributes attributes0, physx::PxFilterData fd0, + physx::PxFilterObjectAttributes attributes1, physx::PxFilterData fd1, + physx::PxPairFlags &pairFlags, const void* constantBlock, physx::PxU32 constantBlockSize); + +class QueryFilterShader : public physx::PxSceneQueryFilterCallback { +public: + physx::PxQueryHitType::Enum preFilter(const physx::PxFilterData &filterData, const physx::PxShape *shape, + const physx::PxRigidActor *actor, physx::PxHitFlags &queryFlags) override; + physx::PxQueryHitType::Enum postFilter(const physx::PxFilterData & filterData, const physx::PxQueryHit & hit) override { + PX_UNUSED(filterData); + PX_UNUSED(hit); + return physx::PxQueryHitType::eNONE; + }; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXInc.h b/native/cocos/physics/physx/PhysXInc.h new file mode 100644 index 0000000000..e4bc9a3ef4 --- /dev/null +++ b/native/cocos/physics/physx/PhysXInc.h @@ -0,0 +1,46 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#if defined(_MSC_VER) + #pragma warning(disable : 4250) + #pragma warning(disable : 4996) +#endif + +#include "base/Macros.h" + +#if !defined(NDEBUG) ^ defined(_DEBUG) + #ifdef CC_DEBUG + #define _DEBUG + #else + #define NDEBUG + #endif +#endif + +#include +#include +#include +#include diff --git a/native/cocos/physics/physx/PhysXRigidBody.cpp b/native/cocos/physics/physx/PhysXRigidBody.cpp new file mode 100644 index 0000000000..d3e375ff11 --- /dev/null +++ b/native/cocos/physics/physx/PhysXRigidBody.cpp @@ -0,0 +1,258 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/PhysXInc.h" +#include "physics/physx/PhysXRigidBody.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" + +using physx::PxReal; +using physx::PxVec3; +using physx::PxTransform; +using physx::PxForceMode; +using physx::PxActorFlag; + +namespace cc { +namespace physics { + +PhysXRigidBody::PhysXRigidBody() : _mEnabled(false), + _mGroup(1) {} + +void PhysXRigidBody::initialize(uint h, ERigidBodyType t, uint32_t g) { + _mGroup = g; + PhysXWorld &ins = PhysXWorld::getInstance(); + _mSharedBody = ins.getSharedBody(h, this); + getSharedBody().reference(true); + getSharedBody().setType(t); +} + +void PhysXRigidBody::onEnable() { + _mEnabled = true; + getSharedBody().enabled(true); +} + +void PhysXRigidBody::onDisable() { + _mEnabled = false; + getSharedBody().enabled(false); +} + +void PhysXRigidBody::onDestroy() { + getSharedBody().reference(false); +} + +bool PhysXRigidBody::isAwake() { + if (getSharedBody().isStatic()) return false; + return !getSharedBody().getImpl().rigidDynamic->isSleeping(); +} + +bool PhysXRigidBody::isSleepy() { + return false; +} + +bool PhysXRigidBody::isSleeping() { + if (getSharedBody().isStatic()) return true; + return getSharedBody().getImpl().rigidDynamic->isSleeping(); +} + +void PhysXRigidBody::setType(ERigidBodyType v) { + getSharedBody().setType(v); +} + +void PhysXRigidBody::setMass(float v) { + getSharedBody().setMass(v); +} + +void PhysXRigidBody::setLinearDamping(float v) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setLinearDamping(v); +} + +void PhysXRigidBody::setAngularDamping(float v) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setAngularDamping(v); +} + +void PhysXRigidBody::useGravity(bool v) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setActorFlag(PxActorFlag::eDISABLE_GRAVITY, !v); +} + +void PhysXRigidBody::setLinearFactor(float x, float y, float z) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setRigidDynamicLockFlag(physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_X, x == 0.); + getSharedBody().getImpl().rigidDynamic->setRigidDynamicLockFlag(physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y, y == 0.); + getSharedBody().getImpl().rigidDynamic->setRigidDynamicLockFlag(physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_Z, z == 0.); +} + +void PhysXRigidBody::setAngularFactor(float x, float y, float z) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setRigidDynamicLockFlag(physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X, x == 0.); + getSharedBody().getImpl().rigidDynamic->setRigidDynamicLockFlag(physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y, y == 0.); + getSharedBody().getImpl().rigidDynamic->setRigidDynamicLockFlag(physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z, z == 0.); +} + +void PhysXRigidBody::setAllowSleep(bool v) { + if (!getSharedBody().isDynamic()) return; + PxReal st = getSharedBody().getImpl().rigidDynamic->getSleepThreshold(); + PxReal wc = v ? std::max(0.F, st - 0.001F) : FLT_MAX; + getSharedBody().getImpl().rigidDynamic->setWakeCounter(wc); +} + +void PhysXRigidBody::wakeUp() { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->wakeUp(); +} + +void PhysXRigidBody::sleep() { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->putToSleep(); +} + +void PhysXRigidBody::clearState() { + clearForces(); + clearVelocity(); +} + +void PhysXRigidBody::clearForces() { + getSharedBody().clearForces(); +} + +void PhysXRigidBody::clearVelocity() { + getSharedBody().clearVelocity(); +} + +void PhysXRigidBody::setSleepThreshold(float v) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setSleepThreshold(v); +} + +float PhysXRigidBody::getSleepThreshold() { + return getSharedBody().getImpl().rigidDynamic->getSleepThreshold(); +} + +cc::Vec3 PhysXRigidBody::getLinearVelocity() { + if (getSharedBody().isStatic()) return cc::Vec3::ZERO; + cc::Vec3 cv; + pxSetVec3Ext(cv, getSharedBody().getImpl().rigidDynamic->getLinearVelocity()); + return cv; +} + +void PhysXRigidBody::setLinearVelocity(float x, float y, float z) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setLinearVelocity(PxVec3{x, y, z}); +} + +cc::Vec3 PhysXRigidBody::getAngularVelocity() { + if (getSharedBody().isStatic()) return cc::Vec3::ZERO; + cc::Vec3 cv; + pxSetVec3Ext(cv, getSharedBody().getImpl().rigidDynamic->getAngularVelocity()); + return cv; +} + +void PhysXRigidBody::setAngularVelocity(float x, float y, float z) { + if (getSharedBody().isStatic()) return; + getSharedBody().getImpl().rigidDynamic->setAngularVelocity(PxVec3{x, y, z}); +} + +void PhysXRigidBody::applyForce(float x, float y, float z, float rx, float ry, float rz) { + if (getSharedBody().isStatic()) return; + const PxVec3 force{x, y, z}; + if (force.isZero()) return; + auto *body = getSharedBody().getImpl().rigidDynamic; + body->addForce(force, PxForceMode::eFORCE, true); + const PxVec3 torque = (PxVec3{rx, ry, rz}).cross(force); + if (!torque.isZero()) body->addTorque(torque, PxForceMode::eFORCE, true); +} + +void PhysXRigidBody::applyLocalForce(float x, float y, float z, float rx, float ry, float rz) { + if (getSharedBody().isStatic()) return; + const PxVec3 force{x, y, z}; + if (force.isZero()) return; + auto *body = getSharedBody().getImpl().rigidDynamic; + const PxTransform bodyPose = body->getGlobalPose(); + const PxVec3 worldForce = bodyPose.rotate(force); + const PxVec3 worldPos = bodyPose.rotate(PxVec3{rx, ry, rz}); + body->addForce(worldForce, PxForceMode::eFORCE, true); + const PxVec3 torque = worldPos.cross(worldForce); + if (!torque.isZero()) body->addTorque(torque, PxForceMode::eFORCE, true); +} + +void PhysXRigidBody::applyImpulse(float x, float y, float z, float rx, float ry, float rz) { + if (getSharedBody().isStatic()) return; + const PxVec3 impulse{x, y, z}; + if (impulse.isZero()) return; + auto *body = getSharedBody().getImpl().rigidDynamic; + const PxVec3 torque = (PxVec3{rx, ry, rz}).cross(impulse); + body->addForce(impulse, PxForceMode::eIMPULSE, true); + if (!torque.isZero()) body->addTorque(torque, PxForceMode::eIMPULSE, true); +} + +void PhysXRigidBody::applyLocalImpulse(float x, float y, float z, float rx, float ry, float rz) { + if (getSharedBody().isStatic()) return; + const PxVec3 impulse{x, y, z}; + if (impulse.isZero()) return; + auto *body = getSharedBody().getImpl().rigidDynamic; + const PxTransform bodyPose = body->getGlobalPose(); + const PxVec3 worldImpulse = bodyPose.rotate(impulse); + const PxVec3 worldPos = bodyPose.rotate(PxVec3{rx, ry, rz}); + body->addForce(worldImpulse, PxForceMode::eIMPULSE, true); + const PxVec3 torque = worldPos.cross(worldImpulse); + if (!torque.isZero()) body->addTorque(torque, PxForceMode::eIMPULSE, true); +} + +void PhysXRigidBody::applyTorque(float x, float y, float z) { + if (getSharedBody().isStatic()) return; + PxVec3 torque{x, y, z}; + if (torque.isZero()) return; + getSharedBody().getImpl().rigidDynamic->addTorque(torque, PxForceMode::eFORCE, true); +} + +void PhysXRigidBody::applyLocalTorque(float x, float y, float z) { + if (getSharedBody().isStatic()) return; + PxVec3 torque{x, y, z}; + if (torque.isZero()) return; + auto *body = getSharedBody().getImpl().rigidDynamic; + const PxTransform bodyPose = body->getGlobalPose(); + body->addTorque(bodyPose.rotate(PxVec3{x, y, z}), PxForceMode::eFORCE, true); +} + +uint32_t PhysXRigidBody::getGroup() { + return getSharedBody().getGroup(); +} + +void PhysXRigidBody::setGroup(uint32_t g) { + getSharedBody().setGroup(g); +} + +uint32_t PhysXRigidBody::getMask() { + return getSharedBody().getMask(); +} + +void PhysXRigidBody::setMask(uint32_t m) { + getSharedBody().setMask(m); +} + +} // namespace physics +} // namespace cc \ No newline at end of file diff --git a/native/cocos/physics/physx/PhysXRigidBody.h b/native/cocos/physics/physx/PhysXRigidBody.h new file mode 100644 index 0000000000..d5cfcfe016 --- /dev/null +++ b/native/cocos/physics/physx/PhysXRigidBody.h @@ -0,0 +1,91 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IBody.h" +#include "physics/physx//PhysXInc.h" +#include "base/Macros.h" +#include "physics/physx/PhysXSharedBody.h" + +namespace cc { +namespace physics { + +class PhysXRigidBody final : public IRigidBody { +public: + PhysXRigidBody(); + ~PhysXRigidBody() override = default; + CC_INLINE bool isEnabled() const { return _mEnabled; } + CC_INLINE const PhysXSharedBody &getSharedBody() const { return *_mSharedBody; } + CC_INLINE PhysXSharedBody &getSharedBody() { return *_mSharedBody; } + CC_INLINE uintptr_t getImpl() override { return reinterpret_cast(this); } + CC_INLINE uint getNodeHandle() override { return _mSharedBody->getNodeHandle(); } + void initialize(uint h, ERigidBodyType t, uint32_t g) override; + void onEnable() override; + void onDisable() override; + void onDestroy() override; + bool isAwake() override; + bool isSleepy() override; + bool isSleeping() override; + void setType(ERigidBodyType v) override; + void setMass(float v) override; + void setLinearDamping(float v) override; + void setAngularDamping(float v) override; + void useGravity(bool v) override; + void setLinearFactor(float x, float y, float z) override; + void setAngularFactor(float x, float y, float z) override; + void setAllowSleep(bool v) override; + void wakeUp() override; + void sleep() override; + void clearState() override; + void clearForces() override; + void clearVelocity() override; + void setSleepThreshold(float v) override; + float getSleepThreshold() override; + cc::Vec3 getLinearVelocity() override; + void setLinearVelocity(float x, float y, float z) override; + cc::Vec3 getAngularVelocity() override; + void setAngularVelocity(float x, float y, float z) override; + void applyForce(float x, float y, float z, float rx, float ry, float rz) override; + void applyLocalForce(float x, float y, float z, float rx, float ry, float rz) override; + void applyImpulse(float x, float y, float z, float rx, float ry, float rz) override; + void applyLocalImpulse(float x, float y, float z, float rx, float ry, float rz) override; + void applyTorque(float x, float y, float z) override; + void applyLocalTorque(float x, float y, float z) override; + uint32_t getGroup() override; + uint32_t getMask() override; + void setGroup(uint32_t g) override; + void setMask(uint32_t m) override; + CC_INLINE uint32_t getInitialGroup() const { return _mGroup; } + +protected: + // physx::PhysXWorld* mWrappedWorld; + PhysXSharedBody *_mSharedBody; + uint32_t _mGroup; + bool _mEnabled; +}; + +} // namespace physics +} // namespace cc \ No newline at end of file diff --git a/native/cocos/physics/physx/PhysXSharedBody.cpp b/native/cocos/physics/physx/PhysXSharedBody.cpp new file mode 100644 index 0000000000..96efaede5b --- /dev/null +++ b/native/cocos/physics/physx/PhysXSharedBody.cpp @@ -0,0 +1,355 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/PhysXInc.h" +#include "physics/physx/PhysXSharedBody.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" +#include "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/joints/PhysXJoint.h" +#include + +using physx::PxVec3; +using physx::PxQuat; +using physx::PxIdentity; +using physx::PxPhysics; +using physx::PxFilterData; +using physx::PxJointActorIndex; +using physx::PxTransform; +using physx::PxForceMode; +using physx::PxRigidBodyFlag; +using physx::PxRigidActor; +using physx::PxRigidBodyExt; + +namespace cc { +namespace physics { +std::map PhysXSharedBody::sharedBodesMap = std::map(); + +static int idCounter = 0; +PhysXSharedBody::PhysXSharedBody( + const uint & handle, + PhysXWorld *const world, + PhysXRigidBody *const body) : _mID(idCounter++), + _mRef(0), + _mType(ERigidBodyType::STATIC), + _mIsStatic(true), + _mIndex(-1), + _mFilterData(1, 1, 0, 0), + _mNodeHandle(handle), + _mStaticActor(nullptr), + _mDynamicActor(nullptr), + _mWrappedWorld(world), + _mWrappedBody(body) { + _mImpl.ptr = 0; + _mNode = cc::pipeline::SharedMemory::getBuffer(_mNodeHandle); +}; + +PhysXSharedBody *PhysXSharedBody::getSharedBody(const uint handle, PhysXWorld *const world, PhysXRigidBody *const body) { + auto iter = sharedBodesMap.find(handle); + PhysXSharedBody *newSB; + if (iter != sharedBodesMap.end()) { + newSB = iter->second; + } else { + newSB = new PhysXSharedBody(handle, world, body); + newSB->_mFilterData.word0 = 1; + newSB->_mFilterData.word1 = world->getMaskByIndex(0); + sharedBodesMap.insert(std::pair(handle, newSB)); + } + if (body != nullptr) { + auto g = body->getInitialGroup(); + newSB->_mFilterData.word0 = g; + newSB->_mFilterData.word1 = world->getMaskByIndex(static_cast(log2(g))); + } + return newSB; +} + +PhysXSharedBody::~PhysXSharedBody() { + if (_mStaticActor != nullptr) PX_RELEASE(_mStaticActor); + if (_mDynamicActor != nullptr) PX_RELEASE(_mDynamicActor); +} + +PhysXSharedBody::UActor PhysXSharedBody::getImpl() { + initActor(); + _mImpl.ptr = isStatic() ? reinterpret_cast(_mStaticActor) : reinterpret_cast(_mDynamicActor); + return _mImpl; +} + +void PhysXSharedBody::setType(ERigidBodyType v) { + if (_mType == v) return; + _mType = v; + initActor(); + _mImpl.ptr = isStatic() ? reinterpret_cast(_mStaticActor) : reinterpret_cast(_mDynamicActor); +} + +void PhysXSharedBody::reference(bool v) { + v ? _mRef++ : _mRef--; + if (_mRef == 0) delete this; +} + +void PhysXSharedBody::enabled(bool v) { + if (v) { + if (_mIndex < 0) { + _mIndex = 1; + _mWrappedWorld->addActor(*this); + } + } else { + auto *wb = _mWrappedBody; + auto ws = _mWrappedShapes; + auto isRemove = ws.empty() && (wb == nullptr || (wb != nullptr && !wb->isEnabled())); + if (isRemove) { + _mIndex = -1; + _mWrappedWorld->removeActor(*this); + } + } +} + +void PhysXSharedBody::initActor() { + const bool temp = _mIsStatic; + if (isStatic()) { + _mIsStatic = true; + initStaticActor(); + } else { + _mIsStatic = false; + initDynamicActor(); + } + if (temp != _mIsStatic) switchActor(temp); +} + +void PhysXSharedBody::switchActor(const bool isStaticBefore) { + if (_mStaticActor == nullptr || _mDynamicActor == nullptr) return; + PxRigidActor &a0 = isStaticBefore ? *reinterpret_cast(_mStaticActor) : *reinterpret_cast(_mDynamicActor); + PxRigidActor &a1 = !isStaticBefore ? *reinterpret_cast(_mStaticActor) : *reinterpret_cast(_mDynamicActor); + if (_mIndex >= 0) { + _mWrappedWorld->getScene().removeActor(a0, false); + _mWrappedWorld->getScene().addActor(a1); + } + for (auto const &ws : _mWrappedShapes) { + a0.detachShape(ws->getShape(), false); + a1.attachShape(ws->getShape()); + } + if (isStaticBefore) { + if (isDynamic()) _mDynamicActor->wakeUp(); + _mDynamicActor->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, isKinematic()); + PxRigidBodyExt::setMassAndUpdateInertia(*_mDynamicActor, _mMass); + PxTransform com{PxIdentity}; + for (auto const &ws : _mWrappedShapes) { + if (!ws->isTrigger()) com.p -= ws->getCenter(); + } + _mDynamicActor->setCMassLocalPose(com); + } +} + +void PhysXSharedBody::initStaticActor() { + if (_mStaticActor == nullptr) { + PxTransform transform{PxIdentity}; + pxSetVec3Ext(transform.p, getNode().worldPosition); + pxSetQuatExt(transform.q, getNode().worldRotation); + if (!transform.p.isFinite()) transform.p = PxVec3{PxIdentity}; + if (!transform.q.isUnit()) transform.q = PxQuat{PxIdentity}; + PxPhysics &phy = PxGetPhysics(); + _mStaticActor = phy.createRigidStatic(transform); + } +} + +void PhysXSharedBody::initDynamicActor() { + if (_mDynamicActor == nullptr) { + PxTransform transform{PxIdentity}; + pxSetVec3Ext(transform.p, getNode().worldPosition); + pxSetQuatExt(transform.q, getNode().worldRotation); + if (!transform.p.isFinite()) transform.p = PxVec3{PxIdentity}; + if (!transform.q.isUnit()) transform.q = PxQuat{PxIdentity}; + PxPhysics &phy = PxGetPhysics(); + _mDynamicActor = phy.createRigidDynamic(transform); + _mDynamicActor->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, isKinematic()); + } +} + +void PhysXSharedBody::updateCenterOfMass() { + initActor(); + if (isStatic()) return; + PxTransform com{PxIdentity}; + for (auto const &ws : _mWrappedShapes) { + if (!ws->isTrigger()) com.p -= ws->getCenter(); + } + _mDynamicActor->setCMassLocalPose(com); +} + +void PhysXSharedBody::syncScale() { + for (auto const &sb : _mWrappedShapes) { + sb->updateScale(); + } + + for (auto const &sb : _mWrappedJoints0) { + sb->updateScale0(); + } + + for (auto const &sb : _mWrappedJoints1) { + sb->updateScale1(); + } +} + +void PhysXSharedBody::syncSceneToPhysics() { + if (getNode().flagsChanged) { + if (getNode().flagsChanged & static_cast(TransformBit::SCALE)) syncScale(); + auto wp = getImpl().rigidActor->getGlobalPose(); + if (getNode().flagsChanged & static_cast(TransformBit::POSITION)) { + pxSetVec3Ext(wp.p, getNode().worldPosition); + } + if (getNode().flagsChanged & static_cast(TransformBit::ROTATION)) { + pxSetQuatExt(wp.q, getNode().worldRotation); + } + + if (isKinematic()) { + getImpl().rigidDynamic->setKinematicTarget(wp); + } else { + getImpl().rigidActor->setGlobalPose(wp, true); + } + } +} + +void PhysXSharedBody::syncSceneWithCheck() { + if (getNode().flagsChanged & static_cast(TransformBit::SCALE)) syncScale(); + auto wp = getImpl().rigidActor->getGlobalPose(); + bool needUpdate = false; + if (wp.p != getNode().worldPosition) { + pxSetVec3Ext(wp.p, getNode().worldPosition); + needUpdate = true; + } + if (wp.q != getNode().worldRotation) { + pxSetQuatExt(wp.q, getNode().worldRotation); + needUpdate = true; + } + if (needUpdate) { + getImpl().rigidActor->setGlobalPose(wp, true); + } +} + +void PhysXSharedBody::syncPhysicsToScene() { + if (isStaticOrKinematic()) return; + if (_mDynamicActor->isSleeping()) return; + const PxTransform &wp = getImpl().rigidActor->getGlobalPose(); + pxSetVec3Ext(getNode().worldPosition, wp.p); + pxSetQuatExt(getNode().worldRotation, wp.q); + getNode().flagsChanged |= static_cast(TransformBit::POSITION) | static_cast(TransformBit::ROTATION); +} + +void PhysXSharedBody::addShape(PhysXShape &shape) { + auto beg = _mWrappedShapes.begin(); + auto end = _mWrappedShapes.end(); + auto iter = find(beg, end, &shape); + if (iter == end) { + shape.getShape().setSimulationFilterData(_mFilterData); + shape.getShape().setQueryFilterData(_mFilterData); + getImpl().rigidActor->attachShape(shape.getShape()); + _mWrappedShapes.push_back(&shape); + if (!shape.isTrigger()) { + if (!shape.getCenter().isZero()) updateCenterOfMass(); + if (isDynamic()) PxRigidBodyExt::setMassAndUpdateInertia(*getImpl().rigidDynamic, _mMass); + } + } +} + +void PhysXSharedBody::removeShape(PhysXShape &shape) { + auto beg = _mWrappedShapes.begin(); + auto end = _mWrappedShapes.end(); + auto iter = find(beg, end, &shape); + if (iter != end) { + _mWrappedShapes.erase(iter); + getImpl().rigidActor->detachShape(shape.getShape(), true); + if (!shape.isTrigger()) { + if (!shape.getCenter().isZero()) updateCenterOfMass(); + if (isDynamic()) PxRigidBodyExt::setMassAndUpdateInertia(*getImpl().rigidDynamic, _mMass); + } + } +} + +void PhysXSharedBody::addJoint(PhysXJoint &joint, const PxJointActorIndex::Enum index) { + if (index == PxJointActorIndex::eACTOR1) { + auto beg = _mWrappedJoints1.begin(); + auto end = _mWrappedJoints1.end(); + auto iter = find(beg, end, &joint); + if (iter == end) _mWrappedJoints1.push_back(&joint); + } else { + auto beg = _mWrappedJoints0.begin(); + auto end = _mWrappedJoints0.end(); + auto iter = find(beg, end, &joint); + if (iter == end) _mWrappedJoints0.push_back(&joint); + } +} + +void PhysXSharedBody::removeJoint(PhysXJoint &joint, const PxJointActorIndex::Enum index) { + if (index == PxJointActorIndex::eACTOR1) { + auto beg = _mWrappedJoints1.begin(); + auto end = _mWrappedJoints1.end(); + auto iter = find(beg, end, &joint); + if (iter != end) _mWrappedJoints1.erase(iter); + } else { + auto beg = _mWrappedJoints0.begin(); + auto end = _mWrappedJoints0.end(); + auto iter = find(beg, end, &joint); + if (iter != end) _mWrappedJoints0.erase(iter); + } +} + +void PhysXSharedBody::setMass(float v) { + if (v <= 0) v = 1e-7F; + _mMass = v; + if (isDynamic()) PxRigidBodyExt::setMassAndUpdateInertia(*getImpl().rigidDynamic, _mMass); +} + +void PhysXSharedBody::setGroup(uint32_t v) { + _mFilterData.word0 = v; + setCollisionFilter(_mFilterData); +} + +void PhysXSharedBody::setMask(uint32_t v) { + _mFilterData.word1 = v; + setCollisionFilter(_mFilterData); +} + +void PhysXSharedBody::setCollisionFilter(PxFilterData &data) { + if (isDynamic()) _mDynamicActor->wakeUp(); + for (auto const &ws : _mWrappedShapes) { + ws->getShape().setQueryFilterData(data); + ws->getShape().setSimulationFilterData(data); + } +} + +void PhysXSharedBody::clearForces() { + if (isStaticOrKinematic()) return; + _mDynamicActor->clearForce(PxForceMode::eFORCE); + _mDynamicActor->clearForce(PxForceMode::eIMPULSE); + _mDynamicActor->clearTorque(PxForceMode::eFORCE); + _mDynamicActor->clearTorque(PxForceMode::eIMPULSE); +} + +void PhysXSharedBody::clearVelocity() { + if (isStaticOrKinematic()) return; + _mDynamicActor->setLinearVelocity(PxVec3{PxIdentity}, false); + _mDynamicActor->setAngularVelocity(PxVec3{PxIdentity}, false); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXSharedBody.h b/native/cocos/physics/physx/PhysXSharedBody.h new file mode 100644 index 0000000000..7798f226b4 --- /dev/null +++ b/native/cocos/physics/physx/PhysXSharedBody.h @@ -0,0 +1,123 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IBody.h" +#include "physics/physx/PhysXInc.h" +#include "base/Macros.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include +#include + +namespace cc { + +enum class TransformBit { + NONE = 0, + POSITION = (1 << 0), + ROTATION = (1 << 1), + SCALE = (1 << 2), + RS = TransformBit::ROTATION | TransformBit::SCALE, + TRS = TransformBit::POSITION | TransformBit::ROTATION | TransformBit::SCALE, + TRS_MASK = ~TransformBit::TRS, +}; + +namespace physics { + +class PhysXWorld; +class PhysXShape; +class PhysXJoint; +class PhysXRigidBody; + +class PhysXSharedBody final { +public: + static PhysXSharedBody *getSharedBody(uint handle, PhysXWorld *world, PhysXRigidBody *body); + PhysXSharedBody() = delete; + PhysXSharedBody(PhysXSharedBody &other) = delete; + PhysXSharedBody(PhysXSharedBody &&other) = delete; + void reference(bool v); + void enabled(bool v); + CC_INLINE bool isStatic() { return static_cast(_mType) & static_cast(ERigidBodyType::STATIC); } + CC_INLINE bool isKinematic() { return static_cast(_mType) & static_cast(ERigidBodyType::KINEMATIC); } + CC_INLINE bool isStaticOrKinematic() { return static_cast(_mType) & static_cast(ERigidBodyType::STATIC) || static_cast(_mType) & static_cast(ERigidBodyType::KINEMATIC); } + CC_INLINE bool isDynamic() { return !isStaticOrKinematic(); } + CC_INLINE uint getNodeHandle() const { return _mNodeHandle; } + CC_INLINE cc::pipeline::Node &getNode() const { return *_mNode; } + CC_INLINE PhysXWorld &getWorld() const { return *_mWrappedWorld; } + union UActor { + uintptr_t ptr; + physx::PxRigidActor * rigidActor; + physx::PxRigidStatic * rigidStatic; + physx::PxRigidDynamic *rigidDynamic; + }; + UActor getImpl(); + void setType(ERigidBodyType v); + void setMass(float v); + void syncScale(); + void syncSceneToPhysics(); + void syncSceneWithCheck(); + void syncPhysicsToScene(); + void updateCenterOfMass(); + void addShape(PhysXShape &shape); + void removeShape(PhysXShape &shape); + void addJoint(PhysXJoint &joint, physx::PxJointActorIndex::Enum index); + void removeJoint(PhysXJoint &joint, physx::PxJointActorIndex::Enum index); + void setCollisionFilter(physx::PxFilterData &data); + void clearForces(); + void clearVelocity(); + void setGroup(uint32_t v); + void setMask(uint32_t v); + CC_INLINE uint32_t getGroup() const { return _mFilterData.word0; } + CC_INLINE uint32_t getMask() const { return _mFilterData.word1; } + +private: + static std::map sharedBodesMap; + const uint32_t _mID; + const uint _mNodeHandle; + uint8_t _mRef; + bool _mIsStatic; + ERigidBodyType _mType; + float _mMass; + int _mIndex; + physx::PxFilterData _mFilterData; + cc::pipeline::Node * _mNode; + UActor _mImpl; + physx::PxRigidStatic * _mStaticActor; + physx::PxRigidDynamic * _mDynamicActor; + PhysXWorld * _mWrappedWorld; + PhysXRigidBody * _mWrappedBody; + std::vector _mWrappedShapes; + std::vector _mWrappedJoints0; + std::vector _mWrappedJoints1; + PhysXSharedBody(const uint &handle, PhysXWorld *world, PhysXRigidBody *body); + ~PhysXSharedBody(); + void initActor(); + void switchActor(bool isStaticBefore); + void initStaticActor(); + void initDynamicActor(); +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXUtils.cpp b/native/cocos/physics/physx/PhysXUtils.cpp new file mode 100644 index 0000000000..c8d875d10f --- /dev/null +++ b/native/cocos/physics/physx/PhysXUtils.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/PhysXUtils.h" + +namespace cc { +namespace physics { + +void pxSetFromTwoVectors(physx::PxQuat &out, const physx::PxVec3 &a, const physx::PxVec3 &b) { + float dot = a.dot(b); + if (dot < -0.999999) { + physx::PxVec3 c = (physx::PxVec3{1., 0., 0.}).cross(a); + if (c.magnitude() < 0.000001) c = (physx::PxVec3{0., 1., 0.}).cross(a); + c.normalize(); + out = physx::PxQuat(physx::PxPi, c); + } else if (dot > 0.999999) { + out = physx::PxQuat{physx::PxIdentity}; + } else { + physx::PxVec3 c = a.cross(b); + out = physx::PxQuat{c.x, c.y, c.z, 1 + dot}; + out.normalize(); + } +} + +physx::PxRigidActor &getTempRigidActor() { + static physx::PxRigidActor *tempRigidActor = nullptr; + if (!tempRigidActor) { + tempRigidActor = PxGetPhysics().createRigidDynamic(physx::PxTransform{physx::PxIdentity}); + } + return *tempRigidActor; +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXUtils.h b/native/cocos/physics/physx/PhysXUtils.h new file mode 100644 index 0000000000..6d4fc5aa35 --- /dev/null +++ b/native/cocos/physics/physx/PhysXUtils.h @@ -0,0 +1,154 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/PhysXInc.h" +#include "physics/physx/PhysXFilterShader.h" +#include "base/Macros.h" +#include "math/Vec3.h" +#include "math/Vec4.h" +#include +#include + +#define PX_RELEASE(x) \ + if (x) { \ + (x)->release(); \ + (x) = NULL; \ + } + +namespace cc { +namespace physics { + +CC_INLINE bool operator!=(const physx::PxVec3 &a, const cc::Vec3 &b) { + return a.x != b.x || a.y == b.y || a.z == b.z; +} + +CC_INLINE bool operator!=(const cc::Vec3 &a, const physx::PxVec3 &b) { + return a.x != b.x || a.y == b.y || a.z == b.z; +} + +CC_INLINE bool operator==(const physx::PxVec3 &a, const cc::Vec3 &b) { + return a.x == b.x && a.y == b.y && a.z == b.z; +} + +CC_INLINE bool operator==(const cc::Vec3 &a, const physx::PxVec3 &b) { + return a.x == b.x && a.y == b.y && a.z == b.z; +} + +CC_INLINE physx::PxVec3 operator*(const physx::PxVec3 &a, const cc::Vec3 &b) { + return physx::PxVec3{a.x * b.x, a.y * b.y, a.z * b.z}; +} + +CC_INLINE cc::Vec3 operator*(const cc::Vec3 &a, const physx::PxVec3 &b) { + return cc::Vec3{a.x * b.x, a.y * b.y, a.z * b.z}; +} + +CC_INLINE physx::PxVec3 operator+(const physx::PxVec3 &a, const cc::Vec3 &b) { + return physx::PxVec3{a.x + b.x, a.y + b.y, a.z + b.z}; +} + +CC_INLINE cc::Vec3 operator+(const cc::Vec3 &a, const physx::PxVec3 &b) { + return cc::Vec3{a.x + b.x, a.y + b.y, a.z + b.z}; +} + +CC_INLINE physx::PxVec3 &operator*=(physx::PxVec3 &a, const cc::Vec3 &b) { + a.x *= b.x; + a.y *= b.y; + a.z *= b.z; + return a; +} + +CC_INLINE cc::Vec3 &operator*=(cc::Vec3 &a, const physx::PxVec3 &b) { + a.x *= b.x; + a.y *= b.y; + a.z *= b.z; + return a; +} + +CC_INLINE bool operator!=(const physx::PxQuat &a, const cc::Vec4 &b) { + return a.x != b.x || a.y == b.y || a.z == b.z || a.w == b.w; +} + +CC_INLINE bool operator!=(const cc::Vec4 &a, const physx::PxQuat &b) { + return a.x != b.x || a.y == b.y || a.z == b.z || a.w == b.w; +} + +CC_INLINE bool operator==(const physx::PxQuat &a, const cc::Vec4 &b) { + return a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w; +} + +CC_INLINE bool operator==(const cc::Vec4 &a, const physx::PxQuat &b) { + return a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w; +} + +CC_INLINE void pxSetVec3Ext(physx::PxVec3 &v, const cc::Vec3 &cv) { + v = physx::PxVec3(cv.x, cv.y, cv.z); +} + +CC_INLINE void pxSetVec3Ext(cc::Vec3 &v, const physx::PxVec3 &cv) { + v = cc::Vec3(cv.x, cv.y, cv.z); +} + +template +CC_INLINE void pxSetQuatExt(T1 &p, const T2 &cp) { + p = T1(cp.x, cp.y, cp.z, cp.w); +} + +template +CC_INLINE T pxAbsMax(const T &a, const T &b) { + return physx::PxAbs(a) > physx::PxAbs(b) ? a : b; +} + +void pxSetFromTwoVectors(physx::PxQuat &out, const physx::PxVec3 &a, const physx::PxVec3 &b); + +CC_INLINE std::unordered_map &getPxShapeMap() { + static std::unordered_map m; + return m; +} + +CC_INLINE std::unordered_map &getPxMaterialMap() { + static std::unordered_map m; + return m; +} + +CC_INLINE physx::PxMaterial &getDefaultMaterial() { + return *(reinterpret_cast(getPxMaterialMap()[0])); +} + +CC_INLINE std::vector &getPxRaycastHitBuffer() { + static std::vector m{12}; + return m; +} + +CC_INLINE QueryFilterShader &getQueryFilterShader() { + static QueryFilterShader shader; + return shader; +} + +physx::PxRigidActor &getTempRigidActor(); + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXWorld.cpp b/native/cocos/physics/physx/PhysXWorld.cpp new file mode 100644 index 0000000000..a01306a841 --- /dev/null +++ b/native/cocos/physics/physx/PhysXWorld.cpp @@ -0,0 +1,309 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/PhysXInc.h" +#include "physics/physx/PhysXWorld.h" +#include "physics/spec/IWorld.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXFilterShader.h" + +namespace cc { +namespace physics { + +PhysXWorld *PhysXWorld::instance = nullptr; +PhysXWorld &PhysXWorld::getInstance() { + return *instance; +} + +physx::PxFoundation &PhysXWorld::getFundation() { + return *getInstance()._mFoundation; +} + +physx::PxCooking &PhysXWorld::getCooking() { + return *getInstance()._mCooking; +} + +physx::PxPhysics &PhysXWorld::getPhysics() { + return *getInstance()._mPhysics; +} + +PhysXWorld::PhysXWorld() { + instance = this; + static physx::PxDefaultAllocator gAllocator; + static physx::PxDefaultErrorCallback gErrorCallback; + _mFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + physx::PxTolerancesScale scale{}; + _mCooking = PxCreateCooking(PX_PHYSICS_VERSION, *_mFoundation, physx::PxCookingParams(scale)); + + physx::PxPvd *pvd = nullptr; +#ifdef CC_DEBUG + pvd = _mPvd = physx::PxCreatePvd(*_mFoundation); + physx::PxPvdTransport *transport = physx::PxDefaultPvdSocketTransportCreate("127.0.0.1", 5425, 10); + _mPvd->connect(*transport, physx::PxPvdInstrumentationFlag::eALL); +#endif + _mPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *_mFoundation, scale, true, pvd); + PxInitExtensions(*_mPhysics, pvd); + _mDispatcher = physx::PxDefaultCpuDispatcherCreate(0); + + _mEventMgr = new PhysXEventManager(); + + physx::PxSceneDesc sceneDesc(_mPhysics->getTolerancesScale()); + sceneDesc.gravity = physx::PxVec3(0.0F, -10.0F, 0.0F); + sceneDesc.cpuDispatcher = _mDispatcher; + sceneDesc.kineKineFilteringMode = physx::PxPairFilteringMode::eKEEP; + sceneDesc.staticKineFilteringMode = physx::PxPairFilteringMode::eKEEP; + sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD; + sceneDesc.filterShader = simpleFilterShader; + sceneDesc.simulationEventCallback = &_mEventMgr->getEventCallback(); + _mScene = _mPhysics->createScene(sceneDesc); + + _mCollisionMatrix[0] = 1; + + createMaterial(0, 0.6F, 0.6F, 0.1F, 2, 2); +} + +PhysXWorld::~PhysXWorld() { + delete _mEventMgr; + PX_RELEASE(_mScene); + PX_RELEASE(_mDispatcher); + PX_RELEASE(_mPhysics); +#ifdef CC_DEBUG + physx::PxPvdTransport *transport = _mPvd->getTransport(); + PX_RELEASE(_mPvd); + PX_RELEASE(transport); +#endif + PxCloseExtensions(); + PX_RELEASE(_mFoundation); +} + +void PhysXWorld::step(float fixedTimeStep) { + _mScene->simulate(fixedTimeStep); + _mScene->fetchResults(true); + syncPhysicsToScene(); +} + +void PhysXWorld::setGravity(float x, float y, float z) { + _mScene->setGravity(physx::PxVec3(x, y, z)); +} + +void PhysXWorld::destroy() { +} + +void PhysXWorld::setCollisionMatrix(uint32_t index, uint32_t mask) { + if (index > 31) return; + _mCollisionMatrix[index] = mask; +} + +uintptr_t PhysXWorld::createConvex(ConvexDesc &desc) { + physx::PxConvexMeshDesc convexDesc; + convexDesc.points.count = desc.positionLength; + convexDesc.points.stride = sizeof(physx::PxVec3); + convexDesc.points.data = static_cast(desc.positions); + convexDesc.flags = physx::PxConvexFlag::eCOMPUTE_CONVEX; + physx::PxConvexMesh *convexMesh = getCooking().createConvexMesh(convexDesc, PxGetPhysics().getPhysicsInsertionCallback()); + return reinterpret_cast(convexMesh); +} + +uintptr_t PhysXWorld::createTrimesh(TrimeshDesc &desc) { + physx::PxTriangleMeshDesc meshDesc; + meshDesc.points.count = desc.positionLength; + meshDesc.points.stride = sizeof(physx::PxVec3); + meshDesc.points.data = static_cast(desc.positions); + meshDesc.triangles.count = desc.triangleLength; + if (desc.isU16) { + meshDesc.triangles.stride = 3 * sizeof(physx::PxU16); + meshDesc.triangles.data = static_cast(desc.triangles); + meshDesc.flags = physx::PxMeshFlag::e16_BIT_INDICES; + } else { + meshDesc.triangles.stride = 3 * sizeof(physx::PxU32); + meshDesc.triangles.data = static_cast(desc.triangles); + } + physx::PxTriangleMesh *triangleMesh = getCooking().createTriangleMesh(meshDesc, PxGetPhysics().getPhysicsInsertionCallback()); + return reinterpret_cast(triangleMesh); +} + +uintptr_t PhysXWorld::createHeightField(HeightFieldDesc &desc) { + const auto rows = desc.rows; + const auto columns = desc.columns; + const physx::PxU32 counts = rows * columns; + auto *samples = new physx::PxHeightFieldSample[counts]; + for (physx::PxU32 r = 0; r < rows; r++) { + for (physx::PxU32 c = 0; c < columns; c++) { + const auto index = c + r * columns; + auto v = (static_cast(desc.samples))[index]; + samples[index].height = v; + } + } + physx::PxHeightFieldDesc hfDesc; + hfDesc.nbRows = rows; + hfDesc.nbColumns = columns; + hfDesc.samples.data = samples; + hfDesc.samples.stride = sizeof(physx::PxHeightFieldSample); + physx::PxHeightField *hf = getCooking().createHeightField(hfDesc, PxGetPhysics().getPhysicsInsertionCallback()); + delete[] samples; + return reinterpret_cast(hf); +} + +uintptr_t PhysXWorld::createMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) { + physx::PxMaterial *mat; + auto &m = getPxMaterialMap(); + if (m.find(id) == m.end()) { + mat = PxGetPhysics().createMaterial(f, df, r); + m[id] = reinterpret_cast(mat); + mat->setFrictionCombineMode(physx::PxCombineMode::Enum(m0)); + mat->setRestitutionCombineMode(physx::PxCombineMode::Enum(m1)); + } else { + mat = reinterpret_cast(m[id]); + mat->setStaticFriction(f); + mat->setDynamicFriction(df); + mat->setRestitution(r); + mat->setFrictionCombineMode(physx::PxCombineMode::Enum(m0)); + mat->setRestitutionCombineMode(physx::PxCombineMode::Enum(m1)); + } + return uintptr_t(mat); +} + +void PhysXWorld::emitEvents() { + _mEventMgr->refreshPairs(); +} + +void PhysXWorld::syncSceneToPhysics() { + for (auto const &sb : _mSharedBodies) { + sb->syncSceneToPhysics(); + } +} + +uint32_t PhysXWorld::getMaskByIndex(uint32_t i) { + if (i > 31) i = 0; + return _mCollisionMatrix[i]; +} + +void PhysXWorld::syncPhysicsToScene() { + for (auto const &sb : _mSharedBodies) { + sb->syncPhysicsToScene(); + } +} + +void PhysXWorld::syncSceneWithCheck() { + for (auto const &sb : _mSharedBodies) { + sb->syncSceneWithCheck(); + } +} + +void PhysXWorld::setAllowSleep(bool val) { +} + +void PhysXWorld::addActor(PhysXSharedBody &sb) { + auto beg = _mSharedBodies.begin(); + auto end = _mSharedBodies.end(); + auto iter = find(beg, end, &sb); + if (iter == end) { + _mScene->addActor(*sb.getImpl().rigidActor); + _mSharedBodies.push_back(&sb); + } +} + +void PhysXWorld::removeActor(PhysXSharedBody &sb) { + auto beg = _mSharedBodies.begin(); + auto end = _mSharedBodies.end(); + auto iter = find(beg, end, &sb); + if (iter != end) { + _mScene->removeActor(*sb.getImpl().rigidActor, true); + _mSharedBodies.erase(iter); + } +} + +bool PhysXWorld::raycast(RaycastOptions &opt) { + physx::PxQueryCache *cache = nullptr; + const auto o = opt.origin; + const auto ud = opt.unitDir; + physx::PxVec3 origin{o.x, o.y, o.z}; + physx::PxVec3 unitDir{ud.x, ud.y, ud.z}; + unitDir.normalize(); + physx::PxHitFlags flags = physx::PxHitFlag::ePOSITION | physx::PxHitFlag::eNORMAL; + physx::PxSceneQueryFilterData filterData; + filterData.data.word0 = opt.mask; + filterData.data.word3 = QUERY_FILTER | (opt.queryTrigger ? 0 : QUERY_CHECK_TRIGGER); + filterData.flags = physx::PxQueryFlag::eSTATIC | physx::PxQueryFlag::eDYNAMIC | physx::PxQueryFlag::ePREFILTER; + auto &hitBuffer = getPxRaycastHitBuffer(); + bool result = false; + const auto nbTouches = physx::PxSceneQueryExt::raycastMultiple( + getScene(), origin, unitDir, opt.distance, flags, hitBuffer.data(), + static_cast(hitBuffer.size()), result, filterData, &getQueryFilterShader(), cache); + if (nbTouches == 0 || nbTouches == -1) return false; + auto &r = raycastResult(); + r.resize(nbTouches); + for (physx::PxI32 i = 0; i < nbTouches; i++) { + const auto &shapeIter = getPxShapeMap().find(reinterpret_cast(hitBuffer[i].shape)); + if (shapeIter == getPxShapeMap().end()) return false; + r[i].shape = shapeIter->second; + r[i].distance = hitBuffer[i].distance; + pxSetVec3Ext(r[i].hitNormal, hitBuffer[i].normal); + pxSetVec3Ext(r[i].hitPoint, hitBuffer[i].position); + } + return true; +} + +std::vector &PhysXWorld::raycastResult() { + static std::vector hits; + return hits; +} + +bool PhysXWorld::raycastClosest(RaycastOptions &opt) { + physx::PxRaycastHit hit; + physx::PxQueryCache *cache = nullptr; + const auto o = opt.origin; + const auto ud = opt.unitDir; + physx::PxVec3 origin{o.x, o.y, o.z}; + physx::PxVec3 unitDir{ud.x, ud.y, ud.z}; + unitDir.normalize(); + physx::PxHitFlags flags = physx::PxHitFlag::ePOSITION | physx::PxHitFlag::eNORMAL; + physx::PxSceneQueryFilterData filterData; + filterData.data.word0 = opt.mask; + filterData.data.word3 = QUERY_FILTER | (opt.queryTrigger ? 0 : QUERY_CHECK_TRIGGER) | QUERY_SINGLE_HIT; + filterData.flags = physx::PxQueryFlag::eSTATIC | physx::PxQueryFlag::eDYNAMIC | physx::PxQueryFlag::ePREFILTER; + const auto result = physx::PxSceneQueryExt::raycastSingle( + getScene(), origin, unitDir, opt.distance, flags, + hit, filterData, &getQueryFilterShader(), cache); + if (result) { + auto &r = raycastClosestResult(); + const auto &shapeIter = getPxShapeMap().find(reinterpret_cast(hit.shape)); + if (shapeIter == getPxShapeMap().end()) return false; + r.shape = shapeIter->second; + r.distance = hit.distance; + pxSetVec3Ext(r.hitPoint, hit.position); + pxSetVec3Ext(r.hitNormal, hit.normal); + } + return result; +} + +RaycastResult &PhysXWorld::raycastClosestResult() { + static RaycastResult hit; + return hit; +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/PhysXWorld.h b/native/cocos/physics/physx/PhysXWorld.h new file mode 100644 index 0000000000..94c74b8064 --- /dev/null +++ b/native/cocos/physics/physx/PhysXWorld.h @@ -0,0 +1,100 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/PhysXInc.h" +#include "physics/spec/IWorld.h" +#include "physics/physx/PhysXEventManager.h" +#include "physics/physx/PhysXFilterShader.h" +#include "physics/physx/PhysXRigidBody.h" +#include "physics/physx/PhysXSharedBody.h" +#include "base/Macros.h" +#include + +namespace cc { +namespace physics { + +class PhysXWorld final : virtual public IPhysicsWorld { +public: + static PhysXWorld &getInstance(); + static physx::PxFoundation &getFundation(); + static physx::PxCooking &getCooking(); + static physx::PxPhysics &getPhysics(); + PhysXWorld(); + ~PhysXWorld() override; + void step(float fixedTimeStep) override; + void setGravity(float x, float y, float z) override; + void setAllowSleep(bool v) override; + void emitEvents() override; + void setCollisionMatrix(uint32_t index, uint32_t mask) override; + bool raycast(RaycastOptions &opt) override; + bool raycastClosest(RaycastOptions &opt) override; + std::vector &raycastResult() override; + RaycastResult &raycastClosestResult() override; + uintptr_t createConvex(ConvexDesc &desc) override; + uintptr_t createTrimesh(TrimeshDesc &desc) override; + uintptr_t createHeightField(HeightFieldDesc &desc) override; + uintptr_t createMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) override; + CC_INLINE std::vector> &getTriggerEventPairs() override { + return _mEventMgr->getTriggerPairs(); + } + CC_INLINE std::vector> &getContactEventPairs() override { + return _mEventMgr->getConatctPairs(); + } + void syncSceneToPhysics() override; + void syncSceneWithCheck() override; + void destroy() override; + + CC_INLINE PhysXSharedBody *getSharedBody( + const uint handle, + PhysXRigidBody *const body = nullptr) { + return PhysXSharedBody::getSharedBody(handle, this, body); + } + + CC_INLINE physx::PxScene &getScene() const { return *_mScene; } + uint32_t getMaskByIndex(uint32_t i); + void syncPhysicsToScene(); + void addActor(PhysXSharedBody &sb); + void removeActor(PhysXSharedBody &sb); + +private: + static PhysXWorld *instance; + physx::PxFoundation *_mFoundation; + physx::PxCooking *_mCooking; + physx::PxPhysics *_mPhysics; +#ifdef CC_DEBUG + physx::PxPvd *_mPvd; +#endif + physx::PxDefaultCpuDispatcher *_mDispatcher; + physx::PxScene *_mScene; + PhysXEventManager *_mEventMgr; + uint32_t _mCollisionMatrix[31]; + std::vector _mSharedBodies; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/joints/PhysXDistance.cpp b/native/cocos/physics/physx/joints/PhysXDistance.cpp new file mode 100644 index 0000000000..04fae12e7f --- /dev/null +++ b/native/cocos/physics/physx/joints/PhysXDistance.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/joints/PhysXDistance.h" +#include "physics/physx/PhysXSharedBody.h" +#include "physics/physx/PhysXUtils.h" +#include "math/Quaternion.h" + +namespace cc { +namespace physics { + +PhysXDistance::PhysXDistance() : _mPivotA(physx::PxZero), + _mPivotB(physx::PxZero) {} + +void PhysXDistance::onComponentSet() { + _mJoint = PxDistanceJointCreate(PxGetPhysics(), &getTempRigidActor(), physx::PxTransform{physx::PxIdentity}, nullptr, physx::PxTransform{physx::PxIdentity}); +} + +void PhysXDistance::setPivotA(float x, float y, float z) { + _mPivotA = physx::PxVec3{x, y, z}; + updatePose(); +} + +void PhysXDistance::setPivotB(float x, float y, float z) { + _mPivotB = physx::PxVec3{x, y, z}; + updatePose(); +} + +void PhysXDistance::updateScale0() { + updatePose(); +} + +void PhysXDistance::updateScale1() { + updatePose(); +} + +void PhysXDistance::updatePose() { + physx::PxTransform pose0{physx::PxIdentity}; + physx::PxTransform pose1{physx::PxIdentity}; + auto &node0 = _mSharedBody->getNode(); + pose0.p = _mPivotA * node0.worldScale; + _mJoint->setLocalPose(physx::PxJointActorIndex::eACTOR0, pose0); + if (_mConnectedBody) { + auto &node1 = _mConnectedBody->getNode(); + pose1.p = _mPivotB * node1.worldScale; + } else { + pose1.p = _mPivotA * node0.worldScale; + pose1.p += _mPivotB + node0.worldPosition; + const auto &wr = node0.worldRotation; + pose1.q *= physx::PxQuat{wr.x, wr.y, wr.z, wr.w}; + } + _mJoint->setLocalPose(physx::PxJointActorIndex::eACTOR1, pose1); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/joints/PhysXDistance.h b/native/cocos/physics/physx/joints/PhysXDistance.h new file mode 100644 index 0000000000..3372d03d81 --- /dev/null +++ b/native/cocos/physics/physx/joints/PhysXDistance.h @@ -0,0 +1,50 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/joints/PhysXJoint.h" + +namespace cc { +namespace physics { + +class PhysXDistance final : public PhysXJoint, public IDistanceJoint { +public: + PhysXDistance(); + ~PhysXDistance() override = default; + void setPivotA(float x, float y, float z) override; + void setPivotB(float x, float y, float z) override; + void updateScale0() override; + void updateScale1() override; + +private: + void onComponentSet() override; + void updatePose(); + physx::PxVec3 _mPivotA; + physx::PxVec3 _mPivotB; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/joints/PhysXJoint.cpp b/native/cocos/physics/physx/joints/PhysXJoint.cpp new file mode 100644 index 0000000000..2179628c47 --- /dev/null +++ b/native/cocos/physics/physx/joints/PhysXJoint.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/joints/PhysXJoint.h" +#include "physics/physx/PhysXSharedBody.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" + +namespace cc { +namespace physics { + +void PhysXJoint::initialize(const uint handle) { + auto &ins = PhysXWorld::getInstance(); + _mSharedBody = ins.getSharedBody(handle); + _mSharedBody->reference(true); + onComponentSet(); +} + +void PhysXJoint::onEnable() { + _mSharedBody->addJoint(*this, physx::PxJointActorIndex::eACTOR0); + if (_mConnectedBody) { + _mConnectedBody->addJoint(*this, physx::PxJointActorIndex::eACTOR1); + _mJoint->setActors(_mSharedBody->getImpl().rigidActor, _mConnectedBody->getImpl().rigidActor); + } else { + _mJoint->setActors(_mSharedBody->getImpl().rigidActor, nullptr); + } +} + +void PhysXJoint::onDisable() { + _mJoint->setActors(&getTempRigidActor(), nullptr); + _mSharedBody->removeJoint(*this, physx::PxJointActorIndex::eACTOR0); + if (_mConnectedBody) _mConnectedBody->removeJoint(*this, physx::PxJointActorIndex::eACTOR1); +} + +void PhysXJoint::onDestroy() { + _mSharedBody->reference(false); +} + +void PhysXJoint::setConnectedBody(const uint handle) { + if (handle) { + auto &ins = PhysXWorld::getInstance(); + _mConnectedBody = ins.getSharedBody(handle); + } else { + _mConnectedBody = nullptr; + } + if (_mJoint) { + _mJoint->setActors(_mSharedBody->getImpl().rigidActor, _mConnectedBody ? _mConnectedBody->getImpl().rigidActor : nullptr); + } +} + +void PhysXJoint::setEnableCollision(const bool v) { + _mEnableCollision = v; + if (_mJoint) { + _mJoint->setConstraintFlag(physx::PxConstraintFlag::eCOLLISION_ENABLED, _mEnableCollision); + } +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/joints/PhysXJoint.h b/native/cocos/physics/physx/joints/PhysXJoint.h new file mode 100644 index 0000000000..cda55a75b4 --- /dev/null +++ b/native/cocos/physics/physx/joints/PhysXJoint.h @@ -0,0 +1,61 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/PhysXInc.h" +#include "physics/spec/IJoint.h" +#include "base/Macros.h" + +namespace cc { +namespace physics { +class PhysXSharedBody; + +class PhysXJoint : virtual public IBaseJoint { + PX_NOCOPY(PhysXJoint) + PhysXJoint() = default; + +public: + ~PhysXJoint() override = default; + CC_INLINE uintptr_t getImpl() override { return reinterpret_cast(this); } + void initialize(uint handle) override; + void onEnable() override; + void onDisable() override; + void onDestroy() override; + void setConnectedBody(uint handle) override; + void setEnableCollision(bool v) override; + virtual void updateScale0() = 0; + virtual void updateScale1() = 0; + +protected: + physx::PxJoint *_mJoint{nullptr}; + PhysXSharedBody *_mSharedBody{nullptr}; + PhysXSharedBody *_mConnectedBody{nullptr}; + bool _mEnableCollision{false}; + virtual void onComponentSet() = 0; +}; + +} // namespace physics +} // namespace cc \ No newline at end of file diff --git a/native/cocos/physics/physx/joints/PhysXRevolute.cpp b/native/cocos/physics/physx/joints/PhysXRevolute.cpp new file mode 100644 index 0000000000..e252290924 --- /dev/null +++ b/native/cocos/physics/physx/joints/PhysXRevolute.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/joints/PhysXRevolute.h" +#include "physics/physx/PhysXSharedBody.h" +#include "physics/physx/PhysXUtils.h" +#include "math/Quaternion.h" + +namespace cc { +namespace physics { + +PhysXRevolute::PhysXRevolute() : _mPivotA(physx::PxZero), + _mPivotB(physx::PxZero), + _mAxis(physx::PxZero) {} + +void PhysXRevolute::onComponentSet() { + _mJoint = PxRevoluteJointCreate(PxGetPhysics(), &getTempRigidActor(), physx::PxTransform{physx::PxIdentity}, nullptr, physx::PxTransform{physx::PxIdentity}); +} + +void PhysXRevolute::setPivotA(float x, float y, float z) { + _mPivotA = physx::PxVec3{x, y, z}; + updatePose(); +} + +void PhysXRevolute::setPivotB(float x, float y, float z) { + _mPivotB = physx::PxVec3{x, y, z}; + updatePose(); +} + +void PhysXRevolute::setAxis(float x, float y, float z) { + _mAxis = physx::PxVec3{x, y, z}; + updatePose(); +} + +void PhysXRevolute::updateScale0() { + updatePose(); +} + +void PhysXRevolute::updateScale1() { + updatePose(); +} + +void PhysXRevolute::updatePose() { + physx::PxTransform pose0{physx::PxIdentity}; + physx::PxTransform pose1{physx::PxIdentity}; + auto &node0 = _mSharedBody->getNode(); + pose0.p = _mPivotA * node0.worldScale; + pxSetFromTwoVectors(pose0.q, physx::PxVec3{1.F, 0.F, 0.F}, _mAxis); + _mJoint->setLocalPose(physx::PxJointActorIndex::eACTOR0, pose0); + pose1.q = pose0.q; + if (_mConnectedBody) { + auto &node1 = _mConnectedBody->getNode(); + pose1.p = _mPivotB * node1.worldScale; + } else { + pose1.p = _mPivotA * node0.worldScale; + pose1.p += _mPivotB + node0.worldPosition; + const auto &wr = node0.worldRotation; + pose1.q *= physx::PxQuat{wr.x, wr.y, wr.z, wr.w}; + } + _mJoint->setLocalPose(physx::PxJointActorIndex::eACTOR1, pose1); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/joints/PhysXRevolute.h b/native/cocos/physics/physx/joints/PhysXRevolute.h new file mode 100644 index 0000000000..312297554a --- /dev/null +++ b/native/cocos/physics/physx/joints/PhysXRevolute.h @@ -0,0 +1,52 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/joints/PhysXJoint.h" + +namespace cc { +namespace physics { + +class PhysXRevolute final : public PhysXJoint, public IRevoluteJoint { +public: + PhysXRevolute(); + ~PhysXRevolute() override = default; + void setPivotA(float x, float y, float z) override; + void setPivotB(float x, float y, float z) override; + void setAxis(float x, float y, float z) override; + void updateScale0() override; + void updateScale1() override; + +private: + void onComponentSet() override; + void updatePose(); + physx::PxVec3 _mPivotA; + physx::PxVec3 _mPivotB; + physx::PxVec3 _mAxis; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXBox.cpp b/native/cocos/physics/physx/shapes/PhysXBox.cpp new file mode 100644 index 0000000000..3492f06d9c --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXBox.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXBox.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" + +namespace cc { +namespace physics { + +PhysXBox::PhysXBox() : _mHalfExtents(0.5), + PhysXShape(){}; + +void PhysXBox::setSize(float x, float y, float z) { + _mHalfExtents = physx::PxVec3{x / 2, y / 2, z / 2}; + updateGeometry(); + getShape().setGeometry(getPxGeometry()); +} + +void PhysXBox::onComponentSet() { + updateGeometry(); + _mShape = PxGetPhysics().createShape(getPxGeometry(), getDefaultMaterial(), true); +} + +void PhysXBox::updateScale() { + updateGeometry(); + getShape().setGeometry(getPxGeometry()); + updateCenter(); +} + +void PhysXBox::updateGeometry() { + auto &node = getSharedBody().getNode(); + auto &geo = getPxGeometry(); + geo.halfExtents = _mHalfExtents; + geo.halfExtents *= node.worldScale; + geo.halfExtents = geo.halfExtents.abs(); + if (geo.halfExtents.minElement() <= 0.0) { + geo.halfExtents = geo.halfExtents.maximum(physx::PxVec3{PX_NORMALIZATION_EPSILON}); + } +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXBox.h b/native/cocos/physics/physx/shapes/PhysXBox.h new file mode 100644 index 0000000000..6ed2d13a05 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXBox.h @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXBox final : public PhysXShape, public IBoxShape { +public: + PhysXBox(); + ~PhysXBox() override = default; + void setSize(float x, float y, float z) override; + void updateScale() override; + +private: + physx::PxVec3 _mHalfExtents; + void updateGeometry(); + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXCapsule.cpp b/native/cocos/physics/physx/shapes/PhysXCapsule.cpp new file mode 100644 index 0000000000..81916f25ed --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXCapsule.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXCapsule.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" + +namespace cc { +namespace physics { + +PhysXCapsule::PhysXCapsule() : _mRadius(0.5F), + _mCylinderHeight(1.0F), + _mDirection(EAxisDirection::Y_AXIS) + {}; + +void PhysXCapsule::setRadius(float r) { + _mRadius = r; + updateGeometry(); + getShape().setGeometry(getPxGeometry()); +} + +void PhysXCapsule::setCylinderHeight(float v) { + _mCylinderHeight = v; + updateGeometry(); + getShape().setGeometry(getPxGeometry()); +} + +void PhysXCapsule::setDirection(EAxisDirection v) { + _mDirection = v; + updateGeometry(); + getShape().setGeometry(getPxGeometry()); +} + +void PhysXCapsule::onComponentSet() { + updateGeometry(); + _mShape = PxGetPhysics().createShape(getPxGeometry(), getDefaultMaterial(), true); +} + +void PhysXCapsule::updateScale() { + updateGeometry(); + getShape().setGeometry(getPxGeometry()); + updateCenter(); +} + +void PhysXCapsule::updateGeometry() { + auto &node = getSharedBody().getNode(); + auto &geo = getPxGeometry(); + float rs = 1.F; + float hs = 1.F; + switch (_mDirection) { + case EAxisDirection::X_AXIS: + hs = physx::PxAbs(node.worldScale.x); + rs = pxAbsMax(node.worldScale.y, node.worldScale.z); + _mRotation = physx::PxQuat{physx::PxIdentity}; + break; + case EAxisDirection::Z_AXIS: + hs = physx::PxAbs(node.worldScale.z); + rs = pxAbsMax(node.worldScale.x, node.worldScale.y); + _mRotation = physx::PxQuat(physx::PxPiDivTwo, physx::PxVec3{0.F, 1.F, 0.F}); + break; + case EAxisDirection::Y_AXIS: + default: + hs = physx::PxAbs(node.worldScale.y); + rs = pxAbsMax(node.worldScale.x, node.worldScale.z); + _mRotation = physx::PxQuat(physx::PxPiDivTwo, physx::PxVec3{0.F, 0.F, 1.F}); + break; + } + geo.radius = physx::PxMax(physx::PxAbs(_mRadius * rs), PX_NORMALIZATION_EPSILON); + geo.halfHeight = physx::PxMax(physx::PxAbs(_mCylinderHeight / 2 * hs), PX_NORMALIZATION_EPSILON); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXCapsule.h b/native/cocos/physics/physx/shapes/PhysXCapsule.h new file mode 100644 index 0000000000..824b3484ee --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXCapsule.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXCapsule final : public PhysXShape, public ICapsuleShape { +public: + PhysXCapsule(); + ~PhysXCapsule() override = default; + void setRadius(float r) override; + void setCylinderHeight(float v) override; + void setDirection(EAxisDirection v) override; + void updateScale() override; + +private: + float _mRadius; + float _mCylinderHeight; + EAxisDirection _mDirection; + void updateGeometry(); + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXCone.cpp b/native/cocos/physics/physx/shapes/PhysXCone.cpp new file mode 100644 index 0000000000..01ba6e5800 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXCone.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXCone.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" +#include "math/Quaternion.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include + +namespace cc { +namespace physics { + +PhysXCone::PhysXCone() : _mMesh(nullptr) + {}; + +void PhysXCone::setConvex(uintptr_t handle) { + if (reinterpret_cast(_mMesh) == handle) return; + _mMesh = reinterpret_cast(handle); + if (_mShape) { + } +} + +void PhysXCone::onComponentSet() { + if (_mMesh) { + physx::PxConvexMeshGeometry geom; + geom.convexMesh = _mMesh; + // geom.meshFlags = PxConvexMeshGeometryFlags::eTIGHT_BOUNDS; + _mShape = PxGetPhysics().createShape(geom, getDefaultMaterial(), true); + updateGeometry(); + } +} + +void PhysXCone::setCone(float r, float h, EAxisDirection d) { + _mData.radius = r; + _mData.height = h; + _mData.direction = d; + updateGeometry(); +} + +void PhysXCone::updateGeometry() { + if (!_mShape) return; + static physx::PxMeshScale scale; + pxSetVec3Ext(scale.scale, getSharedBody().getNode().worldScale); + scale.scale.y *= std::max(0.0001F, _mData.height / 2); + const auto xz = std::max(0.0001F, _mData.radius * 2); + scale.scale.x *= xz; + scale.scale.z *= xz; + Quaternion quat; + switch (_mData.direction) { + case EAxisDirection::X_AXIS: + quat.set(Vec3::UNIT_Z, physx::PxPiDivTwo); + pxSetQuatExt(scale.rotation, quat); + break; + case EAxisDirection::Y_AXIS: + default: + scale.rotation = physx::PxQuat{physx::PxIdentity}; + break; + case EAxisDirection::Z_AXIS: + quat.set(Vec3::UNIT_X, physx::PxPiDivTwo); + pxSetQuatExt(scale.rotation, quat); + break; + } + physx::PxConvexMeshGeometry geom; + if (getShape().getConvexMeshGeometry(geom)) { + geom.scale = scale; + getShape().setGeometry(geom); + } + pxSetQuatExt(_mRotation, quat); +} + +void PhysXCone::updateScale() { + updateGeometry(); + updateCenter(); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXCone.h b/native/cocos/physics/physx/shapes/PhysXCone.h new file mode 100644 index 0000000000..49200c689f --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXCone.h @@ -0,0 +1,55 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXCone final : public PhysXShape, public IConeShape { +public: + PhysXCone(); + ~PhysXCone() override = default; + void setConvex(uintptr_t handle) override; + void setCone(float r, float h, EAxisDirection d) override; + void updateScale() override; + + struct Cone { + float radius; + float height; + EAxisDirection direction; + }; + +private: + physx::PxConvexMesh *_mMesh; + Cone _mData; + void updateGeometry(); + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXCylinder.cpp b/native/cocos/physics/physx/shapes/PhysXCylinder.cpp new file mode 100644 index 0000000000..4d8f0d3eb7 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXCylinder.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXCylinder.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" +#include "math/Quaternion.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include + +namespace cc { +namespace physics { + +PhysXCylinder::PhysXCylinder() : _mMesh(nullptr){}; + +void PhysXCylinder::setConvex(uintptr_t handle) { + if (reinterpret_cast(_mMesh) == handle) return; + _mMesh = reinterpret_cast(handle); + if (_mShape) { + // TODO(Administrator): ... + } +} + +void PhysXCylinder::onComponentSet() { + if (_mMesh) { + physx::PxConvexMeshGeometry geom; + geom.convexMesh = _mMesh; + // geom.meshFlags = PxConvexMeshGeometryFlags::eTIGHT_BOUNDS; + _mShape = PxGetPhysics().createShape(geom, getDefaultMaterial(), true); + updateGeometry(); + } +} + +void PhysXCylinder::setCylinder(float r, float h, EAxisDirection d) { + _mData.radius = r; + _mData.height = h; + _mData.direction = d; + updateGeometry(); +} + +void PhysXCylinder::updateGeometry() { + if (!_mShape) return; + static physx::PxMeshScale scale; + pxSetVec3Ext(scale.scale, getSharedBody().getNode().worldScale); + scale.scale.y *= std::max(0.0001F, _mData.height / 2); + const auto xz = std::max(0.0001F, _mData.radius * 2); + scale.scale.x *= xz; + scale.scale.z *= xz; + Quaternion quat; + switch (_mData.direction) { + case EAxisDirection::X_AXIS: + quat.set(Vec3::UNIT_Z, physx::PxPiDivTwo); + pxSetQuatExt(scale.rotation, quat); + break; + case EAxisDirection::Y_AXIS: + default: + scale.rotation = physx::PxQuat{physx::PxIdentity}; + break; + case EAxisDirection::Z_AXIS: + quat.set(Vec3::UNIT_X, physx::PxPiDivTwo); + pxSetQuatExt(scale.rotation, quat); + break; + } + physx::PxConvexMeshGeometry geom; + if (getShape().getConvexMeshGeometry(geom)) { + geom.scale = scale; + getShape().setGeometry(geom); + } + pxSetQuatExt(_mRotation, quat); +} + +void PhysXCylinder::updateScale() { + updateGeometry(); + updateCenter(); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXCylinder.h b/native/cocos/physics/physx/shapes/PhysXCylinder.h new file mode 100644 index 0000000000..68fac46535 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXCylinder.h @@ -0,0 +1,55 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXCylinder final : public PhysXShape, public ICylinderShape { +public: + PhysXCylinder(); + ~PhysXCylinder() override = default; + void setConvex(uintptr_t handle) override; + void setCylinder(float r, float h, EAxisDirection d) override; + void updateScale() override; + + struct Cylinder { + float radius; + float height; + EAxisDirection direction; + }; + +private: + physx::PxConvexMesh *_mMesh; + Cylinder _mData; + void updateGeometry(); + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXPlane.cpp b/native/cocos/physics/physx/shapes/PhysXPlane.cpp new file mode 100644 index 0000000000..7b0f4ef679 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXPlane.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXPlane.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" + +namespace cc { +namespace physics { + +PhysXPlane::PhysXPlane() : _mConstant(0.F), + _mNormal(0.F, 1.F, 0.F) + {}; + +void PhysXPlane::setConstant(float x) { + _mConstant = x; + updateCenter(); +} + +void PhysXPlane::setNormal(float x, float y, float z) { + _mNormal = physx::PxVec3{x, y, z}; + updateCenter(); +} + +void PhysXPlane::onComponentSet() { + _mShape = PxGetPhysics().createShape(getPxGeometry(), getDefaultMaterial(), true); + updateCenter(); +} + +void PhysXPlane::updateScale() { + updateCenter(); +} + +void PhysXPlane::updateCenter() { + auto &node = getSharedBody().getNode(); + auto &geo = getPxGeometry(); + physx::PxTransform local; + pxSetFromTwoVectors(local.q, physx::PxVec3{1.F, 0.F, 0.F}, _mNormal); + local.p = _mNormal * _mConstant + _mCenter; + getShape().setLocalPose(local); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXPlane.h b/native/cocos/physics/physx/shapes/PhysXPlane.h new file mode 100644 index 0000000000..2615650530 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXPlane.h @@ -0,0 +1,49 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXPlane final : public PhysXShape, public IPlaneShape { +public: + PhysXPlane(); + ~PhysXPlane() override = default; + void setConstant(float x) override; + void setNormal(float x, float y, float z) override; + void updateScale() override; + +private: + physx::PxVec3 _mNormal; + physx::PxReal _mConstant; + void updateCenter() override; + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXShape.cpp b/native/cocos/physics/physx/shapes/PhysXShape.cpp new file mode 100644 index 0000000000..ac175b2c0e --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXShape.cpp @@ -0,0 +1,126 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/PhysXSharedBody.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" +#include + +namespace cc { +namespace physics { + +void PhysXShape::initialize(uint handle) { + PhysXWorld &ins = PhysXWorld::getInstance(); + _mSharedBody = ins.getSharedBody(handle); + getSharedBody().reference(true); + onComponentSet(); + getPxShapeMap().insert(std::pair(reinterpret_cast(&getShape()), getImpl())); +} + +void PhysXShape::onEnable() { + _mEnabled = true; + getSharedBody().addShape(*this); + getSharedBody().enabled(true); +} + +void PhysXShape::onDisable() { + _mEnabled = false; + getSharedBody().removeShape(*this); + getSharedBody().enabled(false); +} + +void PhysXShape::onDestroy() { + getSharedBody().reference(false); + getPxShapeMap().erase(reinterpret_cast(&getShape())); +} + +void PhysXShape::setMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) { + auto *mat = reinterpret_cast(getSharedBody().getWorld().createMaterial(id, f, df, r, m0, m1)); + getShape().setMaterials(&mat, 1); +} + +void PhysXShape::setAsTrigger(bool v) { + if (v) { + getShape().setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, !v); + getShape().setFlag(physx::PxShapeFlag::eTRIGGER_SHAPE, v); + } else { + getShape().setFlag(physx::PxShapeFlag::eTRIGGER_SHAPE, v); + getShape().setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, !v); + } + if (_mIndex >= 0) { + getSharedBody().removeShape(*this); + getSharedBody().addShape(*this); + } +} + +void PhysXShape::setCenter(float x, float y, float z) { + _mCenter = physx::PxVec3{x, y, z}; + updateCenter(); +} + +uint32_t PhysXShape::getGroup() { + return getSharedBody().getGroup(); +} + +void PhysXShape::setGroup(uint32_t g) { + getSharedBody().setGroup(g); +} + +uint32_t PhysXShape::getMask() { + return getSharedBody().getMask(); +} + +void PhysXShape::setMask(uint32_t m) { + getSharedBody().setMask(m); +} + +void PhysXShape::updateEventListener(EShapeFilterFlag flag) { +} + +cc::pipeline::AABB& PhysXShape::getAABB() { + static cc::pipeline::AABB aabb; + return aabb; +} + +cc::pipeline::Sphere& PhysXShape::getBoundingSphere() { + static cc::pipeline::Sphere s; + return s; +} + +void PhysXShape::updateFilterData(physx::PxFilterData &data) { +} + +void PhysXShape::updateCenter() { + auto &sb = getSharedBody(); + auto &node = sb.getNode(); + physx::PxTransform local{_mCenter * node.worldScale, _mRotation}; + getShape().setLocalPose(local); + if (_mEnabled && !isTrigger()) sb.updateCenterOfMass(); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXShape.h b/native/cocos/physics/physx/shapes/PhysXShape.h new file mode 100644 index 0000000000..b47412625c --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXShape.h @@ -0,0 +1,87 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/PhysXInc.h" +#include "physics/spec/IShape.h" +#include "base/Macros.h" + +namespace cc { +namespace physics { +class PhysXSharedBody; + +template +CC_INLINE T &getPxGeometry() { + static T geo; + return geo; +} + +class PhysXShape : virtual public IBaseShape { + PX_NOCOPY(PhysXShape) + PhysXShape() : _mCenter(physx::PxIdentity), + _mRotation(physx::PxIdentity){}; + +public: + ~PhysXShape() override = default; + CC_INLINE uintptr_t getImpl() override { return reinterpret_cast(this); } + void initialize(uint handle) override; + void onEnable() override; + void onDisable() override; + void onDestroy() override; + void setMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) override; + void setAsTrigger(bool v) override; + void setCenter(float x, float y, float z) override; + cc::pipeline::AABB & getAABB() override; + cc::pipeline::Sphere &getBoundingSphere() override; + void updateEventListener(EShapeFilterFlag flag) override; + uint32_t getGroup() override; + void setGroup(uint32_t g) override; + uint32_t getMask() override; + void setMask(uint32_t m) override; + virtual void updateScale() = 0; + CC_INLINE physx::PxVec3 &getCenter() { return _mCenter; } + CC_INLINE physx::PxShape &getShape() const { return *_mShape; } + CC_INLINE PhysXSharedBody &getSharedBody() const { return *_mSharedBody; } + CC_INLINE bool isTrigger() const { + return getShape().getFlags().isSet(physx::PxShapeFlag::eTRIGGER_SHAPE); + } + void updateFilterData(physx::PxFilterData &data); + +protected: + PhysXSharedBody *_mSharedBody{nullptr}; + physx::PxShape * _mShape{nullptr}; + physx::PxVec3 _mCenter; + physx::PxQuat _mRotation; + int8_t _mIndex{-1}; + uint8_t _mFlag{0}; + bool _mEnabled{false}; + virtual void updateCenter(); + virtual void onComponentSet() = 0; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXSphere.cpp b/native/cocos/physics/physx/shapes/PhysXSphere.cpp new file mode 100644 index 0000000000..90f35aca4a --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXSphere.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXSphere.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" + +namespace cc { +namespace physics { + +PhysXSphere::PhysXSphere() : _mRadius(0.5F), + PhysXShape(){}; + +void PhysXSphere::setRadius(float r) { + _mRadius = r; + updateGeometry(); + getShape().setGeometry(getPxGeometry()); +} + +void PhysXSphere::onComponentSet() { + updateGeometry(); + _mShape = PxGetPhysics().createShape(getPxGeometry(), getDefaultMaterial(), true); +} + +void PhysXSphere::updateScale() { + updateGeometry(); + getShape().setGeometry(getPxGeometry()); + updateCenter(); +} + +void PhysXSphere::updateGeometry() { + physx::PxVec3 scale; + pxSetVec3Ext(scale, getSharedBody().getNode().worldScale); + auto &geo = getPxGeometry(); + geo.radius = physx::PxMax(_mRadius * scale.abs().maxElement(), PX_NORMALIZATION_EPSILON); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXSphere.h b/native/cocos/physics/physx/shapes/PhysXSphere.h new file mode 100644 index 0000000000..1f1b4cdae9 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXSphere.h @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXSphere final : public PhysXShape, public ISphereShape { +public: + PhysXSphere(); + ~PhysXSphere() override = default; + void setRadius(float r) override; + void updateScale() override; + +private: + float _mRadius; + void updateGeometry(); + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXTerrain.cpp b/native/cocos/physics/physx/shapes/PhysXTerrain.cpp new file mode 100644 index 0000000000..8dd5980f12 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXTerrain.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXTerrain.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" +#include "renderer/pipeline/helper/SharedMemory.h" + +namespace cc { +namespace physics { + +PhysXTerrain::PhysXTerrain() : _mTerrain(nullptr), + _mRowScale(1.F), + _mColScale(1.F), + _mHeightScale(1.F){}; + +void PhysXTerrain::setTerrain(uintptr_t handle, float rs, float cs, float hs) { + if (reinterpret_cast(_mTerrain) == handle) return; + _mTerrain = reinterpret_cast(handle); + _mRowScale = rs; + _mColScale = cs; + _mHeightScale = hs; + if (_mShape) { + } +} + +void PhysXTerrain::onComponentSet() { + if (_mTerrain) { + physx::PxHeightFieldGeometry geom; + geom.rowScale = _mRowScale; + geom.columnScale = _mColScale; + geom.heightScale = _mHeightScale; + geom.heightField = _mTerrain; + _mShape = PxGetPhysics().createShape(geom, getDefaultMaterial(), true); + } +} + +void PhysXTerrain::updateScale() { + // updateCenter(); needed? +} + +void PhysXTerrain::updateCenter() { + getShape().setLocalPose(physx::PxTransform{_mCenter, _mRotation}); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXTerrain.h b/native/cocos/physics/physx/shapes/PhysXTerrain.h new file mode 100644 index 0000000000..b24eceb650 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXTerrain.h @@ -0,0 +1,50 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXTerrain final : public PhysXShape, public ITerrainShape { +public: + PhysXTerrain(); + ~PhysXTerrain() override = default; + void setTerrain(uintptr_t handle, float rs, float cs, float hs) override; + void updateScale() override; + void updateCenter() override; + +private: + physx::PxHeightField *_mTerrain; + float _mRowScale; + float _mColScale; + float _mHeightScale; + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXTrimesh.cpp b/native/cocos/physics/physx/shapes/PhysXTrimesh.cpp new file mode 100644 index 0000000000..a99a92ce91 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXTrimesh.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/physx/shapes/PhysXShape.h" +#include "physics/physx/shapes/PhysXTrimesh.h" +#include "physics/physx/PhysXUtils.h" +#include "physics/physx/PhysXWorld.h" +#include "renderer/pipeline/helper/SharedMemory.h" + +namespace cc { +namespace physics { + +PhysXTrimesh::PhysXTrimesh() : _mMeshHandle(0), + _mConvex(false){}; + +void PhysXTrimesh::setMesh(uintptr_t handle) { + if (_mMeshHandle == handle) return; + _mMeshHandle = handle; + if (_mShape) { + } +} + +void PhysXTrimesh::useConvex(bool v) { + if (_mConvex == v) return; + _mConvex = v; + if (_mShape) { + } +} + +void PhysXTrimesh::onComponentSet() { + if (_mMeshHandle) { + const auto &mat = getDefaultMaterial(); + if (_mConvex) { + physx::PxConvexMeshGeometry geom; + geom.convexMesh = reinterpret_cast(_mMeshHandle); + // geom.meshFlags = PxConvexMeshGeometryFlags::eTIGHT_BOUNDS; + _mShape = PxGetPhysics().createShape(geom, mat, true); + } else { + physx::PxTriangleMeshGeometry geom; + geom.triangleMesh = reinterpret_cast(_mMeshHandle); + // geom.meshFlags = PxMeshGeometryFlag::eDOUBLE_SIDED; + _mShape = PxGetPhysics().createShape(geom, mat, true); + } + updateGeometry(); + } +} + +void PhysXTrimesh::updateScale() { + updateGeometry(); + updateCenter(); +} + +void PhysXTrimesh::updateGeometry() { + static physx::PxMeshScale scale; + scale.rotation = physx::PxQuat{physx::PxIdentity}; + pxSetVec3Ext(scale.scale, getSharedBody().getNode().worldScale); + const auto &type = _mShape->getGeometryType(); + if (type == physx::PxGeometryType::eCONVEXMESH) { + physx::PxConvexMeshGeometry geom; + if (getShape().getConvexMeshGeometry(geom)) { + geom.scale = scale; + getShape().setGeometry(geom); + } + } else if (type == physx::PxGeometryType::eTRIANGLEMESH) { + physx::PxTriangleMeshGeometry geom; + if (getShape().getTriangleMeshGeometry(geom)) { + geom.scale = scale; + getShape().setGeometry(geom); + } + } +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/physx/shapes/PhysXTrimesh.h b/native/cocos/physics/physx/shapes/PhysXTrimesh.h new file mode 100644 index 0000000000..c62378b5a2 --- /dev/null +++ b/native/cocos/physics/physx/shapes/PhysXTrimesh.h @@ -0,0 +1,49 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/physx/shapes/PhysXShape.h" + +namespace cc { +namespace physics { + +class PhysXTrimesh final : public PhysXShape, public ITrimeshShape { +public: + PhysXTrimesh(); + ~PhysXTrimesh() override = default; + void setMesh(uintptr_t handle) override; + void useConvex(bool v) override; + void updateScale() override; + +private: + bool _mConvex; + uintptr_t _mMeshHandle; + void updateGeometry(); + void onComponentSet() override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/Joint.cpp b/native/cocos/physics/sdk/Joint.cpp new file mode 100644 index 0000000000..38da4da877 --- /dev/null +++ b/native/cocos/physics/sdk/Joint.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/PhysicsSelector.h" +#include "physics/sdk/Joint.h" + +#define CC_PHYSICS_JOINT_DEFINITION(CLASS, WRAPPED) \ + \ + CLASS::CLASS() { \ + _impl.reset(new WRAPPED()); \ + } \ + \ + CLASS::~CLASS() { \ + _impl.reset(nullptr); \ + } \ + \ + uintptr_t CLASS::getImpl() { \ + return _impl->getImpl(); \ + } \ + \ + void CLASS::initialize(uint h) { \ + _impl->initialize(h); \ + } \ + \ + void CLASS::onEnable() { \ + _impl->onEnable(); \ + } \ + \ + void CLASS::onDisable() { \ + _impl->onDisable(); \ + } \ + \ + void CLASS::onDestroy() { \ + _impl->onDestroy(); \ + } \ + \ + void CLASS::setConnectedBody(uint v) { \ + _impl->setConnectedBody(v); \ + } \ + \ + void CLASS::setEnableCollision(bool v) { \ + _impl->setEnableCollision(v); \ + } + +namespace cc { +namespace physics { + +/// COMMON /// + +CC_PHYSICS_JOINT_DEFINITION(DistanceJoint, WrappedDistanceJoint) +CC_PHYSICS_JOINT_DEFINITION(RevoluteJoint, WrappedRevoluteJoint) + +/// EXTRAS /// + +void DistanceJoint::setPivotA(float x, float y, float z) { + _impl->setPivotA(x, y, z); +} + +void DistanceJoint::setPivotB(float x, float y, float z) { + _impl->setPivotB(x, y, z); +} + +void RevoluteJoint::setPivotA(float x, float y, float z) { + _impl->setPivotA(x, y, z); +} + +void RevoluteJoint::setPivotB(float x, float y, float z) { + _impl->setPivotB(x, y, z); +} + +void RevoluteJoint::setAxis(float x, float y, float z) { + _impl->setAxis(x, y, z); +} + +} // namespace physics +} // namespace cc \ No newline at end of file diff --git a/native/cocos/physics/sdk/Joint.h b/native/cocos/physics/sdk/Joint.h new file mode 100644 index 0000000000..abe35779bf --- /dev/null +++ b/native/cocos/physics/sdk/Joint.h @@ -0,0 +1,65 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IJoint.h" +#include "base/Macros.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include +#include + +#define CC_PHYSICS_JOINT_CLASS(CLASS) \ + class CC_DLL CLASS final : virtual public I##CLASS { \ + protected: \ + std::unique_ptr _impl; \ + \ + public: \ + CLASS(); \ + ~CLASS() override; \ + uintptr_t getImpl() override; \ + void initialize(uint h) override; \ + void onEnable() override; \ + void onDisable() override; \ + void onDestroy() override; \ + void setEnableCollision(bool v) override; \ + void setConnectedBody(uint v) override; + +namespace cc { +namespace physics { + +CC_PHYSICS_JOINT_CLASS(RevoluteJoint) +void setPivotA(float x, float y, float z) override; +void setPivotB(float x, float y, float z) override; +void setAxis(float x, float y, float z) override; +}; + +CC_PHYSICS_JOINT_CLASS(DistanceJoint) +void setPivotA(float x, float y, float z) override; +void setPivotB(float x, float y, float z) override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/RigidBody.cpp b/native/cocos/physics/sdk/RigidBody.cpp new file mode 100644 index 0000000000..f3b15c4750 --- /dev/null +++ b/native/cocos/physics/sdk/RigidBody.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/PhysicsSelector.h" +#include "physics/sdk/RigidBody.h" +#include + +namespace cc { +namespace physics { + +RigidBody::RigidBody() { + _impl = std::make_unique(); +} + +RigidBody::~RigidBody() { + _impl.reset(nullptr); +} + +void RigidBody::initialize(const uint h, const ERigidBodyType t, const uint32_t g) { + _impl->initialize(h, t, g); +} + +void RigidBody::onEnable() { + _impl->onEnable(); +} + +void RigidBody::onDisable() { + _impl->onDisable(); +} + +void RigidBody::onDestroy() { + _impl->onDestroy(); +} + +bool RigidBody::isAwake() { + return _impl->isAwake(); +} + +bool RigidBody::isSleepy() { + return _impl->isSleepy(); +} + +bool RigidBody::isSleeping() { + return _impl->isSleeping(); +} + +void RigidBody::setType(ERigidBodyType v) { + _impl->setType(v); +} + +void RigidBody::setMass(float v) { + _impl->setMass(v); +} + +void RigidBody::setLinearDamping(float v) { + _impl->setLinearDamping(v); +} + +void RigidBody::setAngularDamping(float v) { + _impl->setAngularDamping(v); +} + +void RigidBody::useGravity(bool v) { + _impl->useGravity(v); +} + +void RigidBody::setLinearFactor(float x, float y, float z) { + _impl->setLinearFactor(x, y, z); +} + +void RigidBody::setAngularFactor(float x, float y, float z) { + _impl->setAngularFactor(x, y, z); +} + +void RigidBody::setAllowSleep(bool v) { + _impl->setAllowSleep(v); +} + +void RigidBody::wakeUp() { + _impl->wakeUp(); +} + +void RigidBody::sleep() { + _impl->sleep(); +} + +void RigidBody::clearState() { + _impl->clearState(); +} + +void RigidBody::clearForces() { + _impl->clearForces(); +} + +void RigidBody::clearVelocity() { + _impl->clearVelocity(); +} + +void RigidBody::setSleepThreshold(float v) { + _impl->setSleepThreshold(v); +} + +float RigidBody::getSleepThreshold() { + return _impl->getSleepThreshold(); +} + +cc::Vec3 RigidBody::getLinearVelocity() { + return _impl->getLinearVelocity(); +} + +void RigidBody::setLinearVelocity(float x, float y, float z) { + _impl->setLinearVelocity(x, y, z); +} + +cc::Vec3 RigidBody::getAngularVelocity() { + return _impl->getAngularVelocity(); +} + +void RigidBody::setAngularVelocity(float x, float y, float z) { + _impl->setAngularVelocity(x, y, z); +} + +void RigidBody::applyForce(float x, float y, float z, float rx, float ry, float rz) { + _impl->applyForce(x, y, z, rx, ry, rz); +} + +void RigidBody::applyLocalForce(float x, float y, float z, float rx, float ry, float rz) { + _impl->applyLocalForce(x, y, z, rx, ry, rz); +} + +void RigidBody::applyImpulse(float x, float y, float z, float rx, float ry, float rz) { + _impl->applyImpulse(x, y, z, rx, ry, rz); +} + +void RigidBody::applyLocalImpulse(float x, float y, float z, float rx, float ry, float rz) { + _impl->applyLocalImpulse(x, y, z, rx, ry, rz); +} + +void RigidBody::applyTorque(float x, float y, float z) { + _impl->applyTorque(x, y, z); +} + +void RigidBody::applyLocalTorque(float x, float y, float z) { + _impl->applyLocalTorque(x, y, z); +} + +uint32_t RigidBody::getGroup() { + return _impl->getGroup(); +} + +void RigidBody::setGroup(uint32_t g) { + _impl->setGroup(g); +} + +uint32_t RigidBody::getMask() { + return _impl->getMask(); +} + +void RigidBody::setMask(uint32_t m) { + _impl->setMask(m); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/RigidBody.h b/native/cocos/physics/sdk/RigidBody.h new file mode 100644 index 0000000000..b11638ce33 --- /dev/null +++ b/native/cocos/physics/sdk/RigidBody.h @@ -0,0 +1,81 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IBody.h" +#include "base/Macros.h" +#include + +namespace cc { +namespace physics { +class CC_DLL RigidBody final : public IRigidBody { +public: + RigidBody(); + ~RigidBody() override; + CC_INLINE uintptr_t getImpl() override { return _impl->getImpl(); }; + CC_INLINE uint getNodeHandle() override { return _impl->getNodeHandle(); } + void initialize(uint h, ERigidBodyType t, uint32_t g) override; + void onEnable() override; + void onDisable() override; + void onDestroy() override; + bool isAwake() override; + bool isSleepy() override; + bool isSleeping() override; + void setType(ERigidBodyType v) override; + void setMass(float v) override; + void setLinearDamping(float v) override; + void setAngularDamping(float v) override; + void useGravity(bool v) override; + void setLinearFactor(float x, float y, float z) override; + void setAngularFactor(float x, float y, float z) override; + void setAllowSleep(bool v) override; + void wakeUp() override; + void sleep() override; + void clearState() override; + void clearForces() override; + void clearVelocity() override; + void setSleepThreshold(float v) override; + float getSleepThreshold() override; + cc::Vec3 getLinearVelocity() override; + void setLinearVelocity(float x, float y, float z) override; + cc::Vec3 getAngularVelocity() override; + void setAngularVelocity(float x, float y, float z) override; + void applyForce(float x, float y, float z, float rx, float ry, float rz) override; + void applyLocalForce(float x, float y, float z, float rx, float ry, float rz) override; + void applyImpulse(float x, float y, float z, float rx, float ry, float rz) override; + void applyLocalImpulse(float x, float y, float z, float rx, float ry, float rz) override; + void applyTorque(float x, float y, float z) override; + void applyLocalTorque(float x, float y, float z) override; + uint32_t getGroup() override; + void setGroup(uint32_t g) override; + uint32_t getMask() override; + void setMask(uint32_t m) override; + +private: + std::unique_ptr _impl; +}; +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/Shape.cpp b/native/cocos/physics/sdk/Shape.cpp new file mode 100644 index 0000000000..c289c3d005 --- /dev/null +++ b/native/cocos/physics/sdk/Shape.cpp @@ -0,0 +1,174 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/PhysicsSelector.h" +#include "physics/sdk/Shape.h" + + +#define CC_PHYSICS_SHAPE_DEFINITION(CLASS, WRAPPED) \ + \ + CLASS::CLASS() { \ + _impl.reset(new WRAPPED()); \ + } \ + \ + CLASS::~CLASS() { \ + _impl.reset(nullptr); \ + } \ + \ + uintptr_t CLASS::getImpl() { \ + return _impl->getImpl(); \ + } \ + \ + void CLASS::initialize(uint uuid) { \ + _impl->initialize(uuid); \ + } \ + \ + void CLASS::onEnable() { \ + _impl->onEnable(); \ + } \ + \ + void CLASS::onDisable() { \ + _impl->onDisable(); \ + } \ + \ + void CLASS::onDestroy() { \ + _impl->onDestroy(); \ + } \ + \ + void CLASS::setMaterial(uint16_t ID, float f, float df, float r, \ + uint8_t m0, uint8_t m1) { \ + _impl->setMaterial(ID, f, df, r, m0, m1); \ + } \ + \ + void CLASS::setAsTrigger(bool v) { \ + _impl->setAsTrigger(v); \ + } \ + \ + void CLASS::setCenter(float x, float y, float z) { \ + _impl->setCenter(x, y, z); \ + } \ + \ + void CLASS::setGroup(uint32_t g) { \ + _impl->setGroup(g); \ + } \ + \ + uint32_t CLASS::getGroup() { \ + return _impl->getGroup(); \ + } \ + \ + void CLASS::setMask(uint32_t m) { \ + _impl->setMask(m); \ + } \ + \ + uint32_t CLASS::getMask() { \ + return _impl->getMask(); \ + } \ + \ + void CLASS::updateEventListener(EShapeFilterFlag v) { \ + _impl->updateEventListener(v); \ + } \ + \ + cc::pipeline::AABB& CLASS::getAABB() { \ + return _impl->getAABB(); \ + } \ + \ + cc::pipeline::Sphere& CLASS::getBoundingSphere() { \ + return _impl->getBoundingSphere(); \ + } + +namespace cc { +namespace physics { + +/// COMMON /// + +CC_PHYSICS_SHAPE_DEFINITION(SphereShape, WrappedSphereShape) +CC_PHYSICS_SHAPE_DEFINITION(BoxShape, WrappedBoxShape) +CC_PHYSICS_SHAPE_DEFINITION(PlaneShape, WrappedPlaneShape) +CC_PHYSICS_SHAPE_DEFINITION(CapsuleShape, WrappedCapsuleShape) +CC_PHYSICS_SHAPE_DEFINITION(CylinderShape, WrappedCylinderShape) +CC_PHYSICS_SHAPE_DEFINITION(ConeShape, WrappedConeShape) +CC_PHYSICS_SHAPE_DEFINITION(TrimeshShape, WrappedTrimeshShape) +CC_PHYSICS_SHAPE_DEFINITION(TerrainShape, WrappedTerrainShape) + +/// EXTRAS /// + +void SphereShape::setRadius(float v) { + _impl->setRadius(v); +} + +void BoxShape::setSize(float x, float y, float z) { + _impl->setSize(x, y, z); +} + +void CapsuleShape::setRadius(float v) { + _impl->setRadius(v); +} + +void CapsuleShape::setCylinderHeight(float v) { + _impl->setCylinderHeight(v); +} + +void CapsuleShape::setDirection(EAxisDirection v) { + _impl->setDirection(v); +} + +void PlaneShape::setConstant(float v) { + _impl->setConstant(v); +} + +void PlaneShape::setNormal(float x, float y, float z) { + _impl->setNormal(x, y, z); +} + +void TrimeshShape::setMesh(uintptr_t v) { + _impl->setMesh(v); +} + +void TrimeshShape::useConvex(bool v) { + _impl->useConvex(v); +} + +void TerrainShape::setTerrain(uintptr_t v, float rs, float cs, float hs) { + _impl->setTerrain(v, rs, cs, hs); +} + +void CylinderShape::setConvex(uintptr_t v) { + _impl->setConvex(v); +} + +void CylinderShape::setCylinder(float r, float h, EAxisDirection d) { + _impl->setCylinder(r, h, d); +} + +void ConeShape::setConvex(uintptr_t v) { + _impl->setConvex(v); +} + +void ConeShape::setCone(float r, float h, EAxisDirection d) { + _impl->setCone(r, h, d); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/Shape.h b/native/cocos/physics/sdk/Shape.h new file mode 100644 index 0000000000..81817d6495 --- /dev/null +++ b/native/cocos/physics/sdk/Shape.h @@ -0,0 +1,101 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IShape.h" +#include "base/Macros.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include +#include + +#define CC_PHYSICS_SHAPE_CLASS(CLASS) \ + class CC_DLL CLASS final : public I##CLASS { \ + protected: \ + std::unique_ptr _impl; \ + \ + public: \ + CLASS(); \ + ~CLASS() override; \ + uintptr_t getImpl() override; \ + void initialize(uint uuid) override; \ + void onEnable() override; \ + void onDisable() override; \ + void onDestroy() override; \ + void setMaterial(uint16_t ID, float f, float df, float r, \ + uint8_t m0, uint8_t m1) override; \ + void setAsTrigger(bool v) override; \ + void setCenter(float x, float y, float z) override; \ + void updateEventListener(EShapeFilterFlag v) override; \ + cc::pipeline::AABB& getAABB() override; \ + cc::pipeline::Sphere& getBoundingSphere() override; \ + uint32_t getGroup() override; \ + void setGroup(uint32_t g) override; \ + uint32_t getMask() override; \ + void setMask(uint32_t m) override; + +namespace cc { +namespace physics { + +CC_PHYSICS_SHAPE_CLASS(SphereShape) +void setRadius(float v) override; +}; + +CC_PHYSICS_SHAPE_CLASS(BoxShape) +void setSize(float x, float y, float z) override; +}; + +CC_PHYSICS_SHAPE_CLASS(CapsuleShape) +void setRadius(float v) override; +void setCylinderHeight(float v) override; +void setDirection(EAxisDirection v) override; +}; + +CC_PHYSICS_SHAPE_CLASS(PlaneShape) +void setConstant(float v) override; +void setNormal(float x, float y, float z) override; +}; + +CC_PHYSICS_SHAPE_CLASS(TrimeshShape) +void setMesh(uintptr_t v) override; +void useConvex(bool v) override; +}; + +CC_PHYSICS_SHAPE_CLASS(CylinderShape) +void setConvex(uintptr_t v) override; +void setCylinder(float r, float h, EAxisDirection d) override; +}; + +CC_PHYSICS_SHAPE_CLASS(ConeShape) +void setConvex(uintptr_t v) override; +void setCone(float r, float h, EAxisDirection d) override; +}; + +CC_PHYSICS_SHAPE_CLASS(TerrainShape) +void setTerrain(uintptr_t v, float rs, float cs, float hs) override; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/World.cpp b/native/cocos/physics/sdk/World.cpp new file mode 100644 index 0000000000..95c9bef426 --- /dev/null +++ b/native/cocos/physics/sdk/World.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "physics/PhysicsSelector.h" +#include "physics/sdk/World.h" +#include + +namespace cc { +namespace physics { + +World::World() { + _impl = std::make_unique(); +} + +World::~World() { + _impl.reset(nullptr); +} + +void World::emitEvents() { + _impl->emitEvents(); +} + +void World::step(float fixedTimeStep) { + _impl->step(fixedTimeStep); +} + +void World::setAllowSleep(bool v) { + _impl->setAllowSleep(v); +} + +void World::setGravity(float x, float y, float z) { + _impl->setGravity(x, y, z); +} + +uintptr_t World::createMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) { + return _impl->createMaterial(id, f, df, r, m0, m1); +} + +void World::syncSceneToPhysics() { + _impl->syncSceneToPhysics(); +} + +void World::syncSceneWithCheck() { + _impl->syncSceneWithCheck(); +} + +void World::destroy() { + _impl->destroy(); +} + +std::vector> &World::getTriggerEventPairs() { + return _impl->getTriggerEventPairs(); +} + +std::vector> &World::getContactEventPairs() { + return _impl->getContactEventPairs(); +} + +void World::setCollisionMatrix(uint32_t i, uint32_t m) { + _impl->setCollisionMatrix(i, m); +} + +uintptr_t World::createConvex(ConvexDesc &desc) { + return _impl->createConvex(desc); +} + +uintptr_t World::createTrimesh(TrimeshDesc &desc) { + return _impl->createTrimesh(desc); +} + +uintptr_t World::createHeightField(HeightFieldDesc &desc) { + return _impl->createHeightField(desc); +} + +bool World::raycast(RaycastOptions &opt) { + return _impl->raycast(opt); +} + +std::vector &World::raycastResult() { + return _impl->raycastResult(); +} + +bool World::raycastClosest(RaycastOptions &opt) { + return _impl->raycastClosest(opt); +} + +RaycastResult &World::raycastClosestResult() { + return _impl->raycastClosestResult(); +} + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/sdk/World.h b/native/cocos/physics/sdk/World.h new file mode 100644 index 0000000000..46f9260a67 --- /dev/null +++ b/native/cocos/physics/sdk/World.h @@ -0,0 +1,62 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/IWorld.h" +#include "base/Macros.h" +#include + +namespace cc { +namespace physics { +class CC_DLL World final : public IPhysicsWorld { +public: + World(); + ~World() override; + void setGravity(float x, float y, float z) override; + void setAllowSleep(bool v) override; + void step(float fixedTimeStep) override; + void emitEvents() override; + void syncSceneToPhysics() override; + void syncSceneWithCheck() override; + void setCollisionMatrix(uint32_t i, uint32_t m) override; + std::vector> &getTriggerEventPairs() override; + std::vector> &getContactEventPairs() override; + bool raycast(RaycastOptions &opt) override; + bool raycastClosest(RaycastOptions &opt) override; + std::vector &raycastResult() override; + RaycastResult &raycastClosestResult() override; + uintptr_t createConvex(ConvexDesc &desc) override; + uintptr_t createTrimesh(TrimeshDesc &desc) override; + uintptr_t createHeightField(HeightFieldDesc &desc) override; + uintptr_t createMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) override; + void destroy() override; + +private: + std::unique_ptr _impl; +}; +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/spec/IBody.h b/native/cocos/physics/spec/IBody.h new file mode 100644 index 0000000000..4a0e0ce55b --- /dev/null +++ b/native/cocos/physics/spec/IBody.h @@ -0,0 +1,81 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/ILifecycle.h" +#include "math/Vec3.h" + +namespace cc { +namespace physics { + +enum class ERigidBodyType : uint8_t { + DYNAMIC = 1, + STATIC = 2, + KINEMATIC = 4, +}; + +class IRigidBody : public ILifecycle { +public: + ~IRigidBody() override = default; + virtual uintptr_t getImpl() = 0; + virtual uint getNodeHandle() = 0; + virtual void initialize(uint h, ERigidBodyType t, uint32_t g) = 0; + virtual bool isAwake() = 0; + virtual bool isSleepy() = 0; + virtual bool isSleeping() = 0; + virtual void setType(ERigidBodyType v) = 0; + virtual void setMass(float v) = 0; + virtual void setLinearDamping(float v) = 0; + virtual void setAngularDamping(float v) = 0; + virtual void useGravity(bool v) = 0; + virtual void setLinearFactor(float x, float y, float z) = 0; + virtual void setAngularFactor(float x, float y, float z) = 0; + virtual void setAllowSleep(bool v) = 0; + virtual void wakeUp() = 0; + virtual void sleep() = 0; + virtual void clearState() = 0; + virtual void clearForces() = 0; + virtual void clearVelocity() = 0; + virtual void setSleepThreshold(float v) = 0; + virtual float getSleepThreshold() = 0; + virtual cc::Vec3 getLinearVelocity() = 0; + virtual void setLinearVelocity(float x, float y, float z) = 0; + virtual cc::Vec3 getAngularVelocity() = 0; + virtual void setAngularVelocity(float x, float y, float z) = 0; + virtual void applyForce(float x, float y, float z, float rx, float ry, float rz) = 0; + virtual void applyLocalForce(float x, float y, float z, float rx, float ry, float rz) = 0; + virtual void applyImpulse(float x, float y, float z, float rx, float ry, float rz) = 0; + virtual void applyLocalImpulse(float x, float y, float z, float rx, float ry, float rz) = 0; + virtual void applyTorque(float x, float y, float z) = 0; + virtual void applyLocalTorque(float x, float y, float z) = 0; + virtual uint32_t getGroup() = 0; + virtual void setGroup(uint32_t g) = 0; + virtual uint32_t getMask() = 0; + virtual void setMask(uint32_t m) = 0; +}; + +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/spec/IJoint.h b/native/cocos/physics/spec/IJoint.h new file mode 100644 index 0000000000..ae6f3d45c1 --- /dev/null +++ b/native/cocos/physics/spec/IJoint.h @@ -0,0 +1,60 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "physics/spec/ILifecycle.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include + +namespace cc { +namespace physics { + +class IBaseJoint : virtual public ILifecycle { +public: + ~IBaseJoint() override = default; + virtual void initialize(uint h) = 0; + virtual uintptr_t getImpl() = 0; + virtual void setEnableCollision(bool v) = 0; + virtual void setConnectedBody(uint v) = 0; +}; + +class IDistanceJoint : virtual public IBaseJoint { +public: + ~IDistanceJoint() override = default; + virtual void setPivotA(float x, float y, float z) = 0; + virtual void setPivotB(float x, float y, float z) = 0; +}; + +class IRevoluteJoint : virtual public IBaseJoint { +public: + ~IRevoluteJoint() override = default; + virtual void setPivotA(float x, float y, float z) = 0; + virtual void setPivotB(float x, float y, float z) = 0; + virtual void setAxis(float x, float y, float z) = 0; +}; + +} // namespace physics +} // namespace cc \ No newline at end of file diff --git a/native/cocos/physics/spec/ILifecycle.h b/native/cocos/physics/spec/ILifecycle.h new file mode 100644 index 0000000000..de29c9b31f --- /dev/null +++ b/native/cocos/physics/spec/ILifecycle.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/TypeDef.h" +#include + +namespace cc { +namespace physics { +class ILifecycle { +public: + virtual ~ILifecycle() = default; + virtual void onEnable() = 0; + virtual void onDisable() = 0; + virtual void onDestroy() = 0; +}; +} // namespace physics +} // namespace cc diff --git a/native/cocos/physics/spec/IShape.h b/native/cocos/physics/spec/IShape.h new file mode 100644 index 0000000000..3c74905b12 --- /dev/null +++ b/native/cocos/physics/spec/IShape.h @@ -0,0 +1,142 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "bindings/manual/jsb_conversions.h" +#include "physics/spec/ILifecycle.h" +#include "renderer/pipeline/helper/SharedMemory.h" +#include + +namespace cc { +namespace physics { + +enum class EAxisDirection : uint8_t { + X_AXIS, + Y_AXIS, + Z_AXIS, +}; + +enum class EShapeFilterFlag : uint8_t { + NONE = 0, + IS_TRIGGER = 1 << 0, + NEED_EVENT = 1 << 1, + NEED_CONTACT_DATA = 1 << 2, + DETECT_CONTACT_CCD = 1 << 3, +}; + +class IBaseShape : virtual public ILifecycle { +public: + ~IBaseShape() override= default;; + virtual void initialize(uint h) = 0; + virtual uintptr_t getImpl() = 0; + virtual void setMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) = 0; + virtual void setAsTrigger(bool v) = 0; + virtual void setCenter(float x, float y, float z) = 0; + virtual cc::pipeline::AABB& getAABB() = 0; + virtual cc::pipeline::Sphere& getBoundingSphere() = 0; + virtual void updateEventListener(EShapeFilterFlag flag) = 0; + virtual uint32_t getGroup() = 0; + virtual void setGroup(uint32_t g) = 0; + virtual uint32_t getMask() = 0; + virtual void setMask(uint32_t m) = 0; +}; + +class ISphereShape : virtual public IBaseShape { +public: + ~ISphereShape() override= default;; + virtual void setRadius(float v) = 0; +}; + +class IBoxShape : virtual public IBaseShape { +public: + ~IBoxShape() override= default;; + virtual void setSize(float x, float y, float z) = 0; +}; + +class ICapsuleShape : virtual public IBaseShape { +public: + ~ICapsuleShape() override= default;; + virtual void setRadius(float v) = 0; + virtual void setCylinderHeight(float v) = 0; + virtual void setDirection(EAxisDirection v) = 0; +}; + +class ICylinderShape : virtual public IBaseShape { +public: + ~ICylinderShape() override= default;; + virtual void setConvex(uintptr_t v) = 0; + virtual void setCylinder(float r, float h, EAxisDirection d) = 0; +}; + +class IConeShape : virtual public IBaseShape { +public: + ~IConeShape() override= default;; + virtual void setConvex(uintptr_t v) = 0; + virtual void setCone(float r, float h, EAxisDirection d) = 0; +}; + +class IPlaneShape : virtual public IBaseShape { +public: + ~IPlaneShape() override= default;; + virtual void setConstant(float v) = 0; + virtual void setNormal(float x, float y, float z) = 0; +}; + +class ITrimeshShape : virtual public IBaseShape { +public: + ~ITrimeshShape() override= default;; + virtual void setMesh(uintptr_t v) = 0; + virtual void useConvex(bool v) = 0; +}; + +class ITerrainShape : virtual public IBaseShape { +public: + virtual void setTerrain(uintptr_t v, float rs, float cs, float hs) = 0; +}; + +} // namespace physics +} // namespace cc + +template <> +inline bool nativevalue_to_se(const cc::pipeline::AABB &from, se::Value &to, se::Object *ctx) { + se::HandleObject obj(se::Object::createPlainObject()); + se::Value tmp; + if (nativevalue_to_se(from.center, tmp, ctx)) obj->setProperty("center", tmp); + if (nativevalue_to_se(from.halfExtents, tmp, ctx)) obj->setProperty("halfExtents", tmp); + to.setObject(obj); + return true; +} + +template <> +inline bool nativevalue_to_se(const cc::pipeline::Sphere &from, se::Value &to, se::Object *ctx) { + se::HandleObject obj(se::Object::createPlainObject()); + se::Value tmp(from.radius); + obj->setProperty("radius", tmp); + if (nativevalue_to_se(from.center, tmp, ctx)) obj->setProperty("center", tmp); + to.setObject(obj); + return true; +} diff --git a/native/cocos/physics/spec/IWorld.h b/native/cocos/physics/spec/IWorld.h new file mode 100644 index 0000000000..48b7a2a870 --- /dev/null +++ b/native/cocos/physics/spec/IWorld.h @@ -0,0 +1,341 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "bindings/manual/jsb_conversions.h" +#include "base/TypeDef.h" +#include +#include +#include + +namespace cc { +namespace physics { + +enum class ETouchState : uint8_t { + ENTER = 0, + STAY = 1, + EXIT = 2, +}; + +struct TriggerEventPair { + uintptr_t shapeA; + uintptr_t shapeB; + ETouchState state; + static constexpr uint8_t COUNT = 3; + TriggerEventPair(const uintptr_t a, const uintptr_t b) + : shapeA(a), + shapeB(b), + state(ETouchState::ENTER) {} +}; + +struct ContactPoint { + Vec3 position; + float separation; + Vec3 normal; + uint32_t internalFaceIndex0; + Vec3 impulse; + uint32_t internalFaceIndex1; + static constexpr uint8_t COUNT = 12; +}; + +struct ContactEventPair { + uintptr_t shapeA; + uintptr_t shapeB; + ETouchState state; + std::vector contacts; + static constexpr uint8_t COUNT = 4; + ContactEventPair(const uintptr_t a, const uintptr_t b) + : shapeA(a), + shapeB(b), + state(ETouchState::ENTER) {} +}; + +struct ConvexDesc { + void *positions; + uint32_t positionLength; +}; + +struct TrimeshDesc : ConvexDesc { + void *triangles; + uint32_t triangleLength; + bool isU16; +}; + +struct HeightFieldDesc { + uint32_t rows; + uint32_t columns; + void *samples; +}; + +struct RaycastOptions { + cc::Vec3 origin; + float distance; + cc::Vec3 unitDir; + uint32_t mask; + bool queryTrigger; +}; + +struct RaycastResult { + uintptr_t shape{0}; + cc::Vec3 hitPoint; + float distance; + cc::Vec3 hitNormal; + RaycastResult() = default; +}; + +class IPhysicsWorld { +public: + virtual ~IPhysicsWorld()= default;; + virtual void setGravity(float x, float y, float z) = 0; + virtual void setAllowSleep(bool v) = 0; + virtual void step(float s) = 0; + virtual void emitEvents() = 0; + virtual void syncSceneToPhysics() = 0; + virtual void syncSceneWithCheck() = 0; + virtual void destroy() = 0; + virtual void setCollisionMatrix(uint32_t i, uint32_t m) = 0; + virtual std::vector> &getTriggerEventPairs() = 0; + virtual std::vector> &getContactEventPairs() = 0; + virtual bool raycast(RaycastOptions &opt) = 0; + virtual bool raycastClosest(RaycastOptions &opt) = 0; + virtual std::vector &raycastResult() = 0; + virtual RaycastResult &raycastClosestResult() = 0; + virtual uintptr_t createConvex(ConvexDesc &desc) = 0; + virtual uintptr_t createTrimesh(TrimeshDesc &desc) = 0; + virtual uintptr_t createHeightField(HeightFieldDesc &desc) = 0; + virtual uintptr_t createMaterial(uint16_t id, float f, float df, float r, + uint8_t m0, uint8_t m1) = 0; +}; + +} // namespace physics +} // namespace cc + +template <> +inline bool nativevalue_to_se(const std::vector> &from, se::Value &to, se::Object * /*ctx*/) { + se::HandleObject array(se::Object::createArrayObject(from.size() * cc::physics::TriggerEventPair::COUNT)); + for (size_t i = 0; i < from.size(); i++) { + auto t = i * cc::physics::TriggerEventPair::COUNT; + array->setArrayElement(static_cast(t + 0), se::Value(from[i]->shapeA)); + array->setArrayElement(static_cast(t + 1), se::Value(from[i]->shapeB)); + array->setArrayElement(static_cast(t + 2), se::Value(static_cast(from[i]->state))); + } + to.setObject(array); + return true; +} + +template <> +inline bool nativevalue_to_se(const std::vector &from, se::Value &to, se::Object * /*ctx*/) { + const auto contactCount = from.size(); + se::HandleObject array(se::Object::createArrayObject(contactCount)); + for (size_t i = 0; i < contactCount; i++) { + auto t = i * cc::physics::ContactPoint::COUNT; + uint32_t j = 0; + array->setArrayElement(static_cast(t + j++), se::Value(from[i].position.x)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].position.y)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].position.z)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].normal.x)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].normal.y)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].normal.z)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].impulse.x)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].impulse.y)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].impulse.z)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].separation)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].internalFaceIndex0)); + array->setArrayElement(static_cast(t + j++), se::Value(from[i].internalFaceIndex1)); + } + to.setObject(array); + return true; +} + +template <> +inline bool nativevalue_to_se(const std::vector> &from, se::Value &to, se::Object *ctx) { + se::HandleObject array(se::Object::createArrayObject(from.size() * cc::physics::ContactEventPair::COUNT)); + for (size_t i = 0; i < from.size(); i++) { + auto t = i * cc::physics::ContactEventPair::COUNT; + array->setArrayElement(static_cast(t + 0), se::Value(from[i]->shapeA)); + array->setArrayElement(static_cast(t + 1), se::Value(from[i]->shapeB)); + array->setArrayElement(static_cast(t + 2), se::Value(static_cast(from[i]->state))); + array->setArrayElement(static_cast(t + 3), [&]() -> se::Value { + auto obj = se::Value(); + nativevalue_to_se(from[i]->contacts, obj, ctx); + return obj; + }()); + } + to.setObject(array); + return true; +} + +template <> +inline bool nativevalue_to_se(const cc::physics::RaycastResult &from, se::Value &to, se::Object *ctx) { + se::HandleObject obj(se::Object::createPlainObject()); + obj->setProperty("shape", se::Value(from.shape)); + obj->setProperty("distance", se::Value(from.distance)); + se::Value tmp; + if (nativevalue_to_se(from.hitPoint, tmp, ctx)) obj->setProperty("hitPoint", tmp); + if (nativevalue_to_se(from.hitNormal, tmp, ctx)) obj->setProperty("hitNormal", tmp); + to.setObject(obj); + return true; +} + +template <> +inline bool sevalue_to_native(const se::Value &from, cc::physics::ConvexDesc *to, se::Object *ctx) { + assert(from.isObject()); + se::Object *json = from.toObject(); + auto *data = static_cast(json->getPrivateData()); + if (data) { + *to = *data; + return true; + } + + se::Value field; + bool ok = true; + + json->getProperty("positionLength", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &to->positionLength, ctx); + + CC_UNUSED size_t dataLength = 0; + json->getProperty("positions", &field); + if (!field.isNullOrUndefined()) { + se::Object *obj = field.toObject(); + if (obj->isArrayBuffer()) { + ok &= obj->getArrayBufferData(reinterpret_cast(&to->positions), &dataLength); + SE_PRECONDITION2(ok, false, "getArrayBufferData failed!"); + } else if (obj->isTypedArray()) { + ok &= obj->getTypedArrayData(reinterpret_cast(&to->positions), &dataLength); + SE_PRECONDITION2(ok, false, "getTypedArrayData failed!"); + } else { + ok &= false; + } + } + return ok; +} + +template <> +inline bool sevalue_to_native(const se::Value &from, cc::physics::TrimeshDesc *to, se::Object *ctx) { + if (!sevalue_to_native(from, reinterpret_cast(to), ctx)) { + return false; + } + + assert(from.isObject()); + se::Object *json = from.toObject(); + auto *data = static_cast(json->getPrivateData()); + if (data) { + *to = *data; + return true; + } + se::Value field; + bool ok = true; + + json->getProperty("triangleLength", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &(to->triangleLength), ctx); + + json->getProperty("isU16", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &(to->isU16), ctx); + + CC_UNUSED size_t dataLength = 0; + json->getProperty("triangles", &field); + if (!field.isNullOrUndefined()) { + se::Object *obj = field.toObject(); + if (obj->isArrayBuffer()) { + ok &= obj->getArrayBufferData(reinterpret_cast(&to->triangles), &dataLength); + SE_PRECONDITION2(ok, false, "getArrayBufferData failed!"); + } else if (obj->isTypedArray()) { + ok &= obj->getTypedArrayData(reinterpret_cast(&to->triangles), &dataLength); + SE_PRECONDITION2(ok, false, "getTypedArrayData failed!"); + } else { + ok &= false; + } + } + + return ok; +} + +template <> +inline bool sevalue_to_native(const se::Value &from, cc::physics::HeightFieldDesc *to, se::Object *ctx) { + assert(from.isObject()); + se::Object *json = from.toObject(); + auto *data = static_cast(json->getPrivateData()); + if (data) { + *to = *data; + return true; + } + + se::Value field; + bool ok = true; + + json->getProperty("rows", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &to->rows, ctx); + + json->getProperty("columns", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &to->columns, ctx); + + CC_UNUSED size_t dataLength = 0; + json->getProperty("samples", &field); + if (!field.isNullOrUndefined()) { + se::Object *obj = field.toObject(); + if (obj->isArrayBuffer()) { + ok &= obj->getArrayBufferData(reinterpret_cast(&to->samples), &dataLength); + SE_PRECONDITION2(ok, false, "getArrayBufferData failed!"); + } else if (obj->isTypedArray()) { + ok &= obj->getTypedArrayData(reinterpret_cast(&to->samples), &dataLength); + SE_PRECONDITION2(ok, false, "getTypedArrayData failed!"); + } else { + ok &= false; + } + } + return ok; +} + +template <> +inline bool sevalue_to_native(const se::Value &from, cc::physics::RaycastOptions *to, se::Object *ctx) { + assert(from.isObject()); + se::Object *json = from.toObject(); + auto *data = static_cast(json->getPrivateData()); + if (data) { + *to = *data; + return true; + } + + se::Value field; + bool ok = true; + + json->getProperty("origin", &field); + if (!field.isNullOrUndefined()) ok &= seval_to_Vec3(field, &to->origin); + + json->getProperty("unitDir", &field); + if (!field.isNullOrUndefined()) ok &= seval_to_Vec3(field, &to->unitDir); + + json->getProperty("mask", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &to->mask, ctx); + + json->getProperty("distance", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &to->distance, ctx); + + json->getProperty("queryTrigger", &field); + if (!field.isNullOrUndefined()) ok &= sevalue_to_native(field, &to->queryTrigger, ctx); + + return ok; +} diff --git a/native/cocos/platform/Application.cpp b/native/cocos/platform/Application.cpp index 0030472f63..058ae7312b 100644 --- a/native/cocos/platform/Application.cpp +++ b/native/cocos/platform/Application.cpp @@ -1,25 +1,26 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "cocos/platform/Application.h" @@ -40,7 +41,7 @@ void Application::restartVM() { cc::EventDispatcher::dispatchRestartVM(); - auto scriptEngine = se::ScriptEngine::getInstance(); + auto *scriptEngine = se::ScriptEngine::getInstance(); cc::PoolManager::getInstance()->getCurrentPool()->clear(); #if USE_AUDIO @@ -91,7 +92,10 @@ void Application::tick() { _scheduler->update(dt); cc::EventDispatcher::dispatchTickEvent(dt); - PoolManager::getInstance()->getCurrentPool()->clear(); + AutoreleasePool *currentPool = PoolManager::getInstance()->getCurrentPool(); + if (currentPool) { + currentPool->clear(); + } now = std::chrono::steady_clock::now(); dtNS = dtNS * 0.1 + 0.9 * std::chrono::duration_cast(now - prevTime).count(); diff --git a/native/cocos/platform/Application.h b/native/cocos/platform/Application.h index 16ca7b20f5..7e26ea7321 100644 --- a/native/cocos/platform/Application.h +++ b/native/cocos/platform/Application.h @@ -1,27 +1,29 @@ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include diff --git a/native/cocos/platform/CanvasRenderingContext2D.h b/native/cocos/platform/CanvasRenderingContext2D.h index 64d82065ce..cf50fed9fa 100644 --- a/native/cocos/platform/CanvasRenderingContext2D.h +++ b/native/cocos/platform/CanvasRenderingContext2D.h @@ -1,17 +1,18 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,7 +21,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/platform/Device.h b/native/cocos/platform/Device.h index 1e586297d5..c7c48dbbb3 100644 --- a/native/cocos/platform/Device.h +++ b/native/cocos/platform/Device.h @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CCDEVICE_H__ diff --git a/native/cocos/platform/FileUtils.cpp b/native/cocos/platform/FileUtils.cpp index 382cb3188e..27c8324e0e 100644 --- a/native/cocos/platform/FileUtils.cpp +++ b/native/cocos/platform/FileUtils.cpp @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2013 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/FileUtils.h" diff --git a/native/cocos/platform/FileUtils.h b/native/cocos/platform/FileUtils.h index b9efce809c..20b780ec0c 100644 --- a/native/cocos/platform/FileUtils.h +++ b/native/cocos/platform/FileUtils.h @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2013 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CC_FILEUTILS_H__ #define __CC_FILEUTILS_H__ diff --git a/native/cocos/platform/Image.cpp b/native/cocos/platform/Image.cpp index 3e079081b1..a66e52a6f2 100644 --- a/native/cocos/platform/Image.cpp +++ b/native/cocos/platform/Image.cpp @@ -1,40 +1,43 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2016-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "Image.h" -#include -#include -#include #include "base/Config.h" // CC_USE_JPEG, CC_USE_WEBP +#include +#include +#include #if CC_USE_JPEG #include "jpeg/jpeglib.h" #endif // CC_USE_JPEG +#include "base/CoreStd.h" #include "base/Data.h" #include "base/Utils.h" -#include "renderer/core/Core.h" +#include "gfx-base/GFXDef.h" extern "C" { #if CC_USE_PNG @@ -51,8 +54,8 @@ extern "C" { #include "webp/decode.h" #endif // CC_USE_WEBP -#include "platform/FileUtils.h" #include "base/ZipUtils.h" +#include "platform/FileUtils.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID) #include "platform/android/FileUtils-android.h" #endif @@ -65,22 +68,22 @@ namespace cc { //struct and data for pvr structure namespace { -static const int PVR_TEXTURE_FLAG_TYPE_MASK = 0xff; +const int PVR_TEXTURE_FLAG_TYPE_MASK = 0xff; // Values taken from PVRTexture.h from http://www.imgtec.com enum class PVR2TextureFlag { - Mipmap = (1 << 8), // has mip map levels - Twiddle = (1 << 9), // is twiddled - Bumpmap = (1 << 10), // has normals encoded for a bump map - Tiling = (1 << 11), // is bordered for tiled pvr - Cubemap = (1 << 12), // is a cubemap/skybox - FalseMipCol = (1 << 13), // are there false colored MIP levels - Volume = (1 << 14), // is this a volume texture - Alpha = (1 << 15), // v2.1 is there transparency info in the texture - VerticalFlip = (1 << 16), // v2.1 is the texture vertically flipped + MIPMAP = (1 << 8), // has mip map levels + TWIDDLE = (1 << 9), // is twiddled + BUMPMAP = (1 << 10), // has normals encoded for a bump map + TILING = (1 << 11), // is bordered for tiled pvr + CUBEMAP = (1 << 12), // is a cubemap/skybox + FALSE_MIP_COL = (1 << 13), // are there false colored MIP levels + VOLUME = (1 << 14), // is this a volume texture + ALPHA = (1 << 15), // v2.1 is there transparency info in the texture + VERTICAL_FLIP = (1 << 16), // v2.1 is the texture vertically flipped }; -static const char gPVRTexIdentifier[5] = "PVR!"; +const char G_PVR_TEX_IDENTIFIER[5] = "PVR!"; // v2 enum class PVR2TexturePixelFormat : unsigned char { @@ -100,99 +103,97 @@ enum class PVR2TexturePixelFormat : unsigned char { // v3 enum class PVR3TexturePixelFormat : uint64_t { - PVRTC2BPP_RGB = 0ULL, - PVRTC2BPP_RGBA = 1ULL, - PVRTC4BPP_RGB = 2ULL, - PVRTC4BPP_RGBA = 3ULL, - PVRTC2_2BPP_RGBA = 4ULL, - PVRTC2_4BPP_RGBA = 5ULL, - ETC1 = 6ULL, - DXT1 = 7ULL, - DXT2 = 8ULL, - DXT3 = 9ULL, - DXT4 = 10ULL, - DXT5 = 11ULL, - BC1 = 7ULL, - BC2 = 9ULL, - BC3 = 11ULL, - BC4 = 12ULL, - BC5 = 13ULL, - BC6 = 14ULL, - BC7 = 15ULL, - UYVY = 16ULL, - YUY2 = 17ULL, - BW1bpp = 18ULL, - R9G9B9E5 = 19ULL, - RGBG8888 = 20ULL, - GRGB8888 = 21ULL, - ETC2_RGB = 22ULL, - ETC2_RGBA = 23ULL, - ETC2_RGBA1 = 24ULL, - EAC_R11_Unsigned = 25ULL, - EAC_R11_Signed = 26ULL, - EAC_RG11_Unsigned = 27ULL, - EAC_RG11_Signed = 28ULL, + PVRTC2BPP_RGB = 0ULL, + PVRTC2BPP_RGBA = 1ULL, + PVRTC4BPP_RGB = 2ULL, + PVRTC4BPP_RGBA = 3ULL, + PVRTC2_2BPP_RGBA = 4ULL, + PVRTC2_4BPP_RGBA = 5ULL, + ETC1 = 6ULL, + DXT1 = 7ULL, + DXT2 = 8ULL, + DXT3 = 9ULL, + DXT4 = 10ULL, + DXT5 = 11ULL, + BC1 = 7ULL, + BC2 = 9ULL, + BC3 = 11ULL, + BC4 = 12ULL, + BC5 = 13ULL, + BC6 = 14ULL, + BC7 = 15ULL, + UYVY = 16ULL, + YUY2 = 17ULL, + B_W1BPP = 18ULL, + R9G9B9E5 = 19ULL, + RGBG8888 = 20ULL, + GRGB8888 = 21ULL, + ETC2_RGB = 22ULL, + ETC2_RGBA = 23ULL, + ETC2_RGBA1 = 24ULL, + EAC_R11_UNSIGNED = 25ULL, + EAC_R11_SIGNED = 26ULL, + EAC_R_G11_UNSIGNED = 27ULL, + EAC_R_G11_SIGNED = 28ULL, BGRA8888 = 0x0808080861726762ULL, RGBA8888 = 0x0808080861626772ULL, RGBA4444 = 0x0404040461626772ULL, RGBA5551 = 0x0105050561626772ULL, - RGB565 = 0x0005060500626772ULL, - RGB888 = 0x0008080800626772ULL, - A8 = 0x0000000800000061ULL, - L8 = 0x000000080000006cULL, - LA88 = 0x000008080000616cULL, + RGB565 = 0x0005060500626772ULL, + RGB888 = 0x0008080800626772ULL, + A8 = 0x0000000800000061ULL, + L8 = 0x000000080000006cULL, + LA88 = 0x000008080000616cULL, }; // v2 -typedef const std::map _pixel2_formathash; +using _pixel2_formathash = const std::map; -static const _pixel2_formathash::value_type v2_pixel_formathash_value[] = - { - _pixel2_formathash::value_type(PVR2TexturePixelFormat::BGRA8888, gfx::Format::BGRA8), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGBA8888, gfx::Format::RGBA8), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGBA4444, gfx::Format::RGBA4), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGBA5551, gfx::Format::RGB5A1), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGB565, gfx::Format::R5G6B5), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGB888, gfx::Format::RGB8), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::A8, gfx::Format::A8), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::I8, gfx::Format::L8), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::AI88, gfx::Format::LA8), +const _pixel2_formathash::value_type V2_PIXEL_FORMATHASH_VALUE[] = { + _pixel2_formathash::value_type(PVR2TexturePixelFormat::BGRA8888, gfx::Format::BGRA8), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGBA8888, gfx::Format::RGBA8), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGBA4444, gfx::Format::RGBA4), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGBA5551, gfx::Format::RGB5A1), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGB565, gfx::Format::R5G6B5), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::RGB888, gfx::Format::RGB8), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::A8, gfx::Format::A8), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::I8, gfx::Format::L8), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::AI88, gfx::Format::LA8), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::PVRTC2BPP_RGBA, gfx::Format::PVRTC_RGBA2), - _pixel2_formathash::value_type(PVR2TexturePixelFormat::PVRTC4BPP_RGBA, gfx::Format::PVRTC_RGBA4), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::PVRTC2BPP_RGBA, gfx::Format::PVRTC_RGBA2), + _pixel2_formathash::value_type(PVR2TexturePixelFormat::PVRTC4BPP_RGBA, gfx::Format::PVRTC_RGBA4), }; -static const int PVR2_MAX_TABLE_ELEMENTS = sizeof(v2_pixel_formathash_value) / sizeof(v2_pixel_formathash_value[0]); -static const _pixel2_formathash v2_pixel_formathash(v2_pixel_formathash_value, v2_pixel_formathash_value + PVR2_MAX_TABLE_ELEMENTS); +const int PVR2_MAX_TABLE_ELEMENTS = sizeof(V2_PIXEL_FORMATHASH_VALUE) / sizeof(V2_PIXEL_FORMATHASH_VALUE[0]); +const _pixel2_formathash V2_PIXEL_FORMATHASH(V2_PIXEL_FORMATHASH_VALUE, V2_PIXEL_FORMATHASH_VALUE + PVR2_MAX_TABLE_ELEMENTS); // v3 -typedef const std::map _pixel3_formathash; -static _pixel3_formathash::value_type v3_pixel_formathash_value[] = - { - _pixel3_formathash::value_type(PVR3TexturePixelFormat::BGRA8888, gfx::Format::BGRA8), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGBA8888, gfx::Format::RGBA8), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGBA4444, gfx::Format::RGBA4), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGBA5551, gfx::Format::RGB5A1), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGB565, gfx::Format::R5G6B5), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGB888, gfx::Format::RGB8), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::A8, gfx::Format::A8), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::L8, gfx::Format::L8), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::LA88, gfx::Format::LA8), +using _pixel3_formathash = const std::map; +_pixel3_formathash::value_type v3PixelFormathashValue[] = { + _pixel3_formathash::value_type(PVR3TexturePixelFormat::BGRA8888, gfx::Format::BGRA8), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGBA8888, gfx::Format::RGBA8), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGBA4444, gfx::Format::RGBA4), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGBA5551, gfx::Format::RGB5A1), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGB565, gfx::Format::R5G6B5), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::RGB888, gfx::Format::RGB8), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::A8, gfx::Format::A8), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::L8, gfx::Format::L8), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::LA88, gfx::Format::LA8), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC2BPP_RGB, gfx::Format::PVRTC_RGB2), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC2BPP_RGBA, gfx::Format::PVRTC_RGBA2), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC4BPP_RGB, gfx::Format::PVRTC_RGB4), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC4BPP_RGBA, gfx::Format::PVRTC_RGBA4), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC2BPP_RGB, gfx::Format::PVRTC_RGB2), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC2BPP_RGBA, gfx::Format::PVRTC_RGBA2), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC4BPP_RGB, gfx::Format::PVRTC_RGB4), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::PVRTC4BPP_RGBA, gfx::Format::PVRTC_RGBA4), - _pixel3_formathash::value_type(PVR3TexturePixelFormat::ETC1, gfx::Format::ETC_RGB8), + _pixel3_formathash::value_type(PVR3TexturePixelFormat::ETC1, gfx::Format::ETC_RGB8), }; -static const int PVR3_MAX_TABLE_ELEMENTS = sizeof(v3_pixel_formathash_value) / sizeof(v3_pixel_formathash_value[0]); +const int PVR3_MAX_TABLE_ELEMENTS = sizeof(v3PixelFormathashValue) / sizeof(v3PixelFormathashValue[0]); -static const _pixel3_formathash v3_pixel_formathash(v3_pixel_formathash_value, v3_pixel_formathash_value + PVR3_MAX_TABLE_ELEMENTS); +const _pixel3_formathash V3_PIXEL_FORMATHASH(v3PixelFormathashValue, v3PixelFormathashValue + PVR3_MAX_TABLE_ELEMENTS); -typedef struct _PVRTexHeader { +using PVRv2TexHeader = struct PvrTexHeader { unsigned int headerLength; unsigned int height; unsigned int width; @@ -206,13 +207,12 @@ typedef struct _PVRTexHeader { unsigned int bitmaskAlpha; unsigned int pvrTag; unsigned int numSurfs; -} PVRv2TexHeader; +}; #ifdef _MSC_VER #pragma pack(push, 1) #endif -typedef struct -{ +using PVRv3TexHeader = struct { uint32_t version; uint32_t flags; uint64_t pixelFormat; @@ -226,31 +226,30 @@ typedef struct uint32_t numberOfMipmaps; uint32_t metadataLength; #ifdef _MSC_VER -} PVRv3TexHeader; +}; #pragma pack(pop) #else -} __attribute__((packed)) PVRv3TexHeader; +} __attribute__((packed)); #endif } // namespace //pvr structure end namespace { -typedef struct -{ +using tImageSource = struct { const unsigned char *data; - ssize_t size; - int offset; -} tImageSource; + ssize_t size; + int offset; +}; #ifdef CC_USE_PNG -static void pngReadCallback(png_structp png_ptr, png_bytep data, png_size_t length) { - tImageSource *isource = (tImageSource *)png_get_io_ptr(png_ptr); +void pngReadCallback(png_structp pngPtr, png_bytep data, png_size_t length) { + auto *isource = static_cast(png_get_io_ptr(pngPtr)); - if ((int)(isource->offset + length) <= isource->size) { + if (static_cast(isource->offset + length) <= isource->size) { memcpy(data, isource->data + isource->offset, length); isource->offset += length; } else { - png_error(png_ptr, "pngReaderCallback failed"); + png_error(pngPtr, "pngReaderCallback failed"); } } #endif //CC_USE_PNG @@ -289,7 +288,7 @@ bool Image::initWithImageData(const unsigned char *data, ssize_t dataLen) { CC_BREAK_IF(!data || dataLen <= 0); unsigned char *unpackedData = nullptr; - ssize_t unpackedLen = 0; + ssize_t unpackedLen = 0; //detect and unzip the compress file if (ZipUtils::isCCZBuffer(data, dataLen)) { @@ -298,7 +297,7 @@ bool Image::initWithImageData(const unsigned char *data, ssize_t dataLen) { unpackedLen = ZipUtils::inflateMemory(const_cast(data), dataLen, &unpackedData); } else { unpackedData = const_cast(data); - unpackedLen = dataLen; + unpackedLen = dataLen; } _fileType = detectFormat(unpackedData, unpackedLen); @@ -332,7 +331,7 @@ bool Image::initWithImageData(const unsigned char *data, ssize_t dataLen) { if (unpackedData != data) { free(unpackedData); } - } while (0); + } while (false); return ret; } @@ -347,16 +346,16 @@ bool Image::isPng(const unsigned char *data, ssize_t dataLen) { return memcmp(PNG_SIGNATURE, data, sizeof(PNG_SIGNATURE)) == 0; } -bool Image::isEtc(const unsigned char *data, ssize_t dataLen) { - return etc1_pkm_is_valid((etc1_byte *)data) ? true : false; +bool Image::isEtc(const unsigned char *data, ssize_t /*dataLen*/) { + return etc1_pkm_is_valid(const_cast(data)) != 0; } -bool Image::isEtc2(const unsigned char *data, ssize_t dataLen) { - return etc2_pkm_is_valid((etc2_byte *)data) ? true : false; +bool Image::isEtc2(const unsigned char *data, ssize_t /*dataLen*/) { + return etc2_pkm_is_valid(const_cast(data)) != 0; } -bool Image::isASTC(const unsigned char *data, ssize_t dataLen) { - return astcIsValid((astc_byte *)data) ? true : false; +bool Image::isASTC(const unsigned char *data, ssize_t /*dataLen*/) { + return astcIsValid(const_cast(data)); } bool Image::isJpg(const unsigned char *data, ssize_t dataLen) { @@ -374,10 +373,10 @@ bool Image::isWebp(const unsigned char *data, ssize_t dataLen) { return false; } - static const char *WEBP_RIFF = "RIFF"; - static const char *WEBP_WEBP = "WEBP"; + static const char *webpRiff = "RIFF"; + static const char *webpWebp = "WEBP"; - return memcmp(data, WEBP_RIFF, 4) == 0 && memcmp(static_cast(data) + 8, WEBP_WEBP, 4) == 0; + return memcmp(data, webpRiff, 4) == 0 && memcmp(static_cast(data) + 8, webpWebp, 4) == 0; } bool Image::isPvr(const unsigned char *data, ssize_t dataLen) { @@ -385,122 +384,109 @@ bool Image::isPvr(const unsigned char *data, ssize_t dataLen) { return false; } - const PVRv2TexHeader *headerv2 = static_cast(static_cast(data)); - const PVRv3TexHeader *headerv3 = static_cast(static_cast(data)); + const auto *headerv2 = static_cast(static_cast(data)); + const auto *headerv3 = static_cast(static_cast(data)); - return memcmp(&headerv2->pvrTag, gPVRTexIdentifier, strlen(gPVRTexIdentifier)) == 0 || CC_SWAP_INT32_BIG_TO_HOST(headerv3->version) == 0x50565203; + return memcmp(&headerv2->pvrTag, G_PVR_TEX_IDENTIFIER, strlen(G_PVR_TEX_IDENTIFIER)) == 0 || CC_SWAP_INT32_BIG_TO_HOST(headerv3->version) == 0x50565203; } Image::Format Image::detectFormat(const unsigned char *data, ssize_t dataLen) { if (isPng(data, dataLen)) { return Format::PNG; - } else if (isJpg(data, dataLen)) { - return Format::JPG; - } else if (isWebp(data, dataLen)) { - return Format::WEBP; - } else if (isPvr(data, dataLen)) { - return Format::PVR; - } else if (isEtc(data, dataLen)) { - return Format::ETC; - } else if (isEtc2(data, dataLen)) { - return Format::ETC2; - } else if (isASTC(data, dataLen)) { - return Format::ASTC; - } else { - return Format::UNKNOWN; } + if (isJpg(data, dataLen)) { + return Format::JPG; + } + if (isWebp(data, dataLen)) { + return Format::WEBP; + } + if (isPvr(data, dataLen)) { + return Format::PVR; + } + if (isEtc(data, dataLen)) { + return Format::ETC; + } + if (isEtc2(data, dataLen)) { + return Format::ETC2; + } + if (isASTC(data, dataLen)) { + return Format::ASTC; + } + return Format::UNKNOWN; } -gfx::Format Image::getASTCFormat(const unsigned char *pHeader) const { +gfx::Format Image::getASTCFormat(const unsigned char *pHeader) { int xdim = pHeader[ASTC_HEADER_MAGIC]; int ydim = pHeader[ASTC_HEADER_MAGIC + 1]; - if (xdim == 4) { - return gfx::Format::ASTC_RGBA_4x4; - } else if (xdim == 5) { - if (ydim == 4) { - return gfx::Format::ASTC_RGBA_5x4; - } else { - return gfx::Format::ASTC_RGBA_5x5; - } - } else if (xdim == 6) { - if (ydim == 5) { - return gfx::Format::ASTC_RGBA_6x5; - } else { - return gfx::Format::ASTC_RGBA_6x6; - } - } else if (xdim == 8) { - if (ydim == 5) { - return gfx::Format::ASTC_RGBA_8x5; - } else if (ydim == 6) { - return gfx::Format::ASTC_RGBA_8x6; - } else { - return gfx::Format::ASTC_RGBA_8x8; - } - } else if (xdim == 10) { - if (ydim == 5) { - return gfx::Format::ASTC_RGBA_10x5; - } else if (ydim == 6) { - return gfx::Format::ASTC_RGBA_10x6; - } else if (ydim == 8) { - return gfx::Format::ASTC_RGBA_10x8; - } else { - return gfx::Format::ASTC_RGBA_10x10; - } - } else { - if (ydim == 10) { - return gfx::Format::ASTC_RGBA_12x10; - } else { - return gfx::Format::ASTC_RGBA_12x12; - } + if (xdim == 4) return gfx::Format::ASTC_RGBA_4X4; + if (xdim == 5) { + if (ydim == 4) return gfx::Format::ASTC_RGBA_5X4; + return gfx::Format::ASTC_RGBA_5X5; } + if (xdim == 6) { + if (ydim == 5) return gfx::Format::ASTC_RGBA_6X5; + return gfx::Format::ASTC_RGBA_6X6; + } + if (xdim == 8) { + if (ydim == 5) return gfx::Format::ASTC_RGBA_8X5; + if (ydim == 6) return gfx::Format::ASTC_RGBA_8X6; + return gfx::Format::ASTC_RGBA_8X8; + } + if (xdim == 10) { + if (ydim == 5) return gfx::Format::ASTC_RGBA_10X5; + if (ydim == 6) return gfx::Format::ASTC_RGBA_10X6; + if (ydim == 8) return gfx::Format::ASTC_RGBA_10X8; + return gfx::Format::ASTC_RGBA_10X10; + } + if (ydim == 10) return gfx::Format::ASTC_RGBA_12X10; + return gfx::Format::ASTC_RGBA_12X12; } namespace { /* - * ERROR HANDLING: - * - * The JPEG library's standard error handler (jerror.c) is divided into - * several "methods" which you can override individually. This lets you - * adjust the behavior without duplicating a lot of code, which you might - * have to update with each future release. - * - * We override the "error_exit" method so that control is returned to the - * library's caller when a fatal error occurs, rather than calling exit() - * as the standard error_exit method does. - * - * We use C's setjmp/longjmp facility to return control. This means that the - * routine which calls the JPEG library must first execute a setjmp() call to - * establish the return point. We want the replacement error_exit to do a - * longjmp(). But we need to make the setjmp buffer accessible to the - * error_exit routine. To do this, we make a private extension of the - * standard JPEG error handler object. (If we were using C++, we'd say we - * were making a subclass of the regular error handler.) - * - * Here's the extended error handler struct: - */ + * ERROR HANDLING: + * + * The JPEG library's standard error handler (jerror.c) is divided into + * several "methods" which you can override individually. This lets you + * adjust the behavior without duplicating a lot of code, which you might + * have to update with each future release. + * + * We override the "error_exit" method so that control is returned to the + * library's caller when a fatal error occurs, rather than calling exit() + * as the standard error_exit method does. + * + * We use C's setjmp/longjmp facility to return control. This means that the + * routine which calls the JPEG library must first execute a setjmp() call to + * establish the return point. We want the replacement error_exit to do a + * longjmp(). But we need to make the setjmp buffer accessible to the + * error_exit routine. To do this, we make a private extension of the + * standard JPEG error handler object. (If we were using C++, we'd say we + * were making a subclass of the regular error handler.) + * + * Here's the extended error handler struct: + */ #if CC_USE_JPEG struct MyErrorMgr { - struct jpeg_error_mgr pub; /* "public" fields */ - jmp_buf setjmp_buffer; /* for return to caller */ + struct jpeg_error_mgr pub; /* "public" fields */ + jmp_buf setjmp_buffer; /* for return to caller */ }; -typedef struct MyErrorMgr *MyErrorPtr; +using MyErrorPtr = struct MyErrorMgr *; /* - * Here's the routine that will replace the standard error_exit method: - */ + * Here's the routine that will replace the standard error_exit method: + */ -METHODDEF(void) -myErrorExit(j_common_ptr cinfo) { +void myErrorExit(j_common_ptr cinfo) { /* cinfo->err really points to a MyErrorMgr struct, so coerce pointer */ - MyErrorPtr myerr = (MyErrorPtr)cinfo->err; + auto *myerr = reinterpret_cast(cinfo->err); /* Always display the message. */ /* We could postpone this until after returning, if we chose. */ /* internal message function can't show error message in some platforms, so we rewrite it here. - * edit it if has version conflict. - */ + * edit it if has version conflict. + */ //(*cinfo->err->output_message) (cinfo); char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message)(cinfo, buffer); @@ -522,13 +508,13 @@ bool Image::initWithJpgData(const unsigned char *data, ssize_t dataLen) { */ struct MyErrorMgr jerr; /* libjpeg data structure for storing one row, that is, scanline of an image */ - JSAMPROW row_pointer[1] = {0}; - unsigned long location = 0; + JSAMPROW rowPointer[1] = {nullptr}; + uint32_t location = 0; bool ret = false; do { /* We set up the normal JPEG error routines, then override error_exit. */ - cinfo.err = jpeg_std_error(&jerr.pub); + cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = myErrorExit; /* Establish the setjmp return context for MyErrorExit to use. */ if (setjmp(jerr.setjmp_buffer)) { @@ -553,11 +539,11 @@ bool Image::initWithJpgData(const unsigned char *data, ssize_t dataLen) { #endif // we only support RGB or grayscale - if (cinfo.jpeg_color_space == JCS_GRAYSCALE) + if (cinfo.jpeg_color_space == JCS_GRAYSCALE) { _renderFormat = gfx::Format::L8; - else { + } else { cinfo.out_color_space = JCS_RGB; - _renderFormat = gfx::Format::RGB8; + _renderFormat = gfx::Format::RGB8; } /* Start decompression jpeg here */ @@ -565,18 +551,18 @@ bool Image::initWithJpgData(const unsigned char *data, ssize_t dataLen) { /* init image info */ _isCompressed = false; - _width = cinfo.output_width; - _height = cinfo.output_height; - _dataLen = cinfo.output_width * cinfo.output_height * cinfo.output_components; - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _width = cinfo.output_width; + _height = cinfo.output_height; + _dataLen = cinfo.output_width * cinfo.output_height * cinfo.output_components; + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); CC_BREAK_IF(!_data); /* now actually read the jpeg into the raw buffer */ /* read one scan line at a time */ while (cinfo.output_scanline < cinfo.output_height) { - row_pointer[0] = _data + location; + rowPointer[0] = _data + location; location += cinfo.output_width * cinfo.output_components; - jpeg_read_scanlines(&cinfo, row_pointer, 1); + jpeg_read_scanlines(&cinfo, rowPointer, 1); } /* When read image file with broken data, jpeg_finish_decompress() may cause error. @@ -588,7 +574,7 @@ bool Image::initWithJpgData(const unsigned char *data, ssize_t dataLen) { jpeg_destroy_decompress(&cinfo); /* wrap up decompression, destroy objects, free pointers and close open files */ ret = true; - } while (0); + } while (false); return ret; #endif // CC_USE_JPEG @@ -598,10 +584,10 @@ bool Image::initWithPngData(const unsigned char *data, ssize_t dataLen) { #if CC_USE_PNG // length of bytes to check if it is a valid png file #define PNGSIGSIZE 8 - bool ret = false; - png_byte header[PNGSIGSIZE] = {0}; - png_structp png_ptr = 0; - png_infop info_ptr = 0; + bool ret = false; + png_byte header[PNGSIGSIZE] = {0}; + png_structp pngPtr = nullptr; + png_infop infoPtr = nullptr; do { // png header len is 8 bytes @@ -612,64 +598,64 @@ bool Image::initWithPngData(const unsigned char *data, ssize_t dataLen) { CC_BREAK_IF(png_sig_cmp(header, 0, PNGSIGSIZE)); // init png_struct - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - CC_BREAK_IF(!png_ptr); + pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + CC_BREAK_IF(!pngPtr); // init png_info - info_ptr = png_create_info_struct(png_ptr); - CC_BREAK_IF(!info_ptr); + infoPtr = png_create_info_struct(pngPtr); + CC_BREAK_IF(!infoPtr); - CC_BREAK_IF(setjmp(png_jmpbuf(png_ptr))); + CC_BREAK_IF(setjmp(png_jmpbuf(pngPtr))); // set the read call back function tImageSource imageSource; - imageSource.data = (unsigned char *)data; - imageSource.size = dataLen; + imageSource.data = const_cast(data); + imageSource.size = dataLen; imageSource.offset = 0; - png_set_read_fn(png_ptr, &imageSource, pngReadCallback); + png_set_read_fn(pngPtr, &imageSource, pngReadCallback); // read png header info // read png file info - png_read_info(png_ptr, info_ptr); + png_read_info(pngPtr, infoPtr); - _isCompressed = false; - _width = png_get_image_width(png_ptr, info_ptr); - _height = png_get_image_height(png_ptr, info_ptr); - png_byte bit_depth = png_get_bit_depth(png_ptr, info_ptr); - png_uint_32 color_type = png_get_color_type(png_ptr, info_ptr); + _isCompressed = false; + _width = png_get_image_width(pngPtr, infoPtr); + _height = png_get_image_height(pngPtr, infoPtr); + png_byte bitDepth = png_get_bit_depth(pngPtr, infoPtr); + png_uint_32 colorType = png_get_color_type(pngPtr, infoPtr); //CC_LOG_DEBUG("color type %u", color_type); // force palette images to be expanded to 24-bit RGB // it may include alpha channel - if (color_type == PNG_COLOR_TYPE_PALETTE) { - png_set_palette_to_rgb(png_ptr); + if (colorType == PNG_COLOR_TYPE_PALETTE) { + png_set_palette_to_rgb(pngPtr); } // low-bit-depth grayscale images are to be expanded to 8 bits - if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { - bit_depth = 8; - png_set_expand_gray_1_2_4_to_8(png_ptr); + if (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8) { + bitDepth = 8; + png_set_expand_gray_1_2_4_to_8(pngPtr); } // expand any tRNS chunk data into a full alpha channel - if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { - png_set_tRNS_to_alpha(png_ptr); + if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) { + png_set_tRNS_to_alpha(pngPtr); } // reduce images with 16-bit samples to 8 bits - if (bit_depth == 16) { - png_set_strip_16(png_ptr); + if (bitDepth == 16) { + png_set_strip_16(pngPtr); } // Expanded earlier for grayscale, now take care of palette and rgb - if (bit_depth < 8) { - png_set_packing(png_ptr); + if (bitDepth < 8) { + png_set_packing(pngPtr); } // update info - png_read_update_info(png_ptr, info_ptr); - bit_depth = png_get_bit_depth(png_ptr, info_ptr); - color_type = png_get_color_type(png_ptr, info_ptr); + png_read_update_info(pngPtr, infoPtr); + bitDepth = png_get_bit_depth(pngPtr, infoPtr); + colorType = png_get_color_type(pngPtr, infoPtr); - switch (color_type) { + switch (colorType) { case PNG_COLOR_TYPE_GRAY: _renderFormat = gfx::Format::L8; break; @@ -688,64 +674,65 @@ bool Image::initWithPngData(const unsigned char *data, ssize_t dataLen) { // read png data png_size_t rowbytes; - png_bytep *row_pointers = (png_bytep *)malloc(sizeof(png_bytep) * _height); + auto * rowPointers = static_cast(malloc(sizeof(png_bytep) * _height)); - rowbytes = png_get_rowbytes(png_ptr, info_ptr); + rowbytes = png_get_rowbytes(pngPtr, infoPtr); _dataLen = rowbytes * _height; - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); if (!_data) { - if (row_pointers != nullptr) { - free(row_pointers); + if (rowPointers != nullptr) { + free(rowPointers); } break; } - for (unsigned short i = 0; i < _height; ++i) { - row_pointers[i] = _data + i * rowbytes; + for (int i = 0; i < _height; ++i) { + rowPointers[i] = _data + i * rowbytes; } - png_read_image(png_ptr, row_pointers); - png_read_end(png_ptr, nullptr); + png_read_image(pngPtr, rowPointers); + png_read_end(pngPtr, nullptr); - if (row_pointers != nullptr) { - free(row_pointers); + if (rowPointers != nullptr) { + free(rowPointers); } ret = true; - } while (0); + } while (false); - if (png_ptr) { - png_destroy_read_struct(&png_ptr, (info_ptr) ? &info_ptr : 0, 0); + if (pngPtr) { + png_destroy_read_struct(&pngPtr, (infoPtr) ? &infoPtr : nullptr, nullptr); } return ret; #endif //CC_USE_PNG } bool Image::initWithPVRv2Data(const unsigned char *data, ssize_t dataLen) { - int width = 0, height = 0; + int width = 0; + int height = 0; //Cast first sizeof(PVRTexHeader) bytes of data stream as PVRTexHeader - const PVRv2TexHeader *header = static_cast(static_cast(data)); + const auto *header = static_cast(static_cast(data)); //Make sure that tag is in correct formatting - if (memcmp(&header->pvrTag, gPVRTexIdentifier, strlen(gPVRTexIdentifier)) != 0) { + if (memcmp(&header->pvrTag, G_PVR_TEX_IDENTIFIER, strlen(G_PVR_TEX_IDENTIFIER)) != 0) { return false; } - unsigned int flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags); - PVR2TexturePixelFormat formatFlags = static_cast(flags & PVR_TEXTURE_FLAG_TYPE_MASK); - bool flipped = (flags & (unsigned int)PVR2TextureFlag::VerticalFlip) ? true : false; + unsigned int flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags); + auto formatFlags = static_cast(flags & PVR_TEXTURE_FLAG_TYPE_MASK); + bool flipped = (flags & static_cast(PVR2TextureFlag::VERTICAL_FLIP)) != 0; if (flipped) { CC_LOG_DEBUG("initWithPVRv2Data: WARNING: Image is flipped. Regenerate it using PVRTexTool"); } - if (v2_pixel_formathash.find(formatFlags) == v2_pixel_formathash.end()) { + if (V2_PIXEL_FORMATHASH.find(formatFlags) == V2_PIXEL_FORMATHASH.end()) { CC_LOG_DEBUG("initWithPVRv2Data: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } - auto it = v2_pixel_formathash.find(formatFlags); - if (it == v2_pixel_formathash.end()) { + auto it = V2_PIXEL_FORMATHASH.find(formatFlags); + if (it == V2_PIXEL_FORMATHASH.end()) { CC_LOG_DEBUG("initWithPVRv2Data: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } @@ -755,12 +742,12 @@ bool Image::initWithPVRv2Data(const unsigned char *data, ssize_t dataLen) { //Get size of mipmap _width = width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width); _height = height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height); - _isCompressed = true; + _isCompressed = true; //Move by size of header _dataLen = dataLen - sizeof(PVRv2TexHeader); - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); - memcpy(_data, (unsigned char *)data + sizeof(PVRv2TexHeader), _dataLen); + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + memcpy(_data, const_cast(data) + sizeof(PVRv2TexHeader), _dataLen); return true; } @@ -770,7 +757,7 @@ bool Image::initWithPVRv3Data(const unsigned char *data, ssize_t dataLen) { return false; } - const PVRv3TexHeader *header = static_cast(static_cast(data)); + const auto *header = static_cast(static_cast(data)); // validate version if (CC_SWAP_INT32_BIG_TO_HOST(header->version) != 0x50565203) { @@ -779,16 +766,16 @@ bool Image::initWithPVRv3Data(const unsigned char *data, ssize_t dataLen) { } // parse pixel format - PVR3TexturePixelFormat pixelFormat = static_cast(header->pixelFormat); + auto pixelFormat = static_cast(header->pixelFormat); - if (v3_pixel_formathash.find(pixelFormat) == v3_pixel_formathash.end()) { + if (V3_PIXEL_FORMATHASH.find(pixelFormat) == V3_PIXEL_FORMATHASH.end()) { CC_LOG_DEBUG("initWithPVRv3Data: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format variant", static_cast(pixelFormat)); return false; } - auto it = v3_pixel_formathash.find(pixelFormat); - if (it == v3_pixel_formathash.end()) { + auto it = V3_PIXEL_FORMATHASH.find(pixelFormat); + if (it == V3_PIXEL_FORMATHASH.end()) { CC_LOG_DEBUG("initWithPVRv3Data: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format variant", static_cast(pixelFormat)); return false; @@ -797,27 +784,27 @@ bool Image::initWithPVRv3Data(const unsigned char *data, ssize_t dataLen) { _renderFormat = it->second; // sizing - _width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width); - _height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height); + _width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width); + _height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height); _isCompressed = true; _dataLen = dataLen - (sizeof(PVRv3TexHeader) + header->metadataLength); - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); memcpy(_data, static_cast(data) + sizeof(PVRv3TexHeader) + header->metadataLength, _dataLen); return true; } bool Image::initWithETCData(const unsigned char *data, ssize_t dataLen) { - const etc1_byte *header = static_cast(data); + const auto *header = static_cast(data); //check the data if (!etc1_pkm_is_valid(header)) { return false; } - _width = etc1_pkm_get_width(header); - _height = etc1_pkm_get_height(header); + _width = etc1_pkm_get_width(header); + _height = etc1_pkm_get_height(header); _isCompressed = true; if (0 == _width || 0 == _height) { @@ -825,22 +812,22 @@ bool Image::initWithETCData(const unsigned char *data, ssize_t dataLen) { } _renderFormat = gfx::Format::ETC_RGB8; - _dataLen = dataLen - ETC_PKM_HEADER_SIZE; - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _dataLen = dataLen - ETC_PKM_HEADER_SIZE; + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); memcpy(_data, static_cast(data) + ETC_PKM_HEADER_SIZE, _dataLen); return true; } bool Image::initWithETC2Data(const unsigned char *data, ssize_t dataLen) { - const etc2_byte *header = static_cast(data); + const auto *header = static_cast(data); //check the data if (!etc2_pkm_is_valid(header)) { return false; } - _width = etc2_pkm_get_width(header); - _height = etc2_pkm_get_height(header); + _width = etc2_pkm_get_width(header); + _height = etc2_pkm_get_height(header); _isCompressed = true; if (0 == _width || 0 == _height) { @@ -848,27 +835,28 @@ bool Image::initWithETC2Data(const unsigned char *data, ssize_t dataLen) { } etc2_uint32 format = etc2_pkm_get_format(header); - if (format == ETC2_RGB_NO_MIPMAPS) + if (format == ETC2_RGB_NO_MIPMAPS) { _renderFormat = gfx::Format::ETC2_RGB8; - else + } else { _renderFormat = gfx::Format::ETC2_RGBA8; + } _dataLen = dataLen - ETC2_PKM_HEADER_SIZE; - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); memcpy(_data, static_cast(data) + ETC2_PKM_HEADER_SIZE, _dataLen); return true; } bool Image::initWithASTCData(const unsigned char *data, ssize_t dataLen) { - const astc_byte *header = static_cast(data); + const auto *header = static_cast(data); //check the data if (!astcIsValid(header)) { return false; } - _width = astcGetWidth(header); - _height = astcGetHeight(header); + _width = astcGetWidth(header); + _height = astcGetHeight(header); _isCompressed = true; if (0 == _width || 0 == _height) { @@ -878,7 +866,7 @@ bool Image::initWithASTCData(const unsigned char *data, ssize_t dataLen) { _renderFormat = getASTCFormat(header); _dataLen = dataLen - ASTC_HEADER_SIZE; - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); memcpy(_data, static_cast(data) + ASTC_HEADER_SIZE, _dataLen); // if (_data == nullptr) { // CCLOG("initWithASTCData: ERROR: Image _data is null!"); @@ -903,17 +891,17 @@ bool Image::initWithWebpData(const unsigned char *data, ssize_t dataLen) { if (config.input.width == 0 || config.input.height == 0) break; config.output.colorspace = config.input.has_alpha ? MODE_rgbA : MODE_RGB; - _renderFormat = config.input.has_alpha ? gfx::Format::RGBA8 : gfx::Format::RGB8; - _width = config.input.width; - _height = config.input.height; - _isCompressed = false; + _renderFormat = config.input.has_alpha ? gfx::Format::RGBA8 : gfx::Format::RGB8; + _width = config.input.width; + _height = config.input.height; + _isCompressed = false; _dataLen = _width * _height * (config.input.has_alpha ? 4 : 3); - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); - config.output.u.RGBA.rgba = static_cast(_data); - config.output.u.RGBA.stride = _width * (config.input.has_alpha ? 4 : 3); - config.output.u.RGBA.size = _dataLen; + config.output.u.RGBA.rgba = static_cast(_data); + config.output.u.RGBA.stride = _width * (config.input.has_alpha ? 4 : 3); + config.output.u.RGBA.size = _dataLen; config.output.is_external_memory = 1; if (WebPDecode(static_cast(data), dataLen, &config) != VP8_STATUS_OK) { @@ -923,30 +911,30 @@ bool Image::initWithWebpData(const unsigned char *data, ssize_t dataLen) { } ret = true; - } while (0); + } while (false); return ret; #endif // CC_USE_WEBP } -bool Image::initWithRawData(const unsigned char *data, ssize_t dataLen, int width, int height, int bitsPerComponent, bool preMulti) { +bool Image::initWithRawData(const unsigned char *data, ssize_t /*dataLen*/, int width, int height, int /*bitsPerComponent*/, bool /*preMulti*/) { bool ret = false; do { CC_BREAK_IF(0 == width || 0 == height); - _height = height; - _width = width; + _height = height; + _width = width; _renderFormat = gfx::Format::RGBA8; _isCompressed = false; // only RGBA8888 supported int bytesPerComponent = 4; - _dataLen = height * width * bytesPerComponent; - _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); + _dataLen = height * width * bytesPerComponent; + _data = static_cast(malloc(_dataLen * sizeof(unsigned char))); CC_BREAK_IF(!_data); memcpy(_data, data, _dataLen); ret = true; - } while (0); + } while (false); return ret; } diff --git a/native/cocos/platform/Image.h b/native/cocos/platform/Image.h index 872db303f5..ce534e8772 100644 --- a/native/cocos/platform/Image.h +++ b/native/cocos/platform/Image.h @@ -1,27 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2016-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "base/Ref.h" @@ -94,7 +97,6 @@ protected: bool initWithETC2Data(const unsigned char *data, ssize_t dataLen); bool initWithASTCData(const unsigned char *data, ssize_t dataLen); -protected: unsigned char *_data = nullptr; ssize_t _dataLen = 0; int _width = 0; @@ -104,27 +106,18 @@ protected: std::string _filePath; bool _isCompressed = false; -protected: - // noncopyable - Image(const Image &) = delete; - Image &operator=(const Image &) = delete; + ~Image() override; - // nonmoveable - Image(Image &&) = delete; - Image &operator=(Image &&) = delete; + static Format detectFormat(const unsigned char *data, ssize_t dataLen); + static bool isPng(const unsigned char *data, ssize_t dataLen); + static bool isJpg(const unsigned char *data, ssize_t dataLen); + static bool isWebp(const unsigned char *data, ssize_t dataLen); + static bool isPvr(const unsigned char *data, ssize_t dataLen); + static bool isEtc(const unsigned char *data, ssize_t dataLen); + static bool isEtc2(const unsigned char *data, ssize_t dataLen); + static bool isASTC(const unsigned char *data, ssize_t detaLen); - virtual ~Image(); - - Format detectFormat(const unsigned char *data, ssize_t dataLen); - bool isPng(const unsigned char *data, ssize_t dataLen); - bool isJpg(const unsigned char *data, ssize_t dataLen); - bool isWebp(const unsigned char *data, ssize_t dataLen); - bool isPvr(const unsigned char *data, ssize_t dataLen); - bool isEtc(const unsigned char *data, ssize_t dataLen); - bool isEtc2(const unsigned char *data, ssize_t dataLen); - bool isASTC(const unsigned char *data, ssize_t detaLen); - - gfx::Format getASTCFormat(const unsigned char *pHeader) const; + static gfx::Format getASTCFormat(const unsigned char *pHeader); }; } //namespace cc diff --git a/native/cocos/platform/SAXParser.cpp b/native/cocos/platform/SAXParser.cpp index c7fd061b57..6692c2a59f 100644 --- a/native/cocos/platform/SAXParser.cpp +++ b/native/cocos/platform/SAXParser.cpp @@ -3,17 +3,20 @@ Copyright (c) 2010 cocos2d-x.org Copyright (c) 2013 Martell Malone Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +25,7 @@ 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 "platform/SAXParser.h" diff --git a/native/cocos/platform/SAXParser.h b/native/cocos/platform/SAXParser.h index e3e3df799e..bca9d4bb2b 100644 --- a/native/cocos/platform/SAXParser.h +++ b/native/cocos/platform/SAXParser.h @@ -2,17 +2,20 @@ Copyright (c) 2010 cocos2d-x.org Copyright (c) 2010 Максим Аксенов Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +24,7 @@ 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 __CCSAXPARSER_H__ #define __CCSAXPARSER_H__ diff --git a/native/cocos/platform/StdC.h b/native/cocos/platform/StdC.h index 254a83b681..60c6a01d5d 100644 --- a/native/cocos/platform/StdC.h +++ b/native/cocos/platform/StdC.h @@ -1,26 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 cocos.com Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020 cocos.com Xiamen Yaji Software Co., Ltd. + Copyright (c) undefined-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #if CC_PLATFORM == CC_PLATFORM_WINDOWS diff --git a/native/cocos/platform/android/Application-android.cpp b/native/cocos/platform/android/Application-android.cpp index 43c13a549b..6e2da1ee88 100644 --- a/native/cocos/platform/android/Application-android.cpp +++ b/native/cocos/platform/android/Application-android.cpp @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/Application.h" #include #include @@ -34,6 +36,10 @@ THE SOFTWARE. #include "platform/android/jni/JniHelper.h" #include "platform/android/jni/JniCocosActivity.h" +#include "pipeline/Define.h" +#include "pipeline/RenderPipeline.h" +#include "renderer/GFXDeviceManager.h" + #define LOG_APP_TAG "Application_android Debug" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_APP_TAG, __VA_ARGS__) @@ -45,7 +51,10 @@ extern "C" size_t __ctype_get_mb_cur_max(void) { } #endif +namespace cc { + namespace { + bool setCanvasCallback(se::Object *global) { auto viewLogicalSize = cc::Application::getInstance()->getViewLogicalSize(); se::AutoHandleScope scope; @@ -57,11 +66,20 @@ bool setCanvasCallback(se::Object *global) { (uintptr_t)cc::cocosApp.window); se->evalString(commandBuf); + gfx::DeviceInfo deviceInfo; + deviceInfo.windowHandle = (uintptr_t)cc::cocosApp.window; + deviceInfo.width = viewLogicalSize.x; + deviceInfo.height = viewLogicalSize.y; + deviceInfo.nativeWidth = viewLogicalSize.x; + deviceInfo.nativeHeight = viewLogicalSize.y; + deviceInfo.bindingMappingInfo = pipeline::bindingMappingInfo; + + gfx::DeviceManager::create(deviceInfo); + return true; } -} // namespace -namespace cc { +} // namespace Application *Application::_instance = nullptr; std::shared_ptr Application::_scheduler = nullptr; @@ -78,9 +96,13 @@ Application::~Application() { AudioEngine::end(); #endif + pipeline::RenderPipeline::getInstance()->destroy(); + EventDispatcher::destroy(); se::ScriptEngine::destroyInstance(); + gfx::DeviceManager::destroy(); + Application::_instance = nullptr; } diff --git a/native/cocos/platform/android/CanvasRenderingContext2D-android.cpp b/native/cocos/platform/android/CanvasRenderingContext2D-android.cpp index 259d9e18e4..bd0f909d8a 100644 --- a/native/cocos/platform/android/CanvasRenderingContext2D-android.cpp +++ b/native/cocos/platform/android/CanvasRenderingContext2D-android.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "platform/CanvasRenderingContext2D.h" #include "base/csscolorparser.h" #include "math/Math.h" diff --git a/native/cocos/platform/android/Device-android.cpp b/native/cocos/platform/android/Device-android.cpp index 1f61f15288..0f310a894d 100644 --- a/native/cocos/platform/android/Device-android.cpp +++ b/native/cocos/platform/android/Device-android.cpp @@ -1,33 +1,34 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #if CC_PLATFORM == CC_PLATFORM_ANDROID #include "platform/Device.h" - #include + #include #include #include #include @@ -39,11 +40,11 @@ THE SOFTWARE. #include "platform/android/jni/JniHelper.h" #ifndef JCLS_HELPER - #define JCLS_HELPER "com/cocos/lib/CocosHelper" + constexpr auto JCLS_HELPER = "com/cocos/lib/CocosHelper"; #endif #ifndef JCLS_SENSOR - #define JCLS_SENSOR "com/cocos/lib/CocosSensorHandler" + constexpr auto JCLS_SENSOR = "com/cocos/lib/CocosSensorHandler"; #endif namespace { @@ -68,7 +69,8 @@ int Device::getDPI() { AConfiguration_fromAssetManager(config, cocosApp.assetManager); int32_t density = AConfiguration_getDensity(config); AConfiguration_delete(config); - dpi = density * 160; + const int stdDpi = 160; + dpi = density * stdDpi; } return dpi; } @@ -110,16 +112,20 @@ Device::Orientation Device::getDeviceOrientation() { return Orientation::PORTRAIT_UPSIDE_DOWN; case ROTATION_270: return Orientation::LANDSCAPE_LEFT; + default: + break; } + return Orientation::PORTRAIT; } std::string Device::getDeviceModel() { return JniHelper::callStaticStringMethod(JCLS_HELPER, "getDeviceModel"); } -void Device::setKeepScreenOn(bool value) { +void Device::setKeepScreenOn(bool keepScreenOn) { // JniHelper::callStaticVoidMethod(JCLS_HELPER, "setKeepScreenOn", value); // ANativeActivity_setWindowFlags(JniHelper::getAndroidApp()->activity, AWINDOW_FLAG_KEEP_SCREEN_ON, 0); + CC_UNUSED_PARAM(keepScreenOn); } void Device::vibrate(float duration) { diff --git a/native/cocos/platform/android/FileUtils-android.cpp b/native/cocos/platform/android/FileUtils-android.cpp index 803348b6e8..bd82f16c2e 100644 --- a/native/cocos/platform/android/FileUtils-android.cpp +++ b/native/cocos/platform/android/FileUtils-android.cpp @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #if CC_PLATFORM == CC_PLATFORM_ANDROID diff --git a/native/cocos/platform/android/FileUtils-android.h b/native/cocos/platform/android/FileUtils-android.h index 732c2520d8..08771429c7 100644 --- a/native/cocos/platform/android/FileUtils-android.h +++ b/native/cocos/platform/android/FileUtils-android.h @@ -1,19 +1,20 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,8 @@ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. 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 __CC_FILEUTILS_ANDROID_H__ #define __CC_FILEUTILS_ANDROID_H__ diff --git a/native/cocos/platform/android/View.cpp b/native/cocos/platform/android/View.cpp index 53d02da7d2..797dccab1e 100644 --- a/native/cocos/platform/android/View.cpp +++ b/native/cocos/platform/android/View.cpp @@ -1,19 +1,20 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,8 @@ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. 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 "View.h" #include #include "cocos/bindings/event/EventDispatcher.h" @@ -45,26 +47,26 @@ std::unordered_map keyCodeMap = { {AKEYCODE_DPAD_RIGHT, 1001}, {AKEYCODE_DPAD_CENTER, 1005}}; -void dispatchTouchEvent(int index, AInputEvent *event, cc::TouchEvent &touchEvent) { +void dispatchTouchEvent(int index, AInputEvent *event, cc::TouchEvent *touchEvent) { int pointerID = AMotionEvent_getPointerId(event, index); - touchEvent.touches.push_back({AMotionEvent_getX(event, index), // x - AMotionEvent_getY(event, index), // y - pointerID}); + touchEvent->touches.emplace_back(AMotionEvent_getX(event, index), // x + AMotionEvent_getY(event, index), // y + pointerID); - cc::EventDispatcher::dispatchTouchEvent(touchEvent); - touchEvent.touches.clear(); + cc::EventDispatcher::dispatchTouchEvent(*touchEvent); + touchEvent->touches.clear(); } -void dispatchTouchEvents(AInputEvent *event, cc::TouchEvent &touchEvent) { +void dispatchTouchEvents(AInputEvent *event, cc::TouchEvent *touchEvent) { size_t pointerCount = AMotionEvent_getPointerCount(event); for (size_t i = 0; i < pointerCount; ++i) { - touchEvent.touches.push_back({AMotionEvent_getX(event, i), - AMotionEvent_getY(event, i), - AMotionEvent_getPointerId(event, i)}); + touchEvent->touches.emplace_back(AMotionEvent_getX(event, i), + AMotionEvent_getY(event, i), + AMotionEvent_getPointerId(event, i)); } - cc::EventDispatcher::dispatchTouchEvent(touchEvent); - touchEvent.touches.clear(); + cc::EventDispatcher::dispatchTouchEvent(*touchEvent); + touchEvent->touches.clear(); } } // namespace @@ -88,15 +90,18 @@ void View::engineHandleCmd(int cmd) { case APP_CMD_TERM_WINDOW: { cc::CustomEvent event; event.name = EVENT_DESTROY_WINDOW; + event.args->ptrVal = cocosApp.window; cc::EventDispatcher::dispatchCustomEvent(event); } break; case APP_CMD_RESUME: - if (Application::getInstance()) + if (Application::getInstance()) { Application::getInstance()->onResume(); + } break; case APP_CMD_PAUSE: - if (Application::getInstance()) + if (Application::getInstance()) { Application::getInstance()->onPause(); + } break; case APP_CMD_LOW_MEMORY: cc::EventDispatcher::dispatchMemoryWarningEvent(); @@ -109,19 +114,21 @@ void View::engineHandleCmd(int cmd) { /** * Process the next input event. */ -int32_t View::engineHandleInput(struct android_app *app, AInputEvent *event) { +int32_t View::engineHandleInput(struct android_app * /*app*/, AInputEvent *event) { int type = AInputEvent_getType(event); if (type == AINPUT_EVENT_TYPE_KEY) { int action = AKeyEvent_getAction(event); - if (action == AKEY_EVENT_ACTION_MULTIPLE) + if (action == AKEY_EVENT_ACTION_MULTIPLE) { return 0; + } int keyCode = AKeyEvent_getKeyCode(event); - if (keyCodeMap.count(keyCode) > 0) + if (keyCodeMap.count(keyCode) > 0) { keyCode = keyCodeMap[keyCode]; - else + } else { keyCode = 0; + } keyboardEvent.key = keyCode; keyboardEvent.action = action == AKEY_EVENT_ACTION_DOWN @@ -130,37 +137,38 @@ int32_t View::engineHandleInput(struct android_app *app, AInputEvent *event) { cc::EventDispatcher::dispatchKeyboardEvent(keyboardEvent); return 1; - } else if (type == AINPUT_EVENT_TYPE_MOTION) { + } + if (type == AINPUT_EVENT_TYPE_MOTION) { int action = AMotionEvent_getAction(event); switch (action & AMOTION_EVENT_ACTION_MASK) { case AMOTION_EVENT_ACTION_DOWN: touchEvent.type = cc::TouchEvent::Type::BEGAN; - dispatchTouchEvent(0, event, touchEvent); + dispatchTouchEvent(0, event, &touchEvent); break; case AMOTION_EVENT_ACTION_POINTER_DOWN: touchEvent.type = cc::TouchEvent::Type::BEGAN; dispatchTouchEvent((action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT, event, - touchEvent); + &touchEvent); break; case AMOTION_EVENT_ACTION_UP: touchEvent.type = cc::TouchEvent::Type::ENDED; - dispatchTouchEvent(0, event, touchEvent); + dispatchTouchEvent(0, event, &touchEvent); break; case AMOTION_EVENT_ACTION_POINTER_UP: touchEvent.type = cc::TouchEvent::Type::ENDED; dispatchTouchEvent((action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT, event, - touchEvent); + &touchEvent); break; case AMOTION_EVENT_ACTION_MOVE: touchEvent.type = cc::TouchEvent::Type::MOVED; - dispatchTouchEvents(event, touchEvent); + dispatchTouchEvents(event, &touchEvent); break; case AMOTION_EVENT_ACTION_CANCEL: touchEvent.type = cc::TouchEvent::Type::CANCELLED; - dispatchTouchEvents(event, touchEvent); + dispatchTouchEvents(event, &touchEvent); break; default: return 0; diff --git a/native/cocos/platform/android/View.h b/native/cocos/platform/android/View.h index c0bae92c85..8952804b18 100644 --- a/native/cocos/platform/android/View.h +++ b/native/cocos/platform/android/View.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "base/Macros.h" diff --git a/native/cocos/platform/android/java/src/com/cocos/lib/CocosVideoView.java b/native/cocos/platform/android/java/src/com/cocos/lib/CocosVideoView.java index 6b5a09ffd1..a5fad59bf5 100644 --- a/native/cocos/platform/android/java/src/com/cocos/lib/CocosVideoView.java +++ b/native/cocos/platform/android/java/src/com/cocos/lib/CocosVideoView.java @@ -18,6 +18,7 @@ package com.cocos.lib; +import android.annotation.TargetApi; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; @@ -26,6 +27,7 @@ import android.content.res.Resources; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; +import android.os.Build; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceHolder; @@ -35,6 +37,7 @@ import android.app.Activity; import android.graphics.Point; import java.io.IOException; +import java.lang.reflect.Method; import java.util.Map; public class CocosVideoView extends SurfaceView { @@ -286,8 +289,19 @@ public class CocosVideoView extends SurfaceView { mMediaPlayer == null) { return; } - - mMediaPlayer.seekTo(ms); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + try { + Method seekTo = mMediaPlayer.getClass().getMethod("seekTo", long.class, int.class); + // The mode argument added in API level 26, 3 = MediaPlayer.SEEK_CLOSEST + // https://developer.android.com/reference/android/media/MediaPlayer#seekTo(int) + seekTo.invoke(mMediaPlayer, ms, 3); + } catch (Exception e) { + mMediaPlayer.seekTo(ms); + } + } + else { + mMediaPlayer.seekTo(ms); + } } public void fixSize() { diff --git a/native/cocos/platform/android/jni/JniCocosActivity.cpp b/native/cocos/platform/android/jni/JniCocosActivity.cpp index efcf8ff85f..e5e914863e 100644 --- a/native/cocos/platform/android/jni/JniCocosActivity.cpp +++ b/native/cocos/platform/android/jni/JniCocosActivity.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "JniCocosActivity.h" #include "platform/android/jni/JniHelper.h" #include "platform/android/FileUtils-android.h" diff --git a/native/cocos/platform/android/jni/JniCocosActivity.h b/native/cocos/platform/android/jni/JniCocosActivity.h index 40b54b0b0b..2919ea39c4 100644 --- a/native/cocos/platform/android/jni/JniCocosActivity.h +++ b/native/cocos/platform/android/jni/JniCocosActivity.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include diff --git a/native/cocos/platform/android/jni/JniCocosKeyCodeHandler.cpp b/native/cocos/platform/android/jni/JniCocosKeyCodeHandler.cpp index 6bf8dc6e34..301a788720 100644 --- a/native/cocos/platform/android/jni/JniCocosKeyCodeHandler.cpp +++ b/native/cocos/platform/android/jni/JniCocosKeyCodeHandler.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/android/jni/JniHelper.h" #include "platform/Application.h" #include diff --git a/native/cocos/platform/android/jni/JniCocosOrientationHelper.cpp b/native/cocos/platform/android/jni/JniCocosOrientationHelper.cpp index 5da1ce3701..72bbdfc6c8 100644 --- a/native/cocos/platform/android/jni/JniCocosOrientationHelper.cpp +++ b/native/cocos/platform/android/jni/JniCocosOrientationHelper.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/android/jni/JniHelper.h" #include "platform/Application.h" #include diff --git a/native/cocos/platform/android/jni/JniCocosSurfaceView.cpp b/native/cocos/platform/android/jni/JniCocosSurfaceView.cpp index 685b2633da..7854c37364 100644 --- a/native/cocos/platform/android/jni/JniCocosSurfaceView.cpp +++ b/native/cocos/platform/android/jni/JniCocosSurfaceView.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/android/jni/JniHelper.h" #include "platform/Application.h" #include diff --git a/native/cocos/platform/android/jni/JniCocosTouchHandler.cpp b/native/cocos/platform/android/jni/JniCocosTouchHandler.cpp index c9a1bba9e1..0cc5be1675 100644 --- a/native/cocos/platform/android/jni/JniCocosTouchHandler.cpp +++ b/native/cocos/platform/android/jni/JniCocosTouchHandler.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/android/jni/JniHelper.h" #include "platform/Application.h" #include diff --git a/native/cocos/platform/android/jni/JniHelper.cpp b/native/cocos/platform/android/jni/JniHelper.cpp index 94881d3a73..95b9baa7d9 100644 --- a/native/cocos/platform/android/jni/JniHelper.cpp +++ b/native/cocos/platform/android/jni/JniHelper.cpp @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/android/jni/JniHelper.h" #include "platform/android/FileUtils-android.h" #include diff --git a/native/cocos/platform/android/jni/JniHelper.h b/native/cocos/platform/android/jni/JniHelper.h index e0e9877843..0065ae5c1c 100644 --- a/native/cocos/platform/android/jni/JniHelper.h +++ b/native/cocos/platform/android/jni/JniHelper.h @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cc-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cc-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __ANDROID_JNI_HELPER_H__ #define __ANDROID_JNI_HELPER_H__ diff --git a/native/cocos/platform/android/jni/JniImp.cpp b/native/cocos/platform/android/jni/JniImp.cpp index 6efb9f58e0..fea99d8315 100644 --- a/native/cocos/platform/android/jni/JniImp.cpp +++ b/native/cocos/platform/android/jni/JniImp.cpp @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2018-2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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 "JniImp.h" #include #include diff --git a/native/cocos/platform/android/jni/JniImp.h b/native/cocos/platform/android/jni/JniImp.h index f43baafb57..75a973762b 100644 --- a/native/cocos/platform/android/jni/JniImp.h +++ b/native/cocos/platform/android/jni/JniImp.h @@ -1,5 +1,5 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -21,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include diff --git a/native/cocos/platform/apple/CanvasRenderingContext2D-apple.mm b/native/cocos/platform/apple/CanvasRenderingContext2D-apple.mm index 08824eecc9..9739631cdb 100644 --- a/native/cocos/platform/apple/CanvasRenderingContext2D-apple.mm +++ b/native/cocos/platform/apple/CanvasRenderingContext2D-apple.mm @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "platform/CanvasRenderingContext2D.h" #include "base/csscolorparser.h" #include "base/UTF8.h" diff --git a/native/cocos/platform/apple/Device-apple.h b/native/cocos/platform/apple/Device-apple.h index 1f45e5a835..adfe053f1e 100644 --- a/native/cocos/platform/apple/Device-apple.h +++ b/native/cocos/platform/apple/Device-apple.h @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -22,7 +23,7 @@ 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 CCDevice_apple_hpp #define CCDevice_apple_hpp diff --git a/native/cocos/platform/apple/Device-apple.mm b/native/cocos/platform/apple/Device-apple.mm index 2829cabb10..8ad0a32d59 100644 --- a/native/cocos/platform/apple/Device-apple.mm +++ b/native/cocos/platform/apple/Device-apple.mm @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -22,7 +23,7 @@ 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 "platform/apple/Device-apple.h" #include "platform/Application.h" diff --git a/native/cocos/platform/apple/FileUtils-apple.h b/native/cocos/platform/apple/FileUtils-apple.h index 3eec542935..ac736fd1d5 100644 --- a/native/cocos/platform/apple/FileUtils-apple.h +++ b/native/cocos/platform/apple/FileUtils-apple.h @@ -1,20 +1,21 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org - Copyright (c) 2011 Zynga Inc. + Copyright (c) 2011 Zynga Inc. Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -23,7 +24,8 @@ 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 __CC_FILEUTILS_APPLE_H__ #define __CC_FILEUTILS_APPLE_H__ diff --git a/native/cocos/platform/apple/FileUtils-apple.mm b/native/cocos/platform/apple/FileUtils-apple.mm index 7969d0fa24..2d4e92357e 100644 --- a/native/cocos/platform/apple/FileUtils-apple.mm +++ b/native/cocos/platform/apple/FileUtils-apple.mm @@ -1,29 +1,31 @@ /**************************************************************************** -Copyright (c) 2010-2012 cc-x.org -Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cc-x.org + Copyright (c) 2011 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #import #include "platform/apple/FileUtils-apple.h" @@ -154,7 +156,7 @@ static cc::Value convertNSObjectToCCValue(id item) { return Value(subArray); } - return Value::Null; + return Value::VALUE_NULL; } static void addNSObjectToCCVector(id item, ValueVector &array) { diff --git a/native/cocos/platform/ios/Application-ios.mm b/native/cocos/platform/ios/Application-ios.mm index e13a61430e..312780a014 100644 --- a/native/cocos/platform/ios/Application-ios.mm +++ b/native/cocos/platform/ios/Application-ios.mm @@ -1,18 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2017 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,9 +23,13 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #import "Application.h" + #import +#include + #include "base/Scheduler.h" #include "base/AutoreleasePool.h" #include "bindings/event/EventDispatcher.h" @@ -31,7 +37,10 @@ #include "audio/include/AudioEngine.h" #include "platform/Device.h" -#ifndef CC_USE_METAL +#include "pipeline/Define.h" +#include "pipeline/RenderPipeline.h" +#include "renderer/GFXDeviceManager.h" + @interface MyTimer : NSObject { cc::Application *_app; CADisplayLink *_displayLink; @@ -77,42 +86,49 @@ } @end -#endif namespace cc { namespace { -bool setCanvasCallback(se::Object *global) { - auto viewLogicalSize = cc::Application::getInstance()->getViewLogicalSize(); + bool setCanvasCallback(se::Object* global) { + auto viewLogicalSize = cc::Application::getInstance()->getViewLogicalSize(); - CGRect nativeBounds = [[UIScreen mainScreen] nativeBounds]; - int nativeWidth = static_cast(nativeBounds.size.width); - int nativeHeight = static_cast(nativeBounds.size.height); - auto orientation = cc::Device::getDeviceOrientation(); - bool isLandscape = (orientation == cc::Device::Orientation::LANDSCAPE_RIGHT || orientation == cc::Device::Orientation::LANDSCAPE_LEFT); - if (isLandscape) std::swap(nativeWidth, nativeHeight); + int nativeWidth = static_cast(viewLogicalSize.y * Device::getDevicePixelRatio()); + int nativeHeight = static_cast(viewLogicalSize.x * Device::getDevicePixelRatio()); + auto orientation = cc::Device::getDeviceOrientation(); + bool isLandscape = (orientation == cc::Device::Orientation::LANDSCAPE_RIGHT || orientation == cc::Device::Orientation::LANDSCAPE_LEFT); + if (isLandscape) std::swap(nativeWidth, nativeHeight); - char commandBuf[200] = {0}; - // https://stackoverflow.com/questions/5795978/string-format-for-intptr-t-and-uintptr-t/41897226#41897226 - // format intptr_t - //set window.innerWidth/innerHeight in css pixel units - sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d; window.nativeWidth = %d; window.nativeHeight = %d; window.windowHandler = 0x%" PRIxPTR ";", - static_cast(viewLogicalSize.x), - static_cast(viewLogicalSize.y), - nativeWidth, - nativeHeight, - reinterpret_cast(UIApplication.sharedApplication.delegate.window.rootViewController.view)); + // https://stackoverflow.com/questions/5795978/string-format-for-intptr-t-and-uintptr-t/41897226#41897226 + // format intptr_t + //set window.innerWidth/innerHeight in css pixel units + uintptr_t windowHandle = reinterpret_cast(UIApplication.sharedApplication.delegate.window.rootViewController.view); + std::stringstream commandBuf; + commandBuf << "window.innerWidth = " << viewLogicalSize.x + << "; window.innerHeight = " << viewLogicalSize.y + << "; window.nativeWidth= " << nativeWidth + << "; window.nativeHeight = " << nativeHeight + << "; window.windowHandler = " << windowHandle << ";"; - se::ScriptEngine *se = se::ScriptEngine::getInstance(); - se->evalString(commandBuf); - return true; + se::ScriptEngine* se = se::ScriptEngine::getInstance(); + se->evalString(commandBuf.str().c_str()); + + gfx::DeviceInfo deviceInfo; + deviceInfo.windowHandle = windowHandle; + deviceInfo.width = viewLogicalSize.x; + deviceInfo.height = viewLogicalSize.y; + deviceInfo.nativeWidth = nativeWidth; + deviceInfo.nativeHeight = nativeHeight; + deviceInfo.bindingMappingInfo = pipeline::bindingMappingInfo; + + gfx::DeviceManager::create(deviceInfo); + + return true; + } + + MyTimer* _timer; } -#ifndef CC_USE_METAL -MyTimer *_timer; -#endif -} // namespace - Application *Application::_instance = nullptr; std::shared_ptr Application::_scheduler = nullptr; @@ -123,9 +139,7 @@ Application::Application(int width, int height) { _viewLogicalSize.x = width; _viewLogicalSize.y = height; -#ifndef CC_USE_METAL _timer = [[MyTimer alloc] initWithApp:this fps:_fps]; -#endif } Application::~Application() { @@ -133,14 +147,16 @@ Application::~Application() { AudioEngine::end(); #endif + pipeline::RenderPipeline::getInstance()->destroy(); + EventDispatcher::destroy(); se::ScriptEngine::destroyInstance(); + gfx::DeviceManager::destroy(); + Application::_instance = nullptr; -#ifndef CC_USE_METAL [_timer release]; -#endif } std::string Application::getCurrentLanguageCode() const { @@ -210,7 +226,11 @@ Application::Platform Application::getPlatform() const { bool Application::openURL(const std::string &url) { NSString *msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding]; NSURL *nsUrl = [NSURL URLWithString:msg]; - return [[UIApplication sharedApplication] openURL:nsUrl]; + __block BOOL flag = false; + [[UIApplication sharedApplication] openURL:nsUrl options:@{} completionHandler:^(BOOL success) { + flag = success; + }]; + return flag; } void Application::copyTextToClipboard(const std::string &text) { @@ -222,23 +242,16 @@ bool Application::init() { se::ScriptEngine *se = se::ScriptEngine::getInstance(); se->addRegisterCallback(setCanvasCallback); -#ifndef CC_USE_METAL [_timer start]; -#endif - return true; } void Application::onPause() { -#ifndef CC_USE_METAL [_timer pause]; -#endif } void Application::onResume() { -#ifndef CC_USE_METAL [_timer resume]; -#endif } std::string Application::getSystemVersion() { @@ -248,9 +261,7 @@ std::string Application::getSystemVersion() { void Application::setPreferredFramesPerSecond(int fps) { _fps = fps; -#ifndef CC_USE_METAL [_timer changeFPS:_fps]; -#endif } } // namespace cc diff --git a/native/cocos/platform/ios/Device-ios.mm b/native/cocos/platform/ios/Device-ios.mm index b0af4208b9..1ea056b5df 100644 --- a/native/cocos/platform/ios/Device-ios.mm +++ b/native/cocos/platform/ios/Device-ios.mm @@ -1,19 +1,20 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +23,8 @@ 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 "Application.h" #include "platform/Device.h" diff --git a/native/cocos/platform/ios/Reachability.cpp b/native/cocos/platform/ios/Reachability.cpp index a6fd90e2ca..5d4c1fa519 100644 --- a/native/cocos/platform/ios/Reachability.cpp +++ b/native/cocos/platform/ios/Reachability.cpp @@ -1,17 +1,18 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, diff --git a/native/cocos/platform/ios/Reachability.h b/native/cocos/platform/ios/Reachability.h index b274c316c7..03ed06fb71 100644 --- a/native/cocos/platform/ios/Reachability.h +++ b/native/cocos/platform/ios/Reachability.h @@ -1,17 +1,18 @@ /**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include "base/Ref.h" diff --git a/native/cocos/platform/ios/View.h b/native/cocos/platform/ios/View.h index 8ab6021ee2..8078e516dc 100644 --- a/native/cocos/platform/ios/View.h +++ b/native/cocos/platform/ios/View.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #import @@ -29,13 +31,12 @@ #import #endif -#ifdef CC_USE_METAL -@interface View : MTKView -#else @interface View : UIView -#endif -@property (nonatomic, assign) BOOL preventTouch; +@property(nonatomic, assign)BOOL preventTouch; +#ifdef CC_USE_METAL +@property(nonatomic, assign) id device; +#endif - (void)setPreventTouchEvent:(BOOL)flag; diff --git a/native/cocos/platform/ios/View.mm b/native/cocos/platform/ios/View.mm index ff8beb2b2f..ac84f04cb8 100644 --- a/native/cocos/platform/ios/View.mm +++ b/native/cocos/platform/ios/View.mm @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,10 +21,12 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #import "View.h" #include "bindings/event/EventDispatcher.h" #include "platform/Application.h" +#include namespace { void dispatchEvents(cc::TouchEvent &touchEvent, NSSet *touches) { @@ -43,7 +46,11 @@ void dispatchEvents(cc::TouchEvent &touchEvent, NSSet *touches) { @synthesize preventTouch; -#ifndef CC_USE_METAL +#ifdef CC_USE_METAL ++ (Class)layerClass { + return [CAMetalLayer class]; +} +#else + (Class)layerClass { return [CAEAGLLayer class]; } @@ -51,10 +58,17 @@ void dispatchEvents(cc::TouchEvent &touchEvent, NSSet *touches) { - (id)initWithFrame:(CGRect)frame { #ifdef CC_USE_METAL - if (self = [super initWithFrame:frame device:MTLCreateSystemDefaultDevice()]) { - self.framebufferOnly = YES; - self.delegate = self; + if (self = [super initWithFrame:frame]) { self.preventTouch = FALSE; + + int pixelRatio = [[UIScreen mainScreen] scale]; + CGSize size = CGSizeMake(frame.size.width * pixelRatio, frame.size.height * pixelRatio); + self.contentScaleFactor = pixelRatio; + // Config metal layer + CAMetalLayer *layer = (CAMetalLayer*)self.layer; + layer.pixelFormat = MTLPixelFormatBGRA8Unorm; + layer.device = self.device = MTLCreateSystemDefaultDevice(); + layer.drawableSize = size; } #else if (self = [super initWithFrame:frame]) { @@ -101,14 +115,4 @@ void dispatchEvents(cc::TouchEvent &touchEvent, NSSet *touches) { self.preventTouch = flag; } -#ifdef CC_USE_METAL -- (void)drawInMTKView:(nonnull MTKView *)view { - cc::Application::getInstance()->tick(); -} - -- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size { - //TODO -} -#endif - @end diff --git a/native/cocos/platform/mac/Application-mac.mm b/native/cocos/platform/mac/Application-mac.mm index 0bbbde2d18..63ba3a96cf 100644 --- a/native/cocos/platform/mac/Application-mac.mm +++ b/native/cocos/platform/mac/Application-mac.mm @@ -1,41 +1,50 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "audio/include/AudioEngine.h" + +#import +#include +#include +#include + #include "base/Scheduler.h" #include "cocos/bindings/jswrapper/SeApi.h" #include "platform/Application.h" -#include -#include +#include "platform/Device.h" -#import +#include "pipeline/Define.h" +#include "pipeline/RenderPipeline.h" +#include "renderer/GFXDeviceManager.h" @interface MyTimer : NSObject { cc::Application *_app; - NSTimer *_timer; - int _fps; + NSTimer * _timer; + int _fps; } - (instancetype)initWithApp:(cc::Application *)app fps:(int)fps; - (void)start; @@ -88,24 +97,33 @@ namespace cc { namespace { bool setCanvasCallback(se::Object *global) { - auto viewLogicalSize = Application::getInstance()->getViewLogicalSize(); - se::ScriptEngine *se = se::ScriptEngine::getInstance(); - char commandBuf[200] = {0}; - NSView *view = [[[[NSApplication sharedApplication] delegate] getWindow] contentView]; - sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d; window.windowHandler = 0x%" PRIxPTR ";", - (int)(viewLogicalSize.x), - (int)(viewLogicalSize.y), - (uintptr_t)view); - se->evalString(commandBuf); + auto viewLogicalSize = Application::getInstance()->getViewLogicalSize(); + se::ScriptEngine *se = se::ScriptEngine::getInstance(); + NSView * view = [[[[NSApplication sharedApplication] delegate] getWindow] contentView]; + + std::stringstream commandBuf; + commandBuf << "window.innerWidth = " << viewLogicalSize.x + << "; window.innerHeight = " << viewLogicalSize.y + << "; window.windowHandler = " << reinterpret_cast(view) << ";"; + se->evalString(commandBuf.str().c_str()); + + gfx::DeviceInfo deviceInfo; + deviceInfo.windowHandle = (uintptr_t)view; + deviceInfo.width = viewLogicalSize.x; + deviceInfo.height = viewLogicalSize.y; + deviceInfo.nativeWidth = viewLogicalSize.x * Device::getDevicePixelRatio(); + deviceInfo.nativeHeight = viewLogicalSize.y * Device::getDevicePixelRatio(); + deviceInfo.bindingMappingInfo = pipeline::bindingMappingInfo; + + gfx::DeviceManager::create(deviceInfo); + return true; } -#ifndef CC_USE_METAL MyTimer *_timer; -#endif } // namespace -Application *Application::_instance = nullptr; +Application * Application::_instance = nullptr; std::shared_ptr Application::_scheduler = nullptr; Application::Application(int width, int height) { @@ -117,11 +135,7 @@ Application::Application(int width, int height) { _scheduler = std::make_shared(); EventDispatcher::init(); -#ifndef CC_USE_METAL _timer = [[MyTimer alloc] initWithApp:this fps:_fps]; -#endif - - [[[[[NSApplication sharedApplication] delegate] getWindow] contentView] start]; } Application::~Application() { @@ -130,33 +144,27 @@ Application::~Application() { AudioEngine::end(); #endif + pipeline::RenderPipeline::getInstance()->destroy(); + EventDispatcher::destroy(); se::ScriptEngine::destroyInstance(); - Application::_instance = nullptr; + gfx::DeviceManager::destroy(); -#ifndef CC_USE_METAL + Application::_instance = nullptr; [_timer release]; -#endif } bool Application::init() { se::ScriptEngine *se = se::ScriptEngine::getInstance(); se->addRegisterCallback(setCanvasCallback); - -#ifndef CC_USE_METAL [_timer start]; -#endif - return true; } void Application::setPreferredFramesPerSecond(int fps) { _fps = fps; - -#ifndef CC_USE_METAL [_timer changeFPS:_fps]; -#endif } Application::Platform Application::getPlatform() const { @@ -164,23 +172,23 @@ Application::Platform Application::getPlatform() const { } std::string Application::getCurrentLanguageCode() const { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSArray *languages = [defaults objectForKey:@"AppleLanguages"]; - NSString *currentLanguage = [languages objectAtIndex:0]; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSArray * languages = [defaults objectForKey:@"AppleLanguages"]; + NSString * currentLanguage = [languages objectAtIndex:0]; return [currentLanguage UTF8String]; } bool Application::isDisplayStats() { se::AutoHandleScope hs; - se::Value ret; - char commandBuf[100] = "cc.debug.isDisplayStats();"; + se::Value ret; + char commandBuf[100] = "cc.debug.isDisplayStats();"; se::ScriptEngine::getInstance()->evalString(commandBuf, 100, &ret); return ret.toBoolean(); } void Application::setDisplayStats(bool isShow) { se::AutoHandleScope hs; - char commandBuf[100] = {0}; + char commandBuf[100] = {0}; sprintf(commandBuf, "cc.debug.setDisplayStats(%s);", isShow ? "true" : "false"); se::ScriptEngine::getInstance()->evalString(commandBuf); } @@ -194,13 +202,13 @@ void Application::setCursorEnabled(bool value) { Application::LanguageType Application::getCurrentLanguage() const { // get the current language and country config - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSArray *languages = [defaults objectForKey:@"AppleLanguages"]; - NSString *currentLanguage = [languages objectAtIndex:0]; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSArray * languages = [defaults objectForKey:@"AppleLanguages"]; + NSString * currentLanguage = [languages objectAtIndex:0]; // get the current language code.(such as English is "en", Chinese is "zh" and so on) - NSDictionary *temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage]; - NSString *languageCode = [temp objectForKey:NSLocaleLanguageCode]; + NSDictionary *temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage]; + NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode]; if ([languageCode isEqualToString:@"zh"]) return LanguageType::CHINESE; if ([languageCode isEqualToString:@"en"]) return LanguageType::ENGLISH; @@ -225,8 +233,8 @@ Application::LanguageType Application::getCurrentLanguage() const { } bool Application::openURL(const std::string &url) { - NSString *msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding]; - NSURL *nsUrl = [NSURL URLWithString:msg]; + NSString *msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding]; + NSURL * nsUrl = [NSURL URLWithString:msg]; return [[NSWorkspace sharedWorkspace] openURL:nsUrl]; } @@ -234,24 +242,20 @@ void Application::copyTextToClipboard(const std::string &text) { NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; NSString *tmp = [NSString stringWithCString:text.c_str() encoding:NSUTF8StringEncoding]; - [pasteboard setString:tmp forType:NSStringPboardType]; + [pasteboard setString:tmp forType:NSPasteboardTypeString]; } void Application::onPause() { -#ifndef CC_USE_METAL [_timer pause]; -#endif } void Application::onResume() { -#ifndef CC_USE_METAL [_timer resume]; -#endif } std::string Application::getSystemVersion() { - NSOperatingSystemVersion v = NSProcessInfo.processInfo.operatingSystemVersion; - char version[50] = {0}; + NSOperatingSystemVersion v = NSProcessInfo.processInfo.operatingSystemVersion; + char version[50] = {0}; snprintf(version, sizeof(version), "%d.%d.%d", (int)v.majorVersion, (int)v.minorVersion, (int)v.patchVersion); return version; } diff --git a/native/cocos/platform/mac/Device-mac.mm b/native/cocos/platform/mac/Device-mac.mm index c7abf639f9..6759a7cb29 100644 --- a/native/cocos/platform/mac/Device-mac.mm +++ b/native/cocos/platform/mac/Device-mac.mm @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #if CC_PLATFORM == CC_PLATFORM_MAC_OSX diff --git a/native/cocos/platform/mac/KeyCodeHelper.cpp b/native/cocos/platform/mac/KeyCodeHelper.cpp index 84d3deef48..0a5add1c34 100644 --- a/native/cocos/platform/mac/KeyCodeHelper.cpp +++ b/native/cocos/platform/mac/KeyCodeHelper.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "KeyCodeHelper.h" #include diff --git a/native/cocos/platform/mac/KeyCodeHelper.h b/native/cocos/platform/mac/KeyCodeHelper.h index aac722c0ed..2dca010a66 100644 --- a/native/cocos/platform/mac/KeyCodeHelper.h +++ b/native/cocos/platform/mac/KeyCodeHelper.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once extern int translateKeycode(int); diff --git a/native/cocos/platform/mac/View.h b/native/cocos/platform/mac/View.h index 29ebc5c8d6..34044c7667 100644 --- a/native/cocos/platform/mac/View.h +++ b/native/cocos/platform/mac/View.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,19 +21,17 @@ 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. - ****************************************************************************/ +****************************************************************************/ + +#import #ifdef CC_USE_METAL - #import -#else - #import +#import #endif -#ifdef CC_USE_METAL -@interface View : MTKView -#else @interface View : NSView -#endif --(void)start; +#ifdef CC_USE_METAL +@property(nonatomic, assign) id device; +#endif @end diff --git a/native/cocos/platform/mac/View.mm b/native/cocos/platform/mac/View.mm index 5ef7f5dab6..0624222fc9 100644 --- a/native/cocos/platform/mac/View.mm +++ b/native/cocos/platform/mac/View.mm @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,36 +21,43 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #import "View.h" #import "KeyCodeHelper.h" #import "cocos/bindings/event/EventDispatcher.h" #include "platform/Application.h" #import #import +#import +#import @implementation View { cc::MouseEvent _mouseEvent; cc::KeyboardEvent _keyboardEvent; } +#ifdef CC_USE_METAL +- (CALayer *)makeBackingLayer +{ + return [CAMetalLayer layer]; +} +#endif + - (instancetype)initWithFrame:(NSRect)frameRect { if (self = [super initWithFrame:frameRect]) { [self.window makeFirstResponder:self]; - // Add tracking area to receive mouse move events. - CGSize viewDrawableSize = self.drawableSize; - NSRect rect = {0, 0, viewDrawableSize.width, viewDrawableSize.height}; - NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:rect - options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveInKeyWindow) - owner:self - userInfo:nil]; - [self addTrackingArea:trackingArea]; - #ifdef CC_USE_METAL - self.device = MTLCreateSystemDefaultDevice(); - self.framebufferOnly = YES; - self.delegate = self; + int pixelRatio = [[NSScreen mainScreen] backingScaleFactor]; + CGSize size = CGSizeMake(frameRect.size.width * pixelRatio, frameRect.size.height * pixelRatio); + // Create CAMetalLayer + self.wantsLayer = YES; + // Config metal layer + CAMetalLayer *layer = (CAMetalLayer*)self.layer; + layer.pixelFormat = MTLPixelFormatBGRA8Unorm; + layer.device = self.device = MTLCreateSystemDefaultDevice(); + layer.drawableSize = size; #endif } return self; @@ -65,12 +73,6 @@ } #endif -- (void)start { -#ifdef CC_USE_METAL - self.delegate = self; -#endif -} - - (void)keyDown:(NSEvent *)event { _keyboardEvent.key = translateKeycode(event.keyCode); _keyboardEvent.action = [event isARepeat] ? cc::KeyboardEvent::Action::REPEAT diff --git a/native/cocos/platform/win32/Application-win32.cpp b/native/cocos/platform/win32/Application-win32.cpp index e003d9dcd4..34458b202b 100644 --- a/native/cocos/platform/win32/Application-win32.cpp +++ b/native/cocos/platform/win32/Application-win32.cpp @@ -1,54 +1,61 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/Application.h" #include "platform/StdC.h" // need it to include Windows.h -#include -#include -#include -#include -#include -#include + +#include "audio/include/AudioEngine.h" +#include "base/AutoreleasePool.h" +#include "base/Scheduler.h" +#include "cocos/bindings/event/EventDispatcher.h" +#include "cocos/bindings/jswrapper/SeApi.h" #include "platform/FileUtils.h" #include "platform/win32/View-win32.h" -#include "cocos/bindings/jswrapper/SeApi.h" -#include "cocos/bindings/event/EventDispatcher.h" -#include "base/Scheduler.h" -#include "base/AutoreleasePool.h" -#include "audio/include/AudioEngine.h" +#include +#include +#include +#include +#include +#include + +#include "pipeline/Define.h" +#include "pipeline/RenderPipeline.h" +#include "renderer/GFXDeviceManager.h" extern std::shared_ptr cc_get_application_view(); namespace cc { -Application *Application::_instance = nullptr; +Application * Application::_instance = nullptr; std::shared_ptr Application::_scheduler = nullptr; Application::Application(int width, int height) { Application::_instance = this; - _scheduler = std::make_shared(); + _scheduler = std::make_shared(); FileUtils::getInstance()->addSearchPath("Resources", true); @@ -62,9 +69,13 @@ Application::~Application() { AudioEngine::end(); #endif + pipeline::RenderPipeline::getInstance()->destroy(); + EventDispatcher::destroy(); se::ScriptEngine::destroyInstance(); + gfx::DeviceManager::destroy(); + Application::_instance = nullptr; } @@ -75,6 +86,19 @@ bool Application::init() { se::ScriptEngine::getInstance()->cleanup(); + auto view = cc_get_application_view(); + auto viewSize = view->getViewSize(); + + gfx::DeviceInfo deviceInfo; + deviceInfo.windowHandle = (uintptr_t)view->getWindowHandler(); + deviceInfo.width = viewSize[0]; + deviceInfo.height = viewSize[1]; + deviceInfo.nativeWidth = viewSize[0]; + deviceInfo.nativeHeight = viewSize[1]; + deviceInfo.bindingMappingInfo = pipeline::bindingMappingInfo; + + gfx::DeviceManager::create(deviceInfo); + return true; } @@ -82,14 +106,14 @@ void Application::setPreferredFramesPerSecond(int fps) { if (fps == 0) return; - _fps = fps; + _fps = fps; _prefererredNanosecondsPerFrame = (long)(1.0 / _fps * NANOSECONDS_PER_SECOND); } Application::LanguageType Application::getCurrentLanguage() const { LanguageType ret = LanguageType::ENGLISH; - LCID localeID = GetUserDefaultLCID(); + LCID localeID = GetUserDefaultLCID(); unsigned short primaryLanguageID = localeID & 0xFF; switch (primaryLanguageID) { @@ -156,9 +180,9 @@ Application::LanguageType Application::getCurrentLanguage() const { } std::string Application::getCurrentLanguageCode() const { - LANGID lid = GetUserDefaultUILanguage(); + LANGID lid = GetUserDefaultUILanguage(); const LCID locale_id = MAKELCID(lid, SORT_DEFAULT); - int length = GetLocaleInfoA(locale_id, LOCALE_SISO639LANGNAME, nullptr, 0); + int length = GetLocaleInfoA(locale_id, LOCALE_SISO639LANGNAME, nullptr, 0); char *tempCode = new char[length]; GetLocaleInfoA(locale_id, LOCALE_SISO639LANGNAME, tempCode, length); @@ -170,15 +194,15 @@ std::string Application::getCurrentLanguageCode() const { bool Application::isDisplayStats() { se::AutoHandleScope hs; - se::Value ret; - char commandBuf[100] = "cc.profiler.isShowingStats();"; + se::Value ret; + char commandBuf[100] = "cc.profiler.isShowingStats();"; se::ScriptEngine::getInstance()->evalString(commandBuf, 100, &ret); return ret.toBoolean(); } void Application::setDisplayStats(bool isShow) { se::AutoHandleScope hs; - char commandBuf[100] = {0}; + char commandBuf[100] = {0}; sprintf(commandBuf, isShow ? "cc.profiler.showStats();" : "cc.profiler.hideStats();"); se::ScriptEngine::getInstance()->evalString(commandBuf); } @@ -192,9 +216,9 @@ Application::Platform Application::getPlatform() const { } bool Application::openURL(const std::string &url) { - WCHAR *temp = new WCHAR[url.size() + 1]; - int wchars_num = MultiByteToWideChar(CP_UTF8, 0, url.c_str(), url.size() + 1, temp, url.size() + 1); - HINSTANCE r = ShellExecuteW(NULL, L"open", temp, NULL, NULL, SW_SHOWNORMAL); + WCHAR * temp = new WCHAR[url.size() + 1]; + int wchars_num = MultiByteToWideChar(CP_UTF8, 0, url.c_str(), url.size() + 1, temp, url.size() + 1); + HINSTANCE r = ShellExecuteW(NULL, L"open", temp, NULL, NULL, SW_SHOWNORMAL); delete[] temp; return (size_t)r > 32; } diff --git a/native/cocos/platform/win32/CanvasRenderingContext2D-win32.cpp b/native/cocos/platform/win32/CanvasRenderingContext2D-win32.cpp index d46c07327c..2f3537ac66 100644 --- a/native/cocos/platform/win32/CanvasRenderingContext2D-win32.cpp +++ b/native/cocos/platform/win32/CanvasRenderingContext2D-win32.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "platform/CanvasRenderingContext2D.h" #include #include "base/csscolorparser.h" diff --git a/native/cocos/platform/win32/Device-win32.cpp b/native/cocos/platform/win32/Device-win32.cpp index 9e43a575f0..2c43e50bd7 100644 --- a/native/cocos/platform/win32/Device-win32.cpp +++ b/native/cocos/platform/win32/Device-win32.cpp @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #if CC_PLATFORM == CC_PLATFORM_WINDOWS @@ -39,7 +40,7 @@ int Device::getDPI() { int PixelsX = GetDeviceCaps(hScreenDC, HORZRES); int MMX = GetDeviceCaps(hScreenDC, HORZSIZE); ReleaseDC(nullptr, hScreenDC); - dpi = 254.0f * PixelsX / MMX / 10; + dpi = static_cast(254.0f * PixelsX / MMX / 10); } return dpi; } diff --git a/native/cocos/platform/win32/FileUtils-win32.cpp b/native/cocos/platform/win32/FileUtils-win32.cpp index 62c6d7dc79..396b8616a9 100644 --- a/native/cocos/platform/win32/FileUtils-win32.cpp +++ b/native/cocos/platform/win32/FileUtils-win32.cpp @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #if CC_PLATFORM == CC_PLATFORM_WINDOWS diff --git a/native/cocos/platform/win32/FileUtils-win32.h b/native/cocos/platform/win32/FileUtils-win32.h index 45b27b5606..dd7c25225b 100644 --- a/native/cocos/platform/win32/FileUtils-win32.h +++ b/native/cocos/platform/win32/FileUtils-win32.h @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CC_FILEUTILS_WIN32_H__ #define __CC_FILEUTILS_WIN32_H__ diff --git a/native/cocos/platform/win32/Utils-win32.cpp b/native/cocos/platform/win32/Utils-win32.cpp index 0436b17529..99a8e15407 100644 --- a/native/cocos/platform/win32/Utils-win32.cpp +++ b/native/cocos/platform/win32/Utils-win32.cpp @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "platform/win32/Utils-win32.h" #include "platform/StdC.h" #include diff --git a/native/cocos/platform/win32/Utils-win32.h b/native/cocos/platform/win32/Utils-win32.h index 12e0c60881..e594fd81a4 100644 --- a/native/cocos/platform/win32/Utils-win32.h +++ b/native/cocos/platform/win32/Utils-win32.h @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CC_UTILS_WIN32_H__ diff --git a/native/cocos/platform/win32/View-win32.cpp b/native/cocos/platform/win32/View-win32.cpp index f9f6ac4f99..c834d4fe89 100644 --- a/native/cocos/platform/win32/View-win32.cpp +++ b/native/cocos/platform/win32/View-win32.cpp @@ -1,25 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "View-win32.h" @@ -85,14 +86,15 @@ bool View::init() { CC_LOG_ERROR("Window could not be created! SDL_Error: %s\n", SDL_GetError()); return false; } + return true; } bool View::pollEvent(bool *quit, bool *resume, bool *pause) { int cnt = SDL_PollEvent(&sdlEvent); if (cnt == 0) return false; - cc::TouchEvent touch; - cc::MouseEvent mouse; + cc::TouchEvent touch; + cc::MouseEvent mouse; cc::KeyboardEvent keyboard; switch (sdlEvent.type) { case SDL_QUIT: { @@ -122,81 +124,81 @@ bool View::pollEvent(bool *quit, bool *resume, bool *pause) { } case SDL_MOUSEBUTTONDOWN: { SDL_MouseButtonEvent &event = sdlEvent.button; - mouse.type = MouseEvent::Type::DOWN; - mouse.x = static_cast(event.x); - mouse.y = static_cast(event.y); - mouse.button = event.button - 1; + mouse.type = MouseEvent::Type::DOWN; + mouse.x = static_cast(event.x); + mouse.y = static_cast(event.y); + mouse.button = event.button - 1; cc::EventDispatcher::dispatchMouseEvent(mouse); break; } case SDL_MOUSEBUTTONUP: { SDL_MouseButtonEvent &event = sdlEvent.button; - mouse.type = MouseEvent::Type::UP; - mouse.x = static_cast(event.x); - mouse.y = static_cast(event.y); - mouse.button = event.button - 1; + mouse.type = MouseEvent::Type::UP; + mouse.x = static_cast(event.x); + mouse.y = static_cast(event.y); + mouse.button = event.button - 1; cc::EventDispatcher::dispatchMouseEvent(mouse); break; } case SDL_MOUSEMOTION: { SDL_MouseMotionEvent &event = sdlEvent.motion; - mouse.type = MouseEvent::Type::MOVE; - mouse.x = static_cast(event.x); - mouse.y = static_cast(event.y); - mouse.button = 0; + mouse.type = MouseEvent::Type::MOVE; + mouse.x = static_cast(event.x); + mouse.y = static_cast(event.y); + mouse.button = 0; cc::EventDispatcher::dispatchMouseEvent(mouse); break; } case SDL_MOUSEWHEEL: { SDL_MouseWheelEvent &event = sdlEvent.wheel; - mouse.type = MouseEvent::Type::WHEEL; - mouse.x = static_cast(event.x); - mouse.y = static_cast(event.y); - mouse.button = 0; //TODO: direction + mouse.type = MouseEvent::Type::WHEEL; + mouse.x = static_cast(event.x); + mouse.y = static_cast(event.y); + mouse.button = 0; //TODO: direction cc::EventDispatcher::dispatchMouseEvent(mouse); break; } case SDL_FINGERUP: { SDL_TouchFingerEvent &event = sdlEvent.tfinger; - touch.type = TouchEvent::Type::ENDED; - touch.touches = {TouchInfo(event.x, event.y, (int)event.fingerId)}; + touch.type = TouchEvent::Type::ENDED; + touch.touches = {TouchInfo(event.x, event.y, (int)event.fingerId)}; cc::EventDispatcher::dispatchTouchEvent(touch); break; } case SDL_FINGERDOWN: { SDL_TouchFingerEvent &event = sdlEvent.tfinger; - touch.type = TouchEvent::Type::BEGAN; - touch.touches = {TouchInfo(event.x, event.y, (int)event.fingerId)}; + touch.type = TouchEvent::Type::BEGAN; + touch.touches = {TouchInfo(event.x, event.y, (int)event.fingerId)}; cc::EventDispatcher::dispatchTouchEvent(touch); break; } case SDL_FINGERMOTION: { SDL_TouchFingerEvent &event = sdlEvent.tfinger; - touch.type = TouchEvent::Type::MOVED; - touch.touches = {TouchInfo(event.x, event.y, (int)event.fingerId)}; + touch.type = TouchEvent::Type::MOVED; + touch.touches = {TouchInfo(event.x, event.y, (int)event.fingerId)}; cc::EventDispatcher::dispatchTouchEvent(touch); break; } case SDL_KEYDOWN: { SDL_KeyboardEvent &event = sdlEvent.key; - auto mode = event.keysym.mod; - keyboard.action = KeyboardEvent::Action::PRESS; - keyboard.key = sdl_keycode_to_cocos_code(event.keysym.sym, mode); - keyboard.altKeyActive = mode & KMOD_ALT; - keyboard.ctrlKeyActive = mode & KMOD_CTRL; - keyboard.shiftKeyActive = mode & KMOD_SHIFT; + auto mode = event.keysym.mod; + keyboard.action = KeyboardEvent::Action::PRESS; + keyboard.key = sdl_keycode_to_cocos_code(event.keysym.sym, mode); + keyboard.altKeyActive = mode & KMOD_ALT; + keyboard.ctrlKeyActive = mode & KMOD_CTRL; + keyboard.shiftKeyActive = mode & KMOD_SHIFT; //CC_LOG_DEBUG("==> key %d -> code %d", event.keysym.sym, keyboard.key); cc::EventDispatcher::dispatchKeyboardEvent(keyboard); break; } case SDL_KEYUP: { SDL_KeyboardEvent &event = sdlEvent.key; - auto mode = event.keysym.mod; - keyboard.action = KeyboardEvent::Action::RELEASE; - keyboard.key = sdl_keycode_to_cocos_code(event.keysym.sym, mode); - keyboard.altKeyActive = mode & KMOD_ALT; - keyboard.ctrlKeyActive = mode & KMOD_CTRL; - keyboard.shiftKeyActive = mode & KMOD_SHIFT; + auto mode = event.keysym.mod; + keyboard.action = KeyboardEvent::Action::RELEASE; + keyboard.key = sdl_keycode_to_cocos_code(event.keysym.sym, mode); + keyboard.altKeyActive = mode & KMOD_ALT; + keyboard.ctrlKeyActive = mode & KMOD_CTRL; + keyboard.shiftKeyActive = mode & KMOD_SHIFT; cc::EventDispatcher::dispatchKeyboardEvent(keyboard); break; } diff --git a/native/cocos/platform/win32/View-win32.h b/native/cocos/platform/win32/View-win32.h index 62b860a70a..72b5aae639 100644 --- a/native/cocos/platform/win32/View-win32.h +++ b/native/cocos/platform/win32/View-win32.h @@ -1,25 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos.com + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ #pragma once diff --git a/native/cocos/platform/win32/compat/stdint.h b/native/cocos/platform/win32/compat/stdint.h index 8f1c73f9e3..504c1fa853 100644 --- a/native/cocos/platform/win32/compat/stdint.h +++ b/native/cocos/platform/win32/compat/stdint.h @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + // ISO C9x compliant stdint.h for Microsoft Visual Studio // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 // diff --git a/native/cocos/renderer/CMakeLists.txt b/native/cocos/renderer/CMakeLists.txt deleted file mode 100644 index 9bbbfa1f0f..0000000000 --- a/native/cocos/renderer/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -add_subdirectory(core) - -if(COCOS_PLATFORM_WIN32) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-vulkan) -elseif(COCOS_PLATFORM_IOS) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-metal) - add_subdirectory(gfx-vulkan) -elseif(COCOS_PLATFORM_OSX) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-metal) - add_subdirectory(gfx-vulkan) -elseif(COCOS_PLATFORM_ANDROID) - add_subdirectory(gfx-gles2) - add_subdirectory(gfx-gles3) - add_subdirectory(gfx-vulkan) -endif() diff --git a/native/cocos/renderer/GFXDeviceManager.h b/native/cocos/renderer/GFXDeviceManager.h new file mode 100644 index 0000000000..af46d29b1b --- /dev/null +++ b/native/cocos/renderer/GFXDeviceManager.h @@ -0,0 +1,126 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "bindings/event/CustomEventTypes.h" +#include "bindings/event/EventDispatcher.h" +#include "gfx-agent/DeviceAgent.h" +#include "gfx-empty/EmptyDevice.h" +#include "gfx-validator/DeviceValidator.h" + +//#undef CC_USE_VULKAN +//#undef CC_USE_GLES3 +//#undef CC_USE_GLES2 + +#ifdef CC_USE_VULKAN + #include "gfx-vulkan/GFXVulkan.h" +#endif + +#ifdef CC_USE_METAL + #include "gfx-metal/GFXMTL.h" +#endif + +#ifdef CC_USE_GLES3 + #include "gfx-gles3/GFXGLES3.h" +#endif + +#ifdef CC_USE_GLES2 + #include "gfx-gles2/GFXGLES2.h" +#endif + +namespace cc { +namespace gfx { + +class CC_DLL DeviceManager final { +public: + static Device *create(const DeviceInfo &info) { + Device *device = nullptr; + +#ifdef CC_USE_VULKAN + if (tryCreate(info, &device)) return device; +#endif + +#ifdef CC_USE_METAL + if (tryCreate(info, &device)) return device; +#endif + +#ifdef CC_USE_GLES3 + if (tryCreate(info, &device)) return device; +#endif + +#ifdef CC_USE_GLES2 + if (tryCreate(info, &device)) return device; +#endif + + if (tryCreate(info, &device)) return device; + + return nullptr; + } + + static void destroy() { + CC_SAFE_DESTROY(Device::instance); + } + +private: + template ::value>> + static bool tryCreate(const DeviceInfo &info, Device **pDevice) { + Device *device = CC_NEW(DeviceCtor); + + device = CC_NEW(gfx::DeviceAgent(device)); + + if (CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION || FORCE_ENABLE_VALIDATION) { + device = CC_NEW(gfx::DeviceValidator(device)); + //((gfx::DeviceValidator *)device)->enableRecording(true); + } + + if (!device->initialize(info)) { + CC_SAFE_DELETE(device); + return false; + } + + EventDispatcher::addCustomEventListener(EVENT_DESTROY_WINDOW, [device](const CustomEvent &e) -> void { + device->releaseSurface(reinterpret_cast(e.args->ptrVal)); + }); + + EventDispatcher::addCustomEventListener(EVENT_RECREATE_WINDOW, [device](const CustomEvent &e) -> void { + device->acquireSurface(reinterpret_cast(e.args->ptrVal)); + }); + + *pDevice = device; + + return true; + } + +#ifndef CC_DEBUG + static constexpr int CC_DEBUG{0}; +#endif + + static constexpr bool FORCE_DISABLE_VALIDATION{false}; + static constexpr bool FORCE_ENABLE_VALIDATION{false}; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/core/CMakeLists.txt b/native/cocos/renderer/core/CMakeLists.txt deleted file mode 100644 index 1b814c1b3f..0000000000 --- a/native/cocos/renderer/core/CMakeLists.txt +++ /dev/null @@ -1,175 +0,0 @@ -set(TARGET_NAME Core) - -message(STATUS "Target: ${TARGET_NAME}...") - -# --------------------------------------------- -# set cocos base files - -set(CC_BASE_HEADERS - ${COCOS_SRC_PATH}/base/TypeDef.h - ${COCOS_SRC_PATH}/base/Log.h - ${COCOS_SRC_PATH}/base/Object.h - ${COCOS_SRC_PATH}/base/memory/Memory.h - ${COCOS_SRC_PATH}/math/Math.h -) - -set(CC_BASE_SOURCES - ${COCOS_SRC_PATH}/base/Log.cpp - ${COCOS_SRC_PATH}/base/memory/Memory.cpp - ${COCOS_SRC_PATH}/math/Math.cpp -) - -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/nedmalloc - ${GFX_EXTERNAL_PATH}/tommyds - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${GFX_EXTERNAL_PATH}/taskflow - ${COCOS_SRC_PATH}/base - ${COCOS_SRC_PATH}/renderer/core -) - -if(COCOS_PLATFORM_WIN32) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/jemalloc/include-win) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/jemalloc/include-win/msvc_compat) -else() - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/jemalloc/include-linux) -endif() - -include_directories( ${INCLUDE_FILES} ) - -if(COCOS_PLATFORM_WIN32) -link_libraries( - glu32.lib - opengl32.lib -) -endif() - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h *.hpp) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) -if(COCOS_PLATFORM_IOS) - file(GLOB_RECURSE SOURCE_MM_FILES *.mm) - file(GLOB_RECURSE SOURCE_M_FILES *.m) -endif() - -macro(GROUP_FILES src_files out_del_files) - set(del_files " ") - set(cur_dir ${CMAKE_CURRENT_SOURCE_DIR}) - foreach(src_file ${${src_files}}) - string(REGEX REPLACE ${cur_dir}/\(.*\) \\1 sgbd_fpath ${src_file}) - string(REGEX REPLACE "\(.*\)/.*" \\1 sgbd_group_name ${sgbd_fpath}) - string(COMPARE EQUAL ${sgbd_fpath} ${sgbd_group_name} sgbd_nogroup) - - string(REPLACE "\\" "/" sgbd_group_name ${sgbd_group_name}) - - if(sgbd_nogroup) - set(sgbd_group_name "/") - endif(sgbd_nogroup) - - set(SRC_OK TRUE) - if(src_file MATCHES ".*Win32/.*") - if(NOT COCOS_PLATFORM_WIN32) - set(SRC_OK FALSE) - endif() - elseif(src_file MATCHES ".*Android/.*") - if(NOT COCOS_PLATFORM_ANDROID) - set(SRC_OK FALSE) - endif() - elseif(src_file MATCHES ".*iOS/.*") - if(NOT COCOS_PLATFORM_IOS) - set(SRC_OK FALSE) - endif() - endif() - - if(SRC_OK) - #if(${COCOS_PLATFORM_WIN32}) - string(REPLACE "/" "\\" sgbd_group_name ${sgbd_group_name}) - #endif() - source_group(${sgbd_group_name} FILES ${src_file}) - else() - set(del_files ${del_files} ${src_file}) - endif() - - endforeach(src_file) - - set(${out_del_files} ${del_files}) -endmacro(GROUP_FILES) - -set(ALL_FILES - ${CC_BASE_HEADERS} - ${CC_BASE_SOURCES} - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} -) -if(COCOS_PLATFORM_IOS) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) - set(ALL_FILES ${ALL_FILES} ${SOURCE_M_FILES}) -endif() - -GROUP_FILES(ALL_FILES DEL_FILES) - -foreach(del_file ${DEL_FILES}) - list(REMOVE_ITEM ALL_FILES ${del_file}) - list(REMOVE_ITEM SOURCE_CPP_FILES ${del_file}) - list(REMOVE_ITEM SOURCE_C_FILES ${del_file}) - list(REMOVE_ITEM HEADER_FILES ${del_file}) -endforeach(del_file) - -# --------------------------------------------------------------------- - -add_definitions("-DCC_CORE_EXPORTS") -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${CC_BASE_HEADERS} ${CC_BASE_SOURCES} ${HEADER_FILES} ${SOURCE_CPP_FILES} ${SOURCE_C_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${CC_BASE_HEADERS} ${CC_BASE_SOURCES} ${HEADER_FILES} ${SOURCE_CPP_FILES} ${SOURCE_C_FILES}) -endif() - -if (COCOS_PLATFORM_WIN32) - target_link_libraries(${TARGET_NAME} ${COCOS_EXTERNAL_TARGETS} Winmm.lib) -else() - target_link_libraries(${TARGET_NAME} ${COCOS_EXTERNAL_TARGETS}) -endif() -target_link_libraries(${TARGET_NAME} TBBJobSystem TFJobSystem Threading) - -if(MSVC) - set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS") - target_compile_options(${TARGET_NAME} PUBLIC /MP) - target_link_directories(${TARGET_NAME} PUBLIC ${COCOS_EXTERNAL_PATH}/win32/libs) -endif() - -set(COCOS_EXTERNAL_INCLUDE_PATH) -if(COCOS_PLATFORM_WIN32) - set(COCOS_EXTERNAL_INCLUDE_PATH ${COCOS_EXTERNAL_INCLUDE_PATH} ${COCOS_EXTERNAL_PATH}/win32/include) -elseif(COCOS_PLATFORM_IOS) - # set(COCOS_EXTERNAL_INCLUDE_PATH ${COCOS_EXTERNAL_PATH}/ios/include) -endif() - - -target_include_directories(${TARGET_NAME} PUBLIC - ${COCOS_SRC_PATH}/renderer - ${COCOS_SRC_PATH} - ${COCOS_SRC_PATH}/.. - ${COCOS_SRC_PATH}/base - ${COCOS_EXTERNAL_INCLUDE_PATH} -) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCCore) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCCore_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/CoreStd.h" "${CMAKE_CURRENT_SOURCE_DIR}/CoreStd.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/core/Core.h b/native/cocos/renderer/core/Core.h deleted file mode 100644 index fc6ae5d0e6..0000000000 --- a/native/cocos/renderer/core/Core.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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. -****************************************************************************/ -#pragma once - -#include "CoreStd.h" - -#include "base/CachedArray.h" -#include "base/StringUtil.h" - -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommand.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXCommandPool.h" -#include "gfx/GFXContext.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDescriptorSetLayout.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFence.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXInputAssembler.h" -#include "gfx/GFXPipelineLayout.h" -#include "gfx/GFXPipelineState.h" -#include "gfx/GFXQueue.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXSampler.h" -#include "gfx/GFXShader.h" -#include "gfx/GFXTexture.h" diff --git a/native/cocos/renderer/core/CoreStd.cpp b/native/cocos/renderer/core/CoreStd.cpp deleted file mode 100644 index 45239144aa..0000000000 --- a/native/cocos/renderer/core/CoreStd.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "CoreStd.h" diff --git a/native/cocos/renderer/core/gfx/GFXBuffer.cpp b/native/cocos/renderer/core/gfx/GFXBuffer.cpp deleted file mode 100755 index 771258ff1e..0000000000 --- a/native/cocos/renderer/core/gfx/GFXBuffer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXBuffer.h" - -namespace cc { -namespace gfx { - -Buffer::Buffer(Device *device) -: GFXObject(ObjectType::BUFFER), _device(device) { -} - -Buffer::~Buffer() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXBuffer.h b/native/cocos/renderer/core/gfx/GFXBuffer.h deleted file mode 100755 index 8de5863c33..0000000000 --- a/native/cocos/renderer/core/gfx/GFXBuffer.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CC_CORE_GFX_BUFFER_H_ -#define CC_CORE_GFX_BUFFER_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Buffer : public GFXObject { -public: - Buffer(Device *device); - virtual ~Buffer(); - -public: - virtual bool initialize(const BufferInfo &info) = 0; - virtual bool initialize(const BufferViewInfo &info) = 0; - virtual void destroy() = 0; - virtual void resize(uint size) = 0; - virtual void update(void *buffer, uint size) = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE BufferUsage getUsage() const { return _usage; } - CC_INLINE MemoryUsage getMemUsage() const { return _memUsage; } - CC_INLINE uint getStride() const { return _stride; } - CC_INLINE uint getCount() const { return _count; } - CC_INLINE uint getSize() const { return _size; } - CC_INLINE BufferFlags getFlags() const { return _flags; } - -protected: - Device *_device = nullptr; - BufferUsage _usage = BufferUsageBit::NONE; - MemoryUsage _memUsage = MemoryUsageBit::NONE; - uint _stride = 0u; - uint _count = 0u; - uint _size = 0u; - uint _offset = 0u; - BufferFlags _flags = BufferFlagBit::NONE; - bool _isBufferView = false; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_BUFFER_H_ diff --git a/native/cocos/renderer/core/gfx/GFXCommand.h b/native/cocos/renderer/core/gfx/GFXCommand.h deleted file mode 100644 index b2fc052b99..0000000000 --- a/native/cocos/renderer/core/gfx/GFXCommand.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -namespace cc { -namespace gfx { - -enum class GFXCmdType : uint8_t { - BEGIN_RENDER_PASS, - END_RENDER_PASS, - BIND_STATES, - DRAW, - UPDATE_BUFFER, - COPY_BUFFER_TO_TEXTURE, - COUNT, -}; - -class GFXCmd : public Object { -public: - GFXCmdType type; - uint refCount = 0; - - GFXCmd(GFXCmdType _type) : type(_type) {} - virtual ~GFXCmd() {} - - virtual void clear() = 0; -}; - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXCommandBuffer.cpp b/native/cocos/renderer/core/gfx/GFXCommandBuffer.cpp deleted file mode 100755 index dc4b28e132..0000000000 --- a/native/cocos/renderer/core/gfx/GFXCommandBuffer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXCommandBuffer.h" - -namespace cc { -namespace gfx { - -CommandBuffer::CommandBuffer(Device *device) -: GFXObject(ObjectType::COMMAND_BUFFER), _device(device) { -} - -CommandBuffer::~CommandBuffer() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h b/native/cocos/renderer/core/gfx/GFXCommandBuffer.h deleted file mode 100755 index ad129b552d..0000000000 --- a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef CC_CORE_GFX_COMMAND_BUFFER_H_ -#define CC_CORE_GFX_COMMAND_BUFFER_H_ - -#include "GFXDef.h" -#include "GFXBuffer.h" - -namespace cc { -namespace gfx { - -class CC_DLL CommandBuffer : public GFXObject { -public: - CommandBuffer(Device *device); - virtual ~CommandBuffer(); - -public: - virtual bool initialize(const CommandBufferInfo &info) = 0; - virtual void destroy() = 0; - virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) = 0; - virtual void end() = 0; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) = 0; - virtual void endRenderPass() = 0; - virtual void bindPipelineState(PipelineState *pso) = 0; - virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) = 0; - virtual void bindInputAssembler(InputAssembler *ia) = 0; - virtual void setViewport(const Viewport &vp) = 0; - virtual void setScissor(const Rect &rect) = 0; - virtual void setLineWidth(float width) = 0; - virtual void setDepthBias(float constant, float clamp, float slope) = 0; - virtual void setBlendConstants(const Color &constants) = 0; - virtual void setDepthBound(float minBounds, float maxBounds) = 0; - virtual void setStencilWriteMask(StencilFace face, uint mask) = 0; - virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) = 0; - virtual void draw(InputAssembler *ia) = 0; - virtual void updateBuffer(Buffer *buff, const void *data, uint size) = 0; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) = 0; - virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) = 0; - - CC_INLINE void bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet) { - bindDescriptorSet(set, descriptorSet, 0, nullptr); - } - CC_INLINE void bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets) { - bindDescriptorSet(set, descriptorSet, static_cast(dynamicOffsets.size()), dynamicOffsets.data()); - } - - CC_INLINE void begin() { begin(nullptr, 0, nullptr, -1); } - CC_INLINE void begin(int submitIndex) { begin(nullptr, 0, nullptr, submitIndex); } - // secondary command buffer specifics - CC_INLINE void begin(RenderPass *renderPass) { begin(renderPass, 0, nullptr, -1); } - CC_INLINE void begin(RenderPass *renderPass, uint subpass) { begin(renderPass, subpass, nullptr, -1); } - CC_INLINE void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) { begin(renderPass, subpass, frameBuffer, -1); } - - CC_INLINE void updateBuffer(Buffer *buff, const void *data) { updateBuffer(buff, data, buff->getSize()); } - CC_INLINE void execute(const CommandBufferList &cmdBuffs, uint32_t count) { execute(cmdBuffs.data(), count); } - CC_INLINE void bindDescriptorSet(uint set, DescriptorSet *descriptorSet) { bindDescriptorSet(set, descriptorSet, 0, nullptr); } - CC_INLINE void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets) { - bindDescriptorSet(set, descriptorSet, static_cast(dynamicOffsets.size()), dynamicOffsets.data()); - } - CC_INLINE void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil) { - beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil); - } - CC_INLINE void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) { - beginRenderPass(renderPass, fbo, renderArea, colors, depth, stencil, false); - } - CC_INLINE void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { - copyBuffersToTexture(buffers.data(), texture, regions.data(), static_cast(regions.size())); - } - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE Queue *getQueue() const { return _queue; } - CC_INLINE CommandBufferType getType() const { return _type; } - - virtual uint getNumDrawCalls() const { return _numDrawCalls; } - virtual uint getNumInstances() const { return _numInstances; } - virtual uint getNumTris() const { return _numTriangles; } - -protected: - Device *_device = nullptr; - Queue *_queue = nullptr; - CommandBufferType _type = CommandBufferType::PRIMARY; - - uint32_t _numDrawCalls = 0; - uint32_t _numInstances = 0; - uint32_t _numTriangles = 0; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_COMMAND_ALLOCATOR_H_ diff --git a/native/cocos/renderer/core/gfx/GFXContext.cpp b/native/cocos/renderer/core/gfx/GFXContext.cpp deleted file mode 100755 index 4327212b66..0000000000 --- a/native/cocos/renderer/core/gfx/GFXContext.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXContext.h" - -namespace cc { -namespace gfx { - -Context::Context(Device *device) -: _device(device) { -} - -Context::~Context() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXContext.h b/native/cocos/renderer/core/gfx/GFXContext.h deleted file mode 100755 index a63ecc8794..0000000000 --- a/native/cocos/renderer/core/gfx/GFXContext.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef CC_CORE_GFX_CONTEXT_H_ -#define CC_CORE_GFX_CONTEXT_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Context : public Object { -public: - Context(Device *device); - virtual ~Context(); - -public: - virtual bool initialize(const ContextInfo &info) = 0; - virtual void destroy() = 0; - virtual void present() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE Context *getSharedContext() const { return _sharedContext; } - CC_INLINE VsyncMode getVsyncMode() const { return _vsyncMode; } - CC_INLINE Format getColorFormat() const { return _colorFmt; } - CC_INLINE Format getDepthStencilFormat() const { return _depthStencilFmt; } - -protected: - Device *_device = nullptr; - uintptr_t _windowHandle = 0; - Context *_sharedContext = nullptr; - VsyncMode _vsyncMode = VsyncMode::OFF; - Format _colorFmt = Format::UNKNOWN; - Format _depthStencilFmt = Format::UNKNOWN; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_CONTEXT_H_ diff --git a/native/cocos/renderer/core/gfx/GFXDef.cpp b/native/cocos/renderer/core/gfx/GFXDef.cpp deleted file mode 100644 index 5728d725d6..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDef.cpp +++ /dev/null @@ -1,293 +0,0 @@ -#include "CoreStd.h" - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -const uint DESCRIPTOR_BUFFER_TYPE = (uint)DescriptorType::STORAGE_BUFFER | (uint)DescriptorType::DYNAMIC_STORAGE_BUFFER | - (uint)DescriptorType::UNIFORM_BUFFER | (uint)DescriptorType::DYNAMIC_UNIFORM_BUFFER; -const uint DESCRIPTOR_SAMPLER_TYPE = (uint)DescriptorType::SAMPLER; -const uint DESCRIPTOR_DYNAMIC_TYPE = (uint)DescriptorType::DYNAMIC_STORAGE_BUFFER | (uint)DescriptorType::DYNAMIC_UNIFORM_BUFFER; - -const FormatInfo GFX_FORMAT_INFOS[] = { - {"UNKNOWN", 0, 0, FormatType::NONE, false, false, false, false}, - {"A8", 1, 1, FormatType::UNORM, true, false, false, false}, - {"L8", 1, 1, FormatType::UNORM, false, false, false, false}, - {"LA8", 1, 2, FormatType::UNORM, false, false, false, false}, - - {"R8", 1, 1, FormatType::UNORM, false, false, false, false}, - {"R8SN", 1, 1, FormatType::SNORM, false, false, false, false}, - {"R8UI", 1, 1, FormatType::UINT, false, false, false, false}, - {"R8I", 1, 1, FormatType::INT, false, false, false, false}, - {"R16F", 2, 1, FormatType::FLOAT, false, false, false, false}, - {"R16UI", 2, 1, FormatType::UINT, false, false, false, false}, - {"R16I", 2, 1, FormatType::INT, false, false, false, false}, - {"R32F", 4, 1, FormatType::FLOAT, false, false, false, false}, - {"R32UI", 4, 1, FormatType::UINT, false, false, false, false}, - {"R32I", 4, 1, FormatType::INT, false, false, false, false}, - - {"RG8", 2, 2, FormatType::UNORM, false, false, false, false}, - {"RG8SN", 2, 2, FormatType::SNORM, false, false, false, false}, - {"RG8UI", 2, 2, FormatType::UINT, false, false, false, false}, - {"RG8I", 2, 2, FormatType::INT, false, false, false, false}, - {"RG16F", 4, 2, FormatType::FLOAT, false, false, false, false}, - {"RG16UI", 4, 2, FormatType::UINT, false, false, false, false}, - {"RG16I", 4, 2, FormatType::INT, false, false, false, false}, - {"RG32F", 8, 2, FormatType::FLOAT, false, false, false, false}, - {"RG32UI", 8, 2, FormatType::UINT, false, false, false, false}, - {"RG32I", 8, 2, FormatType::INT, false, false, false, false}, - - {"RGB8", 3, 3, FormatType::UNORM, false, false, false, false}, - {"SRGB8", 3, 3, FormatType::UNORM, false, false, false, false}, - {"RGB8SN", 3, 3, FormatType::SNORM, false, false, false, false}, - {"RGB8UI", 3, 3, FormatType::UINT, false, false, false, false}, - {"RGB8I", 3, 3, FormatType::INT, false, false, false, false}, - {"RGB16F", 6, 3, FormatType::FLOAT, false, false, false, false}, - {"RGB16UI", 6, 3, FormatType::UINT, false, false, false, false}, - {"RGB16I", 6, 3, FormatType::INT, false, false, false, false}, - {"RGB32F", 12, 3, FormatType::FLOAT, false, false, false, false}, - {"RGB32UI", 12, 3, FormatType::UINT, false, false, false, false}, - {"RGB32I", 12, 3, FormatType::INT, false, false, false, false}, - - {"RGBA8", 4, 4, FormatType::UNORM, true, false, false, false}, - {"BGRA8", 4, 4, FormatType::UNORM, true, false, false, false}, - {"SRGB8_A8", 4, 4, FormatType::UNORM, true, false, false, false}, - {"RGBA8SN", 4, 4, FormatType::SNORM, true, false, false, false}, - {"RGBA8UI", 4, 4, FormatType::UINT, true, false, false, false}, - {"RGBA8I", 4, 4, FormatType::INT, true, false, false, false}, - {"RGBA16F", 8, 4, FormatType::FLOAT, true, false, false, false}, - {"RGBA16UI", 8, 4, FormatType::UINT, true, false, false, false}, - {"RGBA16I", 8, 4, FormatType::INT, true, false, false, false}, - {"RGBA32F", 16, 4, FormatType::FLOAT, true, false, false, false}, - {"RGBA32UI", 16, 4, FormatType::UINT, true, false, false, false}, - {"RGBA32I", 16, 4, FormatType::INT, true, false, false, false}, - - {"R5G6B5", 2, 3, FormatType::UNORM, false, false, false, false}, - {"R11G11B10F", 4, 3, FormatType::FLOAT, false, false, false, false}, - {"RGB5A1", 2, 4, FormatType::UNORM, true, false, false, false}, - {"RGBA4", 2, 4, FormatType::UNORM, true, false, false, false}, - {"RGB10A2", 2, 4, FormatType::UNORM, true, false, false, false}, - {"RGB10A2UI", 2, 4, FormatType::UINT, true, false, false, false}, - {"RGB9E5", 2, 4, FormatType::FLOAT, true, false, false, false}, - - {"D16", 2, 1, FormatType::UINT, false, true, false, false}, - {"D16S8", 3, 1, FormatType::UINT, false, true, true, false}, - {"D24", 3, 1, FormatType::UINT, false, true, false, false}, - {"D24S8", 2, 1, FormatType::UINT, false, true, true, false}, - {"D32F", 4, 1, FormatType::FLOAT, false, true, false, false}, - {"D32FS8", 5, 2, FormatType::FLOAT, false, true, true, false}, - - {"BC1", 1, 3, FormatType::UNORM, false, false, false, true}, - {"BC1_ALPHA", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC1_SRGB", 1, 3, FormatType::UNORM, false, false, false, true}, - {"BC1_SRGB_ALPHA", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC2", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC2_SRGB", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC3", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC3_SRGB", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC4", 1, 1, FormatType::UNORM, false, false, false, true}, - {"BC4_SNORM", 1, 1, FormatType::SNORM, false, false, false, true}, - {"BC5", 1, 2, FormatType::UNORM, false, false, false, true}, - {"BC5_SNORM", 1, 2, FormatType::SNORM, false, false, false, true}, - {"BC6H_UF16", 1, 3, FormatType::UFLOAT, false, false, false, true}, - {"BC6H_SF16", 1, 3, FormatType::FLOAT, false, false, false, true}, - {"BC7", 1, 4, FormatType::UNORM, true, false, false, true}, - {"BC7_SRGB", 1, 4, FormatType::UNORM, true, false, false, true}, - - {"ETC_RGB8", 1, 3, FormatType::UNORM, false, false, false, true}, - {"ETC2_RGB8", 1, 3, FormatType::UNORM, false, false, false, true}, - {"ETC2_SRGB8", 1, 3, FormatType::UNORM, false, false, false, true}, - {"ETC2_RGB8_A1", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ETC2_SRGB8_A1", 1, 4, FormatType::UNORM, true, false, false, true}, - {"EAC_R11", 1, 1, FormatType::UNORM, false, false, false, true}, - {"EAC_R11SN", 1, 1, FormatType::SNORM, false, false, false, true}, - {"EAC_RG11", 2, 2, FormatType::UNORM, false, false, false, true}, - {"EAC_RG11SN", 2, 2, FormatType::SNORM, false, false, false, true}, - - {"PVRTC_RGB2", 2, 3, FormatType::UNORM, false, false, false, true}, - {"PVRTC_RGBA2", 2, 4, FormatType::UNORM, true, false, false, true}, - {"PVRTC_RGB4", 2, 3, FormatType::UNORM, false, false, false, true}, - {"PVRTC_RGBA4", 2, 4, FormatType::UNORM, true, false, false, true}, - {"PVRTC2_2BPP", 2, 4, FormatType::UNORM, true, false, false, true}, - {"PVRTC2_4BPP", 2, 4, FormatType::UNORM, true, false, false, true}, - - {"ASTC_RGBA_4x4", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_5x4", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_5x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_6x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_6x6", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_8x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_8x6", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_8x8", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_10x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_10x6", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_10x8", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_10x10", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_12x10", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_RGBA_12x12", 1, 4, FormatType::UNORM, true, false, false, true}, - - {"ASTC_SRGBA_4x4", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_5x4", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_5x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_6x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_6x6", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_8x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_8x6", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_8x8", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_10x5", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_10x6", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_10x8", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_10x10", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_12x10", 1, 4, FormatType::UNORM, true, false, false, true}, - {"ASTC_SRGBA_12x12", 1, 4, FormatType::UNORM, true, false, false, true}, -}; - -uint FormatSize(Format format, uint width, uint height, uint depth) { - - if (!GFX_FORMAT_INFOS[(uint)format].isCompressed) { - return (width * height * depth * GFX_FORMAT_INFOS[(uint)format].size); - } else { - switch (format) { - case Format::BC1: - case Format::BC1_ALPHA: - case Format::BC1_SRGB: - case Format::BC1_SRGB_ALPHA: - return (uint)std::ceil(width / 4) * (uint)std::ceil(height / 4) * 8 * depth; - case Format::BC2: - case Format::BC2_SRGB: - case Format::BC3: - case Format::BC3_SRGB: - case Format::BC4: - case Format::BC4_SNORM: - case Format::BC6H_SF16: - case Format::BC6H_UF16: - case Format::BC7: - case Format::BC7_SRGB: - return (uint)std::ceil(width / 4) * (uint)std::ceil(height / 4) * 16 * depth; - case Format::BC5: - case Format::BC5_SNORM: - return (uint)std::ceil(width / 4) * (uint)std::ceil(height / 4) * 32 * depth; - - case Format::ETC_RGB8: - case Format::ETC2_RGB8: - case Format::ETC2_SRGB8: - case Format::ETC2_RGB8_A1: - case Format::EAC_R11: - case Format::EAC_R11SN: - return (uint)std::ceil((float)width / 4) * (uint)std::ceil((float)height / 4) * 8 * depth; - case Format::ETC2_RGBA8: - case Format::ETC2_SRGB8_A1: - case Format::EAC_RG11: - case Format::EAC_RG11SN: - return (uint)std::ceil((float)width / 4) * (uint)std::ceil((float)height / 4) * 16 * depth; - - case Format::PVRTC_RGB2: - case Format::PVRTC_RGBA2: - case Format::PVRTC2_2BPP: - return (uint)std::ceil(std::max(width, 16U) * std::max(height, 8U) / 4) * depth; - case Format::PVRTC_RGB4: - case Format::PVRTC_RGBA4: - case Format::PVRTC2_4BPP: - return (uint)std::ceil(std::max(width, 16U) * std::max(height, 8U) / 2) * depth; - - case Format::ASTC_RGBA_4x4: - case Format::ASTC_SRGBA_4x4: - return (uint)std::ceil((float)width / 4) * (uint)std::ceil((float)height / 4) * 16 * depth; - case Format::ASTC_RGBA_5x4: - case Format::ASTC_SRGBA_5x4: - return (uint)std::ceil((float)width / 5) * (uint)std::ceil((float)height / 4) * 16 * depth; - case Format::ASTC_RGBA_5x5: - case Format::ASTC_SRGBA_5x5: - return (uint)std::ceil((float)width / 5) * (uint)std::ceil((float)height / 5) * 16 * depth; - case Format::ASTC_RGBA_6x5: - case Format::ASTC_SRGBA_6x5: - return (uint)std::ceil((float)width / 6) * (uint)std::ceil((float)height / 5) * 16 * depth; - case Format::ASTC_RGBA_6x6: - case Format::ASTC_SRGBA_6x6: - return (uint)std::ceil((float)width / 6) * (uint)std::ceil((float)height / 6) * 16 * depth; - case Format::ASTC_RGBA_8x5: - case Format::ASTC_SRGBA_8x5: - return (uint)std::ceil((float)width / 8) * (uint)std::ceil((float)height / 5) * 16 * depth; - case Format::ASTC_RGBA_8x6: - case Format::ASTC_SRGBA_8x6: - return (uint)std::ceil((float)width / 8) * (uint)std::ceil((float)height / 6) * 16 * depth; - case Format::ASTC_RGBA_8x8: - case Format::ASTC_SRGBA_8x8: - return (uint)std::ceil((float)width / 8) * (uint)std::ceil((float)height / 8) * 16 * depth; - case Format::ASTC_RGBA_10x5: - case Format::ASTC_SRGBA_10x5: - return (uint)std::ceil((float)width / 10) * (uint)std::ceil((float)height / 5) * 16 * depth; - case Format::ASTC_RGBA_10x6: - case Format::ASTC_SRGBA_10x6: - return (uint)std::ceil((float)width / 10) * (uint)std::ceil((float)height / 6) * 16 * depth; - case Format::ASTC_RGBA_10x8: - case Format::ASTC_SRGBA_10x8: - return (uint)std::ceil((float)width / 10) * (uint)std::ceil((float)height / 8) * 16 * depth; - case Format::ASTC_RGBA_10x10: - case Format::ASTC_SRGBA_10x10: - return (uint)std::ceil((float)width / 10) * (uint)std::ceil((float)height / 10) * 16 * depth; - case Format::ASTC_RGBA_12x10: - case Format::ASTC_SRGBA_12x10: - return (uint)std::ceil((float)width / 12) * (uint)std::ceil((float)height / 10) * 16 * depth; - case Format::ASTC_RGBA_12x12: - case Format::ASTC_SRGBA_12x12: - return (uint)std::ceil((float)width / 12) * (uint)std::ceil((float)height / 12) * 16 * depth; - - default: { - return 0; - } - } - } -} - -const uint GFX_TYPE_SIZES[] = { - 0, // UNKNOWN - 4, // BOOL - 8, // BOOL2 - 12, // BOOL3 - 16, // BOOL4 - 4, // INT - 8, // INT2 - 12, // INT3 - 16, // INT4 - 4, // UINT - 8, // UINT2 - 12, // UINT3 - 16, // UINT4 - 4, // FLOAT - 8, // FLOAT2 - 12, // FLOAT3 - 16, // FLOAT4 - 16, // MAT2 - 24, // MAT2X3 - 32, // MAT2X4 - 24, // MAT3X2 - 36, // MAT3 - 48, // MAT3X4 - 32, // MAT4X2 - 48, // MAT4X3 - 64, // MAT4 - 4, // SAMPLER1D - 4, // SAMPLER1D_ARRAY - 4, // SAMPLER2D - 4, // SAMPLER2D_ARRAY - 4, // SAMPLER3D - 4, // SAMPLER_CUBE -}; - -uint FormatSurfaceSize(Format format, uint width, uint height, uint depth, uint mips) { - - uint size = 0; - - for (uint i = 0; i < mips; ++i) { - size += FormatSize(format, width, height, depth); - width = std::max(width >> 1, 1U); - height = std::max(height >> 1, 1U); - } - - return size; -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXDef.h b/native/cocos/renderer/core/gfx/GFXDef.h deleted file mode 100644 index 08d4dba9ed..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDef.h +++ /dev/null @@ -1,1079 +0,0 @@ -#ifndef CC_CORE_GFX_DEF_H_ -#define CC_CORE_GFX_DEF_H_ - -namespace cc { -namespace gfx { - -class Device; -class Buffer; -class Texture; -class Sampler; -class Shader; -class InputAssembler; -class RenderPass; -class Framebuffer; -class DescriptorSetLayout; -class PipelineLayout; -class PipelineState; -class DescriptorSet; -class CommandAllocator; -class CommandBuffer; -class Fence; -class Queue; -class Window; -class Context; - -#define GFX_MAX_ATTACHMENTS 4 -#define GFX_INVALID_BINDING ((uint8_t)-1) -#define GFX_INVALID_HANDLE ((uint)-1) - -enum class ObjectType { - UNKNOWN, - BUFFER, - TEXTURE, - RENDER_PASS, - FRAMEBUFFER, - SAMPLER, - SHADER, - DESCRIPTOR_SET_LAYOUT, - PIPELINE_LAYOUT, - PIPELINE_STATE, - DESCRIPTOR_SET, - INPUT_ASSEMBLER, - COMMAND_BUFFER, - FENCE, - QUEUE, -}; - -enum class Status { - UNREADY, - FAILED, - SUCCESS, -}; - -enum class API { - UNKNOWN, - GLES2, - GLES3, - METAL, - VULKAN, - WEBGL, - WEBGL2, - WEBGPU, -}; - -enum class SurfaceTransform { - IDENTITY, - ROTATE_90, - ROTATE_180, - ROTATE_270, -}; - -enum class Feature { - COLOR_FLOAT, - COLOR_HALF_FLOAT, - TEXTURE_FLOAT, - TEXTURE_HALF_FLOAT, - TEXTURE_FLOAT_LINEAR, - TEXTURE_HALF_FLOAT_LINEAR, - FORMAT_R11G11B10F, - FORMAT_D16, - FORMAT_D16S8, - FORMAT_D24, - FORMAT_D24S8, - FORMAT_D32F, - FORMAT_D32FS8, - FORMAT_ETC1, - FORMAT_ETC2, - FORMAT_DXT, - FORMAT_PVRTC, - FORMAT_ASTC, - FORMAT_RGB8, - MSAA, - ELEMENT_INDEX_UINT, - INSTANCED_ARRAYS, - MULTIPLE_RENDER_TARGETS, - BLEND_MINMAX, - DEPTH_BOUNDS, - LINE_WIDTH, - STENCIL_WRITE_MASK, - STENCIL_COMPARE_MASK, - MULTITHREADED_SUBMISSION, - COUNT, -}; - -enum class Format { - - UNKNOWN, - - A8, - L8, - LA8, - - R8, - R8SN, - R8UI, - R8I, - R16F, - R16UI, - R16I, - R32F, - R32UI, - R32I, - - RG8, - RG8SN, - RG8UI, - RG8I, - RG16F, - RG16UI, - RG16I, - RG32F, - RG32UI, - RG32I, - - RGB8, - SRGB8, - RGB8SN, - RGB8UI, - RGB8I, - RGB16F, - RGB16UI, - RGB16I, - RGB32F, - RGB32UI, - RGB32I, - - RGBA8, - BGRA8, - SRGB8_A8, - RGBA8SN, - RGBA8UI, - RGBA8I, - RGBA16F, - RGBA16UI, - RGBA16I, - RGBA32F, - RGBA32UI, - RGBA32I, - - // Special Format - R5G6B5, - R11G11B10F, - RGB5A1, - RGBA4, - RGB10A2, - RGB10A2UI, - RGB9E5, - - // Depth-Stencil Format - D16, - D16S8, - D24, - D24S8, - D32F, - D32F_S8, - - // Compressed Format - - // Block Compression Format, DDS (DirectDraw Surface) - // DXT1: 3 channels (5:6:5), 1/8 origianl size, with 0 or 1 bit of alpha - BC1, - BC1_ALPHA, - BC1_SRGB, - BC1_SRGB_ALPHA, - // DXT3: 4 channels (5:6:5), 1/4 origianl size, with 4 bits of alpha - BC2, - BC2_SRGB, - // DXT5: 4 channels (5:6:5), 1/4 origianl size, with 8 bits of alpha - BC3, - BC3_SRGB, - // 1 channel (8), 1/4 origianl size - BC4, - BC4_SNORM, - // 2 channels (8:8), 1/2 origianl size - BC5, - BC5_SNORM, - // 3 channels (16:16:16), half-floating point, 1/6 origianl size - // UF16: unsigned float, 5 exponent bits + 11 mantissa bits - // SF16: signed float, 1 signed bit + 5 exponent bits + 10 mantissa bits - BC6H_UF16, - BC6H_SF16, - // 4 channels (4~7 bits per channel) with 0 to 8 bits of alpha, 1/3 original size - BC7, - BC7_SRGB, - - // Ericsson Texture Compression Format - ETC_RGB8, - ETC2_RGB8, - ETC2_SRGB8, - ETC2_RGB8_A1, - ETC2_SRGB8_A1, - ETC2_RGBA8, - ETC2_SRGB8_A8, - EAC_R11, - EAC_R11SN, - EAC_RG11, - EAC_RG11SN, - - // PVRTC (PowerVR) - PVRTC_RGB2, - PVRTC_RGBA2, - PVRTC_RGB4, - PVRTC_RGBA4, - PVRTC2_2BPP, - PVRTC2_4BPP, - - // ASTC (Adaptive Scalable Texture Compression) - ASTC_RGBA_4x4, - ASTC_RGBA_5x4, - ASTC_RGBA_5x5, - ASTC_RGBA_6x5, - ASTC_RGBA_6x6, - ASTC_RGBA_8x5, - ASTC_RGBA_8x6, - ASTC_RGBA_8x8, - ASTC_RGBA_10x5, - ASTC_RGBA_10x6, - ASTC_RGBA_10x8, - ASTC_RGBA_10x10, - ASTC_RGBA_12x10, - ASTC_RGBA_12x12, - - // ASTC (Adaptive Scalable Texture Compression) SRGB - ASTC_SRGBA_4x4, - ASTC_SRGBA_5x4, - ASTC_SRGBA_5x5, - ASTC_SRGBA_6x5, - ASTC_SRGBA_6x6, - ASTC_SRGBA_8x5, - ASTC_SRGBA_8x6, - ASTC_SRGBA_8x8, - ASTC_SRGBA_10x5, - ASTC_SRGBA_10x6, - ASTC_SRGBA_10x8, - ASTC_SRGBA_10x10, - ASTC_SRGBA_12x10, - ASTC_SRGBA_12x12, - - // Total count - COUNT, -}; - -enum class FormatType { - NONE, - UNORM, - SNORM, - UINT, - INT, - UFLOAT, - FLOAT, -}; - -enum class Type { - UNKNOWN, - BOOL, - BOOL2, - BOOL3, - BOOL4, - INT, - INT2, - INT3, - INT4, - UINT, - UINT2, - UINT3, - UINT4, - FLOAT, - FLOAT2, - FLOAT3, - FLOAT4, - MAT2, - MAT2X3, - MAT2X4, - MAT3X2, - MAT3, - MAT3X4, - MAT4X2, - MAT4X3, - MAT4, - SAMPLER1D, - SAMPLER1D_ARRAY, - SAMPLER2D, - SAMPLER2D_ARRAY, - SAMPLER3D, - SAMPLER_CUBE, - COUNT, -}; - -enum class BufferUsageBit : FlagBits { - NONE = 0, - TRANSFER_SRC = 0x1, - TRANSFER_DST = 0x2, - INDEX = 0x4, - VERTEX = 0x8, - UNIFORM = 0x10, - STORAGE = 0x20, - INDIRECT = 0x40, -}; -typedef BufferUsageBit BufferUsage; -CC_ENUM_OPERATORS(BufferUsageBit); - -enum class BufferFlagBit : FlagBits { - NONE = 0, -}; -typedef BufferFlagBit BufferFlags; -CC_ENUM_OPERATORS(BufferFlagBit); - -enum class BufferAccessBit : FlagBits { - NONE = 0, - READ = 0x1, - WRITE = 0x2, -}; -typedef BufferAccessBit BufferAccess; -CC_ENUM_OPERATORS(BufferAccessBit); - -enum class MemoryUsageBit : FlagBits { - NONE = 0, - DEVICE = 0x1, - HOST = 0x2, -}; -typedef MemoryUsageBit MemoryUsage; -CC_ENUM_OPERATORS(MemoryUsageBit); - -enum class TextureType { - TEX1D, - TEX2D, - TEX3D, - CUBE, - TEX1D_ARRAY, - TEX2D_ARRAY, -}; - -enum class TextureUsageBit : FlagBits { - NONE = 0, - TRANSFER_SRC = 0x1, - TRANSFER_DST = 0x2, - SAMPLED = 0x4, - STORAGE = 0x8, - COLOR_ATTACHMENT = 0x10, - DEPTH_STENCIL_ATTACHMENT = 0x20, - TRANSIENT_ATTACHMENT = 0x40, - INPUT_ATTACHMENT = 0x80, -}; -typedef TextureUsageBit TextureUsage; -CC_ENUM_OPERATORS(TextureUsageBit); - -enum class TextureFlagBit : FlagBits { - NONE = 0, - GEN_MIPMAP = 0x1, - CUBEMAP = 0x2, - BAKUP_BUFFER = 0x4, - IMMUTABLE = 0x8, -}; -typedef TextureFlagBit TextureFlags; -CC_ENUM_OPERATORS(TextureFlagBit); - -enum class SampleCount { - X1, - X2, - X4, - X8, - X16, - X32, - X64, -}; - -enum class Filter { - NONE, - POINT, - LINEAR, - ANISOTROPIC, -}; - -enum class Address { - WRAP, - MIRROR, - CLAMP, - BORDER, -}; - -enum class ComparisonFunc { - NEVER, - LESS, - EQUAL, - LESS_EQUAL, - GREATER, - NOT_EQUAL, - GREATER_EQUAL, - ALWAYS, -}; - -enum class StencilOp { - ZERO, - KEEP, - REPLACE, - INCR, - DECR, - INVERT, - INCR_WRAP, - DECR_WRAP, -}; - -enum class BlendFactor { - ZERO, - ONE, - SRC_ALPHA, - DST_ALPHA, - ONE_MINUS_SRC_ALPHA, - ONE_MINUS_DST_ALPHA, - SRC_COLOR, - DST_COLOR, - ONE_MINUS_SRC_COLOR, - ONE_MINUS_DST_COLOR, - SRC_ALPHA_SATURATE, - CONSTANT_COLOR, - ONE_MINUS_CONSTANT_COLOR, - CONSTANT_ALPHA, - ONE_MINUS_CONSTANT_ALPHA, -}; - -enum class BlendOp { - ADD, - SUB, - REV_SUB, - MIN, - MAX, -}; - -enum class ColorMask : FlagBits { - NONE = 0x0, - R = 0x1, - G = 0x2, - B = 0x4, - A = 0x8, - ALL = R | G | B | A, -}; -CC_ENUM_OPERATORS(ColorMask); - -enum class ShaderStageFlagBit : FlagBits { - NONE = 0x0, - VERTEX = 0x1, - CONTROL = 0x2, - EVALUATION = 0x4, - GEOMETRY = 0x8, - FRAGMENT = 0x10, - COMPUTE = 0x20, - ALL = 0x3f, -}; -typedef ShaderStageFlagBit ShaderStageFlags; -CC_ENUM_OPERATORS(ShaderStageFlagBit); - -enum class LoadOp { - LOAD, // Load the contents from the fbo from previous - CLEAR, // Clear the fbo - DISCARD, // Ignore writing to the fbo and keep old data -}; - -enum class StoreOp { - STORE, // Write the source to the destination - DISCARD, // Don't write the source to the destination -}; - -enum class TextureLayout { - UNDEFINED, - GENERAL, - COLOR_ATTACHMENT_OPTIMAL, - DEPTH_STENCIL_ATTACHMENT_OPTIMAL, - DEPTH_STENCIL_READONLY_OPTIMAL, - SHADER_READONLY_OPTIMAL, - TRANSFER_SRC_OPTIMAL, - TRANSFER_DST_OPTIMAL, - PREINITIALIZED, - PRESENT_SRC, -}; - -enum class PipelineBindPoint { - GRAPHICS, - COMPUTE, - RAY_TRACING, -}; - -enum class PrimitiveMode { - POINT_LIST, - LINE_LIST, - LINE_STRIP, - LINE_LOOP, - LINE_LIST_ADJACENCY, - LINE_STRIP_ADJACENCY, - ISO_LINE_LIST, - // raycast detectable: - TRIANGLE_LIST, - TRIANGLE_STRIP, - TRIANGLE_FAN, - TRIANGLE_LIST_ADJACENCY, - TRIANGLE_STRIP_ADJACENCY, - TRIANGLE_PATCH_ADJACENCY, - QUAD_PATCH_LIST, -}; - -enum class PolygonMode { - FILL, - POINT, - LINE, -}; - -enum class ShadeModel { - GOURAND, - FLAT, -}; - -enum class CullMode { - NONE, - FRONT, - BACK, -}; - -enum class DynamicStateFlagBit : FlagBits { - NONE = 0x0, - VIEWPORT = 0x1, - SCISSOR = 0x2, - LINE_WIDTH = 0x4, - DEPTH_BIAS = 0x8, - BLEND_CONSTANTS = 0x10, - DEPTH_BOUNDS = 0x20, - STENCIL_WRITE_MASK = 0x40, - STENCIL_COMPARE_MASK = 0x80, -}; -typedef DynamicStateFlagBit DynamicStateFlags; - -typedef cc::vector DynamicStateList; - -enum class StencilFace { - FRONT, - BACK, - ALL, -}; - -enum class DescriptorType : FlagBits { - UNKNOWN = 0, - UNIFORM_BUFFER = 0x1, - DYNAMIC_UNIFORM_BUFFER = 0x2, - STORAGE_BUFFER = 0x4, - DYNAMIC_STORAGE_BUFFER = 0x8, - SAMPLER = 0x10, -}; - -enum class QueueType { - GRAPHICS, - COMPUTE, - TRANSFER, -}; - -enum class CommandBufferType { - PRIMARY, - SECONDARY, -}; - -enum class ClearFlagBit : FlagBits { - NONE = 0, - COLOR = 0x1, - DEPTH = 0x2, - STENCIL = 0x4, - DEPTH_STENCIL = DEPTH | STENCIL, - ALL = COLOR | DEPTH | STENCIL, -}; -typedef ClearFlagBit ClearFlags; -CC_ENUM_OPERATORS(ClearFlags); - -enum class VsyncMode { - // The application does not synchronizes with the vertical sync. If application renders faster than the display refreshes, frames are wasted and tearing may be observed. FPS is uncapped. Maximum power consumption. If unsupported, "ON" value will be used instead. Minimum latency. - OFF, - // The application is always synchronized with the vertical sync. Tearing does not happen. FPS is capped to the display's refresh rate. For fast applications, battery life is improved. Always supported. - ON, - // The application synchronizes with the vertical sync, but only if the application rendering speed is greater than refresh rate. Compared to OFF, there is no tearing. Compared to ON, the FPS will be improved for "slower" applications. If unsupported, "ON" value will be used instead. Recommended for most applications. Default if supported. - RELAXED, - // The presentation engine will always use the latest fully rendered image. Compared to OFF, no tearing will be observed. Compared to ON, battery power will be worse, especially for faster applications. If unsupported, "OFF" will be attempted next. - MAILBOX, - // The application is capped to using half the vertical sync time. FPS artificially capped to Half the display speed (usually 30fps) to maintain battery. Best possible battery savings. Worst possible performance. Recommended for specific applications where battery saving is critical. - HALF, -}; - -struct Offset { - int x = 0; - int y = 0; - int z = 0; -}; - -struct Rect { - int x = 0; - int y = 0; - uint width = 1u; - uint height = 1u; - - bool operator==(const Rect &rs) { - if (x == rs.x && - y == rs.y && - width == rs.width && - height == rs.height) { - return true; - } else - return false; - } - - bool operator!=(const Rect &rs) { - return !(*this == rs); - } -}; - -struct Extent { - uint width = 0; - uint height = 0; - uint depth = 1; -}; - -struct TextureSubres { - uint mipLevel = 0u; - uint baseArrayLayer = 0u; - uint layerCount = 1u; -}; - -struct TextureCopy { - TextureSubres srcSubres; - Offset srcOffset; - TextureSubres dstSubres; - Offset dstOffset; - Extent extent; -}; - -struct BufferTextureCopy { - uint buffStride = 0; - uint buffTexHeight = 0; - Offset texOffset; - Extent texExtent; - TextureSubres texSubres; -}; -typedef cc::vector BufferTextureCopyList; -typedef cc::vector BufferDataList; - -struct Viewport { - int left = 0; - int top = 0; - uint width = 0; - uint height = 0; - float minDepth = 0.0f; - float maxDepth = 1.0f; - - bool operator==(const Viewport &rs) { - return (left == rs.left && - top == rs.top && - width == rs.width && - height == rs.height && - math::IsEqualF(minDepth, rs.minDepth) && - math::IsEqualF(maxDepth, maxDepth)); - } - - bool operator!=(const Viewport &rs) { - return !(*this == rs); - } -}; - -#pragma pack(push, 1) -struct Color { - float x = 0.0f; - float y = 0.0f; - float z = 0.0f; - float w = 0.0f; - - bool operator==(const Color &rhs) { - return (math::IsEqualF(x, rhs.x) && - math::IsEqualF(y, rhs.y) && - math::IsEqualF(z, rhs.z) && - math::IsEqualF(w, rhs.w)); - } -}; -#pragma pack(pop) -typedef cc::vector ColorList; - -/** - * For non-vulkan backends, to maintain compatibility and maximize - * descriptor cache-locality, descriptor-set-based binding numbers need - * to be mapped to backend-specific bindings based on maximum limit - * of available descriptor slots in each set. - * - * The GFX layer assumes the binding numbers for each descriptor type inside each set - * are guaranteed to be consecutive, so the mapping procedure is reduced - * to a simple shifting operation. This data structure specifies the - * offsets for each descriptor type in each set. - */ -struct BindingMappingInfo { - cc::vector bufferOffsets; - cc::vector samplerOffsets; - uint flexibleSet = 0u; -}; - -struct DeviceInfo { - uintptr_t windowHandle = 0; - uint width = 0; - uint height = 0; - uint nativeWidth = 0; - uint nativeHeight = 0; - Context *sharedCtx = nullptr; - BindingMappingInfo bindingMappingInfo; -}; - -struct WindowInfo { - String title; - int left = 0; - int top = 0; - uint width = 800; - uint height = 600; - Format colorFmt = Format::UNKNOWN; - Format depthStencilFmt = Format::UNKNOWN; - bool isOffscreen = false; - bool isFullscreen = false; - VsyncMode vsyncMode = VsyncMode::OFF; - uintptr_t windowHandle = 0; - RenderPass *renderPass = nullptr; -}; - -struct ContextInfo { - uintptr_t windowHandle = 0; - Context *sharedCtx = nullptr; - VsyncMode vsyncMode = VsyncMode::RELAXED; -}; - -struct BufferInfo { - BufferUsage usage = BufferUsage::NONE; - MemoryUsage memUsage = MemoryUsage::NONE; - uint size = 0; - uint stride = 0; // in bytes - BufferFlags flags = BufferFlagBit::NONE; -}; - -struct BufferViewInfo { - Buffer *buffer = nullptr; - uint offset = 0u; - uint range = 0u; -}; - -#pragma pack(push, 1) -struct DrawInfo { - uint vertexCount = 0; - uint firstVertex = 0; - uint indexCount = 0; - uint firstIndex = 0; - uint vertexOffset = 0; - uint instanceCount = 0; - uint firstInstance = 0; -}; -#pragma pack(pop) - -typedef cc::vector DrawInfoList; - -struct IndirectBuffer { - DrawInfoList drawInfos; -}; - -struct TextureInfo { - TextureType type = TextureType::TEX2D; - TextureUsage usage = TextureUsageBit::NONE; - Format format = Format::UNKNOWN; - uint width = 0u; - uint height = 0u; - TextureFlags flags = TextureFlagBit::NONE; - uint layerCount = 1u; - uint levelCount = 1u; - SampleCount samples = SampleCount::X1; - uint depth = 1u; -}; - -struct TextureViewInfo { - Texture *texture = nullptr; - TextureType type = TextureType::TEX2D; - Format format = Format::UNKNOWN; - uint baseLevel = 0u; - uint levelCount = 1u; - uint baseLayer = 0u; - uint layerCount = 1u; -}; - -struct SamplerInfo { - Filter minFilter = Filter::LINEAR; - Filter magFilter = Filter::LINEAR; - Filter mipFilter = Filter::NONE; - Address addressU = Address::WRAP; - Address addressV = Address::WRAP; - Address addressW = Address::WRAP; - uint maxAnisotropy = 16; - ComparisonFunc cmpFunc = ComparisonFunc::NEVER; - Color borderColor; - uint minLOD = 0; - uint maxLOD = 1000; - float mipLODBias = 0.0f; -}; - -struct ShaderMacro { - String macro; - String value; -}; - -typedef cc::vector ShaderMacroList; - -struct Uniform { - String name; - Type type = Type::UNKNOWN; - uint count = 0; -}; - -typedef cc::vector UniformList; - -struct UniformBlock { - uint set = 0; - uint binding = 0; - String name; - UniformList members; - uint count = 0u; -}; - -typedef cc::vector UniformBlockList; - -struct UniformSampler { - uint set = 0; - uint binding = 0; - String name; - Type type = Type::UNKNOWN; - uint count = 0; -}; - -typedef cc::vector UniformSamplerList; - -struct ShaderStage { - ShaderStageFlagBit stage; - String source; -}; - -typedef cc::vector ShaderStageList; - -struct Attribute { - String name; - Format format = Format::UNKNOWN; - bool isNormalized = false; - uint stream = 0; - bool isInstanced = false; - uint location = 0; -}; - -typedef cc::vector AttributeList; -typedef cc::vector BufferList; - -struct ShaderInfo { - String name; - ShaderStageList stages; - AttributeList attributes; - UniformBlockList blocks; - UniformSamplerList samplers; -}; - -struct InputAssemblerInfo { - AttributeList attributes; - BufferList vertexBuffers; - Buffer *indexBuffer = nullptr; - Buffer *indirectBuffer = nullptr; -}; - -struct ColorAttachment { - Format format = Format::UNKNOWN; - uint sampleCount = 1; - LoadOp loadOp = LoadOp::CLEAR; - StoreOp storeOp = StoreOp::STORE; - TextureLayout beginLayout = TextureLayout::UNDEFINED; - TextureLayout endLayout = TextureLayout::PRESENT_SRC; -}; - -typedef cc::vector ColorAttachmentList; - -struct DepthStencilAttachment { - Format format = Format::UNKNOWN; - uint sampleCount = 1; - LoadOp depthLoadOp = LoadOp::CLEAR; - StoreOp depthStoreOp = StoreOp::STORE; - LoadOp stencilLoadOp = LoadOp::CLEAR; - StoreOp stencilStoreOp = StoreOp::STORE; - TextureLayout beginLayout = TextureLayout::UNDEFINED; - TextureLayout endLayout = TextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL; -}; - -struct SubPassInfo { - PipelineBindPoint bindPoint = PipelineBindPoint::GRAPHICS; - cc::vector inputs; - cc::vector colors; - cc::vector resolves; - uint8_t depthStencil = GFX_INVALID_BINDING; - cc::vector preserves; -}; - -typedef cc::vector SubPassInfoList; - -struct RenderPassInfo { - ColorAttachmentList colorAttachments; - DepthStencilAttachment depthStencilAttachment; - SubPassInfoList subPasses; -}; - -typedef cc::vector BufferList; -typedef cc::vector TextureList; -typedef cc::vector SamplerList; - -struct FramebufferInfo { - RenderPass *renderPass = nullptr; - TextureList colorTextures; - Texture *depthStencilTexture = nullptr; - cc::vector colorMipmapLevels; - uint depthStencilMipmapLevel = 0; -}; - -struct DescriptorSetLayoutBinding { - uint binding = GFX_INVALID_BINDING; - DescriptorType descriptorType = DescriptorType::UNKNOWN; - uint count = 0; - ShaderStageFlagBit stageFlags = ShaderStageFlagBit::NONE; - SamplerList immutableSamplers; -}; -typedef cc::vector DescriptorSetLayoutBindingList; - -struct DescriptorSetLayoutInfo { - DescriptorSetLayoutBindingList bindings; -}; - -struct DescriptorSetInfo { - DescriptorSetLayout *layout = nullptr; -}; - -typedef cc::vector DescriptorSetLayoutList; - -struct PipelineLayoutInfo { - DescriptorSetLayoutList setLayouts; -}; - -struct InputState { - AttributeList attributes; -}; - -// Use uint32_t for all boolean values to convert memory to RasterizerState* in shared memory. -struct RasterizerState { - uint32_t isDiscard = 0; - PolygonMode polygonMode = PolygonMode::FILL; - ShadeModel shadeModel = ShadeModel::GOURAND; - CullMode cullMode = CullMode::BACK; - uint32_t isFrontFaceCCW = 1; - uint32_t depthBiasEnabled = 0; - float depthBias = 0.0f; - float depthBiasClamp = 0.0f; - float depthBiasSlop = 0.0f; - uint32_t isDepthClip = 1; - uint32_t isMultisample = 0; - float lineWidth = 1.0f; -}; - -// Use uint32_t for all boolean values to convert memory to DepthStencilState* in shared memory. -struct DepthStencilState { - uint32_t depthTest = 1; - uint32_t depthWrite = 1; - ComparisonFunc depthFunc = ComparisonFunc::LESS; - uint32_t stencilTestFront = 0; - ComparisonFunc stencilFuncFront = ComparisonFunc::ALWAYS; - uint32_t stencilReadMaskFront = 0xffffffff; - uint32_t stencilWriteMaskFront = 0xffffffff; - StencilOp stencilFailOpFront = StencilOp::KEEP; - StencilOp stencilZFailOpFront = StencilOp::KEEP; - StencilOp stencilPassOpFront = StencilOp::KEEP; - uint32_t stencilRefFront = 1; - uint32_t stencilTestBack = 0; - ComparisonFunc stencilFuncBack = ComparisonFunc::ALWAYS; - uint32_t stencilReadMaskBack = 0xffffffff; - uint32_t stencilWriteMaskBack = 0xffffffff; - StencilOp stencilFailOpBack = StencilOp::KEEP; - StencilOp stencilZFailOpBack = StencilOp::KEEP; - StencilOp stencilPassOpBack = StencilOp::KEEP; - uint32_t stencilRefBack = 1; -}; - -// Use uint32_t for all boolean values to do convert memory to BlendTarget* in shared memory. -struct BlendTarget { - uint32_t blend = 0; - BlendFactor blendSrc = BlendFactor::ONE; - BlendFactor blendDst = BlendFactor::ZERO; - BlendOp blendEq = BlendOp::ADD; - BlendFactor blendSrcAlpha = BlendFactor::ONE; - BlendFactor blendDstAlpha = BlendFactor::ZERO; - BlendOp blendAlphaEq = BlendOp::ADD; - ColorMask blendColorMask = ColorMask::ALL; -}; - -typedef cc::vector BlendTargetList; - -// Use uint32_t for all boolean values to do memeory copy in shared memory. -struct BlendState { - uint32_t isA2C = 0; - uint32_t isIndepend = 0; - Color blendColor; - BlendTargetList targets{1}; -}; - -struct PipelineStateInfo { - Shader *shader = nullptr; - PipelineLayout *pipelineLayout = nullptr; - RenderPass *renderPass = nullptr; - InputState inputState; - RasterizerState rasterizerState; - DepthStencilState depthStencilState; - BlendState blendState; - PrimitiveMode primitive = PrimitiveMode::TRIANGLE_LIST; - DynamicStateFlags dynamicStates = DynamicStateFlagBit::NONE; -}; - -struct CommandBufferInfo { - Queue *queue = nullptr; - CommandBufferType type = CommandBufferType::PRIMARY; -}; -typedef cc::vector CommandBufferList; - -struct QueueInfo { - QueueType type = QueueType::GRAPHICS; -}; - -struct FenceInfo { -}; - -struct FormatInfo { - String name; - uint size = 0; - uint count = 0; - FormatType type = FormatType::NONE; - bool hasAlpha = false; - bool hasDepth = false; - bool hasStencil = false; - bool isCompressed = false; -}; - -extern CC_DLL const uint DESCRIPTOR_BUFFER_TYPE; -extern CC_DLL const uint DESCRIPTOR_SAMPLER_TYPE; -extern CC_DLL const uint DESCRIPTOR_DYNAMIC_TYPE; - -extern CC_DLL const FormatInfo GFX_FORMAT_INFOS[]; -extern CC_DLL const uint GFX_TYPE_SIZES[]; - -struct MemoryStatus { - uint bufferSize = 0; - uint textureSize = 0; -}; - -extern CC_DLL uint FormatSize(Format format, uint width, uint height, uint depth); - -extern CC_DLL uint FormatSurfaceSize(Format format, uint width, uint height, uint depth, uint mips); - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_DEF_H_ diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSet.cpp b/native/cocos/renderer/core/gfx/GFXDescriptorSet.cpp deleted file mode 100644 index 49f0eff207..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSet.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "CoreStd.h" - -#include "GFXDescriptorSet.h" -#include "GFXDescriptorSetLayout.h" - -namespace cc { -namespace gfx { - -DescriptorSet::DescriptorSet(Device *device) -: GFXObject(ObjectType::DESCRIPTOR_SET), _device(device) { -} - -DescriptorSet::~DescriptorSet() { -} - -void DescriptorSet::bindBuffer(uint binding, Buffer *buffer, uint index) { - const vector &bindingIndices = _layout->getBindingIndices(); - const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); - if (binding >= bindingIndices.size() || bindingIndices[binding] >= bindings.size()) return; - - const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; - if ((uint)info.descriptorType & DESCRIPTOR_BUFFER_TYPE) { - const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; - if (_buffers[descriptorIndex + index] != buffer) { - _buffers[descriptorIndex + index] = buffer; - _isDirty = true; - } - } else { - CCASSERT(false, "Setting binding is not DESCRIPTOR_BUFFER_TYPE."); - } -} - -void DescriptorSet::bindTexture(uint binding, Texture *texture, uint index) { - const vector &bindingIndices = _layout->getBindingIndices(); - const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); - if (binding >= bindingIndices.size() || bindingIndices[binding] >= bindings.size()) return; - - const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; - if ((uint)info.descriptorType & DESCRIPTOR_SAMPLER_TYPE) { - const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; - if (_textures[descriptorIndex + index] != texture) { - _textures[descriptorIndex + index] = texture; - _isDirty = true; - } - } else { - CCASSERT(false, "Setting binding is not DESCRIPTOR_SAMPLER_TYPE."); - } -} - -void DescriptorSet::bindSampler(uint binding, Sampler *sampler, uint index) { - const vector &bindingIndices = _layout->getBindingIndices(); - const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); - if (binding >= bindingIndices.size() || bindingIndices[binding] >= bindings.size()) return; - - const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; - if ((uint)info.descriptorType & DESCRIPTOR_SAMPLER_TYPE) { - const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; - if (_samplers[descriptorIndex + index] != sampler) { - _samplers[descriptorIndex + index] = sampler; - _isDirty = true; - } - } else { - CCASSERT(false, "Setting binding is not DESCRIPTOR_SAMPLER_TYPE."); - } -} - -bool DescriptorSet::bindBufferJSB(uint binding, Buffer *buffer, uint index) { - bindBuffer(binding, buffer, index); - return _isDirty; -} - -bool DescriptorSet::bindTextureJSB(uint binding, Texture *texture, uint index) { - bindTexture(binding, texture, index); - return _isDirty; -} - -bool DescriptorSet::bindSamplerJSB(uint binding, Sampler *sampler, uint index) { - bindSampler(binding, sampler, index); - return _isDirty; -} - -Buffer *DescriptorSet::getBuffer(uint binding, uint index) const { - const vector &descriptorIndices = _layout->getDescriptorIndices(); - if (binding >= descriptorIndices.size()) return nullptr; - const uint descriptorIndex = descriptorIndices[binding] + index; - if (descriptorIndex >= _buffers.size()) return nullptr; - return _buffers[descriptorIndex]; -} - -Texture *DescriptorSet::getTexture(uint binding, uint index) const { - const vector &descriptorIndices = _layout->getDescriptorIndices(); - if (binding >= descriptorIndices.size()) return nullptr; - const uint descriptorIndex = descriptorIndices[binding] + index; - if (descriptorIndex >= _textures.size()) return nullptr; - return _textures[descriptorIndex]; -} - -Sampler *DescriptorSet::getSampler(uint binding, uint index) const { - const vector &descriptorIndices = _layout->getDescriptorIndices(); - if (binding >= descriptorIndices.size()) return nullptr; - const uint descriptorIndex = descriptorIndices[binding] + index; - if (descriptorIndex >= _samplers.size()) return nullptr; - return _samplers[descriptorIndex]; -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSet.h b/native/cocos/renderer/core/gfx/GFXDescriptorSet.h deleted file mode 100644 index b47ed6b71b..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSet.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef CC_CORE_GFX_DESCRIPTOR_SET_H_ -#define CC_CORE_GFX_DESCRIPTOR_SET_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL DescriptorSet : public GFXObject { -public: - DescriptorSet(Device *device); - virtual ~DescriptorSet(); - -public: - virtual bool initialize(const DescriptorSetInfo &info) = 0; - virtual void destroy() = 0; - virtual void update() = 0; - - virtual void bindBuffer(uint binding, Buffer *buffer, uint index); - virtual void bindTexture(uint binding, Texture *texture, uint index); - virtual void bindSampler(uint binding, Sampler *sampler, uint index); - - // Functions invoked by JSB adapter - bool bindBufferJSB(uint binding, Buffer *buffer, uint index); - bool bindTextureJSB(uint binding, Texture *texture, uint index); - bool bindSamplerJSB(uint binding, Sampler *sampler, uint index); - - Buffer *getBuffer(uint binding, uint index) const; - Texture *getTexture(uint binding, uint index) const; - Sampler *getSampler(uint binding, uint index) const; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE void bindBuffer(uint binding, Buffer *buffer) { bindBuffer(binding, buffer, 0u); } - CC_INLINE void bindTexture(uint binding, Texture *texture) { bindTexture(binding, texture, 0u); } - CC_INLINE void bindSampler(uint binding, Sampler *sampler) { bindSampler(binding, sampler, 0u); } - CC_INLINE Buffer *getBuffer(uint binding) const { return getBuffer(binding, 0u); } - CC_INLINE Texture *getTexture(uint binding) const { return getTexture(binding, 0u); } - CC_INLINE Sampler *getSampler(uint binding) const { return getSampler(binding, 0u); } - -protected: - Device *_device = nullptr; - - DescriptorSetLayout *_layout; - BufferList _buffers; - TextureList _textures; - SamplerList _samplers; - - bool _isDirty = false; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_DESCRIPTOR_SET_H_ diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp b/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp deleted file mode 100644 index 222493b55c..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXDescriptorSetLayout.h" - -namespace cc { -namespace gfx { - -DescriptorSetLayout::DescriptorSetLayout(Device *device) -: GFXObject(ObjectType::DESCRIPTOR_SET_LAYOUT), _device(device) { -} - -DescriptorSetLayout::~DescriptorSetLayout() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.h b/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.h deleted file mode 100644 index 07e54a7f97..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDescriptorSetLayout.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef CC_CORE_GFX_DESCRIPTOR_SET_LAYOUT_H_ -#define CC_CORE_GFX_DESCRIPTOR_SET_LAYOUT_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL DescriptorSetLayout : public GFXObject { -public: - DescriptorSetLayout(Device *device); - virtual ~DescriptorSetLayout(); - -public: - virtual bool initialize(const DescriptorSetLayoutInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE const DescriptorSetLayoutBindingList &getBindings() const { return _bindings; } - CC_INLINE const vector &getBindingIndices() const { return _bindingIndices; } - CC_INLINE const vector &getDescriptorIndices() const { return _descriptorIndices; } - CC_INLINE const uint getDescriptorCount() const { return _descriptorCount; } - -protected: - Device *_device = nullptr; - DescriptorSetLayoutBindingList _bindings; - uint _descriptorCount = 0u; - vector _bindingIndices; - vector _descriptorIndices; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_DESCRIPTOR_SET_LAYOUT_H_ diff --git a/native/cocos/renderer/core/gfx/GFXDevice.cpp b/native/cocos/renderer/core/gfx/GFXDevice.cpp deleted file mode 100755 index b66c4fa865..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDevice.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "CoreStd.h" - -#include "GFXContext.h" -#include "GFXDevice.h" -#include "cocos/bindings/event/CustomEventTypes.h" -#include "cocos/bindings/event/EventDispatcher.h" - -namespace cc { -namespace gfx { - -Device *Device::_instance = nullptr; - -Device *Device::getInstance() { - return Device::_instance; -} - -Device::Device() { - Device::_instance = this; - memset(_features, 0, sizeof(_features)); - EventDispatcher::addCustomEventListener(EVENT_RESTART_VM, [=](const CustomEvent&) -> void { - // FIXME: wait & flush all pending gfx commands - Device::_instance->destroy(); - }); -} - -Device::~Device() { - // On Android, engine will check vulkan, gles3, gles2 compatibility in sequence. - // Device::_instance will be the supported device, it may not be equal to this. - // For example, if a vulkan is not supported and gles3 is supported by a Android - // device. Then the function invoking sequence is: - // - new VKDevice() -> Device::_instance == VKDevice - // - GLES3Device() -> Device::_instance == GLES3Device - // delete VKDevice -> Device::_instance != this - if (this == Device::_instance) { - Device::_instance = nullptr; - } -} - -Format Device::getColorFormat() const { - return _context->getColorFormat(); -} - -Format Device::getDepthStencilFormat() const { - return _context->getDepthStencilFormat(); -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXDevice.h b/native/cocos/renderer/core/gfx/GFXDevice.h deleted file mode 100755 index 03896a9cee..0000000000 --- a/native/cocos/renderer/core/gfx/GFXDevice.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef CC_CORE_GFX_DEVICE_H_ -#define CC_CORE_GFX_DEVICE_H_ - -#include "GFXDef.h" -#include "GFXFence.h" -#include "GFXQueue.h" -#include "GFXSampler.h" -#include "GFXInputAssembler.h" -#include "GFXRenderPass.h" -#include "GFXFramebuffer.h" -#include "GFXDescriptorSetLayout.h" -#include "GFXPipelineLayout.h" -#include "GFXPipelineState.h" -#include "GFXCommandBuffer.h" -#include "GFXDescriptorSet.h" -#include "GFXBuffer.h" -#include "GFXTexture.h" -#include "GFXShader.h" - -namespace cc { -namespace gfx { - -class CC_DLL Device : public Object { -public: - static Device *getInstance(); - - Device(); - virtual ~Device(); - - virtual bool initialize(const DeviceInfo &info) = 0; - virtual void destroy() = 0; - virtual void resize(uint width, uint height) = 0; - virtual void acquire() = 0; - virtual void present() = 0; - - CC_INLINE CommandBuffer *createCommandBuffer(const CommandBufferInfo &info) { CommandBuffer *res = doCreateCommandBuffer(info, false); res->initialize(info); return res; } - CC_INLINE Fence *createFence(const FenceInfo &info) { Fence *res = createFence(); res->initialize(info); return res; } - CC_INLINE Queue *createQueue(const QueueInfo &info) { Queue *res = createQueue(); res->initialize(info); return res; } - CC_INLINE Buffer *createBuffer(const BufferInfo &info) { Buffer *res = createBuffer(); res->initialize(info); return res; } - CC_INLINE Buffer *createBuffer(const BufferViewInfo &info) { Buffer *res = createBuffer(); res->initialize(info); return res; } - CC_INLINE Texture *createTexture(const TextureInfo &info) { Texture *res = createTexture(); res->initialize(info); return res; } - CC_INLINE Texture *createTexture(const TextureViewInfo &info) { Texture *res = createTexture(); res->initialize(info); return res; } - CC_INLINE Sampler *createSampler(const SamplerInfo &info) { Sampler *res = createSampler(); res->initialize(info); return res; } - CC_INLINE Shader *createShader(const ShaderInfo &info) { Shader *res = createShader(); res->initialize(info); return res; } - CC_INLINE InputAssembler *createInputAssembler(const InputAssemblerInfo &info) { InputAssembler *res = createInputAssembler(); res->initialize(info); return res; } - CC_INLINE RenderPass *createRenderPass(const RenderPassInfo &info) { RenderPass *res = createRenderPass(); res->initialize(info); return res; } - CC_INLINE Framebuffer *createFramebuffer(const FramebufferInfo &info) { Framebuffer *res = createFramebuffer(); res->initialize(info); return res; } - CC_INLINE DescriptorSet *createDescriptorSet(const DescriptorSetInfo &info) { DescriptorSet *res = createDescriptorSet(); res->initialize(info); return res; } - CC_INLINE DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) { DescriptorSetLayout *res = createDescriptorSetLayout(); res->initialize(info); return res; } - CC_INLINE PipelineLayout *createPipelineLayout(const PipelineLayoutInfo &info) { PipelineLayout *res = createPipelineLayout(); res->initialize(info); return res; } - CC_INLINE PipelineState *createPipelineState(const PipelineStateInfo &info) { PipelineState *res = createPipelineState(); res->initialize(info); return res; } - CC_INLINE void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) { - copyBuffersToTexture(buffers.data(), dst, regions.data(), static_cast(regions.size()) ); - } - - virtual void setMultithreaded(bool multithreaded) {} - virtual SurfaceTransform getSurfaceTransform() const { return _transform; } - virtual uint getWidth() const { return _width; } - virtual uint getHeight() const { return _height; } - virtual uint getNativeWidth() const { return _nativeWidth; } - virtual uint getNativeHeight() const { return _nativeHeight; } - virtual MemoryStatus &getMemoryStatus() { return _memoryStatus; } - virtual uint getNumDrawCalls() const { return _numDrawCalls; } - virtual uint getNumInstances() const { return _numInstances; } - virtual uint getNumTris() const { return _numTriangles; } - - Format getColorFormat() const; - Format getDepthStencilFormat() const; - CC_INLINE API getGfxAPI() const { return _API; } - CC_INLINE const String &getDeviceName() const { return _deviceName; } - CC_INLINE Context *getContext() const { return _context; } - CC_INLINE Queue *getQueue() const { return _queue; } - CC_INLINE CommandBuffer *getCommandBuffer() const { return _cmdBuff; } - CC_INLINE const String &getRenderer() const { return _renderer; } - CC_INLINE const String &getVendor() const { return _vendor; } - CC_INLINE int getMaxVertexAttributes() const { return _maxVertexAttributes; } - CC_INLINE int getMaxVertexUniformVectors() const { return _maxVertexUniformVectors; } - CC_INLINE int getMaxFragmentUniformVectors() const { return _maxFragmentUniformVectors; } - CC_INLINE int getMaxTextureUnits() const { return _maxTextureUnits; } - CC_INLINE int getMaxVertexTextureUnits() const { return _maxVertexTextureUnits; } - CC_INLINE int getMaxUniformBufferBindings() const { return _maxUniformBufferBindings; } - CC_INLINE int getMaxUniformBlockSize() const { return _maxUniformBlockSize; } - CC_INLINE int getMaxTextureSize() const { return _maxTextureSize; } - CC_INLINE int getMaxCubeMapTextureSize() const { return _maxCubeMapTextureSize; } - CC_INLINE int getUboOffsetAlignment() const { return _uboOffsetAlignment; } - CC_INLINE int getDepthBits() const { return _depthBits; } - CC_INLINE int getStencilBits() const { return _stencilBits; } - CC_INLINE bool hasFeature(Feature feature) const { return _features[static_cast(feature)]; } - CC_INLINE float getClipSpaceMinZ() const { return _clipSpaceMinZ; } - CC_INLINE float getScreenSpaceSignY() const { return _screenSpaceSignY; } - CC_INLINE float getUVSpaceSignY() const { return _UVSpaceSignY; } - CC_INLINE const BindingMappingInfo &bindingMappingInfo() const { return _bindingMappingInfo; } - CC_INLINE uint genShaderId() { return _shaderIdGen++; } - -protected: - friend class DeviceAgent; - - virtual CommandBuffer *doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) = 0; - virtual Fence *createFence() = 0; - virtual Queue *createQueue() = 0; - virtual Buffer *createBuffer() = 0; - virtual Texture *createTexture() = 0; - virtual Sampler *createSampler() = 0; - virtual Shader *createShader() = 0; - virtual InputAssembler *createInputAssembler() = 0; - virtual RenderPass *createRenderPass() = 0; - virtual Framebuffer *createFramebuffer() = 0; - virtual DescriptorSet *createDescriptorSet() = 0; - virtual DescriptorSetLayout *createDescriptorSetLayout() = 0; - virtual PipelineLayout *createPipelineLayout() = 0; - virtual PipelineState *createPipelineState() = 0; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) = 0; - - virtual void bindRenderContext(bool bound) {} - virtual void bindDeviceContext(bool bound) {} - - API _API = API::UNKNOWN; - SurfaceTransform _transform = SurfaceTransform::IDENTITY; - String _deviceName; - String _renderer; - String _vendor; - String _version; - bool _features[static_cast(Feature::COUNT)]; - uint _width = 0; - uint _height = 0; - uint _nativeWidth = 0; - uint _nativeHeight = 0; - MemoryStatus _memoryStatus; - uintptr_t _windowHandle = 0; - Context *_context = nullptr; - Queue *_queue = nullptr; - CommandBuffer *_cmdBuff = nullptr; - uint _numDrawCalls = 0u; - uint _numInstances = 0u; - uint _numTriangles = 0u; - uint _maxVertexAttributes = 0u; - uint _maxVertexUniformVectors = 0u; - uint _maxFragmentUniformVectors = 0u; - uint _maxTextureUnits = 0u; - uint _maxVertexTextureUnits = 0u; - uint _maxUniformBufferBindings = 0u; - uint _maxUniformBlockSize = 0u; - uint _maxTextureSize = 0u; - uint _maxCubeMapTextureSize = 0u; - uint _uboOffsetAlignment = 0u; - uint _depthBits = 0u; - uint _stencilBits = 0u; - uint _shaderIdGen = 0u; - unordered_map _macros; - float _clipSpaceMinZ = -1.0f; - float _screenSpaceSignY = 1.0f; - float _UVSpaceSignY = -1.0f; - BindingMappingInfo _bindingMappingInfo; - -private: - static Device *_instance; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_DEVICE_H_ diff --git a/native/cocos/renderer/core/gfx/GFXFence.cpp b/native/cocos/renderer/core/gfx/GFXFence.cpp deleted file mode 100644 index 8657915d6a..0000000000 --- a/native/cocos/renderer/core/gfx/GFXFence.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXFence.h" - -namespace cc { -namespace gfx { - -Fence::Fence(Device *device) -: GFXObject(ObjectType::FENCE), _device(device) { -} - -Fence::~Fence() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXFence.h b/native/cocos/renderer/core/gfx/GFXFence.h deleted file mode 100644 index fb2f9f80c8..0000000000 --- a/native/cocos/renderer/core/gfx/GFXFence.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef CC_CORE_GFX_FENCE_H_ -#define CC_CORE_GFX_FENCE_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Fence : public GFXObject { -public: - Fence(Device *device); - virtual ~Fence(); - -public: - virtual bool initialize(const FenceInfo &info) = 0; - virtual void destroy() = 0; - virtual void wait() = 0; - virtual void reset() = 0; - -protected: - Device *_device = nullptr; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_FENCE_H_ diff --git a/native/cocos/renderer/core/gfx/GFXFramebuffer.cpp b/native/cocos/renderer/core/gfx/GFXFramebuffer.cpp deleted file mode 100755 index f17e012b2e..0000000000 --- a/native/cocos/renderer/core/gfx/GFXFramebuffer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXFramebuffer.h" - -namespace cc { -namespace gfx { - -Framebuffer::Framebuffer(Device *device) -: GFXObject(ObjectType::FRAMEBUFFER), _device(device) { -} - -Framebuffer::~Framebuffer() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXFramebuffer.h b/native/cocos/renderer/core/gfx/GFXFramebuffer.h deleted file mode 100755 index ffc5780f78..0000000000 --- a/native/cocos/renderer/core/gfx/GFXFramebuffer.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CC_CORE_GFX_FRAME_BUFFER_H_ -#define CC_CORE_GFX_FRAME_BUFFER_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Framebuffer : public GFXObject { -public: - Framebuffer(Device *device); - virtual ~Framebuffer(); - -public: - virtual bool initialize(const FramebufferInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE RenderPass *getRenderPass() const { return _renderPass; } - CC_INLINE const TextureList &getColorTextures() const { return _colorTextures; } - CC_INLINE Texture *getDepthStencilTexture() const { return _depthStencilTexture; } - -protected: - Device *_device = nullptr; - RenderPass *_renderPass = nullptr; - TextureList _colorTextures; - Texture *_depthStencilTexture = nullptr; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_FRAME_BUFFER_H_ diff --git a/native/cocos/renderer/core/gfx/GFXInputAssembler.cpp b/native/cocos/renderer/core/gfx/GFXInputAssembler.cpp deleted file mode 100755 index e1b452ba12..0000000000 --- a/native/cocos/renderer/core/gfx/GFXInputAssembler.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "CoreStd.h" - -#include "GFXInputAssembler.h" - -namespace cc { -namespace gfx { - -InputAssembler::InputAssembler(Device *device) -: GFXObject(ObjectType::INPUT_ASSEMBLER), _device(device) { -} - -InputAssembler::~InputAssembler() { -} - -void InputAssembler::extractDrawInfo(DrawInfo &drawInfo) const { - drawInfo.vertexCount = _vertexCount; - drawInfo.firstVertex = _firstVertex; - drawInfo.indexCount = _indexCount; - drawInfo.firstIndex = _firstIndex; - drawInfo.vertexOffset = _vertexOffset; - drawInfo.instanceCount = _instanceCount; - drawInfo.firstInstance = _firstInstance; -} - -uint InputAssembler::computeAttributesHash() const { - // https://stackoverflow.com/questions/20511347/a-good-hash-function-for-a-vector - // 6: Attribute has 6 elements. - std::size_t seed = _attributes.size() * 6; - for (const auto &attribute : _attributes) { - seed ^= std::hash{}(attribute.name) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= (uint)(attribute.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= attribute.isNormalized + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= attribute.stream + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= attribute.isInstanced + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= attribute.location + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - return static_cast(seed); -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXInputAssembler.h b/native/cocos/renderer/core/gfx/GFXInputAssembler.h deleted file mode 100755 index bfc63496ec..0000000000 --- a/native/cocos/renderer/core/gfx/GFXInputAssembler.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef CC_CORE_GFX_INPUT_ASSEMBLER_H_ -#define CC_CORE_GFX_INPUT_ASSEMBLER_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL InputAssembler : public GFXObject { -public: - InputAssembler(Device *device); - virtual ~InputAssembler(); - -public: - virtual bool initialize(const InputAssemblerInfo &info) = 0; - virtual void destroy() = 0; - - void extractDrawInfo(DrawInfo &drawInfo) const; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE const AttributeList &getAttributes() const { return _attributes; } - CC_INLINE const BufferList &getVertexBuffers() const { return _vertexBuffers; } - CC_INLINE Buffer *getIndexBuffer() const { return _indexBuffer; } - CC_INLINE Buffer *getIndirectBuffer() const { return _indirectBuffer; } - CC_INLINE uint getVertexCount() const { return _vertexCount; } - CC_INLINE uint getFirstVertex() const { return _firstVertex; } - CC_INLINE uint getIndexCount() const { return _indexCount; } - CC_INLINE uint getFirstIndex() const { return _firstIndex; } - CC_INLINE uint getVertexOffset() const { return _vertexOffset; } - CC_INLINE uint getInstanceCount() const { return _instanceCount; } - CC_INLINE uint getFirstInstance() const { return _firstInstance; } - CC_INLINE uint getAttributesHash() const { return _attributesHash; } - - virtual void setVertexCount(uint count) { _vertexCount = count; } - virtual void setFirstVertex(uint first) { _firstVertex = first; } - virtual void setIndexCount(uint count) { _indexCount = count; } - virtual void setFirstIndex(uint first) { _firstIndex = first; } - virtual void setVertexOffset(uint offset) { _vertexOffset = offset; } - virtual void setInstanceCount(uint count) { _instanceCount = count; } - virtual void setFirstInstance(uint first) { _firstInstance = first; } - -protected: - uint computeAttributesHash() const; - - Device *_device = nullptr; - AttributeList _attributes; - BufferList _vertexBuffers; - Buffer *_indexBuffer = nullptr; - Buffer *_indirectBuffer = nullptr; - uint _vertexCount = 0; - uint _firstVertex = 0; - uint _indexCount = 0; - uint _firstIndex = 0; - uint _vertexOffset = 0; - uint _instanceCount = 0; - uint _firstInstance = 0; - uint _attributesHash = 0; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_INPUT_ASSEMBLER_H_ diff --git a/native/cocos/renderer/core/gfx/GFXObject.cpp b/native/cocos/renderer/core/gfx/GFXObject.cpp deleted file mode 100644 index 2284eddf37..0000000000 --- a/native/cocos/renderer/core/gfx/GFXObject.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "CoreStd.h" - -#include "GFXObject.h" - -namespace cc { -namespace gfx { - -GFXObject::GFXObject(ObjectType Type) -: _Type(Type) {} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXObject.h b/native/cocos/renderer/core/gfx/GFXObject.h deleted file mode 100644 index 944f34720a..0000000000 --- a/native/cocos/renderer/core/gfx/GFXObject.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class GFXObject : public Object { -public: - GFXObject(ObjectType Type); - virtual ~GFXObject() = default; - - CC_INLINE ObjectType getType() const { return _Type; } - -protected: - ObjectType _Type = ObjectType::UNKNOWN; -}; - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXPipelineLayout.cpp b/native/cocos/renderer/core/gfx/GFXPipelineLayout.cpp deleted file mode 100644 index 9c31d585d6..0000000000 --- a/native/cocos/renderer/core/gfx/GFXPipelineLayout.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXPipelineLayout.h" - -namespace cc { -namespace gfx { - -PipelineLayout::PipelineLayout(Device *device) -: GFXObject(ObjectType::PIPELINE_LAYOUT), _device(device) { -} - -PipelineLayout::~PipelineLayout() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h b/native/cocos/renderer/core/gfx/GFXPipelineLayout.h deleted file mode 100644 index ecfbff2f5f..0000000000 --- a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef CC_CORE_GFX_PIPELINE_LAYOUT_H_ -#define CC_CORE_GFX_PIPELINE_LAYOUT_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL PipelineLayout : public GFXObject { -public: - PipelineLayout(Device *device); - virtual ~PipelineLayout(); - -public: - virtual bool initialize(const PipelineLayoutInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE const DescriptorSetLayoutList &getSetLayouts() const { return _setLayouts; } - -protected: - Device *_device = nullptr; - DescriptorSetLayoutList _setLayouts; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_PIPELINE_LAYOUT_H_ diff --git a/native/cocos/renderer/core/gfx/GFXPipelineState.cpp b/native/cocos/renderer/core/gfx/GFXPipelineState.cpp deleted file mode 100755 index 6cf62e6b9a..0000000000 --- a/native/cocos/renderer/core/gfx/GFXPipelineState.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXPipelineState.h" - -namespace cc { -namespace gfx { - -PipelineState::PipelineState(Device *device) -: GFXObject(ObjectType::PIPELINE_STATE), _device(device) { -} - -PipelineState::~PipelineState() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXPipelineState.h b/native/cocos/renderer/core/gfx/GFXPipelineState.h deleted file mode 100755 index 3e0aa7fa56..0000000000 --- a/native/cocos/renderer/core/gfx/GFXPipelineState.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CC_CORE_GFX_PIPELINE_STATE_H_ -#define CC_CORE_GFX_PIPELINE_STATE_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL PipelineState : public GFXObject { -public: - PipelineState(Device *device); - virtual ~PipelineState(); - -public: - virtual bool initialize(const PipelineStateInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE Shader *getShader() const { return _shader; } - CC_INLINE PrimitiveMode getPrimitive() const { return _primitive; } - CC_INLINE DynamicStateFlags getDynamicStates() const { return _dynamicStates; } - CC_INLINE const InputState &getInputState() const { return _inputState; } - CC_INLINE const RasterizerState &getRasterizerState() const { return _rasterizerState; } - CC_INLINE const DepthStencilState &getDepthStencilState() const { return _depthStencilState; } - CC_INLINE const BlendState &getBlendState() const { return _blendState; } - CC_INLINE const RenderPass *getRenderPass() const { return _renderPass; } - CC_INLINE const PipelineLayout *getPipelineLayout() const { return _pipelineLayout; } - -protected: - Device *_device = nullptr; - Shader *_shader = nullptr; - PrimitiveMode _primitive = PrimitiveMode::TRIANGLE_LIST; - DynamicStateFlags _dynamicStates = DynamicStateFlags::NONE; - InputState _inputState; - RasterizerState _rasterizerState; - DepthStencilState _depthStencilState; - BlendState _blendState; - RenderPass *_renderPass = nullptr; - PipelineLayout *_pipelineLayout = nullptr; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_PIPELINE_STATE_H_ diff --git a/native/cocos/renderer/core/gfx/GFXQueue.cpp b/native/cocos/renderer/core/gfx/GFXQueue.cpp deleted file mode 100755 index ceb98594ee..0000000000 --- a/native/cocos/renderer/core/gfx/GFXQueue.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXQueue.h" - -namespace cc { -namespace gfx { - -Queue::Queue(Device *device) -: GFXObject(ObjectType::QUEUE), _device(device) { -} - -Queue::~Queue() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXQueue.h b/native/cocos/renderer/core/gfx/GFXQueue.h deleted file mode 100755 index cc32b136d4..0000000000 --- a/native/cocos/renderer/core/gfx/GFXQueue.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef CC_CORE_GFX_QUEUE_H_ -#define CC_CORE_GFX_QUEUE_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Queue : public GFXObject { -public: - Queue(Device *device); - virtual ~Queue(); - -public: - virtual bool initialize(const QueueInfo &info) = 0; - virtual void destroy() = 0; - virtual void submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) = 0; - - CC_INLINE void submit(const vector &cmdBuffs) { submit(cmdBuffs, nullptr); } - CC_INLINE void submit(const vector &cmdBuffs, Fence *fence) { submit(cmdBuffs.data(), static_cast(cmdBuffs.size()), fence); } - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE QueueType getType() const { return _type; } - CC_INLINE bool isAsync() const { return _isAsync; } - -protected: - Device *_device = nullptr; - QueueType _type = QueueType::GRAPHICS; - bool _isAsync = false; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_QUEUE_H_ diff --git a/native/cocos/renderer/core/gfx/GFXRenderPass.cpp b/native/cocos/renderer/core/gfx/GFXRenderPass.cpp deleted file mode 100755 index e89bee3f5e..0000000000 --- a/native/cocos/renderer/core/gfx/GFXRenderPass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "CoreStd.h" - -#include "GFXRenderPass.h" - -namespace cc { -namespace gfx { - -RenderPass::RenderPass(Device *device) -: GFXObject(ObjectType::RENDER_PASS), _device(device) { -} - -RenderPass::~RenderPass() { -} - -// Based on render pass compatibility -uint RenderPass::computeHash() const { - // https://stackoverflow.com/questions/20511347/a-good-hash-function-for-a-vector - size_t seed = _colorAttachments.size() * 2 + 2; - if (_subPasses.size()) { - for (const auto &subPass : _subPasses) { - for (const auto &iaIndex : subPass.inputs) { - if (iaIndex >= _colorAttachments.size()) break; - const auto ia = _colorAttachments[iaIndex]; - seed ^= (uint)(ia.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= ia.sampleCount + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - for (const auto &caIndex : subPass.colors) { - if (caIndex >= _colorAttachments.size()) break; - const auto ca = _colorAttachments[caIndex]; - seed ^= (uint)(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= ca.sampleCount + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - if (subPass.depthStencil < _colorAttachments.size()) { - const auto ds = _colorAttachments[subPass.depthStencil]; - seed ^= (uint)(ds.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= ds.sampleCount + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - } - } else { - for (const auto &colorAttachment : _colorAttachments) { - seed ^= (uint)(colorAttachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= colorAttachment.sampleCount + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - seed ^= (uint)(_depthStencilAttachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); - seed ^= _depthStencilAttachment.sampleCount + 0x9e3779b9 + (seed << 6) + (seed >> 2); - } - - return static_cast(seed); -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXRenderPass.h b/native/cocos/renderer/core/gfx/GFXRenderPass.h deleted file mode 100755 index 0d51c94ac0..0000000000 --- a/native/cocos/renderer/core/gfx/GFXRenderPass.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef CC_CORE_GFX_RENDER_PASS_H_ -#define CC_CORE_GFX_RENDER_PASS_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL RenderPass : public GFXObject { -public: - RenderPass(Device *device); - virtual ~RenderPass(); - -public: - virtual bool initialize(const RenderPassInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE const ColorAttachmentList &getColorAttachments() const { return _colorAttachments; } - CC_INLINE const DepthStencilAttachment &getDepthStencilAttachment() const { return _depthStencilAttachment; } - CC_INLINE const SubPassInfoList &getSubPasses() const { return _subPasses; } - CC_INLINE uint getHash() const { return _hash; } - -protected: - uint computeHash() const; - - Device *_device = nullptr; - ColorAttachmentList _colorAttachments; - DepthStencilAttachment _depthStencilAttachment; - SubPassInfoList _subPasses; - uint _hash = 0; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_RENDER_PASS_H_ diff --git a/native/cocos/renderer/core/gfx/GFXSampler.cpp b/native/cocos/renderer/core/gfx/GFXSampler.cpp deleted file mode 100755 index 1e6d59a80e..0000000000 --- a/native/cocos/renderer/core/gfx/GFXSampler.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "CoreStd.h" - -#include "GFXSampler.h" - -namespace cc { -namespace gfx { - -Sampler::Sampler(Device *device) -: GFXObject(ObjectType::SAMPLER), _device(device) { - _borderColor.x = 0.0f; - _borderColor.y = 0.0f; - _borderColor.z = 0.0f; - _borderColor.w = 0.0f; -} - -Sampler::~Sampler() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXSampler.h b/native/cocos/renderer/core/gfx/GFXSampler.h deleted file mode 100755 index 0c32176e0a..0000000000 --- a/native/cocos/renderer/core/gfx/GFXSampler.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef CC_CORE_GFX_SAMPLER_H_ -#define CC_CORE_GFX_SAMPLER_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Sampler : public GFXObject { -public: - Sampler(Device *device); - virtual ~Sampler(); - -public: - virtual bool initialize(const SamplerInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE Filter getMinFilter() const { return _minFilter; } - CC_INLINE Filter getMagFilter() const { return _magFilter; } - CC_INLINE Filter getMipFilter() const { return _mipFilter; } - CC_INLINE Address getAddressU() const { return _addressU; } - CC_INLINE Address getAddressV() const { return _addressV; } - CC_INLINE Address getAddressW() const { return _addressW; } - CC_INLINE uint getMaxAnisotropy() const { return _maxAnisotropy; } - CC_INLINE ComparisonFunc getCmpFunc() const { return _cmpFunc; } - CC_INLINE const Color &getBorderColor() const { return _borderColor; } - CC_INLINE uint getMinLOD() const { return _minLOD; } - CC_INLINE uint getMaxLOD() const { return _maxLOD; } - CC_INLINE float getMipLODBias() const { return _mipLODBias; } - -protected: - Device *_device = nullptr; - Filter _minFilter = Filter::NONE; - Filter _magFilter = Filter::NONE; - Filter _mipFilter = Filter::NONE; - Address _addressU = Address::WRAP; - Address _addressV = Address::WRAP; - Address _addressW = Address::WRAP; - uint _maxAnisotropy = 0; - ComparisonFunc _cmpFunc = ComparisonFunc::ALWAYS; - Color _borderColor; - uint _minLOD = 0; - uint _maxLOD = 0; - float _mipLODBias = 0.0f; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_SAMPLER_H_ diff --git a/native/cocos/renderer/core/gfx/GFXShader.cpp b/native/cocos/renderer/core/gfx/GFXShader.cpp deleted file mode 100755 index d873df24cf..0000000000 --- a/native/cocos/renderer/core/gfx/GFXShader.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "CoreStd.h" - -#include "GFXDevice.h" -#include "GFXShader.h" - -namespace cc { -namespace gfx { - -Shader::Shader(Device *device) -: GFXObject(ObjectType::SHADER), _device(device) { - _shaderID = device->genShaderId(); -} - -Shader::~Shader() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXShader.h b/native/cocos/renderer/core/gfx/GFXShader.h deleted file mode 100755 index f92eba4deb..0000000000 --- a/native/cocos/renderer/core/gfx/GFXShader.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CC_CORE_GFX_SHADER_H_ -#define CC_CORE_GFX_SHADER_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Shader : public GFXObject { -public: - Shader(Device *device); - virtual ~Shader(); - -public: - virtual bool initialize(const ShaderInfo &info) = 0; - virtual void destroy() = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE uint getID() const { return _shaderID; } - CC_INLINE const String &getName() const { return _name; } - CC_INLINE const ShaderStageList &getStages() const { return _stages; } - CC_INLINE const AttributeList &getAttributes() const { return _attributes; } - CC_INLINE const UniformBlockList &getBlocks() const { return _blocks; } - CC_INLINE const UniformSamplerList &getSamplers() const { return _samplers; } - -protected: - Device *_device = nullptr; - uint _shaderID = 0; - String _name; - ShaderStageList _stages; - AttributeList _attributes; - UniformBlockList _blocks; - UniformSamplerList _samplers; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_TEXTURE_VIEW_H_ diff --git a/native/cocos/renderer/core/gfx/GFXTexture.cpp b/native/cocos/renderer/core/gfx/GFXTexture.cpp deleted file mode 100755 index 0b173bd8bf..0000000000 --- a/native/cocos/renderer/core/gfx/GFXTexture.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "CoreStd.h" - -#include "GFXTexture.h" - -namespace cc { -namespace gfx { - -Texture::Texture(Device *device) -: GFXObject(ObjectType::TEXTURE), _device(device) { -} - -Texture::~Texture() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXTexture.h b/native/cocos/renderer/core/gfx/GFXTexture.h deleted file mode 100755 index 53822681bf..0000000000 --- a/native/cocos/renderer/core/gfx/GFXTexture.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef CC_CORE_GFX_TEXTURE_H_ -#define CC_CORE_GFX_TEXTURE_H_ - -#include "GFXDef.h" - -namespace cc { -namespace gfx { - -class CC_DLL Texture : public GFXObject { -public: - Texture(Device *device); - virtual ~Texture(); - -public: - virtual bool initialize(const TextureInfo &info) = 0; - virtual bool initialize(const TextureViewInfo &info) = 0; - virtual void destroy() = 0; - virtual void resize(uint width, uint height) = 0; - - CC_INLINE Device *getDevice() const { return _device; } - CC_INLINE TextureType getType() const { return _type; } - CC_INLINE TextureUsage getUsage() const { return _usage; } - CC_INLINE Format getFormat() const { return _format; } - CC_INLINE uint getWidth() const { return _width; } - CC_INLINE uint getHeight() const { return _height; } - CC_INLINE uint getDepth() const { return _depth; } - CC_INLINE uint getLayerCount() const { return _layerCount; } - CC_INLINE uint getLevelCount() const { return _levelCount; } - CC_INLINE uint getSize() const { return _size; } - CC_INLINE SampleCount getSamples() const { return _samples; } - CC_INLINE TextureFlags getFlags() const { return _flags; } - CC_INLINE uint8_t *getBuffer() const { return _buffer; } - CC_INLINE bool isTextureView() const { return _isTextureView; } - -protected: - Device *_device = nullptr; - TextureType _type = TextureType::TEX2D; - TextureUsage _usage = TextureUsageBit::NONE; - Format _format = Format::UNKNOWN; - uint _width = 0u; - uint _height = 0u; - uint _depth = 1u; - uint _baseLevel = 0u; - uint _levelCount = 1u; - uint _baseLayer = 0u; - uint _layerCount = 1u; - uint _size = 0u; - SampleCount _samples = SampleCount::X1; - TextureFlags _flags = TextureFlagBit::NONE; - uint8_t *_buffer = nullptr; - bool _isTextureView = false; -}; - -} // namespace gfx -} // namespace cc - -#endif // CC_CORE_GFX_TEXTURE_H_ diff --git a/native/cocos/renderer/frame-graph/Blackboard.h b/native/cocos/renderer/frame-graph/Blackboard.h new file mode 100644 index 0000000000..4b10afbdcf --- /dev/null +++ b/native/cocos/renderer/frame-graph/Blackboard.h @@ -0,0 +1,85 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Handle.h" +#include "base/Macros.h" + +namespace cc { +namespace framegraph { + +template +class Blackboard final { +public: + Blackboard() noexcept = default; + ~Blackboard() = default; + Blackboard(const Blackboard &) = delete; + Blackboard(Blackboard &&) = delete; + Blackboard &operator=(const Blackboard &) = delete; + Blackboard &operator=(Blackboard &&) = delete; + + CC_INLINE ValueType &operator[](const KeyType &name) noexcept; + CC_INLINE void put(const KeyType &name, ValueType const handle) noexcept; + CC_INLINE ValueType get(const KeyType &name) const noexcept; + CC_INLINE void clear() noexcept; + CC_INLINE bool has(const KeyType &name) const noexcept; + +private: + using Container = std::map; + Container _container{}; +}; + +////////////////////////////////////////////////////////////////////////// + +template +ValueType &Blackboard::operator[](const KeyType &name) noexcept { + const auto it = _container.find(name); + return (it == _container.end() ? _container.emplace(name, InvalidValue).first : it)->second; +} + +template +void Blackboard::put(const KeyType &name, ValueType const handle) noexcept { + _container[name] = handle; +} + +template +ValueType Blackboard::get(const KeyType &name) const noexcept { + const auto it = _container.find(name); + return it == _container.end() ? InvalidValue : it->second; +} + +template +void Blackboard::clear() noexcept { + _container.clear(); +} + +template +bool Blackboard::has(const KeyType &name) const noexcept { + return _container.find(name) != _container.end(); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/CallbackPass.h b/native/cocos/renderer/frame-graph/CallbackPass.h new file mode 100644 index 0000000000..4718e38894 --- /dev/null +++ b/native/cocos/renderer/frame-graph/CallbackPass.h @@ -0,0 +1,72 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "DevicePassResourceTable.h" + +namespace cc { +namespace framegraph { + +class Executable { +public: + Executable() noexcept = default; + virtual ~Executable() = default; + Executable(const Executable &) = delete; + Executable(Executable &&) = delete; + Executable &operator=(const Executable &) = delete; + Executable &operator=(Executable &&) = delete; + + virtual void execute(const DevicePassResourceTable &resourceTable) noexcept = 0; +}; + +template +class CallbackPass final : public Executable { +public: + explicit CallbackPass(ExecuteMethod &&execute) noexcept; + void execute(const DevicePassResourceTable &resourceTable) noexcept override; + CC_INLINE const Data &getData() const noexcept { return _data; } + CC_INLINE Data &getData() noexcept { return _data; } + +private: + Data _data; + ExecuteMethod _execute; +}; + +////////////////////////////////////////////////////////////////////////// + +template +CallbackPass::CallbackPass(ExecuteMethod &&execute) noexcept +: Executable(), + _execute(execute) { +} + +template +void CallbackPass::execute(const DevicePassResourceTable &resourceTable) noexcept { + _execute(_data, resourceTable); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/DevicePass.cpp b/native/cocos/renderer/frame-graph/DevicePass.cpp new file mode 100644 index 0000000000..7f92cddad4 --- /dev/null +++ b/native/cocos/renderer/frame-graph/DevicePass.cpp @@ -0,0 +1,204 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "DevicePass.h" +#include "CallbackPass.h" +#include "FrameGraph.h" +#include "PassNode.h" +#include "ResourceNode.h" +#include "gfx-base/GFXCommandBuffer.h" +#include + +namespace cc { +namespace framegraph { + +DevicePass::DevicePass(const FrameGraph &graph, std::vector const &subPassNodes) noexcept { + std::vector attachments; + + for (const PassNode *const passNode : subPassNodes) { + append(graph, passNode, attachments); + } + + std::sort(attachments.begin(), attachments.end(), RenderTargetAttachment::Sorter()); + std::vector renderTargets; + + for (auto &attachment : attachments) { + const ResourceNode &resourceNode = graph.getResourceNode(attachment.textureHandle); + CC_ASSERT(resourceNode.virtualResource); + _attachments.emplace_back(); + _attachments.back().attachment = std::move(attachment); + _attachments.back().renderTarget = static_cast *>(resourceNode.virtualResource)->getDeviceResource(); + //CC_ASSERT(_attachments.back().renderTarget); // back buffer doesn't have a device resource instance, for now + renderTargets.emplace_back(_attachments.back().renderTarget); + } + + bool const multiSubPass = subPassNodes.size() > 1; + + for (PassNode *const passNode : subPassNodes) { + _resourceTable.extract(graph, passNode, multiSubPass, renderTargets); + } +} + +void DevicePass::execute() noexcept { + auto cmdBuff = gfx::Device::getInstance()->getCommandBuffer(); + + begin(cmdBuff); + + for (Subpass &subPass : _subpasses) { + for (LogicPass &pass : subPass.logicPasses) { + + gfx::Viewport &viewport = pass.customViewport ? pass.viewport : _viewport; + gfx::Rect & scissor = pass.customViewport ? pass.scissor : _scissor; + + if (viewport != _curViewport) { + cmdBuff->setViewport(viewport); + _curViewport = viewport; + } + if (scissor != _curScissor) { + cmdBuff->setScissor(scissor); + _curScissor = scissor; + } + + pass.pass->execute(_resourceTable); + } + + next(cmdBuff); + } + + end(cmdBuff); +} + +void DevicePass::append(const FrameGraph &graph, const PassNode *passNode, std::vector &attachments) noexcept { + _subpasses.emplace_back(); + Subpass &subPass = _subpasses.back(); + + do { + subPass.logicPasses.emplace_back(); + LogicPass &logicPass = subPass.logicPasses.back(); + logicPass.pass = passNode->_pass.get(); + logicPass.customViewport = passNode->_customViewport; + logicPass.viewport = passNode->_viewport; + logicPass.scissor = passNode->_scissor; + + std::for_each(passNode->_attachments.begin(), passNode->_attachments.end(), [&, this](const RenderTargetAttachment &attachment) { + append(graph, attachment, attachments); + }); + + passNode = passNode->_next; + } while (passNode); +} + +void DevicePass::append(const FrameGraph &graph, const RenderTargetAttachment &attachment, std::vector &attachments) noexcept { + auto it = std::find_if(attachments.begin(), attachments.end(), [&attachment](const RenderTargetAttachment &x) { + return attachment.desc.usage == x.desc.usage && attachment.desc.slot == x.desc.slot; + }); + + if (it == attachments.end()) { + attachments.emplace_back(attachment); + _usedRenderTargetSlotMask |= 1 << attachment.desc.slot; + } else { + const ResourceNode &resourceNodeA = graph.getResourceNode(it->textureHandle); + const ResourceNode &resourceNodeB = graph.getResourceNode(attachment.textureHandle); + + if (resourceNodeA.virtualResource == resourceNodeB.virtualResource) { + if (attachment.storeOp != gfx::StoreOp::DISCARD) it->storeOp = attachment.storeOp; + } else { + CC_ASSERT(attachment.desc.usage == RenderTargetAttachment::Usage::COLOR); + attachments.emplace_back(attachment); + + for (uint8_t i = 0; i < RenderTargetAttachment::DEPTH_STENCIL_SLOT_START; ++i) { + if ((_usedRenderTargetSlotMask & (1 << i)) == 0) { + attachments.back().desc.slot = i; + break; + } + } + } + } +} + +void DevicePass::begin(gfx::CommandBuffer *cmdBuff) noexcept { + if (_attachments.empty()) return; + + gfx::RenderPassInfo rpInfo; + gfx::FramebufferInfo fboInfo; + float clearDepth = 1.f; + uint clearStencil = 0; + static std::vector clearColors; + clearColors.clear(); + _viewport = gfx::Viewport(); + _scissor = gfx::Rect(); + for (uint i = 0; i < _attachments.size(); ++i) { + gfx::Texture *attachment = _attachments[i].renderTarget; + if (_attachments[i].attachment.desc.usage == RenderTargetAttachment::Usage::COLOR) { + rpInfo.colorAttachments.emplace_back(); + rpInfo.colorAttachments.back().format = attachment ? attachment->getFormat() : gfx::Device::getInstance()->getColorFormat(); + rpInfo.colorAttachments.back().loadOp = _attachments[i].attachment.desc.loadOp; + rpInfo.colorAttachments.back().storeOp = _attachments[i].attachment.storeOp; + rpInfo.colorAttachments.back().beginAccesses = _attachments[i].attachment.desc.beginAccesses; + rpInfo.colorAttachments.back().endAccesses = _attachments[i].attachment.desc.endAccesses; + fboInfo.colorTextures.push_back(_attachments[i].renderTarget); + clearColors.emplace_back(_attachments[i].attachment.desc.clearColor); + _viewport.width = _scissor.width = attachment ? attachment->getWidth() : gfx::Device::getInstance()->getNativeWidth(); + _viewport.height = _scissor.height = attachment ? attachment->getHeight() : gfx::Device::getInstance()->getNativeHeight(); + } else { + rpInfo.depthStencilAttachment.format = attachment ? attachment->getFormat() : gfx::Device::getInstance()->getDepthStencilFormat(); + rpInfo.depthStencilAttachment.depthLoadOp = _attachments[i].attachment.desc.loadOp; + rpInfo.depthStencilAttachment.depthStoreOp = _attachments[i].attachment.storeOp; + rpInfo.depthStencilAttachment.stencilLoadOp = _attachments[i].attachment.desc.loadOp; + rpInfo.depthStencilAttachment.stencilStoreOp = _attachments[i].attachment.storeOp; + rpInfo.depthStencilAttachment.beginAccesses = _attachments[i].attachment.desc.beginAccesses; + rpInfo.depthStencilAttachment.endAccesses = _attachments[i].attachment.desc.endAccesses; + fboInfo.depthStencilTexture = _attachments[i].renderTarget; + clearDepth = _attachments[i].attachment.desc.clearDepth; + clearStencil = _attachments[i].attachment.desc.clearStencil; + } + } + + _renderPass = RenderPass(rpInfo); + _renderPass.createTransient(); + + fboInfo.renderPass = _renderPass.get(); + _fbo = Framebuffer(fboInfo); + _fbo.createTransient(); + + cmdBuff->beginRenderPass(_renderPass.get(), _fbo.get(), _scissor, clearColors.data(), clearDepth, clearStencil); + _curViewport = _viewport; + _curScissor = _scissor; +} + +void DevicePass::next(gfx::CommandBuffer *cmdBuff) noexcept { +} + +void DevicePass::end(gfx::CommandBuffer *cmdBuff) noexcept { + if (!_renderPass.get() || !_fbo.get()) return; + + cmdBuff->endRenderPass(); + + _renderPass.destroyTransient(); + _fbo.destroyTransient(); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/DevicePass.h b/native/cocos/renderer/frame-graph/DevicePass.h new file mode 100644 index 0000000000..59b10fa3ea --- /dev/null +++ b/native/cocos/renderer/frame-graph/DevicePass.h @@ -0,0 +1,87 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "CallbackPass.h" +#include "DevicePassResourceTable.h" +#include "RenderTargetAttachment.h" +#include "gfx-base/GFXDef.h" +#include +#include + +namespace cc { +namespace framegraph { + +class DevicePass final { +public: + DevicePass() = delete; + DevicePass(const FrameGraph &graph, std::vector const &subPassNodes) noexcept; + DevicePass(const DevicePass &) = delete; + DevicePass(DevicePass &&) = delete; + ~DevicePass() = default; + DevicePass &operator=(const DevicePass &) = delete; + DevicePass &operator=(DevicePass &&) = delete; + + void execute() noexcept; + +private: + struct LogicPass final { + Executable * pass{nullptr}; + bool customViewport{false}; + gfx::Viewport viewport; + gfx::Rect scissor; + }; + + struct Subpass final { + std::vector logicPasses{}; + }; + + struct Attachment final { + RenderTargetAttachment attachment; + gfx::Texture * renderTarget{nullptr}; + }; + + void append(const FrameGraph &graph, const PassNode *passNode, std::vector &attachments) noexcept; + void append(const FrameGraph &graph, const RenderTargetAttachment &attachment, std::vector &attachments) noexcept; + void begin(gfx::CommandBuffer *cmdBuff) noexcept; + void next(gfx::CommandBuffer *cmdBuff) noexcept; + void end(gfx::CommandBuffer *cmdBuff) noexcept; + + std::vector _subpasses{}; + std::vector _attachments{}; + uint16_t _usedRenderTargetSlotMask{0}; + DevicePassResourceTable _resourceTable; + + gfx::Viewport _viewport; + gfx::Rect _scissor; + gfx::Viewport _curViewport; + gfx::Rect _curScissor; + RenderPass _renderPass; + Framebuffer _fbo; +}; + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/DevicePassResourceTable.cpp b/native/cocos/renderer/frame-graph/DevicePassResourceTable.cpp new file mode 100644 index 0000000000..bce7564ba3 --- /dev/null +++ b/native/cocos/renderer/frame-graph/DevicePassResourceTable.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "DevicePassResourceTable.h" + +#include "FrameGraph.h" +#include "PassNode.h" +#include + +namespace cc { +namespace framegraph { + +gfx::GFXObject *DevicePassResourceTable::get(const ResourceDictionary &from, const Handle handle) noexcept { + const auto it = from.find(handle); + return it == from.cend() ? nullptr : it->second; +} + +void DevicePassResourceTable::extract(const FrameGraph & graph, + const PassNode *const passNode, + bool multiSubPass, + std::vector const &renderTargets) noexcept { + extract(graph, passNode->_reads, reads, multiSubPass, renderTargets); + extract(graph, passNode->_writes, writes, true, renderTargets); + + if (passNode->_next) { + extract(graph, passNode->_next, multiSubPass, renderTargets); + } +} + +void DevicePassResourceTable::extract(const FrameGraph & graph, + std::vector const & from, + ResourceDictionary & to, + bool ignoreRenderTarget, + std::vector const &renderTargets) noexcept { + std::for_each(from.cbegin(), from.cend(), [&](const Handle handle) { + if (to.find(handle) != to.cend()) { + return; + } + + const ResourceNode &resourceNode = graph.getResourceNode(handle); + CC_ASSERT(resourceNode.virtualResource); + gfx::GFXObject *const deviceResource = resourceNode.virtualResource->getDeviceResource(); + + if (!deviceResource) { + return; + } + + if (ignoreRenderTarget) { + bool const isRenderTarget = + std::find_if( + renderTargets.cbegin(), + renderTargets.cend(), + [&deviceResource](const gfx::Texture *const x) { + return deviceResource == x; + }) != renderTargets.cend(); + + if (isRenderTarget) { + return; + } + } + + if (deviceResource) { + to.emplace(handle, deviceResource); + } + }); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/DevicePassResourceTable.h b/native/cocos/renderer/frame-graph/DevicePassResourceTable.h new file mode 100644 index 0000000000..898f335e8d --- /dev/null +++ b/native/cocos/renderer/frame-graph/DevicePassResourceTable.h @@ -0,0 +1,82 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Handle.h" +#include "RenderTargetAttachment.h" +#include "Resource.h" +#include + +namespace cc { +namespace framegraph { + +class PassNode; +class FrameGraph; + +class DevicePassResourceTable final { +public: + DevicePassResourceTable() = default; + ~DevicePassResourceTable() = default; + DevicePassResourceTable(const DevicePassResourceTable &) = delete; + DevicePassResourceTable(DevicePassResourceTable &&) = delete; + DevicePassResourceTable &operator=(const DevicePassResourceTable &) = delete; + DevicePassResourceTable &operator=(DevicePassResourceTable &&) = delete; + + template + std::enable_if_t::value, typename Type::DeviceResource *> + getRead(TypedHandle const handle) const noexcept; + + template + std::enable_if_t::value, typename Type::DeviceResource *> + getWrite(TypedHandle const handle) const noexcept; + +private: + using ResourceDictionary = std::unordered_map; + + static gfx::GFXObject *get(const ResourceDictionary &from, const Handle handle) noexcept; + void extract(const FrameGraph &graph, const PassNode *const passNode, bool multiSubPass, std::vector const &renderTargets) noexcept; + void extract(const FrameGraph &graph, std::vector const &from, ResourceDictionary &to, bool ignoreRenderTarget, std::vector const &renderTargets) noexcept; + + ResourceDictionary reads{}; + ResourceDictionary writes{}; + + friend class DevicePass; +}; + +template +std::enable_if_t::value, typename Type::DeviceResource *> +DevicePassResourceTable::getRead(TypedHandle const handle) const noexcept { + return static_cast(get(reads, handle)); +} + +template +std::enable_if_t::value, typename Type::DeviceResource *> +DevicePassResourceTable::getWrite(TypedHandle const handle) const noexcept { + return static_cast(get(writes, handle)); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/FrameGraph.cpp b/native/cocos/renderer/frame-graph/FrameGraph.cpp new file mode 100644 index 0000000000..e4084e81c6 --- /dev/null +++ b/native/cocos/renderer/frame-graph/FrameGraph.cpp @@ -0,0 +1,623 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "FrameGraph.h" + +#include "PassNodeBuilder.h" +#include "Resource.h" +#include +#include +#include + +namespace cc { +namespace framegraph { + +namespace { +StringPool stringPool; +} + +FrameGraph::~FrameGraph() { + gc(0); +} + +StringHandle FrameGraph::stringToHandle(const char *const name) noexcept { + return stringPool.stringToHandle(name); +} + +const char *FrameGraph::handleToString(const StringHandle &handle) noexcept { + return stringPool.handleToString(handle); +} + +void FrameGraph::present(const Handle &input) noexcept { + struct PassDataPresent {}; + static const StringHandle sNamePresent = FrameGraph::stringToHandle("Present"); + const ResourceNode & resourceNode = getResourceNode(input); + CC_ASSERT(resourceNode.writer); + + addPass( + resourceNode.writer->_insertPoint, sNamePresent, + [&](PassNodeBuilder &builder, PassDataPresent &data) { + builder.read(input); + builder.sideEffect(); + }, + [](const PassDataPresent &data, const DevicePassResourceTable &table) { + }); +} + +void FrameGraph::presentLastVersion(const VirtualResource *const virtualResource) noexcept { + const auto it = std::find_if(_resourceNodes.rbegin(), _resourceNodes.rend(), [&virtualResource](const ResourceNode &node) { + return node.virtualResource == virtualResource; + }); + + CC_ASSERT(it != _resourceNodes.rend()); + present(Handle(static_cast(it.base() - _resourceNodes.begin() - 1))); +} + +void FrameGraph::presentFromBlackboard(const StringHandle &inputName) noexcept { + present(Handle(_blackboard.get(inputName))); +} + +void FrameGraph::compile() noexcept { + sort(); + cull(); + computeResourceLifetime(); + + if (_merge) { + mergePassNodes(); + } + + computeStoreActionAndMemoryless(); + generateDevicePasses(); +} + +void FrameGraph::execute() noexcept { + for (auto &pass : _devicePasses) { + pass->execute(); + } +} + +void FrameGraph::reset() noexcept { + _passNodes.clear(); + _resourceNodes.clear(); + _virtualResources.clear(); + _devicePasses.clear(); + _blackboard.clear(); +} + +void FrameGraph::gc(uint32_t const unusedFrameCount) noexcept { + Buffer::Allocator::getInstance().gc(unusedFrameCount); + Framebuffer::Allocator::getInstance().gc(unusedFrameCount); + RenderPass::Allocator::getInstance().gc(unusedFrameCount); + Texture::Allocator::getInstance().gc(unusedFrameCount); +} + +void FrameGraph::move(const TextureHandle from, const TextureHandle to, uint8_t mipmapLevel, uint8_t faceId, uint8_t arrayPosition) noexcept { + const ResourceNode &fromResourceNode = getResourceNode(from); + const ResourceNode &toResourceNode = getResourceNode(to); + + CC_ASSERT(!fromResourceNode.virtualResource->isImported()); + CC_ASSERT(fromResourceNode.writer); + CC_ASSERT(!toResourceNode.writer); + + const gfx::TextureInfo &toTextureDesc = static_cast *>(toResourceNode.virtualResource)->get().getDesc(); + uint const toTextureWidth = toTextureDesc.width >> mipmapLevel; + uint const toTextureHeight = toTextureDesc.height >> mipmapLevel; + uint const toTextureDepth = toTextureDesc.depth >> mipmapLevel; + + CC_ASSERT(toTextureWidth && toTextureHeight && toTextureDepth); + CC_ASSERT(toTextureDesc.levelCount > mipmapLevel && toTextureDesc.layerCount > arrayPosition); + CC_ASSERT(toTextureDesc.type == gfx::TextureType::CUBE && faceId < 6 || faceId == 0); + + for (ResourceNode &resourceNode : _resourceNodes) { + if (resourceNode.virtualResource == fromResourceNode.virtualResource) { + resourceNode.virtualResource = toResourceNode.virtualResource; + } + } + + for (const auto &passNode : _passNodes) { + for (auto &attachment : passNode->_attachments) { + const ResourceNode &attachmentResourceNode = getResourceNode(attachment.textureHandle); + + if (attachmentResourceNode.virtualResource == toResourceNode.virtualResource) { + const gfx::TextureInfo &attachmentTextureDesc = static_cast *>(attachmentResourceNode.virtualResource)->get().getDesc(); + CC_ASSERT(attachmentTextureDesc.width >> attachment.level == toTextureWidth && + attachmentTextureDesc.height >> attachment.level == toTextureHeight && + attachmentTextureDesc.depth >> attachment.level == toTextureDepth); + attachment.level = mipmapLevel; + attachment.layer = faceId; + attachment.index = arrayPosition; + } + } + } +} + +Handle FrameGraph::create(VirtualResource *const virtualResource) noexcept { + _virtualResources.emplace_back(virtualResource); + return createResourceNode(virtualResource); +} + +PassNode &FrameGraph::createPassNode(const PassInsertPoint insertPoint, const StringHandle &name, Executable *const pass) noexcept { + _passNodes.emplace_back(new PassNode(insertPoint, name, static_cast(_passNodes.size()), pass)); + return *_passNodes.back(); +} + +Handle FrameGraph::createResourceNode(VirtualResource *const virtualResource) noexcept { + const size_t index = _resourceNodes.size(); + ResourceNode resourceNode; + resourceNode.virtualResource = virtualResource; + resourceNode.version = virtualResource->_version; + _resourceNodes.emplace_back(resourceNode); + return Handle{static_cast(index)}; +} + +void FrameGraph::sort() noexcept { + std::stable_sort(_passNodes.begin(), _passNodes.end(), [](const auto &x, const auto &y) { + return x->_insertPoint < y->_insertPoint; + }); +} + +void FrameGraph::cull() noexcept { + for (const auto &passNode : _passNodes) { + passNode->_refCount = static_cast(passNode->_writes.size()) + passNode->_sideEffect; + + for (const Handle handle : passNode->_reads) { + CC_ASSERT(handle.isValid()); + ++_resourceNodes[handle].readerCount; + } + } + + static std::vector stack; + stack.clear(); + stack.reserve(_resourceNodes.size()); + + for (ResourceNode &resourceNode : _resourceNodes) { + if (resourceNode.readerCount == 0 && resourceNode.writer) { + stack.push_back(&resourceNode); + } + } + + while (!stack.empty()) { + PassNode *const writerPassNode = stack.back()->writer; + stack.pop_back(); + + if (writerPassNode) { + CC_ASSERT(writerPassNode->_refCount); + + if (--writerPassNode->_refCount == 0) { + CC_ASSERT(!writerPassNode->_sideEffect); + + for (const Handle handle : writerPassNode->_reads) { + ResourceNode &resourceNode = _resourceNodes[handle]; + + if (--resourceNode.readerCount == 0) { + stack.push_back(&resourceNode); + } + } + } + } + } + + for (const ResourceNode &resourceNode : _resourceNodes) { + resourceNode.virtualResource->_refCount += resourceNode.readerCount; + } +} + +void FrameGraph::computeResourceLifetime() noexcept { + for (const auto &passNode : _passNodes) { + if (passNode->_refCount == 0) { + continue; + } + + for (const Handle handle : passNode->_reads) { + _resourceNodes[handle].virtualResource->updateLifetime(passNode.get()); + } + + for (const Handle handle : passNode->_writes) { + _resourceNodes[handle].virtualResource->updateLifetime(passNode.get()); + ++_resourceNodes[handle].virtualResource->_writerCount; + } + + std::sort(passNode->_attachments.begin(), passNode->_attachments.end(), RenderTargetAttachment::Sorter()); + } + + for (const auto &resource : _virtualResources) { + CC_ASSERT(!resource->_firstUsePass == !resource->_lastUsePass); + + if (!resource->_firstUsePass || !resource->_lastUsePass) { + continue; + } + + if (resource->_refCount == 0 && !resource->_lastUsePass->getRenderTargetAttachment(*this, resource.get())) { + continue; + } + + resource->_firstUsePass->_resourceRequestArray.push_back(resource.get()); + resource->_lastUsePass->_resourceReleaseArray.push_back(resource.get()); + } +} + +void FrameGraph::mergePassNodes() noexcept { + const size_t count = _passNodes.size(); + size_t currentPassId = 0; + size_t lastPassId = 0; + + while (currentPassId < count) { + const auto ¤tPassNode = _passNodes[currentPassId]; + + if (currentPassNode->_refCount) { + break; + } + + ++currentPassId; + } + + lastPassId = currentPassId; + + while (++currentPassId < count) { + const auto ¤tPassNode = _passNodes[currentPassId]; + + if (currentPassNode->_refCount == 0) { + continue; + } + + const auto &lastPassNode = _passNodes[lastPassId]; + + if (lastPassNode->canMerge(*this, *currentPassNode)) { + auto *prevPassNode = lastPassNode.get(); + + uint16_t distance = 1; + + while (prevPassNode->_next) { + prevPassNode = prevPassNode->_next; + ++distance; + } + + prevPassNode->_next = currentPassNode.get(); + currentPassNode->_head = lastPassNode.get(); + currentPassNode->_distanceToHead = distance; + currentPassNode->_refCount = 0; + + const size_t attachmentCount = lastPassNode->_attachments.size(); + + for (size_t i = 0; i < attachmentCount; ++i) { + const RenderTargetAttachment &attachmentInLastPassNode = lastPassNode->_attachments[i]; + const RenderTargetAttachment &attachmentInCurrentPassNode = currentPassNode->_attachments[i]; + + ResourceNode &resourceNode = _resourceNodes[attachmentInLastPassNode.textureHandle]; + uint16_t & writeCount = resourceNode.virtualResource->_writerCount; + CC_ASSERT(writeCount > 1); + --writeCount; + + resourceNode.readerCount += _resourceNodes[attachmentInCurrentPassNode.textureHandle].readerCount; + resourceNode.readerCount -= attachmentInCurrentPassNode.desc.loadOp == gfx::LoadOp::LOAD; + } + } else { + lastPassId = currentPassId; + } + } +} + +void FrameGraph::computeStoreActionAndMemoryless() noexcept { + ID passId = 0; + bool lastPassSubPassEnable = false; + + for (const auto &passNode : _passNodes) { + if (passNode->_refCount == 0) { + continue; + } + + ID const oldPassId = passId; + passId += passNode->_subpass == false || lastPassSubPassEnable != passNode->_subpass; + passId += oldPassId == passId ? passNode->_hasClearedAttachment * !passNode->_clearActionIgnoreable : 0; + passNode->setDevicePassId(passId); + lastPassSubPassEnable = passNode->_subpass && !passNode->_subpassEnd; + } + + const PassNode * lastPassNode = nullptr; + static std::set renderTargets; + renderTargets.clear(); + + for (const auto &passNode : _passNodes) { + if (passNode->_refCount == 0) { + continue; + } + + for (RenderTargetAttachment &attachment : passNode->_attachments) { + CC_ASSERT(attachment.textureHandle.isValid()); + ResourceNode &resourceNode = getResourceNode(attachment.textureHandle); + + if (resourceNode.virtualResource->isImported() || resourceNode.readerCount) { + if (passNode->_subpass) { + if (passNode->_devicePassId != resourceNode.virtualResource->_lastUsePass->_devicePassId) { + attachment.storeOp = gfx::StoreOp::STORE; + } + } else { + if (attachment.desc.writeMask) { + attachment.storeOp = gfx::StoreOp::STORE; + } + } + } + + if (passNode->_subpass && attachment.desc.loadOp == gfx::LoadOp::LOAD && resourceNode.version > 1) { + ResourceNode *const resourceNodePrevVersion = getResourceNode(resourceNode.virtualResource, resourceNode.version - 1); + CC_ASSERT(resourceNodePrevVersion); + + if (resourceNodePrevVersion->writer->_devicePassId == passNode->_devicePassId) { + attachment.desc.loadOp = gfx::LoadOp::DISCARD; + resourceNodePrevVersion->writer->getRenderTargetAttachment(*this, resourceNodePrevVersion->virtualResource)->storeOp = gfx::StoreOp::DISCARD; + } + } + + if (attachment.desc.loadOp == gfx::LoadOp::LOAD) { + resourceNode.virtualResource->_neverLoaded = false; + } + + if (attachment.storeOp == gfx::StoreOp::STORE) { + resourceNode.virtualResource->_neverStored = false; + } + + renderTargets.emplace(resourceNode.virtualResource); + } + + lastPassNode = passNode.get(); + } + + for (VirtualResource *const renderTarget : renderTargets) { + const gfx::TextureInfo &textureDesc = static_cast *>(renderTarget)->get().getDesc(); + + renderTarget->_memoryless = renderTarget->_neverLoaded && renderTarget->_neverStored; + renderTarget->_memorylessMSAA = textureDesc.samples != gfx::SampleCount::X1 && renderTarget->_writerCount < 2; + // TODO: memoryless gfx::Texture + } +} + +void FrameGraph::generateDevicePasses() noexcept { + Buffer::Allocator::getInstance().tick(); + Framebuffer::Allocator::getInstance().tick(); + RenderPass::Allocator::getInstance().tick(); + Texture::Allocator::getInstance().tick(); + + ID passId = 1; + + static std::vector subPassNodes; + subPassNodes.clear(); + + for (const auto &passNode : _passNodes) { + if (passNode->_refCount == 0) { + continue; + } + + if (passId != passNode->_devicePassId) { + _devicePasses.emplace_back(new DevicePass(*this, subPassNodes)); + + for (PassNode *const p : subPassNodes) { + p->releaseTransientResources(); + } + + subPassNodes.clear(); + passId = passNode->_devicePassId; + } + + passNode->requestTransientResources(); + subPassNodes.emplace_back(passNode.get()); + } + + CC_ASSERT(subPassNodes.size() == 1); + static const StringHandle sNamePresent = FrameGraph::stringToHandle("Present"); + + if (subPassNodes.back()->_name != sNamePresent) { + _devicePasses.emplace_back(new DevicePass(*this, subPassNodes)); + + for (PassNode *const p : subPassNodes) { + p->releaseTransientResources(); + } + } +} + +// https://dreampuf.github.io/GraphvizOnline/ +void FrameGraph::exportGraphViz(const std::string &path) { + std::ofstream out(path, std::ios::out | std::ios::binary); + //out.imbue(std::locale("chs", std::locale::ctype)); + + if (out.fail()) { + return; + } + + out << "digraph framegraph {\n"; + out << "rankdir = LR\n"; + out << "bgcolor = black\n"; + out << "node [shape=rectangle, fontname=\"helvetica\", fontsize=10]\n\n"; + + for (const auto &node : _passNodes) { + if (node->_head) { + continue; + } + + out << "\"P" << node->_id << "\" [label=\"" << node->_name.str(); + + const PassNode *currPassNode = node.get(); + + if (currPassNode->_head) { + out << "\\n(merged by pass " << currPassNode->_head->_name.str() << ")"; + } else { + while (currPassNode->_next) { + currPassNode = currPassNode->_next; + out << " & " << currPassNode->_name.str(); + } + } + + out << "\\nrefs: " << node->_refCount + << "\\nseq: " << node->_id + << "\\ndevice pass id: " << node->_devicePassId + << "\", style=filled, fillcolor=" + << (node->_refCount ? "darkorange" : "darkorange4") << "]\n"; + } + + out << "\n"; + + for (const ResourceNode &node : _resourceNodes) { + if (node.writer && node.writer->_head) { + continue; + } + + out << "\"R" << node.virtualResource->_id << "_" << +node.version << "\"" + "[label=\"" + << node.virtualResource->_name.str() << "\\n(version: " << +node.version << ")" + << "\\nrefs:" << node.virtualResource->_refCount; + + if (node.virtualResource->_memoryless) { + out << "\\nMemoryless"; + } + + if (node.virtualResource->_memorylessMSAA) { + out << "\\nMemorylessMSAA"; + } + + PassNode *const writer = (node.writer && node.writer->_head) ? node.writer->_head : node.writer; + + if (writer) { + out << "\\n"; + const RenderTargetAttachment *const attachment = writer->getRenderTargetAttachment(*this, node.virtualResource); + + if (attachment) { + switch (attachment->desc.loadOp) { + case gfx::LoadOp::DISCARD: + out << "Discard"; + break; + case gfx::LoadOp::CLEAR: + out << "Clear"; + break; + default: + out << "Load"; + break; + } + out << ", "; + out << (attachment->storeOp == gfx::StoreOp::DISCARD ? "DontCare" : "Store"); + out << "\\nWriteMask: 0x" << std::hex << (uint32_t)attachment->desc.writeMask << std::dec; + } else { + out << "Transfer"; + } + } + + out << "\", style=filled, fillcolor=" + << ((node.virtualResource->isImported()) ? (node.virtualResource->_refCount ? "palegreen" : "palegreen4") : node.version == 0 ? "pink" : (node.virtualResource->_refCount ? "skyblue" : "skyblue4")) + << "]\n"; + } + + out << "\n"; + + for (const auto &node : _passNodes) { + if (node->_head) { + continue; + } + + out << "P" << node->_id << " -> { "; + + for (const Handle writer : node->_writes) { + out << "R" << _resourceNodes[writer].virtualResource->_id << "_" << +_resourceNodes[writer].version << " "; + } + + out << "} [color=red]\n"; + } + + out << "\n"; + + for (const ResourceNode &node : _resourceNodes) { + if (node.writer && node.writer->_head) { + continue; + } + + out << "R" << node.virtualResource->_id << "_" << +node.version << " -> { "; + + for (const auto &passNode : _passNodes) { + if (passNode->_head) { + continue; + } + + for (Handle read : passNode->_reads) { + const ResourceNode *readResourceNode = &_resourceNodes[read]; + + if (readResourceNode->writer && readResourceNode->writer->_head) { + const Handle resourceNodeHandlePrevVersion = readResourceNode->writer->_head->getWriteResourceNodeHandle(*this, readResourceNode->virtualResource); + CC_ASSERT(resourceNodeHandlePrevVersion.isValid()); + readResourceNode = &getResourceNode(resourceNodeHandlePrevVersion); + } + + if (readResourceNode->virtualResource->_id == node.virtualResource->_id && + readResourceNode->version == node.version) { + out << "P" << passNode->_id << " "; + } + } + } + + out << "} [color=green]\n"; + } + + for (const ResourceNode &node : _resourceNodes) { + if (node.writer && node.writer->_head) { + continue; + } + + out << "R" << node.virtualResource->_id << "_" << +node.version << " -> { "; + + for (const auto &passNode : _passNodes) { + if (passNode->_head) { + continue; + } + + for (const RenderTargetAttachment &attachment : passNode->_attachments) { + const ResourceNode *readResourceNode = &_resourceNodes[attachment.textureHandle]; + uint16_t const distanceToHead = readResourceNode->writer->_distanceToHead; + + if (readResourceNode->writer && readResourceNode->writer->_head) { + const Handle resourceNodeHandleHead = readResourceNode->writer->_head->getWriteResourceNodeHandle(*this, readResourceNode->virtualResource); + CC_ASSERT(resourceNodeHandleHead.isValid()); + readResourceNode = &getResourceNode(resourceNodeHandleHead); + } + + if (readResourceNode->virtualResource == node.virtualResource && + readResourceNode->version == node.version + 1 - distanceToHead) { + out << "P" << passNode->_id << " "; + } + } + } + + out << "} [color=red4]\n"; + } + + out << "}" << std::endl; + out.close(); +} + +ResourceNode *FrameGraph::getResourceNode(const VirtualResource *const virtualResource, uint8_t version) noexcept { + const auto it = std::find_if(_resourceNodes.begin(), _resourceNodes.end(), [&](const ResourceNode &node) { + return node.version == version && node.virtualResource == virtualResource; + }); + + return it == _resourceNodes.end() ? nullptr : &(*it); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/FrameGraph.h b/native/cocos/renderer/frame-graph/FrameGraph.h new file mode 100644 index 0000000000..63db8afd5d --- /dev/null +++ b/native/cocos/renderer/frame-graph/FrameGraph.h @@ -0,0 +1,145 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Blackboard.h" +#include "CallbackPass.h" +#include "DevicePass.h" +#include "PassNode.h" +#include "PassNodeBuilder.h" +#include "ResourceEntry.h" +#include "ResourceNode.h" +#include +#include +#include + +namespace cc { +namespace framegraph { + +class FrameGraph final { +public: + using ResourceHandleBlackboard = Blackboard; + + FrameGraph() = default; + ~FrameGraph(); + FrameGraph(const FrameGraph &) = delete; + FrameGraph(FrameGraph &&) = delete; + FrameGraph &operator=(const FrameGraph &) = delete; + FrameGraph &operator=(FrameGraph &&) = delete; + + static StringHandle stringToHandle(const char *const name) noexcept; + static const char * handleToString(const StringHandle &handle) noexcept; + + void present(const Handle &input) noexcept; + void presentLastVersion(const VirtualResource *const virtualResource) noexcept; + void presentFromBlackboard(const StringHandle &inputName) noexcept; + void compile() noexcept; + void execute() noexcept; + void reset() noexcept; + static void gc(uint32_t const unusedFrameCount = 30) noexcept; + + template + CallbackPass const &addPass(const PassInsertPoint insertPoint, const StringHandle &name, SetupMethod setup, ExecuteMethod &&execute) noexcept; + + template + TypedHandle create(const StringHandle &name, const typename ResourceType::Descriptor &desc) noexcept; + template + TypedHandle importExternal(const StringHandle &name, ResourceType &resource) noexcept; + void move(const TextureHandle from, const TextureHandle to, uint8_t mipmapLevel, uint8_t faceId, uint8_t arrayPosition) noexcept; + + CC_INLINE ResourceNode &getResourceNode(const Handle handle) noexcept { return _resourceNodes[handle]; } + CC_INLINE const ResourceNode &getResourceNode(const Handle handle) const noexcept { return _resourceNodes[handle]; } + CC_INLINE ResourceHandleBlackboard &getBlackboard() noexcept { return _blackboard; } + + void exportGraphViz(const std::string &path); + CC_INLINE void enableMerge(bool const enable) noexcept; + +private: + Handle create(VirtualResource *const virtualResource) noexcept; + PassNode & createPassNode(const PassInsertPoint insertPoint, const StringHandle &name, Executable *const pass) noexcept; + Handle createResourceNode(VirtualResource *const virtualResource) noexcept; + void sort() noexcept; + void cull() noexcept; + void computeResourceLifetime() noexcept; + void mergePassNodes() noexcept; + void computeStoreActionAndMemoryless() noexcept; + void generateDevicePasses() noexcept; + ResourceNode *getResourceNode(const VirtualResource *const virtualResource, uint8_t version) noexcept; + + std::vector> _passNodes{}; + std::vector _resourceNodes{}; + std::vector> _virtualResources{}; + std::vector> _devicePasses{}; + ResourceHandleBlackboard _blackboard; + bool _merge{true}; + + friend class PassNode; + friend class PassNodeBuilder; +}; + +////////////////////////////////////////////////////////////////////////// + +template +const CallbackPass &FrameGraph::addPass(const PassInsertPoint insertPoint, const StringHandle &name, SetupMethod setup, ExecuteMethod &&execute) noexcept { + static_assert(sizeof(ExecuteMethod) < 1024, "Execute() lambda is capturing too much data."); + auto *const pass = new CallbackPass(std::forward(execute)); + PassNode & passNode = createPassNode(insertPoint, name, pass); + PassNodeBuilder builder(*this, passNode); + setup(builder, pass->getData()); + return *pass; +} + +template +TypedHandle FrameGraph::create(const StringHandle &name, const typename ResourceType::Descriptor &desc) noexcept { + auto *const virtualResource = new ResourceEntry(name, static_cast(_virtualResources.size()), desc); + return TypedHandle(create(virtualResource)); +} + +template +TypedHandle FrameGraph::importExternal(const StringHandle &name, ResourceType &resource) noexcept { + //CC_ASSERT(resource.Get()); // back buffer doesn't have a device resource instance, for now + auto *const virtualResource = new ResourceEntry(name, static_cast(_virtualResources.size()), resource); + return TypedHandle(create(virtualResource)); +} + +void FrameGraph::enableMerge(bool const enable) noexcept { + _merge = enable; +} + +////////////////////////////////////////////////////////////////////////// + +template +void PassNodeBuilder::create(TypedHandle &handle, const StringHandle &name, const typename ResourceType::Descriptor &desc) const noexcept { + handle = _graph.create(name, desc); +} + +template +void PassNodeBuilder::importExternal(TypedHandle &handle, const StringHandle &name, ResourceType &resource) const noexcept { + handle = _graph.importExternal(name, resource); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/Handle.h b/native/cocos/renderer/frame-graph/Handle.h new file mode 100644 index 0000000000..62fb410dc2 --- /dev/null +++ b/native/cocos/renderer/frame-graph/Handle.h @@ -0,0 +1,46 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/IndexHandle.h" +#include "base/StringPool.h" + +namespace cc { +namespace framegraph { + +using Handle = cc::IndexHandle; +using StringHandle = cc::StringHandle; +using StringPool = cc::StringPool; + +template +class TypedHandle final : public Handle { +public: + using Type = T; + using Handle::Handle; +}; + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/PassInsertPointManager.cpp b/native/cocos/renderer/frame-graph/PassInsertPointManager.cpp new file mode 100644 index 0000000000..ae9d0acdd4 --- /dev/null +++ b/native/cocos/renderer/frame-graph/PassInsertPointManager.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "PassInsertPointManager.h" +#include "base/Macros.h" + +namespace cc { +namespace framegraph { + +PassInsertPointManager &PassInsertPointManager::getInstance() noexcept { + static PassInsertPointManager instance; + return instance; +} + +PassInsertPoint PassInsertPointManager::record(const char *const name, const PassInsertPoint point) noexcept { + StringHandle nameHandle = _stringPool.find(name); + + if (nameHandle.isValid()) { + CC_ASSERT(point == get(nameHandle)); + return get(nameHandle); + } else { + nameHandle = _stringPool.stringToHandle(name); + CC_ASSERT(nameHandle == _insertPoints.size()); + _insertPoints.emplace_back(point); + return point; + } +} + +PassInsertPoint PassInsertPointManager::get(const char *const name) const noexcept { + const StringHandle nameHandle = _stringPool.find(name); + CC_ASSERT(nameHandle.isValid()); + return get(nameHandle); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/PassInsertPointManager.h b/native/cocos/renderer/frame-graph/PassInsertPointManager.h new file mode 100644 index 0000000000..567e13a8d0 --- /dev/null +++ b/native/cocos/renderer/frame-graph/PassInsertPointManager.h @@ -0,0 +1,66 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include "Handle.h" +#include "base/Macros.h" + +namespace cc { +namespace framegraph { + +using PassInsertPoint = uint16_t; + +class PassInsertPointManager final { +public: + PassInsertPointManager(const PassInsertPointManager &) = delete; + PassInsertPointManager(PassInsertPointManager &&) = delete; + PassInsertPointManager &operator=(const PassInsertPointManager &) = delete; + PassInsertPointManager &operator=(PassInsertPointManager &&) = delete; + + static PassInsertPointManager &getInstance() noexcept; + + PassInsertPoint record(const char *name, PassInsertPoint point) noexcept; + PassInsertPoint get(const char *name) const noexcept; + +private: + PassInsertPointManager() = default; + ~PassInsertPointManager() = default; + + CC_INLINE PassInsertPoint get(StringHandle name) const noexcept; + + StringPool _stringPool; + std::vector _insertPoints{}; +}; + +////////////////////////////////////////////////////////////////////////// + +PassInsertPoint PassInsertPointManager::get(const StringHandle name) const noexcept { + return _insertPoints[name]; +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/PassNode.cpp b/native/cocos/renderer/frame-graph/PassNode.cpp new file mode 100644 index 0000000000..0b457bc130 --- /dev/null +++ b/native/cocos/renderer/frame-graph/PassNode.cpp @@ -0,0 +1,200 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "PassNode.h" +#include "FrameGraph.h" +#include "ResourceNode.h" +#include + +namespace cc { +namespace framegraph { + +PassNode::PassNode(const PassInsertPoint inserPoint, const StringHandle name, const ID &id, Executable *pass) noexcept +: _pass(pass), + _name(name), + _id(id), + _insertPoint(inserPoint) { + CC_ASSERT(_name.isValid()); +} + +Handle PassNode::read(FrameGraph &graph, const Handle &input) noexcept { + CC_ASSERT(check(graph, input, _writes)); + const auto it = std::find_if(_reads.begin(), _reads.end(), [input](const Handle handle) { + return input == handle; + }); + + if (it == _reads.end()) { + _reads.push_back(input); + } + + return input; +} + +Handle PassNode::write(FrameGraph &graph, const Handle &output) noexcept { + CC_ASSERT(check(graph, output, _reads)); + CC_ASSERT(std::find_if(_writes.begin(), _writes.end(), [output](const Handle handle) { + return output == handle; + }) == _writes.end()); + + const ResourceNode &nodeOldVersion = graph.getResourceNode(output); + nodeOldVersion.virtualResource->newVersion(); + _sideEffect = _sideEffect || nodeOldVersion.virtualResource->isImported(); + const Handle handle = graph.createResourceNode(nodeOldVersion.virtualResource); + ResourceNode &nodeNewVersion = graph.getResourceNode(handle); + nodeNewVersion.writer = this; + _writes.push_back(handle); + return handle; +} + +void PassNode::createRenderTargetAttachment(RenderTargetAttachment &&attachment) noexcept { + if (attachment.desc.usage == RenderTargetAttachment::Usage::COLOR) { + if (attachment.desc.slot == 0xff) { + for (uint8_t i = 0; i < RenderTargetAttachment::DEPTH_STENCIL_SLOT_START; ++i) { + if ((_usedRenderTargetSlotMask & (1 << i)) == 0) { + attachment.desc.slot = i; + break; + } + } + } else { + CC_ASSERT(attachment.desc.slot < RenderTargetAttachment::DEPTH_STENCIL_SLOT_START); + } + } else { + attachment.desc.slot = RenderTargetAttachment::DEPTH_STENCIL_SLOT_START + static_cast(attachment.desc.usage) - 1; + + if (attachment.desc.usage == RenderTargetAttachment::Usage::DEPTH_STENCIL) { + CC_ASSERT((_usedRenderTargetSlotMask & (1 << (RenderTargetAttachment::DEPTH_STENCIL_SLOT_START + static_cast(RenderTargetAttachment::Usage::DEPTH) - 1))) == 0); + CC_ASSERT((_usedRenderTargetSlotMask & (1 << (RenderTargetAttachment::DEPTH_STENCIL_SLOT_START + static_cast(RenderTargetAttachment::Usage::STENCIL) - 1))) == 0); + } else { + CC_ASSERT((_usedRenderTargetSlotMask & (1 << (RenderTargetAttachment::DEPTH_STENCIL_SLOT_START + static_cast(attachment.desc.usage) - 1))) == 0); + } + } + + CC_ASSERT((_usedRenderTargetSlotMask & (1 << attachment.desc.slot)) == 0); + _usedRenderTargetSlotMask |= (1 << attachment.desc.slot); + + _attachments.emplace_back(attachment); + _hasClearedAttachment = _hasClearedAttachment || (attachment.desc.loadOp == gfx::LoadOp::CLEAR); +} + +bool PassNode::canMerge(const FrameGraph &graph, const PassNode &passNode) const noexcept { + const size_t attachmentCount = _attachments.size(); + + if (passNode._hasClearedAttachment || attachmentCount != passNode._attachments.size()) { + return false; + } + + for (size_t i = 0; i < attachmentCount; ++i) { + const RenderTargetAttachment &attachmentInPassNodeA = _attachments[i]; + const RenderTargetAttachment &attachmentInPassNodeB = passNode._attachments[i]; + + if (attachmentInPassNodeA.desc.usage != attachmentInPassNodeB.desc.usage || + attachmentInPassNodeA.desc.slot != attachmentInPassNodeB.desc.slot || + attachmentInPassNodeA.desc.writeMask != attachmentInPassNodeB.desc.writeMask || + attachmentInPassNodeA.level != attachmentInPassNodeB.level || + attachmentInPassNodeA.layer != attachmentInPassNodeB.layer || + attachmentInPassNodeA.index != attachmentInPassNodeB.index || + graph.getResourceNode(attachmentInPassNodeA.textureHandle).virtualResource != graph.getResourceNode(attachmentInPassNodeB.textureHandle).virtualResource) { + return false; + } + } + + return true; +} + +RenderTargetAttachment *PassNode::getRenderTargetAttachment(const Handle &handle) noexcept { + const auto it = std::find_if(_attachments.begin(), _attachments.end(), [&handle](const RenderTargetAttachment &attachment) { + return attachment.textureHandle == handle; + }); + + return it == _attachments.end() ? nullptr : &(*it); +} + +RenderTargetAttachment *PassNode::getRenderTargetAttachment(const FrameGraph &graph, const VirtualResource *const resource) noexcept { + const auto it = std::find_if(_attachments.begin(), _attachments.end(), [&](const RenderTargetAttachment &attachment) { + return graph.getResourceNode(attachment.textureHandle).virtualResource == resource; + }); + + return it == _attachments.end() ? nullptr : &(*it); +} + +void PassNode::requestTransientResources() noexcept { + std::for_each(_resourceRequestArray.begin(), _resourceRequestArray.end(), [](VirtualResource *const resource) { + if (!resource->isImported()) { + resource->request(); + } + }); + + if (_next) { + _next->requestTransientResources(); + } +} + +void PassNode::releaseTransientResources() noexcept { + std::for_each(_resourceReleaseArray.begin(), _resourceReleaseArray.end(), [](VirtualResource *const resource) { + if (!resource->isImported()) { + resource->release(); + } + }); + + if (_next) { + _next->releaseTransientResources(); + } +} + +bool PassNode::check(FrameGraph &graph, const Handle &checkingHandle, std::vector const &handles) const noexcept { + // render target can not do both read & write + const VirtualResource *const inputResource = graph.getResourceNode(checkingHandle).virtualResource; + const auto it = std::find_if(handles.begin(), handles.end(), [&](Handle handle) { + return inputResource == graph.getResourceNode(handle).virtualResource; + }); + + if (it == handles.end()) { + return true; + } + + const Handle output = *it; + return std::find_if(_attachments.cbegin(), _attachments.cend(), [&output](const RenderTargetAttachment &attachment) { + return attachment.textureHandle == output; + }) == _attachments.end(); +} + +void PassNode::setDevicePassId(ID const id) noexcept { + _devicePassId = id; + + if (_next) { + _next->setDevicePassId(id); + } +} + +Handle PassNode::getWriteResourceNodeHandle(const FrameGraph &graph, const VirtualResource *const resource) const noexcept { + const auto it = std::find_if(_writes.begin(), _writes.end(), [&](const Handle handle) { + return graph.getResourceNode(handle).virtualResource == resource; + }); + + return it == _writes.end() ? Handle{} : *it; +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/PassNode.h b/native/cocos/renderer/frame-graph/PassNode.h new file mode 100644 index 0000000000..a1bdd8ae39 --- /dev/null +++ b/native/cocos/renderer/frame-graph/PassNode.h @@ -0,0 +1,116 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "CallbackPass.h" +#include "Handle.h" +#include "PassInsertPointManager.h" +#include "RenderTargetAttachment.h" +#include "VirtualResource.h" +#include "gfx-base/GFXDef.h" +#include + +namespace cc { +namespace framegraph { + +class FrameGraph; + +class PassNode final { +public: + PassNode(const PassInsertPoint inserPoint, const StringHandle name, const ID &id, Executable *pass) noexcept; + ~PassNode() = default; + PassNode(PassNode &&) noexcept = default; + PassNode(const PassNode &) = delete; + PassNode &operator=(const PassNode &) = delete; + PassNode &operator=(PassNode &&) = delete; + + Handle read(FrameGraph &graph, const Handle &input) noexcept; + Handle write(FrameGraph &graph, const Handle &output) noexcept; + void createRenderTargetAttachment(RenderTargetAttachment &&attachment) noexcept; + CC_INLINE void sideEffect() noexcept; + CC_INLINE void subpass(bool clearActionIgnoreable, bool const end) noexcept; + CC_INLINE void setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept; + +private: + bool canMerge(const FrameGraph &graph, const PassNode &passNode) const noexcept; + RenderTargetAttachment *getRenderTargetAttachment(const Handle &handle) noexcept; + RenderTargetAttachment *getRenderTargetAttachment(const FrameGraph &graph, const VirtualResource *const resource) noexcept; + void requestTransientResources() noexcept; + void releaseTransientResources() noexcept; + bool check(FrameGraph &graph, const Handle &checkingHandle, std::vector const &handles) const noexcept; + void setDevicePassId(ID const id) noexcept; + Handle getWriteResourceNodeHandle(const FrameGraph &graph, const VirtualResource *const resource) const noexcept; + + std::unique_ptr _pass{nullptr}; + std::vector _reads{}; + std::vector _writes{}; + std::vector _attachments{}; + std::vector _resourceRequestArray{}; + std::vector _resourceReleaseArray{}; + const StringHandle _name; + uint32_t _refCount{0}; + PassNode * _head{nullptr}; + PassNode * _next{nullptr}; + uint16_t _distanceToHead{0}; + uint16_t _usedRenderTargetSlotMask{0}; + ID const _id{0}; + ID _devicePassId{0}; + const PassInsertPoint _insertPoint{0}; + bool _sideEffect{false}; + bool _subpass{false}; + bool _subpassEnd{false}; + bool _hasClearedAttachment{false}; + bool _clearActionIgnoreable{false}; + + bool _customViewport{false}; + gfx::Viewport _viewport; + gfx::Rect _scissor; + + friend class FrameGraph; + friend class DevicePass; + friend class DevicePassResourceTable; +}; + +////////////////////////////////////////////////////////////////////////// + +void PassNode::sideEffect() noexcept { + _sideEffect = true; +} + +void PassNode::subpass(bool clearActionIgnoreable, bool const end) noexcept { + _subpass = true; + _clearActionIgnoreable = clearActionIgnoreable; + _subpassEnd = end; +} + +void PassNode::setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept { + _customViewport = true; + _viewport = viewport; + _scissor = scissor; +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/PassNodeBuilder.cpp b/native/cocos/renderer/frame-graph/PassNodeBuilder.cpp new file mode 100644 index 0000000000..1c5d9601ca --- /dev/null +++ b/native/cocos/renderer/frame-graph/PassNodeBuilder.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "PassNodeBuilder.h" +#include "FrameGraph.h" + +namespace cc { +namespace framegraph { + +PassNodeBuilder::PassNodeBuilder(FrameGraph &graph, PassNode &passNode) noexcept +: _graph(graph), + _passNode(passNode) { +} + +Handle PassNodeBuilder::read(const Handle &input) const noexcept { + return _passNode.read(_graph, input); +} + +TextureHandle PassNodeBuilder::write(const TextureHandle &output, uint8_t mipmapLevel, uint8_t faceId, uint8_t arrayPosition, const RenderTargetAttachment::Descriptor &attachmentDesc) const noexcept { + const TextureHandle handle(_passNode.write(_graph, output)); + RenderTargetAttachment attachment; + attachment.textureHandle = handle; + attachment.desc = attachmentDesc; + attachment.level = mipmapLevel; + attachment.layer = faceId; + attachment.index = arrayPosition; + _passNode.createRenderTargetAttachment(std::forward(attachment)); + + if (attachmentDesc.loadOp == gfx::LoadOp::LOAD) { + ResourceNode &outputResourceNode = _graph.getResourceNode(output); + ++outputResourceNode.readerCount; + } + + return handle; +} + +TextureHandle PassNodeBuilder::write(const TextureHandle &output, const RenderTargetAttachment::Descriptor &attachmentDesc) const noexcept { + return write(output, 0, 0, 0, attachmentDesc); +} + +void PassNodeBuilder::writeToBlackboard(const StringHandle &name, const Handle &handle) const noexcept { + _graph.getBlackboard().put(name, handle); +} + +Handle PassNodeBuilder::readFromBlackboard(const StringHandle &name) const noexcept { + return Handle(_graph.getBlackboard().get(name)); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/PassNodeBuilder.h b/native/cocos/renderer/frame-graph/PassNodeBuilder.h new file mode 100644 index 0000000000..d994783020 --- /dev/null +++ b/native/cocos/renderer/frame-graph/PassNodeBuilder.h @@ -0,0 +1,92 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "PassNode.h" + +namespace cc { +namespace framegraph { + +class PassNodeBuilder final { +public: + PassNodeBuilder(FrameGraph &graph, PassNode &passNode) noexcept; + PassNodeBuilder() = delete; + ~PassNodeBuilder() = default; + PassNodeBuilder(const PassNodeBuilder &) = delete; + PassNodeBuilder(PassNodeBuilder &&) = delete; + PassNodeBuilder &operator=(const PassNodeBuilder &) = delete; + PassNodeBuilder &operator=(PassNodeBuilder &&) = delete; + + template + void create(TypedHandle &handle, const StringHandle &name, const typename ResourceType::Descriptor &desc) const noexcept; + template + void importExternal(TypedHandle &handle, const StringHandle &name, ResourceType &resource) const noexcept; + template + TypedHandle read(TypedHandle const &input) const noexcept; + Handle read(const Handle &input) const noexcept; + template + TypedHandle write(TypedHandle const &output) const noexcept; + TextureHandle write(const TextureHandle &output, uint8_t mipmapLevel, uint8_t faceId, uint8_t arrayPosition, const RenderTargetAttachment::Descriptor &attachmentDesc) const noexcept; + TextureHandle write(const TextureHandle &output, const RenderTargetAttachment::Descriptor &attachmentDesc) const noexcept; + + CC_INLINE void sideEffect() const noexcept; + CC_INLINE void subpass(bool clearActionIgnoreable, bool const end) const noexcept; + CC_INLINE void setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept; + + void writeToBlackboard(const StringHandle &name, const Handle &handle) const noexcept; + Handle readFromBlackboard(const StringHandle &name) const noexcept; + +private: + FrameGraph &_graph; + PassNode & _passNode; +}; + +////////////////////////////////////////////////////////////////////////// + +template +TypedHandle PassNodeBuilder::read(TypedHandle const &input) const noexcept { + return TypedHandle(read(static_cast(input))); +} + +template +TypedHandle PassNodeBuilder::write(TypedHandle const &output) const noexcept { + return TypedHandle(_passNode.write(_graph, output)); +} + +void PassNodeBuilder::sideEffect() const noexcept { + _passNode.sideEffect(); +} + +void PassNodeBuilder::subpass(bool clearActionIgnoreable, bool const end) const noexcept { + _passNode.subpass(clearActionIgnoreable, end); +} + +void PassNodeBuilder::setViewport(const gfx::Viewport &viewport, const gfx::Rect &scissor) noexcept { + _passNode.setViewport(viewport, scissor); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/RenderTargetAttachment.h b/native/cocos/renderer/frame-graph/RenderTargetAttachment.h new file mode 100644 index 0000000000..603e9d63bd --- /dev/null +++ b/native/cocos/renderer/frame-graph/RenderTargetAttachment.h @@ -0,0 +1,83 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "Resource.h" + +namespace cc { +namespace framegraph { + +struct RenderTargetAttachment final { + using StoreOp = gfx::StoreOp; + using LoadOp = gfx::LoadOp; + using Color = gfx::Color; + + enum class Usage : uint8_t { + COLOR, + DEPTH, + STENCIL, + DEPTH_STENCIL, + }; + + struct Descriptor final { + Usage usage{Usage::COLOR}; + uint8_t slot{0xff}; + uint8_t writeMask{0xff}; + LoadOp loadOp{LoadOp::DISCARD}; + Color clearColor; + float clearDepth{1.f}; + uint8_t clearStencil{0u}; + + std::vector beginAccesses; + std::vector endAccesses; + }; + + struct Sorter { + CC_INLINE bool operator()(const RenderTargetAttachment &a1, const RenderTargetAttachment &a2) const noexcept; + }; + + static constexpr uint8_t DEPTH_STENCIL_SLOT_START{13}; + + TextureHandle textureHandle{}; + Descriptor desc; + uint8_t level{0}; + uint8_t layer{0}; + uint8_t index{0}; + StoreOp storeOp{StoreOp::DISCARD}; +}; + +CC_INLINE bool RenderTargetAttachment::Sorter::operator()(const RenderTargetAttachment &a1, const RenderTargetAttachment &a2) const noexcept { + if (a1.desc.usage < a2.desc.usage) { + return true; + } else if (a1.desc.usage == a2.desc.usage) { + return a1.desc.slot < a2.desc.slot; + } else { + return false; + } +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/Resource.h b/native/cocos/renderer/frame-graph/Resource.h new file mode 100644 index 0000000000..5afd90fc72 --- /dev/null +++ b/native/cocos/renderer/frame-graph/Resource.h @@ -0,0 +1,174 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "ResourceAllocator.h" + +#include "Handle.h" +#include "renderer/gfx-base/GFXBuffer.h" +#include "renderer/gfx-base/GFXDevice.h" +#include "renderer/gfx-base/GFXFramebuffer.h" +#include "renderer/gfx-base/GFXGlobalBarrier.h" +#include "renderer/gfx-base/GFXRenderPass.h" +#include "renderer/gfx-base/GFXTexture.h" +#include "renderer/gfx-base/GFXTextureBarrier.h" + +namespace cc { +namespace framegraph { + +template +struct ResourceDescriptorHasher final { + CC_INLINE uint32_t operator()(const DescriptorType &desc) const { + return 1; + } +}; + +template +struct DeviceResourceCreator final { + CC_INLINE DeviceResourceType *operator()(const DescriptorType &desc) const { + return nullptr; + } +}; + +template , + typename DescriptorHasherType = ResourceDescriptorHasher> +class Resource final { +public: + using Allocator = ResourceAllocator; + using DescriptorHash = typename Allocator::DescriptorHash; + using DeviceResource = DeviceResourceType; + using Descriptor = DescriptorType; + using DescriptorHasher = DescriptorHasherType; + + Resource() = default; + explicit Resource(const Descriptor &desc) noexcept; + ~Resource() = default; + Resource(const Resource &) = default; + Resource(Resource &&) noexcept = default; + Resource &operator=(const Resource &) = default; + Resource &operator=(Resource &&) noexcept = default; + + void createTransient() noexcept; + void createPersistent() noexcept; + void destroyTransient() noexcept; + void destroyPersistent() noexcept; + CC_INLINE DeviceResourceType *get() const noexcept; + CC_INLINE const Descriptor &getDesc() const noexcept; + +private: + void computeHash() noexcept; + + Descriptor _desc; + DescriptorHash _hash{0}; + DeviceResourceType *_deviceObject{nullptr}; +}; + +////////////////////////////////////////////////////////////////////////// + +template +Resource::Resource(const Descriptor &desc) noexcept +: _desc(desc) { +} + +template +void Resource::createTransient() noexcept { + computeHash(); + _deviceObject = Allocator::getInstance().alloc(_desc, _hash); +} + +template +void Resource::createPersistent() noexcept { + computeHash(); + + if (!_deviceObject) { + DeviceResourceCreatorType creator; + _deviceObject = creator(_desc); + } +} + +template +void Resource::destroyTransient() noexcept { + CC_ASSERT(_hash); + Allocator::getInstance().free(_desc, _hash, _deviceObject); + _deviceObject = nullptr; +} + +template +void Resource::destroyPersistent() noexcept { + if (_deviceObject) { + delete _deviceObject; + _deviceObject = nullptr; + } +} + +template +DeviceResourceType *Resource::get() const noexcept { + return _deviceObject; +} + +template +const DescriptorType &Resource::getDesc() const noexcept { + return _desc; +} + +template +void Resource::computeHash() noexcept { + if (!_hash) { + DescriptorHasher hasher; + _hash = hasher(_desc); + } +} + +////////////////////////////////////////////////////////////////////////// + +#define DEFINE_GFX_RESOURCE(Type) \ + template <> \ + struct ResourceDescriptorHasher final { \ + CC_INLINE uint32_t operator()(const gfx::Type##Info &desc) const { \ + return gfx::Type::computeHash(desc); \ + } \ + }; \ + \ + template <> \ + struct DeviceResourceCreator final { \ + CC_INLINE gfx::Type *operator()(const gfx::Type##Info &desc) const { \ + return gfx::Device::getInstance()->create##Type(desc); \ + } \ + }; \ + \ + using Type = Resource; /* NOLINT(bugprone-macro-parentheses) N/A */ \ + using Type##Handle = TypedHandle; + +DEFINE_GFX_RESOURCE(Buffer) +DEFINE_GFX_RESOURCE(Framebuffer) +DEFINE_GFX_RESOURCE(GlobalBarrier) +DEFINE_GFX_RESOURCE(RenderPass) +DEFINE_GFX_RESOURCE(Texture) +DEFINE_GFX_RESOURCE(TextureBarrier) + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/ResourceAllocator.h b/native/cocos/renderer/frame-graph/ResourceAllocator.h new file mode 100644 index 0000000000..67cdb817dc --- /dev/null +++ b/native/cocos/renderer/frame-graph/ResourceAllocator.h @@ -0,0 +1,202 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include "base/memory/Memory.h" + +namespace cc { +namespace framegraph { + +template +class ResourceAllocator final { +public: + using DescriptorHash = uint32_t; + using DeviceResourceCreator = DeviceResourceCreatorType; + + ResourceAllocator(const ResourceAllocator &) = delete; + ResourceAllocator(ResourceAllocator &&) = delete; + ResourceAllocator &operator=(const ResourceAllocator &) = delete; + ResourceAllocator &operator=(ResourceAllocator &&) = delete; + + static ResourceAllocator &getInstance() noexcept; + DeviceResourceType * alloc(const DescriptorType &desc, DescriptorHash const key) noexcept; + void free(const DescriptorType &desc, DescriptorHash const key, DeviceResourceType *const resource) noexcept; + CC_INLINE void tick() noexcept; + void gc(uint32_t const unusedFrameCount) noexcept; + +private: + using DeviceResourcePtr = DeviceResourceType *; + + struct Bucket { + explicit Bucket(DescriptorHash const key) noexcept : key(key) {} + + using Pool = std::vector; + DescriptorHash key{0}; + Pool pool{}; + }; + + struct BucketGC final : public Bucket { + using Bucket::Bucket; + std::vector ages{}; + }; + + ResourceAllocator() noexcept = default; + ~ResourceAllocator() = default; + template + typename Bucket::Pool *getPool(DescriptorHash const key, Cache &from) noexcept; + BucketGC & getBucketGC(DescriptorHash const key) noexcept; + + std::vector _free{}; + std::vector _inUse{}; + uint64_t _age{0}; +}; + +////////////////////////////////////////////////////////////////////////// + +template +ResourceAllocator &ResourceAllocator::getInstance() noexcept { + static ResourceAllocator instance; + return instance; +} + +template +DeviceResourceType *ResourceAllocator::alloc(const DescriptorType &desc, DescriptorHash const key) noexcept { + auto it = std::find_if(_free.begin(), _free.end(), [&key](const BucketGC &x) { + return key == x.key; + }); + + if (it == _free.end()) { + _free.emplace_back(key); + _inUse.emplace_back(key); + it = _free.end() - 1; + } + + DeviceResourcePtr resource = nullptr; + + if (it->pool.empty()) { + DeviceResourceCreator creator; + resource = creator(desc); + } else { + resource = it->pool.back(); + it->pool.pop_back(); + it->ages.pop_back(); + } + + getPool(key, _inUse)->emplace_back(resource); + return resource; +} + +template +void ResourceAllocator::free(const DescriptorType &desc, DescriptorHash const key, DeviceResourceType *const resource) noexcept { + auto *pool = getPool(key, _inUse); + CC_ASSERT(!pool->empty()); + + auto it = std::find_if(pool->begin(), pool->end(), [&resource](DeviceResourcePtr x) { + return resource == x; + }); + CC_ASSERT(it != pool->end()); + pool->erase(it); + + auto &freeBucket = getBucketGC(key); + freeBucket.pool.emplace_back(resource); + freeBucket.ages.emplace_back(_age); +} + +template +void ResourceAllocator::tick() noexcept { + ++_age; +} + +template +void ResourceAllocator::gc(uint32_t const unusedFrameCount) noexcept { + std::for_each(_free.begin(), _free.end(), [&](BucketGC &bucket) { + const size_t count = bucket.ages.size(); + + if (!count) { + return; + } + + size_t destroyBegin = count - 1; + + for (size_t i = 0; i < count; ++i) { + if (_age - bucket.ages[i] < unusedFrameCount) { + continue; + } + + size_t j = destroyBegin; + + for (; j > i; --j) { + if (_age - bucket.ages[j] < unusedFrameCount) { + std::swap(bucket.ages[i], bucket.ages[j]); + std::swap(bucket.pool[i], bucket.pool[j]); + destroyBegin = j - 1; + break; + } + } + + if (i >= j) { + destroyBegin = i - 1; + } + + if (i >= destroyBegin) { + break; + } + } + + while (++destroyBegin < count) { + CC_SAFE_DESTROY(bucket.pool.back()); + bucket.pool.pop_back(); + bucket.ages.pop_back(); + } + }); +} + +template +template +typename ResourceAllocator::Bucket::Pool * +ResourceAllocator::getPool( + DescriptorHash const key, Cache &from) noexcept { + auto it = std::find_if(from.begin(), from.end(), [&key](const Bucket &x) { + return key == x.key; + }); + + return it == from.end() ? nullptr : &it->pool; +} + +template +typename ResourceAllocator::BucketGC & +ResourceAllocator::getBucketGC(DescriptorHash const key) noexcept { + auto it = std::find_if(_free.begin(), _free.end(), [&key](const BucketGC &x) { + return key == x.key; + }); + + CC_ASSERT(it != _free.end()); + return *it; +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/ResourceEntry.h b/native/cocos/renderer/frame-graph/ResourceEntry.h new file mode 100644 index 0000000000..aa2c5a19f0 --- /dev/null +++ b/native/cocos/renderer/frame-graph/ResourceEntry.h @@ -0,0 +1,85 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "VirtualResource.h" + +namespace cc { +namespace framegraph { + +template ::value>> +class ResourceEntry final : public VirtualResource { +public: + explicit ResourceEntry(const StringHandle name, ID const id, const typename ResourceType::Descriptor &desc) noexcept; + ResourceEntry(const StringHandle name, ID const id, const ResourceType &resource) noexcept; + ResourceEntry() = delete; + ~ResourceEntry() = default; + ResourceEntry(const ResourceEntry &) = delete; + ResourceEntry(ResourceEntry &&) = delete; + ResourceEntry &operator=(const ResourceEntry &) = delete; + ResourceEntry &operator=(ResourceEntry &&) = delete; + + void request() noexcept override; + void release() noexcept override; + typename ResourceType::DeviceResource *getDeviceResource() const noexcept override; + + CC_INLINE const ResourceType &get() const noexcept { return _resource; } + +private: + ResourceType _resource; +}; + +////////////////////////////////////////////////////////////////////////// + +template +ResourceEntry::ResourceEntry(const StringHandle name, ID const id, const typename ResourceType::Descriptor &desc) noexcept +: VirtualResource(name, id, false), + _resource(desc) { +} + +template +ResourceEntry::ResourceEntry(const StringHandle name, ID const id, const ResourceType &resource) noexcept +: VirtualResource(name, id, true), + _resource(resource) { +} + +template +void ResourceEntry::request() noexcept { + _resource.createTransient(); +} + +template +void ResourceEntry::release() noexcept { + _resource.destroyTransient(); +} + +template +typename ResourceType::DeviceResource *ResourceEntry::getDeviceResource() const noexcept { + return _resource.get(); +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/ResourceNode.h b/native/cocos/renderer/frame-graph/ResourceNode.h new file mode 100644 index 0000000000..8e68ccb3d1 --- /dev/null +++ b/native/cocos/renderer/frame-graph/ResourceNode.h @@ -0,0 +1,39 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +namespace cc { +namespace framegraph { + +struct ResourceNode final { + VirtualResource *virtualResource{nullptr}; + PassNode * writer{nullptr}; + uint32_t readerCount{0}; + uint8_t version{0}; +}; + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/VirtualResource.cpp b/native/cocos/renderer/frame-graph/VirtualResource.cpp new file mode 100644 index 0000000000..4484ed2b89 --- /dev/null +++ b/native/cocos/renderer/frame-graph/VirtualResource.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "VirtualResource.h" + +namespace cc { +namespace framegraph { + +VirtualResource::VirtualResource(const StringHandle name, ID const id, bool const imported) noexcept +: _name(name), + _id(id), + _imported(imported) { + CC_ASSERT(_name.isValid()); +} + +void VirtualResource::updateLifetime(PassNode *const passNode) noexcept { + _firstUsePass = _firstUsePass ? _firstUsePass : passNode; + _lastUsePass = passNode; +} + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/frame-graph/VirtualResource.h b/native/cocos/renderer/frame-graph/VirtualResource.h new file mode 100644 index 0000000000..3a9d3879ff --- /dev/null +++ b/native/cocos/renderer/frame-graph/VirtualResource.h @@ -0,0 +1,74 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "renderer/gfx-base/GFXObject.h" +#include "Handle.h" + +namespace cc { +namespace framegraph { + +class PassNode; + +using ID = uint16_t; + +class VirtualResource { +public: + VirtualResource(const StringHandle name, ID const id, bool const imported) noexcept; + VirtualResource() noexcept = delete; + virtual ~VirtualResource() = default; + VirtualResource(const VirtualResource &) = delete; + VirtualResource(VirtualResource &&) = delete; + VirtualResource &operator=(const VirtualResource &) = delete; + VirtualResource &operator=(VirtualResource &&) = delete; + + virtual void request() noexcept = 0; + virtual void release() noexcept = 0; + bool isImported() const noexcept { return _imported; } + void updateLifetime(PassNode *const passNode) noexcept; + void newVersion() noexcept { ++_version; } + + virtual gfx::GFXObject *getDeviceResource() const noexcept = 0; + +private: + PassNode * _firstUsePass{nullptr}; + PassNode * _lastUsePass{nullptr}; + const StringHandle _name; + uint32_t _refCount{0}; + uint16_t _writerCount{0}; + ID _id{0}; + uint8_t _version{0}; + bool const _imported{false}; + bool _neverLoaded{true}; + bool _neverStored{true}; + bool _memoryless{false}; + bool _memorylessMSAA{false}; + + friend class FrameGraph; +}; + +} // namespace framegraph +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/BufferAgent.cpp b/native/cocos/renderer/gfx-agent/BufferAgent.cpp new file mode 100644 index 0000000000..78543dd512 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/BufferAgent.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferAgent.h" +#include "DeviceAgent.h" +#include "LinearAllocatorPool.h" + +namespace cc { +namespace gfx { + +BufferAgent::~BufferAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + BufferDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void BufferAgent::doInit(const BufferInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + BufferInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void BufferAgent::doInit(const BufferViewInfo &info) { + BufferViewInfo actorInfo = info; + actorInfo.buffer = static_cast(info.buffer)->getActor(); + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + BufferViewInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void BufferAgent::doResize(uint size, uint /*count*/) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + BufferResize, + actor, getActor(), + size, size, + { + actor->resize(size); + }); +} + +void BufferAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + BufferDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +void BufferAgent::update(const void *buffer, uint size) { + auto *actorBuffer = DeviceAgent::getInstance()->getMainAllocator()->allocate(size); + memcpy(actorBuffer, buffer, size); + + ENQUEUE_MESSAGE_3( + DeviceAgent::getInstance()->getMessageQueue(), + BufferUpdate, + actor, getActor(), + buffer, actorBuffer, + size, size, + { + actor->update(buffer, size); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/BufferAgent.h b/native/cocos/renderer/gfx-agent/BufferAgent.h new file mode 100644 index 0000000000..7c9054937e --- /dev/null +++ b/native/cocos/renderer/gfx-agent/BufferAgent.h @@ -0,0 +1,49 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXBuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL BufferAgent final : public Agent { +public: + using Agent::Agent; + ~BufferAgent() override; + + void update(const void *buffer, uint size) override; + +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doResize(uint size, uint count) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp b/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp new file mode 100644 index 0000000000..9e89cacc04 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/CommandBufferAgent.cpp @@ -0,0 +1,469 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/job-system/JobSystem.h" +#include "base/threading/MessageQueue.h" + +#include "BufferAgent.h" +#include "CommandBufferAgent.h" +#include "DescriptorSetAgent.h" +#include "DeviceAgent.h" +#include "FramebufferAgent.h" +#include "InputAssemblerAgent.h" +#include "LinearAllocatorPool.h" +#include "PipelineStateAgent.h" +#include "QueueAgent.h" +#include "RenderPassAgent.h" +#include "TextureAgent.h" + +namespace cc { +namespace gfx { + +void CommandBufferAgent::flushCommands(uint count, CommandBufferAgent *const *cmdBuffs, bool multiThreaded) { + uint jobThreadCount = JobSystem::getInstance()->threadCount(); + uint workForThisThread = (count - 1) / jobThreadCount + 1; // ceil(count / jobThreadCount) + + if (count > workForThisThread + 1 && multiThreaded) { // more than one job to dispatch + JobGraph g(JobSystem::getInstance()); + g.createForEachIndexJob(workForThisThread, count, 1U, [cmdBuffs](uint i) { + cmdBuffs[i]->getMessageQueue()->flushMessages(); + }); + g.run(); + + for (uint i = 0U; i < workForThisThread; ++i) { + cmdBuffs[i]->getMessageQueue()->flushMessages(); + } + g.waitForAll(); + } else { + for (uint i = 0U; i < count; ++i) { + cmdBuffs[i]->getMessageQueue()->flushMessages(); + } + } +} + +CommandBufferAgent::~CommandBufferAgent() { + destroyMessageQueue(); + + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), CommandBufferDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void CommandBufferAgent::initMessageQueue() { + _allocatorPools.resize(MAX_CPU_FRAME_AHEAD + 1); + + for (uint i = 0U; i < MAX_CPU_FRAME_AHEAD + 1; ++i) { + _allocatorPools[i] = CC_NEW(LinearAllocatorPool); + } + DeviceAgent *device = DeviceAgent::getInstance(); + device->_cmdBuffRefs.insert(this); + + _messageQueue = CC_NEW(MessageQueue); + if (device->_multithreaded) _messageQueue->setImmediateMode(false); +} + +void CommandBufferAgent::destroyMessageQueue() { + DeviceAgent::getInstance()->getMessageQueue()->kickAndWait(); + CC_SAFE_DELETE(_messageQueue); + + DeviceAgent::getInstance()->_cmdBuffRefs.erase(this); + for (LinearAllocatorPool *pool : _allocatorPools) { + CC_SAFE_DELETE(pool); + } + _allocatorPools.clear(); +} + +LinearAllocatorPool *CommandBufferAgent::getAllocator() { + return _allocatorPools[DeviceAgent::getInstance()->_currentIndex]; +} + +void CommandBufferAgent::doInit(const CommandBufferInfo &info) { + initMessageQueue(); + + CommandBufferInfo actorInfo = info; + actorInfo.queue = static_cast(info.queue)->getActor(); + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), CommandBufferInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void CommandBufferAgent::doDestroy() { + destroyMessageQueue(); + + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), CommandBufferDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +void CommandBufferAgent::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) { + ENQUEUE_MESSAGE_4( + _messageQueue, + CommandBufferBegin, + actor, getActor(), + renderPass, renderPass ? static_cast(renderPass)->getActor() : nullptr, + subpass, subpass, + frameBuffer, frameBuffer ? static_cast(frameBuffer)->getActor() : nullptr, + { + actor->begin(renderPass, subpass, frameBuffer); + }); +} + +void CommandBufferAgent::end() { + ENQUEUE_MESSAGE_1( + _messageQueue, CommandBufferEnd, + actor, getActor(), + { + actor->end(); + }); +} + +void CommandBufferAgent::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) { + uint attachmentCount = static_cast(renderPass->getColorAttachments().size()); + Color *actorColors = nullptr; + if (attachmentCount) { + actorColors = getAllocator()->allocate(attachmentCount); + memcpy(actorColors, colors, sizeof(Color) * attachmentCount); + } + + CommandBuffer **actorSecondaryCBs = nullptr; + if (secondaryCBCount) { + actorSecondaryCBs = getAllocator()->allocate(secondaryCBCount); + for (uint i = 0; i < secondaryCBCount; ++i) { + actorSecondaryCBs[i] = static_cast(secondaryCBs[i])->getActor(); + } + } + + ENQUEUE_MESSAGE_9( + _messageQueue, CommandBufferBeginRenderPass, + actor, getActor(), + renderPass, static_cast(renderPass)->getActor(), + fbo, static_cast(fbo)->getActor(), + renderArea, renderArea, + colors, actorColors, + depth, depth, + stencil, stencil, + secondaryCBCount, secondaryCBCount, + secondaryCBs, actorSecondaryCBs, + { + actor->beginRenderPass(renderPass, fbo, renderArea, colors, depth, stencil, secondaryCBs, secondaryCBCount); + }); +} + +void CommandBufferAgent::endRenderPass() { + ENQUEUE_MESSAGE_1( + _messageQueue, CommandBufferEndRenderPass, + actor, getActor(), + { + actor->endRenderPass(); + }); +} + +void CommandBufferAgent::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { + if (!count) return; + + auto **actorCmdBuffs = getAllocator()->allocate(count); + for (uint i = 0; i < count; ++i) { + actorCmdBuffs[i] = static_cast(cmdBuffs[i])->getActor(); + } + + ENQUEUE_MESSAGE_3( + _messageQueue, CommandBufferExecute, + actor, getActor(), + cmdBuffs, actorCmdBuffs, + count, count, + { + actor->execute(cmdBuffs, count); + }); +} + +void CommandBufferAgent::bindPipelineState(PipelineState *pso) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferBindPipelineState, + actor, getActor(), + pso, static_cast(pso)->getActor(), + { + actor->bindPipelineState(pso); + }); +} + +void CommandBufferAgent::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) { + uint *actorDynamicOffsets = nullptr; + if (dynamicOffsetCount) { + actorDynamicOffsets = getAllocator()->allocate(dynamicOffsetCount); + memcpy(actorDynamicOffsets, dynamicOffsets, dynamicOffsetCount * sizeof(uint)); + } + + ENQUEUE_MESSAGE_5( + _messageQueue, CommandBufferBindDescriptorSet, + actor, getActor(), + set, set, + descriptorSet, static_cast(descriptorSet)->getActor(), + dynamicOffsetCount, dynamicOffsetCount, + dynamicOffsets, actorDynamicOffsets, + { + actor->bindDescriptorSet(set, descriptorSet, dynamicOffsetCount, dynamicOffsets); + }); +} + +void CommandBufferAgent::bindInputAssembler(InputAssembler *ia) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferBindInputAssembler, + actor, getActor(), + ia, static_cast(ia)->getActor(), + { + actor->bindInputAssembler(ia); + }); +} + +void CommandBufferAgent::setViewport(const Viewport &vp) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferSetViewport, + actor, getActor(), + vp, vp, + { + actor->setViewport(vp); + }); +} + +void CommandBufferAgent::setScissor(const Rect &rect) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferSetScissor, + actor, getActor(), + rect, rect, + { + actor->setScissor(rect); + }); +} + +void CommandBufferAgent::setLineWidth(float width) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferSetLineWidth, + actor, getActor(), + width, width, + { + actor->setLineWidth(width); + }); +} + +void CommandBufferAgent::setDepthBias(float constant, float clamp, float slope) { + ENQUEUE_MESSAGE_4( + _messageQueue, CommandBufferSetDepthBias, + actor, getActor(), + constant, constant, + clamp, clamp, + slope, slope, + { + actor->setDepthBias(constant, clamp, slope); + }); +} + +void CommandBufferAgent::setBlendConstants(const Color &constants) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferSetBlendConstants, + actor, getActor(), + constants, constants, + { + actor->setBlendConstants(constants); + }); +} + +void CommandBufferAgent::setDepthBound(float minBounds, float maxBounds) { + ENQUEUE_MESSAGE_3( + _messageQueue, CommandBufferSetDepthBound, + actor, getActor(), + minBounds, minBounds, + maxBounds, maxBounds, + { + actor->setDepthBound(minBounds, maxBounds); + }); +} + +void CommandBufferAgent::setStencilWriteMask(StencilFace face, uint mask) { + ENQUEUE_MESSAGE_3( + _messageQueue, CommandBufferSetStencilWriteMask, + actor, getActor(), + face, face, + mask, mask, + { + actor->setStencilWriteMask(face, mask); + }); +} + +void CommandBufferAgent::setStencilCompareMask(StencilFace face, int ref, uint mask) { + ENQUEUE_MESSAGE_4( + _messageQueue, CommandBufferSetStencilCompareMask, + actor, getActor(), + face, face, + ref, ref, + mask, mask, + { + actor->setStencilCompareMask(face, ref, mask); + }); +} + +void CommandBufferAgent::nextSubpass() { + ENQUEUE_MESSAGE_1( + _messageQueue, CommandBufferNextSubpass, + actor, getActor(), + { + actor->nextSubpass(); + }); +} + +void CommandBufferAgent::draw(const DrawInfo &info) { + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferDraw, + actor, getActor(), + info, info, + { + actor->draw(info); + }); +} + +void CommandBufferAgent::updateBuffer(Buffer *buff, const void *data, uint size) { + MessageQueue *queue = _messageQueue; + + auto *actorData = getAllocator()->allocate(size); + memcpy(actorData, data, size); + + ENQUEUE_MESSAGE_4( + queue, CommandBufferUpdateBuffer, + actor, getActor(), + buff, static_cast(buff)->getActor(), + data, actorData, + size, size, + { + actor->updateBuffer(buff, data, size); + }); +} + +void CommandBufferAgent::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { + LinearAllocatorPool *allocator = getAllocator(); + + auto *actorRegions = allocator->allocate(count); + memcpy(actorRegions, regions, count * sizeof(BufferTextureCopy)); + + uint bufferCount = 0U; + for (uint i = 0U; i < count; i++) { + bufferCount += regions[i].texSubres.layerCount; + } + const auto **actorBuffers = allocator->allocate(bufferCount); + for (uint i = 0U, n = 0U; i < count; i++) { + const BufferTextureCopy ®ion = regions[i]; + uint size = formatSize(texture->getFormat(), region.texExtent.width, region.texExtent.height, 1); + for (uint l = 0; l < region.texSubres.layerCount; l++) { + auto *buffer = allocator->allocate(size); + memcpy(buffer, buffers[n], size); + actorBuffers[n++] = buffer; + } + } + + ENQUEUE_MESSAGE_5( + _messageQueue, CommandBufferCopyBuffersToTexture, + actor, getActor(), + buffers, actorBuffers, + texture, static_cast(texture)->getActor(), + regions, actorRegions, + count, count, + { + actor->copyBuffersToTexture(buffers, texture, regions, count); + }); +} + +void CommandBufferAgent::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { + Texture *actorSrcTexture = nullptr; + Texture *actorDstTexture = nullptr; + if (srcTexture) actorSrcTexture = static_cast(srcTexture)->getActor(); + if (dstTexture) actorDstTexture = static_cast(dstTexture)->getActor(); + + auto *actorRegions = getAllocator()->allocate(count); + memcpy(actorRegions, regions, count * sizeof(TextureBlit)); + + ENQUEUE_MESSAGE_6( + _messageQueue, CommandBufferBlitTexture, + actor, getActor(), + srcTexture, actorSrcTexture, + dstTexture, actorDstTexture, + regions, actorRegions, + count, count, + filter, filter, + { + actor->blitTexture(srcTexture, dstTexture, regions, count, filter); + }); +} + +void CommandBufferAgent::dispatch(const DispatchInfo &info) { + DispatchInfo actorInfo = info; + if (info.indirectBuffer) actorInfo.indirectBuffer = static_cast(info.indirectBuffer)->getActor(); + + ENQUEUE_MESSAGE_2( + _messageQueue, CommandBufferDispatch, + actor, getActor(), + info, actorInfo, + { + actor->dispatch(info); + }); +} + +void CommandBufferAgent::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) { + TextureBarrier **actorTextureBarriers = nullptr; + Texture ** actorTextures = nullptr; + + if (textureBarrierCount) { + actorTextureBarriers = getAllocator()->allocate(textureBarrierCount); + memcpy(actorTextureBarriers, textureBarriers, textureBarrierCount * sizeof(uintptr_t)); + + actorTextures = getAllocator()->allocate(textureBarrierCount); + for (uint i = 0U; i < textureBarrierCount; ++i) { + actorTextures[i] = textures[i] ? static_cast(textures[i])->getActor() : nullptr; + } + } + + ENQUEUE_MESSAGE_5( + _messageQueue, CommandBufferPipelineBarrier, + actor, getActor(), + barrier, barrier, + textureBarriers, actorTextureBarriers, + textures, actorTextures, + textureBarrierCount, textureBarrierCount, + { + actor->pipelineBarrier(barrier, textureBarriers, textures, textureBarrierCount); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/CommandBufferAgent.h b/native/cocos/renderer/gfx-agent/CommandBufferAgent.h new file mode 100644 index 0000000000..ddf033cd36 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/CommandBufferAgent.h @@ -0,0 +1,90 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXCommandBuffer.h" + +namespace cc { + +class MessageQueue; + +namespace gfx { + +class LinearAllocatorPool; + +class CC_DLL CommandBufferAgent final : public Agent { +public: + using Agent::Agent; + ~CommandBufferAgent() override; + + static void flushCommands(uint count, CommandBufferAgent *const *cmdBuffs, bool multiThreaded); + + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void bindPipelineState(PipelineState *pso) override; + void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; + void bindInputAssembler(InputAssembler *ia) override; + void setViewport(const Viewport &vp) override; + void setScissor(const Rect &rect) override; + void setLineWidth(float width) override; + void setDepthBias(float constant, float clamp, float slope) override; + void setBlendConstants(const Color &constants) override; + void setDepthBound(float minBounds, float maxBounds) override; + void setStencilWriteMask(StencilFace face, uint mask) override; + void setStencilCompareMask(StencilFace face, int ref, uint mask) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; + + uint getNumDrawCalls() const override { return _actor->getNumDrawCalls(); } + uint getNumInstances() const override { return _actor->getNumInstances(); } + uint getNumTris() const override { return _actor->getNumTris(); } + + CC_INLINE MessageQueue *getMessageQueue() { return _messageQueue; } + LinearAllocatorPool *getAllocator(); + +protected: + friend class DeviceAgent; + + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; + + void initMessageQueue(); + void destroyMessageQueue(); + MessageQueue *_messageQueue = nullptr; + vector _allocatorPools; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/DescriptorSetAgent.cpp b/native/cocos/renderer/gfx-agent/DescriptorSetAgent.cpp new file mode 100644 index 0000000000..435e567ea4 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/DescriptorSetAgent.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferAgent.h" +#include "DescriptorSetAgent.h" +#include "DescriptorSetLayoutAgent.h" +#include "DeviceAgent.h" +#include "SamplerAgent.h" +#include "TextureAgent.h" + +namespace cc { +namespace gfx { + +DescriptorSetAgent::~DescriptorSetAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void DescriptorSetAgent::doInit(const DescriptorSetInfo &info) { + DescriptorSetInfo actorInfo; + actorInfo.layout = static_cast(info.layout)->getActor(); + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void DescriptorSetAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +void DescriptorSetAgent::update() { + _isDirty = false; + + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetUpdate, + actor, getActor(), + { + actor->update(); + }); +} + +void DescriptorSetAgent::bindBuffer(uint binding, Buffer *buffer, uint index) { + DescriptorSet::bindBuffer(binding, buffer, index); + + ENQUEUE_MESSAGE_4( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetBindBuffer, + actor, getActor(), + binding, binding, + buffer, static_cast(buffer)->getActor(), + index, index, + { + actor->bindBuffer(binding, buffer, index); + }); +} + +void DescriptorSetAgent::bindTexture(uint binding, Texture *texture, uint index) { + DescriptorSet::bindTexture(binding, texture, index); + + ENQUEUE_MESSAGE_4( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetBindTexture, + actor, getActor(), + binding, binding, + texture, static_cast(texture)->getActor(), + index, index, + { + actor->bindTexture(binding, texture, index); + }); +} + +void DescriptorSetAgent::bindSampler(uint binding, Sampler *sampler, uint index) { + DescriptorSet::bindSampler(binding, sampler, index); + + ENQUEUE_MESSAGE_4( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetBindSampler, + actor, getActor(), + binding, binding, + sampler, static_cast(sampler)->getActor(), + index, index, + { + actor->bindSampler(binding, sampler, index); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/DescriptorSetAgent.h b/native/cocos/renderer/gfx-agent/DescriptorSetAgent.h new file mode 100644 index 0000000000..35e89019db --- /dev/null +++ b/native/cocos/renderer/gfx-agent/DescriptorSetAgent.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXDescriptorSet.h" + +namespace cc { +namespace gfx { + +class CC_DLL DescriptorSetAgent final : public Agent { +public: + using Agent::Agent; + ~DescriptorSetAgent() override; + + void update() override; + + void bindBuffer(uint binding, Buffer *buffer, uint index) override; + void bindTexture(uint binding, Texture *texture, uint index) override; + void bindSampler(uint binding, Sampler *sampler, uint index) override; + +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.cpp b/native/cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.cpp new file mode 100644 index 0000000000..4811a5bc8e --- /dev/null +++ b/native/cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceAgent.h" +#include "DescriptorSetLayoutAgent.h" + +namespace cc { +namespace gfx { + +DescriptorSetLayoutAgent::~DescriptorSetLayoutAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetLayoutDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void DescriptorSetLayoutAgent::doInit(const DescriptorSetLayoutInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetLayoutInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void DescriptorSetLayoutAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + DescriptorSetLayoutDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.h b/native/cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.h new file mode 100644 index 0000000000..417b585df0 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXDescriptorSetLayout.h" + +namespace cc { +namespace gfx { + +class CC_DLL DescriptorSetLayoutAgent final : public Agent { +public: + using Agent::Agent; + ~DescriptorSetLayoutAgent() override; + +protected: + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/DeviceAgent.cpp b/native/cocos/renderer/gfx-agent/DeviceAgent.cpp new file mode 100644 index 0000000000..3e9e565e70 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/DeviceAgent.cpp @@ -0,0 +1,346 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferAgent.h" +#include "CommandBufferAgent.h" +#include "DescriptorSetAgent.h" +#include "DescriptorSetLayoutAgent.h" +#include "DeviceAgent.h" +#include "FramebufferAgent.h" +#include "InputAssemblerAgent.h" +#include "LinearAllocatorPool.h" +#include "PipelineLayoutAgent.h" +#include "PipelineStateAgent.h" +#include "QueueAgent.h" +#include "RenderPassAgent.h" +#include "SamplerAgent.h" +#include "ShaderAgent.h" +#include "TextureAgent.h" + +namespace cc { +namespace gfx { + +DeviceAgent *DeviceAgent::instance = nullptr; + +DeviceAgent *DeviceAgent::getInstance() { + return DeviceAgent::instance; +} + +DeviceAgent::DeviceAgent(Device *device) : Agent(device) { + DeviceAgent::instance = this; +} + +DeviceAgent::~DeviceAgent() { + CC_SAFE_DELETE(_actor); + DeviceAgent::instance = nullptr; +} + +bool DeviceAgent::doInit(const DeviceInfo &info) { + if (!_actor->initialize(info)) { + return false; + } + + _context = _actor->getContext(); + _api = _actor->getGfxAPI(); + _deviceName = _actor->getDeviceName(); + _queue = CC_NEW(QueueAgent(_actor->getQueue())); + _cmdBuff = CC_NEW(CommandBufferAgent(_actor->getCommandBuffer())); + static_cast(_cmdBuff)->_queue = _queue; + _renderer = _actor->getRenderer(); + _vendor = _actor->getVendor(); + _caps = _actor->_caps; + memcpy(_features, _actor->_features, static_cast(Feature::COUNT) * sizeof(bool)); + + _mainEncoder = CC_NEW(MessageQueue); + + _allocatorPools.resize(MAX_CPU_FRAME_AHEAD + 1); + for (uint i = 0U; i < MAX_CPU_FRAME_AHEAD + 1; ++i) { + _allocatorPools[i] = CC_NEW(LinearAllocatorPool); + } + static_cast(_cmdBuff)->initMessageQueue(); + + setMultithreaded(true); + + return true; +} + +void DeviceAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + getMessageQueue(), DeviceDestroy, + actor, getActor(), + { + actor->destroy(); + }); + + if (_cmdBuff) { + static_cast(_cmdBuff)->destroyMessageQueue(); + static_cast(_cmdBuff)->_actor = nullptr; + CC_DELETE(_cmdBuff); + _cmdBuff = nullptr; + } + if (_queue) { + static_cast(_queue)->_actor = nullptr; + CC_DELETE(_queue); + _queue = nullptr; + } + + _mainEncoder->terminateConsumerThread(); + CC_SAFE_DELETE(_mainEncoder); + + for (LinearAllocatorPool *pool : _allocatorPools) { + CC_SAFE_DELETE(pool); + } + _allocatorPools.clear(); +} + +void DeviceAgent::resize(uint width, uint height) { + ENQUEUE_MESSAGE_3( + getMessageQueue(), DeviceResize, + actor, getActor(), + width, width, + height, height, + { + actor->resize(width, height); + }); +} + +void DeviceAgent::acquire() { + ENQUEUE_MESSAGE_1( + _mainEncoder, DeviceAcquire, + actor, getActor(), + { + actor->acquire(); + }); +} + +void DeviceAgent::present() { + ENQUEUE_MESSAGE_2( + _mainEncoder, DevicePresent, + actor, getActor(), + frameBoundarySemaphore, &_frameBoundarySemaphore, + { + actor->present(); + frameBoundarySemaphore->signal(); + }); + + MessageQueue::freeChunksInFreeQueue(_mainEncoder); + _mainEncoder->finishWriting(); + _currentIndex = (_currentIndex + 1) % (MAX_CPU_FRAME_AHEAD + 1); + _frameBoundarySemaphore.wait(); + + getMainAllocator()->reset(); + for (CommandBufferAgent *cmdBuff : _cmdBuffRefs) { + cmdBuff->_allocatorPools[_currentIndex]->reset(); + } +} + +void DeviceAgent::setMultithreaded(bool multithreaded) { + if (multithreaded == _multithreaded) return; + _multithreaded = multithreaded; + + if (multithreaded) { + _mainEncoder->setImmediateMode(false); + _actor->bindRenderContext(false); + _mainEncoder->runConsumerThread(); + ENQUEUE_MESSAGE_1( + _mainEncoder, DeviceMakeCurrentTrue, + actor, _actor, + { + actor->bindDeviceContext(true); + CC_LOG_INFO("Device thread detached."); + }); + for (CommandBufferAgent *cmdBuff : _cmdBuffRefs) { + cmdBuff->_messageQueue->setImmediateMode(false); + } + } else { + ENQUEUE_MESSAGE_1( + _mainEncoder, DeviceMakeCurrentFalse, + actor, _actor, + { + actor->bindDeviceContext(false); + }); + _mainEncoder->terminateConsumerThread(); + _mainEncoder->setImmediateMode(true); + _actor->bindRenderContext(true); + for (CommandBufferAgent *cmdBuff : _cmdBuffRefs) { + cmdBuff->_messageQueue->setImmediateMode(true); + } + CC_LOG_INFO("Device thread joined."); + } +} + +void DeviceAgent::releaseSurface(uintptr_t windowHandle) { + ENQUEUE_MESSAGE_2( + _mainEncoder, DeviceReleaseSurface, + actor, _actor, + windowHandle, windowHandle, + { + actor->releaseSurface(windowHandle); + }); +} + +void DeviceAgent::acquireSurface(uintptr_t windowHandle) { + ENQUEUE_MESSAGE_2( + _mainEncoder, DeviceAcquireSurface, + actor, _actor, + windowHandle, windowHandle, + { + actor->acquireSurface(windowHandle); + }); +} + +CommandBuffer *DeviceAgent::createCommandBuffer(const CommandBufferInfo &info, bool /*hasAgent*/) { + CommandBuffer *actor = _actor->createCommandBuffer(info, true); + return CC_NEW(CommandBufferAgent(actor)); +} + +Queue *DeviceAgent::createQueue() { + Queue *actor = _actor->createQueue(); + return CC_NEW(QueueAgent(actor)); +} + +Buffer *DeviceAgent::createBuffer() { + Buffer *actor = _actor->createBuffer(); + return CC_NEW(BufferAgent(actor)); +} + +Texture *DeviceAgent::createTexture() { + Texture *actor = _actor->createTexture(); + return CC_NEW(TextureAgent(actor)); +} + +Sampler *DeviceAgent::createSampler() { + Sampler *actor = _actor->createSampler(); + return CC_NEW(SamplerAgent(actor)); +} + +Shader *DeviceAgent::createShader() { + Shader *actor = _actor->createShader(); + return CC_NEW(ShaderAgent(actor)); +} + +InputAssembler *DeviceAgent::createInputAssembler() { + InputAssembler *actor = _actor->createInputAssembler(); + return CC_NEW(InputAssemblerAgent(actor)); +} + +RenderPass *DeviceAgent::createRenderPass() { + RenderPass *actor = _actor->createRenderPass(); + return CC_NEW(RenderPassAgent(actor)); +} + +Framebuffer *DeviceAgent::createFramebuffer() { + Framebuffer *actor = _actor->createFramebuffer(); + return CC_NEW(FramebufferAgent(actor)); +} + +DescriptorSet *DeviceAgent::createDescriptorSet() { + DescriptorSet *actor = _actor->createDescriptorSet(); + return CC_NEW(DescriptorSetAgent(actor)); +} + +DescriptorSetLayout *DeviceAgent::createDescriptorSetLayout() { + DescriptorSetLayout *actor = _actor->createDescriptorSetLayout(); + return CC_NEW(DescriptorSetLayoutAgent(actor)); +} + +PipelineLayout *DeviceAgent::createPipelineLayout() { + PipelineLayout *actor = _actor->createPipelineLayout(); + return CC_NEW(PipelineLayoutAgent(actor)); +} + +PipelineState *DeviceAgent::createPipelineState() { + PipelineState *actor = _actor->createPipelineState(); + return CC_NEW(PipelineStateAgent(actor)); +} + +GlobalBarrier *DeviceAgent::createGlobalBarrier() { + return _actor->createGlobalBarrier(); +} + +TextureBarrier *DeviceAgent::createTextureBarrier() { + return _actor->createTextureBarrier(); +} + +void DeviceAgent::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { + LinearAllocatorPool *allocator = getMainAllocator(); + + auto *actorRegions = allocator->allocate(count); + memcpy(actorRegions, regions, count * sizeof(BufferTextureCopy)); + + uint bufferCount = 0U; + for (uint i = 0U; i < count; i++) { + bufferCount += regions[i].texSubres.layerCount; + } + const auto **actorBuffers = allocator->allocate(bufferCount); + for (uint i = 0U, n = 0U; i < count; i++) { + const BufferTextureCopy ®ion = regions[i]; + uint size = formatSize(dst->getFormat(), region.texExtent.width, region.texExtent.height, 1); + for (uint l = 0; l < region.texSubres.layerCount; l++) { + auto *buffer = allocator->allocate(size); + memcpy(buffer, buffers[n], size); + actorBuffers[n++] = buffer; + } + } + + ENQUEUE_MESSAGE_5( + _mainEncoder, DeviceCopyBuffersToTexture, + actor, getActor(), + buffers, actorBuffers, + dst, static_cast(dst)->getActor(), + regions, actorRegions, + count, count, + { + actor->copyBuffersToTexture(buffers, dst, regions, count); + }); +} + +void DeviceAgent::flushCommands(CommandBuffer *const *cmdBuffs, uint count) { + if (!_multithreaded) return; // all command buffers are immediately executed + + bool multiThreaded = hasFeature(Feature::MULTITHREADED_SUBMISSION); + + auto **agentCmdBuffs = getMainAllocator()->allocate(count); + for (uint i = 0; i < count; ++i) { + agentCmdBuffs[i] = static_cast(cmdBuffs[i]); + MessageQueue::freeChunksInFreeQueue(agentCmdBuffs[i]->_messageQueue); + agentCmdBuffs[i]->_messageQueue->finishWriting(); + } + + ENQUEUE_MESSAGE_3( + _mainEncoder, DeviceFlushCommands, + count, count, + cmdBuffs, agentCmdBuffs, + multiThreaded, multiThreaded, + { + CommandBufferAgent::flushCommands(count, cmdBuffs, multiThreaded); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/DeviceAgent.h b/native/cocos/renderer/gfx-agent/DeviceAgent.h new file mode 100644 index 0000000000..544221dfaa --- /dev/null +++ b/native/cocos/renderer/gfx-agent/DeviceAgent.h @@ -0,0 +1,127 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "base/threading/Semaphore.h" +#include "gfx-base/GFXDevice.h" + +namespace cc { + +class MessageQueue; + +namespace gfx { + +class LinearAllocatorPool; +class CommandBuffer; +class CommandBufferAgent; +constexpr uint MAX_CPU_FRAME_AHEAD = 1U; + +class CC_DLL DeviceAgent final : public Agent { +public: + static DeviceAgent *getInstance(); + + ~DeviceAgent() override; + + using Device::copyBuffersToTexture; + using Device::createBuffer; + using Device::createCommandBuffer; + using Device::createDescriptorSet; + using Device::createDescriptorSetLayout; + using Device::createFramebuffer; + using Device::createGlobalBarrier; + using Device::createInputAssembler; + using Device::createPipelineLayout; + using Device::createPipelineState; + using Device::createQueue; + using Device::createRenderPass; + using Device::createSampler; + using Device::createShader; + using Device::createTexture; + using Device::createTextureBarrier; + + void resize(uint width, uint height) override; + void acquire() override; + void present() override; + + CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; + Queue * createQueue() override; + Buffer * createBuffer() override; + Texture * createTexture() override; + Sampler * createSampler() override; + Shader * createShader() override; + InputAssembler * createInputAssembler() override; + RenderPass * createRenderPass() override; + Framebuffer * createFramebuffer() override; + DescriptorSet * createDescriptorSet() override; + DescriptorSetLayout *createDescriptorSetLayout() override; + PipelineLayout * createPipelineLayout() override; + PipelineState * createPipelineState() override; + GlobalBarrier * createGlobalBarrier() override; + TextureBarrier * createTextureBarrier() override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; + + void flushCommands(CommandBuffer *const *cmdBuffs, uint count) override; + void setMultithreaded(bool multithreaded) override; + SurfaceTransform getSurfaceTransform() const override { return _actor->getSurfaceTransform(); } + uint getWidth() const override { return _actor->getWidth(); } + uint getHeight() const override { return _actor->getHeight(); } + uint getNativeWidth() const override { return _actor->getNativeWidth(); } + uint getNativeHeight() const override { return _actor->getNativeHeight(); } + MemoryStatus & getMemoryStatus() override { return _actor->getMemoryStatus(); } + uint getNumDrawCalls() const override { return _actor->getNumDrawCalls(); } + uint getNumInstances() const override { return _actor->getNumInstances(); } + uint getNumTris() const override { return _actor->getNumTris(); } + + MessageQueue * getMessageQueue() const { return _mainEncoder; } + LinearAllocatorPool *getMainAllocator() const { return _allocatorPools[_currentIndex]; } + +protected: + static DeviceAgent *instance; + + friend class DeviceManager; + friend class CommandBufferAgent; + + explicit DeviceAgent(Device *device); + + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; + + void releaseSurface(uintptr_t windowHandle) override; + void acquireSurface(uintptr_t windowHandle) override; + + bool _multithreaded{false}; + MessageQueue *_mainEncoder{nullptr}; + + uint _currentIndex = 0U; + vector _allocatorPools; + Semaphore _frameBoundarySemaphore{MAX_CPU_FRAME_AHEAD}; + + unordered_set _cmdBuffRefs; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/FramebufferAgent.cpp b/native/cocos/renderer/gfx-agent/FramebufferAgent.cpp new file mode 100644 index 0000000000..02621b478b --- /dev/null +++ b/native/cocos/renderer/gfx-agent/FramebufferAgent.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceAgent.h" +#include "FramebufferAgent.h" +#include "RenderPassAgent.h" +#include "TextureAgent.h" + +namespace cc { +namespace gfx { + +FramebufferAgent::~FramebufferAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + FramebufferDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void FramebufferAgent::doInit(const FramebufferInfo &info) { + FramebufferInfo actorInfo = info; + for (uint i = 0u; i < info.colorTextures.size(); ++i) { + if (info.colorTextures[i]) { + actorInfo.colorTextures[i] = static_cast(info.colorTextures[i])->getActor(); + } + } + if (info.depthStencilTexture) { + actorInfo.depthStencilTexture = static_cast(info.depthStencilTexture)->getActor(); + } + actorInfo.renderPass = static_cast(info.renderPass)->getActor(); + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + FramebufferInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void FramebufferAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + FramebufferDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/FramebufferAgent.h b/native/cocos/renderer/gfx-agent/FramebufferAgent.h new file mode 100644 index 0000000000..e10fe7db9b --- /dev/null +++ b/native/cocos/renderer/gfx-agent/FramebufferAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXFramebuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL FramebufferAgent final : public Agent { +public: + using Agent::Agent; + ~FramebufferAgent() override; + +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/InputAssemblerAgent.cpp b/native/cocos/renderer/gfx-agent/InputAssemblerAgent.cpp new file mode 100644 index 0000000000..a61fb0023a --- /dev/null +++ b/native/cocos/renderer/gfx-agent/InputAssemblerAgent.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferAgent.h" +#include "DeviceAgent.h" +#include "InputAssemblerAgent.h" + +namespace cc { +namespace gfx { + +InputAssemblerAgent::~InputAssemblerAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + InputAssemblerDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void InputAssemblerAgent::doInit(const InputAssemblerInfo &info) { + InputAssemblerInfo actorInfo = info; + for (uint i = 0u; i < actorInfo.vertexBuffers.size(); ++i) { + actorInfo.vertexBuffers[i] = static_cast(actorInfo.vertexBuffers[i])->getActor(); + } + if (actorInfo.indexBuffer) { + actorInfo.indexBuffer = static_cast(actorInfo.indexBuffer)->getActor(); + } + if (actorInfo.indirectBuffer) { + actorInfo.indirectBuffer = static_cast(actorInfo.indirectBuffer)->getActor(); + } + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + InputAssemblerInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void InputAssemblerAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + InputAssemblerDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +void InputAssemblerAgent::setVertexCount(uint count) { + _vertexCount = count; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + count, count, + { + actor->setVertexCount(count); + }); +} + +void InputAssemblerAgent::setFirstVertex(uint first) { + _firstVertex = first; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + first, first, + { + actor->setFirstVertex(first); + }); +} + +void InputAssemblerAgent::setIndexCount(uint count) { + _indexCount = count; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + count, count, + { + actor->setIndexCount(count); + }); +} + +void InputAssemblerAgent::setFirstIndex(uint first) { + _firstIndex = first; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + first, first, + { + actor->setFirstIndex(first); + }); +} + +void InputAssemblerAgent::setVertexOffset(uint offset) { + _vertexOffset = offset; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + offset, offset, + { + actor->setVertexOffset(offset); + }); +} + +void InputAssemblerAgent::setInstanceCount(uint count) { + _instanceCount = count; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + count, count, + { + actor->setInstanceCount(count); + }); +} + +void InputAssemblerAgent::setFirstInstance(uint first) { + _firstInstance = first; + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), InputAssemblerDestroy, + actor, getActor(), + first, first, + { + actor->setFirstInstance(first); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/InputAssemblerAgent.h b/native/cocos/renderer/gfx-agent/InputAssemblerAgent.h new file mode 100644 index 0000000000..632b95aa02 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/InputAssemblerAgent.h @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXInputAssembler.h" + +namespace cc { +namespace gfx { + +class CC_DLL InputAssemblerAgent final : public Agent { +public: + using Agent::Agent; + ~InputAssemblerAgent() override; + + void setVertexCount(uint count) override; + void setFirstVertex(uint first) override; + void setIndexCount(uint count) override; + void setFirstIndex(uint first) override; + void setVertexOffset(uint offset) override; + void setInstanceCount(uint count) override; + void setFirstInstance(uint first) override; + +protected: + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/LinearAllocatorPool.h b/native/cocos/renderer/gfx-agent/LinearAllocatorPool.h new file mode 100644 index 0000000000..b65fb9aa5c --- /dev/null +++ b/native/cocos/renderer/gfx-agent/LinearAllocatorPool.h @@ -0,0 +1,89 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include +#include "base/threading/ThreadSafeLinearAllocator.h" + +namespace cc { +namespace gfx { + +namespace { +constexpr size_t DEFAULT_BLOCK_SIZE = 4096 * 16; + +uint nextPowerOf2(uint v) { + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + return ++v; +} +} + +class CC_DLL LinearAllocatorPool final { +public: + LinearAllocatorPool(size_t defaultBlockSize = DEFAULT_BLOCK_SIZE): _defaultBlockSize(defaultBlockSize) { + _allocators.emplace_back(CC_NEW(ThreadSafeLinearAllocator(static_cast(_defaultBlockSize)))); + } + + ~LinearAllocatorPool() { + for (ThreadSafeLinearAllocator *allocator : _allocators) { + CC_SAFE_DELETE(allocator); + } + _allocators.clear(); + } + + template + T* allocate(const uint count, uint alignment = 64u) noexcept { + if (!count) return nullptr; + + T* res = nullptr; + size_t size = count * sizeof(T); + for (ThreadSafeLinearAllocator *allocator : _allocators) { + res = reinterpret_cast(allocator->allocate(size, alignment)); + if (res) return res; + } + uint capacity = nextPowerOf2(static_cast(std::max(DEFAULT_BLOCK_SIZE, size + static_cast(alignment)))); // reserve enough padding space for alignment + _allocators.emplace_back(CC_NEW(ThreadSafeLinearAllocator(static_cast(capacity)))); + return reinterpret_cast(_allocators.back()->allocate(size, alignment)); + } + + inline void reset() { + for (ThreadSafeLinearAllocator *allocator : _allocators) { + allocator->recycle(); + } + } + +protected: + vector _allocators; + size_t _defaultBlockSize = DEFAULT_BLOCK_SIZE; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/PipelineLayoutAgent.cpp b/native/cocos/renderer/gfx-agent/PipelineLayoutAgent.cpp new file mode 100644 index 0000000000..4687d007d2 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/PipelineLayoutAgent.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DescriptorSetLayoutAgent.h" +#include "DeviceAgent.h" +#include "PipelineLayoutAgent.h" + +namespace cc { +namespace gfx { + +PipelineLayoutAgent::~PipelineLayoutAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + PipelineLayoutDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void PipelineLayoutAgent::doInit(const PipelineLayoutInfo &info) { + PipelineLayoutInfo actorInfo; + actorInfo.setLayouts.resize(info.setLayouts.size()); + for (uint i = 0u; i < info.setLayouts.size(); i++) { + actorInfo.setLayouts[i] = static_cast(info.setLayouts[i])->getActor(); + } + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + PipelineLayoutInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void PipelineLayoutAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + PipelineLayoutDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/PipelineLayoutAgent.h b/native/cocos/renderer/gfx-agent/PipelineLayoutAgent.h new file mode 100644 index 0000000000..488d4a13bc --- /dev/null +++ b/native/cocos/renderer/gfx-agent/PipelineLayoutAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXPipelineLayout.h" + +namespace cc { +namespace gfx { + +class CC_DLL PipelineLayoutAgent final : public Agent { +public: + using Agent::Agent; + ~PipelineLayoutAgent() override; + +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/PipelineStateAgent.cpp b/native/cocos/renderer/gfx-agent/PipelineStateAgent.cpp new file mode 100644 index 0000000000..1f8194936d --- /dev/null +++ b/native/cocos/renderer/gfx-agent/PipelineStateAgent.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceAgent.h" +#include "PipelineLayoutAgent.h" +#include "PipelineStateAgent.h" +#include "RenderPassAgent.h" +#include "ShaderAgent.h" + +namespace cc { +namespace gfx { + +PipelineStateAgent::~PipelineStateAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + PipelineStateDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void PipelineStateAgent::doInit(const PipelineStateInfo &info) { + PipelineStateInfo actorInfo = info; + actorInfo.shader = static_cast(info.shader)->getActor(); + actorInfo.pipelineLayout = static_cast(info.pipelineLayout)->getActor(); + if (info.renderPass) actorInfo.renderPass = static_cast(info.renderPass)->getActor(); + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + PipelineStateInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void PipelineStateAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + PipelineStateDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/PipelineStateAgent.h b/native/cocos/renderer/gfx-agent/PipelineStateAgent.h new file mode 100644 index 0000000000..887867863a --- /dev/null +++ b/native/cocos/renderer/gfx-agent/PipelineStateAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXPipelineState.h" + +namespace cc { +namespace gfx { + +class CC_DLL PipelineStateAgent final : public Agent { +public: + using Agent::Agent; + ~PipelineStateAgent() override; + +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/QueueAgent.cpp b/native/cocos/renderer/gfx-agent/QueueAgent.cpp new file mode 100644 index 0000000000..7daaaa968c --- /dev/null +++ b/native/cocos/renderer/gfx-agent/QueueAgent.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/job-system/JobSystem.h" +#include "base/threading/MessageQueue.h" + +#include "CommandBufferAgent.h" +#include "DeviceAgent.h" +#include "LinearAllocatorPool.h" +#include "QueueAgent.h" + +namespace cc { +namespace gfx { + +QueueAgent::~QueueAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + QueueDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void QueueAgent::doInit(const QueueInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + QueueInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void QueueAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + QueueDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +void QueueAgent::submit(CommandBuffer *const *cmdBuffs, uint count) { + if (!count) return; + + LinearAllocatorPool *allocator = DeviceAgent::getInstance()->getMainAllocator(); + CommandBuffer ** actorCmdBuffs = allocator->allocate(count); + for (uint i = 0u; i < count; ++i) { + actorCmdBuffs[i] = static_cast(cmdBuffs[i])->getActor(); + } + + ENQUEUE_MESSAGE_3( + DeviceAgent::getInstance()->getMessageQueue(), + QueueSubmit, + actor, getActor(), + actorCmdBuffs, actorCmdBuffs, + count, count, + { + //auto startTime = std::chrono::steady_clock::now(); + + //auto endTime = std::chrono::steady_clock::now(); + //float dt = std::chrono::duration_cast(endTime - startTime).count() / 1e6; + //static float timeAcc = 0.f; + //if (!timeAcc) timeAcc = dt; + //else timeAcc = timeAcc * 0.95f + dt * 0.05f; + //CC_LOG_INFO("---------- %.2fms", timeAcc); + + //CC_LOG_INFO("======== one round ========"); + + actor->submit(actorCmdBuffs, count); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/QueueAgent.h b/native/cocos/renderer/gfx-agent/QueueAgent.h new file mode 100644 index 0000000000..f49834663b --- /dev/null +++ b/native/cocos/renderer/gfx-agent/QueueAgent.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXQueue.h" +#include "base/Agent.h" + +namespace cc { +namespace gfx { + +class CC_DLL QueueAgent final : public Agent { +public: + using Agent::Agent; + using Queue::submit; + + ~QueueAgent() override; + + void submit(CommandBuffer *const *cmdBuffs, uint count) override; + +protected: + friend class DeviceAgent; + + void doInit(const QueueInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/RenderPassAgent.cpp b/native/cocos/renderer/gfx-agent/RenderPassAgent.cpp new file mode 100644 index 0000000000..66d07f7251 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/RenderPassAgent.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceAgent.h" +#include "RenderPassAgent.h" + +namespace cc { +namespace gfx { + +RenderPassAgent::~RenderPassAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + RenderPassDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void RenderPassAgent::doInit(const RenderPassInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + RenderPassInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void RenderPassAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + RenderPassDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/RenderPassAgent.h b/native/cocos/renderer/gfx-agent/RenderPassAgent.h new file mode 100644 index 0000000000..8519bf6c6e --- /dev/null +++ b/native/cocos/renderer/gfx-agent/RenderPassAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXRenderPass.h" +#include "base/Agent.h" + +namespace cc { +namespace gfx { + +class CC_DLL RenderPassAgent final : public Agent { +public: + using Agent::Agent; + ~RenderPassAgent() override; + +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/SamplerAgent.cpp b/native/cocos/renderer/gfx-agent/SamplerAgent.cpp new file mode 100644 index 0000000000..220d0adbd5 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/SamplerAgent.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DescriptorSetLayoutAgent.h" +#include "DeviceAgent.h" +#include "SamplerAgent.h" + +namespace cc { +namespace gfx { + +SamplerAgent::~SamplerAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + SamplerDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void SamplerAgent::doInit(const SamplerInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + SamplerInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void SamplerAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + SamplerDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/SamplerAgent.h b/native/cocos/renderer/gfx-agent/SamplerAgent.h new file mode 100644 index 0000000000..20ee7e71a6 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/SamplerAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXSampler.h" + +namespace cc { +namespace gfx { + +class CC_DLL SamplerAgent final : public Agent { +public: + using Agent::Agent; + ~SamplerAgent() override; + +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/ShaderAgent.cpp b/native/cocos/renderer/gfx-agent/ShaderAgent.cpp new file mode 100644 index 0000000000..4c31142337 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/ShaderAgent.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceAgent.h" +#include "ShaderAgent.h" + +namespace cc { +namespace gfx { + +ShaderAgent::~ShaderAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + ShaderDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void ShaderAgent::doInit(const ShaderInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + ShaderInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void ShaderAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + ShaderDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/ShaderAgent.h b/native/cocos/renderer/gfx-agent/ShaderAgent.h new file mode 100644 index 0000000000..6d228c1006 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/ShaderAgent.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXShader.h" + +namespace cc { +namespace gfx { + +class CC_DLL ShaderAgent final : public Agent { +public: + using Agent::Agent; + ~ShaderAgent() override; + +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/TextureAgent.cpp b/native/cocos/renderer/gfx-agent/TextureAgent.cpp new file mode 100644 index 0000000000..de922a6ca8 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/TextureAgent.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceAgent.h" +#include "TextureAgent.h" + +namespace cc { +namespace gfx { + +TextureAgent::~TextureAgent() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + TextureDestruct, + actor, _actor, + { + CC_SAFE_DELETE(actor); + }); +} + +void TextureAgent::doInit(const TextureInfo &info) { + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + TextureInit, + actor, getActor(), + info, info, + { + actor->initialize(info); + }); +} + +void TextureAgent::doInit(const TextureViewInfo &info) { + TextureViewInfo actorInfo = info; + actorInfo.texture = static_cast(info.texture)->getActor(); + + ENQUEUE_MESSAGE_2( + DeviceAgent::getInstance()->getMessageQueue(), + TextureViewInit, + actor, getActor(), + info, actorInfo, + { + actor->initialize(info); + }); +} + +void TextureAgent::doDestroy() { + ENQUEUE_MESSAGE_1( + DeviceAgent::getInstance()->getMessageQueue(), + TextureDestroy, + actor, getActor(), + { + actor->destroy(); + }); +} + +void TextureAgent::doResize(uint width, uint height, uint size) { + ENQUEUE_MESSAGE_3( + DeviceAgent::getInstance()->getMessageQueue(), + TextureResize, + actor, getActor(), + width, width, + height, height, + { + actor->resize(width, height); + }); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-agent/TextureAgent.h b/native/cocos/renderer/gfx-agent/TextureAgent.h new file mode 100644 index 0000000000..3e33e44371 --- /dev/null +++ b/native/cocos/renderer/gfx-agent/TextureAgent.h @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXTexture.h" + +namespace cc { +namespace gfx { + +class CC_DLL TextureAgent final : public Agent { +public: + using Agent::Agent; + ~TextureAgent() override; + +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXBase.h b/native/cocos/renderer/gfx-base/GFXBase.h new file mode 100644 index 0000000000..794be08aa9 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXBase.h @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXBuffer.h" +#include "GFXCommandBuffer.h" +#include "GFXContext.h" +#include "GFXDescriptorSet.h" +#include "GFXDescriptorSetLayout.h" +#include "GFXDevice.h" +#include "GFXFramebuffer.h" +#include "GFXGlobalBarrier.h" +#include "GFXInputAssembler.h" +#include "GFXPipelineLayout.h" +#include "GFXPipelineState.h" +#include "GFXQueue.h" +#include "GFXRenderPass.h" +#include "GFXSampler.h" +#include "GFXShader.h" +#include "GFXTexture.h" +#include "GFXTextureBarrier.h" diff --git a/native/cocos/renderer/gfx-base/GFXBuffer.cpp b/native/cocos/renderer/gfx-base/GFXBuffer.cpp new file mode 100644 index 0000000000..1cb73e1e19 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXBuffer.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXBuffer.h" +#include "GFXDevice.h" +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +Buffer::Buffer() +: GFXObject(ObjectType::BUFFER) { +} + +Buffer::~Buffer() = default; + +uint Buffer::computeHash(const BufferInfo &info) { + uint seed = 4; + seed ^= static_cast(info.usage) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.memUsage) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.size) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.flags) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + return seed; +} + +void Buffer::initialize(const BufferInfo &info) { + _usage = info.usage; + _memUsage = info.memUsage; + _size = info.size; + _flags = info.flags; + _stride = std::max(info.stride, 1U); + _count = _size / _stride; + + Device::getInstance()->getMemoryStatus().bufferSize += _size; + + doInit(info); +} + +void Buffer::initialize(const BufferViewInfo &info) { + _usage = info.buffer->getUsage(); + _memUsage = info.buffer->getMemUsage(); + _flags = info.buffer->getFlags(); + _offset = info.offset; + _size = _stride = info.range; + _count = 1U; + _isBufferView = true; + + doInit(info); +} + +void Buffer::destroy() { + doDestroy(); + + Device::getInstance()->getMemoryStatus().bufferSize -= _size; + + _offset = _size = _stride = _count = 0U; +} + +void Buffer::resize(uint size) { + if (size != _size) { + uint count = size / _stride; + doResize(size, count); + + Device::getInstance()->getMemoryStatus().bufferSize -= _size; + + _size = size; + _count = count; + + Device::getInstance()->getMemoryStatus().bufferSize += _size; + } +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXBuffer.h b/native/cocos/renderer/gfx-base/GFXBuffer.h new file mode 100644 index 0000000000..1b7f69d52e --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXBuffer.h @@ -0,0 +1,71 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL Buffer : public GFXObject { +public: + Buffer(); + ~Buffer() override; + + static uint computeHash(const BufferInfo &info); + + void initialize(const BufferInfo &info); + void initialize(const BufferViewInfo &info); + void resize(uint size); + void destroy(); + + virtual void update(const void *buffer, uint size) = 0; + + CC_INLINE BufferUsage getUsage() const { return _usage; } + CC_INLINE MemoryUsage getMemUsage() const { return _memUsage; } + CC_INLINE uint getStride() const { return _stride; } + CC_INLINE uint getCount() const { return _count; } + CC_INLINE uint getSize() const { return _size; } + CC_INLINE BufferFlags getFlags() const { return _flags; } + +protected: + virtual void doInit(const BufferInfo &info) = 0; + virtual void doInit(const BufferViewInfo &info) = 0; + virtual void doResize(uint size, uint count) = 0; + virtual void doDestroy() = 0; + + BufferUsage _usage = BufferUsageBit::NONE; + MemoryUsage _memUsage = MemoryUsageBit::NONE; + uint _stride = 0U; + uint _count = 0U; + uint _size = 0U; + uint _offset = 0U; + BufferFlags _flags = BufferFlagBit::NONE; + bool _isBufferView = false; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXCommandBuffer.cpp b/native/cocos/renderer/gfx-base/GFXCommandBuffer.cpp new file mode 100644 index 0000000000..5a1dfe42a6 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXCommandBuffer.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXCommandBuffer.h" +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +CommandBuffer::CommandBuffer() +: GFXObject(ObjectType::COMMAND_BUFFER) { +} + +CommandBuffer::~CommandBuffer() = default; + +void CommandBuffer::initialize(const CommandBufferInfo& info) { + _type = info.type; + _queue = info.queue; + + doInit(info); +} + +void CommandBuffer::destroy() { + doDestroy(); + + _type = CommandBufferType::PRIMARY; + _queue = nullptr; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXCommandBuffer.h b/native/cocos/renderer/gfx-base/GFXCommandBuffer.h new file mode 100644 index 0000000000..6124234744 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXCommandBuffer.h @@ -0,0 +1,196 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXBuffer.h" +#include "GFXInputAssembler.h" +#include "GFXObject.h" +#include "base/Utils.h" + +namespace cc { +namespace gfx { + +class CC_DLL CommandBuffer : public GFXObject { +public: + CommandBuffer(); + ~CommandBuffer() override; + + void initialize(const CommandBufferInfo &info); + void destroy(); + + virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) = 0; + virtual void end() = 0; + virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) = 0; + virtual void endRenderPass() = 0; + virtual void bindPipelineState(PipelineState *pso) = 0; + virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) = 0; + virtual void bindInputAssembler(InputAssembler *ia) = 0; + virtual void setViewport(const Viewport &vp) = 0; + virtual void setScissor(const Rect &rect) = 0; + virtual void setLineWidth(float width) = 0; + virtual void setDepthBias(float constant, float clamp, float slope) = 0; + virtual void setBlendConstants(const Color &constants) = 0; + virtual void setDepthBound(float minBounds, float maxBounds) = 0; + virtual void setStencilWriteMask(StencilFace face, uint mask) = 0; + virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) = 0; + virtual void nextSubpass() = 0; + virtual void draw(const DrawInfo &info) = 0; + virtual void updateBuffer(Buffer *buff, const void *data, uint size) = 0; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) = 0; + virtual void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) = 0; + virtual void execute(CommandBuffer *const *cmdBuffs, uint32_t count) = 0; + virtual void dispatch(const DispatchInfo &info) = 0; + virtual void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) = 0; + + inline void begin(); + inline void begin(RenderPass *renderPass); + inline void begin(RenderPass *renderPass, uint subpass); + + inline void updateBuffer(Buffer *buff, const void *data); + + inline void execute(const CommandBufferList &cmdBuffs, uint32_t count); + + inline void bindDescriptorSet(uint set, DescriptorSet *descriptorSet); + inline void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets); + + inline void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil, const CommandBufferList &secondaryCBs); + inline void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil); + inline void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil); + + inline void draw(InputAssembler *ia); + inline void copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions); + + inline void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlitList ®ions, Filter filter); + + inline void pipelineBarrier(const GlobalBarrier *barrier); + inline void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrierList &textureBarriers, const TextureList &textures); + + inline void bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet); + inline void bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets); + inline void beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil, const CommandBufferList &secondaryCBs); + inline void beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil); + + inline Queue * getQueue() const { return _queue; } + inline CommandBufferType getType() const { return _type; } + + virtual uint getNumDrawCalls() const { return _numDrawCalls; } + virtual uint getNumInstances() const { return _numInstances; } + virtual uint getNumTris() const { return _numTriangles; } + +protected: + virtual void doInit(const CommandBufferInfo &info) = 0; + virtual void doDestroy() = 0; + + Queue * _queue = nullptr; + CommandBufferType _type = CommandBufferType::PRIMARY; + + uint32_t _numDrawCalls = 0; + uint32_t _numInstances = 0; + uint32_t _numTriangles = 0; +}; + +////////////////////////////////////////////////////////////////////////// + +void CommandBuffer::begin() { + begin(nullptr, 0, nullptr); +} + +void CommandBuffer::begin(RenderPass *renderPass) { + begin(renderPass, 0, nullptr); +} + +void CommandBuffer::begin(RenderPass *renderPass, uint subpass) { + begin(renderPass, subpass, nullptr); +} + +void CommandBuffer::updateBuffer(Buffer *buff, const void *data) { + updateBuffer(buff, data, buff->getSize()); +} + +void CommandBuffer::execute(const CommandBufferList &cmdBuffs, uint32_t count) { + execute(cmdBuffs.data(), count); +} + +void CommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSet) { + bindDescriptorSet(set, descriptorSet, 0, nullptr); +} + +void CommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets) { + bindDescriptorSet(set, descriptorSet, utils::toUint(dynamicOffsets.size()), dynamicOffsets.data()); +} + +void CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil, const CommandBufferList &secondaryCBs) { + beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil, secondaryCBs.data(), utils::toUint(secondaryCBs.size())); +} + +void CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil) { + beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil, nullptr, 0); +} + +void CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil) { + beginRenderPass(renderPass, fbo, renderArea, colors, depth, stencil, nullptr, 0); +} + +void CommandBuffer::draw(InputAssembler *ia) { + DrawInfo info; + ia->extractDrawInfo(info); + draw(info); +} + +void CommandBuffer::copyBuffersToTexture(const BufferDataList &buffers, Texture *texture, const BufferTextureCopyList ®ions) { + copyBuffersToTexture(buffers.data(), texture, regions.data(), utils::toUint(regions.size())); +} + +void CommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlitList ®ions, Filter filter) { + blitTexture(srcTexture, dstTexture, regions.data(), utils::toUint(regions.size()), filter); +} + +void CommandBuffer::pipelineBarrier(const GlobalBarrier *barrier) { + pipelineBarrier(barrier, nullptr, nullptr, 0U); +} + +void CommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrierList &textureBarriers, const TextureList &textures) { + pipelineBarrier(barrier, textureBarriers.data(), textures.data(), utils::toUint(textureBarriers.size())); +} + +void CommandBuffer::bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet) { + bindDescriptorSet(set, descriptorSet, 0, nullptr); +} + +void CommandBuffer::bindDescriptorSetForJS(uint set, DescriptorSet *descriptorSet, const vector &dynamicOffsets) { + bindDescriptorSet(set, descriptorSet, utils::toUint(dynamicOffsets.size()), dynamicOffsets.data()); +} + +void CommandBuffer::beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil, const CommandBufferList &secondaryCBs) { + beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil, secondaryCBs.data(), utils::toUint(secondaryCBs.size())); +} + +void CommandBuffer::beginRenderPassForJS(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const ColorList &colors, float depth, int stencil) { + beginRenderPass(renderPass, fbo, renderArea, colors.data(), depth, stencil, nullptr, 0); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXContext.cpp b/native/cocos/renderer/gfx-base/GFXContext.cpp new file mode 100644 index 0000000000..5d25122134 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXContext.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXContext.h" + +namespace cc { +namespace gfx { + +Context::Context() = default; + +Context::~Context() = default; + +bool Context::initialize(const ContextInfo& info) { + _vsyncMode = info.vsyncMode; + _windowHandle = info.windowHandle; + + return doInit(info); +} + +void Context::destroy() { + doDestroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXContext.h b/native/cocos/renderer/gfx-base/GFXContext.h new file mode 100644 index 0000000000..e29e476b50 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXContext.h @@ -0,0 +1,60 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL Context : public Object { +public: + Context(); + virtual ~Context(); + + bool initialize(const ContextInfo &info); + void destroy(); + + virtual void present() = 0; + + CC_INLINE Context * getSharedContext() const { return _sharedContext; } + CC_INLINE VsyncMode getVsyncMode() const { return _vsyncMode; } + CC_INLINE Format getColorFormat() const { return _colorFmt; } + CC_INLINE Format getDepthStencilFormat() const { return _depthStencilFmt; } + +protected: + virtual bool doInit(const ContextInfo &info) = 0; + virtual void doDestroy() = 0; + + uintptr_t _windowHandle = 0; + Context * _sharedContext = nullptr; + VsyncMode _vsyncMode = VsyncMode::OFF; + Format _colorFmt = Format::UNKNOWN; + Format _depthStencilFmt = Format::UNKNOWN; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDef-common.h b/native/cocos/renderer/gfx-base/GFXDef-common.h new file mode 100644 index 0000000000..3034c6b133 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDef-common.h @@ -0,0 +1,1245 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/TypeDef.h" +#include "base/memory/Memory.h" +#include "math/Math.h" + +/** + * This file should be synced with engine/cocos/core/gfx/base/define.ts + * every time changes being made, by manually running: + * node tools/gfx-define-generator/generate.js + * + * Due to Clang AST's incompleteness for now we are parsing this header manually. + * Some caveat: + * * native-specific structs should not be included here, put them in GFXDef.h instead + * * no typedefs, only usings + * * define struct members first, then other helper functions + * * macros are hardcoded in the generator for now + * * aliases can only be used as types, not values (e.g. BufferUsage::NONE is illegal) + * * parser directives can be specified in comments right after struct member declarations: + * * @ts-nullable: declare the member optional + * * @ts-overrides `YAML declaration`: overrides any parsed results, use with caution + * * each struct member have to be specified in a single line, including optional parser directives + */ + +namespace cc { +namespace gfx { + +class Device; +class Buffer; +class GlobalBarrier; +class TextureBarrier; +class Texture; +class Sampler; +class Shader; +class InputAssembler; +class RenderPass; +class Framebuffer; +class DescriptorSetLayout; +class PipelineLayout; +class PipelineState; +class DescriptorSet; +class CommandBuffer; +class Queue; +class Window; +class Context; + +using TextureBarrierList = vector; +using BufferDataList = vector; +using CommandBufferList = vector; + +constexpr uint MAX_ATTACHMENTS = 4U; +constexpr uint INVALID_BINDING = static_cast(-1); +constexpr uint SUBPASS_EXTERNAL = static_cast(-1); + +using BufferList = vector; +using TextureList = vector; +using SamplerList = vector; +using DescriptorSetLayoutList = vector; + +enum class ObjectType { + UNKNOWN, + BUFFER, + TEXTURE, + RENDER_PASS, + FRAMEBUFFER, + SAMPLER, + SHADER, + DESCRIPTOR_SET_LAYOUT, + PIPELINE_LAYOUT, + PIPELINE_STATE, + DESCRIPTOR_SET, + INPUT_ASSEMBLER, + COMMAND_BUFFER, + QUEUE, + GLOBAL_BARRIER, + TEXTURE_BARRIER, + BUFFER_BARRIER, +}; + +enum class Status { + UNREADY, + FAILED, + SUCCESS, +}; + +enum class API { + UNKNOWN, + GLES2, + GLES3, + METAL, + VULKAN, + WEBGL, + WEBGL2, + WEBGPU, +}; + +enum class SurfaceTransform { + IDENTITY, + ROTATE_90, + ROTATE_180, + ROTATE_270, +}; + +enum class Feature { + COLOR_FLOAT, + COLOR_HALF_FLOAT, + TEXTURE_FLOAT, + TEXTURE_HALF_FLOAT, + TEXTURE_FLOAT_LINEAR, + TEXTURE_HALF_FLOAT_LINEAR, + FORMAT_R11G11B10F, + FORMAT_D16, + FORMAT_D16S8, + FORMAT_D24, + FORMAT_D24S8, + FORMAT_D32F, + FORMAT_D32FS8, + FORMAT_ETC1, + FORMAT_ETC2, + FORMAT_DXT, + FORMAT_PVRTC, + FORMAT_ASTC, + FORMAT_RGB8, + MSAA, + ELEMENT_INDEX_UINT, + INSTANCED_ARRAYS, + MULTIPLE_RENDER_TARGETS, + BLEND_MINMAX, + DEPTH_BOUNDS, + LINE_WIDTH, + STENCIL_WRITE_MASK, + STENCIL_COMPARE_MASK, + MULTITHREADED_SUBMISSION, + COMPUTE_SHADER, + COUNT, +}; + +enum class Format { + + UNKNOWN, + + A8, + L8, + LA8, + + R8, + R8SN, + R8UI, + R8I, + R16F, + R16UI, + R16I, + R32F, + R32UI, + R32I, + + RG8, + RG8SN, + RG8UI, + RG8I, + RG16F, + RG16UI, + RG16I, + RG32F, + RG32UI, + RG32I, + + RGB8, + SRGB8, + RGB8SN, + RGB8UI, + RGB8I, + RGB16F, + RGB16UI, + RGB16I, + RGB32F, + RGB32UI, + RGB32I, + + RGBA8, + BGRA8, + SRGB8_A8, + RGBA8SN, + RGBA8UI, + RGBA8I, + RGBA16F, + RGBA16UI, + RGBA16I, + RGBA32F, + RGBA32UI, + RGBA32I, + + // Special Format + R5G6B5, + R11G11B10F, + RGB5A1, + RGBA4, + RGB10A2, + RGB10A2UI, + RGB9E5, + + // Depth-Stencil Format + D16, + D16S8, + D24, + D24S8, + D32F, + D32F_S8, + + // Compressed Format + + // Block Compression Format, DDS (DirectDraw Surface) + // DXT1: 3 channels (5:6:5), 1/8 origianl size, with 0 or 1 bit of alpha + BC1, + BC1_ALPHA, + BC1_SRGB, + BC1_SRGB_ALPHA, + // DXT3: 4 channels (5:6:5), 1/4 origianl size, with 4 bits of alpha + BC2, + BC2_SRGB, + // DXT5: 4 channels (5:6:5), 1/4 origianl size, with 8 bits of alpha + BC3, + BC3_SRGB, + // 1 channel (8), 1/4 origianl size + BC4, + BC4_SNORM, + // 2 channels (8:8), 1/2 origianl size + BC5, + BC5_SNORM, + // 3 channels (16:16:16), half-floating point, 1/6 origianl size + // UF16: unsigned float, 5 exponent bits + 11 mantissa bits + // SF16: signed float, 1 signed bit + 5 exponent bits + 10 mantissa bits + BC6H_UF16, + BC6H_SF16, + // 4 channels (4~7 bits per channel) with 0 to 8 bits of alpha, 1/3 original size + BC7, + BC7_SRGB, + + // Ericsson Texture Compression Format + ETC_RGB8, + ETC2_RGB8, + ETC2_SRGB8, + ETC2_RGB8_A1, + ETC2_SRGB8_A1, + ETC2_RGBA8, + ETC2_SRGB8_A8, + EAC_R11, + EAC_R11SN, + EAC_RG11, + EAC_RG11SN, + + // PVRTC (PowerVR) + PVRTC_RGB2, + PVRTC_RGBA2, + PVRTC_RGB4, + PVRTC_RGBA4, + PVRTC2_2BPP, + PVRTC2_4BPP, + + // ASTC (Adaptive Scalable Texture Compression) + ASTC_RGBA_4X4, + ASTC_RGBA_5X4, + ASTC_RGBA_5X5, + ASTC_RGBA_6X5, + ASTC_RGBA_6X6, + ASTC_RGBA_8X5, + ASTC_RGBA_8X6, + ASTC_RGBA_8X8, + ASTC_RGBA_10X5, + ASTC_RGBA_10X6, + ASTC_RGBA_10X8, + ASTC_RGBA_10X10, + ASTC_RGBA_12X10, + ASTC_RGBA_12X12, + + // ASTC (Adaptive Scalable Texture Compression) SRGB + ASTC_SRGBA_4X4, + ASTC_SRGBA_5X4, + ASTC_SRGBA_5X5, + ASTC_SRGBA_6X5, + ASTC_SRGBA_6X6, + ASTC_SRGBA_8X5, + ASTC_SRGBA_8X6, + ASTC_SRGBA_8X8, + ASTC_SRGBA_10X5, + ASTC_SRGBA_10X6, + ASTC_SRGBA_10X8, + ASTC_SRGBA_10X10, + ASTC_SRGBA_12X10, + ASTC_SRGBA_12X12, + + // Total count + COUNT, +}; + +enum class FormatType { + NONE, + UNORM, + SNORM, + UINT, + INT, + UFLOAT, + FLOAT, +}; + +enum class Type { + UNKNOWN, + BOOL, + BOOL2, + BOOL3, + BOOL4, + INT, + INT2, + INT3, + INT4, + UINT, + UINT2, + UINT3, + UINT4, + FLOAT, + FLOAT2, + FLOAT3, + FLOAT4, + MAT2, + MAT2X3, + MAT2X4, + MAT3X2, + MAT3, + MAT3X4, + MAT4X2, + MAT4X3, + MAT4, + // combined image samplers + SAMPLER1D, + SAMPLER1D_ARRAY, + SAMPLER2D, + SAMPLER2D_ARRAY, + SAMPLER3D, + SAMPLER_CUBE, + // sampler + SAMPLER, + // sampled textures + TEXTURE1D, + TEXTURE1D_ARRAY, + TEXTURE2D, + TEXTURE2D_ARRAY, + TEXTURE3D, + TEXTURE_CUBE, + // storage images + IMAGE1D, + IMAGE1D_ARRAY, + IMAGE2D, + IMAGE2D_ARRAY, + IMAGE3D, + IMAGE_CUBE, + // input attachment + SUBPASS_INPUT, + COUNT, +}; +bool isCombinedImageSampler(Type type); +bool isSampledImage(Type type); +bool isStorageImage(Type type); + +enum class BufferUsageBit : FlagBits { + NONE = 0, + TRANSFER_SRC = 0x1, + TRANSFER_DST = 0x2, + INDEX = 0x4, + VERTEX = 0x8, + UNIFORM = 0x10, + STORAGE = 0x20, + INDIRECT = 0x40, +}; +using BufferUsage = BufferUsageBit; +CC_ENUM_OPERATORS(BufferUsageBit); + +enum class BufferFlagBit : FlagBits { + NONE = 0, +}; +using BufferFlags = BufferFlagBit; +CC_ENUM_OPERATORS(BufferFlagBit); + +enum class MemoryAccessBit : FlagBits { + NONE = 0, + READ_ONLY = 0x1, + WRITE_ONLY = 0x2, + READ_WRITE = READ_ONLY | WRITE_ONLY, +}; +using MemoryAccess = MemoryAccessBit; + +enum class MemoryUsageBit : FlagBits { + NONE = 0, + DEVICE = 0x1, + HOST = 0x2, +}; +using MemoryUsage = MemoryUsageBit; +CC_ENUM_OPERATORS(MemoryUsageBit); + +enum class TextureType { + TEX1D, + TEX2D, + TEX3D, + CUBE, + TEX1D_ARRAY, + TEX2D_ARRAY, +}; + +enum class TextureUsageBit : FlagBits { + NONE = 0, + TRANSFER_SRC = 0x1, + TRANSFER_DST = 0x2, + SAMPLED = 0x4, + STORAGE = 0x8, + COLOR_ATTACHMENT = 0x10, + DEPTH_STENCIL_ATTACHMENT = 0x20, + INPUT_ATTACHMENT = 0x40, +}; +using TextureUsage = TextureUsageBit; +CC_ENUM_OPERATORS(TextureUsageBit); + +enum class TextureFlagBit : FlagBits { + NONE = 0, + GEN_MIPMAP = 0x1, + IMMUTABLE = 0x2, +}; +using TextureFlags = TextureFlagBit; +CC_ENUM_OPERATORS(TextureFlagBit); + +enum class SampleCount { + X1, + X2, + X4, + X8, + X16, + X32, + X64, +}; + +enum class Filter { + NONE, + POINT, + LINEAR, + ANISOTROPIC, +}; + +enum class Address { + WRAP, + MIRROR, + CLAMP, + BORDER, +}; + +enum class ComparisonFunc { + NEVER, + LESS, + EQUAL, + LESS_EQUAL, + GREATER, + NOT_EQUAL, + GREATER_EQUAL, + ALWAYS, +}; + +enum class StencilOp { + ZERO, + KEEP, + REPLACE, + INCR, + DECR, + INVERT, + INCR_WRAP, + DECR_WRAP, +}; + +enum class BlendFactor { + ZERO, + ONE, + SRC_ALPHA, + DST_ALPHA, + ONE_MINUS_SRC_ALPHA, + ONE_MINUS_DST_ALPHA, + SRC_COLOR, + DST_COLOR, + ONE_MINUS_SRC_COLOR, + ONE_MINUS_DST_COLOR, + SRC_ALPHA_SATURATE, + CONSTANT_COLOR, + ONE_MINUS_CONSTANT_COLOR, + CONSTANT_ALPHA, + ONE_MINUS_CONSTANT_ALPHA, +}; + +enum class BlendOp { + ADD, + SUB, + REV_SUB, + MIN, + MAX, +}; + +enum class ColorMask : FlagBits { + NONE = 0x0, + R = 0x1, + G = 0x2, + B = 0x4, + A = 0x8, + ALL = R | G | B | A, +}; +CC_ENUM_OPERATORS(ColorMask); + +enum class ShaderStageFlagBit : FlagBits { + NONE = 0x0, + VERTEX = 0x1, + CONTROL = 0x2, + EVALUATION = 0x4, + GEOMETRY = 0x8, + FRAGMENT = 0x10, + COMPUTE = 0x20, + ALL = 0x3f, +}; +using ShaderStageFlags = ShaderStageFlagBit; +CC_ENUM_OPERATORS(ShaderStageFlagBit); + +enum class LoadOp { + LOAD, // Load the contents from the fbo from previous + CLEAR, // Clear the fbo + DISCARD, // Ignore writing to the fbo and keep old data +}; + +enum class StoreOp { + STORE, // Write the source to the destination + DISCARD, // Don't write the source to the destination +}; + +enum class AccessType { + NONE, + + // Read access + INDIRECT_BUFFER, // Read as an indirect buffer for drawing or dispatch + INDEX_BUFFER, // Read as an index buffer for drawing + VERTEX_BUFFER, // Read as a vertex buffer for drawing + VERTEX_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a vertex shader + VERTEX_SHADER_READ_TEXTURE, // Read as a sampled image/uniform texel buffer in a vertex shader + VERTEX_SHADER_READ_OTHER, // Read as any other resource in a vertex shader + FRAGMENT_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a fragment shader + FRAGMENT_SHADER_READ_TEXTURE, // Read as a sampled image/uniform texel buffer in a fragment shader + FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT, // Read as an input attachment with a color format in a fragment shader + FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT, // Read as an input attachment with a depth/stencil format in a fragment shader + FRAGMENT_SHADER_READ_OTHER, // Read as any other resource in a fragment shader + COLOR_ATTACHMENT_READ, // Read by standard blending/logic operations or subpass load operations + DEPTH_STENCIL_ATTACHMENT_READ, // Read by depth/stencil tests or subpass load operations + COMPUTE_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a compute shader + COMPUTE_SHADER_READ_TEXTURE, // Read as a sampled image/uniform texel buffer in a compute shader + COMPUTE_SHADER_READ_OTHER, // Read as any other resource in a compute shader + TRANSFER_READ, // Read as the source of a transfer operation + HOST_READ, // Read on the host + PRESENT, // Read by the presentation engine + + // Write access + VERTEX_SHADER_WRITE, // Written as any resource in a vertex shader + FRAGMENT_SHADER_WRITE, // Written as any resource in a fragment shader + COLOR_ATTACHMENT_WRITE, // Written as a color attachment during rendering, or via a subpass store op + DEPTH_STENCIL_ATTACHMENT_WRITE, // Written as a depth/stencil attachment during rendering, or via a subpass store op + COMPUTE_SHADER_WRITE, // Written as any resource in a compute shader + TRANSFER_WRITE, // Written as the destination of a transfer operation + HOST_PREINITIALIZED, // Data pre-filled by host before device access starts + HOST_WRITE, // Written on the host +}; + +using AccessTypeList = std::vector; + +enum class PipelineBindPoint { + GRAPHICS, + COMPUTE, + RAY_TRACING, +}; + +enum class PrimitiveMode { + POINT_LIST, + LINE_LIST, + LINE_STRIP, + LINE_LOOP, + LINE_LIST_ADJACENCY, + LINE_STRIP_ADJACENCY, + ISO_LINE_LIST, + // raycast detectable: + TRIANGLE_LIST, + TRIANGLE_STRIP, + TRIANGLE_FAN, + TRIANGLE_LIST_ADJACENCY, + TRIANGLE_STRIP_ADJACENCY, + TRIANGLE_PATCH_ADJACENCY, + QUAD_PATCH_LIST, +}; + +enum class PolygonMode { + FILL, + POINT, + LINE, +}; + +enum class ShadeModel { + GOURAND, + FLAT, +}; + +enum class CullMode { + NONE, + FRONT, + BACK, +}; + +enum class DynamicStateFlagBit : FlagBits { + NONE = 0x0, + VIEWPORT = 0x1, + SCISSOR = 0x2, + LINE_WIDTH = 0x4, + DEPTH_BIAS = 0x8, + BLEND_CONSTANTS = 0x10, + DEPTH_BOUNDS = 0x20, + STENCIL_WRITE_MASK = 0x40, + STENCIL_COMPARE_MASK = 0x80, +}; +using DynamicStateFlags = DynamicStateFlagBit; +CC_ENUM_OPERATORS(DynamicStateFlagBit); + +using DynamicStateList = vector; + +enum class StencilFace { + FRONT, + BACK, + ALL, +}; + +enum class DescriptorType : FlagBits { + UNKNOWN = 0, + UNIFORM_BUFFER = 0x1, + DYNAMIC_UNIFORM_BUFFER = 0x2, + STORAGE_BUFFER = 0x4, + DYNAMIC_STORAGE_BUFFER = 0x8, + SAMPLER_TEXTURE = 0x10, + SAMPLER = 0x20, + TEXTURE = 0x40, + STORAGE_IMAGE = 0x80, + INPUT_ATTACHMENT = 0x100, +}; +CC_ENUM_OPERATORS(DescriptorType); + +enum class QueueType { + GRAPHICS, + COMPUTE, + TRANSFER, +}; + +enum class CommandBufferType { + PRIMARY, + SECONDARY, +}; + +enum class ClearFlagBit : FlagBits { + NONE = 0, + COLOR = 0x1, + DEPTH = 0x2, + STENCIL = 0x4, + DEPTH_STENCIL = DEPTH | STENCIL, + ALL = COLOR | DEPTH | STENCIL, +}; +using ClearFlags = ClearFlagBit; +CC_ENUM_OPERATORS(ClearFlagBit); + +struct Size { + uint x = 0U; + uint y = 0U; + uint z = 0U; +}; + +struct DeviceCaps { + uint maxVertexAttributes = 0U; + uint maxVertexUniformVectors = 0U; + uint maxFragmentUniformVectors = 0U; + uint maxTextureUnits = 0U; + uint maxImageUnits = 0U; + uint maxVertexTextureUnits = 0U; + uint maxColorRenderTargets = 0U; + uint maxShaderStorageBufferBindings = 0U; + uint maxShaderStorageBlockSize = 0U; + uint maxUniformBufferBindings = 0U; + uint maxUniformBlockSize = 0U; + uint maxTextureSize = 0U; + uint maxCubeMapTextureSize = 0U; + uint depthBits = 0U; + uint stencilBits = 0U; + uint uboOffsetAlignment = 1U; + + uint maxComputeSharedMemorySize = 0U; + uint maxComputeWorkGroupInvocations = 0U; + Size maxComputeWorkGroupSize; + Size maxComputeWorkGroupCount; + + float clipSpaceMinZ = -1.0F; + float screenSpaceSignY = 1.0F; + float clipSpaceSignY = 1.0F; +}; + +struct Offset { + int x = 0; + int y = 0; + int z = 0; +}; + +struct Rect { + int x = 0; + int y = 0; + uint width = 0U; + uint height = 0U; + + bool operator==(const Rect &rs) const { + return x == rs.x && + y == rs.y && + width == rs.width && + height == rs.height; + } + + bool operator!=(const Rect &rs) const { + return !(*this == rs); + } +}; + +struct Extent { + uint width = 0U; + uint height = 0U; + uint depth = 1U; +}; + +struct TextureSubresLayers { + uint mipLevel = 0U; + uint baseArrayLayer = 0U; + uint layerCount = 1U; +}; + +struct TextureSubresRange { + uint baseMipLevel = 0U; + uint levelCount = 1U; + uint baseArrayLayer = 0U; + uint layerCount = 1U; +}; + +struct TextureCopy { + TextureSubresLayers srcSubres; + Offset srcOffset; + TextureSubresLayers dstSubres; + Offset dstOffset; + Extent extent; +}; + +struct TextureBlit { + TextureSubresLayers srcSubres; + Offset srcOffset; + Extent srcExtent; + TextureSubresLayers dstSubres; + Offset dstOffset; + Extent dstExtent; +}; +using TextureBlitList = vector; + +struct BufferTextureCopy { + uint buffStride = 0; + uint buffTexHeight = 0; + Offset texOffset; + Extent texExtent; + TextureSubresLayers texSubres; +}; +using BufferTextureCopyList = vector; + +struct Viewport { + int left = 0; + int top = 0; + uint width = 0; + uint height = 0; + float minDepth = 0.0F; + float maxDepth = 1.0F; + + bool operator==(const Viewport &rs) const { + return (left == rs.left && + top == rs.top && + width == rs.width && + height == rs.height && + math::IsEqualF(minDepth, rs.minDepth) && + math::IsEqualF(maxDepth, maxDepth)); + } + + bool operator!=(const Viewport &rs) const { + return !(*this == rs); + } +}; + +struct Color { + float x = 0.0F; + float y = 0.0F; + float z = 0.0F; + float w = 0.0F; + + bool operator==(const Color &rhs) const { + return (math::IsEqualF(x, rhs.x) && + math::IsEqualF(y, rhs.y) && + math::IsEqualF(z, rhs.z) && + math::IsEqualF(w, rhs.w)); + } +}; +using ColorList = vector; + +/** + * For non-vulkan backends, to maintain compatibility and maximize + * descriptor cache-locality, descriptor-set-based binding numbers need + * to be mapped to backend-specific bindings based on maximum limit + * of available descriptor slots in each set. + * + * The GFX layer assumes the binding numbers for each descriptor type inside each set + * are guaranteed to be consecutive, so the mapping procedure is reduced + * to a simple shifting operation. This data structure specifies the + * offsets for each descriptor type in each set. + */ +struct BindingMappingInfo { + std::vector bufferOffsets; + std::vector samplerOffsets; + uint flexibleSet = 0U; +}; + +struct BufferInfo { + BufferUsage usage = BufferUsageBit::NONE; + MemoryUsage memUsage = MemoryUsageBit::NONE; + uint size = 0U; + uint stride = 0U; // in bytes + BufferFlags flags = BufferFlagBit::NONE; +}; + +struct BufferViewInfo { + Buffer *buffer = nullptr; + uint offset = 0U; + uint range = 0U; +}; + +struct DrawInfo { + uint vertexCount = 0U; + uint firstVertex = 0U; + uint indexCount = 0U; + uint firstIndex = 0U; + uint vertexOffset = 0U; + uint instanceCount = 0U; + uint firstInstance = 0U; +}; + +using DrawInfoList = vector; + +struct DispatchInfo { + uint groupCountX = 0U; + uint groupCountY = 0U; + uint groupCountZ = 0U; + + Buffer *indirectBuffer = nullptr; // @ts-nullable + uint indirectOffset = 0U; +}; + +using DispatchInfoList = vector; + +struct IndirectBuffer { + DrawInfoList drawInfos; +}; + +struct TextureInfo { + TextureType type = TextureType::TEX2D; + TextureUsage usage = TextureUsageBit::NONE; + Format format = Format::UNKNOWN; + uint width = 0U; + uint height = 0U; + TextureFlags flags = TextureFlagBit::NONE; + uint layerCount = 1U; + uint levelCount = 1U; + SampleCount samples = SampleCount::X1; + uint depth = 1U; +}; + +struct TextureViewInfo { + Texture * texture = nullptr; + TextureType type = TextureType::TEX2D; + Format format = Format::UNKNOWN; + uint baseLevel = 0U; + uint levelCount = 1U; + uint baseLayer = 0U; + uint layerCount = 1U; +}; + +struct SamplerInfo { + Filter minFilter = Filter::LINEAR; + Filter magFilter = Filter::LINEAR; + Filter mipFilter = Filter::NONE; + Address addressU = Address::WRAP; + Address addressV = Address::WRAP; + Address addressW = Address::WRAP; + uint maxAnisotropy = 0U; + ComparisonFunc cmpFunc = ComparisonFunc::ALWAYS; + Color borderColor; + float mipLODBias = 0.0F; +}; + +struct Uniform { + String name; + Type type = Type::UNKNOWN; + uint count = 0U; +}; + +using UniformList = vector; + +struct UniformBlock { + uint set = 0U; + uint binding = 0U; + String name; + UniformList members; + uint count = 0U; +}; + +using UniformBlockList = vector; + +struct UniformSamplerTexture { + uint set = 0U; + uint binding = 0U; + String name; + Type type = Type::UNKNOWN; + uint count = 0U; +}; + +using UniformSamplerTextureList = vector; + +struct UniformSampler { + uint set = 0U; + uint binding = 0U; + String name; + uint count = 0U; +}; + +using UniformSamplerList = vector; + +struct UniformTexture { + uint set = 0U; + uint binding = 0U; + String name; + Type type = Type::UNKNOWN; + uint count = 0U; +}; + +using UniformTextureList = vector; + +struct UniformStorageImage { + uint set = 0U; + uint binding = 0U; + String name; + Type type = Type::UNKNOWN; + uint count = 0U; + MemoryAccess memoryAccess = MemoryAccessBit::READ_WRITE; +}; + +using UniformStorageImageList = vector; + +struct UniformStorageBuffer { + uint set = 0U; + uint binding = 0U; + String name; + uint count = 0U; + MemoryAccess memoryAccess = MemoryAccessBit::READ_WRITE; +}; + +using UniformStorageBufferList = vector; + +struct UniformInputAttachment { + uint set = 0U; + uint binding = 0U; + String name; + uint count = 0U; +}; + +using UniformInputAttachmentList = vector; + +struct ShaderStage { + ShaderStageFlagBit stage = ShaderStageFlagBit::NONE; + String source; +}; + +using ShaderStageList = vector; + +struct Attribute { + String name; + Format format = Format::UNKNOWN; + bool isNormalized = false; + uint stream = 0; + bool isInstanced = false; + uint location = 0; +}; + +using AttributeList = vector; + +struct ShaderInfo { + String name; + ShaderStageList stages; + AttributeList attributes; + UniformBlockList blocks; + UniformStorageBufferList buffers; + UniformSamplerTextureList samplerTextures; + UniformSamplerList samplers; + UniformTextureList textures; + UniformStorageImageList images; + UniformInputAttachmentList subpassInputs; +}; + +struct InputAssemblerInfo { + AttributeList attributes; + BufferList vertexBuffers; + Buffer * indexBuffer = nullptr; // @ts-nullable + Buffer * indirectBuffer = nullptr; // @ts-nullable +}; + +struct ColorAttachment { + Format format = Format::UNKNOWN; + SampleCount sampleCount = SampleCount::X1; + LoadOp loadOp = LoadOp::CLEAR; + StoreOp storeOp = StoreOp::STORE; + std::vector beginAccesses; + std::vector endAccesses{AccessType::PRESENT}; +}; + +using ColorAttachmentList = vector; + +struct DepthStencilAttachment { + Format format = Format::UNKNOWN; + SampleCount sampleCount = SampleCount::X1; + LoadOp depthLoadOp = LoadOp::CLEAR; + StoreOp depthStoreOp = StoreOp::STORE; + LoadOp stencilLoadOp = LoadOp::CLEAR; + StoreOp stencilStoreOp = StoreOp::STORE; + std::vector beginAccesses; + std::vector endAccesses{AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE}; +}; + +struct SubpassInfo { + std::vector inputs; + std::vector colors; + std::vector resolves; + std::vector preserves; + uint depthStencil = INVALID_BINDING; +}; + +using SubpassInfoList = vector; + +struct SubpassDependency { + uint srcSubpass = 0U; + uint dstSubpass = 0U; + std::vector srcAccesses; + std::vector dstAccesses; +}; + +using SubpassDependencyList = vector; + +struct RenderPassInfo { + ColorAttachmentList colorAttachments; + DepthStencilAttachment depthStencilAttachment; + SubpassInfoList subpasses; + SubpassDependencyList dependencies; +}; + +struct GlobalBarrierInfo { + std::vector prevAccesses; + std::vector nextAccesses; +}; +using GlobalBarrierInfoList = vector; + +struct TextureBarrierInfo { + std::vector prevAccesses; + std::vector nextAccesses; + + bool discardContents = false; + + Queue *srcQueue = nullptr; // @ts-nullable + Queue *dstQueue = nullptr; // @ts-nullable +}; +using TextureBarrierInfoList = vector; + +struct FramebufferInfo { + RenderPass * renderPass = nullptr; + TextureList colorTextures; // @ts-overrides { type: '(Texture | null)[]' } + Texture * depthStencilTexture = nullptr; // @ts-nullable + std::vector colorMipmapLevels; + uint depthStencilMipmapLevel = 0; +}; + +struct DescriptorSetLayoutBinding { + uint binding = INVALID_BINDING; + DescriptorType descriptorType = DescriptorType::UNKNOWN; + uint count = 0; + ShaderStageFlags stageFlags = ShaderStageFlagBit::NONE; + SamplerList immutableSamplers; +}; +using DescriptorSetLayoutBindingList = vector; + +struct DescriptorSetLayoutInfo { + DescriptorSetLayoutBindingList bindings; +}; + +struct DescriptorSetInfo { + DescriptorSetLayout *layout = nullptr; +}; + +struct PipelineLayoutInfo { + DescriptorSetLayoutList setLayouts; +}; + +struct InputState { + AttributeList attributes; +}; + +// Use uint for all boolean values to convert memory to RasterizerState* in shared memory. +struct RasterizerState { + uint isDiscard = 0; + PolygonMode polygonMode = PolygonMode::FILL; + ShadeModel shadeModel = ShadeModel::GOURAND; + CullMode cullMode = CullMode::BACK; + uint isFrontFaceCCW = 1; + uint depthBiasEnabled = 0; + float depthBias = 0.0F; + float depthBiasClamp = 0.0F; + float depthBiasSlop = 0.0F; + uint isDepthClip = 1; + uint isMultisample = 0; + float lineWidth = 1.0F; +}; + +// Use uint for all boolean values to convert memory to DepthStencilState* in shared memory. +struct DepthStencilState { + uint depthTest = 1; + uint depthWrite = 1; + ComparisonFunc depthFunc = ComparisonFunc::LESS; + uint stencilTestFront = 0; + ComparisonFunc stencilFuncFront = ComparisonFunc::ALWAYS; + uint stencilReadMaskFront = 0xffffffff; + uint stencilWriteMaskFront = 0xffffffff; + StencilOp stencilFailOpFront = StencilOp::KEEP; + StencilOp stencilZFailOpFront = StencilOp::KEEP; + StencilOp stencilPassOpFront = StencilOp::KEEP; + uint stencilRefFront = 1; + uint stencilTestBack = 0; + ComparisonFunc stencilFuncBack = ComparisonFunc::ALWAYS; + uint stencilReadMaskBack = 0xffffffff; + uint stencilWriteMaskBack = 0xffffffff; + StencilOp stencilFailOpBack = StencilOp::KEEP; + StencilOp stencilZFailOpBack = StencilOp::KEEP; + StencilOp stencilPassOpBack = StencilOp::KEEP; + uint stencilRefBack = 1; +}; + +// Use uint for all boolean values to do convert memory to BlendTarget* in shared memory. +struct BlendTarget { + uint blend = 0; + BlendFactor blendSrc = BlendFactor::ONE; + BlendFactor blendDst = BlendFactor::ZERO; + BlendOp blendEq = BlendOp::ADD; + BlendFactor blendSrcAlpha = BlendFactor::ONE; + BlendFactor blendDstAlpha = BlendFactor::ZERO; + BlendOp blendAlphaEq = BlendOp::ADD; + ColorMask blendColorMask = ColorMask::ALL; +}; + +using BlendTargetList = vector; + +// Use uint for all boolean values to do memeory copy in shared memory. +struct BlendState { + uint isA2C = 0; + uint isIndepend = 0; + Color blendColor; + BlendTargetList targets{1}; +}; + +struct PipelineStateInfo { + Shader * shader = nullptr; + PipelineLayout * pipelineLayout = nullptr; + RenderPass * renderPass = nullptr; + InputState inputState; + RasterizerState rasterizerState; + DepthStencilState depthStencilState; + BlendState blendState; + PrimitiveMode primitive = PrimitiveMode::TRIANGLE_LIST; + DynamicStateFlags dynamicStates = DynamicStateFlagBit::NONE; + PipelineBindPoint bindPoint = PipelineBindPoint::GRAPHICS; + uint subpass = 0U; +}; + +struct CommandBufferInfo { + Queue * queue = nullptr; + CommandBufferType type = CommandBufferType::PRIMARY; +}; + +struct QueueInfo { + QueueType type = QueueType::GRAPHICS; +}; + +struct FormatInfo { + const String name; + const uint size = 0; + const uint count = 0; + const FormatType type = FormatType::NONE; + const bool hasAlpha = false; + const bool hasDepth = false; + const bool hasStencil = false; + const bool isCompressed = false; +}; + +struct MemoryStatus { + uint bufferSize = 0; + uint textureSize = 0; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDef.cpp b/native/cocos/renderer/gfx-base/GFXDef.cpp new file mode 100644 index 0000000000..422beb1b21 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDef.cpp @@ -0,0 +1,314 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXDef.h" + +namespace cc { +namespace gfx { + +const FormatInfo GFX_FORMAT_INFOS[] = { + {"UNKNOWN", 0, 0, FormatType::NONE, false, false, false, false}, + {"A8", 1, 1, FormatType::UNORM, true, false, false, false}, + {"L8", 1, 1, FormatType::UNORM, false, false, false, false}, + {"LA8", 1, 2, FormatType::UNORM, false, false, false, false}, + + {"R8", 1, 1, FormatType::UNORM, false, false, false, false}, + {"R8SN", 1, 1, FormatType::SNORM, false, false, false, false}, + {"R8UI", 1, 1, FormatType::UINT, false, false, false, false}, + {"R8I", 1, 1, FormatType::INT, false, false, false, false}, + {"R16F", 2, 1, FormatType::FLOAT, false, false, false, false}, + {"R16UI", 2, 1, FormatType::UINT, false, false, false, false}, + {"R16I", 2, 1, FormatType::INT, false, false, false, false}, + {"R32F", 4, 1, FormatType::FLOAT, false, false, false, false}, + {"R32UI", 4, 1, FormatType::UINT, false, false, false, false}, + {"R32I", 4, 1, FormatType::INT, false, false, false, false}, + + {"RG8", 2, 2, FormatType::UNORM, false, false, false, false}, + {"RG8SN", 2, 2, FormatType::SNORM, false, false, false, false}, + {"RG8UI", 2, 2, FormatType::UINT, false, false, false, false}, + {"RG8I", 2, 2, FormatType::INT, false, false, false, false}, + {"RG16F", 4, 2, FormatType::FLOAT, false, false, false, false}, + {"RG16UI", 4, 2, FormatType::UINT, false, false, false, false}, + {"RG16I", 4, 2, FormatType::INT, false, false, false, false}, + {"RG32F", 8, 2, FormatType::FLOAT, false, false, false, false}, + {"RG32UI", 8, 2, FormatType::UINT, false, false, false, false}, + {"RG32I", 8, 2, FormatType::INT, false, false, false, false}, + + {"RGB8", 3, 3, FormatType::UNORM, false, false, false, false}, + {"SRGB8", 3, 3, FormatType::UNORM, false, false, false, false}, + {"RGB8SN", 3, 3, FormatType::SNORM, false, false, false, false}, + {"RGB8UI", 3, 3, FormatType::UINT, false, false, false, false}, + {"RGB8I", 3, 3, FormatType::INT, false, false, false, false}, + {"RGB16F", 6, 3, FormatType::FLOAT, false, false, false, false}, + {"RGB16UI", 6, 3, FormatType::UINT, false, false, false, false}, + {"RGB16I", 6, 3, FormatType::INT, false, false, false, false}, + {"RGB32F", 12, 3, FormatType::FLOAT, false, false, false, false}, + {"RGB32UI", 12, 3, FormatType::UINT, false, false, false, false}, + {"RGB32I", 12, 3, FormatType::INT, false, false, false, false}, + + {"RGBA8", 4, 4, FormatType::UNORM, true, false, false, false}, + {"BGRA8", 4, 4, FormatType::UNORM, true, false, false, false}, + {"SRGB8_A8", 4, 4, FormatType::UNORM, true, false, false, false}, + {"RGBA8SN", 4, 4, FormatType::SNORM, true, false, false, false}, + {"RGBA8UI", 4, 4, FormatType::UINT, true, false, false, false}, + {"RGBA8I", 4, 4, FormatType::INT, true, false, false, false}, + {"RGBA16F", 8, 4, FormatType::FLOAT, true, false, false, false}, + {"RGBA16UI", 8, 4, FormatType::UINT, true, false, false, false}, + {"RGBA16I", 8, 4, FormatType::INT, true, false, false, false}, + {"RGBA32F", 16, 4, FormatType::FLOAT, true, false, false, false}, + {"RGBA32UI", 16, 4, FormatType::UINT, true, false, false, false}, + {"RGBA32I", 16, 4, FormatType::INT, true, false, false, false}, + + {"R5G6B5", 2, 3, FormatType::UNORM, false, false, false, false}, + {"R11G11B10F", 4, 3, FormatType::FLOAT, false, false, false, false}, + {"RGB5A1", 2, 4, FormatType::UNORM, true, false, false, false}, + {"RGBA4", 2, 4, FormatType::UNORM, true, false, false, false}, + {"RGB10A2", 2, 4, FormatType::UNORM, true, false, false, false}, + {"RGB10A2UI", 2, 4, FormatType::UINT, true, false, false, false}, + {"RGB9E5", 2, 4, FormatType::FLOAT, true, false, false, false}, + + {"D16", 2, 1, FormatType::UINT, false, true, false, false}, + {"D16S8", 3, 1, FormatType::UINT, false, true, true, false}, + {"D24", 3, 1, FormatType::UINT, false, true, false, false}, + {"D24S8", 2, 1, FormatType::UINT, false, true, true, false}, + {"D32F", 4, 1, FormatType::FLOAT, false, true, false, false}, + {"D32FS8", 5, 2, FormatType::FLOAT, false, true, true, false}, + + {"BC1", 1, 3, FormatType::UNORM, false, false, false, true}, + {"BC1_ALPHA", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC1_SRGB", 1, 3, FormatType::UNORM, false, false, false, true}, + {"BC1_SRGB_ALPHA", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC2", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC2_SRGB", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC3", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC3_SRGB", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC4", 1, 1, FormatType::UNORM, false, false, false, true}, + {"BC4_SNORM", 1, 1, FormatType::SNORM, false, false, false, true}, + {"BC5", 1, 2, FormatType::UNORM, false, false, false, true}, + {"BC5_SNORM", 1, 2, FormatType::SNORM, false, false, false, true}, + {"BC6H_UF16", 1, 3, FormatType::UFLOAT, false, false, false, true}, + {"BC6H_SF16", 1, 3, FormatType::FLOAT, false, false, false, true}, + {"BC7", 1, 4, FormatType::UNORM, true, false, false, true}, + {"BC7_SRGB", 1, 4, FormatType::UNORM, true, false, false, true}, + + {"ETC_RGB8", 1, 3, FormatType::UNORM, false, false, false, true}, + {"ETC2_RGB8", 1, 3, FormatType::UNORM, false, false, false, true}, + {"ETC2_SRGB8", 1, 3, FormatType::UNORM, false, false, false, true}, + {"ETC2_RGB8_A1", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ETC2_SRGB8_A1", 1, 4, FormatType::UNORM, true, false, false, true}, + {"EAC_R11", 1, 1, FormatType::UNORM, false, false, false, true}, + {"EAC_R11SN", 1, 1, FormatType::SNORM, false, false, false, true}, + {"EAC_RG11", 2, 2, FormatType::UNORM, false, false, false, true}, + {"EAC_RG11SN", 2, 2, FormatType::SNORM, false, false, false, true}, + + {"PVRTC_RGB2", 2, 3, FormatType::UNORM, false, false, false, true}, + {"PVRTC_RGBA2", 2, 4, FormatType::UNORM, true, false, false, true}, + {"PVRTC_RGB4", 2, 3, FormatType::UNORM, false, false, false, true}, + {"PVRTC_RGBA4", 2, 4, FormatType::UNORM, true, false, false, true}, + {"PVRTC2_2BPP", 2, 4, FormatType::UNORM, true, false, false, true}, + {"PVRTC2_4BPP", 2, 4, FormatType::UNORM, true, false, false, true}, + + {"ASTC_RGBA_4X4", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_5X4", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_5X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_6X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_6X6", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_8X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_8X6", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_8X8", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_10X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_10X6", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_10X8", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_10X10", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_12X10", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_RGBA_12X12", 1, 4, FormatType::UNORM, true, false, false, true}, + + {"ASTC_SRGBA_4X4", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_5X4", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_5X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_6X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_6X6", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_8X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_8X6", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_8X8", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_10X5", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_10X6", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_10X8", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_10X10", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_12X10", 1, 4, FormatType::UNORM, true, false, false, true}, + {"ASTC_SRGBA_12X12", 1, 4, FormatType::UNORM, true, false, false, true}, +}; + +bool isCombinedImageSampler(Type type) { return type >= Type::SAMPLER1D && type <= Type::SAMPLER_CUBE; } +bool isSampledImage(Type type) { return type >= Type::TEXTURE1D && type <= Type::TEXTURE_CUBE; } +bool isStorageImage(Type type) { return type >= Type::IMAGE1D && type <= Type::IMAGE_CUBE; } + +uint ceilDiv(uint x, uint y) { return (x - 1) / y + 1; } + +uint formatSize(Format format, uint width, uint height, uint depth) { + if (!GFX_FORMAT_INFOS[static_cast(format)].isCompressed) { + return (width * height * depth * GFX_FORMAT_INFOS[static_cast(format)].size); + } + switch (format) { + case Format::BC1: + case Format::BC1_ALPHA: + case Format::BC1_SRGB: + case Format::BC1_SRGB_ALPHA: + return ceilDiv(width, 4) * ceilDiv(height, 4) * 8 * depth; + case Format::BC2: + case Format::BC2_SRGB: + case Format::BC3: + case Format::BC3_SRGB: + case Format::BC4: + case Format::BC4_SNORM: + case Format::BC6H_SF16: + case Format::BC6H_UF16: + case Format::BC7: + case Format::BC7_SRGB: + return ceilDiv(width, 4) * ceilDiv(height, 4) * 16 * depth; + case Format::BC5: + case Format::BC5_SNORM: + return ceilDiv(width, 4) * ceilDiv(height, 4) * 32 * depth; + + case Format::ETC_RGB8: + case Format::ETC2_RGB8: + case Format::ETC2_SRGB8: + case Format::ETC2_RGB8_A1: + case Format::EAC_R11: + case Format::EAC_R11SN: + return ceilDiv(width, 4) * ceilDiv(height, 4) * 8 * depth; + case Format::ETC2_RGBA8: + case Format::ETC2_SRGB8_A1: + case Format::EAC_RG11: + case Format::EAC_RG11SN: + return ceilDiv(width, 4) * ceilDiv(height, 4) * 16 * depth; + + case Format::PVRTC_RGB2: + case Format::PVRTC_RGBA2: + case Format::PVRTC2_2BPP: + return ceilDiv(std::max(width, 16U) * std::max(height, 8U), 4) * depth; + case Format::PVRTC_RGB4: + case Format::PVRTC_RGBA4: + case Format::PVRTC2_4BPP: + return ceilDiv(std::max(width, 16U) * std::max(height, 8U), 2) * depth; + + case Format::ASTC_RGBA_4X4: + case Format::ASTC_SRGBA_4X4: + return ceilDiv(width, 4) * ceilDiv(height, 4) * 16 * depth; + case Format::ASTC_RGBA_5X4: + case Format::ASTC_SRGBA_5X4: + return ceilDiv(width, 5) * ceilDiv(height, 4) * 16 * depth; + case Format::ASTC_RGBA_5X5: + case Format::ASTC_SRGBA_5X5: + return ceilDiv(width, 5) * ceilDiv(height, 5) * 16 * depth; + case Format::ASTC_RGBA_6X5: + case Format::ASTC_SRGBA_6X5: + return ceilDiv(width, 6) * ceilDiv(height, 5) * 16 * depth; + case Format::ASTC_RGBA_6X6: + case Format::ASTC_SRGBA_6X6: + return ceilDiv(width, 6) * ceilDiv(height, 6) * 16 * depth; + case Format::ASTC_RGBA_8X5: + case Format::ASTC_SRGBA_8X5: + return ceilDiv(width, 8) * ceilDiv(height, 5) * 16 * depth; + case Format::ASTC_RGBA_8X6: + case Format::ASTC_SRGBA_8X6: + return ceilDiv(width, 8) * ceilDiv(height, 6) * 16 * depth; + case Format::ASTC_RGBA_8X8: + case Format::ASTC_SRGBA_8X8: + return ceilDiv(width, 8) * ceilDiv(height, 8) * 16 * depth; + case Format::ASTC_RGBA_10X5: + case Format::ASTC_SRGBA_10X5: + return ceilDiv(width, 10) * ceilDiv(height, 5) * 16 * depth; + case Format::ASTC_RGBA_10X6: + case Format::ASTC_SRGBA_10X6: + return ceilDiv(width, 10) * ceilDiv(height, 6) * 16 * depth; + case Format::ASTC_RGBA_10X8: + case Format::ASTC_SRGBA_10X8: + return ceilDiv(width, 10) * ceilDiv(height, 8) * 16 * depth; + case Format::ASTC_RGBA_10X10: + case Format::ASTC_SRGBA_10X10: + return ceilDiv(width, 10) * ceilDiv(height, 10) * 16 * depth; + case Format::ASTC_RGBA_12X10: + case Format::ASTC_SRGBA_12X10: + return ceilDiv(width, 12) * ceilDiv(height, 10) * 16 * depth; + case Format::ASTC_RGBA_12X12: + case Format::ASTC_SRGBA_12X12: + return ceilDiv(width, 12) * ceilDiv(height, 12) * 16 * depth; + default: + return 0; + } +} + +const uint GFX_TYPE_SIZES[] = { + 0, // UNKNOWN + 4, // BOOL + 8, // BOOL2 + 12, // BOOL3 + 16, // BOOL4 + 4, // INT + 8, // INT2 + 12, // INT3 + 16, // INT4 + 4, // UINT + 8, // UINT2 + 12, // UINT3 + 16, // UINT4 + 4, // FLOAT + 8, // FLOAT2 + 12, // FLOAT3 + 16, // FLOAT4 + 16, // MAT2 + 24, // MAT2X3 + 32, // MAT2X4 + 24, // MAT3X2 + 36, // MAT3 + 48, // MAT3X4 + 32, // MAT4X2 + 48, // MAT4X3 + 64, // MAT4 + 4, // SAMPLER1D + 4, // SAMPLER1D_ARRAY + 4, // SAMPLER2D + 4, // SAMPLER2D_ARRAY + 4, // SAMPLER3D + 4, // SAMPLER_CUBE +}; + +uint formatSurfaceSize(Format format, uint width, uint height, uint depth, uint mips) { + uint size = 0; + + for (uint i = 0; i < mips; ++i) { + size += formatSize(format, width, height, depth); + width = std::max(width >> 1, 1U); + height = std::max(height >> 1, 1U); + } + + return size; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDef.h b/native/cocos/renderer/gfx-base/GFXDef.h new file mode 100644 index 0000000000..707d2a4efc --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDef.h @@ -0,0 +1,113 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXDef-common.h" + +namespace cc { +namespace gfx { + +enum class VsyncMode { + // The application does not synchronizes with the vertical sync. + // If application renders faster than the display refreshes, frames are wasted and tearing may be observed. + // FPS is uncapped. Maximum power consumption. If unsupported, "ON" value will be used instead. Minimum latency. + OFF, + // The application is always synchronized with the vertical sync. Tearing does not happen. + // FPS is capped to the display's refresh rate. For fast applications, battery life is improved. Always supported. + ON, + // The application synchronizes with the vertical sync, but only if the application rendering speed is greater than refresh rate. + // Compared to OFF, there is no tearing. Compared to ON, the FPS will be improved for "slower" applications. + // If unsupported, "ON" value will be used instead. Recommended for most applications. Default if supported. + RELAXED, + // The presentation engine will always use the latest fully rendered image. + // Compared to OFF, no tearing will be observed. + // Compared to ON, battery power will be worse, especially for faster applications. + // If unsupported, "OFF" will be attempted next. + MAILBOX, + // The application is capped to using half the vertical sync time. + // FPS artificially capped to Half the display speed (usually 30fps) to maintain battery. + // Best possible battery savings. Worst possible performance. + // Recommended for specific applications where battery saving is critical. + HALF, +}; + +struct DeviceInfo { + bool isAntiAlias = false; + uintptr_t windowHandle = 0U; + uint width = 0U; + uint height = 0U; + uint nativeWidth = 0U; + uint nativeHeight = 0U; + BindingMappingInfo bindingMappingInfo; +}; + +enum class Performance { + HIGH_QUALITY, + LOW_POWER, + //BALANCE, +}; + +struct ContextInfo { + bool msaaEnabled = false; + Performance performance = Performance::LOW_POWER; + VsyncMode vsyncMode = VsyncMode::RELAXED; + uintptr_t windowHandle = 0; + Context* sharedCtx = nullptr; +}; + +constexpr TextureUsage TEXTURE_USAGE_TRANSIENT = static_cast( + static_cast(TextureUsageBit::COLOR_ATTACHMENT) | + static_cast(TextureUsageBit::DEPTH_STENCIL_ATTACHMENT) | + static_cast(TextureUsageBit::INPUT_ATTACHMENT)); + +constexpr DescriptorType DESCRIPTOR_BUFFER_TYPE = static_cast( + static_cast(DescriptorType::STORAGE_BUFFER) | + static_cast(DescriptorType::DYNAMIC_STORAGE_BUFFER) | + static_cast(DescriptorType::UNIFORM_BUFFER) | + static_cast(DescriptorType::DYNAMIC_UNIFORM_BUFFER)); + +constexpr DescriptorType DESCRIPTOR_TEXTURE_TYPE = static_cast( + static_cast(DescriptorType::SAMPLER_TEXTURE) | + static_cast(DescriptorType::SAMPLER) | + static_cast(DescriptorType::TEXTURE) | + static_cast(DescriptorType::STORAGE_IMAGE) | + static_cast(DescriptorType::INPUT_ATTACHMENT)); + +constexpr DescriptorType DESCRIPTOR_DYNAMIC_TYPE = static_cast( + static_cast(DescriptorType::DYNAMIC_STORAGE_BUFFER) | + static_cast(DescriptorType::DYNAMIC_UNIFORM_BUFFER)); + +constexpr uint DRAW_INFO_SIZE = 28U; + +extern const FormatInfo GFX_FORMAT_INFOS[]; +extern const uint GFX_TYPE_SIZES[]; + +extern uint formatSize(Format format, uint width, uint height, uint depth); + +extern uint formatSurfaceSize(Format format, uint width, uint height, uint depth, uint mips); + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDescriptorSet.cpp b/native/cocos/renderer/gfx-base/GFXDescriptorSet.cpp new file mode 100644 index 0000000000..217182c51d --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSet.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXDescriptorSet.h" +#include "GFXDescriptorSetLayout.h" +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +DescriptorSet::DescriptorSet() +: GFXObject(ObjectType::DESCRIPTOR_SET) { +} + +DescriptorSet::~DescriptorSet() = default; + +void DescriptorSet::initialize(const DescriptorSetInfo &info) { + CCASSERT(info.layout, "Invalid set layout"); + + _layout = info.layout; + uint descriptorCount = _layout->getDescriptorCount(); + _buffers.resize(descriptorCount); + _textures.resize(descriptorCount); + _samplers.resize(descriptorCount); + + doInit(info); +} + +void DescriptorSet::destroy() { + doDestroy(); + + _layout = nullptr; + // have to clear these or else it might not be properly updated when reused + _buffers.clear(); + _textures.clear(); + _samplers.clear(); +} + +void DescriptorSet::bindBuffer(uint binding, Buffer *buffer, uint index) { + const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; + if (_buffers[descriptorIndex + index] != buffer) { + _buffers[descriptorIndex + index] = buffer; + _isDirty = true; + } +} + +void DescriptorSet::bindTexture(uint binding, Texture *texture, uint index) { + const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; + if (_textures[descriptorIndex + index] != texture) { + _textures[descriptorIndex + index] = texture; + _isDirty = true; + } +} + +void DescriptorSet::bindSampler(uint binding, Sampler *sampler, uint index) { + const uint descriptorIndex = _layout->getDescriptorIndices()[binding]; + if (_samplers[descriptorIndex + index] != sampler) { + _samplers[descriptorIndex + index] = sampler; + _isDirty = true; + } +} + +bool DescriptorSet::bindBufferJSB(uint binding, Buffer *buffer, uint index) { + bindBuffer(binding, buffer, index); + return _isDirty; +} + +bool DescriptorSet::bindTextureJSB(uint binding, Texture *texture, uint index) { + bindTexture(binding, texture, index); + return _isDirty; +} + +bool DescriptorSet::bindSamplerJSB(uint binding, Sampler *sampler, uint index) { + bindSampler(binding, sampler, index); + return _isDirty; +} + +Buffer *DescriptorSet::getBuffer(uint binding, uint index) const { + const vector &descriptorIndices = _layout->getDescriptorIndices(); + if (binding >= descriptorIndices.size()) return nullptr; + const uint descriptorIndex = descriptorIndices[binding] + index; + if (descriptorIndex >= _buffers.size()) return nullptr; + return _buffers[descriptorIndex]; +} + +Texture *DescriptorSet::getTexture(uint binding, uint index) const { + const vector &descriptorIndices = _layout->getDescriptorIndices(); + if (binding >= descriptorIndices.size()) return nullptr; + const uint descriptorIndex = descriptorIndices[binding] + index; + if (descriptorIndex >= _textures.size()) return nullptr; + return _textures[descriptorIndex]; +} + +Sampler *DescriptorSet::getSampler(uint binding, uint index) const { + const vector &descriptorIndices = _layout->getDescriptorIndices(); + if (binding >= descriptorIndices.size()) return nullptr; + const uint descriptorIndex = descriptorIndices[binding] + index; + if (descriptorIndex >= _samplers.size()) return nullptr; + return _samplers[descriptorIndex]; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDescriptorSet.h b/native/cocos/renderer/gfx-base/GFXDescriptorSet.h new file mode 100644 index 0000000000..6bd48b93e3 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSet.h @@ -0,0 +1,77 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL DescriptorSet : public GFXObject { +public: + DescriptorSet(); + virtual ~DescriptorSet(); + +public: + void initialize(const DescriptorSetInfo &info); + void destroy(); + + virtual void update() = 0; + + virtual void bindBuffer(uint binding, Buffer *buffer, uint index); + virtual void bindTexture(uint binding, Texture *texture, uint index); + virtual void bindSampler(uint binding, Sampler *sampler, uint index); + + // Functions invoked by JSB adapter + bool bindBufferJSB(uint binding, Buffer *buffer, uint index); + bool bindTextureJSB(uint binding, Texture *texture, uint index); + bool bindSamplerJSB(uint binding, Sampler *sampler, uint index); + + Buffer * getBuffer(uint binding, uint index) const; + Texture *getTexture(uint binding, uint index) const; + Sampler *getSampler(uint binding, uint index) const; + + CC_INLINE void bindBuffer(uint binding, Buffer *buffer) { bindBuffer(binding, buffer, 0u); } + CC_INLINE void bindTexture(uint binding, Texture *texture) { bindTexture(binding, texture, 0u); } + CC_INLINE void bindSampler(uint binding, Sampler *sampler) { bindSampler(binding, sampler, 0u); } + CC_INLINE Buffer *getBuffer(uint binding) const { return getBuffer(binding, 0u); } + CC_INLINE Texture *getTexture(uint binding) const { return getTexture(binding, 0u); } + CC_INLINE Sampler *getSampler(uint binding) const { return getSampler(binding, 0u); } + +protected: + virtual void doInit(const DescriptorSetInfo &info) = 0; + virtual void doDestroy() = 0; + + DescriptorSetLayout *_layout; + BufferList _buffers; + TextureList _textures; + SamplerList _samplers; + + bool _isDirty = false; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp new file mode 100644 index 0000000000..fd7c20b60b --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GFXObject.h" +#include "base/CoreStd.h" + +#include "GFXDescriptorSetLayout.h" + +namespace cc { +namespace gfx { + +DescriptorSetLayout::DescriptorSetLayout() +: GFXObject(ObjectType::DESCRIPTOR_SET_LAYOUT) { +} + +DescriptorSetLayout::~DescriptorSetLayout() = default; + +void DescriptorSetLayout::initialize(const DescriptorSetLayoutInfo &info) { + _bindings = info.bindings; + uint bindingCount = static_cast(_bindings.size()); + _descriptorCount = 0U; + + if (bindingCount) { + uint maxBinding = 0U; + vector flattenedIndices(bindingCount); + for (uint i = 0U; i < bindingCount; i++) { + const DescriptorSetLayoutBinding &binding = _bindings[i]; + flattenedIndices[i] = _descriptorCount; + _descriptorCount += binding.count; + if (binding.binding > maxBinding) maxBinding = binding.binding; + } + + _bindingIndices.resize(maxBinding + 1, INVALID_BINDING); + _descriptorIndices.resize(maxBinding + 1, INVALID_BINDING); + for (uint i = 0U; i < bindingCount; i++) { + const DescriptorSetLayoutBinding &binding = _bindings[i]; + _bindingIndices[binding.binding] = i; + _descriptorIndices[binding.binding] = flattenedIndices[i]; + } + } + + doInit(info); +} + +void DescriptorSetLayout::destroy() { + doDestroy(); + + _bindings.clear(); + _descriptorCount = 0U; + _bindingIndices.clear(); + _descriptorIndices.clear(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.h b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.h new file mode 100644 index 0000000000..30222459ff --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDescriptorSetLayout.h @@ -0,0 +1,57 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL DescriptorSetLayout : public GFXObject { +public: + DescriptorSetLayout(); + virtual ~DescriptorSetLayout(); + + void initialize(const DescriptorSetLayoutInfo &info); + void destroy(); + + CC_INLINE const DescriptorSetLayoutBindingList &getBindings() const { return _bindings; } + CC_INLINE const vector &getBindingIndices() const { return _bindingIndices; } + CC_INLINE const vector &getDescriptorIndices() const { return _descriptorIndices; } + CC_INLINE const uint getDescriptorCount() const { return _descriptorCount; } + +protected: + virtual void doInit(const DescriptorSetLayoutInfo &info) = 0; + virtual void doDestroy() = 0; + + DescriptorSetLayoutBindingList _bindings; + uint _descriptorCount = 0u; + vector _bindingIndices; + vector _descriptorIndices; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDevice.cpp b/native/cocos/renderer/gfx-base/GFXDevice.cpp new file mode 100644 index 0000000000..b2323d5866 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDevice.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXContext.h" +#include "GFXDevice.h" +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +Device *Device::instance = nullptr; + +Device *Device::getInstance() { + return Device::instance; +} + +Device::Device() { + Device::instance = this; + memset(_features, 0, sizeof(_features)); +} + +Device::~Device() { + Device::instance = nullptr; +} + +Format Device::getColorFormat() const { + return _context->getColorFormat(); +} + +Format Device::getDepthStencilFormat() const { + return _context->getDepthStencilFormat(); +} + +bool Device::initialize(const DeviceInfo &info) { + _width = info.width; + _height = info.height; + _nativeWidth = info.nativeWidth; + _nativeHeight = info.nativeHeight; + _windowHandle = info.windowHandle; + + _bindingMappingInfo = info.bindingMappingInfo; + if (_bindingMappingInfo.bufferOffsets.empty()) { + _bindingMappingInfo.bufferOffsets.push_back(0); + } + if (_bindingMappingInfo.samplerOffsets.empty()) { + _bindingMappingInfo.samplerOffsets.push_back(0); + } + + return doInit(info); +} + +void Device::destroy() { + doDestroy(); + + _bindingMappingInfo.bufferOffsets.clear(); + _bindingMappingInfo.samplerOffsets.clear(); + _width = _height = _nativeWidth = _nativeHeight = _windowHandle = 0U; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXDevice.h b/native/cocos/renderer/gfx-base/GFXDevice.h new file mode 100644 index 0000000000..013fdf6254 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXDevice.h @@ -0,0 +1,289 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXBuffer.h" +#include "GFXCommandBuffer.h" +#include "GFXDescriptorSet.h" +#include "GFXDescriptorSetLayout.h" +#include "GFXFramebuffer.h" +#include "GFXGlobalBarrier.h" +#include "GFXInputAssembler.h" +#include "GFXObject.h" +#include "GFXPipelineLayout.h" +#include "GFXPipelineState.h" +#include "GFXQueue.h" +#include "GFXRenderPass.h" +#include "GFXSampler.h" +#include "GFXShader.h" +#include "GFXTexture.h" +#include "GFXTextureBarrier.h" + +namespace cc { +namespace gfx { + +class CC_DLL Device : public Object { +public: + static Device *getInstance(); + + ~Device() override; + + bool initialize(const DeviceInfo &info); + void destroy(); + + virtual void resize(uint width, uint height) = 0; + virtual void acquire() = 0; + virtual void present() = 0; + + virtual void flushCommands(CommandBuffer *const *cmdBuffs, uint count) {} + virtual void setMultithreaded(bool multithreaded) {} + + virtual SurfaceTransform getSurfaceTransform() const { return _transform; } + virtual uint getWidth() const { return _width; } + virtual uint getHeight() const { return _height; } + virtual uint getNativeWidth() const { return _nativeWidth; } + virtual uint getNativeHeight() const { return _nativeHeight; } + virtual MemoryStatus & getMemoryStatus() { return _memoryStatus; } + virtual uint getNumDrawCalls() const { return _numDrawCalls; } + virtual uint getNumInstances() const { return _numInstances; } + virtual uint getNumTris() const { return _numTriangles; } + + inline CommandBuffer * createCommandBuffer(const CommandBufferInfo &info); + inline Queue * createQueue(const QueueInfo &info); + inline Buffer * createBuffer(const BufferInfo &info); + inline Buffer * createBuffer(const BufferViewInfo &info); + inline Texture * createTexture(const TextureInfo &info); + inline Texture * createTexture(const TextureViewInfo &info); + inline Sampler * createSampler(const SamplerInfo &info); + inline Shader * createShader(const ShaderInfo &info); + inline InputAssembler * createInputAssembler(const InputAssemblerInfo &info); + inline RenderPass * createRenderPass(const RenderPassInfo &info); + inline Framebuffer * createFramebuffer(const FramebufferInfo &info); + inline DescriptorSet * createDescriptorSet(const DescriptorSetInfo &info); + inline DescriptorSetLayout *createDescriptorSetLayout(const DescriptorSetLayoutInfo &info); + inline PipelineLayout * createPipelineLayout(const PipelineLayoutInfo &info); + inline PipelineState * createPipelineState(const PipelineStateInfo &info); + inline GlobalBarrier * createGlobalBarrier(const GlobalBarrierInfo &info); + inline TextureBarrier * createTextureBarrier(const TextureBarrierInfo &info); + + inline void copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions); + inline void flushCommands(const vector &cmdBuffs); + inline void flushCommandsForJS(const vector &cmdBuffs); + + inline Queue * getQueue() const { return _queue; } + inline CommandBuffer * getCommandBuffer() const { return _cmdBuff; } + inline const DeviceCaps &getCapabilities() const { return _caps; } + inline API getGfxAPI() const { return _api; } + inline const String & getDeviceName() const { return _deviceName; } + inline const String & getRenderer() const { return _renderer; } + inline const String & getVendor() const { return _vendor; } + inline bool hasFeature(Feature feature) const { return _features[static_cast(feature)]; } + + inline const BindingMappingInfo &bindingMappingInfo() const { return _bindingMappingInfo; } + + Format getColorFormat() const; + Format getDepthStencilFormat() const; + +protected: + static Device *instance; + + friend class DeviceAgent; + friend class DeviceValidator; + friend class DeviceManager; + + Device(); + + virtual bool doInit(const DeviceInfo &info) = 0; + virtual void doDestroy() = 0; + + virtual CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) = 0; + virtual Queue * createQueue() = 0; + virtual Buffer * createBuffer() = 0; + virtual Texture * createTexture() = 0; + virtual Sampler * createSampler() = 0; + virtual Shader * createShader() = 0; + virtual InputAssembler * createInputAssembler() = 0; + virtual RenderPass * createRenderPass() = 0; + virtual Framebuffer * createFramebuffer() = 0; + virtual DescriptorSet * createDescriptorSet() = 0; + virtual DescriptorSetLayout *createDescriptorSetLayout() = 0; + virtual PipelineLayout * createPipelineLayout() = 0; + virtual PipelineState * createPipelineState() = 0; + virtual GlobalBarrier * createGlobalBarrier() = 0; + virtual TextureBarrier * createTextureBarrier() = 0; + virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) = 0; + + // On minimize + virtual void releaseSurface(uintptr_t windowHandle) {} + // On restore + virtual void acquireSurface(uintptr_t windowHandle) {} + + virtual void bindRenderContext(bool bound) {} + virtual void bindDeviceContext(bool bound) {} + + inline Context *getContext() const { return _context; } + + API _api = API::UNKNOWN; + SurfaceTransform _transform = SurfaceTransform::IDENTITY; + String _deviceName; + String _renderer; + String _vendor; + String _version; + bool _features[static_cast(Feature::COUNT)]; + uint _width = 0; + uint _height = 0; + uint _nativeWidth = 0; + uint _nativeHeight = 0; + MemoryStatus _memoryStatus; + uintptr_t _windowHandle = 0; + Context * _context = nullptr; + Queue * _queue = nullptr; + CommandBuffer * _cmdBuff = nullptr; + uint _numDrawCalls = 0U; + uint _numInstances = 0U; + uint _numTriangles = 0U; + BindingMappingInfo _bindingMappingInfo; + DeviceCaps _caps; +}; + +////////////////////////////////////////////////////////////////////////// + +CommandBuffer *Device::createCommandBuffer(const CommandBufferInfo &info) { + CommandBuffer *res = createCommandBuffer(info, false); + res->initialize(info); + return res; +} + +Queue *Device::createQueue(const QueueInfo &info) { + Queue *res = createQueue(); + res->initialize(info); + return res; +} + +Buffer *Device::createBuffer(const BufferInfo &info) { + Buffer *res = createBuffer(); + res->initialize(info); + return res; +} + +Buffer *Device::createBuffer(const BufferViewInfo &info) { + Buffer *res = createBuffer(); + res->initialize(info); + return res; +} + +Texture *Device::createTexture(const TextureInfo &info) { + Texture *res = createTexture(); + res->initialize(info); + return res; +} + +Texture *Device::createTexture(const TextureViewInfo &info) { + Texture *res = createTexture(); + res->initialize(info); + return res; +} + +Sampler *Device::createSampler(const SamplerInfo &info) { + Sampler *res = createSampler(); + res->initialize(info); + return res; +} + +Shader *Device::createShader(const ShaderInfo &info) { + Shader *res = createShader(); + res->initialize(info); + return res; +} + +InputAssembler *Device::createInputAssembler(const InputAssemblerInfo &info) { + InputAssembler *res = createInputAssembler(); + res->initialize(info); + return res; +} + +RenderPass *Device::createRenderPass(const RenderPassInfo &info) { + RenderPass *res = createRenderPass(); + res->initialize(info); + return res; +} + +Framebuffer *Device::createFramebuffer(const FramebufferInfo &info) { + Framebuffer *res = createFramebuffer(); + res->initialize(info); + return res; +} + +DescriptorSet *Device::createDescriptorSet(const DescriptorSetInfo &info) { + DescriptorSet *res = createDescriptorSet(); + res->initialize(info); + return res; +} + +DescriptorSetLayout *Device::createDescriptorSetLayout(const DescriptorSetLayoutInfo &info) { + DescriptorSetLayout *res = createDescriptorSetLayout(); + res->initialize(info); + return res; +} + +PipelineLayout *Device::createPipelineLayout(const PipelineLayoutInfo &info) { + PipelineLayout *res = createPipelineLayout(); + res->initialize(info); + return res; +} + +PipelineState *Device::createPipelineState(const PipelineStateInfo &info) { + PipelineState *res = createPipelineState(); + res->initialize(info); + return res; +} + +GlobalBarrier *Device::createGlobalBarrier(const GlobalBarrierInfo &info) { + GlobalBarrier *res = createGlobalBarrier(); + res->initialize(info); + return res; +} + +TextureBarrier *Device::createTextureBarrier(const TextureBarrierInfo &info) { + TextureBarrier *res = createTextureBarrier(); + res->initialize(info); + return res; +} + +void Device::copyBuffersToTexture(const BufferDataList &buffers, Texture *dst, const BufferTextureCopyList ®ions) { + copyBuffersToTexture(buffers.data(), dst, regions.data(), utils::toUint(regions.size())); +} + +void Device::flushCommands(const vector &cmdBuffs) { + flushCommands(cmdBuffs.data(), utils::toUint(cmdBuffs.size())); +} + +void Device::flushCommandsForJS(const vector &cmdBuffs) { + flushCommands(cmdBuffs.data(), utils::toUint(cmdBuffs.size())); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXFramebuffer.cpp b/native/cocos/renderer/gfx-base/GFXFramebuffer.cpp new file mode 100644 index 0000000000..d34545dcb1 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXFramebuffer.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXFramebuffer.h" +#include "GFXTexture.h" + +namespace cc { +namespace gfx { + +Framebuffer::Framebuffer() +: GFXObject(ObjectType::FRAMEBUFFER) { +} + +Framebuffer::~Framebuffer() = default; + +uint Framebuffer::computeHash(const FramebufferInfo &info) { + uint seed = static_cast(info.colorTextures.size() + info.colorMipmapLevels.size() + 2); + for (const Texture *attachment : info.colorTextures) { + seed ^= attachment->getTextureID() + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (uint level : info.colorMipmapLevels) { + seed ^= level + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + seed ^= info.depthStencilTexture->getTextureID() + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.depthStencilMipmapLevel) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + return seed; +} + +void Framebuffer::initialize(const FramebufferInfo &info) { + _renderPass = info.renderPass; + _colorTextures = info.colorTextures; + _depthStencilTexture = info.depthStencilTexture; + + doInit(info); +} + +void Framebuffer::destroy() { + doDestroy(); + + _renderPass = nullptr; + _colorTextures.clear(); + _depthStencilTexture = nullptr; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXFramebuffer.h b/native/cocos/renderer/gfx-base/GFXFramebuffer.h new file mode 100644 index 0000000000..c7aff3ef67 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXFramebuffer.h @@ -0,0 +1,57 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL Framebuffer : public GFXObject { +public: + Framebuffer(); + virtual ~Framebuffer(); + + static uint computeHash(const FramebufferInfo &info); + + void initialize(const FramebufferInfo &info); + void destroy(); + + CC_INLINE RenderPass *getRenderPass() const { return _renderPass; } + CC_INLINE const TextureList &getColorTextures() const { return _colorTextures; } + CC_INLINE Texture *getDepthStencilTexture() const { return _depthStencilTexture; } + +protected: + virtual void doInit(const FramebufferInfo &info) = 0; + virtual void doDestroy() = 0; + + RenderPass *_renderPass = nullptr; + TextureList _colorTextures; + Texture * _depthStencilTexture = nullptr; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXGlobalBarrier.cpp b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.cpp new file mode 100644 index 0000000000..29a6f12222 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXGlobalBarrier.h" +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +GlobalBarrier::GlobalBarrier() +: GFXObject(ObjectType::GLOBAL_BARRIER) { +} + +GlobalBarrier::~GlobalBarrier() = default; + +uint GlobalBarrier::computeHash(const GlobalBarrierInfo &info) { + uint seed = static_cast(info.prevAccesses.size() + info.nextAccesses.size()); + + for (const AccessType type : info.prevAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (const AccessType type : info.nextAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + + return seed; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXGlobalBarrier.h b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.h new file mode 100644 index 0000000000..594f38d73f --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXGlobalBarrier.h @@ -0,0 +1,55 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL GlobalBarrier : public GFXObject { +public: + GlobalBarrier(); + ~GlobalBarrier() override; + + static uint computeHash(const GlobalBarrierInfo &info); + + CC_INLINE const GlobalBarrierInfo &info() const { return _info; } + +protected: + friend class Device; + + virtual void doInit(const GlobalBarrierInfo &info) {} + + void initialize(const GlobalBarrierInfo &info) { + _info = info; doInit(info); + } + + GlobalBarrierInfo _info; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXInputAssembler.cpp b/native/cocos/renderer/gfx-base/GFXInputAssembler.cpp new file mode 100644 index 0000000000..ec24ab0a53 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXInputAssembler.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXBuffer.h" +#include "GFXInputAssembler.h" +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +InputAssembler::InputAssembler() +: GFXObject(ObjectType::INPUT_ASSEMBLER) { +} + +InputAssembler::~InputAssembler() = default; + +void InputAssembler::extractDrawInfo(DrawInfo &drawInfo) const { + drawInfo.vertexCount = _vertexCount; + drawInfo.firstVertex = _firstVertex; + drawInfo.indexCount = _indexCount; + drawInfo.firstIndex = _firstIndex; + drawInfo.vertexOffset = _vertexOffset; + drawInfo.instanceCount = _instanceCount; + drawInfo.firstInstance = _firstInstance; +} + +uint InputAssembler::computeAttributesHash() const { + // https://stackoverflow.com/questions/20511347/a-good-hash-function-for-a-vector + // 6: Attribute has 6 elements. + std::size_t seed = _attributes.size() * 6; + for (const auto &attribute : _attributes) { + seed ^= std::hash{}(attribute.name) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(attribute.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= attribute.isNormalized + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= attribute.stream + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= attribute.isInstanced + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= attribute.location + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + return static_cast(seed); +} + +void InputAssembler::initialize(const InputAssemblerInfo &info) { + _attributes = info.attributes; + _vertexBuffers = info.vertexBuffers; + _indexBuffer = info.indexBuffer; + _indirectBuffer = info.indirectBuffer; + + if (_indexBuffer) { + _indexCount = _indexBuffer->getCount(); + _firstIndex = 0; + } else if (!_vertexBuffers.empty()) { + _vertexCount = _vertexBuffers[0]->getCount(); + _firstVertex = 0; + _vertexOffset = 0; + } + _attributesHash = computeAttributesHash(); + + doInit(info); +} + +void InputAssembler::destroy() { + _attributes.clear(); + _vertexBuffers.clear(); + _indexBuffer = nullptr; + _indirectBuffer = nullptr; + _indexCount = _firstIndex = _vertexCount = _firstVertex = _vertexOffset = _attributesHash = 0U; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXInputAssembler.h b/native/cocos/renderer/gfx-base/GFXInputAssembler.h new file mode 100644 index 0000000000..2c6f7968e4 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXInputAssembler.h @@ -0,0 +1,85 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL InputAssembler : public GFXObject { +public: + InputAssembler(); + virtual ~InputAssembler(); + + void initialize(const InputAssemblerInfo &info); + void destroy(); + + void extractDrawInfo(DrawInfo &drawInfo) const; + + CC_INLINE const AttributeList &getAttributes() const { return _attributes; } + CC_INLINE const BufferList &getVertexBuffers() const { return _vertexBuffers; } + CC_INLINE Buffer *getIndexBuffer() const { return _indexBuffer; } + CC_INLINE Buffer *getIndirectBuffer() const { return _indirectBuffer; } + CC_INLINE uint getVertexCount() const { return _vertexCount; } + CC_INLINE uint getFirstVertex() const { return _firstVertex; } + CC_INLINE uint getIndexCount() const { return _indexCount; } + CC_INLINE uint getFirstIndex() const { return _firstIndex; } + CC_INLINE uint getVertexOffset() const { return _vertexOffset; } + CC_INLINE uint getInstanceCount() const { return _instanceCount; } + CC_INLINE uint getFirstInstance() const { return _firstInstance; } + CC_INLINE uint getAttributesHash() const { return _attributesHash; } + + virtual void setVertexCount(uint count) { _vertexCount = count; } + virtual void setFirstVertex(uint first) { _firstVertex = first; } + virtual void setIndexCount(uint count) { _indexCount = count; } + virtual void setFirstIndex(uint first) { _firstIndex = first; } + virtual void setVertexOffset(uint offset) { _vertexOffset = offset; } + virtual void setInstanceCount(uint count) { _instanceCount = count; } + virtual void setFirstInstance(uint first) { _firstInstance = first; } + +protected: + virtual void doInit(const InputAssemblerInfo &info) = 0; + virtual void doDestroy() = 0; + + uint computeAttributesHash() const; + + AttributeList _attributes; + BufferList _vertexBuffers; + Buffer * _indexBuffer = nullptr; + Buffer * _indirectBuffer = nullptr; + uint _vertexCount = 0; + uint _firstVertex = 0; + uint _indexCount = 0; + uint _firstIndex = 0; + uint _vertexOffset = 0; + uint _instanceCount = 0; + uint _firstInstance = 0; + uint _attributesHash = 0; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXObject.cpp b/native/cocos/renderer/gfx-base/GFXObject.cpp new file mode 100644 index 0000000000..05aaf6d17f --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXObject.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +GFXObject::GFXObject(ObjectType Type) +: _Type(Type) {} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXObject.h b/native/cocos/renderer/gfx-base/GFXObject.h new file mode 100644 index 0000000000..1fa16a845b --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXObject.h @@ -0,0 +1,46 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXDef.h" +#include "base/Object.h" + +namespace cc { +namespace gfx { + +class GFXObject : public Object { +public: + GFXObject(ObjectType Type); + virtual ~GFXObject() = default; + + CC_INLINE ObjectType getType() const { return _Type; } + +protected: + ObjectType _Type = ObjectType::UNKNOWN; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXPipelineLayout.cpp b/native/cocos/renderer/gfx-base/GFXPipelineLayout.cpp new file mode 100644 index 0000000000..c16fd5545f --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXPipelineLayout.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" +#include "GFXPipelineLayout.h" + +namespace cc { +namespace gfx { + +PipelineLayout::PipelineLayout() +: GFXObject(ObjectType::PIPELINE_LAYOUT) { +} + +PipelineLayout::~PipelineLayout() = default; + +void PipelineLayout::initialize(const PipelineLayoutInfo& info) { + _setLayouts = info.setLayouts; + + doInit(info); +} + +void PipelineLayout::destroy() { + doDestroy(); + + _setLayouts.clear(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXPipelineLayout.h b/native/cocos/renderer/gfx-base/GFXPipelineLayout.h new file mode 100644 index 0000000000..dc34bf3ae0 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXPipelineLayout.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL PipelineLayout : public GFXObject { +public: + PipelineLayout(); + virtual ~PipelineLayout(); + + void initialize(const PipelineLayoutInfo &info); + void destroy(); + + CC_INLINE const DescriptorSetLayoutList &getSetLayouts() const { return _setLayouts; } + +protected: + virtual void doInit(const PipelineLayoutInfo &info) = 0; + virtual void doDestroy() = 0; + + DescriptorSetLayoutList _setLayouts; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXPipelineState.cpp b/native/cocos/renderer/gfx-base/GFXPipelineState.cpp new file mode 100644 index 0000000000..007761ddc2 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXPipelineState.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" +#include "GFXPipelineState.h" + +namespace cc { +namespace gfx { + +PipelineState::PipelineState() +: GFXObject(ObjectType::PIPELINE_STATE) { +} + +PipelineState::~PipelineState() = default; + +void PipelineState::initialize(const PipelineStateInfo &info) { + _primitive = info.primitive; + _shader = info.shader; + _inputState = info.inputState; + _rasterizerState = info.rasterizerState; + _depthStencilState = info.depthStencilState; + _bindPoint = info.bindPoint; + _blendState = info.blendState; + _dynamicStates = info.dynamicStates; + _renderPass = info.renderPass; + _subpass = info.subpass; + _pipelineLayout = info.pipelineLayout; + + doInit(info); +} + +void PipelineState::destroy() { + doDestroy(); + + _shader = nullptr; + _renderPass = nullptr; + _pipelineLayout = nullptr; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXPipelineState.h b/native/cocos/renderer/gfx-base/GFXPipelineState.h new file mode 100644 index 0000000000..e48915b441 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXPipelineState.h @@ -0,0 +1,70 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL PipelineState : public GFXObject { +public: + PipelineState(); + ~PipelineState() override; + + void initialize(const PipelineStateInfo &info); + void destroy(); + + CC_INLINE Shader * getShader() const { return _shader; } + CC_INLINE PipelineBindPoint getBindPoint() const { return _bindPoint; } + CC_INLINE PrimitiveMode getPrimitive() const { return _primitive; } + CC_INLINE DynamicStateFlags getDynamicStates() const { return _dynamicStates; } + CC_INLINE const InputState &getInputState() const { return _inputState; } + CC_INLINE const RasterizerState &getRasterizerState() const { return _rasterizerState; } + CC_INLINE const DepthStencilState &getDepthStencilState() const { return _depthStencilState; } + CC_INLINE const BlendState &getBlendState() const { return _blendState; } + CC_INLINE const RenderPass *getRenderPass() const { return _renderPass; } + CC_INLINE const PipelineLayout *getPipelineLayout() const { return _pipelineLayout; } + +protected: + virtual void doInit(const PipelineStateInfo &info) = 0; + virtual void doDestroy() = 0; + + Shader * _shader = nullptr; + PipelineBindPoint _bindPoint = PipelineBindPoint::GRAPHICS; + PrimitiveMode _primitive = PrimitiveMode::TRIANGLE_LIST; + DynamicStateFlags _dynamicStates = DynamicStateFlags::NONE; + InputState _inputState; + RasterizerState _rasterizerState; + DepthStencilState _depthStencilState; + BlendState _blendState; + RenderPass * _renderPass = nullptr; + uint _subpass = 0U; + PipelineLayout * _pipelineLayout = nullptr; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXQueue.cpp b/native/cocos/renderer/gfx-base/GFXQueue.cpp new file mode 100644 index 0000000000..c3d402f79e --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXQueue.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" +#include "GFXQueue.h" + +namespace cc { +namespace gfx { + +Queue::Queue() +: GFXObject(ObjectType::QUEUE) { +} + +Queue::~Queue() = default; + +void Queue::initialize(const QueueInfo& info) { + _type = info.type; + + doInit(info); +} + +void Queue::destroy() { + doDestroy(); + + _type = QueueType::GRAPHICS; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXQueue.h b/native/cocos/renderer/gfx-base/GFXQueue.h new file mode 100644 index 0000000000..49d3945503 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXQueue.h @@ -0,0 +1,58 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" +#include "base/Utils.h" + +namespace cc { +namespace gfx { + +class CC_DLL Queue : public GFXObject { +public: + Queue(); + ~Queue() override; + + void initialize(const QueueInfo &info); + void destroy(); + + virtual void submit(CommandBuffer *const *cmdBuffs, uint count) = 0; + + CC_INLINE void submit(const CommandBufferList &cmdBuffs) { submit(cmdBuffs.data(), utils::toUint(cmdBuffs.size())); } + + CC_INLINE void submitForJS(const CommandBufferList &cmdBuffs) { submit(cmdBuffs.data(), utils::toUint(cmdBuffs.size())); } + + CC_INLINE QueueType getType() const { return _type; } + +protected: + virtual void doInit(const QueueInfo &info) = 0; + virtual void doDestroy() = 0; + + QueueType _type = QueueType::GRAPHICS; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXRenderPass.cpp b/native/cocos/renderer/gfx-base/GFXRenderPass.cpp new file mode 100644 index 0000000000..0a8abe55d3 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXRenderPass.cpp @@ -0,0 +1,217 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" +#include "GFXRenderPass.h" + +namespace cc { +namespace gfx { + +RenderPass::RenderPass() +: GFXObject(ObjectType::RENDER_PASS) { +} + +RenderPass::~RenderPass() = default; + +// Based on render pass compatibility +uint RenderPass::computeHash() { + // https://stackoverflow.com/questions/20511347/a-good-hash-function-for-a-vector + uint seed = 0; + if (!_subpasses.empty()) { + for (const SubpassInfo &subPass : _subpasses) { + for (const uint iaIndex : subPass.inputs) { + if (iaIndex >= _colorAttachments.size()) break; + seed += 2; + } + for (const uint caIndex : subPass.colors) { + if (caIndex >= _colorAttachments.size()) break; + seed += 2; + } + for (const uint raIndex : subPass.resolves) { + if (raIndex >= _colorAttachments.size()) break; + seed += 2; + } + for (const uint paIndex : subPass.preserves) { + if (paIndex >= _colorAttachments.size()) break; + seed += 2; + } + if (subPass.depthStencil < _colorAttachments.size()) { + seed += 2; + } + } + for (const SubpassInfo &subPass : _subpasses) { + for (const uint iaIndex : subPass.inputs) { + if (iaIndex >= _colorAttachments.size()) break; + const ColorAttachment &ia = _colorAttachments[iaIndex]; + seed ^= static_cast(ia.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(ia.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (const uint caIndex : subPass.colors) { + if (caIndex >= _colorAttachments.size()) break; + const ColorAttachment &ca = _colorAttachments[caIndex]; + seed ^= static_cast(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(ca.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (const uint raIndex : subPass.resolves) { + if (raIndex >= _colorAttachments.size()) break; + const ColorAttachment &ca = _colorAttachments[raIndex]; + seed ^= static_cast(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(ca.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (const uint paIndex : subPass.preserves) { + if (paIndex >= _colorAttachments.size()) break; + const ColorAttachment &ca = _colorAttachments[paIndex]; + seed ^= static_cast(ca.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(ca.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + if (subPass.depthStencil < _colorAttachments.size()) { + const ColorAttachment &ds = _colorAttachments[subPass.depthStencil]; + seed ^= static_cast(ds.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(ds.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + } + } else { + seed = static_cast(_colorAttachments.size() * 2 + 2); + for (const ColorAttachment &colorAttachment : _colorAttachments) { + seed ^= static_cast(colorAttachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(colorAttachment.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + seed ^= static_cast(_depthStencilAttachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(_depthStencilAttachment.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + + return seed; +} + +uint RenderPass::computeHash(const RenderPassInfo &info) { + static auto computeAttachmentHash = [](const ColorAttachment &attachment, uint &seed) { + seed ^= static_cast(attachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(attachment.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(attachment.loadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(attachment.storeOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + for (AccessType type : attachment.beginAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (AccessType type : attachment.endAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + }; + uint seed = 0; + if (!info.subpasses.empty()) { + for (const SubpassInfo &subPass : info.subpasses) { + for (const uint iaIndex : subPass.inputs) { + if (iaIndex >= info.colorAttachments.size()) break; + const ColorAttachment &ia = info.colorAttachments[iaIndex]; + seed += 4 + ia.beginAccesses.size() + ia.endAccesses.size(); + } + for (const uint caIndex : subPass.colors) { + if (caIndex >= info.colorAttachments.size()) break; + const ColorAttachment &ca = info.colorAttachments[caIndex]; + seed += 4 + ca.beginAccesses.size() + ca.endAccesses.size(); + } + for (const uint raIndex : subPass.resolves) { + if (raIndex >= info.colorAttachments.size()) break; + const ColorAttachment &ra = info.colorAttachments[raIndex]; + seed += 4 + ra.beginAccesses.size() + ra.endAccesses.size(); + } + for (const uint paIndex : subPass.preserves) { + if (paIndex >= info.colorAttachments.size()) break; + const ColorAttachment &pa = info.colorAttachments[paIndex]; + seed += 4 + pa.beginAccesses.size() + pa.endAccesses.size(); + } + if (subPass.depthStencil < info.colorAttachments.size()) { + const ColorAttachment &ds = info.colorAttachments[subPass.depthStencil]; + seed += 4 + ds.beginAccesses.size() + ds.endAccesses.size(); + } + } + for (const SubpassInfo &subpass : info.subpasses) { + for (const uint iaIndex : subpass.inputs) { + if (iaIndex >= info.colorAttachments.size()) break; + computeAttachmentHash(info.colorAttachments[iaIndex], seed); + } + for (const uint caIndex : subpass.colors) { + if (caIndex >= info.colorAttachments.size()) break; + computeAttachmentHash(info.colorAttachments[caIndex], seed); + } + for (const uint raIndex : subpass.resolves) { + if (raIndex >= info.colorAttachments.size()) break; + computeAttachmentHash(info.colorAttachments[raIndex], seed); + } + for (const uint paIndex : subpass.preserves) { + if (paIndex >= info.colorAttachments.size()) break; + computeAttachmentHash(info.colorAttachments[paIndex], seed); + } + if (subpass.depthStencil < info.colorAttachments.size()) { + computeAttachmentHash(info.colorAttachments[subpass.depthStencil], seed); + } + } + } else { + for (const ColorAttachment &ca : info.colorAttachments) { + seed += 4 + ca.beginAccesses.size() + ca.endAccesses.size(); + } + seed += 6 + info.depthStencilAttachment.beginAccesses.size() + info.depthStencilAttachment.endAccesses.size(); + + for (const ColorAttachment &ca : info.colorAttachments) { + computeAttachmentHash(ca, seed); + } + seed ^= static_cast(info.depthStencilAttachment.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.depthStencilAttachment.sampleCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.depthStencilAttachment.depthLoadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.depthStencilAttachment.depthStoreOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.depthStencilAttachment.stencilLoadOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.depthStencilAttachment.stencilStoreOp) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + for (AccessType type : info.depthStencilAttachment.beginAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (AccessType type : info.depthStencilAttachment.endAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + } + + return seed; +} + +void RenderPass::initialize(const RenderPassInfo &info) { + _colorAttachments = info.colorAttachments; + _depthStencilAttachment = info.depthStencilAttachment; + _subpasses = info.subpasses; + _dependencies = info.dependencies; + _hash = computeHash(); + + doInit(info); +} + +void RenderPass::destroy() { + doDestroy(); + + _colorAttachments.clear(); + _subpasses.clear(); + _hash = 0U; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXRenderPass.h b/native/cocos/renderer/gfx-base/GFXRenderPass.h new file mode 100644 index 0000000000..112da006a1 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXRenderPass.h @@ -0,0 +1,63 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL RenderPass : public GFXObject { +public: + RenderPass(); + ~RenderPass() override; + + static uint computeHash(const RenderPassInfo &info); + + void initialize(const RenderPassInfo &info); + void destroy(); + + inline const ColorAttachmentList & getColorAttachments() const { return _colorAttachments; } + inline const DepthStencilAttachment &getDepthStencilAttachment() const { return _depthStencilAttachment; } + inline const SubpassInfoList & getSubpasses() const { return _subpasses; } + inline const SubpassDependencyList & getDependencies() const { return _dependencies; } + inline uint getHash() const { return _hash; } + +protected: + uint computeHash(); + + virtual void doInit(const RenderPassInfo &info) = 0; + virtual void doDestroy() = 0; + + ColorAttachmentList _colorAttachments; + DepthStencilAttachment _depthStencilAttachment; + SubpassInfoList _subpasses; + SubpassDependencyList _dependencies; + uint _hash = 0; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXSampler.cpp b/native/cocos/renderer/gfx-base/GFXSampler.cpp new file mode 100644 index 0000000000..87567f715b --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXSampler.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" +#include "GFXSampler.h" + +namespace cc { +namespace gfx { + +Sampler::Sampler() +: GFXObject(ObjectType::SAMPLER) { + _borderColor.x = 0.0F; + _borderColor.y = 0.0F; + _borderColor.z = 0.0F; + _borderColor.w = 0.0F; +} + +Sampler::~Sampler() = default; + +void Sampler::initialize(const SamplerInfo &info) { + _minFilter = info.minFilter; + _magFilter = info.magFilter; + _mipFilter = info.mipFilter; + _addressU = info.addressU; + _addressV = info.addressV; + _addressW = info.addressW; + _maxAnisotropy = info.maxAnisotropy; + _cmpFunc = info.cmpFunc; + _borderColor = info.borderColor; + _mipLODBias = info.mipLODBias; + + doInit(info); +} + +void Sampler::destroy() { + doDestroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXSampler.h b/native/cocos/renderer/gfx-base/GFXSampler.h new file mode 100644 index 0000000000..e0a2545290 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXSampler.h @@ -0,0 +1,69 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL Sampler : public GFXObject { +public: + Sampler(); + virtual ~Sampler(); + + void initialize(const SamplerInfo &info); + void destroy(); + + CC_INLINE Filter getMinFilter() const { return _minFilter; } + CC_INLINE Filter getMagFilter() const { return _magFilter; } + CC_INLINE Filter getMipFilter() const { return _mipFilter; } + CC_INLINE Address getAddressU() const { return _addressU; } + CC_INLINE Address getAddressV() const { return _addressV; } + CC_INLINE Address getAddressW() const { return _addressW; } + CC_INLINE uint getMaxAnisotropy() const { return _maxAnisotropy; } + CC_INLINE ComparisonFunc getCmpFunc() const { return _cmpFunc; } + CC_INLINE const Color &getBorderColor() const { return _borderColor; } + CC_INLINE float getMipLODBias() const { return _mipLODBias; } + +protected: + virtual void doInit(const SamplerInfo &info) = 0; + virtual void doDestroy() = 0; + + Filter _minFilter = Filter::NONE; + Filter _magFilter = Filter::NONE; + Filter _mipFilter = Filter::NONE; + Address _addressU = Address::WRAP; + Address _addressV = Address::WRAP; + Address _addressW = Address::WRAP; + uint _maxAnisotropy = 0; + ComparisonFunc _cmpFunc = ComparisonFunc::ALWAYS; + Color _borderColor; + float _mipLODBias = 0.0f; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXShader.cpp b/native/cocos/renderer/gfx-base/GFXShader.cpp new file mode 100644 index 0000000000..c83ec04f2c --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXShader.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXDevice.h" +#include "GFXObject.h" +#include "GFXShader.h" + +namespace cc { +namespace gfx { + +Shader::Shader() +: GFXObject(ObjectType::SHADER) { + _shaderID = generateShaderID(); +} + +Shader::~Shader() = default; + +void Shader::initialize(const ShaderInfo &info) { + _name = info.name; + _stages = info.stages; + _attributes = info.attributes; + _blocks = info.blocks; + _buffers = info.buffers; + _samplerTextures = info.samplerTextures; + _samplers = info.samplers; + _textures = info.textures; + _images = info.images; + _subpassInputs = info.subpassInputs; + + doInit(info); +} + +void Shader::destroy() { + doDestroy(); + + _stages.clear(); + _attributes.clear(); + _blocks.clear(); + _buffers.clear(); + _samplerTextures.clear(); + _samplers.clear(); + _textures.clear(); + _images.clear(); + _subpassInputs.clear(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXShader.h b/native/cocos/renderer/gfx-base/GFXShader.h new file mode 100644 index 0000000000..7586e36488 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXShader.h @@ -0,0 +1,76 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL Shader : public GFXObject { +public: + Shader(); + virtual ~Shader(); + + void initialize(const ShaderInfo &info); + void destroy(); + + CC_INLINE uint getID() const { return _shaderID; } + CC_INLINE const String &getName() const { return _name; } + CC_INLINE const ShaderStageList &getStages() const { return _stages; } + CC_INLINE const AttributeList &getAttributes() const { return _attributes; } + CC_INLINE const UniformBlockList &getBlocks() const { return _blocks; } + CC_INLINE const UniformStorageBufferList &getBuffers() const { return _buffers; } + CC_INLINE const UniformSamplerTextureList &getSamplerTextures() const { return _samplerTextures; } + CC_INLINE const UniformSamplerList &getSamplers() const { return _samplers; } + CC_INLINE const UniformTextureList &getTextures() const { return _textures; } + CC_INLINE const UniformStorageImageList &getImages() const { return _images; } + CC_INLINE const UniformInputAttachmentList &getSubpassInputs() const { return _subpassInputs; } + +protected: + static uint generateShaderID() noexcept { + static uint _idGen = 10000; + return _idGen++; + } + + virtual void doInit(const ShaderInfo &info) = 0; + virtual void doDestroy() = 0; + + uint _shaderID = 0; + String _name; + ShaderStageList _stages; + AttributeList _attributes; + UniformBlockList _blocks; + UniformStorageBufferList _buffers; + UniformSamplerTextureList _samplerTextures; + UniformSamplerList _samplers; + UniformTextureList _textures; + UniformStorageImageList _images; + UniformInputAttachmentList _subpassInputs; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXTexture.cpp b/native/cocos/renderer/gfx-base/GFXTexture.cpp new file mode 100644 index 0000000000..0c79f66260 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXTexture.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXDevice.h" +#include "GFXObject.h" +#include "GFXTexture.h" + +namespace cc { +namespace gfx { + +Texture::Texture() +: GFXObject(ObjectType::TEXTURE) { + _textureID = generateTextureID(); +} + +Texture::~Texture() = default; + +uint Texture::computeHash(const TextureInfo &info) { + uint seed = 10; + seed ^= static_cast(info.type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.usage) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.format) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.width) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.height) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.flags) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.layerCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.levelCount) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(info.samples) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.depth) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + return seed; +} + +void Texture::initialize(const TextureInfo &info) { + _type = info.type; + _usage = info.usage; + _format = info.format; + _width = info.width; + _height = info.height; + _depth = info.depth; + _layerCount = info.layerCount; + _levelCount = info.levelCount; + _samples = info.samples; + _flags = info.flags; + _size = formatSize(_format, _width, _height, _depth); + + Device::getInstance()->getMemoryStatus().textureSize += _size; + + doInit(info); +} + +void Texture::initialize(const TextureViewInfo &info) { + _isTextureView = true; + + _type = info.texture->getType(); + _format = info.format; + _baseLayer = info.baseLayer; + _layerCount = info.layerCount; + _baseLevel = info.baseLevel; + _levelCount = info.levelCount; + _usage = info.texture->getUsage(); + _width = info.texture->getWidth(); + _height = info.texture->getHeight(); + _depth = info.texture->getDepth(); + _samples = info.texture->getSamples(); + _flags = info.texture->getFlags(); + _size = formatSize(_format, _width, _height, _depth); + _isTextureView = true; + + doInit(info); +} + +void Texture::destroy() { + doDestroy(); + + Device::getInstance()->getMemoryStatus().textureSize -= _size; + + _format = Format::UNKNOWN; + _width = _height = _depth = _size = 0; +} + +void Texture::resize(uint width, uint height) { + if (_width != width || _height != height) { + uint size = formatSize(_format, width, height, _depth); + doResize(width, height, size); + + Device::getInstance()->getMemoryStatus().textureSize -= _size; + + _width = width; + _height = height; + _size = size; + Device::getInstance()->getMemoryStatus().textureSize += _size; + } +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXTexture.h b/native/cocos/renderer/gfx-base/GFXTexture.h new file mode 100644 index 0000000000..c6b12c2832 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXTexture.h @@ -0,0 +1,88 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL Texture : public GFXObject { +public: + Texture(); + ~Texture() override; + + static uint computeHash(const TextureInfo &info); + + void initialize(const TextureInfo &info); + void initialize(const TextureViewInfo &info); + void destroy(); + void resize(uint width, uint height); + + CC_INLINE uint getTextureID() const { return _textureID; } + CC_INLINE TextureType getType() const { return _type; } + CC_INLINE TextureUsage getUsage() const { return _usage; } + CC_INLINE Format getFormat() const { return _format; } + CC_INLINE uint getWidth() const { return _width; } + CC_INLINE uint getHeight() const { return _height; } + CC_INLINE uint getDepth() const { return _depth; } + CC_INLINE uint getLayerCount() const { return _layerCount; } + CC_INLINE uint getLevelCount() const { return _levelCount; } + CC_INLINE uint getSize() const { return _size; } + CC_INLINE SampleCount getSamples() const { return _samples; } + CC_INLINE TextureFlags getFlags() const { return _flags; } + CC_INLINE bool isTextureView() const { return _isTextureView; } + +protected: + static uint generateTextureID() noexcept { + static uint idGen = 0; + return idGen++; + } + + virtual void doInit(const TextureInfo &info) = 0; + virtual void doInit(const TextureViewInfo &info) = 0; + virtual void doDestroy() = 0; + virtual void doResize(uint width, uint height, uint size) = 0; + + uint _textureID = 0; + TextureType _type = TextureType::TEX2D; + TextureUsage _usage = TextureUsageBit::NONE; + Format _format = Format::UNKNOWN; + uint _width = 0U; + uint _height = 0U; + uint _depth = 1U; + uint _baseLevel = 0U; + uint _levelCount = 1U; + uint _baseLayer = 0U; + uint _layerCount = 1U; + uint _size = 0U; + SampleCount _samples = SampleCount::X1; + TextureFlags _flags = TextureFlagBit::NONE; + bool _isTextureView = false; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXTextureBarrier.cpp b/native/cocos/renderer/gfx-base/GFXTextureBarrier.cpp new file mode 100644 index 0000000000..9e2d6d3649 --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXTextureBarrier.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "GFXObject.h" +#include "GFXQueue.h" +#include "GFXTextureBarrier.h" + +namespace cc { +namespace gfx { + +TextureBarrier::TextureBarrier() +: GFXObject(ObjectType::TEXTURE_BARRIER) { +} + +TextureBarrier::~TextureBarrier() = default; + +uint TextureBarrier::computeHash(const TextureBarrierInfo &info) { + uint seed = static_cast(info.prevAccesses.size() + info.nextAccesses.size() + 3); + + for (const AccessType type : info.prevAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + for (const AccessType type : info.nextAccesses) { + seed ^= static_cast(type) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + + seed ^= info.discardContents + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.srcQueue ? static_cast(info.srcQueue->getType()) : 0U) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= (info.dstQueue ? static_cast(info.dstQueue->getType()) : 0U) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + + return seed; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-base/GFXTextureBarrier.h b/native/cocos/renderer/gfx-base/GFXTextureBarrier.h new file mode 100644 index 0000000000..17d286546f --- /dev/null +++ b/native/cocos/renderer/gfx-base/GFXTextureBarrier.h @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "GFXObject.h" + +namespace cc { +namespace gfx { + +class CC_DLL TextureBarrier : public GFXObject { +public: + TextureBarrier(); + virtual ~TextureBarrier(); + + static uint computeHash(const TextureBarrierInfo &info); + + CC_INLINE const TextureBarrierInfo &info() const { return _info; } + +protected: + friend class Device; + + virtual void doInit(const TextureBarrierInfo &info) {} + + void initialize(const TextureBarrierInfo &info) { _info = info; doInit(info); } + + TextureBarrierInfo _info; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyBuffer.cpp b/native/cocos/renderer/gfx-empty/EmptyBuffer.cpp new file mode 100644 index 0000000000..867eedfb96 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyBuffer.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyBuffer.h" + +namespace cc { +namespace gfx { + +void EmptyBuffer::doInit(const BufferInfo &info) { +} + +void EmptyBuffer::doInit(const BufferViewInfo &info) { +} + +void EmptyBuffer::doResize(uint size, uint count) { +} + +void EmptyBuffer::doDestroy() { +} + +void EmptyBuffer::update(const void *buffer, uint size) { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyBuffer.h b/native/cocos/renderer/gfx-empty/EmptyBuffer.h new file mode 100644 index 0000000000..39916c2f1c --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyBuffer.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXBuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyBuffer final : public Buffer { +public: + void update(const void *buffer, uint size) override; + +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doResize(uint size, uint count) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyCommandBuffer.cpp b/native/cocos/renderer/gfx-empty/EmptyCommandBuffer.cpp new file mode 100644 index 0000000000..b1b1142511 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyCommandBuffer.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyCommandBuffer.h" + +namespace cc { +namespace gfx { + +void EmptyCommandBuffer::doInit(const CommandBufferInfo &info) { +} + +void EmptyCommandBuffer::doDestroy() { +} + +void EmptyCommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) { +} + +void EmptyCommandBuffer::end() { +} + +void EmptyCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) { +} + +void EmptyCommandBuffer::endRenderPass() { +} + +void EmptyCommandBuffer::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { +} + +void EmptyCommandBuffer::bindPipelineState(PipelineState *pso) { +} + +void EmptyCommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) { +} + +void EmptyCommandBuffer::bindInputAssembler(InputAssembler *ia) { +} + +void EmptyCommandBuffer::setViewport(const Viewport &vp) { +} + +void EmptyCommandBuffer::setScissor(const Rect &rect) { +} + +void EmptyCommandBuffer::setLineWidth(float width) { +} + +void EmptyCommandBuffer::setDepthBias(float constant, float clamp, float slope) { +} + +void EmptyCommandBuffer::setBlendConstants(const Color &constants) { +} + +void EmptyCommandBuffer::setDepthBound(float minBounds, float maxBounds) { +} + +void EmptyCommandBuffer::setStencilWriteMask(StencilFace face, uint mask) { +} + +void EmptyCommandBuffer::setStencilCompareMask(StencilFace face, int ref, uint mask) { +} + +void EmptyCommandBuffer::nextSubpass() { +} + +void EmptyCommandBuffer::draw(const DrawInfo &info) { +} + +void EmptyCommandBuffer::updateBuffer(Buffer *buff, const void *data, uint size) { +} + +void EmptyCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { +} + +void EmptyCommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { +} + +void EmptyCommandBuffer::dispatch(const DispatchInfo &info) { +} + +void EmptyCommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyCommandBuffer.h b/native/cocos/renderer/gfx-empty/EmptyCommandBuffer.h new file mode 100644 index 0000000000..08713402f8 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyCommandBuffer.h @@ -0,0 +1,65 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXCommandBuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyCommandBuffer final : public CommandBuffer { +public: + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void bindPipelineState(PipelineState *pso) override; + void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; + void bindInputAssembler(InputAssembler *ia) override; + void setViewport(const Viewport &vp) override; + void setScissor(const Rect &rect) override; + void setLineWidth(float width) override; + void setDepthBias(float constant, float clamp, float slope) override; + void setBlendConstants(const Color &constants) override; + void setDepthBound(float minBounds, float maxBounds) override; + void setStencilWriteMask(StencilFace face, uint mask) override; + void setStencilCompareMask(StencilFace face, int ref, uint mask) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; + +protected: + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyContext.cpp b/native/cocos/renderer/gfx-empty/EmptyContext.cpp new file mode 100644 index 0000000000..c558b54e98 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyContext.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyContext.h" + +namespace cc { +namespace gfx { + +bool EmptyContext::doInit(const ContextInfo &info) { + _colorFmt = Format::RGBA8; + _depthStencilFmt = Format::D24S8; + + return true; +} + +void EmptyContext::doDestroy() { +} + +void EmptyContext::present() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyContext.h b/native/cocos/renderer/gfx-empty/EmptyContext.h new file mode 100644 index 0000000000..835eca9b8b --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyContext.h @@ -0,0 +1,43 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXContext.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyContext final : public Context { +public: + void present() override; + +protected: + bool doInit(const ContextInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyDescriptorSet.cpp b/native/cocos/renderer/gfx-empty/EmptyDescriptorSet.cpp new file mode 100644 index 0000000000..c1b416c767 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyDescriptorSet.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyDescriptorSet.h" + +namespace cc { +namespace gfx { + +void EmptyDescriptorSet::doInit(const DescriptorSetInfo &info) { +} + +void EmptyDescriptorSet::doDestroy() { +} + +void EmptyDescriptorSet::update() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyDescriptorSet.h b/native/cocos/renderer/gfx-empty/EmptyDescriptorSet.h new file mode 100644 index 0000000000..1f426138ce --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyDescriptorSet.h @@ -0,0 +1,43 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXDescriptorSet.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyDescriptorSet final : public DescriptorSet { +public: + void update() override; + +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.cpp b/native/cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.cpp new file mode 100644 index 0000000000..f67907acf9 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyDescriptorSetLayout.h" + +namespace cc { +namespace gfx { + +void EmptyDescriptorSetLayout::doInit(const DescriptorSetLayoutInfo &info) { +} + +void EmptyDescriptorSetLayout::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.h b/native/cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.h new file mode 100644 index 0000000000..4d5735945c --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXDescriptorSetLayout.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyDescriptorSetLayout final : public DescriptorSetLayout { +public: +protected: + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyDevice.cpp b/native/cocos/renderer/gfx-empty/EmptyDevice.cpp new file mode 100644 index 0000000000..e07e8c6f32 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyDevice.cpp @@ -0,0 +1,171 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "EmptyBuffer.h" +#include "EmptyCommandBuffer.h" +#include "EmptyContext.h" +#include "EmptyDescriptorSet.h" +#include "EmptyDescriptorSetLayout.h" +#include "EmptyDevice.h" +#include "EmptyFramebuffer.h" +#include "EmptyInputAssembler.h" +#include "EmptyPipelineLayout.h" +#include "EmptyPipelineState.h" +#include "EmptyQueue.h" +#include "EmptyRenderPass.h" +#include "EmptySampler.h" +#include "EmptyShader.h" +#include "EmptyTexture.h" + +namespace cc { +namespace gfx { + +EmptyDevice *EmptyDevice::_instance = nullptr; + +EmptyDevice *EmptyDevice::getInstance() { + return EmptyDevice::_instance; +} + +EmptyDevice::EmptyDevice() { + EmptyDevice::_instance = this; +} + +EmptyDevice::~EmptyDevice() { + EmptyDevice::_instance = nullptr; +} + +bool EmptyDevice::doInit(const DeviceInfo &info) { + ContextInfo ctxInfo; + ctxInfo.windowHandle = _windowHandle; + + _context = CC_NEW(EmptyContext); + if (!_context->initialize(ctxInfo)) { + destroy(); + return false; + } + + QueueInfo queueInfo; + queueInfo.type = QueueType::GRAPHICS; + _queue = createQueue(queueInfo); + + CommandBufferInfo cmdBuffInfo; + cmdBuffInfo.type = CommandBufferType::PRIMARY; + cmdBuffInfo.queue = _queue; + _cmdBuff = createCommandBuffer(cmdBuffInfo); + + _features[static_cast(Feature::FORMAT_D24S8)] = true; + + CC_LOG_INFO("Empty device initialized."); + CC_LOG_INFO("SCREEN_SIZE: %d x %d", _width, _height); + CC_LOG_INFO("NATIVE_SIZE: %d x %d", _nativeWidth, _nativeHeight); + + return true; +} + +void EmptyDevice::doDestroy() { + CC_SAFE_DESTROY(_cmdBuff); + CC_SAFE_DESTROY(_queue); + CC_SAFE_DESTROY(_context); +} + +void EmptyDevice::resize(uint width, uint height) { + _width = _nativeWidth = width; + _height = _nativeHeight = height; +} + +void EmptyDevice::acquire() { +} + +void EmptyDevice::present() { + std::this_thread::sleep_for(std::chrono::milliseconds(16)); +} + +CommandBuffer *EmptyDevice::createCommandBuffer(const CommandBufferInfo &info, bool Emptyhas) { + return CC_NEW(EmptyCommandBuffer()); +} + +Queue *EmptyDevice::createQueue() { + return CC_NEW(EmptyQueue()); +} + +Buffer *EmptyDevice::createBuffer() { + return CC_NEW(EmptyBuffer()); +} + +Texture *EmptyDevice::createTexture() { + return CC_NEW(EmptyTexture()); +} + +Sampler *EmptyDevice::createSampler() { + return CC_NEW(EmptySampler()); +} + +Shader *EmptyDevice::createShader() { + return CC_NEW(EmptyShader()); +} + +InputAssembler *EmptyDevice::createInputAssembler() { + return CC_NEW(EmptyInputAssembler()); +} + +RenderPass *EmptyDevice::createRenderPass() { + return CC_NEW(EmptyRenderPass()); +} + +Framebuffer *EmptyDevice::createFramebuffer() { + return CC_NEW(EmptyFramebuffer()); +} + +DescriptorSet *EmptyDevice::createDescriptorSet() { + return CC_NEW(EmptyDescriptorSet()); +} + +DescriptorSetLayout *EmptyDevice::createDescriptorSetLayout() { + return CC_NEW(EmptyDescriptorSetLayout()); +} + +PipelineLayout *EmptyDevice::createPipelineLayout() { + return CC_NEW(EmptyPipelineLayout()); +} + +PipelineState *EmptyDevice::createPipelineState() { + return CC_NEW(EmptyPipelineState()); +} + +GlobalBarrier *EmptyDevice::createGlobalBarrier() { + return CC_NEW(GlobalBarrier()); +} + +TextureBarrier *EmptyDevice::createTextureBarrier() { + return CC_NEW(TextureBarrier()); +} + +void EmptyDevice::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyDevice.h b/native/cocos/renderer/gfx-empty/EmptyDevice.h new file mode 100644 index 0000000000..f60368783c --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyDevice.h @@ -0,0 +1,89 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXDevice.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyDevice final : public Device { +public: + static EmptyDevice *getInstance(); + + ~EmptyDevice() override; + + using Device::copyBuffersToTexture; + using Device::createBuffer; + using Device::createCommandBuffer; + using Device::createDescriptorSet; + using Device::createDescriptorSetLayout; + using Device::createFramebuffer; + using Device::createGlobalBarrier; + using Device::createInputAssembler; + using Device::createPipelineLayout; + using Device::createPipelineState; + using Device::createQueue; + using Device::createRenderPass; + using Device::createSampler; + using Device::createShader; + using Device::createTexture; + using Device::createTextureBarrier; + + void resize(uint width, uint height) override; + void acquire() override; + void present() override; + + CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool Emptyhas) override; + Queue * createQueue() override; + Buffer * createBuffer() override; + Texture * createTexture() override; + Sampler * createSampler() override; + Shader * createShader() override; + InputAssembler * createInputAssembler() override; + RenderPass * createRenderPass() override; + Framebuffer * createFramebuffer() override; + DescriptorSet * createDescriptorSet() override; + DescriptorSetLayout *createDescriptorSetLayout() override; + PipelineLayout * createPipelineLayout() override; + PipelineState * createPipelineState() override; + GlobalBarrier * createGlobalBarrier() override; + TextureBarrier * createTextureBarrier() override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; + +protected: + static EmptyDevice *_instance; + + friend class DeviceManager; + + EmptyDevice(); + + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyFramebuffer.cpp b/native/cocos/renderer/gfx-empty/EmptyFramebuffer.cpp new file mode 100644 index 0000000000..b352e948ac --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyFramebuffer.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyFramebuffer.h" + +namespace cc { +namespace gfx { + +void EmptyFramebuffer::doInit(const FramebufferInfo &info) { +} + +void EmptyFramebuffer::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyFramebuffer.h b/native/cocos/renderer/gfx-empty/EmptyFramebuffer.h new file mode 100644 index 0000000000..0d99fe532e --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyFramebuffer.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXFramebuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyFramebuffer final : public Framebuffer { +public: +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyInputAssembler.cpp b/native/cocos/renderer/gfx-empty/EmptyInputAssembler.cpp new file mode 100644 index 0000000000..9b6d09e2a7 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyInputAssembler.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyInputAssembler.h" + +namespace cc { +namespace gfx { + +void EmptyInputAssembler::doInit(const InputAssemblerInfo &info) { +} + +void EmptyInputAssembler::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyInputAssembler.h b/native/cocos/renderer/gfx-empty/EmptyInputAssembler.h new file mode 100644 index 0000000000..4cf915c446 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyInputAssembler.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXInputAssembler.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyInputAssembler final : public InputAssembler { +public: +protected: + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyPipelineLayout.cpp b/native/cocos/renderer/gfx-empty/EmptyPipelineLayout.cpp new file mode 100644 index 0000000000..7eb88fee98 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyPipelineLayout.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyPipelineLayout.h" + +namespace cc { +namespace gfx { + +void EmptyPipelineLayout::doInit(const PipelineLayoutInfo &info) { +} + +void EmptyPipelineLayout::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyPipelineLayout.h b/native/cocos/renderer/gfx-empty/EmptyPipelineLayout.h new file mode 100644 index 0000000000..b4c106e550 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyPipelineLayout.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXPipelineLayout.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyPipelineLayout final : public PipelineLayout { +public: +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyPipelineState.cpp b/native/cocos/renderer/gfx-empty/EmptyPipelineState.cpp new file mode 100644 index 0000000000..dadfe6d173 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyPipelineState.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyPipelineState.h" + +namespace cc { +namespace gfx { + +void EmptyPipelineState::doInit(const PipelineStateInfo &info) { +} + +void EmptyPipelineState::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyPipelineState.h b/native/cocos/renderer/gfx-empty/EmptyPipelineState.h new file mode 100644 index 0000000000..ebcc309516 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyPipelineState.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXPipelineState.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyPipelineState final : public PipelineState { +public: +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyQueue.cpp b/native/cocos/renderer/gfx-empty/EmptyQueue.cpp new file mode 100644 index 0000000000..fc282fd457 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyQueue.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyQueue.h" + +namespace cc { +namespace gfx { + +void EmptyQueue::doInit(const QueueInfo &info) { +} + +void EmptyQueue::doDestroy() { +} + +void EmptyQueue::submit(CommandBuffer *const *cmdBuffs, uint count) { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyQueue.h b/native/cocos/renderer/gfx-empty/EmptyQueue.h new file mode 100644 index 0000000000..b74d22b06d --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyQueue.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXQueue.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyQueue final : public Queue { +public: + using Queue::submit; + + void submit(CommandBuffer *const *cmdBuffs, uint count) override; + +protected: + void doInit(const QueueInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyRenderPass.cpp b/native/cocos/renderer/gfx-empty/EmptyRenderPass.cpp new file mode 100644 index 0000000000..b9f17fb79d --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyRenderPass.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyRenderPass.h" + +namespace cc { +namespace gfx { + +void EmptyRenderPass::doInit(const RenderPassInfo &info) { +} + +void EmptyRenderPass::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyRenderPass.h b/native/cocos/renderer/gfx-empty/EmptyRenderPass.h new file mode 100644 index 0000000000..96e0c6cf83 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyRenderPass.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXRenderPass.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyRenderPass final : public RenderPass { +public: +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptySampler.cpp b/native/cocos/renderer/gfx-empty/EmptySampler.cpp new file mode 100644 index 0000000000..de1a9285bb --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptySampler.cpp @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptySampler.h" + +namespace cc { +namespace gfx { + +void EmptySampler::doInit(const SamplerInfo &info) { +} + +void EmptySampler::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptySampler.h b/native/cocos/renderer/gfx-empty/EmptySampler.h new file mode 100644 index 0000000000..b09dc12044 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptySampler.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXSampler.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptySampler final : public Sampler { +public: +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyShader.cpp b/native/cocos/renderer/gfx-empty/EmptyShader.cpp new file mode 100644 index 0000000000..47f6f0a91a --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyShader.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "EmptyShader.h" + +namespace cc { +namespace gfx { + +void EmptyShader::doInit(const ShaderInfo &info) { + CC_LOG_INFO("Shader '%s' compilation succeeded.", info.name.c_str()); +} + +void EmptyShader::doDestroy() { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyShader.h b/native/cocos/renderer/gfx-empty/EmptyShader.h new file mode 100644 index 0000000000..a42aaa6f3d --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyShader.h @@ -0,0 +1,41 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXShader.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyShader final : public Shader { +public: +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyTexture.cpp b/native/cocos/renderer/gfx-empty/EmptyTexture.cpp new file mode 100644 index 0000000000..550d2ce745 --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyTexture.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "EmptyTexture.h" + +namespace cc { +namespace gfx { + +void EmptyTexture::doInit(const TextureInfo &info) { +} + +void EmptyTexture::doInit(const TextureViewInfo &info) { +} + +void EmptyTexture::doDestroy() { +} + +void EmptyTexture::doResize(uint width, uint height, uint size) { +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-empty/EmptyTexture.h b/native/cocos/renderer/gfx-empty/EmptyTexture.h new file mode 100644 index 0000000000..fd21174f9f --- /dev/null +++ b/native/cocos/renderer/gfx-empty/EmptyTexture.h @@ -0,0 +1,43 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXTexture.h" + +namespace cc { +namespace gfx { + +class CC_DLL EmptyTexture final : public Texture { +public: +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXCommandPool.h b/native/cocos/renderer/gfx-gles-common/GLESCommandPool.h similarity index 50% rename from native/cocos/renderer/core/gfx/GFXCommandPool.h rename to native/cocos/renderer/gfx-gles-common/GLESCommandPool.h index 4d79e9aa4f..79c886ef60 100644 --- a/native/cocos/renderer/core/gfx/GFXCommandPool.h +++ b/native/cocos/renderer/gfx-gles-common/GLESCommandPool.h @@ -1,13 +1,64 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + #pragma once -#include "GFXCommand.h" +#include +#include +#include "base/CachedArray.h" namespace cc { namespace gfx { +enum class GLESCmdType : uint8_t { + BEGIN_RENDER_PASS, + END_RENDER_PASS, + BIND_STATES, + DRAW, + UPDATE_BUFFER, + COPY_BUFFER_TO_TEXTURE, + BLIT_TEXTURE, + DISPATCH, + BARRIER, + COUNT, +}; + +class GLESCmd : public Object { +public: + GLESCmdType type; + uint refCount = 0; + + explicit GLESCmd(GLESCmdType type) : type(type) {} + ~GLESCmd() override = default; + + virtual void clear() = 0; +}; + #define INITIAL_CAPACITY 1 -template ::value>> +template ::value>> class CommandPool { public: CommandPool() : _freeCmds(INITIAL_CAPACITY) { @@ -79,7 +130,7 @@ public: _freeCmds.clear(); } -private: +protected: T **_frees = nullptr; uint _count = 0; CachedArray _freeCmds; diff --git a/native/cocos/renderer/gfx-gles-common/eglw.cpp b/native/cocos/renderer/gfx-gles-common/eglw.cpp new file mode 100644 index 0000000000..9f5e0f5589 --- /dev/null +++ b/native/cocos/renderer/gfx-gles-common/eglw.cpp @@ -0,0 +1,729 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS) +#define EGL_EGL_PROTOTYPES 0 +#include +#include +#include +#endif + +#include "eglw.h" + +#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS) +/** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from EGL spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + +/* EGLW_GENERATE_EGL_DEFINITION */ +PFNEGLGETPROCADDRESSPROC eglGetProcAddress; + +/* EGL_VERSION_1_0 */ +PFNEGLCHOOSECONFIGPROC eglChooseConfig; +PFNEGLCOPYBUFFERSPROC eglCopyBuffers; +PFNEGLCREATECONTEXTPROC eglCreateContext; +PFNEGLCREATEPBUFFERSURFACEPROC eglCreatePbufferSurface; +PFNEGLCREATEPIXMAPSURFACEPROC eglCreatePixmapSurface; +PFNEGLCREATEWINDOWSURFACEPROC eglCreateWindowSurface; +PFNEGLDESTROYCONTEXTPROC eglDestroyContext; +PFNEGLDESTROYSURFACEPROC eglDestroySurface; +PFNEGLGETCONFIGATTRIBPROC eglGetConfigAttrib; +PFNEGLGETCONFIGSPROC eglGetConfigs; +PFNEGLGETCURRENTDISPLAYPROC eglGetCurrentDisplay; +PFNEGLGETCURRENTSURFACEPROC eglGetCurrentSurface; +PFNEGLGETDISPLAYPROC eglGetDisplay; +PFNEGLGETERRORPROC eglGetError; +PFNEGLINITIALIZEPROC eglInitialize; +PFNEGLMAKECURRENTPROC eglMakeCurrent; +PFNEGLQUERYCONTEXTPROC eglQueryContext; +PFNEGLQUERYSTRINGPROC eglQueryString; +PFNEGLQUERYSURFACEPROC eglQuerySurface; +PFNEGLSWAPBUFFERSPROC eglSwapBuffers; +PFNEGLTERMINATEPROC eglTerminate; +PFNEGLWAITGLPROC eglWaitGL; +PFNEGLWAITNATIVEPROC eglWaitNative; + + +/* EGL_VERSION_1_1 */ +PFNEGLBINDTEXIMAGEPROC eglBindTexImage; +PFNEGLRELEASETEXIMAGEPROC eglReleaseTexImage; +PFNEGLSURFACEATTRIBPROC eglSurfaceAttrib; +PFNEGLSWAPINTERVALPROC eglSwapInterval; + + +/* EGL_VERSION_1_2 */ +PFNEGLBINDAPIPROC eglBindAPI; +PFNEGLQUERYAPIPROC eglQueryAPI; +PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC eglCreatePbufferFromClientBuffer; +PFNEGLRELEASETHREADPROC eglReleaseThread; +PFNEGLWAITCLIENTPROC eglWaitClient; + + +/* EGL_VERSION_1_3 */ + +/* EGL_VERSION_1_4 */ +PFNEGLGETCURRENTCONTEXTPROC eglGetCurrentContext; + + +/* EGL_VERSION_1_5 */ +PFNEGLCREATESYNCPROC eglCreateSync; +PFNEGLDESTROYSYNCPROC eglDestroySync; +PFNEGLCLIENTWAITSYNCPROC eglClientWaitSync; +PFNEGLGETSYNCATTRIBPROC eglGetSyncAttrib; + +PFNEGLCREATEIMAGEPROC eglCreateImage; +PFNEGLDESTROYIMAGEPROC eglDestroyImage; + +PFNEGLGETPLATFORMDISPLAYPROC eglGetPlatformDisplay; +PFNEGLCREATEPLATFORMWINDOWSURFACEPROC eglCreatePlatformWindowSurface; +PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC eglCreatePlatformPixmapSurface; + +PFNEGLWAITSYNCPROC eglWaitSync; + + +#if defined(EGL_ANDROID_blob_cache) +PFNEGLSETBLOBCACHEFUNCSANDROIDPROC eglSetBlobCacheFuncsANDROID; +#endif /* defined(EGL_ANDROID_blob_cache) */ + +#if defined(EGL_ANDROID_create_native_client_buffer) +PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC eglCreateNativeClientBufferANDROID; +#endif /* defined(EGL_ANDROID_create_native_client_buffer) */ + +#if defined(EGL_ANDROID_get_native_client_buffer) +PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC eglGetNativeClientBufferANDROID; +#endif /* defined(EGL_ANDROID_get_native_client_buffer) */ + +#if defined(EGL_ANDROID_native_fence_sync) +PFNEGLDUPNATIVEFENCEFDANDROIDPROC eglDupNativeFenceFDANDROID; +#endif /* defined(EGL_ANDROID_native_fence_sync) */ + +#if defined(EGL_ANDROID_presentation_time) +PFNEGLPRESENTATIONTIMEANDROIDPROC eglPresentationTimeANDROID; +#endif /* defined(EGL_ANDROID_presentation_time) */ + +#if defined(EGL_ANDROID_get_frame_timestamps) +PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC eglGetCompositorTimingSupportedANDROID; +PFNEGLGETCOMPOSITORTIMINGANDROIDPROC eglGetCompositorTimingANDROID; +PFNEGLGETNEXTFRAMEIDANDROIDPROC eglGetNextFrameIdANDROID; +PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC eglGetFrameTimestampSupportedANDROID; +PFNEGLGETFRAMETIMESTAMPSANDROIDPROC eglGetFrameTimestampsANDROID; +#endif /* defined(EGL_ANDROID_get_frame_timestamps) */ + +#if defined(EGL_ANGLE_query_surface_pointer) +PFNEGLQUERYSURFACEPOINTERANGLEPROC eglQuerySurfacePointerANGLE; +#endif /* defined(EGL_ANGLE_query_surface_pointer) */ + +#if defined(EGL_EXT_client_sync) +PFNEGLCLIENTSIGNALSYNCEXTPROC eglClientSignalSyncEXT; +#endif /* defined(EGL_EXT_client_sync) */ + +#if defined(EGL_EXT_device_base) +PFNEGLQUERYDEVICEATTRIBEXTPROC eglQueryDeviceAttribEXT; +PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT; +PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT; +PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT; +#endif /* defined(EGL_EXT_device_base) */ + +#if defined(EGL_EXT_image_dma_buf_import_modifiers) +PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT; +PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT; +#endif /* defined(EGL_EXT_image_dma_buf_import_modifiers) */ + +#if defined(EGL_EXT_output_base) +PFNEGLGETOUTPUTLAYERSEXTPROC eglGetOutputLayersEXT; +PFNEGLGETOUTPUTPORTSEXTPROC eglGetOutputPortsEXT; +PFNEGLOUTPUTLAYERATTRIBEXTPROC eglOutputLayerAttribEXT; +PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC eglQueryOutputLayerAttribEXT; +PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC eglQueryOutputLayerStringEXT; +PFNEGLOUTPUTPORTATTRIBEXTPROC eglOutputPortAttribEXT; +PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC eglQueryOutputPortAttribEXT; +PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC eglQueryOutputPortStringEXT; +#endif /* defined(EGL_EXT_output_base) */ + +#if defined(EGL_EXT_platform_base) +PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; +PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT; +PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC eglCreatePlatformPixmapSurfaceEXT; +#endif /* defined(EGL_EXT_platform_base) */ + +#if defined(EGL_EXT_stream_consumer_egloutput) +PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT; +#endif /* defined(EGL_EXT_stream_consumer_egloutput) */ + +#if defined(EGL_EXT_swap_buffers_with_damage) +PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC eglSwapBuffersWithDamageEXT; +#endif /* defined(EGL_EXT_swap_buffers_with_damage) */ + +#if defined(EGL_EXT_sync_reuse) +PFNEGLUNSIGNALSYNCEXTPROC eglUnsignalSyncEXT; +#endif /* defined(EGL_EXT_sync_reuse) */ + +#if defined(EGL_HI_clientpixmap) +PFNEGLCREATEPIXMAPSURFACEHIPROC eglCreatePixmapSurfaceHI; +#endif /* defined(EGL_HI_clientpixmap) */ + +#if defined(EGL_KHR_cl_event2) +PFNEGLCREATESYNC64KHRPROC eglCreateSync64KHR; +#endif /* defined(EGL_KHR_cl_event2) */ + +#if defined(EGL_KHR_debug) +PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR; +PFNEGLQUERYDEBUGKHRPROC eglQueryDebugKHR; +PFNEGLLABELOBJECTKHRPROC eglLabelObjectKHR; +#endif /* defined(EGL_KHR_debug) */ + +#if defined(EGL_KHR_display_reference) +PFNEGLQUERYDISPLAYATTRIBKHRPROC eglQueryDisplayAttribKHR; +#endif /* defined(EGL_KHR_display_reference) */ + +#if defined(EGL_KHR_fence_sync) +PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR; +PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR; +PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR; +PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR; +#endif /* defined(EGL_KHR_fence_sync) */ + +#if defined(EGL_KHR_image) +PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; +PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; +#endif /* defined(EGL_KHR_image) */ + +#if defined(EGL_KHR_lock_surface) +PFNEGLLOCKSURFACEKHRPROC eglLockSurfaceKHR; +PFNEGLUNLOCKSURFACEKHRPROC eglUnlockSurfaceKHR; +#endif /* defined(EGL_KHR_lock_surface) */ + +#if defined(EGL_KHR_lock_surface3) +PFNEGLQUERYSURFACE64KHRPROC eglQuerySurface64KHR; +#endif /* defined(EGL_KHR_lock_surface3) */ + +#if defined(EGL_KHR_partial_update) +PFNEGLSETDAMAGEREGIONKHRPROC eglSetDamageRegionKHR; +#endif /* defined(EGL_KHR_partial_update) */ + +#if defined(EGL_KHR_reusable_sync) +PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR; +#endif /* defined(EGL_KHR_reusable_sync) */ + +#if defined(EGL_KHR_stream) +PFNEGLCREATESTREAMKHRPROC eglCreateStreamKHR; +PFNEGLDESTROYSTREAMKHRPROC eglDestroyStreamKHR; +PFNEGLSTREAMATTRIBKHRPROC eglStreamAttribKHR; +PFNEGLQUERYSTREAMKHRPROC eglQueryStreamKHR; +PFNEGLQUERYSTREAMU64KHRPROC eglQueryStreamu64KHR; +#endif /* defined(EGL_KHR_stream) */ + +#if defined(EGL_KHR_stream_attrib) +PFNEGLCREATESTREAMATTRIBKHRPROC eglCreateStreamAttribKHR; +PFNEGLSETSTREAMATTRIBKHRPROC eglSetStreamAttribKHR; +PFNEGLQUERYSTREAMATTRIBKHRPROC eglQueryStreamAttribKHR; +PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC eglStreamConsumerAcquireAttribKHR; +PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC eglStreamConsumerReleaseAttribKHR; +#endif /* defined(EGL_KHR_stream_attrib) */ + +#if defined(EGL_KHR_stream_consumer_gltexture) +PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC eglStreamConsumerGLTextureExternalKHR; +PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquireKHR; +PFNEGLSTREAMCONSUMERRELEASEKHRPROC eglStreamConsumerReleaseKHR; +#endif /* defined(EGL_KHR_stream_consumer_gltexture) */ + +#if defined(EGL_KHR_stream_cross_process_fd) +PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC eglGetStreamFileDescriptorKHR; +PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC eglCreateStreamFromFileDescriptorKHR; +#endif /* defined(EGL_KHR_stream_cross_process_fd) */ + +#if defined(EGL_KHR_stream_fifo) +PFNEGLQUERYSTREAMTIMEKHRPROC eglQueryStreamTimeKHR; +#endif /* defined(EGL_KHR_stream_fifo) */ + +#if defined(EGL_KHR_stream_producer_eglsurface) +PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC eglCreateStreamProducerSurfaceKHR; +#endif /* defined(EGL_KHR_stream_producer_eglsurface) */ + +#if defined(EGL_KHR_swap_buffers_with_damage) +PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC eglSwapBuffersWithDamageKHR; +#endif /* defined(EGL_KHR_swap_buffers_with_damage) */ + +#if defined(EGL_KHR_wait_sync) +PFNEGLWAITSYNCKHRPROC eglWaitSyncKHR; +#endif /* defined(EGL_KHR_wait_sync) */ + +#if defined(EGL_MESA_drm_image) +PFNEGLCREATEDRMIMAGEMESAPROC eglCreateDRMImageMESA; +PFNEGLEXPORTDRMIMAGEMESAPROC eglExportDRMImageMESA; +#endif /* defined(EGL_MESA_drm_image) */ + +#if defined(EGL_MESA_image_dma_buf_export) +PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC eglExportDMABUFImageQueryMESA; +PFNEGLEXPORTDMABUFIMAGEMESAPROC eglExportDMABUFImageMESA; +#endif /* defined(EGL_MESA_image_dma_buf_export) */ + +#if defined(EGL_MESA_query_driver) +PFNEGLGETDISPLAYDRIVERCONFIGPROC eglGetDisplayDriverConfig; +PFNEGLGETDISPLAYDRIVERNAMEPROC eglGetDisplayDriverName; +#endif /* defined(EGL_MESA_query_driver) */ + +#if defined(EGL_NOK_swap_region) +PFNEGLSWAPBUFFERSREGIONNOKPROC eglSwapBuffersRegionNOK; +#endif /* defined(EGL_NOK_swap_region) */ + +#if defined(EGL_NOK_swap_region2) +PFNEGLSWAPBUFFERSREGION2NOKPROC eglSwapBuffersRegion2NOK; +#endif /* defined(EGL_NOK_swap_region2) */ + +#if defined(EGL_NV_native_query) +PFNEGLQUERYNATIVEDISPLAYNVPROC eglQueryNativeDisplayNV; +PFNEGLQUERYNATIVEWINDOWNVPROC eglQueryNativeWindowNV; +PFNEGLQUERYNATIVEPIXMAPNVPROC eglQueryNativePixmapNV; +#endif /* defined(EGL_NV_native_query) */ + +#if defined(EGL_NV_post_sub_buffer) +PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV; +#endif /* defined(EGL_NV_post_sub_buffer) */ + +#if defined(EGL_NV_stream_consumer_gltexture_yuv) +PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC eglStreamConsumerGLTextureExternalAttribsNV; +#endif /* defined(EGL_NV_stream_consumer_gltexture_yuv) */ + +#if defined(EGL_NV_stream_consumer_eglimage) +PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC eglStreamImageConsumerConnectNV; +PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC eglQueryStreamConsumerEventNV; +PFNEGLSTREAMACQUIREIMAGENVPROC eglStreamAcquireImageNV; +PFNEGLSTREAMRELEASEIMAGENVPROC eglStreamReleaseImageNV; +#endif /* defined(EGL_NV_stream_consumer_eglimage) */ + +#if defined(EGL_NV_stream_flush) +PFNEGLSTREAMFLUSHNVPROC eglStreamFlushNV; +#endif /* defined(EGL_NV_stream_flush) */ + +#if defined(EGL_NV_stream_metadata) +PFNEGLQUERYDISPLAYATTRIBNVPROC eglQueryDisplayAttribNV; +PFNEGLSETSTREAMMETADATANVPROC eglSetStreamMetadataNV; +PFNEGLQUERYSTREAMMETADATANVPROC eglQueryStreamMetadataNV; +#endif /* defined(EGL_NV_stream_metadata) */ + +#if defined(EGL_NV_stream_reset) +PFNEGLRESETSTREAMNVPROC eglResetStreamNV; +#endif /* defined(EGL_NV_stream_reset) */ + +#if defined(EGL_NV_stream_sync) +PFNEGLCREATESTREAMSYNCNVPROC eglCreateStreamSyncNV; +#endif /* defined(EGL_NV_stream_sync) */ + +#if defined(EGL_NV_sync) +PFNEGLCREATEFENCESYNCNVPROC eglCreateFenceSyncNV; +PFNEGLDESTROYSYNCNVPROC eglDestroySyncNV; +PFNEGLFENCENVPROC eglFenceNV; +PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV; +PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV; +PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV; +#endif /* defined(EGL_NV_sync) */ + +#if defined(EGL_NV_system_time) +PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC eglGetSystemTimeFrequencyNV; +PFNEGLGETSYSTEMTIMENVPROC eglGetSystemTimeNV; +#endif /* defined(EGL_NV_system_time) */ + +#if defined(EGL_EXT_compositor) +PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC eglCompositorSetContextListEXT; +PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC eglCompositorSetContextAttributesEXT; +PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC eglCompositorSetWindowListEXT; +PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC eglCompositorSetWindowAttributesEXT; +PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC eglCompositorBindTexWindowEXT; +PFNEGLCOMPOSITORSETSIZEEXTPROC eglCompositorSetSizeEXT; +PFNEGLCOMPOSITORSWAPPOLICYEXTPROC eglCompositorSwapPolicyEXT; +#endif /* defined(EGL_EXT_compositor) */ + +#if defined(EGL_WL_bind_wayland_display) +PFNEGLBINDWAYLANDDISPLAYWLPROC eglBindWaylandDisplayWL; +PFNEGLUNBINDWAYLANDDISPLAYWLPROC eglUnbindWaylandDisplayWL; +PFNEGLQUERYWAYLANDBUFFERWLPROC eglQueryWaylandBufferWL; +#endif /* defined(EGL_WL_bind_wayland_display) */ + +#if defined(EGL_WL_create_wayland_buffer_from_image) +PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC eglCreateWaylandBufferFromImageWL; +#endif /* defined(EGL_WL_create_wayland_buffer_from_image) */ + +/* EGLW_GENERATE_EGL_DEFINITION */ + +/** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from EGL spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ +#endif + +void eglwLoadProcs(PFNEGLWLOADPROC eglwLoad) { +#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS) + /** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from EGL spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + + /* EGLW_GENERATE_EGL_LOAD */ + eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC)eglwLoad("eglGetProcAddress"); + + /* EGL_VERSION_1_0 */ + eglChooseConfig = (PFNEGLCHOOSECONFIGPROC)eglwLoad("eglChooseConfig"); + eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC)eglwLoad("eglCopyBuffers"); + eglCreateContext = (PFNEGLCREATECONTEXTPROC)eglwLoad("eglCreateContext"); + eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC)eglwLoad("eglCreatePbufferSurface"); + eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC)eglwLoad("eglCreatePixmapSurface"); + eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC)eglwLoad("eglCreateWindowSurface"); + eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC)eglwLoad("eglDestroyContext"); + eglDestroySurface = (PFNEGLDESTROYSURFACEPROC)eglwLoad("eglDestroySurface"); + eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC)eglwLoad("eglGetConfigAttrib"); + eglGetConfigs = (PFNEGLGETCONFIGSPROC)eglwLoad("eglGetConfigs"); + eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)eglwLoad("eglGetCurrentDisplay"); + eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC)eglwLoad("eglGetCurrentSurface"); + eglGetDisplay = (PFNEGLGETDISPLAYPROC)eglwLoad("eglGetDisplay"); + eglGetError = (PFNEGLGETERRORPROC)eglwLoad("eglGetError"); + eglInitialize = (PFNEGLINITIALIZEPROC)eglwLoad("eglInitialize"); + eglMakeCurrent = (PFNEGLMAKECURRENTPROC)eglwLoad("eglMakeCurrent"); + eglQueryContext = (PFNEGLQUERYCONTEXTPROC)eglwLoad("eglQueryContext"); + eglQueryString = (PFNEGLQUERYSTRINGPROC)eglwLoad("eglQueryString"); + eglQuerySurface = (PFNEGLQUERYSURFACEPROC)eglwLoad("eglQuerySurface"); + eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC)eglwLoad("eglSwapBuffers"); + eglTerminate = (PFNEGLTERMINATEPROC)eglwLoad("eglTerminate"); + eglWaitGL = (PFNEGLWAITGLPROC)eglwLoad("eglWaitGL"); + eglWaitNative = (PFNEGLWAITNATIVEPROC)eglwLoad("eglWaitNative"); + + + /* EGL_VERSION_1_1 */ + eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC)eglwLoad("eglBindTexImage"); + eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC)eglwLoad("eglReleaseTexImage"); + eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC)eglwLoad("eglSurfaceAttrib"); + eglSwapInterval = (PFNEGLSWAPINTERVALPROC)eglwLoad("eglSwapInterval"); + + + /* EGL_VERSION_1_2 */ + eglBindAPI = (PFNEGLBINDAPIPROC)eglwLoad("eglBindAPI"); + eglQueryAPI = (PFNEGLQUERYAPIPROC)eglwLoad("eglQueryAPI"); + eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)eglwLoad("eglCreatePbufferFromClientBuffer"); + eglReleaseThread = (PFNEGLRELEASETHREADPROC)eglwLoad("eglReleaseThread"); + eglWaitClient = (PFNEGLWAITCLIENTPROC)eglwLoad("eglWaitClient"); + + + /* EGL_VERSION_1_3 */ + + /* EGL_VERSION_1_4 */ + eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC)eglwLoad("eglGetCurrentContext"); + + + /* EGL_VERSION_1_5 */ + eglCreateSync = (PFNEGLCREATESYNCPROC)eglwLoad("eglCreateSync"); + eglDestroySync = (PFNEGLDESTROYSYNCPROC)eglwLoad("eglDestroySync"); + eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC)eglwLoad("eglClientWaitSync"); + eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC)eglwLoad("eglGetSyncAttrib"); + + eglCreateImage = (PFNEGLCREATEIMAGEPROC)eglwLoad("eglCreateImage"); + eglDestroyImage = (PFNEGLDESTROYIMAGEPROC)eglwLoad("eglDestroyImage"); + + eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC)eglwLoad("eglGetPlatformDisplay"); + eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)eglwLoad("eglCreatePlatformWindowSurface"); + eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)eglwLoad("eglCreatePlatformPixmapSurface"); + + eglWaitSync = (PFNEGLWAITSYNCPROC)eglwLoad("eglWaitSync"); + + +#if defined(EGL_ANDROID_blob_cache) + eglSetBlobCacheFuncsANDROID = (PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)eglwLoad("eglSetBlobCacheFuncsANDROID"); +#endif /* defined(EGL_ANDROID_blob_cache) */ + +#if defined(EGL_ANDROID_create_native_client_buffer) + eglCreateNativeClientBufferANDROID = (PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC)eglwLoad("eglCreateNativeClientBufferANDROID"); +#endif /* defined(EGL_ANDROID_create_native_client_buffer) */ + +#if defined(EGL_ANDROID_get_native_client_buffer) + eglGetNativeClientBufferANDROID = (PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC)eglwLoad("eglGetNativeClientBufferANDROID"); +#endif /* defined(EGL_ANDROID_get_native_client_buffer) */ + +#if defined(EGL_ANDROID_native_fence_sync) + eglDupNativeFenceFDANDROID = (PFNEGLDUPNATIVEFENCEFDANDROIDPROC)eglwLoad("eglDupNativeFenceFDANDROID"); +#endif /* defined(EGL_ANDROID_native_fence_sync) */ + +#if defined(EGL_ANDROID_presentation_time) + eglPresentationTimeANDROID = (PFNEGLPRESENTATIONTIMEANDROIDPROC)eglwLoad("eglPresentationTimeANDROID"); +#endif /* defined(EGL_ANDROID_presentation_time) */ + +#if defined(EGL_ANDROID_get_frame_timestamps) + eglGetCompositorTimingSupportedANDROID = (PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC)eglwLoad("eglGetCompositorTimingSupportedANDROID"); + eglGetCompositorTimingANDROID = (PFNEGLGETCOMPOSITORTIMINGANDROIDPROC)eglwLoad("eglGetCompositorTimingANDROID"); + eglGetNextFrameIdANDROID = (PFNEGLGETNEXTFRAMEIDANDROIDPROC)eglwLoad("eglGetNextFrameIdANDROID"); + eglGetFrameTimestampSupportedANDROID = (PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC)eglwLoad("eglGetFrameTimestampSupportedANDROID"); + eglGetFrameTimestampsANDROID = (PFNEGLGETFRAMETIMESTAMPSANDROIDPROC)eglwLoad("eglGetFrameTimestampsANDROID"); +#endif /* defined(EGL_ANDROID_get_frame_timestamps) */ + +#if defined(EGL_ANGLE_query_surface_pointer) + eglQuerySurfacePointerANGLE = (PFNEGLQUERYSURFACEPOINTERANGLEPROC)eglwLoad("eglQuerySurfacePointerANGLE"); +#endif /* defined(EGL_ANGLE_query_surface_pointer) */ + +#if defined(EGL_EXT_client_sync) + eglClientSignalSyncEXT = (PFNEGLCLIENTSIGNALSYNCEXTPROC)eglwLoad("eglClientSignalSyncEXT"); +#endif /* defined(EGL_EXT_client_sync) */ + +#if defined(EGL_EXT_device_base) + eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)eglwLoad("eglQueryDeviceAttribEXT"); + eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)eglwLoad("eglQueryDeviceStringEXT"); + eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)eglwLoad("eglQueryDevicesEXT"); + eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)eglwLoad("eglQueryDisplayAttribEXT"); +#endif /* defined(EGL_EXT_device_base) */ + +#if defined(EGL_EXT_image_dma_buf_import_modifiers) + eglQueryDmaBufFormatsEXT = (PFNEGLQUERYDMABUFFORMATSEXTPROC)eglwLoad("eglQueryDmaBufFormatsEXT"); + eglQueryDmaBufModifiersEXT = (PFNEGLQUERYDMABUFMODIFIERSEXTPROC)eglwLoad("eglQueryDmaBufModifiersEXT"); +#endif /* defined(EGL_EXT_image_dma_buf_import_modifiers) */ + +#if defined(EGL_EXT_output_base) + eglGetOutputLayersEXT = (PFNEGLGETOUTPUTLAYERSEXTPROC)eglwLoad("eglGetOutputLayersEXT"); + eglGetOutputPortsEXT = (PFNEGLGETOUTPUTPORTSEXTPROC)eglwLoad("eglGetOutputPortsEXT"); + eglOutputLayerAttribEXT = (PFNEGLOUTPUTLAYERATTRIBEXTPROC)eglwLoad("eglOutputLayerAttribEXT"); + eglQueryOutputLayerAttribEXT = (PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC)eglwLoad("eglQueryOutputLayerAttribEXT"); + eglQueryOutputLayerStringEXT = (PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC)eglwLoad("eglQueryOutputLayerStringEXT"); + eglOutputPortAttribEXT = (PFNEGLOUTPUTPORTATTRIBEXTPROC)eglwLoad("eglOutputPortAttribEXT"); + eglQueryOutputPortAttribEXT = (PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC)eglwLoad("eglQueryOutputPortAttribEXT"); + eglQueryOutputPortStringEXT = (PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC)eglwLoad("eglQueryOutputPortStringEXT"); +#endif /* defined(EGL_EXT_output_base) */ + +#if defined(EGL_EXT_platform_base) + eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglwLoad("eglGetPlatformDisplayEXT"); + eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)eglwLoad("eglCreatePlatformWindowSurfaceEXT"); + eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)eglwLoad("eglCreatePlatformPixmapSurfaceEXT"); +#endif /* defined(EGL_EXT_platform_base) */ + +#if defined(EGL_EXT_stream_consumer_egloutput) + eglStreamConsumerOutputEXT = (PFNEGLSTREAMCONSUMEROUTPUTEXTPROC)eglwLoad("eglStreamConsumerOutputEXT"); +#endif /* defined(EGL_EXT_stream_consumer_egloutput) */ + +#if defined(EGL_EXT_swap_buffers_with_damage) + eglSwapBuffersWithDamageEXT = (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)eglwLoad("eglSwapBuffersWithDamageEXT"); +#endif /* defined(EGL_EXT_swap_buffers_with_damage) */ + +#if defined(EGL_EXT_sync_reuse) + eglUnsignalSyncEXT = (PFNEGLUNSIGNALSYNCEXTPROC)eglwLoad("eglUnsignalSyncEXT"); +#endif /* defined(EGL_EXT_sync_reuse) */ + +#if defined(EGL_HI_clientpixmap) + eglCreatePixmapSurfaceHI = (PFNEGLCREATEPIXMAPSURFACEHIPROC)eglwLoad("eglCreatePixmapSurfaceHI"); +#endif /* defined(EGL_HI_clientpixmap) */ + +#if defined(EGL_KHR_cl_event2) + eglCreateSync64KHR = (PFNEGLCREATESYNC64KHRPROC)eglwLoad("eglCreateSync64KHR"); +#endif /* defined(EGL_KHR_cl_event2) */ + +#if defined(EGL_KHR_debug) + eglDebugMessageControlKHR = (PFNEGLDEBUGMESSAGECONTROLKHRPROC)eglwLoad("eglDebugMessageControlKHR"); + eglQueryDebugKHR = (PFNEGLQUERYDEBUGKHRPROC)eglwLoad("eglQueryDebugKHR"); + eglLabelObjectKHR = (PFNEGLLABELOBJECTKHRPROC)eglwLoad("eglLabelObjectKHR"); +#endif /* defined(EGL_KHR_debug) */ + +#if defined(EGL_KHR_display_reference) + eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC)eglwLoad("eglQueryDisplayAttribKHR"); +#endif /* defined(EGL_KHR_display_reference) */ + +#if defined(EGL_KHR_fence_sync) + eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC)eglwLoad("eglCreateSyncKHR"); + eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)eglwLoad("eglDestroySyncKHR"); + eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)eglwLoad("eglClientWaitSyncKHR"); + eglGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC)eglwLoad("eglGetSyncAttribKHR"); +#endif /* defined(EGL_KHR_fence_sync) */ + +#if defined(EGL_KHR_image) + eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglwLoad("eglCreateImageKHR"); + eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglwLoad("eglDestroyImageKHR"); +#endif /* defined(EGL_KHR_image) */ + +#if defined(EGL_KHR_lock_surface) + eglLockSurfaceKHR = (PFNEGLLOCKSURFACEKHRPROC)eglwLoad("eglLockSurfaceKHR"); + eglUnlockSurfaceKHR = (PFNEGLUNLOCKSURFACEKHRPROC)eglwLoad("eglUnlockSurfaceKHR"); +#endif /* defined(EGL_KHR_lock_surface) */ + +#if defined(EGL_KHR_lock_surface3) + eglQuerySurface64KHR = (PFNEGLQUERYSURFACE64KHRPROC)eglwLoad("eglQuerySurface64KHR"); +#endif /* defined(EGL_KHR_lock_surface3) */ + +#if defined(EGL_KHR_partial_update) + eglSetDamageRegionKHR = (PFNEGLSETDAMAGEREGIONKHRPROC)eglwLoad("eglSetDamageRegionKHR"); +#endif /* defined(EGL_KHR_partial_update) */ + +#if defined(EGL_KHR_reusable_sync) + eglSignalSyncKHR = (PFNEGLSIGNALSYNCKHRPROC)eglwLoad("eglSignalSyncKHR"); +#endif /* defined(EGL_KHR_reusable_sync) */ + +#if defined(EGL_KHR_stream) + eglCreateStreamKHR = (PFNEGLCREATESTREAMKHRPROC)eglwLoad("eglCreateStreamKHR"); + eglDestroyStreamKHR = (PFNEGLDESTROYSTREAMKHRPROC)eglwLoad("eglDestroyStreamKHR"); + eglStreamAttribKHR = (PFNEGLSTREAMATTRIBKHRPROC)eglwLoad("eglStreamAttribKHR"); + eglQueryStreamKHR = (PFNEGLQUERYSTREAMKHRPROC)eglwLoad("eglQueryStreamKHR"); + eglQueryStreamu64KHR = (PFNEGLQUERYSTREAMU64KHRPROC)eglwLoad("eglQueryStreamu64KHR"); +#endif /* defined(EGL_KHR_stream) */ + +#if defined(EGL_KHR_stream_attrib) + eglCreateStreamAttribKHR = (PFNEGLCREATESTREAMATTRIBKHRPROC)eglwLoad("eglCreateStreamAttribKHR"); + eglSetStreamAttribKHR = (PFNEGLSETSTREAMATTRIBKHRPROC)eglwLoad("eglSetStreamAttribKHR"); + eglQueryStreamAttribKHR = (PFNEGLQUERYSTREAMATTRIBKHRPROC)eglwLoad("eglQueryStreamAttribKHR"); + eglStreamConsumerAcquireAttribKHR = (PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC)eglwLoad("eglStreamConsumerAcquireAttribKHR"); + eglStreamConsumerReleaseAttribKHR = (PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC)eglwLoad("eglStreamConsumerReleaseAttribKHR"); +#endif /* defined(EGL_KHR_stream_attrib) */ + +#if defined(EGL_KHR_stream_consumer_gltexture) + eglStreamConsumerGLTextureExternalKHR = (PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)eglwLoad("eglStreamConsumerGLTextureExternalKHR"); + eglStreamConsumerAcquireKHR = (PFNEGLSTREAMCONSUMERACQUIREKHRPROC)eglwLoad("eglStreamConsumerAcquireKHR"); + eglStreamConsumerReleaseKHR = (PFNEGLSTREAMCONSUMERRELEASEKHRPROC)eglwLoad("eglStreamConsumerReleaseKHR"); +#endif /* defined(EGL_KHR_stream_consumer_gltexture) */ + +#if defined(EGL_KHR_stream_cross_process_fd) + eglGetStreamFileDescriptorKHR = (PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)eglwLoad("eglGetStreamFileDescriptorKHR"); + eglCreateStreamFromFileDescriptorKHR = (PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)eglwLoad("eglCreateStreamFromFileDescriptorKHR"); +#endif /* defined(EGL_KHR_stream_cross_process_fd) */ + +#if defined(EGL_KHR_stream_fifo) + eglQueryStreamTimeKHR = (PFNEGLQUERYSTREAMTIMEKHRPROC)eglwLoad("eglQueryStreamTimeKHR"); +#endif /* defined(EGL_KHR_stream_fifo) */ + +#if defined(EGL_KHR_stream_producer_eglsurface) + eglCreateStreamProducerSurfaceKHR = (PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)eglwLoad("eglCreateStreamProducerSurfaceKHR"); +#endif /* defined(EGL_KHR_stream_producer_eglsurface) */ + +#if defined(EGL_KHR_swap_buffers_with_damage) + eglSwapBuffersWithDamageKHR = (PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC)eglwLoad("eglSwapBuffersWithDamageKHR"); +#endif /* defined(EGL_KHR_swap_buffers_with_damage) */ + +#if defined(EGL_KHR_wait_sync) + eglWaitSyncKHR = (PFNEGLWAITSYNCKHRPROC)eglwLoad("eglWaitSyncKHR"); +#endif /* defined(EGL_KHR_wait_sync) */ + +#if defined(EGL_MESA_drm_image) + eglCreateDRMImageMESA = (PFNEGLCREATEDRMIMAGEMESAPROC)eglwLoad("eglCreateDRMImageMESA"); + eglExportDRMImageMESA = (PFNEGLEXPORTDRMIMAGEMESAPROC)eglwLoad("eglExportDRMImageMESA"); +#endif /* defined(EGL_MESA_drm_image) */ + +#if defined(EGL_MESA_image_dma_buf_export) + eglExportDMABUFImageQueryMESA = (PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC)eglwLoad("eglExportDMABUFImageQueryMESA"); + eglExportDMABUFImageMESA = (PFNEGLEXPORTDMABUFIMAGEMESAPROC)eglwLoad("eglExportDMABUFImageMESA"); +#endif /* defined(EGL_MESA_image_dma_buf_export) */ + +#if defined(EGL_MESA_query_driver) + eglGetDisplayDriverConfig = (PFNEGLGETDISPLAYDRIVERCONFIGPROC)eglwLoad("eglGetDisplayDriverConfig"); + eglGetDisplayDriverName = (PFNEGLGETDISPLAYDRIVERNAMEPROC)eglwLoad("eglGetDisplayDriverName"); +#endif /* defined(EGL_MESA_query_driver) */ + +#if defined(EGL_NOK_swap_region) + eglSwapBuffersRegionNOK = (PFNEGLSWAPBUFFERSREGIONNOKPROC)eglwLoad("eglSwapBuffersRegionNOK"); +#endif /* defined(EGL_NOK_swap_region) */ + +#if defined(EGL_NOK_swap_region2) + eglSwapBuffersRegion2NOK = (PFNEGLSWAPBUFFERSREGION2NOKPROC)eglwLoad("eglSwapBuffersRegion2NOK"); +#endif /* defined(EGL_NOK_swap_region2) */ + +#if defined(EGL_NV_native_query) + eglQueryNativeDisplayNV = (PFNEGLQUERYNATIVEDISPLAYNVPROC)eglwLoad("eglQueryNativeDisplayNV"); + eglQueryNativeWindowNV = (PFNEGLQUERYNATIVEWINDOWNVPROC)eglwLoad("eglQueryNativeWindowNV"); + eglQueryNativePixmapNV = (PFNEGLQUERYNATIVEPIXMAPNVPROC)eglwLoad("eglQueryNativePixmapNV"); +#endif /* defined(EGL_NV_native_query) */ + +#if defined(EGL_NV_post_sub_buffer) + eglPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC)eglwLoad("eglPostSubBufferNV"); +#endif /* defined(EGL_NV_post_sub_buffer) */ + +#if defined(EGL_NV_stream_consumer_gltexture_yuv) + eglStreamConsumerGLTextureExternalAttribsNV = (PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC)eglwLoad("eglStreamConsumerGLTextureExternalAttribsNV"); +#endif /* defined(EGL_NV_stream_consumer_gltexture_yuv) */ + +#if defined(EGL_NV_stream_consumer_eglimage) + eglStreamImageConsumerConnectNV = (PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC)eglwLoad("eglStreamImageConsumerConnectNV"); + eglQueryStreamConsumerEventNV = (PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC)eglwLoad("eglQueryStreamConsumerEventNV"); + eglStreamAcquireImageNV = (PFNEGLSTREAMACQUIREIMAGENVPROC)eglwLoad("eglStreamAcquireImageNV"); + eglStreamReleaseImageNV = (PFNEGLSTREAMRELEASEIMAGENVPROC)eglwLoad("eglStreamReleaseImageNV"); +#endif /* defined(EGL_NV_stream_consumer_eglimage) */ + +#if defined(EGL_NV_stream_flush) + eglStreamFlushNV = (PFNEGLSTREAMFLUSHNVPROC)eglwLoad("eglStreamFlushNV"); +#endif /* defined(EGL_NV_stream_flush) */ + +#if defined(EGL_NV_stream_metadata) + eglQueryDisplayAttribNV = (PFNEGLQUERYDISPLAYATTRIBNVPROC)eglwLoad("eglQueryDisplayAttribNV"); + eglSetStreamMetadataNV = (PFNEGLSETSTREAMMETADATANVPROC)eglwLoad("eglSetStreamMetadataNV"); + eglQueryStreamMetadataNV = (PFNEGLQUERYSTREAMMETADATANVPROC)eglwLoad("eglQueryStreamMetadataNV"); +#endif /* defined(EGL_NV_stream_metadata) */ + +#if defined(EGL_NV_stream_reset) + eglResetStreamNV = (PFNEGLRESETSTREAMNVPROC)eglwLoad("eglResetStreamNV"); +#endif /* defined(EGL_NV_stream_reset) */ + +#if defined(EGL_NV_stream_sync) + eglCreateStreamSyncNV = (PFNEGLCREATESTREAMSYNCNVPROC)eglwLoad("eglCreateStreamSyncNV"); +#endif /* defined(EGL_NV_stream_sync) */ + +#if defined(EGL_NV_sync) + eglCreateFenceSyncNV = (PFNEGLCREATEFENCESYNCNVPROC)eglwLoad("eglCreateFenceSyncNV"); + eglDestroySyncNV = (PFNEGLDESTROYSYNCNVPROC)eglwLoad("eglDestroySyncNV"); + eglFenceNV = (PFNEGLFENCENVPROC)eglwLoad("eglFenceNV"); + eglClientWaitSyncNV = (PFNEGLCLIENTWAITSYNCNVPROC)eglwLoad("eglClientWaitSyncNV"); + eglSignalSyncNV = (PFNEGLSIGNALSYNCNVPROC)eglwLoad("eglSignalSyncNV"); + eglGetSyncAttribNV = (PFNEGLGETSYNCATTRIBNVPROC)eglwLoad("eglGetSyncAttribNV"); +#endif /* defined(EGL_NV_sync) */ + +#if defined(EGL_NV_system_time) + eglGetSystemTimeFrequencyNV = (PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)eglwLoad("eglGetSystemTimeFrequencyNV"); + eglGetSystemTimeNV = (PFNEGLGETSYSTEMTIMENVPROC)eglwLoad("eglGetSystemTimeNV"); +#endif /* defined(EGL_NV_system_time) */ + +#if defined(EGL_EXT_compositor) + eglCompositorSetContextListEXT = (PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC)eglwLoad("eglCompositorSetContextListEXT"); + eglCompositorSetContextAttributesEXT = (PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC)eglwLoad("eglCompositorSetContextAttributesEXT"); + eglCompositorSetWindowListEXT = (PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC)eglwLoad("eglCompositorSetWindowListEXT"); + eglCompositorSetWindowAttributesEXT = (PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC)eglwLoad("eglCompositorSetWindowAttributesEXT"); + eglCompositorBindTexWindowEXT = (PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC)eglwLoad("eglCompositorBindTexWindowEXT"); + eglCompositorSetSizeEXT = (PFNEGLCOMPOSITORSETSIZEEXTPROC)eglwLoad("eglCompositorSetSizeEXT"); + eglCompositorSwapPolicyEXT = (PFNEGLCOMPOSITORSWAPPOLICYEXTPROC)eglwLoad("eglCompositorSwapPolicyEXT"); +#endif /* defined(EGL_EXT_compositor) */ + +#if defined(EGL_WL_bind_wayland_display) + eglBindWaylandDisplayWL = (PFNEGLBINDWAYLANDDISPLAYWLPROC)eglwLoad("eglBindWaylandDisplayWL"); + eglUnbindWaylandDisplayWL = (PFNEGLUNBINDWAYLANDDISPLAYWLPROC)eglwLoad("eglUnbindWaylandDisplayWL"); + eglQueryWaylandBufferWL = (PFNEGLQUERYWAYLANDBUFFERWLPROC)eglwLoad("eglQueryWaylandBufferWL"); +#endif /* defined(EGL_WL_bind_wayland_display) */ + +#if defined(EGL_WL_create_wayland_buffer_from_image) + eglCreateWaylandBufferFromImageWL = (PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC)eglwLoad("eglCreateWaylandBufferFromImageWL"); +#endif /* defined(EGL_WL_create_wayland_buffer_from_image) */ + + /* EGLW_GENERATE_EGL_LOAD */ + + /** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from EGL spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ +#endif +} diff --git a/native/cocos/renderer/gfx-gles-common/eglw.h b/native/cocos/renderer/gfx-gles-common/eglw.h new file mode 100644 index 0000000000..719ed44931 --- /dev/null +++ b/native/cocos/renderer/gfx-gles-common/eglw.h @@ -0,0 +1,378 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS) + +/** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from EGL spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + +/* EGLW_GENERATE_EGL_DECLARATION */ +extern PFNEGLGETPROCADDRESSPROC eglGetProcAddress; + +/* EGL_VERSION_1_0 */ +extern PFNEGLCHOOSECONFIGPROC eglChooseConfig; +extern PFNEGLCOPYBUFFERSPROC eglCopyBuffers; +extern PFNEGLCREATECONTEXTPROC eglCreateContext; +extern PFNEGLCREATEPBUFFERSURFACEPROC eglCreatePbufferSurface; +extern PFNEGLCREATEPIXMAPSURFACEPROC eglCreatePixmapSurface; +extern PFNEGLCREATEWINDOWSURFACEPROC eglCreateWindowSurface; +extern PFNEGLDESTROYCONTEXTPROC eglDestroyContext; +extern PFNEGLDESTROYSURFACEPROC eglDestroySurface; +extern PFNEGLGETCONFIGATTRIBPROC eglGetConfigAttrib; +extern PFNEGLGETCONFIGSPROC eglGetConfigs; +extern PFNEGLGETCURRENTDISPLAYPROC eglGetCurrentDisplay; +extern PFNEGLGETCURRENTSURFACEPROC eglGetCurrentSurface; +extern PFNEGLGETDISPLAYPROC eglGetDisplay; +extern PFNEGLGETERRORPROC eglGetError; +extern PFNEGLINITIALIZEPROC eglInitialize; +extern PFNEGLMAKECURRENTPROC eglMakeCurrent; +extern PFNEGLQUERYCONTEXTPROC eglQueryContext; +extern PFNEGLQUERYSTRINGPROC eglQueryString; +extern PFNEGLQUERYSURFACEPROC eglQuerySurface; +extern PFNEGLSWAPBUFFERSPROC eglSwapBuffers; +extern PFNEGLTERMINATEPROC eglTerminate; +extern PFNEGLWAITGLPROC eglWaitGL; +extern PFNEGLWAITNATIVEPROC eglWaitNative; + + +/* EGL_VERSION_1_1 */ +extern PFNEGLBINDTEXIMAGEPROC eglBindTexImage; +extern PFNEGLRELEASETEXIMAGEPROC eglReleaseTexImage; +extern PFNEGLSURFACEATTRIBPROC eglSurfaceAttrib; +extern PFNEGLSWAPINTERVALPROC eglSwapInterval; + + +/* EGL_VERSION_1_2 */ +extern PFNEGLBINDAPIPROC eglBindAPI; +extern PFNEGLQUERYAPIPROC eglQueryAPI; +extern PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC eglCreatePbufferFromClientBuffer; +extern PFNEGLRELEASETHREADPROC eglReleaseThread; +extern PFNEGLWAITCLIENTPROC eglWaitClient; + + +/* EGL_VERSION_1_3 */ + +/* EGL_VERSION_1_4 */ +extern PFNEGLGETCURRENTCONTEXTPROC eglGetCurrentContext; + + +/* EGL_VERSION_1_5 */ +extern PFNEGLCREATESYNCPROC eglCreateSync; +extern PFNEGLDESTROYSYNCPROC eglDestroySync; +extern PFNEGLCLIENTWAITSYNCPROC eglClientWaitSync; +extern PFNEGLGETSYNCATTRIBPROC eglGetSyncAttrib; + +extern PFNEGLCREATEIMAGEPROC eglCreateImage; +extern PFNEGLDESTROYIMAGEPROC eglDestroyImage; + +extern PFNEGLGETPLATFORMDISPLAYPROC eglGetPlatformDisplay; +extern PFNEGLCREATEPLATFORMWINDOWSURFACEPROC eglCreatePlatformWindowSurface; +extern PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC eglCreatePlatformPixmapSurface; + +extern PFNEGLWAITSYNCPROC eglWaitSync; + + +#if defined(EGL_ANDROID_blob_cache) +extern PFNEGLSETBLOBCACHEFUNCSANDROIDPROC eglSetBlobCacheFuncsANDROID; +#endif /* defined(EGL_ANDROID_blob_cache) */ + +#if defined(EGL_ANDROID_create_native_client_buffer) +extern PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC eglCreateNativeClientBufferANDROID; +#endif /* defined(EGL_ANDROID_create_native_client_buffer) */ + +#if defined(EGL_ANDROID_get_native_client_buffer) +extern PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC eglGetNativeClientBufferANDROID; +#endif /* defined(EGL_ANDROID_get_native_client_buffer) */ + +#if defined(EGL_ANDROID_native_fence_sync) +extern PFNEGLDUPNATIVEFENCEFDANDROIDPROC eglDupNativeFenceFDANDROID; +#endif /* defined(EGL_ANDROID_native_fence_sync) */ + +#if defined(EGL_ANDROID_presentation_time) +extern PFNEGLPRESENTATIONTIMEANDROIDPROC eglPresentationTimeANDROID; +#endif /* defined(EGL_ANDROID_presentation_time) */ + +#if defined(EGL_ANDROID_get_frame_timestamps) +extern PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC eglGetCompositorTimingSupportedANDROID; +extern PFNEGLGETCOMPOSITORTIMINGANDROIDPROC eglGetCompositorTimingANDROID; +extern PFNEGLGETNEXTFRAMEIDANDROIDPROC eglGetNextFrameIdANDROID; +extern PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC eglGetFrameTimestampSupportedANDROID; +extern PFNEGLGETFRAMETIMESTAMPSANDROIDPROC eglGetFrameTimestampsANDROID; +#endif /* defined(EGL_ANDROID_get_frame_timestamps) */ + +#if defined(EGL_ANGLE_query_surface_pointer) +extern PFNEGLQUERYSURFACEPOINTERANGLEPROC eglQuerySurfacePointerANGLE; +#endif /* defined(EGL_ANGLE_query_surface_pointer) */ + +#if defined(EGL_EXT_client_sync) +extern PFNEGLCLIENTSIGNALSYNCEXTPROC eglClientSignalSyncEXT; +#endif /* defined(EGL_EXT_client_sync) */ + +#if defined(EGL_EXT_device_base) +extern PFNEGLQUERYDEVICEATTRIBEXTPROC eglQueryDeviceAttribEXT; +extern PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT; +extern PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT; +extern PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT; +#endif /* defined(EGL_EXT_device_base) */ + +#if defined(EGL_EXT_image_dma_buf_import_modifiers) +extern PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT; +extern PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT; +#endif /* defined(EGL_EXT_image_dma_buf_import_modifiers) */ + +#if defined(EGL_EXT_output_base) +extern PFNEGLGETOUTPUTLAYERSEXTPROC eglGetOutputLayersEXT; +extern PFNEGLGETOUTPUTPORTSEXTPROC eglGetOutputPortsEXT; +extern PFNEGLOUTPUTLAYERATTRIBEXTPROC eglOutputLayerAttribEXT; +extern PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC eglQueryOutputLayerAttribEXT; +extern PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC eglQueryOutputLayerStringEXT; +extern PFNEGLOUTPUTPORTATTRIBEXTPROC eglOutputPortAttribEXT; +extern PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC eglQueryOutputPortAttribEXT; +extern PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC eglQueryOutputPortStringEXT; +#endif /* defined(EGL_EXT_output_base) */ + +#if defined(EGL_EXT_platform_base) +extern PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; +extern PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT; +extern PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC eglCreatePlatformPixmapSurfaceEXT; +#endif /* defined(EGL_EXT_platform_base) */ + +#if defined(EGL_EXT_stream_consumer_egloutput) +extern PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT; +#endif /* defined(EGL_EXT_stream_consumer_egloutput) */ + +#if defined(EGL_EXT_swap_buffers_with_damage) +extern PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC eglSwapBuffersWithDamageEXT; +#endif /* defined(EGL_EXT_swap_buffers_with_damage) */ + +#if defined(EGL_EXT_sync_reuse) +extern PFNEGLUNSIGNALSYNCEXTPROC eglUnsignalSyncEXT; +#endif /* defined(EGL_EXT_sync_reuse) */ + +#if defined(EGL_HI_clientpixmap) +extern PFNEGLCREATEPIXMAPSURFACEHIPROC eglCreatePixmapSurfaceHI; +#endif /* defined(EGL_HI_clientpixmap) */ + +#if defined(EGL_KHR_cl_event2) +extern PFNEGLCREATESYNC64KHRPROC eglCreateSync64KHR; +#endif /* defined(EGL_KHR_cl_event2) */ + +#if defined(EGL_KHR_debug) +extern PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR; +extern PFNEGLQUERYDEBUGKHRPROC eglQueryDebugKHR; +extern PFNEGLLABELOBJECTKHRPROC eglLabelObjectKHR; +#endif /* defined(EGL_KHR_debug) */ + +#if defined(EGL_KHR_display_reference) +extern PFNEGLQUERYDISPLAYATTRIBKHRPROC eglQueryDisplayAttribKHR; +#endif /* defined(EGL_KHR_display_reference) */ + +#if defined(EGL_KHR_fence_sync) +extern PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR; +extern PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR; +extern PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR; +extern PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR; +#endif /* defined(EGL_KHR_fence_sync) */ + +#if defined(EGL_KHR_image) +extern PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; +extern PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; +#endif /* defined(EGL_KHR_image) */ + +#if defined(EGL_KHR_lock_surface) +extern PFNEGLLOCKSURFACEKHRPROC eglLockSurfaceKHR; +extern PFNEGLUNLOCKSURFACEKHRPROC eglUnlockSurfaceKHR; +#endif /* defined(EGL_KHR_lock_surface) */ + +#if defined(EGL_KHR_lock_surface3) +extern PFNEGLQUERYSURFACE64KHRPROC eglQuerySurface64KHR; +#endif /* defined(EGL_KHR_lock_surface3) */ + +#if defined(EGL_KHR_partial_update) +extern PFNEGLSETDAMAGEREGIONKHRPROC eglSetDamageRegionKHR; +#endif /* defined(EGL_KHR_partial_update) */ + +#if defined(EGL_KHR_reusable_sync) +extern PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR; +#endif /* defined(EGL_KHR_reusable_sync) */ + +#if defined(EGL_KHR_stream) +extern PFNEGLCREATESTREAMKHRPROC eglCreateStreamKHR; +extern PFNEGLDESTROYSTREAMKHRPROC eglDestroyStreamKHR; +extern PFNEGLSTREAMATTRIBKHRPROC eglStreamAttribKHR; +extern PFNEGLQUERYSTREAMKHRPROC eglQueryStreamKHR; +extern PFNEGLQUERYSTREAMU64KHRPROC eglQueryStreamu64KHR; +#endif /* defined(EGL_KHR_stream) */ + +#if defined(EGL_KHR_stream_attrib) +extern PFNEGLCREATESTREAMATTRIBKHRPROC eglCreateStreamAttribKHR; +extern PFNEGLSETSTREAMATTRIBKHRPROC eglSetStreamAttribKHR; +extern PFNEGLQUERYSTREAMATTRIBKHRPROC eglQueryStreamAttribKHR; +extern PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC eglStreamConsumerAcquireAttribKHR; +extern PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC eglStreamConsumerReleaseAttribKHR; +#endif /* defined(EGL_KHR_stream_attrib) */ + +#if defined(EGL_KHR_stream_consumer_gltexture) +extern PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC eglStreamConsumerGLTextureExternalKHR; +extern PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquireKHR; +extern PFNEGLSTREAMCONSUMERRELEASEKHRPROC eglStreamConsumerReleaseKHR; +#endif /* defined(EGL_KHR_stream_consumer_gltexture) */ + +#if defined(EGL_KHR_stream_cross_process_fd) +extern PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC eglGetStreamFileDescriptorKHR; +extern PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC eglCreateStreamFromFileDescriptorKHR; +#endif /* defined(EGL_KHR_stream_cross_process_fd) */ + +#if defined(EGL_KHR_stream_fifo) +extern PFNEGLQUERYSTREAMTIMEKHRPROC eglQueryStreamTimeKHR; +#endif /* defined(EGL_KHR_stream_fifo) */ + +#if defined(EGL_KHR_stream_producer_eglsurface) +extern PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC eglCreateStreamProducerSurfaceKHR; +#endif /* defined(EGL_KHR_stream_producer_eglsurface) */ + +#if defined(EGL_KHR_swap_buffers_with_damage) +extern PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC eglSwapBuffersWithDamageKHR; +#endif /* defined(EGL_KHR_swap_buffers_with_damage) */ + +#if defined(EGL_KHR_wait_sync) +extern PFNEGLWAITSYNCKHRPROC eglWaitSyncKHR; +#endif /* defined(EGL_KHR_wait_sync) */ + +#if defined(EGL_MESA_drm_image) +extern PFNEGLCREATEDRMIMAGEMESAPROC eglCreateDRMImageMESA; +extern PFNEGLEXPORTDRMIMAGEMESAPROC eglExportDRMImageMESA; +#endif /* defined(EGL_MESA_drm_image) */ + +#if defined(EGL_MESA_image_dma_buf_export) +extern PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC eglExportDMABUFImageQueryMESA; +extern PFNEGLEXPORTDMABUFIMAGEMESAPROC eglExportDMABUFImageMESA; +#endif /* defined(EGL_MESA_image_dma_buf_export) */ + +#if defined(EGL_MESA_query_driver) +extern PFNEGLGETDISPLAYDRIVERCONFIGPROC eglGetDisplayDriverConfig; +extern PFNEGLGETDISPLAYDRIVERNAMEPROC eglGetDisplayDriverName; +#endif /* defined(EGL_MESA_query_driver) */ + +#if defined(EGL_NOK_swap_region) +extern PFNEGLSWAPBUFFERSREGIONNOKPROC eglSwapBuffersRegionNOK; +#endif /* defined(EGL_NOK_swap_region) */ + +#if defined(EGL_NOK_swap_region2) +extern PFNEGLSWAPBUFFERSREGION2NOKPROC eglSwapBuffersRegion2NOK; +#endif /* defined(EGL_NOK_swap_region2) */ + +#if defined(EGL_NV_native_query) +extern PFNEGLQUERYNATIVEDISPLAYNVPROC eglQueryNativeDisplayNV; +extern PFNEGLQUERYNATIVEWINDOWNVPROC eglQueryNativeWindowNV; +extern PFNEGLQUERYNATIVEPIXMAPNVPROC eglQueryNativePixmapNV; +#endif /* defined(EGL_NV_native_query) */ + +#if defined(EGL_NV_post_sub_buffer) +extern PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV; +#endif /* defined(EGL_NV_post_sub_buffer) */ + +#if defined(EGL_NV_stream_consumer_gltexture_yuv) +extern PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC eglStreamConsumerGLTextureExternalAttribsNV; +#endif /* defined(EGL_NV_stream_consumer_gltexture_yuv) */ + +#if defined(EGL_NV_stream_consumer_eglimage) +extern PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC eglStreamImageConsumerConnectNV; +extern PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC eglQueryStreamConsumerEventNV; +extern PFNEGLSTREAMACQUIREIMAGENVPROC eglStreamAcquireImageNV; +extern PFNEGLSTREAMRELEASEIMAGENVPROC eglStreamReleaseImageNV; +#endif /* defined(EGL_NV_stream_consumer_eglimage) */ + +#if defined(EGL_NV_stream_flush) +extern PFNEGLSTREAMFLUSHNVPROC eglStreamFlushNV; +#endif /* defined(EGL_NV_stream_flush) */ + +#if defined(EGL_NV_stream_metadata) +extern PFNEGLQUERYDISPLAYATTRIBNVPROC eglQueryDisplayAttribNV; +extern PFNEGLSETSTREAMMETADATANVPROC eglSetStreamMetadataNV; +extern PFNEGLQUERYSTREAMMETADATANVPROC eglQueryStreamMetadataNV; +#endif /* defined(EGL_NV_stream_metadata) */ + +#if defined(EGL_NV_stream_reset) +extern PFNEGLRESETSTREAMNVPROC eglResetStreamNV; +#endif /* defined(EGL_NV_stream_reset) */ + +#if defined(EGL_NV_stream_sync) +extern PFNEGLCREATESTREAMSYNCNVPROC eglCreateStreamSyncNV; +#endif /* defined(EGL_NV_stream_sync) */ + +#if defined(EGL_NV_sync) +extern PFNEGLCREATEFENCESYNCNVPROC eglCreateFenceSyncNV; +extern PFNEGLDESTROYSYNCNVPROC eglDestroySyncNV; +extern PFNEGLFENCENVPROC eglFenceNV; +extern PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV; +extern PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV; +extern PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV; +#endif /* defined(EGL_NV_sync) */ + +#if defined(EGL_NV_system_time) +extern PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC eglGetSystemTimeFrequencyNV; +extern PFNEGLGETSYSTEMTIMENVPROC eglGetSystemTimeNV; +#endif /* defined(EGL_NV_system_time) */ + +#if defined(EGL_EXT_compositor) +extern PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC eglCompositorSetContextListEXT; +extern PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC eglCompositorSetContextAttributesEXT; +extern PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC eglCompositorSetWindowListEXT; +extern PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC eglCompositorSetWindowAttributesEXT; +extern PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC eglCompositorBindTexWindowEXT; +extern PFNEGLCOMPOSITORSETSIZEEXTPROC eglCompositorSetSizeEXT; +extern PFNEGLCOMPOSITORSWAPPOLICYEXTPROC eglCompositorSwapPolicyEXT; +#endif /* defined(EGL_EXT_compositor) */ + +#if defined(EGL_WL_bind_wayland_display) +extern PFNEGLBINDWAYLANDDISPLAYWLPROC eglBindWaylandDisplayWL; +extern PFNEGLUNBINDWAYLANDDISPLAYWLPROC eglUnbindWaylandDisplayWL; +extern PFNEGLQUERYWAYLANDBUFFERWLPROC eglQueryWaylandBufferWL; +#endif /* defined(EGL_WL_bind_wayland_display) */ + +#if defined(EGL_WL_create_wayland_buffer_from_image) +extern PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC eglCreateWaylandBufferFromImageWL; +#endif /* defined(EGL_WL_create_wayland_buffer_from_image) */ + +/* EGLW_GENERATE_EGL_DECLARATION */ + +/** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from EGL spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ + +#endif + +using PFNEGLWLOADPROC = void *(*)(const char *); +void eglwLoadProcs(PFNEGLWLOADPROC eglwLoad); diff --git a/native/cocos/renderer/gfx-gles-common/gles2w.cpp b/native/cocos/renderer/gfx-gles-common/gles2w.cpp new file mode 100644 index 0000000000..febe91e2ba --- /dev/null +++ b/native/cocos/renderer/gfx-gles-common/gles2w.cpp @@ -0,0 +1,2193 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 GL_GLES_PROTOTYPES 0 +#include + +#include +#include +#include + +#include "gles2w.h" + +/** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + +/* GLES2W_GENERATE_GLES_DEFINITION */ +/* GL_ES_VERSION_2_0 */ +PFNGLACTIVETEXTUREPROC glActiveTexture; +PFNGLATTACHSHADERPROC glAttachShader; +PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation; +PFNGLBINDBUFFERPROC glBindBuffer; +PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; +PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer; +PFNGLBINDTEXTUREPROC glBindTexture; +PFNGLBLENDCOLORPROC glBlendColor; +PFNGLBLENDEQUATIONPROC glBlendEquation; +PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate; +PFNGLBLENDFUNCPROC glBlendFunc; +PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate; +PFNGLBUFFERDATAPROC glBufferData; +PFNGLBUFFERSUBDATAPROC glBufferSubData; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; +PFNGLCLEARPROC glClear; +PFNGLCLEARCOLORPROC glClearColor; +PFNGLCLEARDEPTHFPROC glClearDepthf; +PFNGLCLEARSTENCILPROC glClearStencil; +PFNGLCOLORMASKPROC glColorMask; +PFNGLCOMPILESHADERPROC glCompileShader; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D; +PFNGLCOPYTEXIMAGE2DPROC glCopyTexImage2D; +PFNGLCOPYTEXSUBIMAGE2DPROC glCopyTexSubImage2D; +PFNGLCREATEPROGRAMPROC glCreateProgram; +PFNGLCREATESHADERPROC glCreateShader; +PFNGLCULLFACEPROC glCullFace; +PFNGLDELETEBUFFERSPROC glDeleteBuffers; +PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers; +PFNGLDELETEPROGRAMPROC glDeleteProgram; +PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers; +PFNGLDELETESHADERPROC glDeleteShader; +PFNGLDELETETEXTURESPROC glDeleteTextures; +PFNGLDEPTHFUNCPROC glDepthFunc; +PFNGLDEPTHMASKPROC glDepthMask; +PFNGLDEPTHRANGEFPROC glDepthRangef; +PFNGLDETACHSHADERPROC glDetachShader; +PFNGLDISABLEPROC glDisable; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray; +PFNGLDRAWARRAYSPROC glDrawArrays; +PFNGLDRAWELEMENTSPROC glDrawElements; +PFNGLENABLEPROC glEnable; +PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray; +PFNGLFINISHPROC glFinish; +PFNGLFLUSHPROC glFlush; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer; +PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; +PFNGLFRONTFACEPROC glFrontFace; +PFNGLGENBUFFERSPROC glGenBuffers; +PFNGLGENERATEMIPMAPPROC glGenerateMipmap; +PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; +PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers; +PFNGLGENTEXTURESPROC glGenTextures; +PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib; +PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform; +PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders; +PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation; +PFNGLGETBOOLEANVPROC glGetBooleanv; +PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv; +PFNGLGETERRORPROC glGetError; +PFNGLGETFLOATVPROC glGetFloatv; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv; +PFNGLGETINTEGERVPROC glGetIntegerv; +PFNGLGETPROGRAMIVPROC glGetProgramiv; +PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv; +PFNGLGETSHADERIVPROC glGetShaderiv; +PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; +PFNGLGETSHADERPRECISIONFORMATPROC glGetShaderPrecisionFormat; +PFNGLGETSHADERSOURCEPROC glGetShaderSource; +PFNGLGETSTRINGPROC glGetString; +PFNGLGETTEXPARAMETERFVPROC glGetTexParameterfv; +PFNGLGETTEXPARAMETERIVPROC glGetTexParameteriv; +PFNGLGETUNIFORMFVPROC glGetUniformfv; +PFNGLGETUNIFORMIVPROC glGetUniformiv; +PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; +PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv; +PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv; +PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv; +PFNGLHINTPROC glHint; +PFNGLISBUFFERPROC glIsBuffer; +PFNGLISENABLEDPROC glIsEnabled; +PFNGLISFRAMEBUFFERPROC glIsFramebuffer; +PFNGLISPROGRAMPROC glIsProgram; +PFNGLISRENDERBUFFERPROC glIsRenderbuffer; +PFNGLISSHADERPROC glIsShader; +PFNGLISTEXTUREPROC glIsTexture; +PFNGLLINEWIDTHPROC glLineWidth; +PFNGLLINKPROGRAMPROC glLinkProgram; +PFNGLPIXELSTOREIPROC glPixelStorei; +PFNGLPOLYGONOFFSETPROC glPolygonOffset; +PFNGLREADPIXELSPROC glReadPixels; +PFNGLRELEASESHADERCOMPILERPROC glReleaseShaderCompiler; +PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage; +PFNGLSAMPLECOVERAGEPROC glSampleCoverage; +PFNGLSCISSORPROC glScissor; +PFNGLSHADERBINARYPROC glShaderBinary; +PFNGLSHADERSOURCEPROC glShaderSource; +PFNGLSTENCILFUNCPROC glStencilFunc; +PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate; +PFNGLSTENCILMASKPROC glStencilMask; +PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate; +PFNGLSTENCILOPPROC glStencilOp; +PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate; +PFNGLTEXIMAGE2DPROC glTexImage2D; +PFNGLTEXPARAMETERFPROC glTexParameterf; +PFNGLTEXPARAMETERFVPROC glTexParameterfv; +PFNGLTEXPARAMETERIPROC glTexParameteri; +PFNGLTEXPARAMETERIVPROC glTexParameteriv; +PFNGLTEXSUBIMAGE2DPROC glTexSubImage2D; +PFNGLUNIFORM1FPROC glUniform1f; +PFNGLUNIFORM1FVPROC glUniform1fv; +PFNGLUNIFORM1IPROC glUniform1i; +PFNGLUNIFORM1IVPROC glUniform1iv; +PFNGLUNIFORM2FPROC glUniform2f; +PFNGLUNIFORM2FVPROC glUniform2fv; +PFNGLUNIFORM2IPROC glUniform2i; +PFNGLUNIFORM2IVPROC glUniform2iv; +PFNGLUNIFORM3FPROC glUniform3f; +PFNGLUNIFORM3FVPROC glUniform3fv; +PFNGLUNIFORM3IPROC glUniform3i; +PFNGLUNIFORM3IVPROC glUniform3iv; +PFNGLUNIFORM4FPROC glUniform4f; +PFNGLUNIFORM4FVPROC glUniform4fv; +PFNGLUNIFORM4IPROC glUniform4i; +PFNGLUNIFORM4IVPROC glUniform4iv; +PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv; +PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv; +PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv; +PFNGLUSEPROGRAMPROC glUseProgram; +PFNGLVALIDATEPROGRAMPROC glValidateProgram; +PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f; +PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv; +PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f; +PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv; +PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f; +PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv; +PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f; +PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv; +PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer; +PFNGLVIEWPORTPROC glViewport; + + +#if defined(GL_AMD_framebuffer_multisample_advanced) +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC glRenderbufferStorageMultisampleAdvancedAMD; +PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC glNamedRenderbufferStorageMultisampleAdvancedAMD; +#endif /* defined(GL_AMD_framebuffer_multisample_advanced) */ + +#if defined(GL_AMD_performance_monitor) +PFNGLGETPERFMONITORGROUPSAMDPROC glGetPerfMonitorGroupsAMD; +PFNGLGETPERFMONITORCOUNTERSAMDPROC glGetPerfMonitorCountersAMD; +PFNGLGETPERFMONITORGROUPSTRINGAMDPROC glGetPerfMonitorGroupStringAMD; +PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC glGetPerfMonitorCounterStringAMD; +PFNGLGETPERFMONITORCOUNTERINFOAMDPROC glGetPerfMonitorCounterInfoAMD; +PFNGLGENPERFMONITORSAMDPROC glGenPerfMonitorsAMD; +PFNGLDELETEPERFMONITORSAMDPROC glDeletePerfMonitorsAMD; +PFNGLSELECTPERFMONITORCOUNTERSAMDPROC glSelectPerfMonitorCountersAMD; +PFNGLBEGINPERFMONITORAMDPROC glBeginPerfMonitorAMD; +PFNGLENDPERFMONITORAMDPROC glEndPerfMonitorAMD; +PFNGLGETPERFMONITORCOUNTERDATAAMDPROC glGetPerfMonitorCounterDataAMD; +#endif /* defined(GL_AMD_performance_monitor) */ + +#if defined(GL_ANGLE_framebuffer_blit) +PFNGLBLITFRAMEBUFFERANGLEPROC glBlitFramebufferANGLE; +#endif /* defined(GL_ANGLE_framebuffer_blit) */ + +#if defined(GL_ANGLE_framebuffer_multisample) +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC glRenderbufferStorageMultisampleANGLE; +#endif /* defined(GL_ANGLE_framebuffer_multisample) */ + +#if defined(GL_ANGLE_instanced_arrays) +PFNGLDRAWARRAYSINSTANCEDANGLEPROC glDrawArraysInstancedANGLE; +PFNGLDRAWELEMENTSINSTANCEDANGLEPROC glDrawElementsInstancedANGLE; +PFNGLVERTEXATTRIBDIVISORANGLEPROC glVertexAttribDivisorANGLE; +#endif /* defined(GL_ANGLE_instanced_arrays) */ + +#if defined(GL_ANGLE_translated_shader_source) +PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC glGetTranslatedShaderSourceANGLE; +#endif /* defined(GL_ANGLE_translated_shader_source) */ + +#if defined(GL_APPLE_copy_texture_levels) +PFNGLCOPYTEXTURELEVELSAPPLEPROC glCopyTextureLevelsAPPLE; +#endif /* defined(GL_APPLE_copy_texture_levels) */ + +#if defined(GL_APPLE_framebuffer_multisample) +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC glRenderbufferStorageMultisampleAPPLE; +PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC glResolveMultisampleFramebufferAPPLE; +#endif /* defined(GL_APPLE_framebuffer_multisample) */ + +#if defined(GL_APPLE_sync) +PFNGLFENCESYNCAPPLEPROC glFenceSyncAPPLE; +PFNGLISSYNCAPPLEPROC glIsSyncAPPLE; +PFNGLDELETESYNCAPPLEPROC glDeleteSyncAPPLE; +PFNGLCLIENTWAITSYNCAPPLEPROC glClientWaitSyncAPPLE; +PFNGLWAITSYNCAPPLEPROC glWaitSyncAPPLE; +PFNGLGETINTEGER64VAPPLEPROC glGetInteger64vAPPLE; +PFNGLGETSYNCIVAPPLEPROC glGetSyncivAPPLE; +#endif /* defined(GL_APPLE_sync) */ + +#if defined(GL_EXT_EGL_image_storage) +PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC glEGLImageTargetTexStorageEXT; + +PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC glEGLImageTargetTextureStorageEXT; +#endif /* defined(GL_EXT_EGL_image_storage) */ + +#if defined(GL_EXT_base_instance) +PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC glDrawArraysInstancedBaseInstanceEXT; +PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC glDrawElementsInstancedBaseInstanceEXT; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC glDrawElementsInstancedBaseVertexBaseInstanceEXT; +#endif /* defined(GL_EXT_base_instance) */ + +#if defined(GL_EXT_blend_func_extended) +PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC glBindFragDataLocationIndexedEXT; +PFNGLBINDFRAGDATALOCATIONEXTPROC glBindFragDataLocationEXT; +PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC glGetProgramResourceLocationIndexEXT; +PFNGLGETFRAGDATAINDEXEXTPROC glGetFragDataIndexEXT; +#endif /* defined(GL_EXT_blend_func_extended) */ + +#if defined(GL_EXT_buffer_storage) +PFNGLBUFFERSTORAGEEXTPROC glBufferStorageEXT; +#endif /* defined(GL_EXT_buffer_storage) */ + +#if defined(GL_EXT_clear_texture) +PFNGLCLEARTEXIMAGEEXTPROC glClearTexImageEXT; +PFNGLCLEARTEXSUBIMAGEEXTPROC glClearTexSubImageEXT; +#endif /* defined(GL_EXT_clear_texture) */ + +#if defined(GL_EXT_clip_control) +PFNGLCLIPCONTROLEXTPROC glClipControlEXT; +#endif /* defined(GL_EXT_clip_control) */ + +#if defined(GL_EXT_copy_image) +PFNGLCOPYIMAGESUBDATAEXTPROC glCopyImageSubDataEXT; +#endif /* defined(GL_EXT_copy_image) */ + +#if defined(GL_EXT_debug_label) +PFNGLLABELOBJECTEXTPROC glLabelObjectEXT; +PFNGLGETOBJECTLABELEXTPROC glGetObjectLabelEXT; +#endif /* defined(GL_EXT_debug_label) */ + +#if defined(GL_EXT_debug_marker) +PFNGLINSERTEVENTMARKEREXTPROC glInsertEventMarkerEXT; +PFNGLPUSHGROUPMARKEREXTPROC glPushGroupMarkerEXT; +PFNGLPOPGROUPMARKEREXTPROC glPopGroupMarkerEXT; +#endif /* defined(GL_EXT_debug_marker) */ + +#if defined(GL_EXT_discard_framebuffer) +PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT; +#endif /* defined(GL_EXT_discard_framebuffer) */ + +#if defined(GL_EXT_disjoint_timer_query) +PFNGLGENQUERIESEXTPROC glGenQueriesEXT; +PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT; +PFNGLISQUERYEXTPROC glIsQueryEXT; +PFNGLBEGINQUERYEXTPROC glBeginQueryEXT; +PFNGLENDQUERYEXTPROC glEndQueryEXT; +PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT; +PFNGLGETQUERYIVEXTPROC glGetQueryivEXT; +PFNGLGETQUERYOBJECTIVEXTPROC glGetQueryObjectivEXT; +PFNGLGETQUERYOBJECTUIVEXTPROC glGetQueryObjectuivEXT; +PFNGLGETQUERYOBJECTI64VEXTPROC glGetQueryObjecti64vEXT; +PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT; +PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT; +#endif /* defined(GL_EXT_disjoint_timer_query) */ + +#if defined(GL_EXT_draw_buffers) +PFNGLDRAWBUFFERSEXTPROC glDrawBuffersEXT; +#endif /* defined(GL_EXT_draw_buffers) */ + +#if defined(GL_EXT_draw_buffers_indexed) +PFNGLENABLEIEXTPROC glEnableiEXT; +PFNGLDISABLEIEXTPROC glDisableiEXT; +PFNGLBLENDEQUATIONIEXTPROC glBlendEquationiEXT; +PFNGLBLENDEQUATIONSEPARATEIEXTPROC glBlendEquationSeparateiEXT; +PFNGLBLENDFUNCIEXTPROC glBlendFunciEXT; +PFNGLBLENDFUNCSEPARATEIEXTPROC glBlendFuncSeparateiEXT; +PFNGLCOLORMASKIEXTPROC glColorMaskiEXT; +PFNGLISENABLEDIEXTPROC glIsEnablediEXT; +#endif /* defined(GL_EXT_draw_buffers_indexed) */ + +#if defined(GL_EXT_draw_elements_base_vertex) +PFNGLDRAWELEMENTSBASEVERTEXEXTPROC glDrawElementsBaseVertexEXT; +PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC glDrawRangeElementsBaseVertexEXT; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC glDrawElementsInstancedBaseVertexEXT; +PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC glMultiDrawElementsBaseVertexEXT; +#endif /* defined(GL_EXT_draw_elements_base_vertex) */ + +#if defined(GL_EXT_draw_instanced) +PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstancedEXT; +PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstancedEXT; +#endif /* defined(GL_EXT_draw_instanced) */ + +#if defined(GL_EXT_draw_transform_feedback) +PFNGLDRAWTRANSFORMFEEDBACKEXTPROC glDrawTransformFeedbackEXT; +PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC glDrawTransformFeedbackInstancedEXT; +#endif /* defined(GL_EXT_draw_transform_feedback) */ + +#if defined(GL_EXT_external_buffer) +PFNGLBUFFERSTORAGEEXTERNALEXTPROC glBufferStorageExternalEXT; +PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC glNamedBufferStorageExternalEXT; +#endif /* defined(GL_EXT_external_buffer) */ + +#if defined(GL_EXT_geometry_shader) +PFNGLFRAMEBUFFERTEXTUREEXTPROC glFramebufferTextureEXT; +#endif /* defined(GL_EXT_geometry_shader) */ + +#if defined(GL_EXT_instanced_arrays) +PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisorEXT; +#endif /* defined(GL_EXT_instanced_arrays) */ + +#if defined(GL_EXT_map_buffer_range) +PFNGLMAPBUFFERRANGEEXTPROC glMapBufferRangeEXT; +PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC glFlushMappedBufferRangeEXT; +#endif /* defined(GL_EXT_map_buffer_range) */ + +#if defined(GL_EXT_memory_object) +PFNGLGETUNSIGNEDBYTEVEXTPROC glGetUnsignedBytevEXT; +PFNGLGETUNSIGNEDBYTEI_VEXTPROC glGetUnsignedBytei_vEXT; +PFNGLDELETEMEMORYOBJECTSEXTPROC glDeleteMemoryObjectsEXT; +PFNGLISMEMORYOBJECTEXTPROC glIsMemoryObjectEXT; +PFNGLCREATEMEMORYOBJECTSEXTPROC glCreateMemoryObjectsEXT; +PFNGLMEMORYOBJECTPARAMETERIVEXTPROC glMemoryObjectParameterivEXT; +PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC glGetMemoryObjectParameterivEXT; +PFNGLTEXSTORAGEMEM2DEXTPROC glTexStorageMem2DEXT; +PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC glTexStorageMem2DMultisampleEXT; +PFNGLTEXSTORAGEMEM3DEXTPROC glTexStorageMem3DEXT; +PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC glTexStorageMem3DMultisampleEXT; +PFNGLBUFFERSTORAGEMEMEXTPROC glBufferStorageMemEXT; + +PFNGLTEXTURESTORAGEMEM2DEXTPROC glTextureStorageMem2DEXT; +PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC glTextureStorageMem2DMultisampleEXT; +PFNGLTEXTURESTORAGEMEM3DEXTPROC glTextureStorageMem3DEXT; +PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC glTextureStorageMem3DMultisampleEXT; +PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC glNamedBufferStorageMemEXT; +#endif /* defined(GL_EXT_memory_object) */ + +#if defined(GL_EXT_memory_object_fd) +PFNGLIMPORTMEMORYFDEXTPROC glImportMemoryFdEXT; +#endif /* defined(GL_EXT_memory_object_fd) */ + +#if defined(GL_EXT_memory_object_win32) +PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC glImportMemoryWin32HandleEXT; +PFNGLIMPORTMEMORYWIN32NAMEEXTPROC glImportMemoryWin32NameEXT; +#endif /* defined(GL_EXT_memory_object_win32) */ + +#if defined(GL_EXT_multi_draw_arrays) +PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArraysEXT; +PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElementsEXT; +#endif /* defined(GL_EXT_multi_draw_arrays) */ + +#if defined(GL_EXT_multi_draw_indirect) +PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC glMultiDrawArraysIndirectEXT; +PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC glMultiDrawElementsIndirectEXT; +#endif /* defined(GL_EXT_multi_draw_indirect) */ + +#if defined(GL_EXT_multisampled_render_to_texture) +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT; +PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT; +#endif /* defined(GL_EXT_multisampled_render_to_texture) */ + +#if defined(GL_EXT_multiview_draw_buffers) +PFNGLREADBUFFERINDEXEDEXTPROC glReadBufferIndexedEXT; +PFNGLDRAWBUFFERSINDEXEDEXTPROC glDrawBuffersIndexedEXT; +PFNGLGETINTEGERI_VEXTPROC glGetIntegeri_vEXT; +#endif /* defined(GL_EXT_multiview_draw_buffers) */ + +#if defined(GL_EXT_polygon_offset_clamp) +PFNGLPOLYGONOFFSETCLAMPEXTPROC glPolygonOffsetClampEXT; +#endif /* defined(GL_EXT_polygon_offset_clamp) */ + +#if defined(GL_EXT_primitive_bounding_box) +PFNGLPRIMITIVEBOUNDINGBOXEXTPROC glPrimitiveBoundingBoxEXT; +#endif /* defined(GL_EXT_primitive_bounding_box) */ + +#if defined(GL_EXT_raster_multisample) +PFNGLRASTERSAMPLESEXTPROC glRasterSamplesEXT; +#endif /* defined(GL_EXT_raster_multisample) */ + +#if defined(GL_EXT_robustness) +PFNGLGETGRAPHICSRESETSTATUSEXTPROC glGetGraphicsResetStatusEXT; +PFNGLREADNPIXELSEXTPROC glReadnPixelsEXT; +PFNGLGETNUNIFORMFVEXTPROC glGetnUniformfvEXT; +PFNGLGETNUNIFORMIVEXTPROC glGetnUniformivEXT; +#endif /* defined(GL_EXT_robustness) */ + +#if defined(GL_EXT_semaphore) +PFNGLGENSEMAPHORESEXTPROC glGenSemaphoresEXT; +PFNGLDELETESEMAPHORESEXTPROC glDeleteSemaphoresEXT; +PFNGLISSEMAPHOREEXTPROC glIsSemaphoreEXT; +PFNGLSEMAPHOREPARAMETERUI64VEXTPROC glSemaphoreParameterui64vEXT; +PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC glGetSemaphoreParameterui64vEXT; +PFNGLWAITSEMAPHOREEXTPROC glWaitSemaphoreEXT; +PFNGLSIGNALSEMAPHOREEXTPROC glSignalSemaphoreEXT; +#endif /* defined(GL_EXT_semaphore) */ + +#if defined(GL_EXT_semaphore_fd) +PFNGLIMPORTSEMAPHOREFDEXTPROC glImportSemaphoreFdEXT; +#endif /* defined(GL_EXT_semaphore_fd) */ + +#if defined(GL_EXT_semaphore_win32) +PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC glImportSemaphoreWin32HandleEXT; +PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC glImportSemaphoreWin32NameEXT; +#endif /* defined(GL_EXT_semaphore_win32) */ + +#if defined(GL_EXT_separate_shader_objects) +PFNGLACTIVESHADERPROGRAMEXTPROC glActiveShaderProgramEXT; +PFNGLBINDPROGRAMPIPELINEEXTPROC glBindProgramPipelineEXT; +PFNGLCREATESHADERPROGRAMVEXTPROC glCreateShaderProgramvEXT; +PFNGLDELETEPROGRAMPIPELINESEXTPROC glDeleteProgramPipelinesEXT; +PFNGLGENPROGRAMPIPELINESEXTPROC glGenProgramPipelinesEXT; +PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC glGetProgramPipelineInfoLogEXT; +PFNGLGETPROGRAMPIPELINEIVEXTPROC glGetProgramPipelineivEXT; +PFNGLISPROGRAMPIPELINEEXTPROC glIsProgramPipelineEXT; +PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT; +PFNGLPROGRAMUNIFORM1FEXTPROC glProgramUniform1fEXT; +PFNGLPROGRAMUNIFORM1FVEXTPROC glProgramUniform1fvEXT; +PFNGLPROGRAMUNIFORM1IEXTPROC glProgramUniform1iEXT; +PFNGLPROGRAMUNIFORM1IVEXTPROC glProgramUniform1ivEXT; +PFNGLPROGRAMUNIFORM2FEXTPROC glProgramUniform2fEXT; +PFNGLPROGRAMUNIFORM2FVEXTPROC glProgramUniform2fvEXT; +PFNGLPROGRAMUNIFORM2IEXTPROC glProgramUniform2iEXT; +PFNGLPROGRAMUNIFORM2IVEXTPROC glProgramUniform2ivEXT; +PFNGLPROGRAMUNIFORM3FEXTPROC glProgramUniform3fEXT; +PFNGLPROGRAMUNIFORM3FVEXTPROC glProgramUniform3fvEXT; +PFNGLPROGRAMUNIFORM3IEXTPROC glProgramUniform3iEXT; +PFNGLPROGRAMUNIFORM3IVEXTPROC glProgramUniform3ivEXT; +PFNGLPROGRAMUNIFORM4FEXTPROC glProgramUniform4fEXT; +PFNGLPROGRAMUNIFORM4FVEXTPROC glProgramUniform4fvEXT; +PFNGLPROGRAMUNIFORM4IEXTPROC glProgramUniform4iEXT; +PFNGLPROGRAMUNIFORM4IVEXTPROC glProgramUniform4ivEXT; +PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC glProgramUniformMatrix2fvEXT; +PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC glProgramUniformMatrix3fvEXT; +PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC glProgramUniformMatrix4fvEXT; +PFNGLUSEPROGRAMSTAGESEXTPROC glUseProgramStagesEXT; +PFNGLVALIDATEPROGRAMPIPELINEEXTPROC glValidateProgramPipelineEXT; + +PFNGLPROGRAMUNIFORM1UIEXTPROC glProgramUniform1uiEXT; +PFNGLPROGRAMUNIFORM2UIEXTPROC glProgramUniform2uiEXT; +PFNGLPROGRAMUNIFORM3UIEXTPROC glProgramUniform3uiEXT; +PFNGLPROGRAMUNIFORM4UIEXTPROC glProgramUniform4uiEXT; +PFNGLPROGRAMUNIFORM1UIVEXTPROC glProgramUniform1uivEXT; +PFNGLPROGRAMUNIFORM2UIVEXTPROC glProgramUniform2uivEXT; +PFNGLPROGRAMUNIFORM3UIVEXTPROC glProgramUniform3uivEXT; +PFNGLPROGRAMUNIFORM4UIVEXTPROC glProgramUniform4uivEXT; +PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC glProgramUniformMatrix2x3fvEXT; +PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC glProgramUniformMatrix3x2fvEXT; +PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC glProgramUniformMatrix2x4fvEXT; +PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC glProgramUniformMatrix4x2fvEXT; +PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC glProgramUniformMatrix3x4fvEXT; +PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC glProgramUniformMatrix4x3fvEXT; +#endif /* defined(GL_EXT_separate_shader_objects) */ + +#if defined(GL_EXT_shader_framebuffer_fetch_non_coherent) +PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC glFramebufferFetchBarrierEXT; +#endif /* defined(GL_EXT_shader_framebuffer_fetch_non_coherent) */ + +#if defined(GL_EXT_shader_pixel_local_storage2) +PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC glFramebufferPixelLocalStorageSizeEXT; +PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC glGetFramebufferPixelLocalStorageSizeEXT; +PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC glClearPixelLocalStorageuiEXT; +#endif /* defined(GL_EXT_shader_pixel_local_storage2) */ + +#if defined(GL_EXT_sparse_texture) +PFNGLTEXPAGECOMMITMENTEXTPROC glTexPageCommitmentEXT; +#endif /* defined(GL_EXT_sparse_texture) */ + +#if defined(GL_EXT_tessellation_shader) +PFNGLPATCHPARAMETERIEXTPROC glPatchParameteriEXT; +#endif /* defined(GL_EXT_tessellation_shader) */ + +#if defined(GL_EXT_texture_border_clamp) +PFNGLTEXPARAMETERIIVEXTPROC glTexParameterIivEXT; +PFNGLTEXPARAMETERIUIVEXTPROC glTexParameterIuivEXT; +PFNGLGETTEXPARAMETERIIVEXTPROC glGetTexParameterIivEXT; +PFNGLGETTEXPARAMETERIUIVEXTPROC glGetTexParameterIuivEXT; +PFNGLSAMPLERPARAMETERIIVEXTPROC glSamplerParameterIivEXT; +PFNGLSAMPLERPARAMETERIUIVEXTPROC glSamplerParameterIuivEXT; +PFNGLGETSAMPLERPARAMETERIIVEXTPROC glGetSamplerParameterIivEXT; +PFNGLGETSAMPLERPARAMETERIUIVEXTPROC glGetSamplerParameterIuivEXT; +#endif /* defined(GL_EXT_texture_border_clamp) */ + +#if defined(GL_EXT_texture_buffer) +PFNGLTEXBUFFEREXTPROC glTexBufferEXT; +PFNGLTEXBUFFERRANGEEXTPROC glTexBufferRangeEXT; +#endif /* defined(GL_EXT_texture_buffer) */ + +#if defined(GL_EXT_texture_storage) +PFNGLTEXSTORAGE1DEXTPROC glTexStorage1DEXT; +PFNGLTEXSTORAGE2DEXTPROC glTexStorage2DEXT; +PFNGLTEXSTORAGE3DEXTPROC glTexStorage3DEXT; + +PFNGLTEXTURESTORAGE1DEXTPROC glTextureStorage1DEXT; +PFNGLTEXTURESTORAGE2DEXTPROC glTextureStorage2DEXT; +PFNGLTEXTURESTORAGE3DEXTPROC glTextureStorage3DEXT; +#endif /* defined(GL_EXT_texture_storage) */ + +#if defined(GL_EXT_texture_view) +PFNGLTEXTUREVIEWEXTPROC glTextureViewEXT; +#endif /* defined(GL_EXT_texture_view) */ + +#if defined(GL_NV_timeline_semaphore) +PFNGLCREATESEMAPHORESNVPROC glCreateSemaphoresNV; +PFNGLSEMAPHOREPARAMETERIVNVPROC glSemaphoreParameterivNV; +PFNGLGETSEMAPHOREPARAMETERIVNVPROC glGetSemaphoreParameterivNV; +#endif /* defined(GL_NV_timeline_semaphore) */ + +#if defined(GL_EXT_win32_keyed_mutex) +PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC glAcquireKeyedMutexWin32EXT; +PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC glReleaseKeyedMutexWin32EXT; +#endif /* defined(GL_EXT_win32_keyed_mutex) */ + +#if defined(GL_EXT_window_rectangles) +PFNGLWINDOWRECTANGLESEXTPROC glWindowRectanglesEXT; +#endif /* defined(GL_EXT_window_rectangles) */ + +#if defined(GL_IMG_bindless_texture) +PFNGLGETTEXTUREHANDLEIMGPROC glGetTextureHandleIMG; +PFNGLGETTEXTURESAMPLERHANDLEIMGPROC glGetTextureSamplerHandleIMG; +PFNGLUNIFORMHANDLEUI64IMGPROC glUniformHandleui64IMG; +PFNGLUNIFORMHANDLEUI64VIMGPROC glUniformHandleui64vIMG; +PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC glProgramUniformHandleui64IMG; +PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC glProgramUniformHandleui64vIMG; +#endif /* defined(GL_IMG_bindless_texture) */ + +#if defined(GL_IMG_framebuffer_downsample) +PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC glFramebufferTexture2DDownsampleIMG; +PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC glFramebufferTextureLayerDownsampleIMG; +#endif /* defined(GL_IMG_framebuffer_downsample) */ + +#if defined(GL_IMG_multisampled_render_to_texture) +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC glRenderbufferStorageMultisampleIMG; +PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC glFramebufferTexture2DMultisampleIMG; +#endif /* defined(GL_IMG_multisampled_render_to_texture) */ + +#if defined(GL_INTEL_framebuffer_CMAA) +PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC glApplyFramebufferAttachmentCMAAINTEL; +#endif /* defined(GL_INTEL_framebuffer_CMAA) */ + +#if defined(GL_INTEL_performance_query) +PFNGLBEGINPERFQUERYINTELPROC glBeginPerfQueryINTEL; +PFNGLCREATEPERFQUERYINTELPROC glCreatePerfQueryINTEL; +PFNGLDELETEPERFQUERYINTELPROC glDeletePerfQueryINTEL; +PFNGLENDPERFQUERYINTELPROC glEndPerfQueryINTEL; +PFNGLGETFIRSTPERFQUERYIDINTELPROC glGetFirstPerfQueryIdINTEL; +PFNGLGETNEXTPERFQUERYIDINTELPROC glGetNextPerfQueryIdINTEL; +PFNGLGETPERFCOUNTERINFOINTELPROC glGetPerfCounterInfoINTEL; +PFNGLGETPERFQUERYDATAINTELPROC glGetPerfQueryDataINTEL; +PFNGLGETPERFQUERYIDBYNAMEINTELPROC glGetPerfQueryIdByNameINTEL; +PFNGLGETPERFQUERYINFOINTELPROC glGetPerfQueryInfoINTEL; +#endif /* defined(GL_INTEL_performance_query) */ + +#if defined(GL_KHR_blend_equation_advanced) +PFNGLBLENDBARRIERKHRPROC glBlendBarrierKHR; +#endif /* defined(GL_KHR_blend_equation_advanced) */ + +#if defined(GL_KHR_debug) +PFNGLDEBUGMESSAGECONTROLKHRPROC glDebugMessageControlKHR; +PFNGLDEBUGMESSAGEINSERTKHRPROC glDebugMessageInsertKHR; +PFNGLDEBUGMESSAGECALLBACKKHRPROC glDebugMessageCallbackKHR; +PFNGLGETDEBUGMESSAGELOGKHRPROC glGetDebugMessageLogKHR; +PFNGLPUSHDEBUGGROUPKHRPROC glPushDebugGroupKHR; +PFNGLPOPDEBUGGROUPKHRPROC glPopDebugGroupKHR; +PFNGLOBJECTLABELKHRPROC glObjectLabelKHR; +PFNGLGETOBJECTLABELKHRPROC glGetObjectLabelKHR; +PFNGLOBJECTPTRLABELKHRPROC glObjectPtrLabelKHR; +PFNGLGETOBJECTPTRLABELKHRPROC glGetObjectPtrLabelKHR; +PFNGLGETPOINTERVKHRPROC glGetPointervKHR; +#endif /* defined(GL_KHR_debug) */ + +#if defined(GL_KHR_robustness) +PFNGLGETGRAPHICSRESETSTATUSKHRPROC glGetGraphicsResetStatusKHR; +PFNGLREADNPIXELSKHRPROC glReadnPixelsKHR; +PFNGLGETNUNIFORMFVKHRPROC glGetnUniformfvKHR; +PFNGLGETNUNIFORMIVKHRPROC glGetnUniformivKHR; +PFNGLGETNUNIFORMUIVKHRPROC glGetnUniformuivKHR; +#endif /* defined(GL_KHR_robustness) */ + +#if defined(GL_KHR_parallel_shader_compile) +PFNGLMAXSHADERCOMPILERTHREADSKHRPROC glMaxShaderCompilerThreadsKHR; +#endif /* defined(GL_KHR_parallel_shader_compile) */ + +#if defined(GL_MESA_framebuffer_flip_y) +PFNGLFRAMEBUFFERPARAMETERIMESAPROC glFramebufferParameteriMESA; +PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC glGetFramebufferParameterivMESA; +#endif /* defined(GL_MESA_framebuffer_flip_y) */ + +#if defined(GL_NV_bindless_texture) +PFNGLGETTEXTUREHANDLENVPROC glGetTextureHandleNV; +PFNGLGETTEXTURESAMPLERHANDLENVPROC glGetTextureSamplerHandleNV; +PFNGLMAKETEXTUREHANDLERESIDENTNVPROC glMakeTextureHandleResidentNV; +PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC glMakeTextureHandleNonResidentNV; +PFNGLGETIMAGEHANDLENVPROC glGetImageHandleNV; +PFNGLMAKEIMAGEHANDLERESIDENTNVPROC glMakeImageHandleResidentNV; +PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC glMakeImageHandleNonResidentNV; +PFNGLUNIFORMHANDLEUI64NVPROC glUniformHandleui64NV; +PFNGLUNIFORMHANDLEUI64VNVPROC glUniformHandleui64vNV; +PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC glProgramUniformHandleui64NV; +PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC glProgramUniformHandleui64vNV; +PFNGLISTEXTUREHANDLERESIDENTNVPROC glIsTextureHandleResidentNV; +PFNGLISIMAGEHANDLERESIDENTNVPROC glIsImageHandleResidentNV; +#endif /* defined(GL_NV_bindless_texture) */ + +#if defined(GL_NV_blend_equation_advanced) +PFNGLBLENDPARAMETERINVPROC glBlendParameteriNV; +PFNGLBLENDBARRIERNVPROC glBlendBarrierNV; +#endif /* defined(GL_NV_blend_equation_advanced) */ + +#if defined(GL_NV_clip_space_w_scaling) +PFNGLVIEWPORTPOSITIONWSCALENVPROC glViewportPositionWScaleNV; +#endif /* defined(GL_NV_clip_space_w_scaling) */ + +#if defined(GL_NV_conditional_render) +PFNGLBEGINCONDITIONALRENDERNVPROC glBeginConditionalRenderNV; +PFNGLENDCONDITIONALRENDERNVPROC glEndConditionalRenderNV; +#endif /* defined(GL_NV_conditional_render) */ + +#if defined(GL_NV_conservative_raster) +PFNGLSUBPIXELPRECISIONBIASNVPROC glSubpixelPrecisionBiasNV; +#endif /* defined(GL_NV_conservative_raster) */ + +#if defined(GL_NV_conservative_raster_pre_snap_triangles) +PFNGLCONSERVATIVERASTERPARAMETERINVPROC glConservativeRasterParameteriNV; +#endif /* defined(GL_NV_conservative_raster_pre_snap_triangles) */ + +#if defined(GL_NV_copy_buffer) +PFNGLCOPYBUFFERSUBDATANVPROC glCopyBufferSubDataNV; +#endif /* defined(GL_NV_copy_buffer) */ + +#if defined(GL_NV_coverage_sample) +PFNGLCOVERAGEMASKNVPROC glCoverageMaskNV; +PFNGLCOVERAGEOPERATIONNVPROC glCoverageOperationNV; +#endif /* defined(GL_NV_coverage_sample) */ + +#if defined(GL_NV_draw_buffers) +PFNGLDRAWBUFFERSNVPROC glDrawBuffersNV; +#endif /* defined(GL_NV_draw_buffers) */ + +#if defined(GL_NV_draw_instanced) +PFNGLDRAWARRAYSINSTANCEDNVPROC glDrawArraysInstancedNV; +PFNGLDRAWELEMENTSINSTANCEDNVPROC glDrawElementsInstancedNV; +#endif /* defined(GL_NV_draw_instanced) */ + +#if defined(GL_NV_draw_vulkan_image) +PFNGLDRAWVKIMAGENVPROC glDrawVkImageNV; +PFNGLGETVKPROCADDRNVPROC glGetVkProcAddrNV; +PFNGLWAITVKSEMAPHORENVPROC glWaitVkSemaphoreNV; +PFNGLSIGNALVKSEMAPHORENVPROC glSignalVkSemaphoreNV; +PFNGLSIGNALVKFENCENVPROC glSignalVkFenceNV; +#endif /* defined(GL_NV_draw_vulkan_image) */ + +#if defined(GL_NV_fence) +PFNGLDELETEFENCESNVPROC glDeleteFencesNV; +PFNGLGENFENCESNVPROC glGenFencesNV; +PFNGLISFENCENVPROC glIsFenceNV; +PFNGLTESTFENCENVPROC glTestFenceNV; +PFNGLGETFENCEIVNVPROC glGetFenceivNV; +PFNGLFINISHFENCENVPROC glFinishFenceNV; +PFNGLSETFENCENVPROC glSetFenceNV; +#endif /* defined(GL_NV_fence) */ + +#if defined(GL_NV_fragment_coverage_to_color) +PFNGLFRAGMENTCOVERAGECOLORNVPROC glFragmentCoverageColorNV; +#endif /* defined(GL_NV_fragment_coverage_to_color) */ + +#if defined(GL_NV_framebuffer_blit) +PFNGLBLITFRAMEBUFFERNVPROC glBlitFramebufferNV; +#endif /* defined(GL_NV_framebuffer_blit) */ + +#if defined(GL_NV_framebuffer_mixed_samples) +PFNGLCOVERAGEMODULATIONTABLENVPROC glCoverageModulationTableNV; +PFNGLGETCOVERAGEMODULATIONTABLENVPROC glGetCoverageModulationTableNV; +PFNGLCOVERAGEMODULATIONNVPROC glCoverageModulationNV; +#endif /* defined(GL_NV_framebuffer_mixed_samples) */ + +#if defined(GL_NV_framebuffer_multisample) +PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC glRenderbufferStorageMultisampleNV; +#endif /* defined(GL_NV_framebuffer_multisample) */ + +#if defined(GL_NV_gpu_shader5) +PFNGLUNIFORM1I64NVPROC glUniform1i64NV; +PFNGLUNIFORM2I64NVPROC glUniform2i64NV; +PFNGLUNIFORM3I64NVPROC glUniform3i64NV; +PFNGLUNIFORM4I64NVPROC glUniform4i64NV; +PFNGLUNIFORM1I64VNVPROC glUniform1i64vNV; +PFNGLUNIFORM2I64VNVPROC glUniform2i64vNV; +PFNGLUNIFORM3I64VNVPROC glUniform3i64vNV; +PFNGLUNIFORM4I64VNVPROC glUniform4i64vNV; +PFNGLUNIFORM1UI64NVPROC glUniform1ui64NV; +PFNGLUNIFORM2UI64NVPROC glUniform2ui64NV; +PFNGLUNIFORM3UI64NVPROC glUniform3ui64NV; +PFNGLUNIFORM4UI64NVPROC glUniform4ui64NV; +PFNGLUNIFORM1UI64VNVPROC glUniform1ui64vNV; +PFNGLUNIFORM2UI64VNVPROC glUniform2ui64vNV; +PFNGLUNIFORM3UI64VNVPROC glUniform3ui64vNV; +PFNGLUNIFORM4UI64VNVPROC glUniform4ui64vNV; +PFNGLGETUNIFORMI64VNVPROC glGetUniformi64vNV; + +PFNGLPROGRAMUNIFORM1I64NVPROC glProgramUniform1i64NV; +PFNGLPROGRAMUNIFORM2I64NVPROC glProgramUniform2i64NV; +PFNGLPROGRAMUNIFORM3I64NVPROC glProgramUniform3i64NV; +PFNGLPROGRAMUNIFORM4I64NVPROC glProgramUniform4i64NV; +PFNGLPROGRAMUNIFORM1I64VNVPROC glProgramUniform1i64vNV; +PFNGLPROGRAMUNIFORM2I64VNVPROC glProgramUniform2i64vNV; +PFNGLPROGRAMUNIFORM3I64VNVPROC glProgramUniform3i64vNV; +PFNGLPROGRAMUNIFORM4I64VNVPROC glProgramUniform4i64vNV; +PFNGLPROGRAMUNIFORM1UI64NVPROC glProgramUniform1ui64NV; +PFNGLPROGRAMUNIFORM2UI64NVPROC glProgramUniform2ui64NV; +PFNGLPROGRAMUNIFORM3UI64NVPROC glProgramUniform3ui64NV; +PFNGLPROGRAMUNIFORM4UI64NVPROC glProgramUniform4ui64NV; +PFNGLPROGRAMUNIFORM1UI64VNVPROC glProgramUniform1ui64vNV; +PFNGLPROGRAMUNIFORM2UI64VNVPROC glProgramUniform2ui64vNV; +PFNGLPROGRAMUNIFORM3UI64VNVPROC glProgramUniform3ui64vNV; +PFNGLPROGRAMUNIFORM4UI64VNVPROC glProgramUniform4ui64vNV; +#endif /* defined(GL_NV_gpu_shader5) */ + +#if defined(GL_NV_instanced_arrays) +PFNGLVERTEXATTRIBDIVISORNVPROC glVertexAttribDivisorNV; +#endif /* defined(GL_NV_instanced_arrays) */ + +#if defined(GL_NV_internalformat_sample_query) +PFNGLGETINTERNALFORMATSAMPLEIVNVPROC glGetInternalformatSampleivNV; +#endif /* defined(GL_NV_internalformat_sample_query) */ + +#if defined(GL_NV_memory_attachment) +PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC glGetMemoryObjectDetachedResourcesuivNV; +PFNGLRESETMEMORYOBJECTPARAMETERNVPROC glResetMemoryObjectParameterNV; +PFNGLTEXATTACHMEMORYNVPROC glTexAttachMemoryNV; +PFNGLBUFFERATTACHMEMORYNVPROC glBufferAttachMemoryNV; + +PFNGLTEXTUREATTACHMEMORYNVPROC glTextureAttachMemoryNV; +PFNGLNAMEDBUFFERATTACHMEMORYNVPROC glNamedBufferAttachMemoryNV; +#endif /* defined(GL_NV_memory_attachment) */ + +#if defined(GL_NV_memory_object_sparse) +PFNGLBUFFERPAGECOMMITMENTMEMNVPROC glBufferPageCommitmentMemNV; +PFNGLTEXPAGECOMMITMENTMEMNVPROC glTexPageCommitmentMemNV; + +PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC glNamedBufferPageCommitmentMemNV; +PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC glTexturePageCommitmentMemNV; +#endif /* defined(GL_NV_memory_object_sparse) */ + +#if defined(GL_NV_mesh_shader) +PFNGLDRAWMESHTASKSNVPROC glDrawMeshTasksNV; +PFNGLDRAWMESHTASKSINDIRECTNVPROC glDrawMeshTasksIndirectNV; +PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC glMultiDrawMeshTasksIndirectNV; +PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC glMultiDrawMeshTasksIndirectCountNV; +#endif /* defined(GL_NV_mesh_shader) */ + +#if defined(GL_NV_non_square_matrices) +PFNGLUNIFORMMATRIX2X3FVNVPROC glUniformMatrix2x3fvNV; +PFNGLUNIFORMMATRIX3X2FVNVPROC glUniformMatrix3x2fvNV; +PFNGLUNIFORMMATRIX2X4FVNVPROC glUniformMatrix2x4fvNV; +PFNGLUNIFORMMATRIX4X2FVNVPROC glUniformMatrix4x2fvNV; +PFNGLUNIFORMMATRIX3X4FVNVPROC glUniformMatrix3x4fvNV; +PFNGLUNIFORMMATRIX4X3FVNVPROC glUniformMatrix4x3fvNV; +#endif /* defined(GL_NV_non_square_matrices) */ + +#if defined(GL_NV_path_rendering) +PFNGLGENPATHSNVPROC glGenPathsNV; +PFNGLDELETEPATHSNVPROC glDeletePathsNV; +PFNGLISPATHNVPROC glIsPathNV; +PFNGLPATHCOMMANDSNVPROC glPathCommandsNV; +PFNGLPATHCOORDSNVPROC glPathCoordsNV; +PFNGLPATHSUBCOMMANDSNVPROC glPathSubCommandsNV; +PFNGLPATHSUBCOORDSNVPROC glPathSubCoordsNV; +PFNGLPATHSTRINGNVPROC glPathStringNV; +PFNGLPATHGLYPHSNVPROC glPathGlyphsNV; +PFNGLPATHGLYPHRANGENVPROC glPathGlyphRangeNV; +PFNGLWEIGHTPATHSNVPROC glWeightPathsNV; +PFNGLCOPYPATHNVPROC glCopyPathNV; +PFNGLINTERPOLATEPATHSNVPROC glInterpolatePathsNV; +PFNGLTRANSFORMPATHNVPROC glTransformPathNV; +PFNGLPATHPARAMETERIVNVPROC glPathParameterivNV; +PFNGLPATHPARAMETERINVPROC glPathParameteriNV; +PFNGLPATHPARAMETERFVNVPROC glPathParameterfvNV; +PFNGLPATHPARAMETERFNVPROC glPathParameterfNV; +PFNGLPATHDASHARRAYNVPROC glPathDashArrayNV; +PFNGLPATHSTENCILFUNCNVPROC glPathStencilFuncNV; +PFNGLPATHSTENCILDEPTHOFFSETNVPROC glPathStencilDepthOffsetNV; +PFNGLSTENCILFILLPATHNVPROC glStencilFillPathNV; +PFNGLSTENCILSTROKEPATHNVPROC glStencilStrokePathNV; +PFNGLSTENCILFILLPATHINSTANCEDNVPROC glStencilFillPathInstancedNV; +PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC glStencilStrokePathInstancedNV; +PFNGLPATHCOVERDEPTHFUNCNVPROC glPathCoverDepthFuncNV; +PFNGLCOVERFILLPATHNVPROC glCoverFillPathNV; +PFNGLCOVERSTROKEPATHNVPROC glCoverStrokePathNV; +PFNGLCOVERFILLPATHINSTANCEDNVPROC glCoverFillPathInstancedNV; +PFNGLCOVERSTROKEPATHINSTANCEDNVPROC glCoverStrokePathInstancedNV; +PFNGLGETPATHPARAMETERIVNVPROC glGetPathParameterivNV; +PFNGLGETPATHPARAMETERFVNVPROC glGetPathParameterfvNV; +PFNGLGETPATHCOMMANDSNVPROC glGetPathCommandsNV; +PFNGLGETPATHCOORDSNVPROC glGetPathCoordsNV; +PFNGLGETPATHDASHARRAYNVPROC glGetPathDashArrayNV; +PFNGLGETPATHMETRICSNVPROC glGetPathMetricsNV; +PFNGLGETPATHMETRICRANGENVPROC glGetPathMetricRangeNV; +PFNGLGETPATHSPACINGNVPROC glGetPathSpacingNV; +PFNGLISPOINTINFILLPATHNVPROC glIsPointInFillPathNV; +PFNGLISPOINTINSTROKEPATHNVPROC glIsPointInStrokePathNV; +PFNGLGETPATHLENGTHNVPROC glGetPathLengthNV; +PFNGLPOINTALONGPATHNVPROC glPointAlongPathNV; + +PFNGLMATRIXLOAD3X2FNVPROC glMatrixLoad3x2fNV; +PFNGLMATRIXLOAD3X3FNVPROC glMatrixLoad3x3fNV; +PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC glMatrixLoadTranspose3x3fNV; +PFNGLMATRIXMULT3X2FNVPROC glMatrixMult3x2fNV; +PFNGLMATRIXMULT3X3FNVPROC glMatrixMult3x3fNV; +PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC glMatrixMultTranspose3x3fNV; +PFNGLSTENCILTHENCOVERFILLPATHNVPROC glStencilThenCoverFillPathNV; +PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC glStencilThenCoverStrokePathNV; +PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC glStencilThenCoverFillPathInstancedNV; +PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC glStencilThenCoverStrokePathInstancedNV; +PFNGLPATHGLYPHINDEXRANGENVPROC glPathGlyphIndexRangeNV; + +PFNGLPATHGLYPHINDEXARRAYNVPROC glPathGlyphIndexArrayNV; +PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC glPathMemoryGlyphIndexArrayNV; +PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC glProgramPathFragmentInputGenNV; +PFNGLGETPROGRAMRESOURCEFVNVPROC glGetProgramResourcefvNV; + +PFNGLMATRIXFRUSTUMEXTPROC glMatrixFrustumEXT; +PFNGLMATRIXLOADIDENTITYEXTPROC glMatrixLoadIdentityEXT; +PFNGLMATRIXLOADTRANSPOSEFEXTPROC glMatrixLoadTransposefEXT; +PFNGLMATRIXLOADTRANSPOSEDEXTPROC glMatrixLoadTransposedEXT; +PFNGLMATRIXLOADFEXTPROC glMatrixLoadfEXT; +PFNGLMATRIXLOADDEXTPROC glMatrixLoaddEXT; +PFNGLMATRIXMULTTRANSPOSEFEXTPROC glMatrixMultTransposefEXT; +PFNGLMATRIXMULTTRANSPOSEDEXTPROC glMatrixMultTransposedEXT; +PFNGLMATRIXMULTFEXTPROC glMatrixMultfEXT; +PFNGLMATRIXMULTDEXTPROC glMatrixMultdEXT; +PFNGLMATRIXORTHOEXTPROC glMatrixOrthoEXT; +PFNGLMATRIXPOPEXTPROC glMatrixPopEXT; +PFNGLMATRIXPUSHEXTPROC glMatrixPushEXT; +PFNGLMATRIXROTATEFEXTPROC glMatrixRotatefEXT; +PFNGLMATRIXROTATEDEXTPROC glMatrixRotatedEXT; +PFNGLMATRIXSCALEFEXTPROC glMatrixScalefEXT; +PFNGLMATRIXSCALEDEXTPROC glMatrixScaledEXT; +PFNGLMATRIXTRANSLATEFEXTPROC glMatrixTranslatefEXT; +PFNGLMATRIXTRANSLATEDEXTPROC glMatrixTranslatedEXT; +#endif /* defined(GL_NV_path_rendering) */ + +#if defined(GL_NV_polygon_mode) +PFNGLPOLYGONMODENVPROC glPolygonModeNV; +#endif /* defined(GL_NV_polygon_mode) */ + +#if defined(GL_NV_read_buffer) +PFNGLREADBUFFERNVPROC glReadBufferNV; +#endif /* defined(GL_NV_read_buffer) */ + +#if defined(GL_NV_sample_locations) +PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC glFramebufferSampleLocationsfvNV; +PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC glNamedFramebufferSampleLocationsfvNV; +PFNGLRESOLVEDEPTHVALUESNVPROC glResolveDepthValuesNV; +#endif /* defined(GL_NV_sample_locations) */ + +#if defined(GL_NV_scissor_exclusive) +PFNGLSCISSOREXCLUSIVENVPROC glScissorExclusiveNV; +PFNGLSCISSOREXCLUSIVEARRAYVNVPROC glScissorExclusiveArrayvNV; +#endif /* defined(GL_NV_scissor_exclusive) */ + +#if defined(GL_NV_shading_rate_image) +PFNGLBINDSHADINGRATEIMAGENVPROC glBindShadingRateImageNV; +PFNGLGETSHADINGRATEIMAGEPALETTENVPROC glGetShadingRateImagePaletteNV; +PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC glGetShadingRateSampleLocationivNV; +PFNGLSHADINGRATEIMAGEBARRIERNVPROC glShadingRateImageBarrierNV; +PFNGLSHADINGRATEIMAGEPALETTENVPROC glShadingRateImagePaletteNV; +PFNGLSHADINGRATESAMPLEORDERNVPROC glShadingRateSampleOrderNV; +PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC glShadingRateSampleOrderCustomNV; +#endif /* defined(GL_NV_shading_rate_image) */ + +#if defined(GL_NV_viewport_array) +PFNGLVIEWPORTARRAYVNVPROC glViewportArrayvNV; +PFNGLVIEWPORTINDEXEDFNVPROC glViewportIndexedfNV; +PFNGLVIEWPORTINDEXEDFVNVPROC glViewportIndexedfvNV; +PFNGLSCISSORARRAYVNVPROC glScissorArrayvNV; +PFNGLSCISSORINDEXEDNVPROC glScissorIndexedNV; +PFNGLSCISSORINDEXEDVNVPROC glScissorIndexedvNV; +PFNGLDEPTHRANGEARRAYFVNVPROC glDepthRangeArrayfvNV; +PFNGLDEPTHRANGEINDEXEDFNVPROC glDepthRangeIndexedfNV; +PFNGLGETFLOATI_VNVPROC glGetFloati_vNV; +PFNGLENABLEINVPROC glEnableiNV; +PFNGLDISABLEINVPROC glDisableiNV; +PFNGLISENABLEDINVPROC glIsEnablediNV; +#endif /* defined(GL_NV_viewport_array) */ + +#if defined(GL_NV_viewport_swizzle) +PFNGLVIEWPORTSWIZZLENVPROC glViewportSwizzleNV; +#endif /* defined(GL_NV_viewport_swizzle) */ + +#if defined(GL_OES_EGL_image) +PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; +PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES; +#endif /* defined(GL_OES_EGL_image) */ + +#if defined(GL_OES_copy_image) +PFNGLCOPYIMAGESUBDATAOESPROC glCopyImageSubDataOES; +#endif /* defined(GL_OES_copy_image) */ + +#if defined(GL_OES_draw_buffers_indexed) +PFNGLENABLEIOESPROC glEnableiOES; +PFNGLDISABLEIOESPROC glDisableiOES; +PFNGLBLENDEQUATIONIOESPROC glBlendEquationiOES; +PFNGLBLENDEQUATIONSEPARATEIOESPROC glBlendEquationSeparateiOES; +PFNGLBLENDFUNCIOESPROC glBlendFunciOES; +PFNGLBLENDFUNCSEPARATEIOESPROC glBlendFuncSeparateiOES; +PFNGLCOLORMASKIOESPROC glColorMaskiOES; +PFNGLISENABLEDIOESPROC glIsEnablediOES; +#endif /* defined(GL_OES_draw_buffers_indexed) */ + +#if defined(GL_OES_draw_elements_base_vertex) +PFNGLDRAWELEMENTSBASEVERTEXOESPROC glDrawElementsBaseVertexOES; +PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC glDrawRangeElementsBaseVertexOES; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC glDrawElementsInstancedBaseVertexOES; +#endif /* defined(GL_OES_draw_elements_base_vertex) */ + +#if defined(GL_OES_geometry_shader) +PFNGLFRAMEBUFFERTEXTUREOESPROC glFramebufferTextureOES; +#endif /* defined(GL_OES_geometry_shader) */ + +#if defined(GL_OES_get_program_binary) +PFNGLGETPROGRAMBINARYOESPROC glGetProgramBinaryOES; +PFNGLPROGRAMBINARYOESPROC glProgramBinaryOES; +#endif /* defined(GL_OES_get_program_binary) */ + +#if defined(GL_OES_mapbuffer) +PFNGLMAPBUFFEROESPROC glMapBufferOES; +PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES; +PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointervOES; +#endif /* defined(GL_OES_mapbuffer) */ + +#if defined(GL_OES_primitive_bounding_box) +PFNGLPRIMITIVEBOUNDINGBOXOESPROC glPrimitiveBoundingBoxOES; +#endif /* defined(GL_OES_primitive_bounding_box) */ + +#if defined(GL_OES_sample_shading) +PFNGLMINSAMPLESHADINGOESPROC glMinSampleShadingOES; +#endif /* defined(GL_OES_sample_shading) */ + +#if defined(GL_OES_tessellation_shader) +PFNGLPATCHPARAMETERIOESPROC glPatchParameteriOES; +#endif /* defined(GL_OES_tessellation_shader) */ + +#if defined(GL_OES_texture_3D) +PFNGLTEXIMAGE3DOESPROC glTexImage3DOES; +PFNGLTEXSUBIMAGE3DOESPROC glTexSubImage3DOES; +PFNGLCOPYTEXSUBIMAGE3DOESPROC glCopyTexSubImage3DOES; +PFNGLCOMPRESSEDTEXIMAGE3DOESPROC glCompressedTexImage3DOES; +PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC glCompressedTexSubImage3DOES; +PFNGLFRAMEBUFFERTEXTURE3DOESPROC glFramebufferTexture3DOES; +#endif /* defined(GL_OES_texture_3D) */ + +#if defined(GL_OES_texture_border_clamp) +PFNGLTEXPARAMETERIIVOESPROC glTexParameterIivOES; +PFNGLTEXPARAMETERIUIVOESPROC glTexParameterIuivOES; +PFNGLGETTEXPARAMETERIIVOESPROC glGetTexParameterIivOES; +PFNGLGETTEXPARAMETERIUIVOESPROC glGetTexParameterIuivOES; +PFNGLSAMPLERPARAMETERIIVOESPROC glSamplerParameterIivOES; +PFNGLSAMPLERPARAMETERIUIVOESPROC glSamplerParameterIuivOES; +PFNGLGETSAMPLERPARAMETERIIVOESPROC glGetSamplerParameterIivOES; +PFNGLGETSAMPLERPARAMETERIUIVOESPROC glGetSamplerParameterIuivOES; +#endif /* defined(GL_OES_texture_border_clamp) */ + +#if defined(GL_OES_texture_buffer) +PFNGLTEXBUFFEROESPROC glTexBufferOES; +PFNGLTEXBUFFERRANGEOESPROC glTexBufferRangeOES; +#endif /* defined(GL_OES_texture_buffer) */ + +#if defined(GL_OES_texture_storage_multisample_2d_array) +PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC glTexStorage3DMultisampleOES; +#endif /* defined(GL_OES_texture_storage_multisample_2d_array) */ + +#if defined(GL_OES_texture_view) +PFNGLTEXTUREVIEWOESPROC glTextureViewOES; +#endif /* defined(GL_OES_texture_view) */ + +#if defined(GL_OES_vertex_array_object) +PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES; +PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES; +PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES; +PFNGLISVERTEXARRAYOESPROC glIsVertexArrayOES; +#endif /* defined(GL_OES_vertex_array_object) */ + +#if defined(GL_OES_viewport_array) +PFNGLVIEWPORTARRAYVOESPROC glViewportArrayvOES; +PFNGLVIEWPORTINDEXEDFOESPROC glViewportIndexedfOES; +PFNGLVIEWPORTINDEXEDFVOESPROC glViewportIndexedfvOES; +PFNGLSCISSORARRAYVOESPROC glScissorArrayvOES; +PFNGLSCISSORINDEXEDOESPROC glScissorIndexedOES; +PFNGLSCISSORINDEXEDVOESPROC glScissorIndexedvOES; +PFNGLDEPTHRANGEARRAYFVOESPROC glDepthRangeArrayfvOES; +PFNGLDEPTHRANGEINDEXEDFOESPROC glDepthRangeIndexedfOES; +PFNGLGETFLOATI_VOESPROC glGetFloati_vOES; +#endif /* defined(GL_OES_viewport_array) */ + +#if defined(GL_OVR_multiview) +PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC glFramebufferTextureMultiviewOVR; +#endif /* defined(GL_OVR_multiview) */ + +#if defined(GL_OVR_multiview_multisampled_render_to_texture) +PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC glFramebufferTextureMultisampleMultiviewOVR; +#endif /* defined(GL_OVR_multiview_multisampled_render_to_texture) */ + +#if defined(GL_QCOM_alpha_test) +PFNGLALPHAFUNCQCOMPROC glAlphaFuncQCOM; +#endif /* defined(GL_QCOM_alpha_test) */ + +#if defined(GL_QCOM_driver_control) +PFNGLGETDRIVERCONTROLSQCOMPROC glGetDriverControlsQCOM; +PFNGLGETDRIVERCONTROLSTRINGQCOMPROC glGetDriverControlStringQCOM; +PFNGLENABLEDRIVERCONTROLQCOMPROC glEnableDriverControlQCOM; +PFNGLDISABLEDRIVERCONTROLQCOMPROC glDisableDriverControlQCOM; +#endif /* defined(GL_QCOM_driver_control) */ + +#if defined(GL_QCOM_extended_get) +PFNGLEXTGETTEXTURESQCOMPROC glExtGetTexturesQCOM; +PFNGLEXTGETBUFFERSQCOMPROC glExtGetBuffersQCOM; +PFNGLEXTGETRENDERBUFFERSQCOMPROC glExtGetRenderbuffersQCOM; +PFNGLEXTGETFRAMEBUFFERSQCOMPROC glExtGetFramebuffersQCOM; +PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC glExtGetTexLevelParameterivQCOM; +PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC glExtTexObjectStateOverrideiQCOM; +PFNGLEXTGETTEXSUBIMAGEQCOMPROC glExtGetTexSubImageQCOM; +PFNGLEXTGETBUFFERPOINTERVQCOMPROC glExtGetBufferPointervQCOM; +#endif /* defined(GL_QCOM_extended_get) */ + +#if defined(GL_QCOM_extended_get2) +PFNGLEXTGETSHADERSQCOMPROC glExtGetShadersQCOM; +PFNGLEXTGETPROGRAMSQCOMPROC glExtGetProgramsQCOM; +PFNGLEXTISPROGRAMBINARYQCOMPROC glExtIsProgramBinaryQCOM; +PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC glExtGetProgramBinarySourceQCOM; +#endif /* defined(GL_QCOM_extended_get2) */ + +#if defined(GL_QCOM_framebuffer_foveated) +PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC glFramebufferFoveationConfigQCOM; +PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC glFramebufferFoveationParametersQCOM; +#endif /* defined(GL_QCOM_framebuffer_foveated) */ + +#if defined(GL_QCOM_motion_estimation) +PFNGLTEXESTIMATEMOTIONQCOMPROC glTexEstimateMotionQCOM; +PFNGLTEXESTIMATEMOTIONREGIONSQCOMPROC glTexEstimateMotionRegionsQCOM; +#endif /* defined(GL_QCOM_motion_estimation) */ + +#if defined(GL_QCOM_frame_extrapolation) +PFNGLEXTRAPOLATETEX2DQCOMPROC glExtrapolateTex2DQCOM; +#endif /* defined(GL_QCOM_frame_extrapolation) */ + +#if defined(GL_QCOM_texture_foveated) +PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC glTextureFoveationParametersQCOM; +#endif /* defined(GL_QCOM_texture_foveated) */ + +#if defined(GL_QCOM_shader_framebuffer_fetch_noncoherent) +PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC glFramebufferFetchBarrierQCOM; +#endif /* defined(GL_QCOM_shader_framebuffer_fetch_noncoherent) */ + +#if defined(GL_QCOM_shading_rate) +PFNGLSHADINGRATEQCOMPROC glShadingRateQCOM; +#endif /* defined(GL_QCOM_shading_rate) */ + +#if defined(GL_QCOM_tiled_rendering) +PFNGLSTARTTILINGQCOMPROC glStartTilingQCOM; +PFNGLENDTILINGQCOMPROC glEndTilingQCOM; +#endif /* defined(GL_QCOM_tiled_rendering) */ + +/* GLES2W_GENERATE_GLES_DEFINITION */ + +/** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ + +void gles2wLoadProcs(PFNGLES2WLOADPROC gles2wLoad) { + /** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + + /* GLES2W_GENERATE_GLES_LOAD */ + /* GL_ES_VERSION_2_0 */ + glActiveTexture = (PFNGLACTIVETEXTUREPROC)gles2wLoad("glActiveTexture"); + glAttachShader = (PFNGLATTACHSHADERPROC)gles2wLoad("glAttachShader"); + glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)gles2wLoad("glBindAttribLocation"); + glBindBuffer = (PFNGLBINDBUFFERPROC)gles2wLoad("glBindBuffer"); + glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)gles2wLoad("glBindFramebuffer"); + glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)gles2wLoad("glBindRenderbuffer"); + glBindTexture = (PFNGLBINDTEXTUREPROC)gles2wLoad("glBindTexture"); + glBlendColor = (PFNGLBLENDCOLORPROC)gles2wLoad("glBlendColor"); + glBlendEquation = (PFNGLBLENDEQUATIONPROC)gles2wLoad("glBlendEquation"); + glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)gles2wLoad("glBlendEquationSeparate"); + glBlendFunc = (PFNGLBLENDFUNCPROC)gles2wLoad("glBlendFunc"); + glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)gles2wLoad("glBlendFuncSeparate"); + glBufferData = (PFNGLBUFFERDATAPROC)gles2wLoad("glBufferData"); + glBufferSubData = (PFNGLBUFFERSUBDATAPROC)gles2wLoad("glBufferSubData"); + glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)gles2wLoad("glCheckFramebufferStatus"); + glClear = (PFNGLCLEARPROC)gles2wLoad("glClear"); + glClearColor = (PFNGLCLEARCOLORPROC)gles2wLoad("glClearColor"); + glClearDepthf = (PFNGLCLEARDEPTHFPROC)gles2wLoad("glClearDepthf"); + glClearStencil = (PFNGLCLEARSTENCILPROC)gles2wLoad("glClearStencil"); + glColorMask = (PFNGLCOLORMASKPROC)gles2wLoad("glColorMask"); + glCompileShader = (PFNGLCOMPILESHADERPROC)gles2wLoad("glCompileShader"); + glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)gles2wLoad("glCompressedTexImage2D"); + glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)gles2wLoad("glCompressedTexSubImage2D"); + glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)gles2wLoad("glCopyTexImage2D"); + glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)gles2wLoad("glCopyTexSubImage2D"); + glCreateProgram = (PFNGLCREATEPROGRAMPROC)gles2wLoad("glCreateProgram"); + glCreateShader = (PFNGLCREATESHADERPROC)gles2wLoad("glCreateShader"); + glCullFace = (PFNGLCULLFACEPROC)gles2wLoad("glCullFace"); + glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)gles2wLoad("glDeleteBuffers"); + glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)gles2wLoad("glDeleteFramebuffers"); + glDeleteProgram = (PFNGLDELETEPROGRAMPROC)gles2wLoad("glDeleteProgram"); + glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)gles2wLoad("glDeleteRenderbuffers"); + glDeleteShader = (PFNGLDELETESHADERPROC)gles2wLoad("glDeleteShader"); + glDeleteTextures = (PFNGLDELETETEXTURESPROC)gles2wLoad("glDeleteTextures"); + glDepthFunc = (PFNGLDEPTHFUNCPROC)gles2wLoad("glDepthFunc"); + glDepthMask = (PFNGLDEPTHMASKPROC)gles2wLoad("glDepthMask"); + glDepthRangef = (PFNGLDEPTHRANGEFPROC)gles2wLoad("glDepthRangef"); + glDetachShader = (PFNGLDETACHSHADERPROC)gles2wLoad("glDetachShader"); + glDisable = (PFNGLDISABLEPROC)gles2wLoad("glDisable"); + glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)gles2wLoad("glDisableVertexAttribArray"); + glDrawArrays = (PFNGLDRAWARRAYSPROC)gles2wLoad("glDrawArrays"); + glDrawElements = (PFNGLDRAWELEMENTSPROC)gles2wLoad("glDrawElements"); + glEnable = (PFNGLENABLEPROC)gles2wLoad("glEnable"); + glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)gles2wLoad("glEnableVertexAttribArray"); + glFinish = (PFNGLFINISHPROC)gles2wLoad("glFinish"); + glFlush = (PFNGLFLUSHPROC)gles2wLoad("glFlush"); + glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)gles2wLoad("glFramebufferRenderbuffer"); + glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)gles2wLoad("glFramebufferTexture2D"); + glFrontFace = (PFNGLFRONTFACEPROC)gles2wLoad("glFrontFace"); + glGenBuffers = (PFNGLGENBUFFERSPROC)gles2wLoad("glGenBuffers"); + glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)gles2wLoad("glGenerateMipmap"); + glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)gles2wLoad("glGenFramebuffers"); + glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)gles2wLoad("glGenRenderbuffers"); + glGenTextures = (PFNGLGENTEXTURESPROC)gles2wLoad("glGenTextures"); + glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)gles2wLoad("glGetActiveAttrib"); + glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)gles2wLoad("glGetActiveUniform"); + glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)gles2wLoad("glGetAttachedShaders"); + glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)gles2wLoad("glGetAttribLocation"); + glGetBooleanv = (PFNGLGETBOOLEANVPROC)gles2wLoad("glGetBooleanv"); + glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)gles2wLoad("glGetBufferParameteriv"); + glGetError = (PFNGLGETERRORPROC)gles2wLoad("glGetError"); + glGetFloatv = (PFNGLGETFLOATVPROC)gles2wLoad("glGetFloatv"); + glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)gles2wLoad("glGetFramebufferAttachmentParameteriv"); + glGetIntegerv = (PFNGLGETINTEGERVPROC)gles2wLoad("glGetIntegerv"); + glGetProgramiv = (PFNGLGETPROGRAMIVPROC)gles2wLoad("glGetProgramiv"); + glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)gles2wLoad("glGetProgramInfoLog"); + glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)gles2wLoad("glGetRenderbufferParameteriv"); + glGetShaderiv = (PFNGLGETSHADERIVPROC)gles2wLoad("glGetShaderiv"); + glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)gles2wLoad("glGetShaderInfoLog"); + glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)gles2wLoad("glGetShaderPrecisionFormat"); + glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)gles2wLoad("glGetShaderSource"); + glGetString = (PFNGLGETSTRINGPROC)gles2wLoad("glGetString"); + glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)gles2wLoad("glGetTexParameterfv"); + glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)gles2wLoad("glGetTexParameteriv"); + glGetUniformfv = (PFNGLGETUNIFORMFVPROC)gles2wLoad("glGetUniformfv"); + glGetUniformiv = (PFNGLGETUNIFORMIVPROC)gles2wLoad("glGetUniformiv"); + glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)gles2wLoad("glGetUniformLocation"); + glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)gles2wLoad("glGetVertexAttribfv"); + glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)gles2wLoad("glGetVertexAttribiv"); + glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)gles2wLoad("glGetVertexAttribPointerv"); + glHint = (PFNGLHINTPROC)gles2wLoad("glHint"); + glIsBuffer = (PFNGLISBUFFERPROC)gles2wLoad("glIsBuffer"); + glIsEnabled = (PFNGLISENABLEDPROC)gles2wLoad("glIsEnabled"); + glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)gles2wLoad("glIsFramebuffer"); + glIsProgram = (PFNGLISPROGRAMPROC)gles2wLoad("glIsProgram"); + glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)gles2wLoad("glIsRenderbuffer"); + glIsShader = (PFNGLISSHADERPROC)gles2wLoad("glIsShader"); + glIsTexture = (PFNGLISTEXTUREPROC)gles2wLoad("glIsTexture"); + glLineWidth = (PFNGLLINEWIDTHPROC)gles2wLoad("glLineWidth"); + glLinkProgram = (PFNGLLINKPROGRAMPROC)gles2wLoad("glLinkProgram"); + glPixelStorei = (PFNGLPIXELSTOREIPROC)gles2wLoad("glPixelStorei"); + glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)gles2wLoad("glPolygonOffset"); + glReadPixels = (PFNGLREADPIXELSPROC)gles2wLoad("glReadPixels"); + glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)gles2wLoad("glReleaseShaderCompiler"); + glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)gles2wLoad("glRenderbufferStorage"); + glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)gles2wLoad("glSampleCoverage"); + glScissor = (PFNGLSCISSORPROC)gles2wLoad("glScissor"); + glShaderBinary = (PFNGLSHADERBINARYPROC)gles2wLoad("glShaderBinary"); + glShaderSource = (PFNGLSHADERSOURCEPROC)gles2wLoad("glShaderSource"); + glStencilFunc = (PFNGLSTENCILFUNCPROC)gles2wLoad("glStencilFunc"); + glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)gles2wLoad("glStencilFuncSeparate"); + glStencilMask = (PFNGLSTENCILMASKPROC)gles2wLoad("glStencilMask"); + glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)gles2wLoad("glStencilMaskSeparate"); + glStencilOp = (PFNGLSTENCILOPPROC)gles2wLoad("glStencilOp"); + glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)gles2wLoad("glStencilOpSeparate"); + glTexImage2D = (PFNGLTEXIMAGE2DPROC)gles2wLoad("glTexImage2D"); + glTexParameterf = (PFNGLTEXPARAMETERFPROC)gles2wLoad("glTexParameterf"); + glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)gles2wLoad("glTexParameterfv"); + glTexParameteri = (PFNGLTEXPARAMETERIPROC)gles2wLoad("glTexParameteri"); + glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)gles2wLoad("glTexParameteriv"); + glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)gles2wLoad("glTexSubImage2D"); + glUniform1f = (PFNGLUNIFORM1FPROC)gles2wLoad("glUniform1f"); + glUniform1fv = (PFNGLUNIFORM1FVPROC)gles2wLoad("glUniform1fv"); + glUniform1i = (PFNGLUNIFORM1IPROC)gles2wLoad("glUniform1i"); + glUniform1iv = (PFNGLUNIFORM1IVPROC)gles2wLoad("glUniform1iv"); + glUniform2f = (PFNGLUNIFORM2FPROC)gles2wLoad("glUniform2f"); + glUniform2fv = (PFNGLUNIFORM2FVPROC)gles2wLoad("glUniform2fv"); + glUniform2i = (PFNGLUNIFORM2IPROC)gles2wLoad("glUniform2i"); + glUniform2iv = (PFNGLUNIFORM2IVPROC)gles2wLoad("glUniform2iv"); + glUniform3f = (PFNGLUNIFORM3FPROC)gles2wLoad("glUniform3f"); + glUniform3fv = (PFNGLUNIFORM3FVPROC)gles2wLoad("glUniform3fv"); + glUniform3i = (PFNGLUNIFORM3IPROC)gles2wLoad("glUniform3i"); + glUniform3iv = (PFNGLUNIFORM3IVPROC)gles2wLoad("glUniform3iv"); + glUniform4f = (PFNGLUNIFORM4FPROC)gles2wLoad("glUniform4f"); + glUniform4fv = (PFNGLUNIFORM4FVPROC)gles2wLoad("glUniform4fv"); + glUniform4i = (PFNGLUNIFORM4IPROC)gles2wLoad("glUniform4i"); + glUniform4iv = (PFNGLUNIFORM4IVPROC)gles2wLoad("glUniform4iv"); + glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)gles2wLoad("glUniformMatrix2fv"); + glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)gles2wLoad("glUniformMatrix3fv"); + glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)gles2wLoad("glUniformMatrix4fv"); + glUseProgram = (PFNGLUSEPROGRAMPROC)gles2wLoad("glUseProgram"); + glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)gles2wLoad("glValidateProgram"); + glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)gles2wLoad("glVertexAttrib1f"); + glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)gles2wLoad("glVertexAttrib1fv"); + glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)gles2wLoad("glVertexAttrib2f"); + glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)gles2wLoad("glVertexAttrib2fv"); + glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)gles2wLoad("glVertexAttrib3f"); + glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)gles2wLoad("glVertexAttrib3fv"); + glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)gles2wLoad("glVertexAttrib4f"); + glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)gles2wLoad("glVertexAttrib4fv"); + glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)gles2wLoad("glVertexAttribPointer"); + glViewport = (PFNGLVIEWPORTPROC)gles2wLoad("glViewport"); + + +#if defined(GL_AMD_framebuffer_multisample_advanced) + glRenderbufferStorageMultisampleAdvancedAMD = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC)gles2wLoad("glRenderbufferStorageMultisampleAdvancedAMD"); + glNamedRenderbufferStorageMultisampleAdvancedAMD = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC)gles2wLoad("glNamedRenderbufferStorageMultisampleAdvancedAMD"); +#endif /* defined(GL_AMD_framebuffer_multisample_advanced) */ + +#if defined(GL_AMD_performance_monitor) + glGetPerfMonitorGroupsAMD = (PFNGLGETPERFMONITORGROUPSAMDPROC)gles2wLoad("glGetPerfMonitorGroupsAMD"); + glGetPerfMonitorCountersAMD = (PFNGLGETPERFMONITORCOUNTERSAMDPROC)gles2wLoad("glGetPerfMonitorCountersAMD"); + glGetPerfMonitorGroupStringAMD = (PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)gles2wLoad("glGetPerfMonitorGroupStringAMD"); + glGetPerfMonitorCounterStringAMD = (PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)gles2wLoad("glGetPerfMonitorCounterStringAMD"); + glGetPerfMonitorCounterInfoAMD = (PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)gles2wLoad("glGetPerfMonitorCounterInfoAMD"); + glGenPerfMonitorsAMD = (PFNGLGENPERFMONITORSAMDPROC)gles2wLoad("glGenPerfMonitorsAMD"); + glDeletePerfMonitorsAMD = (PFNGLDELETEPERFMONITORSAMDPROC)gles2wLoad("glDeletePerfMonitorsAMD"); + glSelectPerfMonitorCountersAMD = (PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)gles2wLoad("glSelectPerfMonitorCountersAMD"); + glBeginPerfMonitorAMD = (PFNGLBEGINPERFMONITORAMDPROC)gles2wLoad("glBeginPerfMonitorAMD"); + glEndPerfMonitorAMD = (PFNGLENDPERFMONITORAMDPROC)gles2wLoad("glEndPerfMonitorAMD"); + glGetPerfMonitorCounterDataAMD = (PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)gles2wLoad("glGetPerfMonitorCounterDataAMD"); +#endif /* defined(GL_AMD_performance_monitor) */ + +#if defined(GL_ANGLE_framebuffer_blit) + glBlitFramebufferANGLE = (PFNGLBLITFRAMEBUFFERANGLEPROC)gles2wLoad("glBlitFramebufferANGLE"); +#endif /* defined(GL_ANGLE_framebuffer_blit) */ + +#if defined(GL_ANGLE_framebuffer_multisample) + glRenderbufferStorageMultisampleANGLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)gles2wLoad("glRenderbufferStorageMultisampleANGLE"); +#endif /* defined(GL_ANGLE_framebuffer_multisample) */ + +#if defined(GL_ANGLE_instanced_arrays) + glDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC)gles2wLoad("glDrawArraysInstancedANGLE"); + glDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)gles2wLoad("glDrawElementsInstancedANGLE"); + glVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC)gles2wLoad("glVertexAttribDivisorANGLE"); +#endif /* defined(GL_ANGLE_instanced_arrays) */ + +#if defined(GL_ANGLE_translated_shader_source) + glGetTranslatedShaderSourceANGLE = (PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)gles2wLoad("glGetTranslatedShaderSourceANGLE"); +#endif /* defined(GL_ANGLE_translated_shader_source) */ + +#if defined(GL_APPLE_copy_texture_levels) + glCopyTextureLevelsAPPLE = (PFNGLCOPYTEXTURELEVELSAPPLEPROC)gles2wLoad("glCopyTextureLevelsAPPLE"); +#endif /* defined(GL_APPLE_copy_texture_levels) */ + +#if defined(GL_APPLE_framebuffer_multisample) + glRenderbufferStorageMultisampleAPPLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC)gles2wLoad("glRenderbufferStorageMultisampleAPPLE"); + glResolveMultisampleFramebufferAPPLE = (PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC)gles2wLoad("glResolveMultisampleFramebufferAPPLE"); +#endif /* defined(GL_APPLE_framebuffer_multisample) */ + +#if defined(GL_APPLE_sync) + glFenceSyncAPPLE = (PFNGLFENCESYNCAPPLEPROC)gles2wLoad("glFenceSyncAPPLE"); + glIsSyncAPPLE = (PFNGLISSYNCAPPLEPROC)gles2wLoad("glIsSyncAPPLE"); + glDeleteSyncAPPLE = (PFNGLDELETESYNCAPPLEPROC)gles2wLoad("glDeleteSyncAPPLE"); + glClientWaitSyncAPPLE = (PFNGLCLIENTWAITSYNCAPPLEPROC)gles2wLoad("glClientWaitSyncAPPLE"); + glWaitSyncAPPLE = (PFNGLWAITSYNCAPPLEPROC)gles2wLoad("glWaitSyncAPPLE"); + glGetInteger64vAPPLE = (PFNGLGETINTEGER64VAPPLEPROC)gles2wLoad("glGetInteger64vAPPLE"); + glGetSyncivAPPLE = (PFNGLGETSYNCIVAPPLEPROC)gles2wLoad("glGetSyncivAPPLE"); +#endif /* defined(GL_APPLE_sync) */ + +#if defined(GL_EXT_EGL_image_storage) + glEGLImageTargetTexStorageEXT = (PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC)gles2wLoad("glEGLImageTargetTexStorageEXT"); + + glEGLImageTargetTextureStorageEXT = (PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC)gles2wLoad("glEGLImageTargetTextureStorageEXT"); +#endif /* defined(GL_EXT_EGL_image_storage) */ + +#if defined(GL_EXT_base_instance) + glDrawArraysInstancedBaseInstanceEXT = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC)gles2wLoad("glDrawArraysInstancedBaseInstanceEXT"); + glDrawElementsInstancedBaseInstanceEXT = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC)gles2wLoad("glDrawElementsInstancedBaseInstanceEXT"); + glDrawElementsInstancedBaseVertexBaseInstanceEXT = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC)gles2wLoad("glDrawElementsInstancedBaseVertexBaseInstanceEXT"); +#endif /* defined(GL_EXT_base_instance) */ + +#if defined(GL_EXT_blend_func_extended) + glBindFragDataLocationIndexedEXT = (PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC)gles2wLoad("glBindFragDataLocationIndexedEXT"); + glBindFragDataLocationEXT = (PFNGLBINDFRAGDATALOCATIONEXTPROC)gles2wLoad("glBindFragDataLocationEXT"); + glGetProgramResourceLocationIndexEXT = (PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC)gles2wLoad("glGetProgramResourceLocationIndexEXT"); + glGetFragDataIndexEXT = (PFNGLGETFRAGDATAINDEXEXTPROC)gles2wLoad("glGetFragDataIndexEXT"); +#endif /* defined(GL_EXT_blend_func_extended) */ + +#if defined(GL_EXT_buffer_storage) + glBufferStorageEXT = (PFNGLBUFFERSTORAGEEXTPROC)gles2wLoad("glBufferStorageEXT"); +#endif /* defined(GL_EXT_buffer_storage) */ + +#if defined(GL_EXT_clear_texture) + glClearTexImageEXT = (PFNGLCLEARTEXIMAGEEXTPROC)gles2wLoad("glClearTexImageEXT"); + glClearTexSubImageEXT = (PFNGLCLEARTEXSUBIMAGEEXTPROC)gles2wLoad("glClearTexSubImageEXT"); +#endif /* defined(GL_EXT_clear_texture) */ + +#if defined(GL_EXT_clip_control) + glClipControlEXT = (PFNGLCLIPCONTROLEXTPROC)gles2wLoad("glClipControlEXT"); +#endif /* defined(GL_EXT_clip_control) */ + +#if defined(GL_EXT_copy_image) + glCopyImageSubDataEXT = (PFNGLCOPYIMAGESUBDATAEXTPROC)gles2wLoad("glCopyImageSubDataEXT"); +#endif /* defined(GL_EXT_copy_image) */ + +#if defined(GL_EXT_debug_label) + glLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC)gles2wLoad("glLabelObjectEXT"); + glGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC)gles2wLoad("glGetObjectLabelEXT"); +#endif /* defined(GL_EXT_debug_label) */ + +#if defined(GL_EXT_debug_marker) + glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)gles2wLoad("glInsertEventMarkerEXT"); + glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)gles2wLoad("glPushGroupMarkerEXT"); + glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)gles2wLoad("glPopGroupMarkerEXT"); +#endif /* defined(GL_EXT_debug_marker) */ + +#if defined(GL_EXT_discard_framebuffer) + glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)gles2wLoad("glDiscardFramebufferEXT"); +#endif /* defined(GL_EXT_discard_framebuffer) */ + +#if defined(GL_EXT_disjoint_timer_query) + glGenQueriesEXT = (PFNGLGENQUERIESEXTPROC)gles2wLoad("glGenQueriesEXT"); + glDeleteQueriesEXT = (PFNGLDELETEQUERIESEXTPROC)gles2wLoad("glDeleteQueriesEXT"); + glIsQueryEXT = (PFNGLISQUERYEXTPROC)gles2wLoad("glIsQueryEXT"); + glBeginQueryEXT = (PFNGLBEGINQUERYEXTPROC)gles2wLoad("glBeginQueryEXT"); + glEndQueryEXT = (PFNGLENDQUERYEXTPROC)gles2wLoad("glEndQueryEXT"); + glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)gles2wLoad("glQueryCounterEXT"); + glGetQueryivEXT = (PFNGLGETQUERYIVEXTPROC)gles2wLoad("glGetQueryivEXT"); + glGetQueryObjectivEXT = (PFNGLGETQUERYOBJECTIVEXTPROC)gles2wLoad("glGetQueryObjectivEXT"); + glGetQueryObjectuivEXT = (PFNGLGETQUERYOBJECTUIVEXTPROC)gles2wLoad("glGetQueryObjectuivEXT"); + glGetQueryObjecti64vEXT = (PFNGLGETQUERYOBJECTI64VEXTPROC)gles2wLoad("glGetQueryObjecti64vEXT"); + glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)gles2wLoad("glGetQueryObjectui64vEXT"); + glGetInteger64vEXT = (PFNGLGETINTEGER64VEXTPROC)gles2wLoad("glGetInteger64vEXT"); +#endif /* defined(GL_EXT_disjoint_timer_query) */ + +#if defined(GL_EXT_draw_buffers) + glDrawBuffersEXT = (PFNGLDRAWBUFFERSEXTPROC)gles2wLoad("glDrawBuffersEXT"); +#endif /* defined(GL_EXT_draw_buffers) */ + +#if defined(GL_EXT_draw_buffers_indexed) + glEnableiEXT = (PFNGLENABLEIEXTPROC)gles2wLoad("glEnableiEXT"); + glDisableiEXT = (PFNGLDISABLEIEXTPROC)gles2wLoad("glDisableiEXT"); + glBlendEquationiEXT = (PFNGLBLENDEQUATIONIEXTPROC)gles2wLoad("glBlendEquationiEXT"); + glBlendEquationSeparateiEXT = (PFNGLBLENDEQUATIONSEPARATEIEXTPROC)gles2wLoad("glBlendEquationSeparateiEXT"); + glBlendFunciEXT = (PFNGLBLENDFUNCIEXTPROC)gles2wLoad("glBlendFunciEXT"); + glBlendFuncSeparateiEXT = (PFNGLBLENDFUNCSEPARATEIEXTPROC)gles2wLoad("glBlendFuncSeparateiEXT"); + glColorMaskiEXT = (PFNGLCOLORMASKIEXTPROC)gles2wLoad("glColorMaskiEXT"); + glIsEnablediEXT = (PFNGLISENABLEDIEXTPROC)gles2wLoad("glIsEnablediEXT"); +#endif /* defined(GL_EXT_draw_buffers_indexed) */ + +#if defined(GL_EXT_draw_elements_base_vertex) + glDrawElementsBaseVertexEXT = (PFNGLDRAWELEMENTSBASEVERTEXEXTPROC)gles2wLoad("glDrawElementsBaseVertexEXT"); + glDrawRangeElementsBaseVertexEXT = (PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC)gles2wLoad("glDrawRangeElementsBaseVertexEXT"); + glDrawElementsInstancedBaseVertexEXT = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC)gles2wLoad("glDrawElementsInstancedBaseVertexEXT"); + glMultiDrawElementsBaseVertexEXT = (PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC)gles2wLoad("glMultiDrawElementsBaseVertexEXT"); +#endif /* defined(GL_EXT_draw_elements_base_vertex) */ + +#if defined(GL_EXT_draw_instanced) + glDrawArraysInstancedEXT = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)gles2wLoad("glDrawArraysInstancedEXT"); + glDrawElementsInstancedEXT = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)gles2wLoad("glDrawElementsInstancedEXT"); +#endif /* defined(GL_EXT_draw_instanced) */ + +#if defined(GL_EXT_draw_transform_feedback) + glDrawTransformFeedbackEXT = (PFNGLDRAWTRANSFORMFEEDBACKEXTPROC)gles2wLoad("glDrawTransformFeedbackEXT"); + glDrawTransformFeedbackInstancedEXT = (PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC)gles2wLoad("glDrawTransformFeedbackInstancedEXT"); +#endif /* defined(GL_EXT_draw_transform_feedback) */ + +#if defined(GL_EXT_external_buffer) + glBufferStorageExternalEXT = (PFNGLBUFFERSTORAGEEXTERNALEXTPROC)gles2wLoad("glBufferStorageExternalEXT"); + glNamedBufferStorageExternalEXT = (PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC)gles2wLoad("glNamedBufferStorageExternalEXT"); +#endif /* defined(GL_EXT_external_buffer) */ + +#if defined(GL_EXT_geometry_shader) + glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)gles2wLoad("glFramebufferTextureEXT"); +#endif /* defined(GL_EXT_geometry_shader) */ + +#if defined(GL_EXT_instanced_arrays) + glVertexAttribDivisorEXT = (PFNGLVERTEXATTRIBDIVISOREXTPROC)gles2wLoad("glVertexAttribDivisorEXT"); +#endif /* defined(GL_EXT_instanced_arrays) */ + +#if defined(GL_EXT_map_buffer_range) + glMapBufferRangeEXT = (PFNGLMAPBUFFERRANGEEXTPROC)gles2wLoad("glMapBufferRangeEXT"); + glFlushMappedBufferRangeEXT = (PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC)gles2wLoad("glFlushMappedBufferRangeEXT"); +#endif /* defined(GL_EXT_map_buffer_range) */ + +#if defined(GL_EXT_memory_object) + glGetUnsignedBytevEXT = (PFNGLGETUNSIGNEDBYTEVEXTPROC)gles2wLoad("glGetUnsignedBytevEXT"); + glGetUnsignedBytei_vEXT = (PFNGLGETUNSIGNEDBYTEI_VEXTPROC)gles2wLoad("glGetUnsignedBytei_vEXT"); + glDeleteMemoryObjectsEXT = (PFNGLDELETEMEMORYOBJECTSEXTPROC)gles2wLoad("glDeleteMemoryObjectsEXT"); + glIsMemoryObjectEXT = (PFNGLISMEMORYOBJECTEXTPROC)gles2wLoad("glIsMemoryObjectEXT"); + glCreateMemoryObjectsEXT = (PFNGLCREATEMEMORYOBJECTSEXTPROC)gles2wLoad("glCreateMemoryObjectsEXT"); + glMemoryObjectParameterivEXT = (PFNGLMEMORYOBJECTPARAMETERIVEXTPROC)gles2wLoad("glMemoryObjectParameterivEXT"); + glGetMemoryObjectParameterivEXT = (PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC)gles2wLoad("glGetMemoryObjectParameterivEXT"); + glTexStorageMem2DEXT = (PFNGLTEXSTORAGEMEM2DEXTPROC)gles2wLoad("glTexStorageMem2DEXT"); + glTexStorageMem2DMultisampleEXT = (PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC)gles2wLoad("glTexStorageMem2DMultisampleEXT"); + glTexStorageMem3DEXT = (PFNGLTEXSTORAGEMEM3DEXTPROC)gles2wLoad("glTexStorageMem3DEXT"); + glTexStorageMem3DMultisampleEXT = (PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC)gles2wLoad("glTexStorageMem3DMultisampleEXT"); + glBufferStorageMemEXT = (PFNGLBUFFERSTORAGEMEMEXTPROC)gles2wLoad("glBufferStorageMemEXT"); + + glTextureStorageMem2DEXT = (PFNGLTEXTURESTORAGEMEM2DEXTPROC)gles2wLoad("glTextureStorageMem2DEXT"); + glTextureStorageMem2DMultisampleEXT = (PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC)gles2wLoad("glTextureStorageMem2DMultisampleEXT"); + glTextureStorageMem3DEXT = (PFNGLTEXTURESTORAGEMEM3DEXTPROC)gles2wLoad("glTextureStorageMem3DEXT"); + glTextureStorageMem3DMultisampleEXT = (PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC)gles2wLoad("glTextureStorageMem3DMultisampleEXT"); + glNamedBufferStorageMemEXT = (PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC)gles2wLoad("glNamedBufferStorageMemEXT"); +#endif /* defined(GL_EXT_memory_object) */ + +#if defined(GL_EXT_memory_object_fd) + glImportMemoryFdEXT = (PFNGLIMPORTMEMORYFDEXTPROC)gles2wLoad("glImportMemoryFdEXT"); +#endif /* defined(GL_EXT_memory_object_fd) */ + +#if defined(GL_EXT_memory_object_win32) + glImportMemoryWin32HandleEXT = (PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC)gles2wLoad("glImportMemoryWin32HandleEXT"); + glImportMemoryWin32NameEXT = (PFNGLIMPORTMEMORYWIN32NAMEEXTPROC)gles2wLoad("glImportMemoryWin32NameEXT"); +#endif /* defined(GL_EXT_memory_object_win32) */ + +#if defined(GL_EXT_multi_draw_arrays) + glMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC)gles2wLoad("glMultiDrawArraysEXT"); + glMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC)gles2wLoad("glMultiDrawElementsEXT"); +#endif /* defined(GL_EXT_multi_draw_arrays) */ + +#if defined(GL_EXT_multi_draw_indirect) + glMultiDrawArraysIndirectEXT = (PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC)gles2wLoad("glMultiDrawArraysIndirectEXT"); + glMultiDrawElementsIndirectEXT = (PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC)gles2wLoad("glMultiDrawElementsIndirectEXT"); +#endif /* defined(GL_EXT_multi_draw_indirect) */ + +#if defined(GL_EXT_multisampled_render_to_texture) + glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)gles2wLoad("glRenderbufferStorageMultisampleEXT"); + glFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)gles2wLoad("glFramebufferTexture2DMultisampleEXT"); +#endif /* defined(GL_EXT_multisampled_render_to_texture) */ + +#if defined(GL_EXT_multiview_draw_buffers) + glReadBufferIndexedEXT = (PFNGLREADBUFFERINDEXEDEXTPROC)gles2wLoad("glReadBufferIndexedEXT"); + glDrawBuffersIndexedEXT = (PFNGLDRAWBUFFERSINDEXEDEXTPROC)gles2wLoad("glDrawBuffersIndexedEXT"); + glGetIntegeri_vEXT = (PFNGLGETINTEGERI_VEXTPROC)gles2wLoad("glGetIntegeri_vEXT"); +#endif /* defined(GL_EXT_multiview_draw_buffers) */ + +#if defined(GL_EXT_polygon_offset_clamp) + glPolygonOffsetClampEXT = (PFNGLPOLYGONOFFSETCLAMPEXTPROC)gles2wLoad("glPolygonOffsetClampEXT"); +#endif /* defined(GL_EXT_polygon_offset_clamp) */ + +#if defined(GL_EXT_primitive_bounding_box) + glPrimitiveBoundingBoxEXT = (PFNGLPRIMITIVEBOUNDINGBOXEXTPROC)gles2wLoad("glPrimitiveBoundingBoxEXT"); +#endif /* defined(GL_EXT_primitive_bounding_box) */ + +#if defined(GL_EXT_raster_multisample) + glRasterSamplesEXT = (PFNGLRASTERSAMPLESEXTPROC)gles2wLoad("glRasterSamplesEXT"); +#endif /* defined(GL_EXT_raster_multisample) */ + +#if defined(GL_EXT_robustness) + glGetGraphicsResetStatusEXT = (PFNGLGETGRAPHICSRESETSTATUSEXTPROC)gles2wLoad("glGetGraphicsResetStatusEXT"); + glReadnPixelsEXT = (PFNGLREADNPIXELSEXTPROC)gles2wLoad("glReadnPixelsEXT"); + glGetnUniformfvEXT = (PFNGLGETNUNIFORMFVEXTPROC)gles2wLoad("glGetnUniformfvEXT"); + glGetnUniformivEXT = (PFNGLGETNUNIFORMIVEXTPROC)gles2wLoad("glGetnUniformivEXT"); +#endif /* defined(GL_EXT_robustness) */ + +#if defined(GL_EXT_semaphore) + glGenSemaphoresEXT = (PFNGLGENSEMAPHORESEXTPROC)gles2wLoad("glGenSemaphoresEXT"); + glDeleteSemaphoresEXT = (PFNGLDELETESEMAPHORESEXTPROC)gles2wLoad("glDeleteSemaphoresEXT"); + glIsSemaphoreEXT = (PFNGLISSEMAPHOREEXTPROC)gles2wLoad("glIsSemaphoreEXT"); + glSemaphoreParameterui64vEXT = (PFNGLSEMAPHOREPARAMETERUI64VEXTPROC)gles2wLoad("glSemaphoreParameterui64vEXT"); + glGetSemaphoreParameterui64vEXT = (PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC)gles2wLoad("glGetSemaphoreParameterui64vEXT"); + glWaitSemaphoreEXT = (PFNGLWAITSEMAPHOREEXTPROC)gles2wLoad("glWaitSemaphoreEXT"); + glSignalSemaphoreEXT = (PFNGLSIGNALSEMAPHOREEXTPROC)gles2wLoad("glSignalSemaphoreEXT"); +#endif /* defined(GL_EXT_semaphore) */ + +#if defined(GL_EXT_semaphore_fd) + glImportSemaphoreFdEXT = (PFNGLIMPORTSEMAPHOREFDEXTPROC)gles2wLoad("glImportSemaphoreFdEXT"); +#endif /* defined(GL_EXT_semaphore_fd) */ + +#if defined(GL_EXT_semaphore_win32) + glImportSemaphoreWin32HandleEXT = (PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC)gles2wLoad("glImportSemaphoreWin32HandleEXT"); + glImportSemaphoreWin32NameEXT = (PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC)gles2wLoad("glImportSemaphoreWin32NameEXT"); +#endif /* defined(GL_EXT_semaphore_win32) */ + +#if defined(GL_EXT_separate_shader_objects) + glActiveShaderProgramEXT = (PFNGLACTIVESHADERPROGRAMEXTPROC)gles2wLoad("glActiveShaderProgramEXT"); + glBindProgramPipelineEXT = (PFNGLBINDPROGRAMPIPELINEEXTPROC)gles2wLoad("glBindProgramPipelineEXT"); + glCreateShaderProgramvEXT = (PFNGLCREATESHADERPROGRAMVEXTPROC)gles2wLoad("glCreateShaderProgramvEXT"); + glDeleteProgramPipelinesEXT = (PFNGLDELETEPROGRAMPIPELINESEXTPROC)gles2wLoad("glDeleteProgramPipelinesEXT"); + glGenProgramPipelinesEXT = (PFNGLGENPROGRAMPIPELINESEXTPROC)gles2wLoad("glGenProgramPipelinesEXT"); + glGetProgramPipelineInfoLogEXT = (PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC)gles2wLoad("glGetProgramPipelineInfoLogEXT"); + glGetProgramPipelineivEXT = (PFNGLGETPROGRAMPIPELINEIVEXTPROC)gles2wLoad("glGetProgramPipelineivEXT"); + glIsProgramPipelineEXT = (PFNGLISPROGRAMPIPELINEEXTPROC)gles2wLoad("glIsProgramPipelineEXT"); + glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)gles2wLoad("glProgramParameteriEXT"); + glProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC)gles2wLoad("glProgramUniform1fEXT"); + glProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC)gles2wLoad("glProgramUniform1fvEXT"); + glProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC)gles2wLoad("glProgramUniform1iEXT"); + glProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC)gles2wLoad("glProgramUniform1ivEXT"); + glProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC)gles2wLoad("glProgramUniform2fEXT"); + glProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC)gles2wLoad("glProgramUniform2fvEXT"); + glProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC)gles2wLoad("glProgramUniform2iEXT"); + glProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC)gles2wLoad("glProgramUniform2ivEXT"); + glProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC)gles2wLoad("glProgramUniform3fEXT"); + glProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC)gles2wLoad("glProgramUniform3fvEXT"); + glProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC)gles2wLoad("glProgramUniform3iEXT"); + glProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC)gles2wLoad("glProgramUniform3ivEXT"); + glProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC)gles2wLoad("glProgramUniform4fEXT"); + glProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC)gles2wLoad("glProgramUniform4fvEXT"); + glProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC)gles2wLoad("glProgramUniform4iEXT"); + glProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC)gles2wLoad("glProgramUniform4ivEXT"); + glProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)gles2wLoad("glProgramUniformMatrix2fvEXT"); + glProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)gles2wLoad("glProgramUniformMatrix3fvEXT"); + glProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)gles2wLoad("glProgramUniformMatrix4fvEXT"); + glUseProgramStagesEXT = (PFNGLUSEPROGRAMSTAGESEXTPROC)gles2wLoad("glUseProgramStagesEXT"); + glValidateProgramPipelineEXT = (PFNGLVALIDATEPROGRAMPIPELINEEXTPROC)gles2wLoad("glValidateProgramPipelineEXT"); + + glProgramUniform1uiEXT = (PFNGLPROGRAMUNIFORM1UIEXTPROC)gles2wLoad("glProgramUniform1uiEXT"); + glProgramUniform2uiEXT = (PFNGLPROGRAMUNIFORM2UIEXTPROC)gles2wLoad("glProgramUniform2uiEXT"); + glProgramUniform3uiEXT = (PFNGLPROGRAMUNIFORM3UIEXTPROC)gles2wLoad("glProgramUniform3uiEXT"); + glProgramUniform4uiEXT = (PFNGLPROGRAMUNIFORM4UIEXTPROC)gles2wLoad("glProgramUniform4uiEXT"); + glProgramUniform1uivEXT = (PFNGLPROGRAMUNIFORM1UIVEXTPROC)gles2wLoad("glProgramUniform1uivEXT"); + glProgramUniform2uivEXT = (PFNGLPROGRAMUNIFORM2UIVEXTPROC)gles2wLoad("glProgramUniform2uivEXT"); + glProgramUniform3uivEXT = (PFNGLPROGRAMUNIFORM3UIVEXTPROC)gles2wLoad("glProgramUniform3uivEXT"); + glProgramUniform4uivEXT = (PFNGLPROGRAMUNIFORM4UIVEXTPROC)gles2wLoad("glProgramUniform4uivEXT"); + glProgramUniformMatrix2x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC)gles2wLoad("glProgramUniformMatrix2x3fvEXT"); + glProgramUniformMatrix3x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC)gles2wLoad("glProgramUniformMatrix3x2fvEXT"); + glProgramUniformMatrix2x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC)gles2wLoad("glProgramUniformMatrix2x4fvEXT"); + glProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC)gles2wLoad("glProgramUniformMatrix4x2fvEXT"); + glProgramUniformMatrix3x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC)gles2wLoad("glProgramUniformMatrix3x4fvEXT"); + glProgramUniformMatrix4x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC)gles2wLoad("glProgramUniformMatrix4x3fvEXT"); +#endif /* defined(GL_EXT_separate_shader_objects) */ + +#if defined(GL_EXT_shader_framebuffer_fetch_non_coherent) + glFramebufferFetchBarrierEXT = (PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC)gles2wLoad("glFramebufferFetchBarrierEXT"); +#endif /* defined(GL_EXT_shader_framebuffer_fetch_non_coherent) */ + +#if defined(GL_EXT_shader_pixel_local_storage2) + glFramebufferPixelLocalStorageSizeEXT = (PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC)gles2wLoad("glFramebufferPixelLocalStorageSizeEXT"); + glGetFramebufferPixelLocalStorageSizeEXT = (PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC)gles2wLoad("glGetFramebufferPixelLocalStorageSizeEXT"); + glClearPixelLocalStorageuiEXT = (PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC)gles2wLoad("glClearPixelLocalStorageuiEXT"); +#endif /* defined(GL_EXT_shader_pixel_local_storage2) */ + +#if defined(GL_EXT_sparse_texture) + glTexPageCommitmentEXT = (PFNGLTEXPAGECOMMITMENTEXTPROC)gles2wLoad("glTexPageCommitmentEXT"); +#endif /* defined(GL_EXT_sparse_texture) */ + +#if defined(GL_EXT_tessellation_shader) + glPatchParameteriEXT = (PFNGLPATCHPARAMETERIEXTPROC)gles2wLoad("glPatchParameteriEXT"); +#endif /* defined(GL_EXT_tessellation_shader) */ + +#if defined(GL_EXT_texture_border_clamp) + glTexParameterIivEXT = (PFNGLTEXPARAMETERIIVEXTPROC)gles2wLoad("glTexParameterIivEXT"); + glTexParameterIuivEXT = (PFNGLTEXPARAMETERIUIVEXTPROC)gles2wLoad("glTexParameterIuivEXT"); + glGetTexParameterIivEXT = (PFNGLGETTEXPARAMETERIIVEXTPROC)gles2wLoad("glGetTexParameterIivEXT"); + glGetTexParameterIuivEXT = (PFNGLGETTEXPARAMETERIUIVEXTPROC)gles2wLoad("glGetTexParameterIuivEXT"); + glSamplerParameterIivEXT = (PFNGLSAMPLERPARAMETERIIVEXTPROC)gles2wLoad("glSamplerParameterIivEXT"); + glSamplerParameterIuivEXT = (PFNGLSAMPLERPARAMETERIUIVEXTPROC)gles2wLoad("glSamplerParameterIuivEXT"); + glGetSamplerParameterIivEXT = (PFNGLGETSAMPLERPARAMETERIIVEXTPROC)gles2wLoad("glGetSamplerParameterIivEXT"); + glGetSamplerParameterIuivEXT = (PFNGLGETSAMPLERPARAMETERIUIVEXTPROC)gles2wLoad("glGetSamplerParameterIuivEXT"); +#endif /* defined(GL_EXT_texture_border_clamp) */ + +#if defined(GL_EXT_texture_buffer) + glTexBufferEXT = (PFNGLTEXBUFFEREXTPROC)gles2wLoad("glTexBufferEXT"); + glTexBufferRangeEXT = (PFNGLTEXBUFFERRANGEEXTPROC)gles2wLoad("glTexBufferRangeEXT"); +#endif /* defined(GL_EXT_texture_buffer) */ + +#if defined(GL_EXT_texture_storage) + glTexStorage1DEXT = (PFNGLTEXSTORAGE1DEXTPROC)gles2wLoad("glTexStorage1DEXT"); + glTexStorage2DEXT = (PFNGLTEXSTORAGE2DEXTPROC)gles2wLoad("glTexStorage2DEXT"); + glTexStorage3DEXT = (PFNGLTEXSTORAGE3DEXTPROC)gles2wLoad("glTexStorage3DEXT"); + + glTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)gles2wLoad("glTextureStorage1DEXT"); + glTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)gles2wLoad("glTextureStorage2DEXT"); + glTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)gles2wLoad("glTextureStorage3DEXT"); +#endif /* defined(GL_EXT_texture_storage) */ + +#if defined(GL_EXT_texture_view) + glTextureViewEXT = (PFNGLTEXTUREVIEWEXTPROC)gles2wLoad("glTextureViewEXT"); +#endif /* defined(GL_EXT_texture_view) */ + +#if defined(GL_NV_timeline_semaphore) + glCreateSemaphoresNV = (PFNGLCREATESEMAPHORESNVPROC)gles2wLoad("glCreateSemaphoresNV"); + glSemaphoreParameterivNV = (PFNGLSEMAPHOREPARAMETERIVNVPROC)gles2wLoad("glSemaphoreParameterivNV"); + glGetSemaphoreParameterivNV = (PFNGLGETSEMAPHOREPARAMETERIVNVPROC)gles2wLoad("glGetSemaphoreParameterivNV"); +#endif /* defined(GL_NV_timeline_semaphore) */ + +#if defined(GL_EXT_win32_keyed_mutex) + glAcquireKeyedMutexWin32EXT = (PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC)gles2wLoad("glAcquireKeyedMutexWin32EXT"); + glReleaseKeyedMutexWin32EXT = (PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC)gles2wLoad("glReleaseKeyedMutexWin32EXT"); +#endif /* defined(GL_EXT_win32_keyed_mutex) */ + +#if defined(GL_EXT_window_rectangles) + glWindowRectanglesEXT = (PFNGLWINDOWRECTANGLESEXTPROC)gles2wLoad("glWindowRectanglesEXT"); +#endif /* defined(GL_EXT_window_rectangles) */ + +#if defined(GL_IMG_bindless_texture) + glGetTextureHandleIMG = (PFNGLGETTEXTUREHANDLEIMGPROC)gles2wLoad("glGetTextureHandleIMG"); + glGetTextureSamplerHandleIMG = (PFNGLGETTEXTURESAMPLERHANDLEIMGPROC)gles2wLoad("glGetTextureSamplerHandleIMG"); + glUniformHandleui64IMG = (PFNGLUNIFORMHANDLEUI64IMGPROC)gles2wLoad("glUniformHandleui64IMG"); + glUniformHandleui64vIMG = (PFNGLUNIFORMHANDLEUI64VIMGPROC)gles2wLoad("glUniformHandleui64vIMG"); + glProgramUniformHandleui64IMG = (PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC)gles2wLoad("glProgramUniformHandleui64IMG"); + glProgramUniformHandleui64vIMG = (PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC)gles2wLoad("glProgramUniformHandleui64vIMG"); +#endif /* defined(GL_IMG_bindless_texture) */ + +#if defined(GL_IMG_framebuffer_downsample) + glFramebufferTexture2DDownsampleIMG = (PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC)gles2wLoad("glFramebufferTexture2DDownsampleIMG"); + glFramebufferTextureLayerDownsampleIMG = (PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC)gles2wLoad("glFramebufferTextureLayerDownsampleIMG"); +#endif /* defined(GL_IMG_framebuffer_downsample) */ + +#if defined(GL_IMG_multisampled_render_to_texture) + glRenderbufferStorageMultisampleIMG = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC)gles2wLoad("glRenderbufferStorageMultisampleIMG"); + glFramebufferTexture2DMultisampleIMG = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC)gles2wLoad("glFramebufferTexture2DMultisampleIMG"); +#endif /* defined(GL_IMG_multisampled_render_to_texture) */ + +#if defined(GL_INTEL_framebuffer_CMAA) + glApplyFramebufferAttachmentCMAAINTEL = (PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC)gles2wLoad("glApplyFramebufferAttachmentCMAAINTEL"); +#endif /* defined(GL_INTEL_framebuffer_CMAA) */ + +#if defined(GL_INTEL_performance_query) + glBeginPerfQueryINTEL = (PFNGLBEGINPERFQUERYINTELPROC)gles2wLoad("glBeginPerfQueryINTEL"); + glCreatePerfQueryINTEL = (PFNGLCREATEPERFQUERYINTELPROC)gles2wLoad("glCreatePerfQueryINTEL"); + glDeletePerfQueryINTEL = (PFNGLDELETEPERFQUERYINTELPROC)gles2wLoad("glDeletePerfQueryINTEL"); + glEndPerfQueryINTEL = (PFNGLENDPERFQUERYINTELPROC)gles2wLoad("glEndPerfQueryINTEL"); + glGetFirstPerfQueryIdINTEL = (PFNGLGETFIRSTPERFQUERYIDINTELPROC)gles2wLoad("glGetFirstPerfQueryIdINTEL"); + glGetNextPerfQueryIdINTEL = (PFNGLGETNEXTPERFQUERYIDINTELPROC)gles2wLoad("glGetNextPerfQueryIdINTEL"); + glGetPerfCounterInfoINTEL = (PFNGLGETPERFCOUNTERINFOINTELPROC)gles2wLoad("glGetPerfCounterInfoINTEL"); + glGetPerfQueryDataINTEL = (PFNGLGETPERFQUERYDATAINTELPROC)gles2wLoad("glGetPerfQueryDataINTEL"); + glGetPerfQueryIdByNameINTEL = (PFNGLGETPERFQUERYIDBYNAMEINTELPROC)gles2wLoad("glGetPerfQueryIdByNameINTEL"); + glGetPerfQueryInfoINTEL = (PFNGLGETPERFQUERYINFOINTELPROC)gles2wLoad("glGetPerfQueryInfoINTEL"); +#endif /* defined(GL_INTEL_performance_query) */ + +#if defined(GL_KHR_blend_equation_advanced) + glBlendBarrierKHR = (PFNGLBLENDBARRIERKHRPROC)gles2wLoad("glBlendBarrierKHR"); +#endif /* defined(GL_KHR_blend_equation_advanced) */ + +#if defined(GL_KHR_debug) + glDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC)gles2wLoad("glDebugMessageControlKHR"); + glDebugMessageInsertKHR = (PFNGLDEBUGMESSAGEINSERTKHRPROC)gles2wLoad("glDebugMessageInsertKHR"); + glDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)gles2wLoad("glDebugMessageCallbackKHR"); + glGetDebugMessageLogKHR = (PFNGLGETDEBUGMESSAGELOGKHRPROC)gles2wLoad("glGetDebugMessageLogKHR"); + glPushDebugGroupKHR = (PFNGLPUSHDEBUGGROUPKHRPROC)gles2wLoad("glPushDebugGroupKHR"); + glPopDebugGroupKHR = (PFNGLPOPDEBUGGROUPKHRPROC)gles2wLoad("glPopDebugGroupKHR"); + glObjectLabelKHR = (PFNGLOBJECTLABELKHRPROC)gles2wLoad("glObjectLabelKHR"); + glGetObjectLabelKHR = (PFNGLGETOBJECTLABELKHRPROC)gles2wLoad("glGetObjectLabelKHR"); + glObjectPtrLabelKHR = (PFNGLOBJECTPTRLABELKHRPROC)gles2wLoad("glObjectPtrLabelKHR"); + glGetObjectPtrLabelKHR = (PFNGLGETOBJECTPTRLABELKHRPROC)gles2wLoad("glGetObjectPtrLabelKHR"); + glGetPointervKHR = (PFNGLGETPOINTERVKHRPROC)gles2wLoad("glGetPointervKHR"); +#endif /* defined(GL_KHR_debug) */ + +#if defined(GL_KHR_robustness) + glGetGraphicsResetStatusKHR = (PFNGLGETGRAPHICSRESETSTATUSKHRPROC)gles2wLoad("glGetGraphicsResetStatusKHR"); + glReadnPixelsKHR = (PFNGLREADNPIXELSKHRPROC)gles2wLoad("glReadnPixelsKHR"); + glGetnUniformfvKHR = (PFNGLGETNUNIFORMFVKHRPROC)gles2wLoad("glGetnUniformfvKHR"); + glGetnUniformivKHR = (PFNGLGETNUNIFORMIVKHRPROC)gles2wLoad("glGetnUniformivKHR"); + glGetnUniformuivKHR = (PFNGLGETNUNIFORMUIVKHRPROC)gles2wLoad("glGetnUniformuivKHR"); +#endif /* defined(GL_KHR_robustness) */ + +#if defined(GL_KHR_parallel_shader_compile) + glMaxShaderCompilerThreadsKHR = (PFNGLMAXSHADERCOMPILERTHREADSKHRPROC)gles2wLoad("glMaxShaderCompilerThreadsKHR"); +#endif /* defined(GL_KHR_parallel_shader_compile) */ + +#if defined(GL_MESA_framebuffer_flip_y) + glFramebufferParameteriMESA = (PFNGLFRAMEBUFFERPARAMETERIMESAPROC)gles2wLoad("glFramebufferParameteriMESA"); + glGetFramebufferParameterivMESA = (PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC)gles2wLoad("glGetFramebufferParameterivMESA"); +#endif /* defined(GL_MESA_framebuffer_flip_y) */ + +#if defined(GL_NV_bindless_texture) + glGetTextureHandleNV = (PFNGLGETTEXTUREHANDLENVPROC)gles2wLoad("glGetTextureHandleNV"); + glGetTextureSamplerHandleNV = (PFNGLGETTEXTURESAMPLERHANDLENVPROC)gles2wLoad("glGetTextureSamplerHandleNV"); + glMakeTextureHandleResidentNV = (PFNGLMAKETEXTUREHANDLERESIDENTNVPROC)gles2wLoad("glMakeTextureHandleResidentNV"); + glMakeTextureHandleNonResidentNV = (PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC)gles2wLoad("glMakeTextureHandleNonResidentNV"); + glGetImageHandleNV = (PFNGLGETIMAGEHANDLENVPROC)gles2wLoad("glGetImageHandleNV"); + glMakeImageHandleResidentNV = (PFNGLMAKEIMAGEHANDLERESIDENTNVPROC)gles2wLoad("glMakeImageHandleResidentNV"); + glMakeImageHandleNonResidentNV = (PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC)gles2wLoad("glMakeImageHandleNonResidentNV"); + glUniformHandleui64NV = (PFNGLUNIFORMHANDLEUI64NVPROC)gles2wLoad("glUniformHandleui64NV"); + glUniformHandleui64vNV = (PFNGLUNIFORMHANDLEUI64VNVPROC)gles2wLoad("glUniformHandleui64vNV"); + glProgramUniformHandleui64NV = (PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC)gles2wLoad("glProgramUniformHandleui64NV"); + glProgramUniformHandleui64vNV = (PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC)gles2wLoad("glProgramUniformHandleui64vNV"); + glIsTextureHandleResidentNV = (PFNGLISTEXTUREHANDLERESIDENTNVPROC)gles2wLoad("glIsTextureHandleResidentNV"); + glIsImageHandleResidentNV = (PFNGLISIMAGEHANDLERESIDENTNVPROC)gles2wLoad("glIsImageHandleResidentNV"); +#endif /* defined(GL_NV_bindless_texture) */ + +#if defined(GL_NV_blend_equation_advanced) + glBlendParameteriNV = (PFNGLBLENDPARAMETERINVPROC)gles2wLoad("glBlendParameteriNV"); + glBlendBarrierNV = (PFNGLBLENDBARRIERNVPROC)gles2wLoad("glBlendBarrierNV"); +#endif /* defined(GL_NV_blend_equation_advanced) */ + +#if defined(GL_NV_clip_space_w_scaling) + glViewportPositionWScaleNV = (PFNGLVIEWPORTPOSITIONWSCALENVPROC)gles2wLoad("glViewportPositionWScaleNV"); +#endif /* defined(GL_NV_clip_space_w_scaling) */ + +#if defined(GL_NV_conditional_render) + glBeginConditionalRenderNV = (PFNGLBEGINCONDITIONALRENDERNVPROC)gles2wLoad("glBeginConditionalRenderNV"); + glEndConditionalRenderNV = (PFNGLENDCONDITIONALRENDERNVPROC)gles2wLoad("glEndConditionalRenderNV"); +#endif /* defined(GL_NV_conditional_render) */ + +#if defined(GL_NV_conservative_raster) + glSubpixelPrecisionBiasNV = (PFNGLSUBPIXELPRECISIONBIASNVPROC)gles2wLoad("glSubpixelPrecisionBiasNV"); +#endif /* defined(GL_NV_conservative_raster) */ + +#if defined(GL_NV_conservative_raster_pre_snap_triangles) + glConservativeRasterParameteriNV = (PFNGLCONSERVATIVERASTERPARAMETERINVPROC)gles2wLoad("glConservativeRasterParameteriNV"); +#endif /* defined(GL_NV_conservative_raster_pre_snap_triangles) */ + +#if defined(GL_NV_copy_buffer) + glCopyBufferSubDataNV = (PFNGLCOPYBUFFERSUBDATANVPROC)gles2wLoad("glCopyBufferSubDataNV"); +#endif /* defined(GL_NV_copy_buffer) */ + +#if defined(GL_NV_coverage_sample) + glCoverageMaskNV = (PFNGLCOVERAGEMASKNVPROC)gles2wLoad("glCoverageMaskNV"); + glCoverageOperationNV = (PFNGLCOVERAGEOPERATIONNVPROC)gles2wLoad("glCoverageOperationNV"); +#endif /* defined(GL_NV_coverage_sample) */ + +#if defined(GL_NV_draw_buffers) + glDrawBuffersNV = (PFNGLDRAWBUFFERSNVPROC)gles2wLoad("glDrawBuffersNV"); +#endif /* defined(GL_NV_draw_buffers) */ + +#if defined(GL_NV_draw_instanced) + glDrawArraysInstancedNV = (PFNGLDRAWARRAYSINSTANCEDNVPROC)gles2wLoad("glDrawArraysInstancedNV"); + glDrawElementsInstancedNV = (PFNGLDRAWELEMENTSINSTANCEDNVPROC)gles2wLoad("glDrawElementsInstancedNV"); +#endif /* defined(GL_NV_draw_instanced) */ + +#if defined(GL_NV_draw_vulkan_image) + glDrawVkImageNV = (PFNGLDRAWVKIMAGENVPROC)gles2wLoad("glDrawVkImageNV"); + glGetVkProcAddrNV = (PFNGLGETVKPROCADDRNVPROC)gles2wLoad("glGetVkProcAddrNV"); + glWaitVkSemaphoreNV = (PFNGLWAITVKSEMAPHORENVPROC)gles2wLoad("glWaitVkSemaphoreNV"); + glSignalVkSemaphoreNV = (PFNGLSIGNALVKSEMAPHORENVPROC)gles2wLoad("glSignalVkSemaphoreNV"); + glSignalVkFenceNV = (PFNGLSIGNALVKFENCENVPROC)gles2wLoad("glSignalVkFenceNV"); +#endif /* defined(GL_NV_draw_vulkan_image) */ + +#if defined(GL_NV_fence) + glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)gles2wLoad("glDeleteFencesNV"); + glGenFencesNV = (PFNGLGENFENCESNVPROC)gles2wLoad("glGenFencesNV"); + glIsFenceNV = (PFNGLISFENCENVPROC)gles2wLoad("glIsFenceNV"); + glTestFenceNV = (PFNGLTESTFENCENVPROC)gles2wLoad("glTestFenceNV"); + glGetFenceivNV = (PFNGLGETFENCEIVNVPROC)gles2wLoad("glGetFenceivNV"); + glFinishFenceNV = (PFNGLFINISHFENCENVPROC)gles2wLoad("glFinishFenceNV"); + glSetFenceNV = (PFNGLSETFENCENVPROC)gles2wLoad("glSetFenceNV"); +#endif /* defined(GL_NV_fence) */ + +#if defined(GL_NV_fragment_coverage_to_color) + glFragmentCoverageColorNV = (PFNGLFRAGMENTCOVERAGECOLORNVPROC)gles2wLoad("glFragmentCoverageColorNV"); +#endif /* defined(GL_NV_fragment_coverage_to_color) */ + +#if defined(GL_NV_framebuffer_blit) + glBlitFramebufferNV = (PFNGLBLITFRAMEBUFFERNVPROC)gles2wLoad("glBlitFramebufferNV"); +#endif /* defined(GL_NV_framebuffer_blit) */ + +#if defined(GL_NV_framebuffer_mixed_samples) + glCoverageModulationTableNV = (PFNGLCOVERAGEMODULATIONTABLENVPROC)gles2wLoad("glCoverageModulationTableNV"); + glGetCoverageModulationTableNV = (PFNGLGETCOVERAGEMODULATIONTABLENVPROC)gles2wLoad("glGetCoverageModulationTableNV"); + glCoverageModulationNV = (PFNGLCOVERAGEMODULATIONNVPROC)gles2wLoad("glCoverageModulationNV"); +#endif /* defined(GL_NV_framebuffer_mixed_samples) */ + +#if defined(GL_NV_framebuffer_multisample) + glRenderbufferStorageMultisampleNV = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC)gles2wLoad("glRenderbufferStorageMultisampleNV"); +#endif /* defined(GL_NV_framebuffer_multisample) */ + +#if defined(GL_NV_gpu_shader5) + glUniform1i64NV = (PFNGLUNIFORM1I64NVPROC)gles2wLoad("glUniform1i64NV"); + glUniform2i64NV = (PFNGLUNIFORM2I64NVPROC)gles2wLoad("glUniform2i64NV"); + glUniform3i64NV = (PFNGLUNIFORM3I64NVPROC)gles2wLoad("glUniform3i64NV"); + glUniform4i64NV = (PFNGLUNIFORM4I64NVPROC)gles2wLoad("glUniform4i64NV"); + glUniform1i64vNV = (PFNGLUNIFORM1I64VNVPROC)gles2wLoad("glUniform1i64vNV"); + glUniform2i64vNV = (PFNGLUNIFORM2I64VNVPROC)gles2wLoad("glUniform2i64vNV"); + glUniform3i64vNV = (PFNGLUNIFORM3I64VNVPROC)gles2wLoad("glUniform3i64vNV"); + glUniform4i64vNV = (PFNGLUNIFORM4I64VNVPROC)gles2wLoad("glUniform4i64vNV"); + glUniform1ui64NV = (PFNGLUNIFORM1UI64NVPROC)gles2wLoad("glUniform1ui64NV"); + glUniform2ui64NV = (PFNGLUNIFORM2UI64NVPROC)gles2wLoad("glUniform2ui64NV"); + glUniform3ui64NV = (PFNGLUNIFORM3UI64NVPROC)gles2wLoad("glUniform3ui64NV"); + glUniform4ui64NV = (PFNGLUNIFORM4UI64NVPROC)gles2wLoad("glUniform4ui64NV"); + glUniform1ui64vNV = (PFNGLUNIFORM1UI64VNVPROC)gles2wLoad("glUniform1ui64vNV"); + glUniform2ui64vNV = (PFNGLUNIFORM2UI64VNVPROC)gles2wLoad("glUniform2ui64vNV"); + glUniform3ui64vNV = (PFNGLUNIFORM3UI64VNVPROC)gles2wLoad("glUniform3ui64vNV"); + glUniform4ui64vNV = (PFNGLUNIFORM4UI64VNVPROC)gles2wLoad("glUniform4ui64vNV"); + glGetUniformi64vNV = (PFNGLGETUNIFORMI64VNVPROC)gles2wLoad("glGetUniformi64vNV"); + + glProgramUniform1i64NV = (PFNGLPROGRAMUNIFORM1I64NVPROC)gles2wLoad("glProgramUniform1i64NV"); + glProgramUniform2i64NV = (PFNGLPROGRAMUNIFORM2I64NVPROC)gles2wLoad("glProgramUniform2i64NV"); + glProgramUniform3i64NV = (PFNGLPROGRAMUNIFORM3I64NVPROC)gles2wLoad("glProgramUniform3i64NV"); + glProgramUniform4i64NV = (PFNGLPROGRAMUNIFORM4I64NVPROC)gles2wLoad("glProgramUniform4i64NV"); + glProgramUniform1i64vNV = (PFNGLPROGRAMUNIFORM1I64VNVPROC)gles2wLoad("glProgramUniform1i64vNV"); + glProgramUniform2i64vNV = (PFNGLPROGRAMUNIFORM2I64VNVPROC)gles2wLoad("glProgramUniform2i64vNV"); + glProgramUniform3i64vNV = (PFNGLPROGRAMUNIFORM3I64VNVPROC)gles2wLoad("glProgramUniform3i64vNV"); + glProgramUniform4i64vNV = (PFNGLPROGRAMUNIFORM4I64VNVPROC)gles2wLoad("glProgramUniform4i64vNV"); + glProgramUniform1ui64NV = (PFNGLPROGRAMUNIFORM1UI64NVPROC)gles2wLoad("glProgramUniform1ui64NV"); + glProgramUniform2ui64NV = (PFNGLPROGRAMUNIFORM2UI64NVPROC)gles2wLoad("glProgramUniform2ui64NV"); + glProgramUniform3ui64NV = (PFNGLPROGRAMUNIFORM3UI64NVPROC)gles2wLoad("glProgramUniform3ui64NV"); + glProgramUniform4ui64NV = (PFNGLPROGRAMUNIFORM4UI64NVPROC)gles2wLoad("glProgramUniform4ui64NV"); + glProgramUniform1ui64vNV = (PFNGLPROGRAMUNIFORM1UI64VNVPROC)gles2wLoad("glProgramUniform1ui64vNV"); + glProgramUniform2ui64vNV = (PFNGLPROGRAMUNIFORM2UI64VNVPROC)gles2wLoad("glProgramUniform2ui64vNV"); + glProgramUniform3ui64vNV = (PFNGLPROGRAMUNIFORM3UI64VNVPROC)gles2wLoad("glProgramUniform3ui64vNV"); + glProgramUniform4ui64vNV = (PFNGLPROGRAMUNIFORM4UI64VNVPROC)gles2wLoad("glProgramUniform4ui64vNV"); +#endif /* defined(GL_NV_gpu_shader5) */ + +#if defined(GL_NV_instanced_arrays) + glVertexAttribDivisorNV = (PFNGLVERTEXATTRIBDIVISORNVPROC)gles2wLoad("glVertexAttribDivisorNV"); +#endif /* defined(GL_NV_instanced_arrays) */ + +#if defined(GL_NV_internalformat_sample_query) + glGetInternalformatSampleivNV = (PFNGLGETINTERNALFORMATSAMPLEIVNVPROC)gles2wLoad("glGetInternalformatSampleivNV"); +#endif /* defined(GL_NV_internalformat_sample_query) */ + +#if defined(GL_NV_memory_attachment) + glGetMemoryObjectDetachedResourcesuivNV = (PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC)gles2wLoad("glGetMemoryObjectDetachedResourcesuivNV"); + glResetMemoryObjectParameterNV = (PFNGLRESETMEMORYOBJECTPARAMETERNVPROC)gles2wLoad("glResetMemoryObjectParameterNV"); + glTexAttachMemoryNV = (PFNGLTEXATTACHMEMORYNVPROC)gles2wLoad("glTexAttachMemoryNV"); + glBufferAttachMemoryNV = (PFNGLBUFFERATTACHMEMORYNVPROC)gles2wLoad("glBufferAttachMemoryNV"); + + glTextureAttachMemoryNV = (PFNGLTEXTUREATTACHMEMORYNVPROC)gles2wLoad("glTextureAttachMemoryNV"); + glNamedBufferAttachMemoryNV = (PFNGLNAMEDBUFFERATTACHMEMORYNVPROC)gles2wLoad("glNamedBufferAttachMemoryNV"); +#endif /* defined(GL_NV_memory_attachment) */ + +#if defined(GL_NV_memory_object_sparse) + glBufferPageCommitmentMemNV = (PFNGLBUFFERPAGECOMMITMENTMEMNVPROC)gles2wLoad("glBufferPageCommitmentMemNV"); + glTexPageCommitmentMemNV = (PFNGLTEXPAGECOMMITMENTMEMNVPROC)gles2wLoad("glTexPageCommitmentMemNV"); + + glNamedBufferPageCommitmentMemNV = (PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC)gles2wLoad("glNamedBufferPageCommitmentMemNV"); + glTexturePageCommitmentMemNV = (PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC)gles2wLoad("glTexturePageCommitmentMemNV"); +#endif /* defined(GL_NV_memory_object_sparse) */ + +#if defined(GL_NV_mesh_shader) + glDrawMeshTasksNV = (PFNGLDRAWMESHTASKSNVPROC)gles2wLoad("glDrawMeshTasksNV"); + glDrawMeshTasksIndirectNV = (PFNGLDRAWMESHTASKSINDIRECTNVPROC)gles2wLoad("glDrawMeshTasksIndirectNV"); + glMultiDrawMeshTasksIndirectNV = (PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC)gles2wLoad("glMultiDrawMeshTasksIndirectNV"); + glMultiDrawMeshTasksIndirectCountNV = (PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC)gles2wLoad("glMultiDrawMeshTasksIndirectCountNV"); +#endif /* defined(GL_NV_mesh_shader) */ + +#if defined(GL_NV_non_square_matrices) + glUniformMatrix2x3fvNV = (PFNGLUNIFORMMATRIX2X3FVNVPROC)gles2wLoad("glUniformMatrix2x3fvNV"); + glUniformMatrix3x2fvNV = (PFNGLUNIFORMMATRIX3X2FVNVPROC)gles2wLoad("glUniformMatrix3x2fvNV"); + glUniformMatrix2x4fvNV = (PFNGLUNIFORMMATRIX2X4FVNVPROC)gles2wLoad("glUniformMatrix2x4fvNV"); + glUniformMatrix4x2fvNV = (PFNGLUNIFORMMATRIX4X2FVNVPROC)gles2wLoad("glUniformMatrix4x2fvNV"); + glUniformMatrix3x4fvNV = (PFNGLUNIFORMMATRIX3X4FVNVPROC)gles2wLoad("glUniformMatrix3x4fvNV"); + glUniformMatrix4x3fvNV = (PFNGLUNIFORMMATRIX4X3FVNVPROC)gles2wLoad("glUniformMatrix4x3fvNV"); +#endif /* defined(GL_NV_non_square_matrices) */ + +#if defined(GL_NV_path_rendering) + glGenPathsNV = (PFNGLGENPATHSNVPROC)gles2wLoad("glGenPathsNV"); + glDeletePathsNV = (PFNGLDELETEPATHSNVPROC)gles2wLoad("glDeletePathsNV"); + glIsPathNV = (PFNGLISPATHNVPROC)gles2wLoad("glIsPathNV"); + glPathCommandsNV = (PFNGLPATHCOMMANDSNVPROC)gles2wLoad("glPathCommandsNV"); + glPathCoordsNV = (PFNGLPATHCOORDSNVPROC)gles2wLoad("glPathCoordsNV"); + glPathSubCommandsNV = (PFNGLPATHSUBCOMMANDSNVPROC)gles2wLoad("glPathSubCommandsNV"); + glPathSubCoordsNV = (PFNGLPATHSUBCOORDSNVPROC)gles2wLoad("glPathSubCoordsNV"); + glPathStringNV = (PFNGLPATHSTRINGNVPROC)gles2wLoad("glPathStringNV"); + glPathGlyphsNV = (PFNGLPATHGLYPHSNVPROC)gles2wLoad("glPathGlyphsNV"); + glPathGlyphRangeNV = (PFNGLPATHGLYPHRANGENVPROC)gles2wLoad("glPathGlyphRangeNV"); + glWeightPathsNV = (PFNGLWEIGHTPATHSNVPROC)gles2wLoad("glWeightPathsNV"); + glCopyPathNV = (PFNGLCOPYPATHNVPROC)gles2wLoad("glCopyPathNV"); + glInterpolatePathsNV = (PFNGLINTERPOLATEPATHSNVPROC)gles2wLoad("glInterpolatePathsNV"); + glTransformPathNV = (PFNGLTRANSFORMPATHNVPROC)gles2wLoad("glTransformPathNV"); + glPathParameterivNV = (PFNGLPATHPARAMETERIVNVPROC)gles2wLoad("glPathParameterivNV"); + glPathParameteriNV = (PFNGLPATHPARAMETERINVPROC)gles2wLoad("glPathParameteriNV"); + glPathParameterfvNV = (PFNGLPATHPARAMETERFVNVPROC)gles2wLoad("glPathParameterfvNV"); + glPathParameterfNV = (PFNGLPATHPARAMETERFNVPROC)gles2wLoad("glPathParameterfNV"); + glPathDashArrayNV = (PFNGLPATHDASHARRAYNVPROC)gles2wLoad("glPathDashArrayNV"); + glPathStencilFuncNV = (PFNGLPATHSTENCILFUNCNVPROC)gles2wLoad("glPathStencilFuncNV"); + glPathStencilDepthOffsetNV = (PFNGLPATHSTENCILDEPTHOFFSETNVPROC)gles2wLoad("glPathStencilDepthOffsetNV"); + glStencilFillPathNV = (PFNGLSTENCILFILLPATHNVPROC)gles2wLoad("glStencilFillPathNV"); + glStencilStrokePathNV = (PFNGLSTENCILSTROKEPATHNVPROC)gles2wLoad("glStencilStrokePathNV"); + glStencilFillPathInstancedNV = (PFNGLSTENCILFILLPATHINSTANCEDNVPROC)gles2wLoad("glStencilFillPathInstancedNV"); + glStencilStrokePathInstancedNV = (PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC)gles2wLoad("glStencilStrokePathInstancedNV"); + glPathCoverDepthFuncNV = (PFNGLPATHCOVERDEPTHFUNCNVPROC)gles2wLoad("glPathCoverDepthFuncNV"); + glCoverFillPathNV = (PFNGLCOVERFILLPATHNVPROC)gles2wLoad("glCoverFillPathNV"); + glCoverStrokePathNV = (PFNGLCOVERSTROKEPATHNVPROC)gles2wLoad("glCoverStrokePathNV"); + glCoverFillPathInstancedNV = (PFNGLCOVERFILLPATHINSTANCEDNVPROC)gles2wLoad("glCoverFillPathInstancedNV"); + glCoverStrokePathInstancedNV = (PFNGLCOVERSTROKEPATHINSTANCEDNVPROC)gles2wLoad("glCoverStrokePathInstancedNV"); + glGetPathParameterivNV = (PFNGLGETPATHPARAMETERIVNVPROC)gles2wLoad("glGetPathParameterivNV"); + glGetPathParameterfvNV = (PFNGLGETPATHPARAMETERFVNVPROC)gles2wLoad("glGetPathParameterfvNV"); + glGetPathCommandsNV = (PFNGLGETPATHCOMMANDSNVPROC)gles2wLoad("glGetPathCommandsNV"); + glGetPathCoordsNV = (PFNGLGETPATHCOORDSNVPROC)gles2wLoad("glGetPathCoordsNV"); + glGetPathDashArrayNV = (PFNGLGETPATHDASHARRAYNVPROC)gles2wLoad("glGetPathDashArrayNV"); + glGetPathMetricsNV = (PFNGLGETPATHMETRICSNVPROC)gles2wLoad("glGetPathMetricsNV"); + glGetPathMetricRangeNV = (PFNGLGETPATHMETRICRANGENVPROC)gles2wLoad("glGetPathMetricRangeNV"); + glGetPathSpacingNV = (PFNGLGETPATHSPACINGNVPROC)gles2wLoad("glGetPathSpacingNV"); + glIsPointInFillPathNV = (PFNGLISPOINTINFILLPATHNVPROC)gles2wLoad("glIsPointInFillPathNV"); + glIsPointInStrokePathNV = (PFNGLISPOINTINSTROKEPATHNVPROC)gles2wLoad("glIsPointInStrokePathNV"); + glGetPathLengthNV = (PFNGLGETPATHLENGTHNVPROC)gles2wLoad("glGetPathLengthNV"); + glPointAlongPathNV = (PFNGLPOINTALONGPATHNVPROC)gles2wLoad("glPointAlongPathNV"); + + glMatrixLoad3x2fNV = (PFNGLMATRIXLOAD3X2FNVPROC)gles2wLoad("glMatrixLoad3x2fNV"); + glMatrixLoad3x3fNV = (PFNGLMATRIXLOAD3X3FNVPROC)gles2wLoad("glMatrixLoad3x3fNV"); + glMatrixLoadTranspose3x3fNV = (PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC)gles2wLoad("glMatrixLoadTranspose3x3fNV"); + glMatrixMult3x2fNV = (PFNGLMATRIXMULT3X2FNVPROC)gles2wLoad("glMatrixMult3x2fNV"); + glMatrixMult3x3fNV = (PFNGLMATRIXMULT3X3FNVPROC)gles2wLoad("glMatrixMult3x3fNV"); + glMatrixMultTranspose3x3fNV = (PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC)gles2wLoad("glMatrixMultTranspose3x3fNV"); + glStencilThenCoverFillPathNV = (PFNGLSTENCILTHENCOVERFILLPATHNVPROC)gles2wLoad("glStencilThenCoverFillPathNV"); + glStencilThenCoverStrokePathNV = (PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC)gles2wLoad("glStencilThenCoverStrokePathNV"); + glStencilThenCoverFillPathInstancedNV = (PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC)gles2wLoad("glStencilThenCoverFillPathInstancedNV"); + glStencilThenCoverStrokePathInstancedNV = (PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC)gles2wLoad("glStencilThenCoverStrokePathInstancedNV"); + glPathGlyphIndexRangeNV = (PFNGLPATHGLYPHINDEXRANGENVPROC)gles2wLoad("glPathGlyphIndexRangeNV"); + + glPathGlyphIndexArrayNV = (PFNGLPATHGLYPHINDEXARRAYNVPROC)gles2wLoad("glPathGlyphIndexArrayNV"); + glPathMemoryGlyphIndexArrayNV = (PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC)gles2wLoad("glPathMemoryGlyphIndexArrayNV"); + glProgramPathFragmentInputGenNV = (PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC)gles2wLoad("glProgramPathFragmentInputGenNV"); + glGetProgramResourcefvNV = (PFNGLGETPROGRAMRESOURCEFVNVPROC)gles2wLoad("glGetProgramResourcefvNV"); + + glMatrixFrustumEXT = (PFNGLMATRIXFRUSTUMEXTPROC)gles2wLoad("glMatrixFrustumEXT"); + glMatrixLoadIdentityEXT = (PFNGLMATRIXLOADIDENTITYEXTPROC)gles2wLoad("glMatrixLoadIdentityEXT"); + glMatrixLoadTransposefEXT = (PFNGLMATRIXLOADTRANSPOSEFEXTPROC)gles2wLoad("glMatrixLoadTransposefEXT"); + glMatrixLoadTransposedEXT = (PFNGLMATRIXLOADTRANSPOSEDEXTPROC)gles2wLoad("glMatrixLoadTransposedEXT"); + glMatrixLoadfEXT = (PFNGLMATRIXLOADFEXTPROC)gles2wLoad("glMatrixLoadfEXT"); + glMatrixLoaddEXT = (PFNGLMATRIXLOADDEXTPROC)gles2wLoad("glMatrixLoaddEXT"); + glMatrixMultTransposefEXT = (PFNGLMATRIXMULTTRANSPOSEFEXTPROC)gles2wLoad("glMatrixMultTransposefEXT"); + glMatrixMultTransposedEXT = (PFNGLMATRIXMULTTRANSPOSEDEXTPROC)gles2wLoad("glMatrixMultTransposedEXT"); + glMatrixMultfEXT = (PFNGLMATRIXMULTFEXTPROC)gles2wLoad("glMatrixMultfEXT"); + glMatrixMultdEXT = (PFNGLMATRIXMULTDEXTPROC)gles2wLoad("glMatrixMultdEXT"); + glMatrixOrthoEXT = (PFNGLMATRIXORTHOEXTPROC)gles2wLoad("glMatrixOrthoEXT"); + glMatrixPopEXT = (PFNGLMATRIXPOPEXTPROC)gles2wLoad("glMatrixPopEXT"); + glMatrixPushEXT = (PFNGLMATRIXPUSHEXTPROC)gles2wLoad("glMatrixPushEXT"); + glMatrixRotatefEXT = (PFNGLMATRIXROTATEFEXTPROC)gles2wLoad("glMatrixRotatefEXT"); + glMatrixRotatedEXT = (PFNGLMATRIXROTATEDEXTPROC)gles2wLoad("glMatrixRotatedEXT"); + glMatrixScalefEXT = (PFNGLMATRIXSCALEFEXTPROC)gles2wLoad("glMatrixScalefEXT"); + glMatrixScaledEXT = (PFNGLMATRIXSCALEDEXTPROC)gles2wLoad("glMatrixScaledEXT"); + glMatrixTranslatefEXT = (PFNGLMATRIXTRANSLATEFEXTPROC)gles2wLoad("glMatrixTranslatefEXT"); + glMatrixTranslatedEXT = (PFNGLMATRIXTRANSLATEDEXTPROC)gles2wLoad("glMatrixTranslatedEXT"); +#endif /* defined(GL_NV_path_rendering) */ + +#if defined(GL_NV_polygon_mode) + glPolygonModeNV = (PFNGLPOLYGONMODENVPROC)gles2wLoad("glPolygonModeNV"); +#endif /* defined(GL_NV_polygon_mode) */ + +#if defined(GL_NV_read_buffer) + glReadBufferNV = (PFNGLREADBUFFERNVPROC)gles2wLoad("glReadBufferNV"); +#endif /* defined(GL_NV_read_buffer) */ + +#if defined(GL_NV_sample_locations) + glFramebufferSampleLocationsfvNV = (PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)gles2wLoad("glFramebufferSampleLocationsfvNV"); + glNamedFramebufferSampleLocationsfvNV = (PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC)gles2wLoad("glNamedFramebufferSampleLocationsfvNV"); + glResolveDepthValuesNV = (PFNGLRESOLVEDEPTHVALUESNVPROC)gles2wLoad("glResolveDepthValuesNV"); +#endif /* defined(GL_NV_sample_locations) */ + +#if defined(GL_NV_scissor_exclusive) + glScissorExclusiveNV = (PFNGLSCISSOREXCLUSIVENVPROC)gles2wLoad("glScissorExclusiveNV"); + glScissorExclusiveArrayvNV = (PFNGLSCISSOREXCLUSIVEARRAYVNVPROC)gles2wLoad("glScissorExclusiveArrayvNV"); +#endif /* defined(GL_NV_scissor_exclusive) */ + +#if defined(GL_NV_shading_rate_image) + glBindShadingRateImageNV = (PFNGLBINDSHADINGRATEIMAGENVPROC)gles2wLoad("glBindShadingRateImageNV"); + glGetShadingRateImagePaletteNV = (PFNGLGETSHADINGRATEIMAGEPALETTENVPROC)gles2wLoad("glGetShadingRateImagePaletteNV"); + glGetShadingRateSampleLocationivNV = (PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC)gles2wLoad("glGetShadingRateSampleLocationivNV"); + glShadingRateImageBarrierNV = (PFNGLSHADINGRATEIMAGEBARRIERNVPROC)gles2wLoad("glShadingRateImageBarrierNV"); + glShadingRateImagePaletteNV = (PFNGLSHADINGRATEIMAGEPALETTENVPROC)gles2wLoad("glShadingRateImagePaletteNV"); + glShadingRateSampleOrderNV = (PFNGLSHADINGRATESAMPLEORDERNVPROC)gles2wLoad("glShadingRateSampleOrderNV"); + glShadingRateSampleOrderCustomNV = (PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC)gles2wLoad("glShadingRateSampleOrderCustomNV"); +#endif /* defined(GL_NV_shading_rate_image) */ + +#if defined(GL_NV_viewport_array) + glViewportArrayvNV = (PFNGLVIEWPORTARRAYVNVPROC)gles2wLoad("glViewportArrayvNV"); + glViewportIndexedfNV = (PFNGLVIEWPORTINDEXEDFNVPROC)gles2wLoad("glViewportIndexedfNV"); + glViewportIndexedfvNV = (PFNGLVIEWPORTINDEXEDFVNVPROC)gles2wLoad("glViewportIndexedfvNV"); + glScissorArrayvNV = (PFNGLSCISSORARRAYVNVPROC)gles2wLoad("glScissorArrayvNV"); + glScissorIndexedNV = (PFNGLSCISSORINDEXEDNVPROC)gles2wLoad("glScissorIndexedNV"); + glScissorIndexedvNV = (PFNGLSCISSORINDEXEDVNVPROC)gles2wLoad("glScissorIndexedvNV"); + glDepthRangeArrayfvNV = (PFNGLDEPTHRANGEARRAYFVNVPROC)gles2wLoad("glDepthRangeArrayfvNV"); + glDepthRangeIndexedfNV = (PFNGLDEPTHRANGEINDEXEDFNVPROC)gles2wLoad("glDepthRangeIndexedfNV"); + glGetFloati_vNV = (PFNGLGETFLOATI_VNVPROC)gles2wLoad("glGetFloati_vNV"); + glEnableiNV = (PFNGLENABLEINVPROC)gles2wLoad("glEnableiNV"); + glDisableiNV = (PFNGLDISABLEINVPROC)gles2wLoad("glDisableiNV"); + glIsEnablediNV = (PFNGLISENABLEDINVPROC)gles2wLoad("glIsEnablediNV"); +#endif /* defined(GL_NV_viewport_array) */ + +#if defined(GL_NV_viewport_swizzle) + glViewportSwizzleNV = (PFNGLVIEWPORTSWIZZLENVPROC)gles2wLoad("glViewportSwizzleNV"); +#endif /* defined(GL_NV_viewport_swizzle) */ + +#if defined(GL_OES_EGL_image) + glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)gles2wLoad("glEGLImageTargetTexture2DOES"); + glEGLImageTargetRenderbufferStorageOES = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)gles2wLoad("glEGLImageTargetRenderbufferStorageOES"); +#endif /* defined(GL_OES_EGL_image) */ + +#if defined(GL_OES_copy_image) + glCopyImageSubDataOES = (PFNGLCOPYIMAGESUBDATAOESPROC)gles2wLoad("glCopyImageSubDataOES"); +#endif /* defined(GL_OES_copy_image) */ + +#if defined(GL_OES_draw_buffers_indexed) + glEnableiOES = (PFNGLENABLEIOESPROC)gles2wLoad("glEnableiOES"); + glDisableiOES = (PFNGLDISABLEIOESPROC)gles2wLoad("glDisableiOES"); + glBlendEquationiOES = (PFNGLBLENDEQUATIONIOESPROC)gles2wLoad("glBlendEquationiOES"); + glBlendEquationSeparateiOES = (PFNGLBLENDEQUATIONSEPARATEIOESPROC)gles2wLoad("glBlendEquationSeparateiOES"); + glBlendFunciOES = (PFNGLBLENDFUNCIOESPROC)gles2wLoad("glBlendFunciOES"); + glBlendFuncSeparateiOES = (PFNGLBLENDFUNCSEPARATEIOESPROC)gles2wLoad("glBlendFuncSeparateiOES"); + glColorMaskiOES = (PFNGLCOLORMASKIOESPROC)gles2wLoad("glColorMaskiOES"); + glIsEnablediOES = (PFNGLISENABLEDIOESPROC)gles2wLoad("glIsEnablediOES"); +#endif /* defined(GL_OES_draw_buffers_indexed) */ + +#if defined(GL_OES_draw_elements_base_vertex) + glDrawElementsBaseVertexOES = (PFNGLDRAWELEMENTSBASEVERTEXOESPROC)gles2wLoad("glDrawElementsBaseVertexOES"); + glDrawRangeElementsBaseVertexOES = (PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC)gles2wLoad("glDrawRangeElementsBaseVertexOES"); + glDrawElementsInstancedBaseVertexOES = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC)gles2wLoad("glDrawElementsInstancedBaseVertexOES"); +#endif /* defined(GL_OES_draw_elements_base_vertex) */ + +#if defined(GL_OES_geometry_shader) + glFramebufferTextureOES = (PFNGLFRAMEBUFFERTEXTUREOESPROC)gles2wLoad("glFramebufferTextureOES"); +#endif /* defined(GL_OES_geometry_shader) */ + +#if defined(GL_OES_get_program_binary) + glGetProgramBinaryOES = (PFNGLGETPROGRAMBINARYOESPROC)gles2wLoad("glGetProgramBinaryOES"); + glProgramBinaryOES = (PFNGLPROGRAMBINARYOESPROC)gles2wLoad("glProgramBinaryOES"); +#endif /* defined(GL_OES_get_program_binary) */ + +#if defined(GL_OES_mapbuffer) + glMapBufferOES = (PFNGLMAPBUFFEROESPROC)gles2wLoad("glMapBufferOES"); + glUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC)gles2wLoad("glUnmapBufferOES"); + glGetBufferPointervOES = (PFNGLGETBUFFERPOINTERVOESPROC)gles2wLoad("glGetBufferPointervOES"); +#endif /* defined(GL_OES_mapbuffer) */ + +#if defined(GL_OES_primitive_bounding_box) + glPrimitiveBoundingBoxOES = (PFNGLPRIMITIVEBOUNDINGBOXOESPROC)gles2wLoad("glPrimitiveBoundingBoxOES"); +#endif /* defined(GL_OES_primitive_bounding_box) */ + +#if defined(GL_OES_sample_shading) + glMinSampleShadingOES = (PFNGLMINSAMPLESHADINGOESPROC)gles2wLoad("glMinSampleShadingOES"); +#endif /* defined(GL_OES_sample_shading) */ + +#if defined(GL_OES_tessellation_shader) + glPatchParameteriOES = (PFNGLPATCHPARAMETERIOESPROC)gles2wLoad("glPatchParameteriOES"); +#endif /* defined(GL_OES_tessellation_shader) */ + +#if defined(GL_OES_texture_3D) + glTexImage3DOES = (PFNGLTEXIMAGE3DOESPROC)gles2wLoad("glTexImage3DOES"); + glTexSubImage3DOES = (PFNGLTEXSUBIMAGE3DOESPROC)gles2wLoad("glTexSubImage3DOES"); + glCopyTexSubImage3DOES = (PFNGLCOPYTEXSUBIMAGE3DOESPROC)gles2wLoad("glCopyTexSubImage3DOES"); + glCompressedTexImage3DOES = (PFNGLCOMPRESSEDTEXIMAGE3DOESPROC)gles2wLoad("glCompressedTexImage3DOES"); + glCompressedTexSubImage3DOES = (PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC)gles2wLoad("glCompressedTexSubImage3DOES"); + glFramebufferTexture3DOES = (PFNGLFRAMEBUFFERTEXTURE3DOESPROC)gles2wLoad("glFramebufferTexture3DOES"); +#endif /* defined(GL_OES_texture_3D) */ + +#if defined(GL_OES_texture_border_clamp) + glTexParameterIivOES = (PFNGLTEXPARAMETERIIVOESPROC)gles2wLoad("glTexParameterIivOES"); + glTexParameterIuivOES = (PFNGLTEXPARAMETERIUIVOESPROC)gles2wLoad("glTexParameterIuivOES"); + glGetTexParameterIivOES = (PFNGLGETTEXPARAMETERIIVOESPROC)gles2wLoad("glGetTexParameterIivOES"); + glGetTexParameterIuivOES = (PFNGLGETTEXPARAMETERIUIVOESPROC)gles2wLoad("glGetTexParameterIuivOES"); + glSamplerParameterIivOES = (PFNGLSAMPLERPARAMETERIIVOESPROC)gles2wLoad("glSamplerParameterIivOES"); + glSamplerParameterIuivOES = (PFNGLSAMPLERPARAMETERIUIVOESPROC)gles2wLoad("glSamplerParameterIuivOES"); + glGetSamplerParameterIivOES = (PFNGLGETSAMPLERPARAMETERIIVOESPROC)gles2wLoad("glGetSamplerParameterIivOES"); + glGetSamplerParameterIuivOES = (PFNGLGETSAMPLERPARAMETERIUIVOESPROC)gles2wLoad("glGetSamplerParameterIuivOES"); +#endif /* defined(GL_OES_texture_border_clamp) */ + +#if defined(GL_OES_texture_buffer) + glTexBufferOES = (PFNGLTEXBUFFEROESPROC)gles2wLoad("glTexBufferOES"); + glTexBufferRangeOES = (PFNGLTEXBUFFERRANGEOESPROC)gles2wLoad("glTexBufferRangeOES"); +#endif /* defined(GL_OES_texture_buffer) */ + +#if defined(GL_OES_texture_storage_multisample_2d_array) + glTexStorage3DMultisampleOES = (PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC)gles2wLoad("glTexStorage3DMultisampleOES"); +#endif /* defined(GL_OES_texture_storage_multisample_2d_array) */ + +#if defined(GL_OES_texture_view) + glTextureViewOES = (PFNGLTEXTUREVIEWOESPROC)gles2wLoad("glTextureViewOES"); +#endif /* defined(GL_OES_texture_view) */ + +#if defined(GL_OES_vertex_array_object) + glBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC)gles2wLoad("glBindVertexArrayOES"); + glDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC)gles2wLoad("glDeleteVertexArraysOES"); + glGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)gles2wLoad("glGenVertexArraysOES"); + glIsVertexArrayOES = (PFNGLISVERTEXARRAYOESPROC)gles2wLoad("glIsVertexArrayOES"); +#endif /* defined(GL_OES_vertex_array_object) */ + +#if defined(GL_OES_viewport_array) + glViewportArrayvOES = (PFNGLVIEWPORTARRAYVOESPROC)gles2wLoad("glViewportArrayvOES"); + glViewportIndexedfOES = (PFNGLVIEWPORTINDEXEDFOESPROC)gles2wLoad("glViewportIndexedfOES"); + glViewportIndexedfvOES = (PFNGLVIEWPORTINDEXEDFVOESPROC)gles2wLoad("glViewportIndexedfvOES"); + glScissorArrayvOES = (PFNGLSCISSORARRAYVOESPROC)gles2wLoad("glScissorArrayvOES"); + glScissorIndexedOES = (PFNGLSCISSORINDEXEDOESPROC)gles2wLoad("glScissorIndexedOES"); + glScissorIndexedvOES = (PFNGLSCISSORINDEXEDVOESPROC)gles2wLoad("glScissorIndexedvOES"); + glDepthRangeArrayfvOES = (PFNGLDEPTHRANGEARRAYFVOESPROC)gles2wLoad("glDepthRangeArrayfvOES"); + glDepthRangeIndexedfOES = (PFNGLDEPTHRANGEINDEXEDFOESPROC)gles2wLoad("glDepthRangeIndexedfOES"); + glGetFloati_vOES = (PFNGLGETFLOATI_VOESPROC)gles2wLoad("glGetFloati_vOES"); +#endif /* defined(GL_OES_viewport_array) */ + +#if defined(GL_OVR_multiview) + glFramebufferTextureMultiviewOVR = (PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC)gles2wLoad("glFramebufferTextureMultiviewOVR"); +#endif /* defined(GL_OVR_multiview) */ + +#if defined(GL_OVR_multiview_multisampled_render_to_texture) + glFramebufferTextureMultisampleMultiviewOVR = (PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC)gles2wLoad("glFramebufferTextureMultisampleMultiviewOVR"); +#endif /* defined(GL_OVR_multiview_multisampled_render_to_texture) */ + +#if defined(GL_QCOM_alpha_test) + glAlphaFuncQCOM = (PFNGLALPHAFUNCQCOMPROC)gles2wLoad("glAlphaFuncQCOM"); +#endif /* defined(GL_QCOM_alpha_test) */ + +#if defined(GL_QCOM_driver_control) + glGetDriverControlsQCOM = (PFNGLGETDRIVERCONTROLSQCOMPROC)gles2wLoad("glGetDriverControlsQCOM"); + glGetDriverControlStringQCOM = (PFNGLGETDRIVERCONTROLSTRINGQCOMPROC)gles2wLoad("glGetDriverControlStringQCOM"); + glEnableDriverControlQCOM = (PFNGLENABLEDRIVERCONTROLQCOMPROC)gles2wLoad("glEnableDriverControlQCOM"); + glDisableDriverControlQCOM = (PFNGLDISABLEDRIVERCONTROLQCOMPROC)gles2wLoad("glDisableDriverControlQCOM"); +#endif /* defined(GL_QCOM_driver_control) */ + +#if defined(GL_QCOM_extended_get) + glExtGetTexturesQCOM = (PFNGLEXTGETTEXTURESQCOMPROC)gles2wLoad("glExtGetTexturesQCOM"); + glExtGetBuffersQCOM = (PFNGLEXTGETBUFFERSQCOMPROC)gles2wLoad("glExtGetBuffersQCOM"); + glExtGetRenderbuffersQCOM = (PFNGLEXTGETRENDERBUFFERSQCOMPROC)gles2wLoad("glExtGetRenderbuffersQCOM"); + glExtGetFramebuffersQCOM = (PFNGLEXTGETFRAMEBUFFERSQCOMPROC)gles2wLoad("glExtGetFramebuffersQCOM"); + glExtGetTexLevelParameterivQCOM = (PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC)gles2wLoad("glExtGetTexLevelParameterivQCOM"); + glExtTexObjectStateOverrideiQCOM = (PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC)gles2wLoad("glExtTexObjectStateOverrideiQCOM"); + glExtGetTexSubImageQCOM = (PFNGLEXTGETTEXSUBIMAGEQCOMPROC)gles2wLoad("glExtGetTexSubImageQCOM"); + glExtGetBufferPointervQCOM = (PFNGLEXTGETBUFFERPOINTERVQCOMPROC)gles2wLoad("glExtGetBufferPointervQCOM"); +#endif /* defined(GL_QCOM_extended_get) */ + +#if defined(GL_QCOM_extended_get2) + glExtGetShadersQCOM = (PFNGLEXTGETSHADERSQCOMPROC)gles2wLoad("glExtGetShadersQCOM"); + glExtGetProgramsQCOM = (PFNGLEXTGETPROGRAMSQCOMPROC)gles2wLoad("glExtGetProgramsQCOM"); + glExtIsProgramBinaryQCOM = (PFNGLEXTISPROGRAMBINARYQCOMPROC)gles2wLoad("glExtIsProgramBinaryQCOM"); + glExtGetProgramBinarySourceQCOM = (PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC)gles2wLoad("glExtGetProgramBinarySourceQCOM"); +#endif /* defined(GL_QCOM_extended_get2) */ + +#if defined(GL_QCOM_framebuffer_foveated) + glFramebufferFoveationConfigQCOM = (PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC)gles2wLoad("glFramebufferFoveationConfigQCOM"); + glFramebufferFoveationParametersQCOM = (PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC)gles2wLoad("glFramebufferFoveationParametersQCOM"); +#endif /* defined(GL_QCOM_framebuffer_foveated) */ + +#if defined(GL_QCOM_motion_estimation) + glTexEstimateMotionQCOM = (PFNGLTEXESTIMATEMOTIONQCOMPROC)gles2wLoad("glTexEstimateMotionQCOM"); + glTexEstimateMotionRegionsQCOM = (PFNGLTEXESTIMATEMOTIONREGIONSQCOMPROC)gles2wLoad("glTexEstimateMotionRegionsQCOM"); +#endif /* defined(GL_QCOM_motion_estimation) */ + +#if defined(GL_QCOM_frame_extrapolation) + glExtrapolateTex2DQCOM = (PFNGLEXTRAPOLATETEX2DQCOMPROC)gles2wLoad("glExtrapolateTex2DQCOM"); +#endif /* defined(GL_QCOM_frame_extrapolation) */ + +#if defined(GL_QCOM_texture_foveated) + glTextureFoveationParametersQCOM = (PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC)gles2wLoad("glTextureFoveationParametersQCOM"); +#endif /* defined(GL_QCOM_texture_foveated) */ + +#if defined(GL_QCOM_shader_framebuffer_fetch_noncoherent) + glFramebufferFetchBarrierQCOM = (PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC)gles2wLoad("glFramebufferFetchBarrierQCOM"); +#endif /* defined(GL_QCOM_shader_framebuffer_fetch_noncoherent) */ + +#if defined(GL_QCOM_shading_rate) + glShadingRateQCOM = (PFNGLSHADINGRATEQCOMPROC)gles2wLoad("glShadingRateQCOM"); +#endif /* defined(GL_QCOM_shading_rate) */ + +#if defined(GL_QCOM_tiled_rendering) + glStartTilingQCOM = (PFNGLSTARTTILINGQCOMPROC)gles2wLoad("glStartTilingQCOM"); + glEndTilingQCOM = (PFNGLENDTILINGQCOMPROC)gles2wLoad("glEndTilingQCOM"); +#endif /* defined(GL_QCOM_tiled_rendering) */ + + /* GLES2W_GENERATE_GLES_LOAD */ + + /** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ +} diff --git a/native/cocos/renderer/gfx-gles-common/gles2w.h b/native/cocos/renderer/gfx-gles-common/gles2w.h new file mode 100644 index 0000000000..54051e3af2 --- /dev/null +++ b/native/cocos/renderer/gfx-gles-common/gles2w.h @@ -0,0 +1,1108 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +/** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + +/* GLES2W_GENERATE_GLES_DECLARATION */ +/* GL_ES_VERSION_2_0 */ +extern PFNGLACTIVETEXTUREPROC glActiveTexture; +extern PFNGLATTACHSHADERPROC glAttachShader; +extern PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation; +extern PFNGLBINDBUFFERPROC glBindBuffer; +extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; +extern PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer; +extern PFNGLBINDTEXTUREPROC glBindTexture; +extern PFNGLBLENDCOLORPROC glBlendColor; +extern PFNGLBLENDEQUATIONPROC glBlendEquation; +extern PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate; +extern PFNGLBLENDFUNCPROC glBlendFunc; +extern PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate; +extern PFNGLBUFFERDATAPROC glBufferData; +extern PFNGLBUFFERSUBDATAPROC glBufferSubData; +extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; +extern PFNGLCLEARPROC glClear; +extern PFNGLCLEARCOLORPROC glClearColor; +extern PFNGLCLEARDEPTHFPROC glClearDepthf; +extern PFNGLCLEARSTENCILPROC glClearStencil; +extern PFNGLCOLORMASKPROC glColorMask; +extern PFNGLCOMPILESHADERPROC glCompileShader; +extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D; +extern PFNGLCOPYTEXIMAGE2DPROC glCopyTexImage2D; +extern PFNGLCOPYTEXSUBIMAGE2DPROC glCopyTexSubImage2D; +extern PFNGLCREATEPROGRAMPROC glCreateProgram; +extern PFNGLCREATESHADERPROC glCreateShader; +extern PFNGLCULLFACEPROC glCullFace; +extern PFNGLDELETEBUFFERSPROC glDeleteBuffers; +extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers; +extern PFNGLDELETEPROGRAMPROC glDeleteProgram; +extern PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers; +extern PFNGLDELETESHADERPROC glDeleteShader; +extern PFNGLDELETETEXTURESPROC glDeleteTextures; +extern PFNGLDEPTHFUNCPROC glDepthFunc; +extern PFNGLDEPTHMASKPROC glDepthMask; +extern PFNGLDEPTHRANGEFPROC glDepthRangef; +extern PFNGLDETACHSHADERPROC glDetachShader; +extern PFNGLDISABLEPROC glDisable; +extern PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray; +extern PFNGLDRAWARRAYSPROC glDrawArrays; +extern PFNGLDRAWELEMENTSPROC glDrawElements; +extern PFNGLENABLEPROC glEnable; +extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray; +extern PFNGLFINISHPROC glFinish; +extern PFNGLFLUSHPROC glFlush; +extern PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer; +extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; +extern PFNGLFRONTFACEPROC glFrontFace; +extern PFNGLGENBUFFERSPROC glGenBuffers; +extern PFNGLGENERATEMIPMAPPROC glGenerateMipmap; +extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; +extern PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers; +extern PFNGLGENTEXTURESPROC glGenTextures; +extern PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib; +extern PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform; +extern PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders; +extern PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation; +extern PFNGLGETBOOLEANVPROC glGetBooleanv; +extern PFNGLGETBUFFERPARAMETERIVPROC glGetBufferParameteriv; +extern PFNGLGETERRORPROC glGetError; +extern PFNGLGETFLOATVPROC glGetFloatv; +extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv; +extern PFNGLGETINTEGERVPROC glGetIntegerv; +extern PFNGLGETPROGRAMIVPROC glGetProgramiv; +extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; +extern PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv; +extern PFNGLGETSHADERIVPROC glGetShaderiv; +extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; +extern PFNGLGETSHADERPRECISIONFORMATPROC glGetShaderPrecisionFormat; +extern PFNGLGETSHADERSOURCEPROC glGetShaderSource; +extern PFNGLGETSTRINGPROC glGetString; +extern PFNGLGETTEXPARAMETERFVPROC glGetTexParameterfv; +extern PFNGLGETTEXPARAMETERIVPROC glGetTexParameteriv; +extern PFNGLGETUNIFORMFVPROC glGetUniformfv; +extern PFNGLGETUNIFORMIVPROC glGetUniformiv; +extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; +extern PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv; +extern PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv; +extern PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv; +extern PFNGLHINTPROC glHint; +extern PFNGLISBUFFERPROC glIsBuffer; +extern PFNGLISENABLEDPROC glIsEnabled; +extern PFNGLISFRAMEBUFFERPROC glIsFramebuffer; +extern PFNGLISPROGRAMPROC glIsProgram; +extern PFNGLISRENDERBUFFERPROC glIsRenderbuffer; +extern PFNGLISSHADERPROC glIsShader; +extern PFNGLISTEXTUREPROC glIsTexture; +extern PFNGLLINEWIDTHPROC glLineWidth; +extern PFNGLLINKPROGRAMPROC glLinkProgram; +extern PFNGLPIXELSTOREIPROC glPixelStorei; +extern PFNGLPOLYGONOFFSETPROC glPolygonOffset; +extern PFNGLREADPIXELSPROC glReadPixels; +extern PFNGLRELEASESHADERCOMPILERPROC glReleaseShaderCompiler; +extern PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage; +extern PFNGLSAMPLECOVERAGEPROC glSampleCoverage; +extern PFNGLSCISSORPROC glScissor; +extern PFNGLSHADERBINARYPROC glShaderBinary; +extern PFNGLSHADERSOURCEPROC glShaderSource; +extern PFNGLSTENCILFUNCPROC glStencilFunc; +extern PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate; +extern PFNGLSTENCILMASKPROC glStencilMask; +extern PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate; +extern PFNGLSTENCILOPPROC glStencilOp; +extern PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate; +extern PFNGLTEXIMAGE2DPROC glTexImage2D; +extern PFNGLTEXPARAMETERFPROC glTexParameterf; +extern PFNGLTEXPARAMETERFVPROC glTexParameterfv; +extern PFNGLTEXPARAMETERIPROC glTexParameteri; +extern PFNGLTEXPARAMETERIVPROC glTexParameteriv; +extern PFNGLTEXSUBIMAGE2DPROC glTexSubImage2D; +extern PFNGLUNIFORM1FPROC glUniform1f; +extern PFNGLUNIFORM1FVPROC glUniform1fv; +extern PFNGLUNIFORM1IPROC glUniform1i; +extern PFNGLUNIFORM1IVPROC glUniform1iv; +extern PFNGLUNIFORM2FPROC glUniform2f; +extern PFNGLUNIFORM2FVPROC glUniform2fv; +extern PFNGLUNIFORM2IPROC glUniform2i; +extern PFNGLUNIFORM2IVPROC glUniform2iv; +extern PFNGLUNIFORM3FPROC glUniform3f; +extern PFNGLUNIFORM3FVPROC glUniform3fv; +extern PFNGLUNIFORM3IPROC glUniform3i; +extern PFNGLUNIFORM3IVPROC glUniform3iv; +extern PFNGLUNIFORM4FPROC glUniform4f; +extern PFNGLUNIFORM4FVPROC glUniform4fv; +extern PFNGLUNIFORM4IPROC glUniform4i; +extern PFNGLUNIFORM4IVPROC glUniform4iv; +extern PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv; +extern PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv; +extern PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv; +extern PFNGLUSEPROGRAMPROC glUseProgram; +extern PFNGLVALIDATEPROGRAMPROC glValidateProgram; +extern PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f; +extern PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv; +extern PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f; +extern PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv; +extern PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f; +extern PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv; +extern PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f; +extern PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv; +extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer; +extern PFNGLVIEWPORTPROC glViewport; + + +#if defined(GL_AMD_framebuffer_multisample_advanced) +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC glRenderbufferStorageMultisampleAdvancedAMD; +extern PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC glNamedRenderbufferStorageMultisampleAdvancedAMD; +#endif /* defined(GL_AMD_framebuffer_multisample_advanced) */ + +#if defined(GL_AMD_performance_monitor) +extern PFNGLGETPERFMONITORGROUPSAMDPROC glGetPerfMonitorGroupsAMD; +extern PFNGLGETPERFMONITORCOUNTERSAMDPROC glGetPerfMonitorCountersAMD; +extern PFNGLGETPERFMONITORGROUPSTRINGAMDPROC glGetPerfMonitorGroupStringAMD; +extern PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC glGetPerfMonitorCounterStringAMD; +extern PFNGLGETPERFMONITORCOUNTERINFOAMDPROC glGetPerfMonitorCounterInfoAMD; +extern PFNGLGENPERFMONITORSAMDPROC glGenPerfMonitorsAMD; +extern PFNGLDELETEPERFMONITORSAMDPROC glDeletePerfMonitorsAMD; +extern PFNGLSELECTPERFMONITORCOUNTERSAMDPROC glSelectPerfMonitorCountersAMD; +extern PFNGLBEGINPERFMONITORAMDPROC glBeginPerfMonitorAMD; +extern PFNGLENDPERFMONITORAMDPROC glEndPerfMonitorAMD; +extern PFNGLGETPERFMONITORCOUNTERDATAAMDPROC glGetPerfMonitorCounterDataAMD; +#endif /* defined(GL_AMD_performance_monitor) */ + +#if defined(GL_ANGLE_framebuffer_blit) +extern PFNGLBLITFRAMEBUFFERANGLEPROC glBlitFramebufferANGLE; +#endif /* defined(GL_ANGLE_framebuffer_blit) */ + +#if defined(GL_ANGLE_framebuffer_multisample) +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC glRenderbufferStorageMultisampleANGLE; +#endif /* defined(GL_ANGLE_framebuffer_multisample) */ + +#if defined(GL_ANGLE_instanced_arrays) +extern PFNGLDRAWARRAYSINSTANCEDANGLEPROC glDrawArraysInstancedANGLE; +extern PFNGLDRAWELEMENTSINSTANCEDANGLEPROC glDrawElementsInstancedANGLE; +extern PFNGLVERTEXATTRIBDIVISORANGLEPROC glVertexAttribDivisorANGLE; +#endif /* defined(GL_ANGLE_instanced_arrays) */ + +#if defined(GL_ANGLE_translated_shader_source) +extern PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC glGetTranslatedShaderSourceANGLE; +#endif /* defined(GL_ANGLE_translated_shader_source) */ + +#if defined(GL_APPLE_copy_texture_levels) +extern PFNGLCOPYTEXTURELEVELSAPPLEPROC glCopyTextureLevelsAPPLE; +#endif /* defined(GL_APPLE_copy_texture_levels) */ + +#if defined(GL_APPLE_framebuffer_multisample) +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC glRenderbufferStorageMultisampleAPPLE; +extern PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC glResolveMultisampleFramebufferAPPLE; +#endif /* defined(GL_APPLE_framebuffer_multisample) */ + +#if defined(GL_APPLE_sync) +extern PFNGLFENCESYNCAPPLEPROC glFenceSyncAPPLE; +extern PFNGLISSYNCAPPLEPROC glIsSyncAPPLE; +extern PFNGLDELETESYNCAPPLEPROC glDeleteSyncAPPLE; +extern PFNGLCLIENTWAITSYNCAPPLEPROC glClientWaitSyncAPPLE; +extern PFNGLWAITSYNCAPPLEPROC glWaitSyncAPPLE; +extern PFNGLGETINTEGER64VAPPLEPROC glGetInteger64vAPPLE; +extern PFNGLGETSYNCIVAPPLEPROC glGetSyncivAPPLE; +#endif /* defined(GL_APPLE_sync) */ + +#if defined(GL_EXT_EGL_image_storage) +extern PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC glEGLImageTargetTexStorageEXT; + +extern PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC glEGLImageTargetTextureStorageEXT; +#endif /* defined(GL_EXT_EGL_image_storage) */ + +#if defined(GL_EXT_base_instance) +extern PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC glDrawArraysInstancedBaseInstanceEXT; +extern PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC glDrawElementsInstancedBaseInstanceEXT; +extern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC glDrawElementsInstancedBaseVertexBaseInstanceEXT; +#endif /* defined(GL_EXT_base_instance) */ + +#if defined(GL_EXT_blend_func_extended) +extern PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC glBindFragDataLocationIndexedEXT; +extern PFNGLBINDFRAGDATALOCATIONEXTPROC glBindFragDataLocationEXT; +extern PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC glGetProgramResourceLocationIndexEXT; +extern PFNGLGETFRAGDATAINDEXEXTPROC glGetFragDataIndexEXT; +#endif /* defined(GL_EXT_blend_func_extended) */ + +#if defined(GL_EXT_buffer_storage) +extern PFNGLBUFFERSTORAGEEXTPROC glBufferStorageEXT; +#endif /* defined(GL_EXT_buffer_storage) */ + +#if defined(GL_EXT_clear_texture) +extern PFNGLCLEARTEXIMAGEEXTPROC glClearTexImageEXT; +extern PFNGLCLEARTEXSUBIMAGEEXTPROC glClearTexSubImageEXT; +#endif /* defined(GL_EXT_clear_texture) */ + +#if defined(GL_EXT_clip_control) +extern PFNGLCLIPCONTROLEXTPROC glClipControlEXT; +#endif /* defined(GL_EXT_clip_control) */ + +#if defined(GL_EXT_copy_image) +extern PFNGLCOPYIMAGESUBDATAEXTPROC glCopyImageSubDataEXT; +#endif /* defined(GL_EXT_copy_image) */ + +#if defined(GL_EXT_debug_label) +extern PFNGLLABELOBJECTEXTPROC glLabelObjectEXT; +extern PFNGLGETOBJECTLABELEXTPROC glGetObjectLabelEXT; +#endif /* defined(GL_EXT_debug_label) */ + +#if defined(GL_EXT_debug_marker) +extern PFNGLINSERTEVENTMARKEREXTPROC glInsertEventMarkerEXT; +extern PFNGLPUSHGROUPMARKEREXTPROC glPushGroupMarkerEXT; +extern PFNGLPOPGROUPMARKEREXTPROC glPopGroupMarkerEXT; +#endif /* defined(GL_EXT_debug_marker) */ + +#if defined(GL_EXT_discard_framebuffer) +extern PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT; +#endif /* defined(GL_EXT_discard_framebuffer) */ + +#if defined(GL_EXT_disjoint_timer_query) +extern PFNGLGENQUERIESEXTPROC glGenQueriesEXT; +extern PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT; +extern PFNGLISQUERYEXTPROC glIsQueryEXT; +extern PFNGLBEGINQUERYEXTPROC glBeginQueryEXT; +extern PFNGLENDQUERYEXTPROC glEndQueryEXT; +extern PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT; +extern PFNGLGETQUERYIVEXTPROC glGetQueryivEXT; +extern PFNGLGETQUERYOBJECTIVEXTPROC glGetQueryObjectivEXT; +extern PFNGLGETQUERYOBJECTUIVEXTPROC glGetQueryObjectuivEXT; +extern PFNGLGETQUERYOBJECTI64VEXTPROC glGetQueryObjecti64vEXT; +extern PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT; +extern PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT; +#endif /* defined(GL_EXT_disjoint_timer_query) */ + +#if defined(GL_EXT_draw_buffers) +extern PFNGLDRAWBUFFERSEXTPROC glDrawBuffersEXT; +#endif /* defined(GL_EXT_draw_buffers) */ + +#if defined(GL_EXT_draw_buffers_indexed) +extern PFNGLENABLEIEXTPROC glEnableiEXT; +extern PFNGLDISABLEIEXTPROC glDisableiEXT; +extern PFNGLBLENDEQUATIONIEXTPROC glBlendEquationiEXT; +extern PFNGLBLENDEQUATIONSEPARATEIEXTPROC glBlendEquationSeparateiEXT; +extern PFNGLBLENDFUNCIEXTPROC glBlendFunciEXT; +extern PFNGLBLENDFUNCSEPARATEIEXTPROC glBlendFuncSeparateiEXT; +extern PFNGLCOLORMASKIEXTPROC glColorMaskiEXT; +extern PFNGLISENABLEDIEXTPROC glIsEnablediEXT; +#endif /* defined(GL_EXT_draw_buffers_indexed) */ + +#if defined(GL_EXT_draw_elements_base_vertex) +extern PFNGLDRAWELEMENTSBASEVERTEXEXTPROC glDrawElementsBaseVertexEXT; +extern PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC glDrawRangeElementsBaseVertexEXT; +extern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC glDrawElementsInstancedBaseVertexEXT; +extern PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC glMultiDrawElementsBaseVertexEXT; +#endif /* defined(GL_EXT_draw_elements_base_vertex) */ + +#if defined(GL_EXT_draw_instanced) +extern PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstancedEXT; +extern PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstancedEXT; +#endif /* defined(GL_EXT_draw_instanced) */ + +#if defined(GL_EXT_draw_transform_feedback) +extern PFNGLDRAWTRANSFORMFEEDBACKEXTPROC glDrawTransformFeedbackEXT; +extern PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC glDrawTransformFeedbackInstancedEXT; +#endif /* defined(GL_EXT_draw_transform_feedback) */ + +#if defined(GL_EXT_external_buffer) +extern PFNGLBUFFERSTORAGEEXTERNALEXTPROC glBufferStorageExternalEXT; +extern PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC glNamedBufferStorageExternalEXT; +#endif /* defined(GL_EXT_external_buffer) */ + +#if defined(GL_EXT_geometry_shader) +extern PFNGLFRAMEBUFFERTEXTUREEXTPROC glFramebufferTextureEXT; +#endif /* defined(GL_EXT_geometry_shader) */ + +#if defined(GL_EXT_instanced_arrays) +extern PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisorEXT; +#endif /* defined(GL_EXT_instanced_arrays) */ + +#if defined(GL_EXT_map_buffer_range) +extern PFNGLMAPBUFFERRANGEEXTPROC glMapBufferRangeEXT; +extern PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC glFlushMappedBufferRangeEXT; +#endif /* defined(GL_EXT_map_buffer_range) */ + +#if defined(GL_EXT_memory_object) +extern PFNGLGETUNSIGNEDBYTEVEXTPROC glGetUnsignedBytevEXT; +extern PFNGLGETUNSIGNEDBYTEI_VEXTPROC glGetUnsignedBytei_vEXT; +extern PFNGLDELETEMEMORYOBJECTSEXTPROC glDeleteMemoryObjectsEXT; +extern PFNGLISMEMORYOBJECTEXTPROC glIsMemoryObjectEXT; +extern PFNGLCREATEMEMORYOBJECTSEXTPROC glCreateMemoryObjectsEXT; +extern PFNGLMEMORYOBJECTPARAMETERIVEXTPROC glMemoryObjectParameterivEXT; +extern PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC glGetMemoryObjectParameterivEXT; +extern PFNGLTEXSTORAGEMEM2DEXTPROC glTexStorageMem2DEXT; +extern PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC glTexStorageMem2DMultisampleEXT; +extern PFNGLTEXSTORAGEMEM3DEXTPROC glTexStorageMem3DEXT; +extern PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC glTexStorageMem3DMultisampleEXT; +extern PFNGLBUFFERSTORAGEMEMEXTPROC glBufferStorageMemEXT; + +extern PFNGLTEXTURESTORAGEMEM2DEXTPROC glTextureStorageMem2DEXT; +extern PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC glTextureStorageMem2DMultisampleEXT; +extern PFNGLTEXTURESTORAGEMEM3DEXTPROC glTextureStorageMem3DEXT; +extern PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC glTextureStorageMem3DMultisampleEXT; +extern PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC glNamedBufferStorageMemEXT; +#endif /* defined(GL_EXT_memory_object) */ + +#if defined(GL_EXT_memory_object_fd) +extern PFNGLIMPORTMEMORYFDEXTPROC glImportMemoryFdEXT; +#endif /* defined(GL_EXT_memory_object_fd) */ + +#if defined(GL_EXT_memory_object_win32) +extern PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC glImportMemoryWin32HandleEXT; +extern PFNGLIMPORTMEMORYWIN32NAMEEXTPROC glImportMemoryWin32NameEXT; +#endif /* defined(GL_EXT_memory_object_win32) */ + +#if defined(GL_EXT_multi_draw_arrays) +extern PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArraysEXT; +extern PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElementsEXT; +#endif /* defined(GL_EXT_multi_draw_arrays) */ + +#if defined(GL_EXT_multi_draw_indirect) +extern PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC glMultiDrawArraysIndirectEXT; +extern PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC glMultiDrawElementsIndirectEXT; +#endif /* defined(GL_EXT_multi_draw_indirect) */ + +#if defined(GL_EXT_multisampled_render_to_texture) +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT; +extern PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT; +#endif /* defined(GL_EXT_multisampled_render_to_texture) */ + +#if defined(GL_EXT_multiview_draw_buffers) +extern PFNGLREADBUFFERINDEXEDEXTPROC glReadBufferIndexedEXT; +extern PFNGLDRAWBUFFERSINDEXEDEXTPROC glDrawBuffersIndexedEXT; +extern PFNGLGETINTEGERI_VEXTPROC glGetIntegeri_vEXT; +#endif /* defined(GL_EXT_multiview_draw_buffers) */ + +#if defined(GL_EXT_polygon_offset_clamp) +extern PFNGLPOLYGONOFFSETCLAMPEXTPROC glPolygonOffsetClampEXT; +#endif /* defined(GL_EXT_polygon_offset_clamp) */ + +#if defined(GL_EXT_primitive_bounding_box) +extern PFNGLPRIMITIVEBOUNDINGBOXEXTPROC glPrimitiveBoundingBoxEXT; +#endif /* defined(GL_EXT_primitive_bounding_box) */ + +#if defined(GL_EXT_raster_multisample) +extern PFNGLRASTERSAMPLESEXTPROC glRasterSamplesEXT; +#endif /* defined(GL_EXT_raster_multisample) */ + +#if defined(GL_EXT_robustness) +extern PFNGLGETGRAPHICSRESETSTATUSEXTPROC glGetGraphicsResetStatusEXT; +extern PFNGLREADNPIXELSEXTPROC glReadnPixelsEXT; +extern PFNGLGETNUNIFORMFVEXTPROC glGetnUniformfvEXT; +extern PFNGLGETNUNIFORMIVEXTPROC glGetnUniformivEXT; +#endif /* defined(GL_EXT_robustness) */ + +#if defined(GL_EXT_semaphore) +extern PFNGLGENSEMAPHORESEXTPROC glGenSemaphoresEXT; +extern PFNGLDELETESEMAPHORESEXTPROC glDeleteSemaphoresEXT; +extern PFNGLISSEMAPHOREEXTPROC glIsSemaphoreEXT; +extern PFNGLSEMAPHOREPARAMETERUI64VEXTPROC glSemaphoreParameterui64vEXT; +extern PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC glGetSemaphoreParameterui64vEXT; +extern PFNGLWAITSEMAPHOREEXTPROC glWaitSemaphoreEXT; +extern PFNGLSIGNALSEMAPHOREEXTPROC glSignalSemaphoreEXT; +#endif /* defined(GL_EXT_semaphore) */ + +#if defined(GL_EXT_semaphore_fd) +extern PFNGLIMPORTSEMAPHOREFDEXTPROC glImportSemaphoreFdEXT; +#endif /* defined(GL_EXT_semaphore_fd) */ + +#if defined(GL_EXT_semaphore_win32) +extern PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC glImportSemaphoreWin32HandleEXT; +extern PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC glImportSemaphoreWin32NameEXT; +#endif /* defined(GL_EXT_semaphore_win32) */ + +#if defined(GL_EXT_separate_shader_objects) +extern PFNGLACTIVESHADERPROGRAMEXTPROC glActiveShaderProgramEXT; +extern PFNGLBINDPROGRAMPIPELINEEXTPROC glBindProgramPipelineEXT; +extern PFNGLCREATESHADERPROGRAMVEXTPROC glCreateShaderProgramvEXT; +extern PFNGLDELETEPROGRAMPIPELINESEXTPROC glDeleteProgramPipelinesEXT; +extern PFNGLGENPROGRAMPIPELINESEXTPROC glGenProgramPipelinesEXT; +extern PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC glGetProgramPipelineInfoLogEXT; +extern PFNGLGETPROGRAMPIPELINEIVEXTPROC glGetProgramPipelineivEXT; +extern PFNGLISPROGRAMPIPELINEEXTPROC glIsProgramPipelineEXT; +extern PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT; +extern PFNGLPROGRAMUNIFORM1FEXTPROC glProgramUniform1fEXT; +extern PFNGLPROGRAMUNIFORM1FVEXTPROC glProgramUniform1fvEXT; +extern PFNGLPROGRAMUNIFORM1IEXTPROC glProgramUniform1iEXT; +extern PFNGLPROGRAMUNIFORM1IVEXTPROC glProgramUniform1ivEXT; +extern PFNGLPROGRAMUNIFORM2FEXTPROC glProgramUniform2fEXT; +extern PFNGLPROGRAMUNIFORM2FVEXTPROC glProgramUniform2fvEXT; +extern PFNGLPROGRAMUNIFORM2IEXTPROC glProgramUniform2iEXT; +extern PFNGLPROGRAMUNIFORM2IVEXTPROC glProgramUniform2ivEXT; +extern PFNGLPROGRAMUNIFORM3FEXTPROC glProgramUniform3fEXT; +extern PFNGLPROGRAMUNIFORM3FVEXTPROC glProgramUniform3fvEXT; +extern PFNGLPROGRAMUNIFORM3IEXTPROC glProgramUniform3iEXT; +extern PFNGLPROGRAMUNIFORM3IVEXTPROC glProgramUniform3ivEXT; +extern PFNGLPROGRAMUNIFORM4FEXTPROC glProgramUniform4fEXT; +extern PFNGLPROGRAMUNIFORM4FVEXTPROC glProgramUniform4fvEXT; +extern PFNGLPROGRAMUNIFORM4IEXTPROC glProgramUniform4iEXT; +extern PFNGLPROGRAMUNIFORM4IVEXTPROC glProgramUniform4ivEXT; +extern PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC glProgramUniformMatrix2fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC glProgramUniformMatrix3fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC glProgramUniformMatrix4fvEXT; +extern PFNGLUSEPROGRAMSTAGESEXTPROC glUseProgramStagesEXT; +extern PFNGLVALIDATEPROGRAMPIPELINEEXTPROC glValidateProgramPipelineEXT; + +extern PFNGLPROGRAMUNIFORM1UIEXTPROC glProgramUniform1uiEXT; +extern PFNGLPROGRAMUNIFORM2UIEXTPROC glProgramUniform2uiEXT; +extern PFNGLPROGRAMUNIFORM3UIEXTPROC glProgramUniform3uiEXT; +extern PFNGLPROGRAMUNIFORM4UIEXTPROC glProgramUniform4uiEXT; +extern PFNGLPROGRAMUNIFORM1UIVEXTPROC glProgramUniform1uivEXT; +extern PFNGLPROGRAMUNIFORM2UIVEXTPROC glProgramUniform2uivEXT; +extern PFNGLPROGRAMUNIFORM3UIVEXTPROC glProgramUniform3uivEXT; +extern PFNGLPROGRAMUNIFORM4UIVEXTPROC glProgramUniform4uivEXT; +extern PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC glProgramUniformMatrix2x3fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC glProgramUniformMatrix3x2fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC glProgramUniformMatrix2x4fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC glProgramUniformMatrix4x2fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC glProgramUniformMatrix3x4fvEXT; +extern PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC glProgramUniformMatrix4x3fvEXT; +#endif /* defined(GL_EXT_separate_shader_objects) */ + +#if defined(GL_EXT_shader_framebuffer_fetch_non_coherent) +extern PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC glFramebufferFetchBarrierEXT; +#endif /* defined(GL_EXT_shader_framebuffer_fetch_non_coherent) */ + +#if defined(GL_EXT_shader_pixel_local_storage2) +extern PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC glFramebufferPixelLocalStorageSizeEXT; +extern PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC glGetFramebufferPixelLocalStorageSizeEXT; +extern PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC glClearPixelLocalStorageuiEXT; +#endif /* defined(GL_EXT_shader_pixel_local_storage2) */ + +#if defined(GL_EXT_sparse_texture) +extern PFNGLTEXPAGECOMMITMENTEXTPROC glTexPageCommitmentEXT; +#endif /* defined(GL_EXT_sparse_texture) */ + +#if defined(GL_EXT_tessellation_shader) +extern PFNGLPATCHPARAMETERIEXTPROC glPatchParameteriEXT; +#endif /* defined(GL_EXT_tessellation_shader) */ + +#if defined(GL_EXT_texture_border_clamp) +extern PFNGLTEXPARAMETERIIVEXTPROC glTexParameterIivEXT; +extern PFNGLTEXPARAMETERIUIVEXTPROC glTexParameterIuivEXT; +extern PFNGLGETTEXPARAMETERIIVEXTPROC glGetTexParameterIivEXT; +extern PFNGLGETTEXPARAMETERIUIVEXTPROC glGetTexParameterIuivEXT; +extern PFNGLSAMPLERPARAMETERIIVEXTPROC glSamplerParameterIivEXT; +extern PFNGLSAMPLERPARAMETERIUIVEXTPROC glSamplerParameterIuivEXT; +extern PFNGLGETSAMPLERPARAMETERIIVEXTPROC glGetSamplerParameterIivEXT; +extern PFNGLGETSAMPLERPARAMETERIUIVEXTPROC glGetSamplerParameterIuivEXT; +#endif /* defined(GL_EXT_texture_border_clamp) */ + +#if defined(GL_EXT_texture_buffer) +extern PFNGLTEXBUFFEREXTPROC glTexBufferEXT; +extern PFNGLTEXBUFFERRANGEEXTPROC glTexBufferRangeEXT; +#endif /* defined(GL_EXT_texture_buffer) */ + +#if defined(GL_EXT_texture_storage) +extern PFNGLTEXSTORAGE1DEXTPROC glTexStorage1DEXT; +extern PFNGLTEXSTORAGE2DEXTPROC glTexStorage2DEXT; +extern PFNGLTEXSTORAGE3DEXTPROC glTexStorage3DEXT; + +extern PFNGLTEXTURESTORAGE1DEXTPROC glTextureStorage1DEXT; +extern PFNGLTEXTURESTORAGE2DEXTPROC glTextureStorage2DEXT; +extern PFNGLTEXTURESTORAGE3DEXTPROC glTextureStorage3DEXT; +#endif /* defined(GL_EXT_texture_storage) */ + +#if defined(GL_EXT_texture_view) +extern PFNGLTEXTUREVIEWEXTPROC glTextureViewEXT; +#endif /* defined(GL_EXT_texture_view) */ + +#if defined(GL_NV_timeline_semaphore) +extern PFNGLCREATESEMAPHORESNVPROC glCreateSemaphoresNV; +extern PFNGLSEMAPHOREPARAMETERIVNVPROC glSemaphoreParameterivNV; +extern PFNGLGETSEMAPHOREPARAMETERIVNVPROC glGetSemaphoreParameterivNV; +#endif /* defined(GL_NV_timeline_semaphore) */ + +#if defined(GL_EXT_win32_keyed_mutex) +extern PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC glAcquireKeyedMutexWin32EXT; +extern PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC glReleaseKeyedMutexWin32EXT; +#endif /* defined(GL_EXT_win32_keyed_mutex) */ + +#if defined(GL_EXT_window_rectangles) +extern PFNGLWINDOWRECTANGLESEXTPROC glWindowRectanglesEXT; +#endif /* defined(GL_EXT_window_rectangles) */ + +#if defined(GL_IMG_bindless_texture) +extern PFNGLGETTEXTUREHANDLEIMGPROC glGetTextureHandleIMG; +extern PFNGLGETTEXTURESAMPLERHANDLEIMGPROC glGetTextureSamplerHandleIMG; +extern PFNGLUNIFORMHANDLEUI64IMGPROC glUniformHandleui64IMG; +extern PFNGLUNIFORMHANDLEUI64VIMGPROC glUniformHandleui64vIMG; +extern PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC glProgramUniformHandleui64IMG; +extern PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC glProgramUniformHandleui64vIMG; +#endif /* defined(GL_IMG_bindless_texture) */ + +#if defined(GL_IMG_framebuffer_downsample) +extern PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC glFramebufferTexture2DDownsampleIMG; +extern PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC glFramebufferTextureLayerDownsampleIMG; +#endif /* defined(GL_IMG_framebuffer_downsample) */ + +#if defined(GL_IMG_multisampled_render_to_texture) +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC glRenderbufferStorageMultisampleIMG; +extern PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC glFramebufferTexture2DMultisampleIMG; +#endif /* defined(GL_IMG_multisampled_render_to_texture) */ + +#if defined(GL_INTEL_framebuffer_CMAA) +extern PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC glApplyFramebufferAttachmentCMAAINTEL; +#endif /* defined(GL_INTEL_framebuffer_CMAA) */ + +#if defined(GL_INTEL_performance_query) +extern PFNGLBEGINPERFQUERYINTELPROC glBeginPerfQueryINTEL; +extern PFNGLCREATEPERFQUERYINTELPROC glCreatePerfQueryINTEL; +extern PFNGLDELETEPERFQUERYINTELPROC glDeletePerfQueryINTEL; +extern PFNGLENDPERFQUERYINTELPROC glEndPerfQueryINTEL; +extern PFNGLGETFIRSTPERFQUERYIDINTELPROC glGetFirstPerfQueryIdINTEL; +extern PFNGLGETNEXTPERFQUERYIDINTELPROC glGetNextPerfQueryIdINTEL; +extern PFNGLGETPERFCOUNTERINFOINTELPROC glGetPerfCounterInfoINTEL; +extern PFNGLGETPERFQUERYDATAINTELPROC glGetPerfQueryDataINTEL; +extern PFNGLGETPERFQUERYIDBYNAMEINTELPROC glGetPerfQueryIdByNameINTEL; +extern PFNGLGETPERFQUERYINFOINTELPROC glGetPerfQueryInfoINTEL; +#endif /* defined(GL_INTEL_performance_query) */ + +#if defined(GL_KHR_blend_equation_advanced) +extern PFNGLBLENDBARRIERKHRPROC glBlendBarrierKHR; +#endif /* defined(GL_KHR_blend_equation_advanced) */ + +#if defined(GL_KHR_debug) +extern PFNGLDEBUGMESSAGECONTROLKHRPROC glDebugMessageControlKHR; +extern PFNGLDEBUGMESSAGEINSERTKHRPROC glDebugMessageInsertKHR; +extern PFNGLDEBUGMESSAGECALLBACKKHRPROC glDebugMessageCallbackKHR; +extern PFNGLGETDEBUGMESSAGELOGKHRPROC glGetDebugMessageLogKHR; +extern PFNGLPUSHDEBUGGROUPKHRPROC glPushDebugGroupKHR; +extern PFNGLPOPDEBUGGROUPKHRPROC glPopDebugGroupKHR; +extern PFNGLOBJECTLABELKHRPROC glObjectLabelKHR; +extern PFNGLGETOBJECTLABELKHRPROC glGetObjectLabelKHR; +extern PFNGLOBJECTPTRLABELKHRPROC glObjectPtrLabelKHR; +extern PFNGLGETOBJECTPTRLABELKHRPROC glGetObjectPtrLabelKHR; +extern PFNGLGETPOINTERVKHRPROC glGetPointervKHR; +#endif /* defined(GL_KHR_debug) */ + +#if defined(GL_KHR_robustness) +extern PFNGLGETGRAPHICSRESETSTATUSKHRPROC glGetGraphicsResetStatusKHR; +extern PFNGLREADNPIXELSKHRPROC glReadnPixelsKHR; +extern PFNGLGETNUNIFORMFVKHRPROC glGetnUniformfvKHR; +extern PFNGLGETNUNIFORMIVKHRPROC glGetnUniformivKHR; +extern PFNGLGETNUNIFORMUIVKHRPROC glGetnUniformuivKHR; +#endif /* defined(GL_KHR_robustness) */ + +#if defined(GL_KHR_parallel_shader_compile) +extern PFNGLMAXSHADERCOMPILERTHREADSKHRPROC glMaxShaderCompilerThreadsKHR; +#endif /* defined(GL_KHR_parallel_shader_compile) */ + +#if defined(GL_MESA_framebuffer_flip_y) +extern PFNGLFRAMEBUFFERPARAMETERIMESAPROC glFramebufferParameteriMESA; +extern PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC glGetFramebufferParameterivMESA; +#endif /* defined(GL_MESA_framebuffer_flip_y) */ + +#if defined(GL_NV_bindless_texture) +extern PFNGLGETTEXTUREHANDLENVPROC glGetTextureHandleNV; +extern PFNGLGETTEXTURESAMPLERHANDLENVPROC glGetTextureSamplerHandleNV; +extern PFNGLMAKETEXTUREHANDLERESIDENTNVPROC glMakeTextureHandleResidentNV; +extern PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC glMakeTextureHandleNonResidentNV; +extern PFNGLGETIMAGEHANDLENVPROC glGetImageHandleNV; +extern PFNGLMAKEIMAGEHANDLERESIDENTNVPROC glMakeImageHandleResidentNV; +extern PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC glMakeImageHandleNonResidentNV; +extern PFNGLUNIFORMHANDLEUI64NVPROC glUniformHandleui64NV; +extern PFNGLUNIFORMHANDLEUI64VNVPROC glUniformHandleui64vNV; +extern PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC glProgramUniformHandleui64NV; +extern PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC glProgramUniformHandleui64vNV; +extern PFNGLISTEXTUREHANDLERESIDENTNVPROC glIsTextureHandleResidentNV; +extern PFNGLISIMAGEHANDLERESIDENTNVPROC glIsImageHandleResidentNV; +#endif /* defined(GL_NV_bindless_texture) */ + +#if defined(GL_NV_blend_equation_advanced) +extern PFNGLBLENDPARAMETERINVPROC glBlendParameteriNV; +extern PFNGLBLENDBARRIERNVPROC glBlendBarrierNV; +#endif /* defined(GL_NV_blend_equation_advanced) */ + +#if defined(GL_NV_clip_space_w_scaling) +extern PFNGLVIEWPORTPOSITIONWSCALENVPROC glViewportPositionWScaleNV; +#endif /* defined(GL_NV_clip_space_w_scaling) */ + +#if defined(GL_NV_conditional_render) +extern PFNGLBEGINCONDITIONALRENDERNVPROC glBeginConditionalRenderNV; +extern PFNGLENDCONDITIONALRENDERNVPROC glEndConditionalRenderNV; +#endif /* defined(GL_NV_conditional_render) */ + +#if defined(GL_NV_conservative_raster) +extern PFNGLSUBPIXELPRECISIONBIASNVPROC glSubpixelPrecisionBiasNV; +#endif /* defined(GL_NV_conservative_raster) */ + +#if defined(GL_NV_conservative_raster_pre_snap_triangles) +extern PFNGLCONSERVATIVERASTERPARAMETERINVPROC glConservativeRasterParameteriNV; +#endif /* defined(GL_NV_conservative_raster_pre_snap_triangles) */ + +#if defined(GL_NV_copy_buffer) +extern PFNGLCOPYBUFFERSUBDATANVPROC glCopyBufferSubDataNV; +#endif /* defined(GL_NV_copy_buffer) */ + +#if defined(GL_NV_coverage_sample) +extern PFNGLCOVERAGEMASKNVPROC glCoverageMaskNV; +extern PFNGLCOVERAGEOPERATIONNVPROC glCoverageOperationNV; +#endif /* defined(GL_NV_coverage_sample) */ + +#if defined(GL_NV_draw_buffers) +extern PFNGLDRAWBUFFERSNVPROC glDrawBuffersNV; +#endif /* defined(GL_NV_draw_buffers) */ + +#if defined(GL_NV_draw_instanced) +extern PFNGLDRAWARRAYSINSTANCEDNVPROC glDrawArraysInstancedNV; +extern PFNGLDRAWELEMENTSINSTANCEDNVPROC glDrawElementsInstancedNV; +#endif /* defined(GL_NV_draw_instanced) */ + +#if defined(GL_NV_draw_vulkan_image) +extern PFNGLDRAWVKIMAGENVPROC glDrawVkImageNV; +extern PFNGLGETVKPROCADDRNVPROC glGetVkProcAddrNV; +extern PFNGLWAITVKSEMAPHORENVPROC glWaitVkSemaphoreNV; +extern PFNGLSIGNALVKSEMAPHORENVPROC glSignalVkSemaphoreNV; +extern PFNGLSIGNALVKFENCENVPROC glSignalVkFenceNV; +#endif /* defined(GL_NV_draw_vulkan_image) */ + +#if defined(GL_NV_fence) +extern PFNGLDELETEFENCESNVPROC glDeleteFencesNV; +extern PFNGLGENFENCESNVPROC glGenFencesNV; +extern PFNGLISFENCENVPROC glIsFenceNV; +extern PFNGLTESTFENCENVPROC glTestFenceNV; +extern PFNGLGETFENCEIVNVPROC glGetFenceivNV; +extern PFNGLFINISHFENCENVPROC glFinishFenceNV; +extern PFNGLSETFENCENVPROC glSetFenceNV; +#endif /* defined(GL_NV_fence) */ + +#if defined(GL_NV_fragment_coverage_to_color) +extern PFNGLFRAGMENTCOVERAGECOLORNVPROC glFragmentCoverageColorNV; +#endif /* defined(GL_NV_fragment_coverage_to_color) */ + +#if defined(GL_NV_framebuffer_blit) +extern PFNGLBLITFRAMEBUFFERNVPROC glBlitFramebufferNV; +#endif /* defined(GL_NV_framebuffer_blit) */ + +#if defined(GL_NV_framebuffer_mixed_samples) +extern PFNGLCOVERAGEMODULATIONTABLENVPROC glCoverageModulationTableNV; +extern PFNGLGETCOVERAGEMODULATIONTABLENVPROC glGetCoverageModulationTableNV; +extern PFNGLCOVERAGEMODULATIONNVPROC glCoverageModulationNV; +#endif /* defined(GL_NV_framebuffer_mixed_samples) */ + +#if defined(GL_NV_framebuffer_multisample) +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC glRenderbufferStorageMultisampleNV; +#endif /* defined(GL_NV_framebuffer_multisample) */ + +#if defined(GL_NV_gpu_shader5) +extern PFNGLUNIFORM1I64NVPROC glUniform1i64NV; +extern PFNGLUNIFORM2I64NVPROC glUniform2i64NV; +extern PFNGLUNIFORM3I64NVPROC glUniform3i64NV; +extern PFNGLUNIFORM4I64NVPROC glUniform4i64NV; +extern PFNGLUNIFORM1I64VNVPROC glUniform1i64vNV; +extern PFNGLUNIFORM2I64VNVPROC glUniform2i64vNV; +extern PFNGLUNIFORM3I64VNVPROC glUniform3i64vNV; +extern PFNGLUNIFORM4I64VNVPROC glUniform4i64vNV; +extern PFNGLUNIFORM1UI64NVPROC glUniform1ui64NV; +extern PFNGLUNIFORM2UI64NVPROC glUniform2ui64NV; +extern PFNGLUNIFORM3UI64NVPROC glUniform3ui64NV; +extern PFNGLUNIFORM4UI64NVPROC glUniform4ui64NV; +extern PFNGLUNIFORM1UI64VNVPROC glUniform1ui64vNV; +extern PFNGLUNIFORM2UI64VNVPROC glUniform2ui64vNV; +extern PFNGLUNIFORM3UI64VNVPROC glUniform3ui64vNV; +extern PFNGLUNIFORM4UI64VNVPROC glUniform4ui64vNV; +extern PFNGLGETUNIFORMI64VNVPROC glGetUniformi64vNV; + +extern PFNGLPROGRAMUNIFORM1I64NVPROC glProgramUniform1i64NV; +extern PFNGLPROGRAMUNIFORM2I64NVPROC glProgramUniform2i64NV; +extern PFNGLPROGRAMUNIFORM3I64NVPROC glProgramUniform3i64NV; +extern PFNGLPROGRAMUNIFORM4I64NVPROC glProgramUniform4i64NV; +extern PFNGLPROGRAMUNIFORM1I64VNVPROC glProgramUniform1i64vNV; +extern PFNGLPROGRAMUNIFORM2I64VNVPROC glProgramUniform2i64vNV; +extern PFNGLPROGRAMUNIFORM3I64VNVPROC glProgramUniform3i64vNV; +extern PFNGLPROGRAMUNIFORM4I64VNVPROC glProgramUniform4i64vNV; +extern PFNGLPROGRAMUNIFORM1UI64NVPROC glProgramUniform1ui64NV; +extern PFNGLPROGRAMUNIFORM2UI64NVPROC glProgramUniform2ui64NV; +extern PFNGLPROGRAMUNIFORM3UI64NVPROC glProgramUniform3ui64NV; +extern PFNGLPROGRAMUNIFORM4UI64NVPROC glProgramUniform4ui64NV; +extern PFNGLPROGRAMUNIFORM1UI64VNVPROC glProgramUniform1ui64vNV; +extern PFNGLPROGRAMUNIFORM2UI64VNVPROC glProgramUniform2ui64vNV; +extern PFNGLPROGRAMUNIFORM3UI64VNVPROC glProgramUniform3ui64vNV; +extern PFNGLPROGRAMUNIFORM4UI64VNVPROC glProgramUniform4ui64vNV; +#endif /* defined(GL_NV_gpu_shader5) */ + +#if defined(GL_NV_instanced_arrays) +extern PFNGLVERTEXATTRIBDIVISORNVPROC glVertexAttribDivisorNV; +#endif /* defined(GL_NV_instanced_arrays) */ + +#if defined(GL_NV_internalformat_sample_query) +extern PFNGLGETINTERNALFORMATSAMPLEIVNVPROC glGetInternalformatSampleivNV; +#endif /* defined(GL_NV_internalformat_sample_query) */ + +#if defined(GL_NV_memory_attachment) +extern PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC glGetMemoryObjectDetachedResourcesuivNV; +extern PFNGLRESETMEMORYOBJECTPARAMETERNVPROC glResetMemoryObjectParameterNV; +extern PFNGLTEXATTACHMEMORYNVPROC glTexAttachMemoryNV; +extern PFNGLBUFFERATTACHMEMORYNVPROC glBufferAttachMemoryNV; + +extern PFNGLTEXTUREATTACHMEMORYNVPROC glTextureAttachMemoryNV; +extern PFNGLNAMEDBUFFERATTACHMEMORYNVPROC glNamedBufferAttachMemoryNV; +#endif /* defined(GL_NV_memory_attachment) */ + +#if defined(GL_NV_memory_object_sparse) +extern PFNGLBUFFERPAGECOMMITMENTMEMNVPROC glBufferPageCommitmentMemNV; +extern PFNGLTEXPAGECOMMITMENTMEMNVPROC glTexPageCommitmentMemNV; + +extern PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC glNamedBufferPageCommitmentMemNV; +extern PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC glTexturePageCommitmentMemNV; +#endif /* defined(GL_NV_memory_object_sparse) */ + +#if defined(GL_NV_mesh_shader) +extern PFNGLDRAWMESHTASKSNVPROC glDrawMeshTasksNV; +extern PFNGLDRAWMESHTASKSINDIRECTNVPROC glDrawMeshTasksIndirectNV; +extern PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC glMultiDrawMeshTasksIndirectNV; +extern PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC glMultiDrawMeshTasksIndirectCountNV; +#endif /* defined(GL_NV_mesh_shader) */ + +#if defined(GL_NV_non_square_matrices) +extern PFNGLUNIFORMMATRIX2X3FVNVPROC glUniformMatrix2x3fvNV; +extern PFNGLUNIFORMMATRIX3X2FVNVPROC glUniformMatrix3x2fvNV; +extern PFNGLUNIFORMMATRIX2X4FVNVPROC glUniformMatrix2x4fvNV; +extern PFNGLUNIFORMMATRIX4X2FVNVPROC glUniformMatrix4x2fvNV; +extern PFNGLUNIFORMMATRIX3X4FVNVPROC glUniformMatrix3x4fvNV; +extern PFNGLUNIFORMMATRIX4X3FVNVPROC glUniformMatrix4x3fvNV; +#endif /* defined(GL_NV_non_square_matrices) */ + +#if defined(GL_NV_path_rendering) +extern PFNGLGENPATHSNVPROC glGenPathsNV; +extern PFNGLDELETEPATHSNVPROC glDeletePathsNV; +extern PFNGLISPATHNVPROC glIsPathNV; +extern PFNGLPATHCOMMANDSNVPROC glPathCommandsNV; +extern PFNGLPATHCOORDSNVPROC glPathCoordsNV; +extern PFNGLPATHSUBCOMMANDSNVPROC glPathSubCommandsNV; +extern PFNGLPATHSUBCOORDSNVPROC glPathSubCoordsNV; +extern PFNGLPATHSTRINGNVPROC glPathStringNV; +extern PFNGLPATHGLYPHSNVPROC glPathGlyphsNV; +extern PFNGLPATHGLYPHRANGENVPROC glPathGlyphRangeNV; +extern PFNGLWEIGHTPATHSNVPROC glWeightPathsNV; +extern PFNGLCOPYPATHNVPROC glCopyPathNV; +extern PFNGLINTERPOLATEPATHSNVPROC glInterpolatePathsNV; +extern PFNGLTRANSFORMPATHNVPROC glTransformPathNV; +extern PFNGLPATHPARAMETERIVNVPROC glPathParameterivNV; +extern PFNGLPATHPARAMETERINVPROC glPathParameteriNV; +extern PFNGLPATHPARAMETERFVNVPROC glPathParameterfvNV; +extern PFNGLPATHPARAMETERFNVPROC glPathParameterfNV; +extern PFNGLPATHDASHARRAYNVPROC glPathDashArrayNV; +extern PFNGLPATHSTENCILFUNCNVPROC glPathStencilFuncNV; +extern PFNGLPATHSTENCILDEPTHOFFSETNVPROC glPathStencilDepthOffsetNV; +extern PFNGLSTENCILFILLPATHNVPROC glStencilFillPathNV; +extern PFNGLSTENCILSTROKEPATHNVPROC glStencilStrokePathNV; +extern PFNGLSTENCILFILLPATHINSTANCEDNVPROC glStencilFillPathInstancedNV; +extern PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC glStencilStrokePathInstancedNV; +extern PFNGLPATHCOVERDEPTHFUNCNVPROC glPathCoverDepthFuncNV; +extern PFNGLCOVERFILLPATHNVPROC glCoverFillPathNV; +extern PFNGLCOVERSTROKEPATHNVPROC glCoverStrokePathNV; +extern PFNGLCOVERFILLPATHINSTANCEDNVPROC glCoverFillPathInstancedNV; +extern PFNGLCOVERSTROKEPATHINSTANCEDNVPROC glCoverStrokePathInstancedNV; +extern PFNGLGETPATHPARAMETERIVNVPROC glGetPathParameterivNV; +extern PFNGLGETPATHPARAMETERFVNVPROC glGetPathParameterfvNV; +extern PFNGLGETPATHCOMMANDSNVPROC glGetPathCommandsNV; +extern PFNGLGETPATHCOORDSNVPROC glGetPathCoordsNV; +extern PFNGLGETPATHDASHARRAYNVPROC glGetPathDashArrayNV; +extern PFNGLGETPATHMETRICSNVPROC glGetPathMetricsNV; +extern PFNGLGETPATHMETRICRANGENVPROC glGetPathMetricRangeNV; +extern PFNGLGETPATHSPACINGNVPROC glGetPathSpacingNV; +extern PFNGLISPOINTINFILLPATHNVPROC glIsPointInFillPathNV; +extern PFNGLISPOINTINSTROKEPATHNVPROC glIsPointInStrokePathNV; +extern PFNGLGETPATHLENGTHNVPROC glGetPathLengthNV; +extern PFNGLPOINTALONGPATHNVPROC glPointAlongPathNV; + +extern PFNGLMATRIXLOAD3X2FNVPROC glMatrixLoad3x2fNV; +extern PFNGLMATRIXLOAD3X3FNVPROC glMatrixLoad3x3fNV; +extern PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC glMatrixLoadTranspose3x3fNV; +extern PFNGLMATRIXMULT3X2FNVPROC glMatrixMult3x2fNV; +extern PFNGLMATRIXMULT3X3FNVPROC glMatrixMult3x3fNV; +extern PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC glMatrixMultTranspose3x3fNV; +extern PFNGLSTENCILTHENCOVERFILLPATHNVPROC glStencilThenCoverFillPathNV; +extern PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC glStencilThenCoverStrokePathNV; +extern PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC glStencilThenCoverFillPathInstancedNV; +extern PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC glStencilThenCoverStrokePathInstancedNV; +extern PFNGLPATHGLYPHINDEXRANGENVPROC glPathGlyphIndexRangeNV; + +extern PFNGLPATHGLYPHINDEXARRAYNVPROC glPathGlyphIndexArrayNV; +extern PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC glPathMemoryGlyphIndexArrayNV; +extern PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC glProgramPathFragmentInputGenNV; +extern PFNGLGETPROGRAMRESOURCEFVNVPROC glGetProgramResourcefvNV; + +extern PFNGLMATRIXFRUSTUMEXTPROC glMatrixFrustumEXT; +extern PFNGLMATRIXLOADIDENTITYEXTPROC glMatrixLoadIdentityEXT; +extern PFNGLMATRIXLOADTRANSPOSEFEXTPROC glMatrixLoadTransposefEXT; +extern PFNGLMATRIXLOADTRANSPOSEDEXTPROC glMatrixLoadTransposedEXT; +extern PFNGLMATRIXLOADFEXTPROC glMatrixLoadfEXT; +extern PFNGLMATRIXLOADDEXTPROC glMatrixLoaddEXT; +extern PFNGLMATRIXMULTTRANSPOSEFEXTPROC glMatrixMultTransposefEXT; +extern PFNGLMATRIXMULTTRANSPOSEDEXTPROC glMatrixMultTransposedEXT; +extern PFNGLMATRIXMULTFEXTPROC glMatrixMultfEXT; +extern PFNGLMATRIXMULTDEXTPROC glMatrixMultdEXT; +extern PFNGLMATRIXORTHOEXTPROC glMatrixOrthoEXT; +extern PFNGLMATRIXPOPEXTPROC glMatrixPopEXT; +extern PFNGLMATRIXPUSHEXTPROC glMatrixPushEXT; +extern PFNGLMATRIXROTATEFEXTPROC glMatrixRotatefEXT; +extern PFNGLMATRIXROTATEDEXTPROC glMatrixRotatedEXT; +extern PFNGLMATRIXSCALEFEXTPROC glMatrixScalefEXT; +extern PFNGLMATRIXSCALEDEXTPROC glMatrixScaledEXT; +extern PFNGLMATRIXTRANSLATEFEXTPROC glMatrixTranslatefEXT; +extern PFNGLMATRIXTRANSLATEDEXTPROC glMatrixTranslatedEXT; +#endif /* defined(GL_NV_path_rendering) */ + +#if defined(GL_NV_polygon_mode) +extern PFNGLPOLYGONMODENVPROC glPolygonModeNV; +#endif /* defined(GL_NV_polygon_mode) */ + +#if defined(GL_NV_read_buffer) +extern PFNGLREADBUFFERNVPROC glReadBufferNV; +#endif /* defined(GL_NV_read_buffer) */ + +#if defined(GL_NV_sample_locations) +extern PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC glFramebufferSampleLocationsfvNV; +extern PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC glNamedFramebufferSampleLocationsfvNV; +extern PFNGLRESOLVEDEPTHVALUESNVPROC glResolveDepthValuesNV; +#endif /* defined(GL_NV_sample_locations) */ + +#if defined(GL_NV_scissor_exclusive) +extern PFNGLSCISSOREXCLUSIVENVPROC glScissorExclusiveNV; +extern PFNGLSCISSOREXCLUSIVEARRAYVNVPROC glScissorExclusiveArrayvNV; +#endif /* defined(GL_NV_scissor_exclusive) */ + +#if defined(GL_NV_shading_rate_image) +extern PFNGLBINDSHADINGRATEIMAGENVPROC glBindShadingRateImageNV; +extern PFNGLGETSHADINGRATEIMAGEPALETTENVPROC glGetShadingRateImagePaletteNV; +extern PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC glGetShadingRateSampleLocationivNV; +extern PFNGLSHADINGRATEIMAGEBARRIERNVPROC glShadingRateImageBarrierNV; +extern PFNGLSHADINGRATEIMAGEPALETTENVPROC glShadingRateImagePaletteNV; +extern PFNGLSHADINGRATESAMPLEORDERNVPROC glShadingRateSampleOrderNV; +extern PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC glShadingRateSampleOrderCustomNV; +#endif /* defined(GL_NV_shading_rate_image) */ + +#if defined(GL_NV_viewport_array) +extern PFNGLVIEWPORTARRAYVNVPROC glViewportArrayvNV; +extern PFNGLVIEWPORTINDEXEDFNVPROC glViewportIndexedfNV; +extern PFNGLVIEWPORTINDEXEDFVNVPROC glViewportIndexedfvNV; +extern PFNGLSCISSORARRAYVNVPROC glScissorArrayvNV; +extern PFNGLSCISSORINDEXEDNVPROC glScissorIndexedNV; +extern PFNGLSCISSORINDEXEDVNVPROC glScissorIndexedvNV; +extern PFNGLDEPTHRANGEARRAYFVNVPROC glDepthRangeArrayfvNV; +extern PFNGLDEPTHRANGEINDEXEDFNVPROC glDepthRangeIndexedfNV; +extern PFNGLGETFLOATI_VNVPROC glGetFloati_vNV; +extern PFNGLENABLEINVPROC glEnableiNV; +extern PFNGLDISABLEINVPROC glDisableiNV; +extern PFNGLISENABLEDINVPROC glIsEnablediNV; +#endif /* defined(GL_NV_viewport_array) */ + +#if defined(GL_NV_viewport_swizzle) +extern PFNGLVIEWPORTSWIZZLENVPROC glViewportSwizzleNV; +#endif /* defined(GL_NV_viewport_swizzle) */ + +#if defined(GL_OES_EGL_image) +extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; +extern PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES; +#endif /* defined(GL_OES_EGL_image) */ + +#if defined(GL_OES_copy_image) +extern PFNGLCOPYIMAGESUBDATAOESPROC glCopyImageSubDataOES; +#endif /* defined(GL_OES_copy_image) */ + +#if defined(GL_OES_draw_buffers_indexed) +extern PFNGLENABLEIOESPROC glEnableiOES; +extern PFNGLDISABLEIOESPROC glDisableiOES; +extern PFNGLBLENDEQUATIONIOESPROC glBlendEquationiOES; +extern PFNGLBLENDEQUATIONSEPARATEIOESPROC glBlendEquationSeparateiOES; +extern PFNGLBLENDFUNCIOESPROC glBlendFunciOES; +extern PFNGLBLENDFUNCSEPARATEIOESPROC glBlendFuncSeparateiOES; +extern PFNGLCOLORMASKIOESPROC glColorMaskiOES; +extern PFNGLISENABLEDIOESPROC glIsEnablediOES; +#endif /* defined(GL_OES_draw_buffers_indexed) */ + +#if defined(GL_OES_draw_elements_base_vertex) +extern PFNGLDRAWELEMENTSBASEVERTEXOESPROC glDrawElementsBaseVertexOES; +extern PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC glDrawRangeElementsBaseVertexOES; +extern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC glDrawElementsInstancedBaseVertexOES; +#endif /* defined(GL_OES_draw_elements_base_vertex) */ + +#if defined(GL_OES_geometry_shader) +extern PFNGLFRAMEBUFFERTEXTUREOESPROC glFramebufferTextureOES; +#endif /* defined(GL_OES_geometry_shader) */ + +#if defined(GL_OES_get_program_binary) +extern PFNGLGETPROGRAMBINARYOESPROC glGetProgramBinaryOES; +extern PFNGLPROGRAMBINARYOESPROC glProgramBinaryOES; +#endif /* defined(GL_OES_get_program_binary) */ + +#if defined(GL_OES_mapbuffer) +extern PFNGLMAPBUFFEROESPROC glMapBufferOES; +extern PFNGLUNMAPBUFFEROESPROC glUnmapBufferOES; +extern PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointervOES; +#endif /* defined(GL_OES_mapbuffer) */ + +#if defined(GL_OES_primitive_bounding_box) +extern PFNGLPRIMITIVEBOUNDINGBOXOESPROC glPrimitiveBoundingBoxOES; +#endif /* defined(GL_OES_primitive_bounding_box) */ + +#if defined(GL_OES_sample_shading) +extern PFNGLMINSAMPLESHADINGOESPROC glMinSampleShadingOES; +#endif /* defined(GL_OES_sample_shading) */ + +#if defined(GL_OES_tessellation_shader) +extern PFNGLPATCHPARAMETERIOESPROC glPatchParameteriOES; +#endif /* defined(GL_OES_tessellation_shader) */ + +#if defined(GL_OES_texture_3D) +extern PFNGLTEXIMAGE3DOESPROC glTexImage3DOES; +extern PFNGLTEXSUBIMAGE3DOESPROC glTexSubImage3DOES; +extern PFNGLCOPYTEXSUBIMAGE3DOESPROC glCopyTexSubImage3DOES; +extern PFNGLCOMPRESSEDTEXIMAGE3DOESPROC glCompressedTexImage3DOES; +extern PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC glCompressedTexSubImage3DOES; +extern PFNGLFRAMEBUFFERTEXTURE3DOESPROC glFramebufferTexture3DOES; +#endif /* defined(GL_OES_texture_3D) */ + +#if defined(GL_OES_texture_border_clamp) +extern PFNGLTEXPARAMETERIIVOESPROC glTexParameterIivOES; +extern PFNGLTEXPARAMETERIUIVOESPROC glTexParameterIuivOES; +extern PFNGLGETTEXPARAMETERIIVOESPROC glGetTexParameterIivOES; +extern PFNGLGETTEXPARAMETERIUIVOESPROC glGetTexParameterIuivOES; +extern PFNGLSAMPLERPARAMETERIIVOESPROC glSamplerParameterIivOES; +extern PFNGLSAMPLERPARAMETERIUIVOESPROC glSamplerParameterIuivOES; +extern PFNGLGETSAMPLERPARAMETERIIVOESPROC glGetSamplerParameterIivOES; +extern PFNGLGETSAMPLERPARAMETERIUIVOESPROC glGetSamplerParameterIuivOES; +#endif /* defined(GL_OES_texture_border_clamp) */ + +#if defined(GL_OES_texture_buffer) +extern PFNGLTEXBUFFEROESPROC glTexBufferOES; +extern PFNGLTEXBUFFERRANGEOESPROC glTexBufferRangeOES; +#endif /* defined(GL_OES_texture_buffer) */ + +#if defined(GL_OES_texture_storage_multisample_2d_array) +extern PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC glTexStorage3DMultisampleOES; +#endif /* defined(GL_OES_texture_storage_multisample_2d_array) */ + +#if defined(GL_OES_texture_view) +extern PFNGLTEXTUREVIEWOESPROC glTextureViewOES; +#endif /* defined(GL_OES_texture_view) */ + +#if defined(GL_OES_vertex_array_object) +extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES; +extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES; +extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES; +extern PFNGLISVERTEXARRAYOESPROC glIsVertexArrayOES; +#endif /* defined(GL_OES_vertex_array_object) */ + +#if defined(GL_OES_viewport_array) +extern PFNGLVIEWPORTARRAYVOESPROC glViewportArrayvOES; +extern PFNGLVIEWPORTINDEXEDFOESPROC glViewportIndexedfOES; +extern PFNGLVIEWPORTINDEXEDFVOESPROC glViewportIndexedfvOES; +extern PFNGLSCISSORARRAYVOESPROC glScissorArrayvOES; +extern PFNGLSCISSORINDEXEDOESPROC glScissorIndexedOES; +extern PFNGLSCISSORINDEXEDVOESPROC glScissorIndexedvOES; +extern PFNGLDEPTHRANGEARRAYFVOESPROC glDepthRangeArrayfvOES; +extern PFNGLDEPTHRANGEINDEXEDFOESPROC glDepthRangeIndexedfOES; +extern PFNGLGETFLOATI_VOESPROC glGetFloati_vOES; +#endif /* defined(GL_OES_viewport_array) */ + +#if defined(GL_OVR_multiview) +extern PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC glFramebufferTextureMultiviewOVR; +#endif /* defined(GL_OVR_multiview) */ + +#if defined(GL_OVR_multiview_multisampled_render_to_texture) +extern PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC glFramebufferTextureMultisampleMultiviewOVR; +#endif /* defined(GL_OVR_multiview_multisampled_render_to_texture) */ + +#if defined(GL_QCOM_alpha_test) +extern PFNGLALPHAFUNCQCOMPROC glAlphaFuncQCOM; +#endif /* defined(GL_QCOM_alpha_test) */ + +#if defined(GL_QCOM_driver_control) +extern PFNGLGETDRIVERCONTROLSQCOMPROC glGetDriverControlsQCOM; +extern PFNGLGETDRIVERCONTROLSTRINGQCOMPROC glGetDriverControlStringQCOM; +extern PFNGLENABLEDRIVERCONTROLQCOMPROC glEnableDriverControlQCOM; +extern PFNGLDISABLEDRIVERCONTROLQCOMPROC glDisableDriverControlQCOM; +#endif /* defined(GL_QCOM_driver_control) */ + +#if defined(GL_QCOM_extended_get) +extern PFNGLEXTGETTEXTURESQCOMPROC glExtGetTexturesQCOM; +extern PFNGLEXTGETBUFFERSQCOMPROC glExtGetBuffersQCOM; +extern PFNGLEXTGETRENDERBUFFERSQCOMPROC glExtGetRenderbuffersQCOM; +extern PFNGLEXTGETFRAMEBUFFERSQCOMPROC glExtGetFramebuffersQCOM; +extern PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC glExtGetTexLevelParameterivQCOM; +extern PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC glExtTexObjectStateOverrideiQCOM; +extern PFNGLEXTGETTEXSUBIMAGEQCOMPROC glExtGetTexSubImageQCOM; +extern PFNGLEXTGETBUFFERPOINTERVQCOMPROC glExtGetBufferPointervQCOM; +#endif /* defined(GL_QCOM_extended_get) */ + +#if defined(GL_QCOM_extended_get2) +extern PFNGLEXTGETSHADERSQCOMPROC glExtGetShadersQCOM; +extern PFNGLEXTGETPROGRAMSQCOMPROC glExtGetProgramsQCOM; +extern PFNGLEXTISPROGRAMBINARYQCOMPROC glExtIsProgramBinaryQCOM; +extern PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC glExtGetProgramBinarySourceQCOM; +#endif /* defined(GL_QCOM_extended_get2) */ + +#if defined(GL_QCOM_framebuffer_foveated) +extern PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC glFramebufferFoveationConfigQCOM; +extern PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC glFramebufferFoveationParametersQCOM; +#endif /* defined(GL_QCOM_framebuffer_foveated) */ + +#if defined(GL_QCOM_motion_estimation) +extern PFNGLTEXESTIMATEMOTIONQCOMPROC glTexEstimateMotionQCOM; +extern PFNGLTEXESTIMATEMOTIONREGIONSQCOMPROC glTexEstimateMotionRegionsQCOM; +#endif /* defined(GL_QCOM_motion_estimation) */ + +#if defined(GL_QCOM_frame_extrapolation) +extern PFNGLEXTRAPOLATETEX2DQCOMPROC glExtrapolateTex2DQCOM; +#endif /* defined(GL_QCOM_frame_extrapolation) */ + +#if defined(GL_QCOM_texture_foveated) +extern PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC glTextureFoveationParametersQCOM; +#endif /* defined(GL_QCOM_texture_foveated) */ + +#if defined(GL_QCOM_shader_framebuffer_fetch_noncoherent) +extern PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC glFramebufferFetchBarrierQCOM; +#endif /* defined(GL_QCOM_shader_framebuffer_fetch_noncoherent) */ + +#if defined(GL_QCOM_shading_rate) +extern PFNGLSHADINGRATEQCOMPROC glShadingRateQCOM; +#endif /* defined(GL_QCOM_shading_rate) */ + +#if defined(GL_QCOM_tiled_rendering) +extern PFNGLSTARTTILINGQCOMPROC glStartTilingQCOM; +extern PFNGLENDTILINGQCOMPROC glEndTilingQCOM; +#endif /* defined(GL_QCOM_tiled_rendering) */ + +/* GLES2W_GENERATE_GLES_DECLARATION */ + +/** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ + +using PFNGLES2WLOADPROC = void *(*)(const char *); +void gles2wLoadProcs(PFNGLES2WLOADPROC gles2wLoad); diff --git a/native/cocos/renderer/gfx-gles-common/gles3w.cpp b/native/cocos/renderer/gfx-gles-common/gles3w.cpp new file mode 100644 index 0000000000..ecb7a82518 --- /dev/null +++ b/native/cocos/renderer/gfx-gles-common/gles3w.cpp @@ -0,0 +1,556 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 GL_GLES_PROTOTYPES 0 +#include + +#include +#include + +#include "gles3w.h" + +/** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + +/* GLES3W_GENERATE_GLES_DEFINITION */ +/* GL_ES_VERSION_3_0 */ +PFNGLREADBUFFERPROC glReadBuffer; +PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; +PFNGLTEXIMAGE3DPROC glTexImage3D; +PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D; +PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D; +PFNGLGENQUERIESPROC glGenQueries; +PFNGLDELETEQUERIESPROC glDeleteQueries; +PFNGLISQUERYPROC glIsQuery; +PFNGLBEGINQUERYPROC glBeginQuery; +PFNGLENDQUERYPROC glEndQuery; +PFNGLGETQUERYIVPROC glGetQueryiv; +PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv; +PFNGLUNMAPBUFFERPROC glUnmapBuffer; +PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv; +PFNGLDRAWBUFFERSPROC glDrawBuffers; +PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv; +PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv; +PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv; +PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv; +PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv; +PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv; +PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer; +PFNGLMAPBUFFERRANGEPROC glMapBufferRange; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; +PFNGLBINDVERTEXARRAYPROC glBindVertexArray; +PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; +PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; +PFNGLISVERTEXARRAYPROC glIsVertexArray; +PFNGLGETINTEGERI_VPROC glGetIntegeri_v; +PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback; +PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback; +PFNGLBINDBUFFERRANGEPROC glBindBufferRange; +PFNGLBINDBUFFERBASEPROC glBindBufferBase; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glGetTransformFeedbackVarying; +PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer; +PFNGLGETVERTEXATTRIBIIVPROC glGetVertexAttribIiv; +PFNGLGETVERTEXATTRIBIUIVPROC glGetVertexAttribIuiv; +PFNGLVERTEXATTRIBI4IPROC glVertexAttribI4i; +PFNGLVERTEXATTRIBI4UIPROC glVertexAttribI4ui; +PFNGLVERTEXATTRIBI4IVPROC glVertexAttribI4iv; +PFNGLVERTEXATTRIBI4UIVPROC glVertexAttribI4uiv; +PFNGLGETUNIFORMUIVPROC glGetUniformuiv; +PFNGLGETFRAGDATALOCATIONPROC glGetFragDataLocation; +PFNGLUNIFORM1UIPROC glUniform1ui; +PFNGLUNIFORM2UIPROC glUniform2ui; +PFNGLUNIFORM3UIPROC glUniform3ui; +PFNGLUNIFORM4UIPROC glUniform4ui; +PFNGLUNIFORM1UIVPROC glUniform1uiv; +PFNGLUNIFORM2UIVPROC glUniform2uiv; +PFNGLUNIFORM3UIVPROC glUniform3uiv; +PFNGLUNIFORM4UIVPROC glUniform4uiv; +PFNGLCLEARBUFFERIVPROC glClearBufferiv; +PFNGLCLEARBUFFERUIVPROC glClearBufferuiv; +PFNGLCLEARBUFFERFVPROC glClearBufferfv; +PFNGLCLEARBUFFERFIPROC glClearBufferfi; +PFNGLGETSTRINGIPROC glGetStringi; +PFNGLCOPYBUFFERSUBDATAPROC glCopyBufferSubData; +PFNGLGETUNIFORMINDICESPROC glGetUniformIndices; +PFNGLGETACTIVEUNIFORMSIVPROC glGetActiveUniformsiv; +PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC glGetActiveUniformBlockiv; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName; +PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding; +PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced; +PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced; +PFNGLFENCESYNCPROC glFenceSync; +PFNGLISSYNCPROC glIsSync; +PFNGLDELETESYNCPROC glDeleteSync; +PFNGLCLIENTWAITSYNCPROC glClientWaitSync; +PFNGLWAITSYNCPROC glWaitSync; +PFNGLGETINTEGER64VPROC glGetInteger64v; +PFNGLGETSYNCIVPROC glGetSynciv; +PFNGLGETINTEGER64I_VPROC glGetInteger64i_v; +PFNGLGETBUFFERPARAMETERI64VPROC glGetBufferParameteri64v; +PFNGLGENSAMPLERSPROC glGenSamplers; +PFNGLDELETESAMPLERSPROC glDeleteSamplers; +PFNGLISSAMPLERPROC glIsSampler; +PFNGLBINDSAMPLERPROC glBindSampler; +PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri; +PFNGLSAMPLERPARAMETERIVPROC glSamplerParameteriv; +PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf; +PFNGLSAMPLERPARAMETERFVPROC glSamplerParameterfv; +PFNGLGETSAMPLERPARAMETERIVPROC glGetSamplerParameteriv; +PFNGLGETSAMPLERPARAMETERFVPROC glGetSamplerParameterfv; +PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor; +PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback; +PFNGLDELETETRANSFORMFEEDBACKSPROC glDeleteTransformFeedbacks; +PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks; +PFNGLISTRANSFORMFEEDBACKPROC glIsTransformFeedback; +PFNGLPAUSETRANSFORMFEEDBACKPROC glPauseTransformFeedback; +PFNGLRESUMETRANSFORMFEEDBACKPROC glResumeTransformFeedback; +PFNGLGETPROGRAMBINARYPROC glGetProgramBinary; +PFNGLPROGRAMBINARYPROC glProgramBinary; +PFNGLPROGRAMPARAMETERIPROC glProgramParameteri; +PFNGLINVALIDATEFRAMEBUFFERPROC glInvalidateFramebuffer; +PFNGLINVALIDATESUBFRAMEBUFFERPROC glInvalidateSubFramebuffer; +PFNGLTEXSTORAGE2DPROC glTexStorage2D; +PFNGLTEXSTORAGE3DPROC glTexStorage3D; +PFNGLGETINTERNALFORMATIVPROC glGetInternalformativ; + + +/* GL_ES_VERSION_3_1 */ +PFNGLDISPATCHCOMPUTEPROC glDispatchCompute; +PFNGLDISPATCHCOMPUTEINDIRECTPROC glDispatchComputeIndirect; + +PFNGLDRAWARRAYSINDIRECTPROC glDrawArraysIndirect; +PFNGLDRAWELEMENTSINDIRECTPROC glDrawElementsIndirect; + +PFNGLFRAMEBUFFERPARAMETERIPROC glFramebufferParameteri; +PFNGLGETFRAMEBUFFERPARAMETERIVPROC glGetFramebufferParameteriv; + +PFNGLGETPROGRAMINTERFACEIVPROC glGetProgramInterfaceiv; +PFNGLGETPROGRAMRESOURCEINDEXPROC glGetProgramResourceIndex; +PFNGLGETPROGRAMRESOURCENAMEPROC glGetProgramResourceName; +PFNGLGETPROGRAMRESOURCEIVPROC glGetProgramResourceiv; +PFNGLGETPROGRAMRESOURCELOCATIONPROC glGetProgramResourceLocation; + +PFNGLUSEPROGRAMSTAGESPROC glUseProgramStages; +PFNGLACTIVESHADERPROGRAMPROC glActiveShaderProgram; +PFNGLCREATESHADERPROGRAMVPROC glCreateShaderProgramv; +PFNGLBINDPROGRAMPIPELINEPROC glBindProgramPipeline; +PFNGLDELETEPROGRAMPIPELINESPROC glDeleteProgramPipelines; +PFNGLGENPROGRAMPIPELINESPROC glGenProgramPipelines; +PFNGLISPROGRAMPIPELINEPROC glIsProgramPipeline; +PFNGLGETPROGRAMPIPELINEIVPROC glGetProgramPipelineiv; +PFNGLPROGRAMUNIFORM1IPROC glProgramUniform1i; +PFNGLPROGRAMUNIFORM2IPROC glProgramUniform2i; +PFNGLPROGRAMUNIFORM3IPROC glProgramUniform3i; +PFNGLPROGRAMUNIFORM4IPROC glProgramUniform4i; +PFNGLPROGRAMUNIFORM1UIPROC glProgramUniform1ui; +PFNGLPROGRAMUNIFORM2UIPROC glProgramUniform2ui; +PFNGLPROGRAMUNIFORM3UIPROC glProgramUniform3ui; +PFNGLPROGRAMUNIFORM4UIPROC glProgramUniform4ui; +PFNGLPROGRAMUNIFORM1FPROC glProgramUniform1f; +PFNGLPROGRAMUNIFORM2FPROC glProgramUniform2f; +PFNGLPROGRAMUNIFORM3FPROC glProgramUniform3f; +PFNGLPROGRAMUNIFORM4FPROC glProgramUniform4f; +PFNGLPROGRAMUNIFORM1IVPROC glProgramUniform1iv; +PFNGLPROGRAMUNIFORM2IVPROC glProgramUniform2iv; +PFNGLPROGRAMUNIFORM3IVPROC glProgramUniform3iv; +PFNGLPROGRAMUNIFORM4IVPROC glProgramUniform4iv; +PFNGLPROGRAMUNIFORM1UIVPROC glProgramUniform1uiv; +PFNGLPROGRAMUNIFORM2UIVPROC glProgramUniform2uiv; +PFNGLPROGRAMUNIFORM3UIVPROC glProgramUniform3uiv; +PFNGLPROGRAMUNIFORM4UIVPROC glProgramUniform4uiv; +PFNGLPROGRAMUNIFORM1FVPROC glProgramUniform1fv; +PFNGLPROGRAMUNIFORM2FVPROC glProgramUniform2fv; +PFNGLPROGRAMUNIFORM3FVPROC glProgramUniform3fv; +PFNGLPROGRAMUNIFORM4FVPROC glProgramUniform4fv; +PFNGLPROGRAMUNIFORMMATRIX2FVPROC glProgramUniformMatrix2fv; +PFNGLPROGRAMUNIFORMMATRIX3FVPROC glProgramUniformMatrix3fv; +PFNGLPROGRAMUNIFORMMATRIX4FVPROC glProgramUniformMatrix4fv; +PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glProgramUniformMatrix2x3fv; +PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glProgramUniformMatrix3x2fv; +PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glProgramUniformMatrix2x4fv; +PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glProgramUniformMatrix4x2fv; +PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glProgramUniformMatrix3x4fv; +PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glProgramUniformMatrix4x3fv; +PFNGLVALIDATEPROGRAMPIPELINEPROC glValidateProgramPipeline; +PFNGLGETPROGRAMPIPELINEINFOLOGPROC glGetProgramPipelineInfoLog; + +PFNGLBINDIMAGETEXTUREPROC glBindImageTexture; +PFNGLGETBOOLEANI_VPROC glGetBooleani_v; +PFNGLMEMORYBARRIERPROC glMemoryBarrier; +PFNGLMEMORYBARRIERBYREGIONPROC glMemoryBarrierByRegion; + +PFNGLTEXSTORAGE2DMULTISAMPLEPROC glTexStorage2DMultisample; +PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv; +PFNGLSAMPLEMASKIPROC glSampleMaski; +PFNGLGETTEXLEVELPARAMETERIVPROC glGetTexLevelParameteriv; +PFNGLGETTEXLEVELPARAMETERFVPROC glGetTexLevelParameterfv; + +PFNGLBINDVERTEXBUFFERPROC glBindVertexBuffer; +PFNGLVERTEXATTRIBFORMATPROC glVertexAttribFormat; +PFNGLVERTEXATTRIBIFORMATPROC glVertexAttribIFormat; +PFNGLVERTEXATTRIBBINDINGPROC glVertexAttribBinding; +PFNGLVERTEXBINDINGDIVISORPROC glVertexBindingDivisor; + + +/* GL_ES_VERSION_3_2 */ +PFNGLBLENDBARRIERPROC glBlendBarrier; + +PFNGLCOPYIMAGESUBDATAPROC glCopyImageSubData; + +PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl; +PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert; +PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback; +PFNGLGETDEBUGMESSAGELOGPROC glGetDebugMessageLog; +PFNGLPUSHDEBUGGROUPPROC glPushDebugGroup; +PFNGLPOPDEBUGGROUPPROC glPopDebugGroup; +PFNGLOBJECTLABELPROC glObjectLabel; +PFNGLGETOBJECTLABELPROC glGetObjectLabel; +PFNGLOBJECTPTRLABELPROC glObjectPtrLabel; +PFNGLGETOBJECTPTRLABELPROC glGetObjectPtrLabel; +PFNGLGETPOINTERVPROC glGetPointerv; + +PFNGLENABLEIPROC glEnablei; +PFNGLDISABLEIPROC glDisablei; +PFNGLBLENDEQUATIONIPROC glBlendEquationi; +PFNGLBLENDEQUATIONSEPARATEIPROC glBlendEquationSeparatei; +PFNGLBLENDFUNCIPROC glBlendFunci; +PFNGLBLENDFUNCSEPARATEIPROC glBlendFuncSeparatei; +PFNGLCOLORMASKIPROC glColorMaski; +PFNGLISENABLEDIPROC glIsEnabledi; + +PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glDrawRangeElementsBaseVertex; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glDrawElementsInstancedBaseVertex; + +PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture; + +PFNGLPRIMITIVEBOUNDINGBOXPROC glPrimitiveBoundingBox; + +PFNGLGETGRAPHICSRESETSTATUSPROC glGetGraphicsResetStatus; +PFNGLREADNPIXELSPROC glReadnPixels; +PFNGLGETNUNIFORMFVPROC glGetnUniformfv; +PFNGLGETNUNIFORMIVPROC glGetnUniformiv; +PFNGLGETNUNIFORMUIVPROC glGetnUniformuiv; + +PFNGLMINSAMPLESHADINGPROC glMinSampleShading; + +PFNGLPATCHPARAMETERIPROC glPatchParameteri; + +PFNGLTEXPARAMETERIIVPROC glTexParameterIiv; +PFNGLTEXPARAMETERIUIVPROC glTexParameterIuiv; +PFNGLGETTEXPARAMETERIIVPROC glGetTexParameterIiv; +PFNGLGETTEXPARAMETERIUIVPROC glGetTexParameterIuiv; +PFNGLSAMPLERPARAMETERIIVPROC glSamplerParameterIiv; +PFNGLSAMPLERPARAMETERIUIVPROC glSamplerParameterIuiv; +PFNGLGETSAMPLERPARAMETERIIVPROC glGetSamplerParameterIiv; +PFNGLGETSAMPLERPARAMETERIUIVPROC glGetSamplerParameterIuiv; + +PFNGLTEXBUFFERPROC glTexBuffer; +PFNGLTEXBUFFERRANGEPROC glTexBufferRange; + +PFNGLTEXSTORAGE3DMULTISAMPLEPROC glTexStorage3DMultisample; + + +/* GLES3W_GENERATE_GLES_DEFINITION */ + +/** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ + +void gles3wLoadProcs(PFNGLES3WLOADPROC gles3wLoad) { + /** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + + /* GLES3W_GENERATE_GLES_LOAD */ + /* GL_ES_VERSION_3_0 */ + glReadBuffer = (PFNGLREADBUFFERPROC)gles3wLoad("glReadBuffer"); + glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)gles3wLoad("glDrawRangeElements"); + glTexImage3D = (PFNGLTEXIMAGE3DPROC)gles3wLoad("glTexImage3D"); + glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)gles3wLoad("glTexSubImage3D"); + glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)gles3wLoad("glCopyTexSubImage3D"); + glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)gles3wLoad("glCompressedTexImage3D"); + glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)gles3wLoad("glCompressedTexSubImage3D"); + glGenQueries = (PFNGLGENQUERIESPROC)gles3wLoad("glGenQueries"); + glDeleteQueries = (PFNGLDELETEQUERIESPROC)gles3wLoad("glDeleteQueries"); + glIsQuery = (PFNGLISQUERYPROC)gles3wLoad("glIsQuery"); + glBeginQuery = (PFNGLBEGINQUERYPROC)gles3wLoad("glBeginQuery"); + glEndQuery = (PFNGLENDQUERYPROC)gles3wLoad("glEndQuery"); + glGetQueryiv = (PFNGLGETQUERYIVPROC)gles3wLoad("glGetQueryiv"); + glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)gles3wLoad("glGetQueryObjectuiv"); + glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)gles3wLoad("glUnmapBuffer"); + glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)gles3wLoad("glGetBufferPointerv"); + glDrawBuffers = (PFNGLDRAWBUFFERSPROC)gles3wLoad("glDrawBuffers"); + glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)gles3wLoad("glUniformMatrix2x3fv"); + glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)gles3wLoad("glUniformMatrix3x2fv"); + glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)gles3wLoad("glUniformMatrix2x4fv"); + glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)gles3wLoad("glUniformMatrix4x2fv"); + glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)gles3wLoad("glUniformMatrix3x4fv"); + glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)gles3wLoad("glUniformMatrix4x3fv"); + glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)gles3wLoad("glBlitFramebuffer"); + glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)gles3wLoad("glRenderbufferStorageMultisample"); + glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)gles3wLoad("glFramebufferTextureLayer"); + glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)gles3wLoad("glMapBufferRange"); + glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)gles3wLoad("glFlushMappedBufferRange"); + glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)gles3wLoad("glBindVertexArray"); + glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)gles3wLoad("glDeleteVertexArrays"); + glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)gles3wLoad("glGenVertexArrays"); + glIsVertexArray = (PFNGLISVERTEXARRAYPROC)gles3wLoad("glIsVertexArray"); + glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)gles3wLoad("glGetIntegeri_v"); + glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)gles3wLoad("glBeginTransformFeedback"); + glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)gles3wLoad("glEndTransformFeedback"); + glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)gles3wLoad("glBindBufferRange"); + glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)gles3wLoad("glBindBufferBase"); + glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)gles3wLoad("glTransformFeedbackVaryings"); + glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)gles3wLoad("glGetTransformFeedbackVarying"); + glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)gles3wLoad("glVertexAttribIPointer"); + glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)gles3wLoad("glGetVertexAttribIiv"); + glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)gles3wLoad("glGetVertexAttribIuiv"); + glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)gles3wLoad("glVertexAttribI4i"); + glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)gles3wLoad("glVertexAttribI4ui"); + glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)gles3wLoad("glVertexAttribI4iv"); + glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)gles3wLoad("glVertexAttribI4uiv"); + glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)gles3wLoad("glGetUniformuiv"); + glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)gles3wLoad("glGetFragDataLocation"); + glUniform1ui = (PFNGLUNIFORM1UIPROC)gles3wLoad("glUniform1ui"); + glUniform2ui = (PFNGLUNIFORM2UIPROC)gles3wLoad("glUniform2ui"); + glUniform3ui = (PFNGLUNIFORM3UIPROC)gles3wLoad("glUniform3ui"); + glUniform4ui = (PFNGLUNIFORM4UIPROC)gles3wLoad("glUniform4ui"); + glUniform1uiv = (PFNGLUNIFORM1UIVPROC)gles3wLoad("glUniform1uiv"); + glUniform2uiv = (PFNGLUNIFORM2UIVPROC)gles3wLoad("glUniform2uiv"); + glUniform3uiv = (PFNGLUNIFORM3UIVPROC)gles3wLoad("glUniform3uiv"); + glUniform4uiv = (PFNGLUNIFORM4UIVPROC)gles3wLoad("glUniform4uiv"); + glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)gles3wLoad("glClearBufferiv"); + glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)gles3wLoad("glClearBufferuiv"); + glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)gles3wLoad("glClearBufferfv"); + glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)gles3wLoad("glClearBufferfi"); + glGetStringi = (PFNGLGETSTRINGIPROC)gles3wLoad("glGetStringi"); + glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)gles3wLoad("glCopyBufferSubData"); + glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)gles3wLoad("glGetUniformIndices"); + glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)gles3wLoad("glGetActiveUniformsiv"); + glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)gles3wLoad("glGetUniformBlockIndex"); + glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)gles3wLoad("glGetActiveUniformBlockiv"); + glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)gles3wLoad("glGetActiveUniformBlockName"); + glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)gles3wLoad("glUniformBlockBinding"); + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)gles3wLoad("glDrawArraysInstanced"); + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)gles3wLoad("glDrawElementsInstanced"); + glFenceSync = (PFNGLFENCESYNCPROC)gles3wLoad("glFenceSync"); + glIsSync = (PFNGLISSYNCPROC)gles3wLoad("glIsSync"); + glDeleteSync = (PFNGLDELETESYNCPROC)gles3wLoad("glDeleteSync"); + glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)gles3wLoad("glClientWaitSync"); + glWaitSync = (PFNGLWAITSYNCPROC)gles3wLoad("glWaitSync"); + glGetInteger64v = (PFNGLGETINTEGER64VPROC)gles3wLoad("glGetInteger64v"); + glGetSynciv = (PFNGLGETSYNCIVPROC)gles3wLoad("glGetSynciv"); + glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)gles3wLoad("glGetInteger64i_v"); + glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)gles3wLoad("glGetBufferParameteri64v"); + glGenSamplers = (PFNGLGENSAMPLERSPROC)gles3wLoad("glGenSamplers"); + glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)gles3wLoad("glDeleteSamplers"); + glIsSampler = (PFNGLISSAMPLERPROC)gles3wLoad("glIsSampler"); + glBindSampler = (PFNGLBINDSAMPLERPROC)gles3wLoad("glBindSampler"); + glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)gles3wLoad("glSamplerParameteri"); + glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)gles3wLoad("glSamplerParameteriv"); + glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)gles3wLoad("glSamplerParameterf"); + glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)gles3wLoad("glSamplerParameterfv"); + glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)gles3wLoad("glGetSamplerParameteriv"); + glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)gles3wLoad("glGetSamplerParameterfv"); + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)gles3wLoad("glVertexAttribDivisor"); + glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)gles3wLoad("glBindTransformFeedback"); + glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)gles3wLoad("glDeleteTransformFeedbacks"); + glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)gles3wLoad("glGenTransformFeedbacks"); + glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)gles3wLoad("glIsTransformFeedback"); + glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)gles3wLoad("glPauseTransformFeedback"); + glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)gles3wLoad("glResumeTransformFeedback"); + glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)gles3wLoad("glGetProgramBinary"); + glProgramBinary = (PFNGLPROGRAMBINARYPROC)gles3wLoad("glProgramBinary"); + glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)gles3wLoad("glProgramParameteri"); + glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)gles3wLoad("glInvalidateFramebuffer"); + glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)gles3wLoad("glInvalidateSubFramebuffer"); + glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)gles3wLoad("glTexStorage2D"); + glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)gles3wLoad("glTexStorage3D"); + glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)gles3wLoad("glGetInternalformativ"); + + + /* GL_ES_VERSION_3_1 */ + glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)gles3wLoad("glDispatchCompute"); + glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)gles3wLoad("glDispatchComputeIndirect"); + + glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)gles3wLoad("glDrawArraysIndirect"); + glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)gles3wLoad("glDrawElementsIndirect"); + + glFramebufferParameteri = (PFNGLFRAMEBUFFERPARAMETERIPROC)gles3wLoad("glFramebufferParameteri"); + glGetFramebufferParameteriv = (PFNGLGETFRAMEBUFFERPARAMETERIVPROC)gles3wLoad("glGetFramebufferParameteriv"); + + glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC)gles3wLoad("glGetProgramInterfaceiv"); + glGetProgramResourceIndex = (PFNGLGETPROGRAMRESOURCEINDEXPROC)gles3wLoad("glGetProgramResourceIndex"); + glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC)gles3wLoad("glGetProgramResourceName"); + glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC)gles3wLoad("glGetProgramResourceiv"); + glGetProgramResourceLocation = (PFNGLGETPROGRAMRESOURCELOCATIONPROC)gles3wLoad("glGetProgramResourceLocation"); + + glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)gles3wLoad("glUseProgramStages"); + glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)gles3wLoad("glActiveShaderProgram"); + glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)gles3wLoad("glCreateShaderProgramv"); + glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)gles3wLoad("glBindProgramPipeline"); + glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)gles3wLoad("glDeleteProgramPipelines"); + glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)gles3wLoad("glGenProgramPipelines"); + glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)gles3wLoad("glIsProgramPipeline"); + glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)gles3wLoad("glGetProgramPipelineiv"); + glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)gles3wLoad("glProgramUniform1i"); + glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)gles3wLoad("glProgramUniform2i"); + glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)gles3wLoad("glProgramUniform3i"); + glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)gles3wLoad("glProgramUniform4i"); + glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)gles3wLoad("glProgramUniform1ui"); + glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)gles3wLoad("glProgramUniform2ui"); + glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)gles3wLoad("glProgramUniform3ui"); + glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)gles3wLoad("glProgramUniform4ui"); + glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)gles3wLoad("glProgramUniform1f"); + glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)gles3wLoad("glProgramUniform2f"); + glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)gles3wLoad("glProgramUniform3f"); + glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)gles3wLoad("glProgramUniform4f"); + glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)gles3wLoad("glProgramUniform1iv"); + glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)gles3wLoad("glProgramUniform2iv"); + glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)gles3wLoad("glProgramUniform3iv"); + glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)gles3wLoad("glProgramUniform4iv"); + glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)gles3wLoad("glProgramUniform1uiv"); + glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)gles3wLoad("glProgramUniform2uiv"); + glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)gles3wLoad("glProgramUniform3uiv"); + glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)gles3wLoad("glProgramUniform4uiv"); + glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)gles3wLoad("glProgramUniform1fv"); + glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)gles3wLoad("glProgramUniform2fv"); + glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)gles3wLoad("glProgramUniform3fv"); + glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)gles3wLoad("glProgramUniform4fv"); + glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)gles3wLoad("glProgramUniformMatrix2fv"); + glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)gles3wLoad("glProgramUniformMatrix3fv"); + glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)gles3wLoad("glProgramUniformMatrix4fv"); + glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)gles3wLoad("glProgramUniformMatrix2x3fv"); + glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)gles3wLoad("glProgramUniformMatrix3x2fv"); + glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)gles3wLoad("glProgramUniformMatrix2x4fv"); + glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)gles3wLoad("glProgramUniformMatrix4x2fv"); + glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)gles3wLoad("glProgramUniformMatrix3x4fv"); + glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)gles3wLoad("glProgramUniformMatrix4x3fv"); + glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)gles3wLoad("glValidateProgramPipeline"); + glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)gles3wLoad("glGetProgramPipelineInfoLog"); + + glBindImageTexture = (PFNGLBINDIMAGETEXTUREPROC)gles3wLoad("glBindImageTexture"); + glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)gles3wLoad("glGetBooleani_v"); + glMemoryBarrier = (PFNGLMEMORYBARRIERPROC)gles3wLoad("glMemoryBarrier"); + glMemoryBarrierByRegion = (PFNGLMEMORYBARRIERBYREGIONPROC)gles3wLoad("glMemoryBarrierByRegion"); + + glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)gles3wLoad("glTexStorage2DMultisample"); + glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)gles3wLoad("glGetMultisamplefv"); + glSampleMaski = (PFNGLSAMPLEMASKIPROC)gles3wLoad("glSampleMaski"); + glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)gles3wLoad("glGetTexLevelParameteriv"); + glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)gles3wLoad("glGetTexLevelParameterfv"); + + glBindVertexBuffer = (PFNGLBINDVERTEXBUFFERPROC)gles3wLoad("glBindVertexBuffer"); + glVertexAttribFormat = (PFNGLVERTEXATTRIBFORMATPROC)gles3wLoad("glVertexAttribFormat"); + glVertexAttribIFormat = (PFNGLVERTEXATTRIBIFORMATPROC)gles3wLoad("glVertexAttribIFormat"); + glVertexAttribBinding = (PFNGLVERTEXATTRIBBINDINGPROC)gles3wLoad("glVertexAttribBinding"); + glVertexBindingDivisor = (PFNGLVERTEXBINDINGDIVISORPROC)gles3wLoad("glVertexBindingDivisor"); + + + /* GL_ES_VERSION_3_2 */ + glBlendBarrier = (PFNGLBLENDBARRIERPROC)gles3wLoad("glBlendBarrier"); + + glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)gles3wLoad("glCopyImageSubData"); + + glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)gles3wLoad("glDebugMessageControl"); + glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)gles3wLoad("glDebugMessageInsert"); + glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)gles3wLoad("glDebugMessageCallback"); + glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)gles3wLoad("glGetDebugMessageLog"); + glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)gles3wLoad("glPushDebugGroup"); + glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC)gles3wLoad("glPopDebugGroup"); + glObjectLabel = (PFNGLOBJECTLABELPROC)gles3wLoad("glObjectLabel"); + glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)gles3wLoad("glGetObjectLabel"); + glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)gles3wLoad("glObjectPtrLabel"); + glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)gles3wLoad("glGetObjectPtrLabel"); + glGetPointerv = (PFNGLGETPOINTERVPROC)gles3wLoad("glGetPointerv"); + + glEnablei = (PFNGLENABLEIPROC)gles3wLoad("glEnablei"); + glDisablei = (PFNGLDISABLEIPROC)gles3wLoad("glDisablei"); + glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)gles3wLoad("glBlendEquationi"); + glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)gles3wLoad("glBlendEquationSeparatei"); + glBlendFunci = (PFNGLBLENDFUNCIPROC)gles3wLoad("glBlendFunci"); + glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)gles3wLoad("glBlendFuncSeparatei"); + glColorMaski = (PFNGLCOLORMASKIPROC)gles3wLoad("glColorMaski"); + glIsEnabledi = (PFNGLISENABLEDIPROC)gles3wLoad("glIsEnabledi"); + + glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)gles3wLoad("glDrawElementsBaseVertex"); + glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)gles3wLoad("glDrawRangeElementsBaseVertex"); + glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)gles3wLoad("glDrawElementsInstancedBaseVertex"); + + glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)gles3wLoad("glFramebufferTexture"); + + glPrimitiveBoundingBox = (PFNGLPRIMITIVEBOUNDINGBOXPROC)gles3wLoad("glPrimitiveBoundingBox"); + + glGetGraphicsResetStatus = (PFNGLGETGRAPHICSRESETSTATUSPROC)gles3wLoad("glGetGraphicsResetStatus"); + glReadnPixels = (PFNGLREADNPIXELSPROC)gles3wLoad("glReadnPixels"); + glGetnUniformfv = (PFNGLGETNUNIFORMFVPROC)gles3wLoad("glGetnUniformfv"); + glGetnUniformiv = (PFNGLGETNUNIFORMIVPROC)gles3wLoad("glGetnUniformiv"); + glGetnUniformuiv = (PFNGLGETNUNIFORMUIVPROC)gles3wLoad("glGetnUniformuiv"); + + glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)gles3wLoad("glMinSampleShading"); + + glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)gles3wLoad("glPatchParameteri"); + + glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)gles3wLoad("glTexParameterIiv"); + glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)gles3wLoad("glTexParameterIuiv"); + glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)gles3wLoad("glGetTexParameterIiv"); + glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)gles3wLoad("glGetTexParameterIuiv"); + glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)gles3wLoad("glSamplerParameterIiv"); + glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)gles3wLoad("glSamplerParameterIuiv"); + glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)gles3wLoad("glGetSamplerParameterIiv"); + glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)gles3wLoad("glGetSamplerParameterIuiv"); + + glTexBuffer = (PFNGLTEXBUFFERPROC)gles3wLoad("glTexBuffer"); + glTexBufferRange = (PFNGLTEXBUFFERRANGEPROC)gles3wLoad("glTexBufferRange"); + + glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)gles3wLoad("glTexStorage3DMultisample"); + + + /* GLES3W_GENERATE_GLES_LOAD */ + + /** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ +} diff --git a/native/cocos/renderer/gfx-gles-common/gles3w.h b/native/cocos/renderer/gfx-gles-common/gles3w.h new file mode 100644 index 0000000000..33ee2f8fb1 --- /dev/null +++ b/native/cocos/renderer/gfx-gles-common/gles3w.h @@ -0,0 +1,290 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +/** + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + * The following section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= + */ + +/* GLES3W_GENERATE_GLES_DECLARATION */ +/* GL_ES_VERSION_3_0 */ +extern PFNGLREADBUFFERPROC glReadBuffer; +extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements; +extern PFNGLTEXIMAGE3DPROC glTexImage3D; +extern PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D; +extern PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D; +extern PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D; +extern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D; +extern PFNGLGENQUERIESPROC glGenQueries; +extern PFNGLDELETEQUERIESPROC glDeleteQueries; +extern PFNGLISQUERYPROC glIsQuery; +extern PFNGLBEGINQUERYPROC glBeginQuery; +extern PFNGLENDQUERYPROC glEndQuery; +extern PFNGLGETQUERYIVPROC glGetQueryiv; +extern PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv; +extern PFNGLUNMAPBUFFERPROC glUnmapBuffer; +extern PFNGLGETBUFFERPOINTERVPROC glGetBufferPointerv; +extern PFNGLDRAWBUFFERSPROC glDrawBuffers; +extern PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv; +extern PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv; +extern PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv; +extern PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv; +extern PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv; +extern PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv; +extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer; +extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample; +extern PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer; +extern PFNGLMAPBUFFERRANGEPROC glMapBufferRange; +extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange; +extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray; +extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; +extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; +extern PFNGLISVERTEXARRAYPROC glIsVertexArray; +extern PFNGLGETINTEGERI_VPROC glGetIntegeri_v; +extern PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback; +extern PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback; +extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange; +extern PFNGLBINDBUFFERBASEPROC glBindBufferBase; +extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings; +extern PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glGetTransformFeedbackVarying; +extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer; +extern PFNGLGETVERTEXATTRIBIIVPROC glGetVertexAttribIiv; +extern PFNGLGETVERTEXATTRIBIUIVPROC glGetVertexAttribIuiv; +extern PFNGLVERTEXATTRIBI4IPROC glVertexAttribI4i; +extern PFNGLVERTEXATTRIBI4UIPROC glVertexAttribI4ui; +extern PFNGLVERTEXATTRIBI4IVPROC glVertexAttribI4iv; +extern PFNGLVERTEXATTRIBI4UIVPROC glVertexAttribI4uiv; +extern PFNGLGETUNIFORMUIVPROC glGetUniformuiv; +extern PFNGLGETFRAGDATALOCATIONPROC glGetFragDataLocation; +extern PFNGLUNIFORM1UIPROC glUniform1ui; +extern PFNGLUNIFORM2UIPROC glUniform2ui; +extern PFNGLUNIFORM3UIPROC glUniform3ui; +extern PFNGLUNIFORM4UIPROC glUniform4ui; +extern PFNGLUNIFORM1UIVPROC glUniform1uiv; +extern PFNGLUNIFORM2UIVPROC glUniform2uiv; +extern PFNGLUNIFORM3UIVPROC glUniform3uiv; +extern PFNGLUNIFORM4UIVPROC glUniform4uiv; +extern PFNGLCLEARBUFFERIVPROC glClearBufferiv; +extern PFNGLCLEARBUFFERUIVPROC glClearBufferuiv; +extern PFNGLCLEARBUFFERFVPROC glClearBufferfv; +extern PFNGLCLEARBUFFERFIPROC glClearBufferfi; +extern PFNGLGETSTRINGIPROC glGetStringi; +extern PFNGLCOPYBUFFERSUBDATAPROC glCopyBufferSubData; +extern PFNGLGETUNIFORMINDICESPROC glGetUniformIndices; +extern PFNGLGETACTIVEUNIFORMSIVPROC glGetActiveUniformsiv; +extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex; +extern PFNGLGETACTIVEUNIFORMBLOCKIVPROC glGetActiveUniformBlockiv; +extern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName; +extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding; +extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced; +extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced; +extern PFNGLFENCESYNCPROC glFenceSync; +extern PFNGLISSYNCPROC glIsSync; +extern PFNGLDELETESYNCPROC glDeleteSync; +extern PFNGLCLIENTWAITSYNCPROC glClientWaitSync; +extern PFNGLWAITSYNCPROC glWaitSync; +extern PFNGLGETINTEGER64VPROC glGetInteger64v; +extern PFNGLGETSYNCIVPROC glGetSynciv; +extern PFNGLGETINTEGER64I_VPROC glGetInteger64i_v; +extern PFNGLGETBUFFERPARAMETERI64VPROC glGetBufferParameteri64v; +extern PFNGLGENSAMPLERSPROC glGenSamplers; +extern PFNGLDELETESAMPLERSPROC glDeleteSamplers; +extern PFNGLISSAMPLERPROC glIsSampler; +extern PFNGLBINDSAMPLERPROC glBindSampler; +extern PFNGLSAMPLERPARAMETERIPROC glSamplerParameteri; +extern PFNGLSAMPLERPARAMETERIVPROC glSamplerParameteriv; +extern PFNGLSAMPLERPARAMETERFPROC glSamplerParameterf; +extern PFNGLSAMPLERPARAMETERFVPROC glSamplerParameterfv; +extern PFNGLGETSAMPLERPARAMETERIVPROC glGetSamplerParameteriv; +extern PFNGLGETSAMPLERPARAMETERFVPROC glGetSamplerParameterfv; +extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor; +extern PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback; +extern PFNGLDELETETRANSFORMFEEDBACKSPROC glDeleteTransformFeedbacks; +extern PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks; +extern PFNGLISTRANSFORMFEEDBACKPROC glIsTransformFeedback; +extern PFNGLPAUSETRANSFORMFEEDBACKPROC glPauseTransformFeedback; +extern PFNGLRESUMETRANSFORMFEEDBACKPROC glResumeTransformFeedback; +extern PFNGLGETPROGRAMBINARYPROC glGetProgramBinary; +extern PFNGLPROGRAMBINARYPROC glProgramBinary; +extern PFNGLPROGRAMPARAMETERIPROC glProgramParameteri; +extern PFNGLINVALIDATEFRAMEBUFFERPROC glInvalidateFramebuffer; +extern PFNGLINVALIDATESUBFRAMEBUFFERPROC glInvalidateSubFramebuffer; +extern PFNGLTEXSTORAGE2DPROC glTexStorage2D; +extern PFNGLTEXSTORAGE3DPROC glTexStorage3D; +extern PFNGLGETINTERNALFORMATIVPROC glGetInternalformativ; + + +/* GL_ES_VERSION_3_1 */ +extern PFNGLDISPATCHCOMPUTEPROC glDispatchCompute; +extern PFNGLDISPATCHCOMPUTEINDIRECTPROC glDispatchComputeIndirect; + +extern PFNGLDRAWARRAYSINDIRECTPROC glDrawArraysIndirect; +extern PFNGLDRAWELEMENTSINDIRECTPROC glDrawElementsIndirect; + +extern PFNGLFRAMEBUFFERPARAMETERIPROC glFramebufferParameteri; +extern PFNGLGETFRAMEBUFFERPARAMETERIVPROC glGetFramebufferParameteriv; + +extern PFNGLGETPROGRAMINTERFACEIVPROC glGetProgramInterfaceiv; +extern PFNGLGETPROGRAMRESOURCEINDEXPROC glGetProgramResourceIndex; +extern PFNGLGETPROGRAMRESOURCENAMEPROC glGetProgramResourceName; +extern PFNGLGETPROGRAMRESOURCEIVPROC glGetProgramResourceiv; +extern PFNGLGETPROGRAMRESOURCELOCATIONPROC glGetProgramResourceLocation; + +extern PFNGLUSEPROGRAMSTAGESPROC glUseProgramStages; +extern PFNGLACTIVESHADERPROGRAMPROC glActiveShaderProgram; +extern PFNGLCREATESHADERPROGRAMVPROC glCreateShaderProgramv; +extern PFNGLBINDPROGRAMPIPELINEPROC glBindProgramPipeline; +extern PFNGLDELETEPROGRAMPIPELINESPROC glDeleteProgramPipelines; +extern PFNGLGENPROGRAMPIPELINESPROC glGenProgramPipelines; +extern PFNGLISPROGRAMPIPELINEPROC glIsProgramPipeline; +extern PFNGLGETPROGRAMPIPELINEIVPROC glGetProgramPipelineiv; +extern PFNGLPROGRAMUNIFORM1IPROC glProgramUniform1i; +extern PFNGLPROGRAMUNIFORM2IPROC glProgramUniform2i; +extern PFNGLPROGRAMUNIFORM3IPROC glProgramUniform3i; +extern PFNGLPROGRAMUNIFORM4IPROC glProgramUniform4i; +extern PFNGLPROGRAMUNIFORM1UIPROC glProgramUniform1ui; +extern PFNGLPROGRAMUNIFORM2UIPROC glProgramUniform2ui; +extern PFNGLPROGRAMUNIFORM3UIPROC glProgramUniform3ui; +extern PFNGLPROGRAMUNIFORM4UIPROC glProgramUniform4ui; +extern PFNGLPROGRAMUNIFORM1FPROC glProgramUniform1f; +extern PFNGLPROGRAMUNIFORM2FPROC glProgramUniform2f; +extern PFNGLPROGRAMUNIFORM3FPROC glProgramUniform3f; +extern PFNGLPROGRAMUNIFORM4FPROC glProgramUniform4f; +extern PFNGLPROGRAMUNIFORM1IVPROC glProgramUniform1iv; +extern PFNGLPROGRAMUNIFORM2IVPROC glProgramUniform2iv; +extern PFNGLPROGRAMUNIFORM3IVPROC glProgramUniform3iv; +extern PFNGLPROGRAMUNIFORM4IVPROC glProgramUniform4iv; +extern PFNGLPROGRAMUNIFORM1UIVPROC glProgramUniform1uiv; +extern PFNGLPROGRAMUNIFORM2UIVPROC glProgramUniform2uiv; +extern PFNGLPROGRAMUNIFORM3UIVPROC glProgramUniform3uiv; +extern PFNGLPROGRAMUNIFORM4UIVPROC glProgramUniform4uiv; +extern PFNGLPROGRAMUNIFORM1FVPROC glProgramUniform1fv; +extern PFNGLPROGRAMUNIFORM2FVPROC glProgramUniform2fv; +extern PFNGLPROGRAMUNIFORM3FVPROC glProgramUniform3fv; +extern PFNGLPROGRAMUNIFORM4FVPROC glProgramUniform4fv; +extern PFNGLPROGRAMUNIFORMMATRIX2FVPROC glProgramUniformMatrix2fv; +extern PFNGLPROGRAMUNIFORMMATRIX3FVPROC glProgramUniformMatrix3fv; +extern PFNGLPROGRAMUNIFORMMATRIX4FVPROC glProgramUniformMatrix4fv; +extern PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glProgramUniformMatrix2x3fv; +extern PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glProgramUniformMatrix3x2fv; +extern PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glProgramUniformMatrix2x4fv; +extern PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glProgramUniformMatrix4x2fv; +extern PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glProgramUniformMatrix3x4fv; +extern PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glProgramUniformMatrix4x3fv; +extern PFNGLVALIDATEPROGRAMPIPELINEPROC glValidateProgramPipeline; +extern PFNGLGETPROGRAMPIPELINEINFOLOGPROC glGetProgramPipelineInfoLog; + +extern PFNGLBINDIMAGETEXTUREPROC glBindImageTexture; +extern PFNGLGETBOOLEANI_VPROC glGetBooleani_v; +extern PFNGLMEMORYBARRIERPROC glMemoryBarrier; +extern PFNGLMEMORYBARRIERBYREGIONPROC glMemoryBarrierByRegion; + +extern PFNGLTEXSTORAGE2DMULTISAMPLEPROC glTexStorage2DMultisample; +extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv; +extern PFNGLSAMPLEMASKIPROC glSampleMaski; +extern PFNGLGETTEXLEVELPARAMETERIVPROC glGetTexLevelParameteriv; +extern PFNGLGETTEXLEVELPARAMETERFVPROC glGetTexLevelParameterfv; + +extern PFNGLBINDVERTEXBUFFERPROC glBindVertexBuffer; +extern PFNGLVERTEXATTRIBFORMATPROC glVertexAttribFormat; +extern PFNGLVERTEXATTRIBIFORMATPROC glVertexAttribIFormat; +extern PFNGLVERTEXATTRIBBINDINGPROC glVertexAttribBinding; +extern PFNGLVERTEXBINDINGDIVISORPROC glVertexBindingDivisor; + + +/* GL_ES_VERSION_3_2 */ +extern PFNGLBLENDBARRIERPROC glBlendBarrier; + +extern PFNGLCOPYIMAGESUBDATAPROC glCopyImageSubData; + +extern PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl; +extern PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert; +extern PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback; +extern PFNGLGETDEBUGMESSAGELOGPROC glGetDebugMessageLog; +extern PFNGLPUSHDEBUGGROUPPROC glPushDebugGroup; +extern PFNGLPOPDEBUGGROUPPROC glPopDebugGroup; +extern PFNGLOBJECTLABELPROC glObjectLabel; +extern PFNGLGETOBJECTLABELPROC glGetObjectLabel; +extern PFNGLOBJECTPTRLABELPROC glObjectPtrLabel; +extern PFNGLGETOBJECTPTRLABELPROC glGetObjectPtrLabel; +extern PFNGLGETPOINTERVPROC glGetPointerv; + +extern PFNGLENABLEIPROC glEnablei; +extern PFNGLDISABLEIPROC glDisablei; +extern PFNGLBLENDEQUATIONIPROC glBlendEquationi; +extern PFNGLBLENDEQUATIONSEPARATEIPROC glBlendEquationSeparatei; +extern PFNGLBLENDFUNCIPROC glBlendFunci; +extern PFNGLBLENDFUNCSEPARATEIPROC glBlendFuncSeparatei; +extern PFNGLCOLORMASKIPROC glColorMaski; +extern PFNGLISENABLEDIPROC glIsEnabledi; + +extern PFNGLDRAWELEMENTSBASEVERTEXPROC glDrawElementsBaseVertex; +extern PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glDrawRangeElementsBaseVertex; +extern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glDrawElementsInstancedBaseVertex; + +extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture; + +extern PFNGLPRIMITIVEBOUNDINGBOXPROC glPrimitiveBoundingBox; + +extern PFNGLGETGRAPHICSRESETSTATUSPROC glGetGraphicsResetStatus; +extern PFNGLREADNPIXELSPROC glReadnPixels; +extern PFNGLGETNUNIFORMFVPROC glGetnUniformfv; +extern PFNGLGETNUNIFORMIVPROC glGetnUniformiv; +extern PFNGLGETNUNIFORMUIVPROC glGetnUniformuiv; + +extern PFNGLMINSAMPLESHADINGPROC glMinSampleShading; + +extern PFNGLPATCHPARAMETERIPROC glPatchParameteri; + +extern PFNGLTEXPARAMETERIIVPROC glTexParameterIiv; +extern PFNGLTEXPARAMETERIUIVPROC glTexParameterIuiv; +extern PFNGLGETTEXPARAMETERIIVPROC glGetTexParameterIiv; +extern PFNGLGETTEXPARAMETERIUIVPROC glGetTexParameterIuiv; +extern PFNGLSAMPLERPARAMETERIIVPROC glSamplerParameterIiv; +extern PFNGLSAMPLERPARAMETERIUIVPROC glSamplerParameterIuiv; +extern PFNGLGETSAMPLERPARAMETERIIVPROC glGetSamplerParameterIiv; +extern PFNGLGETSAMPLERPARAMETERIUIVPROC glGetSamplerParameterIuiv; + +extern PFNGLTEXBUFFERPROC glTexBuffer; +extern PFNGLTEXBUFFERRANGEPROC glTexBufferRange; + +extern PFNGLTEXSTORAGE3DMULTISAMPLEPROC glTexStorage3DMultisample; + + +/* GLES3W_GENERATE_GLES_DECLARATION */ + +/** + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + * The above section is auto-generated from GLES spec by running: + * node tools/gles-wrangler-generator/generate.js + * ========================= !DO NOT CHANGE THE ABOVE SECTION MANUALLY! ========================= + */ + +using PFNGLES3WLOADPROC = void *(*)(const char *); +void gles3wLoadProcs(PFNGLES3WLOADPROC gles3wLoad); diff --git a/native/cocos/renderer/gfx-gles2/CMakeLists.txt b/native/cocos/renderer/gfx-gles2/CMakeLists.txt deleted file mode 100644 index 8fc703b414..0000000000 --- a/native/cocos/renderer/gfx-gles2/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ -set(TARGET_NAME GFXGLES2) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src/mesa - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-gles2 -) - -if(WIN32) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/pvrsdk/include) - -if(COCOS_CPU_X64) - set(PVRSDK_LIB_DIR ${GFX_EXTERNAL_PATH}/pvrsdk/lib/Windows_x86_64) -else() - set(PVRSDK_LIB_DIR ${GFX_EXTERNAL_PATH}/pvrsdk/lib/Windows_x86_32) -endif() - - link_libraries( - ${PVRSDK_LIB_DIR}/libEGL.lib - ${PVRSDK_LIB_DIR}/libGLESv2.lib - ) -endif() - -if(COCOS_PLATFORM_OSX) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/pvrsdk/include) - set(PVRSDK_LIB_DIR ${GFX_EXTERNAL_PATH}/pvrsdk/lib/OSX_x86) - - link_libraries( - ${PVRSDK_LIB_DIR}/libEGL.dylib - ${PVRSDK_LIB_DIR}/libGLESv2.dylib - ) -endif() - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles2/gles2w.c") -else() - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles2/gles2w.mm") -endif() - -if(COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles2/GLES2Context.mm") -endif() - -add_definitions("-DCC_GLES2_EXPORTS") -if(WIN32) - add_definitions("-DGLEW_BUILD") -endif() -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME} Core) -target_include_directories(${TARGET_NAME} PUBLIC ${GFX_EXTERNAL_PATH}/khronos) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXGLES2) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXGLES2_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/GLES2Std.h" "${CMAKE_CURRENT_SOURCE_DIR}/GLES2Std.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-gles2/GFXGLES2.h b/native/cocos/renderer/gfx-gles2/GFXGLES2.h index cb7f8ae49a..35859993b1 100644 --- a/native/cocos/renderer/gfx-gles2/GFXGLES2.h +++ b/native/cocos/renderer/gfx-gles2/GFXGLES2.h @@ -1,30 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_H_ -#define CC_GFXGLES2_H_ + +#pragma once #include "GLES2Std.h" #include "GLES2Device.h" - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp b/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp index 310d183711..f25fbfc82c 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Buffer.cpp @@ -1,95 +1,69 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Buffer.h" #include "GLES2Commands.h" +#include "GLES2Device.h" namespace cc { namespace gfx { -GLES2Buffer::GLES2Buffer(Device *device) -: Buffer(device) { -} +GLES2Buffer::GLES2Buffer() = default; GLES2Buffer::~GLES2Buffer() { + destroy(); } -bool GLES2Buffer::initialize(const BufferInfo &info) { - - _usage = info.usage; - _memUsage = info.memUsage; - _size = info.size; - _stride = std::max(info.stride, 1u); - _count = _size / _stride; - _flags = info.flags; - - _gpuBuffer = CC_NEW(GLES2GPUBuffer); - if (!_gpuBuffer) { - CC_LOG_ERROR("GLES2Buffer: CC_NEW GLES2GPUBuffer failed."); - return false; - } - _gpuBuffer->usage = _usage; +void GLES2Buffer::doInit(const BufferInfo & /*info*/) { + _gpuBuffer = CC_NEW(GLES2GPUBuffer); + _gpuBuffer->usage = _usage; _gpuBuffer->memUsage = _memUsage; - _gpuBuffer->size = _size; - _gpuBuffer->stride = _stride; - _gpuBuffer->count = _count; + _gpuBuffer->size = _size; + _gpuBuffer->stride = _stride; + _gpuBuffer->count = _count; - if (_usage & BufferUsageBit::INDIRECT) { + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { _gpuBuffer->indirects.resize(_count); } - GLES2CmdFuncCreateBuffer((GLES2Device *)_device, _gpuBuffer); - _device->getMemoryStatus().bufferSize += _size; - - return true; + cmdFuncGLES2CreateBuffer(GLES2Device::getInstance(), _gpuBuffer); } -bool GLES2Buffer::initialize(const BufferViewInfo &info) { - - _isBufferView = true; - - GLES2Buffer *buffer = (GLES2Buffer *)info.buffer; - - _usage = buffer->_usage; - _memUsage = buffer->_memUsage; - _size = _stride = info.range; - _count = 1u; - _flags = buffer->_flags; - - _gpuBufferView = CC_NEW(GLES2GPUBufferView); +void GLES2Buffer::doInit(const BufferViewInfo &info) { + auto *buffer = static_cast(info.buffer); + _gpuBufferView = CC_NEW(GLES2GPUBufferView); _gpuBufferView->gpuBuffer = buffer->gpuBuffer(); - _gpuBufferView->range = _size; - _gpuBufferView->offset = info.offset; - - return true; + _gpuBufferView->range = _size; + _gpuBufferView->offset = info.offset; } -void GLES2Buffer::destroy() { +void GLES2Buffer::doDestroy() { if (_gpuBuffer) { - GLES2CmdFuncDestroyBuffer((GLES2Device *)_device, _gpuBuffer); - _device->getMemoryStatus().bufferSize -= _size; + cmdFuncGLES2DestroyBuffer(GLES2Device::getInstance(), _gpuBuffer); CC_DELETE(_gpuBuffer); _gpuBuffer = nullptr; } @@ -97,29 +71,14 @@ void GLES2Buffer::destroy() { CC_SAFE_DELETE(_gpuBufferView); } -void GLES2Buffer::resize(uint size) { - CCASSERT(!_isBufferView, "Cannot resize buffer views"); - - if (_size != size) { - const uint oldSize = _size; - _size = size; - _count = _size / _stride; - - MemoryStatus &status = _device->getMemoryStatus(); - _gpuBuffer->size = _size; - _gpuBuffer->count = _count; - GLES2CmdFuncResizeBuffer((GLES2Device *)_device, _gpuBuffer); - status.bufferSize -= oldSize; - status.bufferSize += _size; - } +void GLES2Buffer::doResize(uint size, uint count) { + _gpuBuffer->size = size; + _gpuBuffer->count = count; + cmdFuncGLES2ResizeBuffer(GLES2Device::getInstance(), _gpuBuffer); } -void GLES2Buffer::update(void *buffer, uint size) { - CCASSERT(!_isBufferView, "Cannot update through buffer views"); - CCASSERT(size != 0, "Should not update buffer with 0 bytes of data"); - CCASSERT(buffer, "Buffer should not be nullptr"); - - GLES2CmdFuncUpdateBuffer((GLES2Device *)_device, _gpuBuffer, buffer, 0u, size); +void GLES2Buffer::update(const void *buffer, uint size) { + cmdFuncGLES2UpdateBuffer(GLES2Device::getInstance(), _gpuBuffer, buffer, 0U, size); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles2/GLES2Buffer.h b/native/cocos/renderer/gfx-gles2/GLES2Buffer.h index c84a0d21d9..610a4e7efd 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Buffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Buffer.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_BUFFER_H_ -#define CC_GFXGLES2_BUFFER_H_ + +#pragma once + +#include "GLES2Std.h" +#include "gfx-base/GFXBuffer.h" namespace cc { namespace gfx { @@ -32,25 +36,23 @@ class GLES2GPUBufferView; class CC_GLES2_API GLES2Buffer final : public Buffer { public: - GLES2Buffer(Device *device); - ~GLES2Buffer(); + GLES2Buffer(); + ~GLES2Buffer() override; -public: - virtual bool initialize(const BufferInfo &info) override; - virtual bool initialize(const BufferViewInfo &info) override; - virtual void destroy() override; - virtual void resize(uint size) override; - virtual void update(void *buffer, uint size) override; + void update(const void *buffer, uint size) override; CC_INLINE GLES2GPUBuffer *gpuBuffer() const { return _gpuBuffer; } CC_INLINE GLES2GPUBufferView *gpuBufferView() const { return _gpuBufferView; } -private: - GLES2GPUBuffer *_gpuBuffer = nullptr; +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doDestroy() override; + void doResize(uint size, uint count) override; + + GLES2GPUBuffer * _gpuBuffer = nullptr; GLES2GPUBufferView *_gpuBufferView = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cpp b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cpp index 12fdcfc7fb..f7a4cbee67 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Buffer.h" @@ -36,28 +38,25 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES2CommandBuffer::GLES2CommandBuffer(Device *device) -: CommandBuffer(device) { -} - GLES2CommandBuffer::~GLES2CommandBuffer() { + destroy(); } -bool GLES2CommandBuffer::initialize(const CommandBufferInfo &info) { - _type = info.type; +void GLES2CommandBuffer::doInit(const CommandBufferInfo &info) { + _type = info.type; _queue = info.queue; - _cmdAllocator = CC_NEW(GLES2GPUCommandAllocator); + _cmdAllocator = CC_NEW(GLES2GPUCommandAllocator); _curCmdPackage = CC_NEW(GLES2CmdPackage); - size_t setCount = ((GLES2Device *)_device)->bindingMappingInfo().bufferOffsets.size(); + size_t setCount = GLES2Device::getInstance()->bindingMappingInfo().bufferOffsets.size(); _curGPUDescriptorSets.resize(setCount); _curDynamicOffsets.resize(setCount); - - return true; } -void GLES2CommandBuffer::destroy() { +void GLES2CommandBuffer::doDestroy() { + if (!_cmdAllocator) return; + _cmdAllocator->clearCmds(_curCmdPackage); CC_SAFE_DELETE(_curCmdPackage); @@ -76,10 +75,10 @@ void GLES2CommandBuffer::destroy() { } _cmdAllocator->reset(); - CC_DELETE(_cmdAllocator); + CC_SAFE_DELETE(_cmdAllocator); } -void GLES2CommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) { +void GLES2CommandBuffer::begin(RenderPass * /*renderPass*/, uint /*subpass*/, Framebuffer * /*frameBuffer*/) { _cmdAllocator->clearCmds(_curCmdPackage); _curGPUPipelineState = nullptr; _curGPUInputAssember = nullptr; @@ -92,7 +91,7 @@ void GLES2CommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer void GLES2CommandBuffer::end() { if (_isStateInvalid) { - BindStates(); + bindStates(); } _isInRenderPass = false; @@ -105,43 +104,43 @@ void GLES2CommandBuffer::end() { } } -void GLES2CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) { +void GLES2CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const * /*secondaryCBs*/, uint /*secondaryCBCount*/) { _isInRenderPass = true; GLES2CmdBeginRenderPass *cmd = _cmdAllocator->beginRenderPassCmdPool.alloc(); - cmd->gpuRenderPass = ((GLES2RenderPass *)renderPass)->gpuRenderPass(); - cmd->gpuFBO = ((GLES2Framebuffer *)fbo)->gpuFBO(); - cmd->renderArea = renderArea; - cmd->numClearColors = cmd->gpuRenderPass->colorAttachments.size(); + cmd->gpuRenderPass = static_cast(renderPass)->gpuRenderPass(); + cmd->gpuFBO = static_cast(fbo)->gpuFBO(); + cmd->renderArea = renderArea; + cmd->numClearColors = cmd->gpuRenderPass->colorAttachments.size(); for (size_t i = 0; i < cmd->numClearColors; ++i) { cmd->clearColors[i] = colors[i]; } - cmd->clearDepth = depth; + cmd->clearDepth = depth; cmd->clearStencil = stencil; _curCmdPackage->beginRenderPassCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::BEGIN_RENDER_PASS); + _curCmdPackage->cmds.push(GLESCmdType::BEGIN_RENDER_PASS); } void GLES2CommandBuffer::endRenderPass() { _isInRenderPass = false; - _curCmdPackage->cmds.push(GFXCmdType::END_RENDER_PASS); + _curCmdPackage->cmds.push(GLESCmdType::END_RENDER_PASS); } void GLES2CommandBuffer::bindPipelineState(PipelineState *pso) { - GLES2GPUPipelineState *gpuPipelineState = ((GLES2PipelineState *)pso)->gpuPipelineState(); + GLES2GPUPipelineState *gpuPipelineState = static_cast(pso)->gpuPipelineState(); if (_curGPUPipelineState != gpuPipelineState) { _curGPUPipelineState = gpuPipelineState; - _isStateInvalid = true; + _isStateInvalid = true; } } void GLES2CommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) { CCASSERT(_curGPUDescriptorSets.size() > set, "Invalid set index"); - GLES2GPUDescriptorSet *gpuDescriptorSet = ((GLES2DescriptorSet *)descriptorSet)->gpuDescriptorSet(); + GLES2GPUDescriptorSet *gpuDescriptorSet = static_cast(descriptorSet)->gpuDescriptorSet(); if (_curGPUDescriptorSets[set] != gpuDescriptorSet) { _curGPUDescriptorSets[set] = gpuDescriptorSet; - _isStateInvalid = true; + _isStateInvalid = true; } if (dynamicOffsetCount) { _curDynamicOffsets[set].assign(dynamicOffsets, dynamicOffsets + dynamicOffsetCount); @@ -150,8 +149,8 @@ void GLES2CommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSe } void GLES2CommandBuffer::bindInputAssembler(InputAssembler *ia) { - _curGPUInputAssember = ((GLES2InputAssembler *)ia)->gpuInputAssembler(); - _isStateInvalid = true; + _curGPUInputAssember = static_cast(ia)->gpuInputAssembler(); + _isStateInvalid = true; } void GLES2CommandBuffer::setViewport(const Viewport &vp) { @@ -162,7 +161,7 @@ void GLES2CommandBuffer::setViewport(const Viewport &vp) { (_curViewport.height != vp.height) || math::IsNotEqualF(_curViewport.minDepth, vp.minDepth) || math::IsNotEqualF(_curViewport.maxDepth, vp.maxDepth)) { - _curViewport = vp; + _curViewport = vp; _isStateInvalid = true; } } @@ -172,14 +171,14 @@ void GLES2CommandBuffer::setScissor(const Rect &rect) { (_curScissor.y != rect.y) || (_curScissor.width != rect.width) || (_curScissor.height != rect.height)) { - _curScissor = rect; + _curScissor = rect; _isStateInvalid = true; } } void GLES2CommandBuffer::setLineWidth(float width) { if (math::IsNotEqualF(_curLineWidth, width)) { - _curLineWidth = width; + _curLineWidth = width; _isStateInvalid = true; } } @@ -189,9 +188,9 @@ void GLES2CommandBuffer::setDepthBias(float constant, float clamp, float slope) math::IsNotEqualF(_curDepthBias.clamp, clamp) || math::IsNotEqualF(_curDepthBias.slope, slope)) { _curDepthBias.constant = constant; - _curDepthBias.clamp = clamp; - _curDepthBias.slope = slope; - _isStateInvalid = true; + _curDepthBias.clamp = clamp; + _curDepthBias.slope = slope; + _isStateInvalid = true; } } @@ -204,7 +203,7 @@ void GLES2CommandBuffer::setBlendConstants(const Color &constants) { _curBlendConstants.y = constants.y; _curBlendConstants.z = constants.z; _curBlendConstants.w = constants.w; - _isStateInvalid = true; + _isStateInvalid = true; } } @@ -213,16 +212,16 @@ void GLES2CommandBuffer::setDepthBound(float minBounds, float maxBounds) { math::IsNotEqualF(_curDepthBounds.maxBounds, maxBounds)) { _curDepthBounds.minBounds = minBounds; _curDepthBounds.maxBounds = maxBounds; - _isStateInvalid = true; + _isStateInvalid = true; } } void GLES2CommandBuffer::setStencilWriteMask(StencilFace face, uint mask) { if ((_curStencilWriteMask.face != face) || (_curStencilWriteMask.writeMask != mask)) { - _curStencilWriteMask.face = face; + _curStencilWriteMask.face = face; _curStencilWriteMask.writeMask = mask; - _isStateInvalid = true; + _isStateInvalid = true; } } @@ -230,91 +229,81 @@ void GLES2CommandBuffer::setStencilCompareMask(StencilFace face, int ref, uint m if ((_curStencilCompareMask.face != face) || (_curStencilCompareMask.refrence != ref) || (_curStencilCompareMask.compareMask != mask)) { - _curStencilCompareMask.face = face; - _curStencilCompareMask.refrence = ref; + _curStencilCompareMask.face = face; + _curStencilCompareMask.refrence = ref; _curStencilCompareMask.compareMask = mask; - _isStateInvalid = true; + _isStateInvalid = true; } } -void GLES2CommandBuffer::draw(InputAssembler *ia) { - if ((_type == CommandBufferType::PRIMARY && _isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - if (_isStateInvalid) { - BindStates(); - } +void GLES2CommandBuffer::nextSubpass() { +} - GLES2CmdDraw *cmd = _cmdAllocator->drawCmdPool.alloc(); - ((GLES2InputAssembler *)ia)->ExtractCmdDraw(cmd); - _curCmdPackage->drawCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::DRAW); +void GLES2CommandBuffer::draw(const DrawInfo &info) { + if (_isStateInvalid) { + bindStates(); + } - ++_numDrawCalls; - _numInstances += ia->getInstanceCount(); - if (_curGPUPipelineState) { - switch (_curGPUPipelineState->glPrimitive) { - case GL_TRIANGLES: { - if (ia->getIndexBuffer() == nullptr) { - _numTriangles += ia->getVertexCount() / 3 * std::max(ia->getInstanceCount(), 1U); - } else { - _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getInstanceCount(), 1U); - } - break; - } - case GL_TRIANGLE_STRIP: - case GL_TRIANGLE_FAN: { - _numTriangles += (ia->getVertexCount() - 2) * std::max(ia->getInstanceCount(), 1U); - break; - } - default: - break; + GLES2CmdDraw *cmd = _cmdAllocator->drawCmdPool.alloc(); + cmd->drawInfo = info; + _curCmdPackage->drawCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::DRAW); + + ++_numDrawCalls; + _numInstances += info.instanceCount; + uint indexCount = info.indexCount ? info.indexCount : info.vertexCount; + if (_curGPUPipelineState) { + switch (_curGPUPipelineState->glPrimitive) { + case GL_TRIANGLES: { + _numTriangles += indexCount / 3 * std::max(info.instanceCount, 1U); + break; } + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_FAN: { + _numTriangles += (indexCount - 2) * std::max(info.instanceCount, 1U); + break; + } + default: + break; } - } else { - CC_LOG_ERROR("Command 'draw' must be recorded inside a render pass."); } } void GLES2CommandBuffer::updateBuffer(Buffer *buff, const void *data, uint size) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - GLES2GPUBuffer *gpuBuffer = ((GLES2Buffer *)buff)->gpuBuffer(); - if (gpuBuffer) { - GLES2CmdUpdateBuffer *cmd = _cmdAllocator->updateBufferCmdPool.alloc(); - cmd->gpuBuffer = gpuBuffer; - cmd->size = size; - cmd->buffer = (uint8_t *)data; + GLES2GPUBuffer *gpuBuffer = static_cast(buff)->gpuBuffer(); + if (gpuBuffer) { + GLES2CmdUpdateBuffer *cmd = _cmdAllocator->updateBufferCmdPool.alloc(); + cmd->gpuBuffer = gpuBuffer; + cmd->size = size; + cmd->buffer = static_cast(data); - _curCmdPackage->updateBufferCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::UPDATE_BUFFER); - } - } else { - CC_LOG_ERROR("Command 'updateBuffer' must be recorded outside a render pass."); + _curCmdPackage->updateBufferCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::UPDATE_BUFFER); } } void GLES2CommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - GLES2GPUTexture *gpuTexture = ((GLES2Texture *)texture)->gpuTexture(); - if (gpuTexture) { - GLES2CmdCopyBufferToTexture *cmd = _cmdAllocator->copyBufferToTextureCmdPool.alloc(); - cmd->gpuTexture = gpuTexture; - cmd->regions = regions; - cmd->count = count; - cmd->buffers = buffers; + GLES2GPUTexture *gpuTexture = static_cast(texture)->gpuTexture(); + if (gpuTexture) { + GLES2CmdCopyBufferToTexture *cmd = _cmdAllocator->copyBufferToTextureCmdPool.alloc(); + cmd->gpuTexture = gpuTexture; + cmd->regions = regions; + cmd->count = count; + cmd->buffers = buffers; - _curCmdPackage->copyBufferToTextureCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::COPY_BUFFER_TO_TEXTURE); - } - } else { - CC_LOG_ERROR("Command 'copyBuffersToTexture' must be recorded outside a render pass."); + _curCmdPackage->copyBufferToTextureCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::COPY_BUFFER_TO_TEXTURE); } } -void GLES2CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t count) { +void GLES2CommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { +} + +void GLES2CommandBuffer::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { + CCASSERT(false, "Command 'execute' must be recorded in primary command buffers."); + for (uint i = 0; i < count; ++i) { - GLES2CommandBuffer *cmdBuff = (GLES2CommandBuffer *)cmdBuffs[i]; + auto * cmdBuff = static_cast(cmdBuffs[i]); GLES2CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); for (uint j = 0; j < cmdPackage->beginRenderPassCmds.size(); ++j) { @@ -350,20 +339,25 @@ void GLES2CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t cmdBuff->_pendingPackages.pop(); cmdBuff->_freePackages.push(cmdPackage); + + // current cmd allocator strategy will not work here: (but it doesn't matter anyways) + // allocators are designed to only free the cmds they allocated + // but here we are essentially ��transfering' the owner ship + //cmdBuff->_cmdAllocator->clearCmds(cmdPackage); } } -void GLES2CommandBuffer::BindStates() { +void GLES2CommandBuffer::bindStates() { GLES2CmdBindStates *cmd = _cmdAllocator->bindStatesCmdPool.alloc(); - cmd->gpuPipelineState = _curGPUPipelineState; + cmd->gpuPipelineState = _curGPUPipelineState; cmd->gpuInputAssembler = _curGPUInputAssember; cmd->gpuDescriptorSets = _curGPUDescriptorSets; if (_curGPUPipelineState) { vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; cmd->dynamicOffsets.resize(_curGPUPipelineState->gpuPipelineLayout->dynamicOffsetCount); - for (size_t i = 0u; i < _curDynamicOffsets.size(); i++) { + for (size_t i = 0U; i < _curDynamicOffsets.size(); i++) { size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); count = std::min(count, _curDynamicOffsets[i].size()); @@ -371,20 +365,20 @@ void GLES2CommandBuffer::BindStates() { } } - cmd->viewport = _curViewport; - cmd->scissor = _curScissor; - cmd->lineWidth = _curLineWidth; - cmd->depthBias = _curDepthBias; - cmd->blendConstants.x = _curBlendConstants.x; - cmd->blendConstants.y = _curBlendConstants.y; - cmd->blendConstants.z = _curBlendConstants.z; - cmd->blendConstants.w = _curBlendConstants.w; - cmd->depthBounds = _curDepthBounds; - cmd->stencilWriteMask = _curStencilWriteMask; + cmd->viewport = _curViewport; + cmd->scissor = _curScissor; + cmd->lineWidth = _curLineWidth; + cmd->depthBias = _curDepthBias; + cmd->blendConstants.x = _curBlendConstants.x; + cmd->blendConstants.y = _curBlendConstants.y; + cmd->blendConstants.z = _curBlendConstants.z; + cmd->blendConstants.w = _curBlendConstants.w; + cmd->depthBounds = _curDepthBounds; + cmd->stencilWriteMask = _curStencilWriteMask; cmd->stencilCompareMask = _curStencilCompareMask; _curCmdPackage->bindStatesCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::BIND_STATES); + _curCmdPackage->cmds.push(GLESCmdType::BIND_STATES); _isStateInvalid = false; } diff --git a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h index 8d448c2f3d..04f37595b2 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2CommandBuffer.h @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_COMMAND_BUFFER_H_ -#define CC_GFXGLES2_COMMAND_BUFFER_H_ + +#pragma once #include "GLES2Commands.h" +#include "gfx-base/GFXCommandBuffer.h" namespace cc { namespace gfx { @@ -33,59 +35,60 @@ class GLES2GPUCommandAllocator; class CC_GLES2_API GLES2CommandBuffer : public CommandBuffer { public: - GLES2CommandBuffer(Device *device); - ~GLES2CommandBuffer(); + GLES2CommandBuffer() = default; + ~GLES2CommandBuffer() override; friend class GLES2Queue; -public: - virtual bool initialize(const CommandBufferInfo &info) override; - virtual void destroy() override; - - virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) override; - virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) override; - virtual void endRenderPass() override; - virtual void bindPipelineState(PipelineState *pso) override; - virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; - virtual void bindInputAssembler(InputAssembler *ia) override; - virtual void setViewport(const Viewport &vp) override; - virtual void setScissor(const Rect &rect) override; - virtual void setLineWidth(float width) override; - virtual void setDepthBias(float constant, float clamp, float slope) override; - virtual void setBlendConstants(const Color &constants) override; - virtual void setDepthBound(float minBounds, float maxBounds) override; - virtual void setStencilWriteMask(StencilFace face, uint mask) override; - virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) override; - virtual void draw(InputAssembler *ia) override; - virtual void updateBuffer(Buffer *buff, const void *data, uint size) override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; - virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void bindPipelineState(PipelineState *pso) override; + void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; + void bindInputAssembler(InputAssembler *ia) override; + void setViewport(const Viewport &vp) override; + void setScissor(const Rect &rect) override; + void setLineWidth(float width) override; + void setDepthBias(float constant, float clamp, float slope) override; + void setBlendConstants(const Color &constants) override; + void setDepthBound(float minBounds, float maxBounds) override; + void setStencilWriteMask(StencilFace face, uint mask) override; + void setStencilCompareMask(StencilFace face, int ref, uint mask) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override {} + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override {} protected: - void BindStates(); + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; - GLES2GPUCommandAllocator *_cmdAllocator = nullptr; - GLES2CmdPackage *_curCmdPackage = nullptr; - queue _pendingPackages, _freePackages; + virtual void bindStates(); - bool _isInRenderPass = false; - GLES2GPUPipelineState *_curGPUPipelineState = nullptr; + GLES2GPUCommandAllocator *_cmdAllocator = nullptr; + GLES2CmdPackage * _curCmdPackage = nullptr; + queue _pendingPackages, _freePackages; + + bool _isInRenderPass = false; + GLES2GPUPipelineState * _curGPUPipelineState = nullptr; vector _curGPUDescriptorSets; - vector> _curDynamicOffsets; - GLES2GPUInputAssembler *_curGPUInputAssember = nullptr; - Viewport _curViewport; - Rect _curScissor; - float _curLineWidth = 1.0f; - GLES2DepthBias _curDepthBias; - Color _curBlendConstants; - GLES2DepthBounds _curDepthBounds; - GLES2StencilWriteMask _curStencilWriteMask; - GLES2StencilCompareMask _curStencilCompareMask; - bool _isStateInvalid = false; + vector> _curDynamicOffsets; + GLES2GPUInputAssembler * _curGPUInputAssember = nullptr; + Viewport _curViewport; + Rect _curScissor; + float _curLineWidth = 1.0F; + GLES2DepthBias _curDepthBias; + Color _curBlendConstants; + GLES2DepthBounds _curDepthBounds; + GLES2StencilWriteMask _curStencilWriteMask; + GLES2StencilCompareMask _curStencilCompareMask; + bool _isStateInvalid = false; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp index 27b6ae2d86..9698f5f40d 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Commands.h" @@ -33,60 +35,60 @@ namespace cc { namespace gfx { namespace { -GLenum MapGLInternalFormat(Format format) { +GLenum mapGLInternalFormat(Format format) { switch (format) { case Format::A8: return GL_ALPHA; case Format::L8: return GL_LUMINANCE; case Format::LA8: return GL_LUMINANCE_ALPHA; - case Format::R8: return GL_LUMINANCE; - case Format::R8SN: return GL_LUMINANCE; - case Format::R8UI: return GL_LUMINANCE; + case Format::R8: + case Format::R8SN: + case Format::R8UI: case Format::R8I: return GL_LUMINANCE; - case Format::RG8: return GL_LUMINANCE_ALPHA; - case Format::RG8SN: return GL_LUMINANCE_ALPHA; - case Format::RG8UI: return GL_LUMINANCE_ALPHA; + case Format::RG8: + case Format::RG8SN: + case Format::RG8UI: case Format::RG8I: return GL_LUMINANCE_ALPHA; - case Format::RGB8: return GL_RGB; - case Format::RGB8SN: return GL_RGB; - case Format::RGB8UI: return GL_RGB; + case Format::RGB8: + case Format::RGB8SN: + case Format::RGB8UI: case Format::RGB8I: return GL_RGB; - case Format::RGBA8: return GL_RGBA; - case Format::RGBA8SN: return GL_RGBA; - case Format::RGBA8UI: return GL_RGBA; + case Format::RGBA8: + case Format::RGBA8SN: + case Format::RGBA8UI: case Format::RGBA8I: return GL_RGBA; - case Format::R16I: return GL_LUMINANCE; - case Format::R16UI: return GL_LUMINANCE; + case Format::R16I: + case Format::R16UI: case Format::R16F: return GL_LUMINANCE; - case Format::RG16I: return GL_LUMINANCE_ALPHA; - case Format::RG16UI: return GL_LUMINANCE_ALPHA; + case Format::RG16I: + case Format::RG16UI: case Format::RG16F: return GL_LUMINANCE_ALPHA; - case Format::RGB16I: return GL_RGB; - case Format::RGB16UI: return GL_RGB; + case Format::RGB16I: + case Format::RGB16UI: case Format::RGB16F: return GL_RGB; - case Format::RGBA16I: return GL_RGBA; - case Format::RGBA16UI: return GL_RGBA; + case Format::RGBA16I: + case Format::RGBA16UI: case Format::RGBA16F: return GL_RGBA; - case Format::R32I: return GL_LUMINANCE; - case Format::R32UI: return GL_LUMINANCE; + case Format::R32I: + case Format::R32UI: case Format::R32F: return GL_LUMINANCE; - case Format::RG32I: return GL_LUMINANCE_ALPHA; - case Format::RG32UI: return GL_LUMINANCE_ALPHA; + case Format::RG32I: + case Format::RG32UI: case Format::RG32F: return GL_LUMINANCE_ALPHA; - case Format::RGB32I: return GL_RGB; - case Format::RGB32UI: return GL_RGB; + case Format::RGB32I: + case Format::RGB32UI: case Format::RGB32F: return GL_RGB; - case Format::RGBA32I: return GL_RGBA; - case Format::RGBA32UI: return GL_RGBA; #if CC_PLATFORM == CC_PLATFORM_WINDOWS case Format::RGBA32F: return GL_RGBA32F_EXT; // driver issue #else - case Format::RGBA32F: return GL_RGBA; + case Format::RGBA32F: #endif + case Format::RGBA32I: + case Format::RGBA32UI: return GL_RGBA; case Format::R5G6B5: return GL_RGB565; case Format::RGB5A1: return GL_RGB5_A1; case Format::RGBA4: return GL_RGBA4; - case Format::RGB10A2: return GL_RGB; - case Format::RGB10A2UI: return GL_RGB; + case Format::RGB10A2: + case Format::RGB10A2UI: case Format::R11G11B10F: return GL_RGB; case Format::D16: return GL_DEPTH_COMPONENT; case Format::D16S8: return GL_DEPTH_STENCIL_OES; @@ -113,35 +115,35 @@ GLenum MapGLInternalFormat(Format format) { case Format::PVRTC_RGB4: return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; case Format::PVRTC_RGBA4: return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - case Format::ASTC_RGBA_4x4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; - case Format::ASTC_RGBA_5x4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; - case Format::ASTC_RGBA_5x5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; - case Format::ASTC_RGBA_6x5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; - case Format::ASTC_RGBA_6x6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; - case Format::ASTC_RGBA_8x5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; - case Format::ASTC_RGBA_8x6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; - case Format::ASTC_RGBA_8x8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; - case Format::ASTC_RGBA_10x5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; - case Format::ASTC_RGBA_10x6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; - case Format::ASTC_RGBA_10x8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; - case Format::ASTC_RGBA_10x10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; - case Format::ASTC_RGBA_12x10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; - case Format::ASTC_RGBA_12x12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; + case Format::ASTC_RGBA_4X4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; + case Format::ASTC_RGBA_5X4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; + case Format::ASTC_RGBA_5X5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; + case Format::ASTC_RGBA_6X5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; + case Format::ASTC_RGBA_6X6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; + case Format::ASTC_RGBA_8X5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; + case Format::ASTC_RGBA_8X6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; + case Format::ASTC_RGBA_8X8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; + case Format::ASTC_RGBA_10X5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; + case Format::ASTC_RGBA_10X6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; + case Format::ASTC_RGBA_10X8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; + case Format::ASTC_RGBA_10X10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; + case Format::ASTC_RGBA_12X10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; + case Format::ASTC_RGBA_12X12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; - case Format::ASTC_SRGBA_4x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; - case Format::ASTC_SRGBA_5x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; - case Format::ASTC_SRGBA_5x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; - case Format::ASTC_SRGBA_6x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; - case Format::ASTC_SRGBA_6x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; - case Format::ASTC_SRGBA_8x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; - case Format::ASTC_SRGBA_8x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; - case Format::ASTC_SRGBA_8x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; - case Format::ASTC_SRGBA_10x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; - case Format::ASTC_SRGBA_10x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; - case Format::ASTC_SRGBA_10x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; - case Format::ASTC_SRGBA_10x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; - case Format::ASTC_SRGBA_12x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; - case Format::ASTC_SRGBA_12x12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; + case Format::ASTC_SRGBA_4X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; + case Format::ASTC_SRGBA_5X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; + case Format::ASTC_SRGBA_5X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; + case Format::ASTC_SRGBA_6X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; + case Format::ASTC_SRGBA_6X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; + case Format::ASTC_SRGBA_8X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; + case Format::ASTC_SRGBA_8X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; + case Format::ASTC_SRGBA_8X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; + case Format::ASTC_SRGBA_10X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; + case Format::ASTC_SRGBA_10X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; + case Format::ASTC_SRGBA_10X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; + case Format::ASTC_SRGBA_10X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; + case Format::ASTC_SRGBA_12X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; + case Format::ASTC_SRGBA_12X12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; default: { CCASSERT(false, "Unsupported Format, convert to GL internal format failed."); @@ -150,7 +152,7 @@ GLenum MapGLInternalFormat(Format format) { } } -GLenum MapGLFormat(Format format) { +GLenum mapGLFormat(Format format) { switch (format) { case Format::A8: return GL_ALPHA; case Format::L8: return GL_LUMINANCE; @@ -194,11 +196,11 @@ GLenum MapGLFormat(Format format) { case Format::RGB32F: return GL_RGB; case Format::RGBA32UI: case Format::RGBA32I: - case Format::RGBA32F: return GL_RGBA; + case Format::RGBA32F: case Format::RGB10A2: return GL_RGBA; - case Format::R11G11B10F: return GL_RGB; + case Format::R11G11B10F: case Format::R5G6B5: return GL_RGB; - case Format::RGB5A1: return GL_RGBA; + case Format::RGB5A1: case Format::RGBA4: return GL_RGBA; case Format::D16: return GL_DEPTH_COMPONENT; case Format::D16S8: return GL_DEPTH_STENCIL_OES; @@ -225,35 +227,35 @@ GLenum MapGLFormat(Format format) { case Format::PVRTC_RGB4: return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; case Format::PVRTC_RGBA4: return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - case Format::ASTC_RGBA_4x4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; - case Format::ASTC_RGBA_5x4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; - case Format::ASTC_RGBA_5x5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; - case Format::ASTC_RGBA_6x5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; - case Format::ASTC_RGBA_6x6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; - case Format::ASTC_RGBA_8x5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; - case Format::ASTC_RGBA_8x6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; - case Format::ASTC_RGBA_8x8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; - case Format::ASTC_RGBA_10x5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; - case Format::ASTC_RGBA_10x6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; - case Format::ASTC_RGBA_10x8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; - case Format::ASTC_RGBA_10x10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; - case Format::ASTC_RGBA_12x10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; - case Format::ASTC_RGBA_12x12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; + case Format::ASTC_RGBA_4X4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; + case Format::ASTC_RGBA_5X4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; + case Format::ASTC_RGBA_5X5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; + case Format::ASTC_RGBA_6X5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; + case Format::ASTC_RGBA_6X6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; + case Format::ASTC_RGBA_8X5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; + case Format::ASTC_RGBA_8X6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; + case Format::ASTC_RGBA_8X8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; + case Format::ASTC_RGBA_10X5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; + case Format::ASTC_RGBA_10X6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; + case Format::ASTC_RGBA_10X8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; + case Format::ASTC_RGBA_10X10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; + case Format::ASTC_RGBA_12X10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; + case Format::ASTC_RGBA_12X12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; - case Format::ASTC_SRGBA_4x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; - case Format::ASTC_SRGBA_5x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; - case Format::ASTC_SRGBA_5x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; - case Format::ASTC_SRGBA_6x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; - case Format::ASTC_SRGBA_6x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; - case Format::ASTC_SRGBA_8x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; - case Format::ASTC_SRGBA_8x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; - case Format::ASTC_SRGBA_8x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; - case Format::ASTC_SRGBA_10x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; - case Format::ASTC_SRGBA_10x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; - case Format::ASTC_SRGBA_10x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; - case Format::ASTC_SRGBA_10x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; - case Format::ASTC_SRGBA_12x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; - case Format::ASTC_SRGBA_12x12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; + case Format::ASTC_SRGBA_4X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; + case Format::ASTC_SRGBA_5X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; + case Format::ASTC_SRGBA_5X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; + case Format::ASTC_SRGBA_6X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; + case Format::ASTC_SRGBA_6X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; + case Format::ASTC_SRGBA_8X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; + case Format::ASTC_SRGBA_8X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; + case Format::ASTC_SRGBA_8X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; + case Format::ASTC_SRGBA_10X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; + case Format::ASTC_SRGBA_10X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; + case Format::ASTC_SRGBA_10X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; + case Format::ASTC_SRGBA_10X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; + case Format::ASTC_SRGBA_12X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; + case Format::ASTC_SRGBA_12X12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; default: { CCASSERT(false, "Unsupported Format, convert to WebGL format failed."); @@ -262,7 +264,7 @@ GLenum MapGLFormat(Format format) { } } -GLenum MapGLType(Type type) { +GLenum mapGLType(Type type) { switch (type) { case Type::BOOL: return GL_BOOL; case Type::BOOL2: return GL_BOOL_VEC2; @@ -290,7 +292,7 @@ GLenum MapGLType(Type type) { } } -Type MapType(GLenum glType) { +Type mapType(GLenum glType) { switch (glType) { case GL_BOOL: return Type::BOOL; case GL_BOOL_VEC2: return Type::BOOL2; @@ -318,7 +320,7 @@ Type MapType(GLenum glType) { } } -GLenum FormatToGLType(Format format) { +GLenum formatToGLType(Format format) { switch (format) { case Format::R8: return GL_UNSIGNED_BYTE; case Format::R8SN: return GL_BYTE; @@ -340,7 +342,7 @@ GLenum FormatToGLType(Format format) { case Format::RG32UI: return GL_UNSIGNED_INT; case Format::RG32I: return GL_INT; - case Format::RGB8: return GL_UNSIGNED_BYTE; + case Format::RGB8: case Format::SRGB8: return GL_UNSIGNED_BYTE; case Format::RGB8SN: return GL_BYTE; case Format::RGB8UI: return GL_UNSIGNED_BYTE; @@ -352,7 +354,7 @@ GLenum FormatToGLType(Format format) { case Format::RGB32UI: return GL_UNSIGNED_INT; case Format::RGB32I: return GL_INT; - case Format::RGBA8: return GL_UNSIGNED_BYTE; + case Format::RGBA8: case Format::SRGB8_A8: return GL_UNSIGNED_BYTE; case Format::RGBA8SN: return GL_BYTE; case Format::RGBA8UI: return GL_UNSIGNED_BYTE; @@ -379,66 +381,66 @@ GLenum FormatToGLType(Format format) { case Format::D32F: return GL_UNSIGNED_INT; case Format::D32F_S8: return GL_UNSIGNED_INT_24_8_OES; - case Format::BC1: return GL_UNSIGNED_BYTE; - case Format::BC1_SRGB: return GL_UNSIGNED_BYTE; - case Format::BC2: return GL_UNSIGNED_BYTE; - case Format::BC2_SRGB: return GL_UNSIGNED_BYTE; - case Format::BC3: return GL_UNSIGNED_BYTE; - case Format::BC3_SRGB: return GL_UNSIGNED_BYTE; + case Format::BC1: + case Format::BC1_SRGB: + case Format::BC2: + case Format::BC2_SRGB: + case Format::BC3: + case Format::BC3_SRGB: case Format::BC4: return GL_UNSIGNED_BYTE; case Format::BC4_SNORM: return GL_BYTE; case Format::BC5: return GL_UNSIGNED_BYTE; case Format::BC5_SNORM: return GL_BYTE; - case Format::BC6H_SF16: return GL_FLOAT; + case Format::BC6H_SF16: case Format::BC6H_UF16: return GL_FLOAT; - case Format::BC7: return GL_UNSIGNED_BYTE; - case Format::BC7_SRGB: return GL_UNSIGNED_BYTE; + case Format::BC7: + case Format::BC7_SRGB: - case Format::ETC_RGB8: return GL_UNSIGNED_BYTE; - case Format::ETC2_RGB8: return GL_UNSIGNED_BYTE; - case Format::ETC2_SRGB8: return GL_UNSIGNED_BYTE; - case Format::ETC2_RGB8_A1: return GL_UNSIGNED_BYTE; - case Format::ETC2_SRGB8_A1: return GL_UNSIGNED_BYTE; + case Format::ETC_RGB8: + case Format::ETC2_RGB8: + case Format::ETC2_SRGB8: + case Format::ETC2_RGB8_A1: + case Format::ETC2_SRGB8_A1: case Format::EAC_R11: return GL_UNSIGNED_BYTE; case Format::EAC_R11SN: return GL_BYTE; case Format::EAC_RG11: return GL_UNSIGNED_BYTE; case Format::EAC_RG11SN: return GL_BYTE; - case Format::PVRTC_RGB2: return GL_UNSIGNED_BYTE; - case Format::PVRTC_RGBA2: return GL_UNSIGNED_BYTE; - case Format::PVRTC_RGB4: return GL_UNSIGNED_BYTE; - case Format::PVRTC_RGBA4: return GL_UNSIGNED_BYTE; - case Format::PVRTC2_2BPP: return GL_UNSIGNED_BYTE; - case Format::PVRTC2_4BPP: return GL_UNSIGNED_BYTE; + case Format::PVRTC_RGB2: + case Format::PVRTC_RGBA2: + case Format::PVRTC_RGB4: + case Format::PVRTC_RGBA4: + case Format::PVRTC2_2BPP: + case Format::PVRTC2_4BPP: - case Format::ASTC_RGBA_4x4: - case Format::ASTC_RGBA_5x4: - case Format::ASTC_RGBA_5x5: - case Format::ASTC_RGBA_6x5: - case Format::ASTC_RGBA_6x6: - case Format::ASTC_RGBA_8x5: - case Format::ASTC_RGBA_8x6: - case Format::ASTC_RGBA_8x8: - case Format::ASTC_RGBA_10x5: - case Format::ASTC_RGBA_10x6: - case Format::ASTC_RGBA_10x8: - case Format::ASTC_RGBA_10x10: - case Format::ASTC_RGBA_12x10: - case Format::ASTC_RGBA_12x12: - case Format::ASTC_SRGBA_4x4: - case Format::ASTC_SRGBA_5x4: - case Format::ASTC_SRGBA_5x5: - case Format::ASTC_SRGBA_6x5: - case Format::ASTC_SRGBA_6x6: - case Format::ASTC_SRGBA_8x5: - case Format::ASTC_SRGBA_8x6: - case Format::ASTC_SRGBA_8x8: - case Format::ASTC_SRGBA_10x5: - case Format::ASTC_SRGBA_10x6: - case Format::ASTC_SRGBA_10x8: - case Format::ASTC_SRGBA_10x10: - case Format::ASTC_SRGBA_12x10: - case Format::ASTC_SRGBA_12x12: + case Format::ASTC_RGBA_4X4: + case Format::ASTC_RGBA_5X4: + case Format::ASTC_RGBA_5X5: + case Format::ASTC_RGBA_6X5: + case Format::ASTC_RGBA_6X6: + case Format::ASTC_RGBA_8X5: + case Format::ASTC_RGBA_8X6: + case Format::ASTC_RGBA_8X8: + case Format::ASTC_RGBA_10X5: + case Format::ASTC_RGBA_10X6: + case Format::ASTC_RGBA_10X8: + case Format::ASTC_RGBA_10X10: + case Format::ASTC_RGBA_12X10: + case Format::ASTC_RGBA_12X12: + case Format::ASTC_SRGBA_4X4: + case Format::ASTC_SRGBA_5X4: + case Format::ASTC_SRGBA_5X5: + case Format::ASTC_SRGBA_6X5: + case Format::ASTC_SRGBA_6X6: + case Format::ASTC_SRGBA_8X5: + case Format::ASTC_SRGBA_8X6: + case Format::ASTC_SRGBA_8X8: + case Format::ASTC_SRGBA_10X5: + case Format::ASTC_SRGBA_10X6: + case Format::ASTC_SRGBA_10X8: + case Format::ASTC_SRGBA_10X10: + case Format::ASTC_SRGBA_12X10: + case Format::ASTC_SRGBA_12X12: return GL_UNSIGNED_BYTE; default: { @@ -447,7 +449,7 @@ GLenum FormatToGLType(Format format) { } } -uint GLTypeSize(GLenum glType) { +uint glTypeSize(GLenum glType) { switch (glType) { case GL_BOOL: return 4; case GL_BOOL_VEC2: return 8; @@ -457,20 +459,20 @@ uint GLTypeSize(GLenum glType) { case GL_INT_VEC2: return 8; case GL_INT_VEC3: return 12; case GL_INT_VEC4: return 16; - case GL_UNSIGNED_INT: return 4; + case GL_UNSIGNED_INT: case GL_FLOAT: return 4; case GL_FLOAT_VEC2: return 8; case GL_FLOAT_VEC3: return 12; - case GL_FLOAT_VEC4: return 16; + case GL_FLOAT_VEC4: case GL_FLOAT_MAT2: return 16; case GL_FLOAT_MAT3: return 36; case GL_FLOAT_MAT4: return 64; - case GL_SAMPLER_2D: return 4; - case GL_SAMPLER_3D_OES: return 4; - case GL_SAMPLER_CUBE: return 4; - case GL_SAMPLER_CUBE_MAP_ARRAY_OES: return 4; - case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES: return 4; - case GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES: return 4; + case GL_SAMPLER_2D: + case GL_SAMPLER_3D_OES: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_CUBE_MAP_ARRAY_OES: + case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES: + case GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES: case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES: return 4; default: { CCASSERT(false, "Unsupported GLType, get type failed."); @@ -479,7 +481,7 @@ uint GLTypeSize(GLenum glType) { } } -uint GLComponentCount(GLenum glType) { +uint glComponentCount(GLenum glType) { switch (glType) { case GL_FLOAT_MAT2: return 2; case GL_FLOAT_MAT3: return 3; @@ -546,18 +548,18 @@ const GLenum GLES2_BLEND_FACTORS[] = { }; } // namespace -void GLES2CmdFuncCreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { +void cmdFuncGLES2CreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLenum glUsage = (gpuBuffer->memUsage & MemoryUsageBit::HOST ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); + GLenum glUsage = (hasFlag(gpuBuffer->memUsage, MemoryUsageBit::HOST) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); - if (gpuBuffer->usage & BufferUsageBit::VERTEX) { + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) { gpuBuffer->glTarget = GL_ARRAY_BUFFER; GL_CHECK(glGenBuffers(1, &gpuBuffer->glBuffer)); if (gpuBuffer->size) { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -570,14 +572,14 @@ void GLES2CmdFuncCreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); device->stateCache()->glArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDEX) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) { gpuBuffer->glTarget = GL_ELEMENT_ARRAY_BUFFER; GL_CHECK(glGenBuffers(1, &gpuBuffer->glBuffer)); if (gpuBuffer->size) { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -590,14 +592,12 @@ void GLES2CmdFuncCreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); device->stateCache()->glElementArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::UNIFORM) { - gpuBuffer->buffer = (uint8_t *)CC_MALLOC(gpuBuffer->size); + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { gpuBuffer->glTarget = GL_NONE; - } else if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { - gpuBuffer->glTarget = GL_NONE; - } else if ((gpuBuffer->usage & BufferUsageBit::TRANSFER_DST) || - (gpuBuffer->usage & BufferUsageBit::TRANSFER_SRC)) { - gpuBuffer->buffer = (uint8_t *)CC_MALLOC(gpuBuffer->size); + } else if ((hasFlag(gpuBuffer->usage, BufferUsageBit::UNIFORM)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_DST)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_SRC))) { + gpuBuffer->buffer = static_cast(CC_MALLOC(gpuBuffer->size)); gpuBuffer->glTarget = GL_NONE; } else { CCASSERT(false, "Unsupported BufferType, create buffer failed."); @@ -605,14 +605,14 @@ void GLES2CmdFuncCreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { } } -void GLES2CmdFuncDestroyBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { +void cmdFuncGLES2DestroyBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; if (gpuBuffer->glBuffer) { - if (gpuBuffer->usage & BufferUsageBit::VERTEX) { + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -620,11 +620,11 @@ void GLES2CmdFuncDestroyBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); device->stateCache()->glArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDEX) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -639,17 +639,17 @@ void GLES2CmdFuncDestroyBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { CC_SAFE_FREE(gpuBuffer->buffer); } -void GLES2CmdFuncResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { +void cmdFuncGLES2ResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLenum glUsage = (gpuBuffer->memUsage & MemoryUsageBit::HOST ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); + GLenum glUsage = (hasFlag(gpuBuffer->memUsage, MemoryUsageBit::HOST) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); - if (gpuBuffer->usage & BufferUsageBit::VERTEX) { + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) { gpuBuffer->glTarget = GL_ARRAY_BUFFER; if (gpuBuffer->size) { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -662,13 +662,13 @@ void GLES2CmdFuncResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); device->stateCache()->glArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDEX) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) { gpuBuffer->glTarget = GL_ELEMENT_ARRAY_BUFFER; if (gpuBuffer->size) { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -681,21 +681,16 @@ void GLES2CmdFuncResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); device->stateCache()->glElementArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::UNIFORM) { - if (gpuBuffer->buffer) { - CC_FREE(gpuBuffer->buffer); - } - gpuBuffer->buffer = (uint8_t *)CC_MALLOC(gpuBuffer->size); - gpuBuffer->glTarget = GL_NONE; - } else if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { gpuBuffer->indirects.resize(gpuBuffer->count); gpuBuffer->glTarget = GL_NONE; - } else if ((gpuBuffer->usage & BufferUsageBit::TRANSFER_DST) || - (gpuBuffer->usage & BufferUsageBit::TRANSFER_SRC)) { + } else if ((hasFlag(gpuBuffer->usage, BufferUsageBit::UNIFORM)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_DST)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_SRC))) { if (gpuBuffer->buffer) { CC_FREE(gpuBuffer->buffer); } - gpuBuffer->buffer = (uint8_t *)CC_MALLOC(gpuBuffer->size); + gpuBuffer->buffer = static_cast(CC_MALLOC(gpuBuffer->size)); gpuBuffer->glTarget = GL_NONE; } else { CCASSERT(false, "Unsupported BufferType, resize buffer failed."); @@ -703,10 +698,10 @@ void GLES2CmdFuncResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer) { } } -void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) { - gpuTexture->glInternelFmt = MapGLInternalFormat(gpuTexture->format); - gpuTexture->glFormat = MapGLFormat(gpuTexture->format); - gpuTexture->glType = FormatToGLType(gpuTexture->format); +void cmdFuncGLES2CreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) { + gpuTexture->glInternelFmt = mapGLInternalFormat(gpuTexture->format); + gpuTexture->glFormat = mapGLFormat(gpuTexture->format); + gpuTexture->glType = formatToGLType(gpuTexture->format); switch (gpuTexture->type) { case TextureType::TEX2D: { @@ -720,7 +715,7 @@ void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) } uint w = gpuTexture->width; uint h = gpuTexture->height; - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { GL_CHECK(glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); w = std::max(1U, w >> 1); @@ -728,7 +723,7 @@ void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) } } else { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -746,7 +741,7 @@ void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) GL_CHECK(glBindTexture(GL_TEXTURE_CUBE_MAP, gpuTexture->glTexture)); glTexture = gpuTexture->glTexture; } - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint f = 0; f < 6; ++f) { uint w = gpuTexture->width; uint h = gpuTexture->height; @@ -761,7 +756,7 @@ void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) uint w = gpuTexture->width; uint h = gpuTexture->height; for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -777,7 +772,7 @@ void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) } } -void GLES2CmdFuncDestroyTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) { +void cmdFuncGLES2DestroyTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) { if (gpuTexture->glTexture) { for (GLuint &glTexture : device->stateCache()->glTextures) { if (glTexture == gpuTexture->glTexture) { @@ -789,10 +784,10 @@ void GLES2CmdFuncDestroyTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture } } -void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) { - gpuTexture->glInternelFmt = MapGLInternalFormat(gpuTexture->format); - gpuTexture->glFormat = MapGLFormat(gpuTexture->format); - gpuTexture->glType = FormatToGLType(gpuTexture->format); +void cmdFuncGLES2ResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) { + gpuTexture->glInternelFmt = mapGLInternalFormat(gpuTexture->format); + gpuTexture->glFormat = mapGLFormat(gpuTexture->format); + gpuTexture->glType = formatToGLType(gpuTexture->format); switch (gpuTexture->type) { case TextureType::TEX2D: { @@ -805,7 +800,7 @@ void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) } uint w = gpuTexture->width; uint h = gpuTexture->height; - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { GL_CHECK(glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); w = std::max(1U, w >> 1); @@ -813,7 +808,7 @@ void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) } } else { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -830,7 +825,7 @@ void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) GL_CHECK(glBindTexture(GL_TEXTURE_CUBE_MAP, gpuTexture->glTexture)); glTexture = gpuTexture->glTexture; } - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint f = 0; f < 6; ++f) { uint w = gpuTexture->width; uint h = gpuTexture->height; @@ -845,7 +840,7 @@ void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) uint w = gpuTexture->width; uint h = gpuTexture->height; for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -861,7 +856,7 @@ void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture) } } -void GLES2CmdFuncCreateSampler(GLES2Device *device, GLES2GPUSampler *gpuSampler) { +void cmdFuncGLES2CreateSampler(GLES2Device * /*device*/, GLES2GPUSampler *gpuSampler) { if (gpuSampler->minFilter == Filter::LINEAR || gpuSampler->minFilter == Filter::ANISOTROPIC) { if (gpuSampler->mipFilter == Filter::LINEAR || gpuSampler->mipFilter == Filter::ANISOTROPIC) { gpuSampler->glMinFilter = GL_LINEAR_MIPMAP_LINEAR; @@ -886,30 +881,30 @@ void GLES2CmdFuncCreateSampler(GLES2Device *device, GLES2GPUSampler *gpuSampler) gpuSampler->glMagFilter = GL_NEAREST; } - gpuSampler->glWrapS = GLES2_WRAPS[(int)gpuSampler->addressU]; - gpuSampler->glWrapT = GLES2_WRAPS[(int)gpuSampler->addressV]; - gpuSampler->glWrapR = GLES2_WRAPS[(int)gpuSampler->addressW]; + gpuSampler->glWrapS = GLES2_WRAPS[static_cast(gpuSampler->addressU)]; + gpuSampler->glWrapT = GLES2_WRAPS[static_cast(gpuSampler->addressV)]; + gpuSampler->glWrapR = GLES2_WRAPS[static_cast(gpuSampler->addressW)]; } -void GLES2CmdFuncDestroySampler(GLES2Device *device, GLES2GPUSampler *gpuSampler) { +void cmdFuncGLES2DestroySampler(GLES2Device *device, GLES2GPUSampler *gpuSampler) { } -void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { +void cmdFuncGLES2CreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { GLenum glShaderType = 0; String shaderTypeStr; - GLint status; + GLint status; for (size_t i = 0; i < gpuShader->gpuStages.size(); ++i) { GLES2GPUShaderStage &gpuStage = gpuShader->gpuStages[i]; switch (gpuStage.type) { case ShaderStageFlagBit::VERTEX: { - glShaderType = GL_VERTEX_SHADER; + glShaderType = GL_VERTEX_SHADER; shaderTypeStr = "Vertex Shader"; break; } case ShaderStageFlagBit::FRAGMENT: { - glShaderType = GL_FRAGMENT_SHADER; + glShaderType = GL_FRAGMENT_SHADER; shaderTypeStr = "Fragment Shader"; break; } @@ -930,11 +925,11 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { GL_CHECK(glGetShaderiv(gpuStage.glShader, GL_INFO_LOG_LENGTH, &logSize)); ++logSize; - GLchar *logs = (GLchar *)CC_MALLOC(logSize); + auto *logs = static_cast(CC_MALLOC(logSize)); GL_CHECK(glGetShaderInfoLog(gpuStage.glShader, logSize, nullptr, logs)); CC_LOG_ERROR("%s in %s compilation failed.", shaderTypeStr.c_str(), gpuShader->name.c_str()); - CC_LOG_ERROR("Shader source:%s", gpuStage.source.c_str()); + CC_LOG_ERROR("Shader source:%s", shaderSrc); CC_LOG_ERROR(logs); CC_FREE(logs); GL_CHECK(glDeleteShader(gpuStage.glShader)); @@ -970,10 +965,9 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_INFO_LOG_LENGTH, &logSize)); if (logSize) { ++logSize; - GLchar *logs = (GLchar *)CC_MALLOC(logSize); + auto *logs = static_cast(CC_MALLOC(logSize)); GL_CHECK(glGetProgramInfoLog(gpuShader->glProgram, logSize, nullptr, logs)); - CC_LOG_ERROR("Failed to link shader '%s'.", gpuShader->name.c_str()); CC_LOG_ERROR(logs); CC_FREE(logs); return; @@ -983,14 +977,14 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { CC_LOG_INFO("Shader '%s' compilation succeeded.", gpuShader->name.c_str()); GLint attrMaxLength = 0; - GLint attrCount = 0; + GLint attrCount = 0; GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &attrMaxLength)); GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_ACTIVE_ATTRIBUTES, &attrCount)); - GLchar glName[256]; + GLchar glName[256]; GLsizei glLength; GLsizei glSize; - GLenum glType; + GLenum glType; gpuShader->glInputs.resize(attrCount); for (GLint i = 0; i < attrCount; ++i) { @@ -1003,44 +997,43 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { glName[offset - glName] = '\0'; } - gpuInput.glLoc = glGetAttribLocation(gpuShader->glProgram, glName); + gpuInput.glLoc = glGetAttribLocation(gpuShader->glProgram, glName); gpuInput.binding = gpuInput.glLoc; - gpuInput.name = glName; - gpuInput.type = MapType(glType); - gpuInput.stride = GLTypeSize(glType); - gpuInput.count = glSize; - gpuInput.size = gpuInput.stride * gpuInput.count; - gpuInput.glType = glType; + gpuInput.name = glName; + gpuInput.type = mapType(glType); + gpuInput.stride = glTypeSize(glType); + gpuInput.count = glSize; + gpuInput.size = gpuInput.stride * gpuInput.count; + gpuInput.glType = glType; } // create uniform blocks - if (gpuShader->blocks.size()) { - + if (!gpuShader->blocks.empty()) { gpuShader->glBlocks.resize(gpuShader->blocks.size()); for (size_t i = 0; i < gpuShader->glBlocks.size(); ++i) { GLES2GPUUniformBlock &gpuBlock = gpuShader->glBlocks[i]; - UniformBlock &block = gpuShader->blocks[i]; + UniformBlock & block = gpuShader->blocks[i]; - gpuBlock.name = block.name; - gpuBlock.set = block.set; + gpuBlock.name = block.name; + gpuBlock.set = block.set; gpuBlock.binding = block.binding; gpuBlock.glUniforms.resize(block.members.size()); for (size_t j = 0; j < gpuBlock.glUniforms.size(); ++j) { GLES2GPUUniform &gpuUniform = gpuBlock.glUniforms[j]; - Uniform &uniform = block.members[j]; + Uniform & uniform = block.members[j]; - gpuUniform.binding = GFX_INVALID_BINDING; - gpuUniform.name = uniform.name; - gpuUniform.type = uniform.type; - gpuUniform.stride = GFX_TYPE_SIZES[(int)uniform.type]; - gpuUniform.count = uniform.count; - gpuUniform.size = gpuUniform.stride * gpuUniform.count; - gpuUniform.offset = gpuBlock.size; - gpuUniform.glType = MapGLType(gpuUniform.type); - gpuUniform.glLoc = -1; - gpuUniform.buff = nullptr; + gpuUniform.binding = INVALID_BINDING; + gpuUniform.name = uniform.name; + gpuUniform.type = uniform.type; + gpuUniform.stride = GFX_TYPE_SIZES[static_cast(uniform.type)]; + gpuUniform.count = uniform.count; + gpuUniform.size = gpuUniform.stride * gpuUniform.count; + gpuUniform.offset = gpuBlock.size; + gpuUniform.glType = mapGLType(gpuUniform.type); + gpuUniform.glLoc = -1; + gpuUniform.buff = nullptr; gpuBlock.size += gpuUniform.size; } @@ -1048,19 +1041,18 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { } // if // create uniform samplers - if (gpuShader->samplers.size()) { - gpuShader->glSamplers.resize(gpuShader->samplers.size()); + if (!gpuShader->samplerTextures.empty()) { + gpuShader->glSamplerTextures.resize(gpuShader->samplerTextures.size()); - for (size_t i = 0; i < gpuShader->glSamplers.size(); ++i) { - UniformSampler &sampler = gpuShader->samplers[i]; - GLES2GPUUniformSampler &gpuSampler = gpuShader->glSamplers[i]; - gpuSampler.set = sampler.set; - gpuSampler.binding = sampler.binding; - gpuSampler.name = sampler.name; - gpuSampler.type = sampler.type; - gpuSampler.count = sampler.count; - gpuSampler.glType = MapGLType(gpuSampler.type); - gpuSampler.glLoc = -1; + for (size_t i = 0; i < gpuShader->glSamplerTextures.size(); ++i) { + UniformSamplerTexture & samplerTexture = gpuShader->samplerTextures[i]; + GLES2GPUUniformSamplerTexture &gpuSamplerTexture = gpuShader->glSamplerTextures[i]; + gpuSamplerTexture.set = samplerTexture.set; + gpuSamplerTexture.binding = samplerTexture.binding; + gpuSamplerTexture.name = samplerTexture.name; + gpuSamplerTexture.count = samplerTexture.count; + gpuSamplerTexture.glType = mapGLType(samplerTexture.type); + gpuSamplerTexture.glLoc = -1; } } @@ -1090,8 +1082,8 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { for (size_t u = 0; u < gpuBlock.glUniforms.size(); ++u) { if (gpuBlock.glUniforms[u].name == name) { GLES2GPUUniform &gpuUniform = gpuBlock.glUniforms[u]; - gpuUniform.glLoc = glGetUniformLocation(gpuShader->glProgram, glName); - gpuUniform.buff = (uint8_t *)CC_MALLOC(gpuUniform.size); + gpuUniform.glLoc = glGetUniformLocation(gpuShader->glProgram, glName); + gpuUniform.buff = static_cast(CC_MALLOC(gpuUniform.size)); gpuBlock.glActiveUniforms.emplace_back(gpuUniform); break; @@ -1102,65 +1094,67 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { } // for // texture unit index mapping optimization - vector glActiveSamplers; - vector glActiveSamplerLocations; - const BindingMappingInfo &bindingMappingInfo = device->bindingMappingInfo(); - map &texUnitCacheMap = device->stateCache()->texUnitCacheMap; + vector glActiveSamplerTextures; + vector glActiveSamplerLocations; + const BindingMappingInfo & bindingMappingInfo = device->bindingMappingInfo(); + unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; - uint flexibleSetBaseOffset = 0u; - for (uint i = 0u; i < gpuShader->blocks.size(); i++) { - if (gpuShader->blocks[i].set == bindingMappingInfo.flexibleSet) { + // sampler bindings in the flexible set comes strictly after buffer bindings + // so we need to subtract the buffer count for these samplers + uint flexibleSetBaseOffset = 0U; + for (auto &block : gpuShader->blocks) { + if (block.set == bindingMappingInfo.flexibleSet) { flexibleSetBaseOffset++; } } - uint arrayOffset = 0u; + uint arrayOffset = 0U; - for (uint i = 0u; i < gpuShader->samplers.size(); i++) { - const UniformSampler &sampler = gpuShader->samplers[i]; - GLint glLoc = glGetUniformLocation(gpuShader->glProgram, sampler.name.c_str()); + for (uint i = 0U; i < gpuShader->samplerTextures.size(); i++) { + const UniformSamplerTexture &samplerTexture = gpuShader->samplerTextures[i]; + GLint glLoc = glGetUniformLocation(gpuShader->glProgram, samplerTexture.name.c_str()); if (glLoc >= 0) { - glActiveSamplers.push_back(gpuShader->glSamplers[i]); + glActiveSamplerTextures.push_back(gpuShader->glSamplerTextures[i]); glActiveSamplerLocations.push_back(glLoc); } - if (!texUnitCacheMap.count(sampler.name)) { - uint binding = sampler.binding + bindingMappingInfo.samplerOffsets[sampler.set] + arrayOffset; - if (sampler.set == bindingMappingInfo.flexibleSet) binding -= flexibleSetBaseOffset; - texUnitCacheMap[sampler.name] = binding % device->getMaxTextureUnits(); - arrayOffset += sampler.count - 1; + if (!texUnitCacheMap.count(samplerTexture.name)) { + uint binding = samplerTexture.binding + bindingMappingInfo.samplerOffsets[samplerTexture.set] + arrayOffset; + if (samplerTexture.set == bindingMappingInfo.flexibleSet) binding -= flexibleSetBaseOffset; + texUnitCacheMap[samplerTexture.name] = binding % device->getCapabilities().maxTextureUnits; + arrayOffset += samplerTexture.count - 1; } } - if (glActiveSamplers.size()) { - vector usedTexUnits(device->getMaxTextureUnits(), false); + if (!glActiveSamplerTextures.empty()) { + vector usedTexUnits(device->getCapabilities().maxTextureUnits, false); // try to reuse existing mappings first - for (uint i = 0u; i < glActiveSamplers.size(); i++) { - GLES2GPUUniformSampler &glSampler = glActiveSamplers[i]; + for (uint i = 0U; i < glActiveSamplerTextures.size(); i++) { + GLES2GPUUniformSamplerTexture &glSamplerTexture = glActiveSamplerTextures[i]; - if (texUnitCacheMap.count(glSampler.name)) { - uint cachedUnit = texUnitCacheMap[glSampler.name]; - glSampler.glLoc = glActiveSamplerLocations[i]; - for (uint t = 0u, offset = 0u; t < glSampler.count; t++) { + if (texUnitCacheMap.count(glSamplerTexture.name)) { + uint cachedUnit = texUnitCacheMap[glSamplerTexture.name]; + glSamplerTexture.glLoc = glActiveSamplerLocations[i]; + for (uint t = 0U, offset = 0U; t < glSamplerTexture.count; t++) { while (usedTexUnits[cachedUnit + t + offset]) offset++; - glSampler.units.push_back(cachedUnit + t + offset); + glSamplerTexture.units.push_back(cachedUnit + t + offset); usedTexUnits[cachedUnit + t + offset] = true; } } } // fill in the rest sequencially - uint unitIdx = 0u; - for (uint i = 0u; i < glActiveSamplers.size(); i++) { - GLES2GPUUniformSampler &glSampler = glActiveSamplers[i]; + uint unitIdx = 0U; + for (uint i = 0U; i < glActiveSamplerTextures.size(); i++) { + GLES2GPUUniformSamplerTexture &glSamplerTexture = glActiveSamplerTextures[i]; - if (glSampler.glLoc < 0) { - glSampler.glLoc = glActiveSamplerLocations[i]; - for (uint t = 0u; t < glSampler.count; t++) { + if (glSamplerTexture.glLoc < 0) { + glSamplerTexture.glLoc = glActiveSamplerLocations[i]; + for (uint t = 0U; t < glSamplerTexture.count; t++) { while (usedTexUnits[unitIdx + t]) unitIdx++; - glSampler.units.push_back(unitIdx + t); + glSamplerTexture.units.push_back(unitIdx + t); usedTexUnits[unitIdx + t] = true; } - if (!texUnitCacheMap.count(glSampler.name)) { - texUnitCacheMap[glSampler.name] = unitIdx; + if (!texUnitCacheMap.count(glSamplerTexture.name)) { + texUnitCacheMap[glSamplerTexture.name] = unitIdx; } } } @@ -1169,9 +1163,8 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { GL_CHECK(glUseProgram(gpuShader->glProgram)); } - for (size_t i = 0; i < glActiveSamplers.size(); ++i) { - GLES2GPUUniformSampler &gpuSampler = glActiveSamplers[i]; - GL_CHECK(glUniform1iv(gpuSampler.glLoc, (GLsizei)gpuSampler.units.size(), gpuSampler.units.data())); + for (auto &gpuSamplerTexture : glActiveSamplerTextures) { + GL_CHECK(glUniform1iv(gpuSamplerTexture.glLoc, (GLsizei)gpuSamplerTexture.units.size(), gpuSamplerTexture.units.data())); } if (device->stateCache()->glProgram != gpuShader->glProgram) { @@ -1180,32 +1173,31 @@ void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader) { } // strip out the inactive ones - for (uint i = 0u; i < gpuShader->glBlocks.size();) { - if (gpuShader->glBlocks[i].glActiveUniforms.size()) { + for (uint i = 0U; i < gpuShader->glBlocks.size();) { + if (!gpuShader->glBlocks[i].glActiveUniforms.empty()) { i++; } else { gpuShader->glBlocks[i] = gpuShader->glBlocks.back(); gpuShader->glBlocks.pop_back(); } } - gpuShader->glSamplers = glActiveSamplers; + gpuShader->glSamplerTextures = glActiveSamplerTextures; } -void GLES2CmdFuncDestroyShader(GLES2Device *device, GLES2GPUShader *gpuShader) { +void cmdFuncGLES2DestroyShader(GLES2Device *device, GLES2GPUShader *gpuShader) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; if (gpuShader->glProgram) { if (device->stateCache()->glProgram == gpuShader->glProgram) { GL_CHECK(glUseProgram(0)); device->stateCache()->glProgram = 0; - gfxStateCache.gpuPipelineState = nullptr; + gfxStateCache.gpuPipelineState = nullptr; } GL_CHECK(glDeleteProgram(gpuShader->glProgram)); gpuShader->glProgram = 0; } } -void GLES2CmdFuncCreateInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler) { - +void cmdFuncGLES2CreateInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler) { if (gpuInputAssembler->gpuIndexBuffer) { switch (gpuInputAssembler->gpuIndexBuffer->stride) { case 1: gpuInputAssembler->glIndexType = GL_UNSIGNED_BYTE; break; @@ -1217,38 +1209,38 @@ void GLES2CmdFuncCreateInputAssembler(GLES2Device *device, GLES2GPUInputAssemble } } - vector streamOffsets(device->getMaxVertexAttributes(), 0u); + vector streamOffsets(device->getCapabilities().maxVertexAttributes, 0U); gpuInputAssembler->glAttribs.resize(gpuInputAssembler->attributes.size()); for (size_t i = 0; i < gpuInputAssembler->glAttribs.size(); ++i) { GLES2GPUAttribute &gpuAttribute = gpuInputAssembler->glAttribs[i]; - const Attribute &attrib = gpuInputAssembler->attributes[i]; + const Attribute & attrib = gpuInputAssembler->attributes[i]; - GLES2GPUBuffer *gpuVB = (GLES2GPUBuffer *)gpuInputAssembler->gpuVertexBuffers[attrib.stream]; + auto *gpuVB = static_cast(gpuInputAssembler->gpuVertexBuffers[attrib.stream]); - gpuAttribute.name = attrib.name; - gpuAttribute.glType = FormatToGLType(attrib.format); - gpuAttribute.size = GFX_FORMAT_INFOS[(int)attrib.format].size; - gpuAttribute.count = GFX_FORMAT_INFOS[(int)attrib.format].count; - gpuAttribute.componentCount = GLComponentCount(gpuAttribute.glType); - gpuAttribute.isNormalized = attrib.isNormalized; - gpuAttribute.isInstanced = attrib.isInstanced; - gpuAttribute.offset = streamOffsets[attrib.stream]; + gpuAttribute.name = attrib.name; + gpuAttribute.glType = formatToGLType(attrib.format); + gpuAttribute.size = GFX_FORMAT_INFOS[static_cast(attrib.format)].size; + gpuAttribute.count = GFX_FORMAT_INFOS[static_cast(attrib.format)].count; + gpuAttribute.componentCount = glComponentCount(gpuAttribute.glType); + gpuAttribute.isNormalized = attrib.isNormalized; + gpuAttribute.isInstanced = attrib.isInstanced; + gpuAttribute.offset = streamOffsets[attrib.stream]; if (gpuVB) { gpuAttribute.glBuffer = gpuVB->glBuffer; - gpuAttribute.stride = gpuVB->stride; + gpuAttribute.stride = gpuVB->stride; } streamOffsets[attrib.stream] += gpuAttribute.size; } } -void GLES2CmdFuncDestroyInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler) { +void cmdFuncGLES2DestroyInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; for (auto it = gpuInputAssembler->glVAOs.begin(); it != gpuInputAssembler->glVAOs.end(); ++it) { if (device->stateCache()->glVAO == it->second) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } GL_CHECK(glDeleteVertexArraysOES(1, &it->second)); @@ -1256,8 +1248,8 @@ void GLES2CmdFuncDestroyInputAssembler(GLES2Device *device, GLES2GPUInputAssembl gpuInputAssembler->glVAOs.clear(); } -void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO) { - uint colorViewCount = gpuFBO->gpuColorTextures.size(); +void cmdFuncGLES2CreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO) { + uint colorViewCount = gpuFBO->gpuColorTextures.size(); uint swapchainImageIndices = 0; for (size_t i = 0; i < colorViewCount; ++i) { if (!gpuFBO->gpuColorTextures[i]) { @@ -1277,8 +1269,8 @@ void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpu device->stateCache()->glFramebuffer = gpuFBO->glFramebuffer; } - GLenum attachments[GFX_MAX_ATTACHMENTS] = {0}; - uint attachmentCount = 0; + GLenum attachments[MAX_ATTACHMENTS] = {0}; + uint attachmentCount = 0; for (size_t i = 0; i < gpuFBO->gpuColorTextures.size(); ++i) { GLES2GPUTexture *gpuColorTexture = gpuFBO->gpuColorTextures[i]; @@ -1286,7 +1278,7 @@ void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpu // Mipmap level in GLES2 should be 0. GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, (GLenum)(GL_COLOR_ATTACHMENT0 + i), gpuColorTexture->glTarget, gpuColorTexture->glTexture, 0)); - attachments[attachmentCount++] = (GLenum)(GL_COLOR_ATTACHMENT0 + i); + attachments[attachmentCount++] = static_cast(GL_COLOR_ATTACHMENT0 + i); } } @@ -1295,12 +1287,16 @@ void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpu // Mipmap level in GLES2 should be 0. GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, gpuDepthStencilTexture->glTarget, gpuDepthStencilTexture->glTexture, 0)); - if (GFX_FORMAT_INFOS[(int)gpuDepthStencilTexture->format].hasStencil) { + if (GFX_FORMAT_INFOS[static_cast(gpuDepthStencilTexture->format)].hasStencil) { // Mipmap level in GLES2 should be 0. GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, gpuDepthStencilTexture->glTarget, gpuDepthStencilTexture->glTexture, 0)); } } + if (device->hasFeature(Feature::MULTIPLE_RENDER_TARGETS)) { + GL_CHECK(glDrawBuffersEXT(attachmentCount, attachments)); + } + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { switch (status) { @@ -1330,7 +1326,7 @@ void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpu } } -void GLES2CmdFuncDestroyFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO) { +void cmdFuncGLES2DestroyFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO) { if (gpuFBO->isOffscreen) { if (gpuFBO->glFramebuffer) { if (device->stateCache()->glFramebuffer == gpuFBO->glFramebuffer) { @@ -1343,12 +1339,12 @@ void GLES2CmdFuncDestroyFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gp } } -void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRenderPass, GLES2GPUFramebuffer *gpuFramebuffer, +void cmdFuncGLES2BeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRenderPass, GLES2GPUFramebuffer *gpuFramebuffer, const Rect &renderArea, size_t numClearColors, const Color *clearColors, float clearDepth, int clearStencil) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - gfxStateCache.gpuRenderPass = gpuRenderPass; - gfxStateCache.gpuFramebuffer = gpuFramebuffer; - gfxStateCache.numClearColors = numClearColors; + gfxStateCache.gpuRenderPass = gpuRenderPass; + gfxStateCache.gpuFramebuffer = gpuFramebuffer; + gfxStateCache.numClearColors = numClearColors; GLenum *invalidAttachments = gfxStateCache.invalidAttachments; @@ -1358,8 +1354,6 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen if (cache->glFramebuffer != gpuFramebuffer->glFramebuffer) { GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, gpuFramebuffer->glFramebuffer)); cache->glFramebuffer = gpuFramebuffer->glFramebuffer; - // render targets are drawn with flipped-Y - gfxStateCache.reverseCW = !!gpuFramebuffer->glFramebuffer; } if (cache->viewport.left != renderArea.x || @@ -1367,9 +1361,9 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen cache->viewport.width != renderArea.width || cache->viewport.height != renderArea.height) { GL_CHECK(glViewport(renderArea.x, renderArea.y, renderArea.width, renderArea.height)); - cache->viewport.left = renderArea.x; - cache->viewport.top = renderArea.y; - cache->viewport.width = renderArea.width; + cache->viewport.left = renderArea.x; + cache->viewport.top = renderArea.y; + cache->viewport.width = renderArea.width; cache->viewport.height = renderArea.height; } @@ -1378,14 +1372,18 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen cache->scissor.width != renderArea.width || cache->scissor.height != renderArea.height) { GL_CHECK(glScissor(renderArea.x, renderArea.y, renderArea.width, renderArea.height)); - cache->scissor.x = renderArea.x; - cache->scissor.y = renderArea.y; - cache->scissor.width = renderArea.width; + cache->scissor.x = renderArea.x; + cache->scissor.y = renderArea.y; + cache->scissor.width = renderArea.width; cache->scissor.height = renderArea.height; } - GLbitfield glClears = 0; - uint numAttachments = 0; + GLbitfield glClears = 0; + uint numAttachments = 0; + bool hasBoundFBO = gpuFramebuffer->isOffscreen; +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + hasBoundFBO = true; +#endif gpuRenderPass = gpuRenderPass; for (uint j = 0; j < numClearColors; ++j) { @@ -1394,6 +1392,11 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen switch (colorAttachment.loadOp) { case LoadOp::LOAD: break; // GL default behaviour case LoadOp::CLEAR: { + // `glClearColor` clears all the attachments to the same value + // here we fallback to the load op of the first attachment + // to avoid clearing multiple times + if (j) break; + if (cache->bs.targets[0].blendColorMask != ColorMask::ALL) { GL_CHECK(glColorMask(true, true, true, true)); } @@ -1405,7 +1408,7 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen } case LoadOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR_EXT); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR_EXT); break; } default:; @@ -1414,7 +1417,7 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen } // for if (gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN) { - bool hasDepth = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasDepth; + bool hasDepth = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasDepth; if (hasDepth) { switch (gpuRenderPass->depthStencilAttachment.depthLoadOp) { case LoadOp::LOAD: break; // GL default behaviour @@ -1428,13 +1431,13 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen } case LoadOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_DEPTH_ATTACHMENT : GL_DEPTH_EXT); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_DEPTH_ATTACHMENT : GL_DEPTH_EXT); break; } default:; } } // if (hasDepth) - bool hasStencils = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasStencil; + bool hasStencils = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasStencil; if (hasStencils) { switch (gpuRenderPass->depthStencilAttachment.depthLoadOp) { case LoadOp::LOAD: break; // GL default behaviour @@ -1451,7 +1454,7 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen } case LoadOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_STENCIL_ATTACHMENT : GL_STENCIL_EXT); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_STENCIL_ATTACHMENT : GL_STENCIL_EXT); break; } default:; @@ -1493,12 +1496,16 @@ void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRen } } -void GLES2CmdFuncEndRenderPass(GLES2Device *device) { - GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - size_t numClearColors = gfxStateCache.numClearColors; - GLES2GPURenderPass *gpuRenderPass = gfxStateCache.gpuRenderPass; - GLES2GPUFramebuffer *gpuFramebuffer = gfxStateCache.gpuFramebuffer; - GLenum *invalidAttachments = gfxStateCache.invalidAttachments; +void cmdFuncGLES2EndRenderPass(GLES2Device *device) { + GLES2ObjectCache & gfxStateCache = device->stateCache()->gfxStateCache; + size_t numClearColors = gfxStateCache.numClearColors; + GLES2GPURenderPass * gpuRenderPass = gfxStateCache.gpuRenderPass; + GLES2GPUFramebuffer *gpuFramebuffer = gfxStateCache.gpuFramebuffer; + GLenum * invalidAttachments = gfxStateCache.invalidAttachments; + bool hasBoundFBO = gpuFramebuffer->isOffscreen; +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + hasBoundFBO = true; +#endif uint numAttachments = 0; for (uint j = 0; j < numClearColors; ++j) { @@ -1508,7 +1515,7 @@ void GLES2CmdFuncEndRenderPass(GLES2Device *device) { case StoreOp::STORE: break; case StoreOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR_EXT); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR_EXT); break; } default:; @@ -1517,25 +1524,25 @@ void GLES2CmdFuncEndRenderPass(GLES2Device *device) { } // for if (gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN) { - bool hasDepth = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasDepth; + bool hasDepth = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasDepth; if (hasDepth) { switch (gpuRenderPass->depthStencilAttachment.depthStoreOp) { case StoreOp::STORE: break; case StoreOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_DEPTH_ATTACHMENT : GL_DEPTH_EXT); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_DEPTH_ATTACHMENT : GL_DEPTH_EXT); break; } default:; } } // if (hasDepth) - bool hasStencils = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasStencil; + bool hasStencils = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasStencil; if (hasStencils) { switch (gpuRenderPass->depthStencilAttachment.stencilStoreOp) { case StoreOp::STORE: break; case StoreOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_STENCIL_ATTACHMENT : GL_STENCIL_EXT); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_STENCIL_ATTACHMENT : GL_STENCIL_EXT); break; } default:; @@ -1548,27 +1555,27 @@ void GLES2CmdFuncEndRenderPass(GLES2Device *device) { } } -void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipelineState, GLES2GPUInputAssembler *gpuInputAssembler, - vector &gpuDescriptorSets, vector &dynamicOffsets, - Viewport &viewport, Rect &scissor, float lineWidth, bool depthBiasEnabled, GLES2DepthBias &depthBias, Color &blendConstants, - GLES2DepthBounds &depthBounds, GLES2StencilWriteMask &stencilWriteMask, GLES2StencilCompareMask &stencilCompareMask) { +void cmdFuncGLES2BindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipelineState, GLES2GPUInputAssembler *gpuInputAssembler, + const vector &gpuDescriptorSets, const vector &dynamicOffsets, + const Viewport &viewport, const Rect &scissor, float lineWidth, bool depthBiasEnabled, const GLES2DepthBias &depthBias, const Color & /*blendConstants*/, + const GLES2DepthBounds & /*depthBounds*/, const GLES2StencilWriteMask &stencilWriteMask, const GLES2StencilCompareMask &stencilCompareMask) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLES2GPUStateCache *cache = device->stateCache(); - bool isShaderChanged = false; - GLenum glWrapS = 0u; - GLenum glWrapT = 0u; - GLenum glMinFilter = 0u; + GLES2GPUStateCache *cache = device->stateCache(); + bool isShaderChanged = false; + GLenum glWrapS = 0U; + GLenum glWrapT = 0U; + GLenum glMinFilter = 0U; if (gpuPipelineState && gpuPipelineState != gfxStateCache.gpuPipelineState) { gfxStateCache.gpuPipelineState = gpuPipelineState; - gfxStateCache.glPrimitive = gpuPipelineState->glPrimitive; + gfxStateCache.glPrimitive = gpuPipelineState->glPrimitive; if (gpuPipelineState->gpuShader) { if (cache->glProgram != gpuPipelineState->gpuShader->glProgram) { GL_CHECK(glUseProgram(gpuPipelineState->gpuShader->glProgram)); cache->glProgram = gpuPipelineState->gpuShader->glProgram; - isShaderChanged = true; + isShaderChanged = true; } } @@ -1600,10 +1607,9 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli } cache->rs.cullMode = gpuPipelineState->rs.cullMode; } - bool isFrontFaceCCW = (bool)gpuPipelineState->rs.isFrontFaceCCW != gfxStateCache.reverseCW; - if ((bool)cache->rs.isFrontFaceCCW != isFrontFaceCCW) { - GL_CHECK(glFrontFace(isFrontFaceCCW ? GL_CCW : GL_CW)); - cache->rs.isFrontFaceCCW = isFrontFaceCCW; + if (cache->rs.isFrontFaceCCW != gpuPipelineState->rs.isFrontFaceCCW) { + GL_CHECK(glFrontFace(gpuPipelineState->rs.isFrontFaceCCW ? GL_CCW : GL_CW)); + cache->rs.isFrontFaceCCW = gpuPipelineState->rs.isFrontFaceCCW; } if ((cache->rs.depthBias != gpuPipelineState->rs.depthBias) || (cache->rs.depthBiasSlop != gpuPipelineState->rs.depthBiasSlop)) { @@ -1652,8 +1658,8 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GLES2_CMP_FUNCS[(int)gpuPipelineState->dss.stencilFuncFront], gpuPipelineState->dss.stencilRefFront, gpuPipelineState->dss.stencilReadMaskFront)); - cache->dss.stencilFuncFront = gpuPipelineState->dss.stencilFuncFront; - cache->dss.stencilRefFront = gpuPipelineState->dss.stencilRefFront; + cache->dss.stencilFuncFront = gpuPipelineState->dss.stencilFuncFront; + cache->dss.stencilRefFront = gpuPipelineState->dss.stencilRefFront; cache->dss.stencilReadMaskFront = gpuPipelineState->dss.stencilReadMaskFront; } if (cache->dss.stencilFailOpFront != gpuPipelineState->dss.stencilFailOpFront || @@ -1663,9 +1669,9 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GLES2_STENCIL_OPS[(int)gpuPipelineState->dss.stencilFailOpFront], GLES2_STENCIL_OPS[(int)gpuPipelineState->dss.stencilZFailOpFront], GLES2_STENCIL_OPS[(int)gpuPipelineState->dss.stencilPassOpFront])); - cache->dss.stencilFailOpFront = gpuPipelineState->dss.stencilFailOpFront; + cache->dss.stencilFailOpFront = gpuPipelineState->dss.stencilFailOpFront; cache->dss.stencilZFailOpFront = gpuPipelineState->dss.stencilZFailOpFront; - cache->dss.stencilPassOpFront = gpuPipelineState->dss.stencilPassOpFront; + cache->dss.stencilPassOpFront = gpuPipelineState->dss.stencilPassOpFront; } if (cache->dss.stencilWriteMaskFront != gpuPipelineState->dss.stencilWriteMaskFront) { GL_CHECK(glStencilMaskSeparate(GL_FRONT, gpuPipelineState->dss.stencilWriteMaskFront)); @@ -1680,8 +1686,8 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GLES2_CMP_FUNCS[(int)gpuPipelineState->dss.stencilFuncBack], gpuPipelineState->dss.stencilRefBack, gpuPipelineState->dss.stencilReadMaskBack)); - cache->dss.stencilFuncBack = gpuPipelineState->dss.stencilFuncBack; - cache->dss.stencilRefBack = gpuPipelineState->dss.stencilRefBack; + cache->dss.stencilFuncBack = gpuPipelineState->dss.stencilFuncBack; + cache->dss.stencilRefBack = gpuPipelineState->dss.stencilRefBack; cache->dss.stencilReadMaskBack = gpuPipelineState->dss.stencilReadMaskBack; } if (cache->dss.stencilFailOpBack != gpuPipelineState->dss.stencilFailOpBack || @@ -1691,9 +1697,9 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GLES2_STENCIL_OPS[(int)gpuPipelineState->dss.stencilFailOpBack], GLES2_STENCIL_OPS[(int)gpuPipelineState->dss.stencilZFailOpBack], GLES2_STENCIL_OPS[(int)gpuPipelineState->dss.stencilPassOpBack])); - cache->dss.stencilFailOpBack = gpuPipelineState->dss.stencilFailOpBack; + cache->dss.stencilFailOpBack = gpuPipelineState->dss.stencilFailOpBack; cache->dss.stencilZFailOpBack = gpuPipelineState->dss.stencilZFailOpBack; - cache->dss.stencilPassOpBack = gpuPipelineState->dss.stencilPassOpBack; + cache->dss.stencilPassOpBack = gpuPipelineState->dss.stencilPassOpBack; } if (cache->dss.stencilWriteMaskBack != gpuPipelineState->dss.stencilWriteMaskBack) { GL_CHECK(glStencilMaskSeparate(GL_BACK, gpuPipelineState->dss.stencilWriteMaskBack)); @@ -1713,7 +1719,6 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cache->bs.blendColor.y != gpuPipelineState->bs.blendColor.y || cache->bs.blendColor.z != gpuPipelineState->bs.blendColor.z || cache->bs.blendColor.w != gpuPipelineState->bs.blendColor.w) { - GL_CHECK(glBlendColor(gpuPipelineState->bs.blendColor.x, gpuPipelineState->bs.blendColor.y, gpuPipelineState->bs.blendColor.z, @@ -1721,8 +1726,8 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cache->bs.blendColor = gpuPipelineState->bs.blendColor; } - BlendTarget &cacheTarget = cache->bs.targets[0]; - const BlendTarget &target = gpuPipelineState->bs.targets[0]; + BlendTarget & cacheTarget = cache->bs.targets[0]; + const BlendTarget &target = gpuPipelineState->bs.targets[0]; if (cacheTarget.blend != target.blend) { if (!cacheTarget.blend) { GL_CHECK(glEnable(GL_BLEND)); @@ -1735,7 +1740,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cacheTarget.blendAlphaEq != target.blendAlphaEq) { GL_CHECK(glBlendEquationSeparate(GLES2_BLEND_OPS[(int)target.blendEq], GLES2_BLEND_OPS[(int)target.blendAlphaEq])); - cacheTarget.blendEq = target.blendEq; + cacheTarget.blendEq = target.blendEq; cacheTarget.blendAlphaEq = target.blendAlphaEq; } if (cacheTarget.blendSrc != target.blendSrc || @@ -1746,8 +1751,8 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GLES2_BLEND_FACTORS[(int)target.blendDst], GLES2_BLEND_FACTORS[(int)target.blendSrcAlpha], GLES2_BLEND_FACTORS[(int)target.blendDstAlpha])); - cacheTarget.blendSrc = target.blendSrc; - cacheTarget.blendDst = target.blendDst; + cacheTarget.blendSrc = target.blendSrc; + cacheTarget.blendDst = target.blendDst; cacheTarget.blendSrcAlpha = target.blendSrcAlpha; cacheTarget.blendDstAlpha = target.blendDstAlpha; } @@ -1762,18 +1767,18 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli // bind descriptor sets if (gpuPipelineState && gpuPipelineState->gpuShader && gpuPipelineState->gpuPipelineLayout) { - - size_t blockLen = gpuPipelineState->gpuShader->glBlocks.size(); + size_t blockLen = gpuPipelineState->gpuShader->glBlocks.size(); const vector> &dynamicOffsetIndices = gpuPipelineState->gpuPipelineLayout->dynamicOffsetIndices; - uint8_t *uniformBuffBase = nullptr, *uniformBuff; + uint8_t * uniformBuffBase = nullptr; + uint8_t * uniformBuff; for (size_t j = 0; j < blockLen; j++) { const GLES2GPUUniformBlock &glBlock = gpuPipelineState->gpuShader->glBlocks[j]; CCASSERT(gpuDescriptorSets.size() > glBlock.set, "Invalid set index"); const GLES2GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glBlock.set]; - const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glBlock.binding); - const GLES2GPUDescriptor &gpuDescriptor = gpuDescriptorSet->gpuDescriptors[descriptorIndex]; + const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glBlock.binding); + const GLES2GPUDescriptor & gpuDescriptor = gpuDescriptorSet->gpuDescriptors[descriptorIndex]; if (!gpuDescriptor.gpuBuffer && !gpuDescriptor.gpuBufferView) { CC_LOG_ERROR("Buffer binding '%s' at set %d binding %d is not bounded", @@ -1781,7 +1786,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli continue; } - uint offset = 0u; + uint offset = 0U; const vector &dynamicOffsetIndexSet = dynamicOffsetIndices[glBlock.set]; if (dynamicOffsetIndexSet.size() > glBlock.binding) { int dynamicOffsetIndex = dynamicOffsetIndexSet[glBlock.binding]; @@ -1795,8 +1800,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli uniformBuffBase = gpuDescriptor.gpuBuffer->buffer + offset; } - for (size_t u = 0; u < glBlock.glActiveUniforms.size(); ++u) { - const GLES2GPUUniform &gpuUniform = glBlock.glActiveUniforms[u]; + for (const auto &gpuUniform : glBlock.glActiveUniforms) { uniformBuff = uniformBuffBase + gpuUniform.offset; switch (gpuUniform.glType) { case GL_BOOL: @@ -1897,27 +1901,27 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli } } - size_t samplerLen = gpuPipelineState->gpuShader->glSamplers.size(); + size_t samplerLen = gpuPipelineState->gpuShader->glSamplerTextures.size(); for (size_t j = 0; j < samplerLen; j++) { - const GLES2GPUUniformSampler &glSampler = gpuPipelineState->gpuShader->glSamplers[j]; + const GLES2GPUUniformSamplerTexture &glSamplerTexture = gpuPipelineState->gpuShader->glSamplerTextures[j]; - CCASSERT(gpuDescriptorSets.size() > glSampler.set, "Invalid set index"); - const GLES2GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glSampler.set]; - const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glSampler.binding); - const GLES2GPUDescriptor *gpuDescriptor = &gpuDescriptorSet->gpuDescriptors[descriptorIndex]; + CCASSERT(gpuDescriptorSets.size() > glSamplerTexture.set, "Invalid set index"); + const GLES2GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glSamplerTexture.set]; + const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glSamplerTexture.binding); + const GLES2GPUDescriptor * gpuDescriptor = &gpuDescriptorSet->gpuDescriptors[descriptorIndex]; - for (size_t u = 0; u < glSampler.units.size(); u++, gpuDescriptor++) { - uint unit = (uint)glSampler.units[u]; + for (size_t u = 0; u < glSamplerTexture.units.size(); u++, gpuDescriptor++) { + uint unit = static_cast(glSamplerTexture.units[u]); if (!gpuDescriptor->gpuTexture || !gpuDescriptor->gpuSampler) { CC_LOG_ERROR( "Sampler binding '%s' at set %d binding %d index %d is not bounded", - glSampler.name.c_str(), glSampler.set, glSampler.binding, u); + glSamplerTexture.name.c_str(), glSamplerTexture.set, glSamplerTexture.binding, u); continue; } GLES2GPUTexture *gpuTexture = gpuDescriptor->gpuTexture; - GLuint glTexture = gpuTexture->glTexture; + GLuint glTexture = gpuTexture->glTexture; if (cache->glTextures[unit] != glTexture) { if (cache->texUint != unit) { GL_CHECK(glActiveTexture(GL_TEXTURE0 + unit)); @@ -1932,7 +1936,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli glWrapT = gpuDescriptor->gpuSampler->glWrapT; if (gpuDescriptor->gpuTexture->mipLevel <= 1 && - !(gpuDescriptor->gpuTexture->flags & TextureFlagBit::GEN_MIPMAP) && + !hasFlag(gpuDescriptor->gpuTexture->flags, TextureFlagBit::GEN_MIPMAP) && (gpuDescriptor->gpuSampler->glMinFilter == GL_LINEAR_MIPMAP_NEAREST || gpuDescriptor->gpuSampler->glMinFilter == GL_LINEAR_MIPMAP_LINEAR)) { glMinFilter = GL_LINEAR; @@ -1952,16 +1956,14 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli } } - // bind blend state - if (gpuTexture->glWrapS != glWrapS) { if (cache->texUint != unit) { GL_CHECK(glActiveTexture(GL_TEXTURE0 + unit)); cache->texUint = unit; } - + GL_CHECK(glTexParameteri(gpuTexture->glTarget, GL_TEXTURE_WRAP_S, - glWrapS)); + glWrapS)); gpuTexture->glWrapS = glWrapS; } @@ -1971,7 +1973,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cache->texUint = unit; } GL_CHECK(glTexParameteri(gpuTexture->glTarget, GL_TEXTURE_WRAP_T, - glWrapT)); + glWrapT)); gpuTexture->glWrapT = glWrapT; } @@ -1981,7 +1983,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cache->texUint = unit; } GL_CHECK(glTexParameteri(gpuTexture->glTarget, GL_TEXTURE_MIN_FILTER, - glMinFilter)); + glMinFilter)); gpuTexture->glMinFilter = glMinFilter; } @@ -1991,7 +1993,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cache->texUint = unit; } GL_CHECK(glTexParameteri(gpuTexture->glTarget, GL_TEXTURE_MAG_FILTER, - gpuDescriptor->gpuSampler->glMagFilter)); + gpuDescriptor->gpuSampler->glMagFilter)); gpuTexture->glMagFilter = gpuDescriptor->gpuSampler->glMagFilter; } } @@ -2003,7 +2005,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli (isShaderChanged || gpuInputAssembler != gfxStateCache.gpuInputAssembler)) { gfxStateCache.gpuInputAssembler = gpuInputAssembler; if (device->useVAO()) { - GLuint hash = gpuPipelineState->gpuShader->glProgram ^ device->getThreadID(); + GLuint hash = gpuPipelineState->gpuShader->glProgram ^ device->getThreadID(); GLuint glVAO = gpuInputAssembler->glVAOs[hash]; if (!glVAO) { GL_CHECK(glGenVertexArraysOES(1, &glVAO)); @@ -2012,8 +2014,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); - for (size_t j = 0; j < gpuPipelineState->gpuShader->glInputs.size(); ++j) { - const GLES2GPUInput &gpuInput = gpuPipelineState->gpuShader->glInputs[j]; + for (auto &gpuInput : gpuPipelineState->gpuShader->glInputs) { for (size_t a = 0; a < gpuInputAssembler->attributes.size(); ++a) { const GLES2GPUAttribute &gpuAttribute = gpuInputAssembler->glAttribs[a]; if (gpuAttribute.name == gpuInput.name) { @@ -2021,7 +2022,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli for (uint c = 0; c < gpuAttribute.componentCount; ++c) { GLint glLoc = gpuInput.glLoc + c; - uint attribOffset = + uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; GL_CHECK(glEnableVertexAttribArray(glLoc)); @@ -2053,8 +2054,8 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GL_CHECK(glBindVertexArrayOES(0)); GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); - cache->glVAO = 0; - cache->glArrayBuffer = 0; + cache->glVAO = 0; + cache->glArrayBuffer = 0; cache->glElementArrayBuffer = 0; } @@ -2063,12 +2064,11 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli cache->glVAO = glVAO; } } else { - for (uint a = 0; a < cache->glCurrentAttribLocs.size(); ++a) { - cache->glCurrentAttribLocs[a] = false; + for (auto &&glCurrentAttribLoc : cache->glCurrentAttribLocs) { + glCurrentAttribLoc = false; } - for (size_t j = 0; j < gpuPipelineState->gpuShader->glInputs.size(); ++j) { - const GLES2GPUInput &gpuInput = gpuPipelineState->gpuShader->glInputs[j]; + for (auto &gpuInput : gpuPipelineState->gpuShader->glInputs) { for (size_t a = 0; a < gpuInputAssembler->attributes.size(); ++a) { const GLES2GPUAttribute &gpuAttribute = gpuInputAssembler->glAttribs[a]; if (gpuAttribute.name == gpuInput.name) { @@ -2078,8 +2078,8 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli } for (uint c = 0; c < gpuAttribute.componentCount; ++c) { - GLint glLoc = gpuInput.glLoc + c; - uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; + GLint glLoc = gpuInput.glLoc + c; + uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; GL_CHECK(glEnableVertexAttribArray(glLoc)); cache->glEnabledAttribLocs[glLoc] = true; cache->glCurrentAttribLocs[glLoc] = true; @@ -2143,18 +2143,19 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli } break; case DynamicStateFlagBit::DEPTH_BIAS: - if ((bool)cache->rs.depthBiasEnabled != depthBiasEnabled) { - if (depthBiasEnabled) + if (static_cast(cache->rs.depthBiasEnabled) != depthBiasEnabled) { + if (depthBiasEnabled) { GL_CHECK(glEnable(GL_POLYGON_OFFSET_FILL)); - else + } else { GL_CHECK(glDisable(GL_POLYGON_OFFSET_FILL)); + } cache->rs.depthBiasEnabled = depthBiasEnabled; } if ((cache->rs.depthBias != depthBias.constant) || (cache->rs.depthBiasSlop != depthBias.slope)) { GL_CHECK(glPolygonOffset(depthBias.constant, depthBias.slope)); - cache->rs.depthBias = depthBias.constant; + cache->rs.depthBias = depthBias.constant; cache->rs.depthBiasSlop = depthBias.slope; } break; @@ -2195,7 +2196,7 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli stencilWriteMask.writeMask)) { GL_CHECK(glStencilMask(stencilWriteMask.writeMask)); cache->dss.stencilWriteMaskFront = stencilWriteMask.writeMask; - cache->dss.stencilWriteMaskBack = stencilWriteMask.writeMask; + cache->dss.stencilWriteMaskBack = stencilWriteMask.writeMask; } break; } @@ -2204,37 +2205,37 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli switch (stencilCompareMask.face) { case StencilFace::FRONT: if ((cache->dss.stencilRefFront != - (uint)stencilCompareMask.refrence) || + static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskFront != stencilCompareMask.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_FRONT, GLES2_CMP_FUNCS[(uint)cache->dss.stencilFuncFront], stencilCompareMask.refrence, stencilCompareMask.compareMask)); - cache->dss.stencilRefFront = stencilCompareMask.refrence; + cache->dss.stencilRefFront = stencilCompareMask.refrence; cache->dss.stencilReadMaskFront = stencilCompareMask.compareMask; } break; case StencilFace::BACK: if ((cache->dss.stencilRefBack != - (uint)stencilCompareMask.refrence) || + static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskBack != stencilCompareMask.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_BACK, GLES2_CMP_FUNCS[(uint)cache->dss.stencilFuncBack], stencilCompareMask.refrence, stencilCompareMask.compareMask)); - cache->dss.stencilRefBack = stencilCompareMask.refrence; + cache->dss.stencilRefBack = stencilCompareMask.refrence; cache->dss.stencilReadMaskBack = stencilCompareMask.compareMask; } break; case StencilFace::ALL: if ((cache->dss.stencilRefFront != - (uint)stencilCompareMask.refrence) || + static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskFront != stencilCompareMask.compareMask) || (cache->dss.stencilRefBack != - (uint)stencilCompareMask.refrence) || + static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskBack != stencilCompareMask.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_FRONT, @@ -2245,10 +2246,10 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli GLES2_CMP_FUNCS[(uint)cache->dss.stencilFuncBack], stencilCompareMask.refrence, stencilCompareMask.compareMask)); - cache->dss.stencilRefFront = stencilCompareMask.refrence; + cache->dss.stencilRefFront = stencilCompareMask.refrence; cache->dss.stencilReadMaskFront = stencilCompareMask.compareMask; - cache->dss.stencilRefBack = stencilCompareMask.refrence; - cache->dss.stencilReadMaskBack = stencilCompareMask.compareMask; + cache->dss.stencilRefBack = stencilCompareMask.refrence; + cache->dss.stencilReadMaskBack = stencilCompareMask.compareMask; } break; } @@ -2261,18 +2262,17 @@ void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipeli } // if } -void GLES2CmdFuncDraw(GLES2Device *device, DrawInfo &drawInfo) { - GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLES2GPUPipelineState *gpuPipelineState = gfxStateCache.gpuPipelineState; +void cmdFuncGLES2Draw(GLES2Device *device, const DrawInfo &drawInfo) { + GLES2ObjectCache & gfxStateCache = device->stateCache()->gfxStateCache; + GLES2GPUPipelineState * gpuPipelineState = gfxStateCache.gpuPipelineState; GLES2GPUInputAssembler *gpuInputAssembler = gfxStateCache.gpuInputAssembler; - GLenum glPrimitive = gfxStateCache.glPrimitive; + GLenum glPrimitive = gfxStateCache.glPrimitive; if (gpuInputAssembler && gpuPipelineState) { if (!gpuInputAssembler->gpuIndirectBuffer) { - if (gpuInputAssembler->gpuIndexBuffer) { if (drawInfo.indexCount > 0) { - uint8_t *offset = 0; + uint8_t *offset = nullptr; offset += drawInfo.firstIndex * gpuInputAssembler->gpuIndexBuffer->stride; if (drawInfo.instanceCount == 0) { GL_CHECK(glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset)); @@ -2296,7 +2296,7 @@ void GLES2CmdFuncDraw(GLES2Device *device, DrawInfo &drawInfo) { const DrawInfo &draw = gpuInputAssembler->gpuIndirectBuffer->indirects[j]; if (gpuInputAssembler->gpuIndexBuffer) { if (draw.indexCount > 0) { - uint8_t *offset = 0; + uint8_t *offset = nullptr; offset += draw.firstIndex * gpuInputAssembler->gpuIndexBuffer->stride; if (drawInfo.instanceCount == 0) { GL_CHECK(glDrawElements(glPrimitive, draw.indexCount, gpuInputAssembler->glIndexType, offset)); @@ -2320,22 +2320,21 @@ void GLES2CmdFuncDraw(GLES2Device *device, DrawInfo &drawInfo) { } } -void GLES2CmdFuncUpdateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size) { +void cmdFuncGLES2UpdateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size) { GLES2ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; CCASSERT(buffer, "Buffer should not be nullptr"); - if (gpuBuffer->usage & BufferUsageBit::UNIFORM) { - memcpy(gpuBuffer->buffer + offset, buffer, size); - } else if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { - memcpy((uint8_t *)gpuBuffer->indirects.data() + offset, buffer, size); - } else if (gpuBuffer->usage & BufferUsageBit::TRANSFER_SRC) { + if ((hasFlag(gpuBuffer->usage, BufferUsageBit::UNIFORM)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_SRC))) { memcpy(gpuBuffer->buffer + offset, buffer, size); + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { + memcpy(reinterpret_cast(gpuBuffer->indirects.data()) + offset, buffer, size); } else { switch (gpuBuffer->glTarget) { case GL_ARRAY_BUFFER: { if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -2350,7 +2349,7 @@ void GLES2CmdFuncUpdateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer, co if (device->useVAO()) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArrayOES(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -2368,7 +2367,7 @@ void GLES2CmdFuncUpdateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer, co } } -void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const *buffers, +void cmdFuncGLES2CopyBuffersToTexture(GLES2Device *device, const uint8_t *const *buffers, GLES2GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count) { GLuint &glTexture = device->stateCache()->glTextures[device->stateCache()->texUint]; if (glTexture != gpuTexture->glTexture) { @@ -2376,8 +2375,8 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const glTexture = gpuTexture->glTexture; } - bool isCompressed = GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed; - uint n = 0; + bool isCompressed = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed; + uint n = 0; switch (gpuTexture->glTarget) { case GL_TEXTURE_2D: { @@ -2385,11 +2384,11 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const uint h; for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; - w = region.texExtent.width; - h = region.texExtent.height; - const uint8_t *buff = buffers[n++]; + w = region.texExtent.width; + h = region.texExtent.height; + const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage2D(GL_TEXTURE_2D, region.texSubres.mipLevel, region.texOffset.x, @@ -2415,16 +2414,16 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const uint w; uint h; for (size_t i = 0; i < count; ++i) { - const BufferTextureCopy ®ion = regions[i]; - uint d = region.texSubres.layerCount; - uint layerCount = d + region.texSubres.baseArrayLayer; + const BufferTextureCopy ®ion = regions[i]; + uint d = region.texSubres.layerCount; + uint layerCount = d + region.texSubres.baseArrayLayer; for (uint z = region.texSubres.baseArrayLayer; z < layerCount; ++z) { - w = region.texExtent.width; - h = region.texExtent.height; + w = region.texExtent.width; + h = region.texExtent.height; const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage3DOES(GL_TEXTURE_2D_ARRAY, region.texSubres.mipLevel, region.texOffset.x, @@ -2454,12 +2453,12 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const uint d; for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; - w = region.texExtent.width; - h = region.texExtent.height; - d = region.texExtent.depth; - const uint8_t *buff = buffers[n++]; + w = region.texExtent.width; + h = region.texExtent.height; + d = region.texExtent.depth; + const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage3DOES(GL_TEXTURE_3D, region.texSubres.mipLevel, region.texOffset.x, @@ -2488,14 +2487,14 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const uint h; uint f; for (size_t i = 0; i < count; ++i) { - const BufferTextureCopy ®ion = regions[i]; - uint faceCount = region.texSubres.baseArrayLayer + region.texSubres.layerCount; + const BufferTextureCopy ®ion = regions[i]; + uint faceCount = region.texSubres.baseArrayLayer + region.texSubres.layerCount; for (f = region.texSubres.baseArrayLayer; f < faceCount; ++f) { - w = region.texExtent.width; - h = region.texExtent.height; + w = region.texExtent.width; + h = region.texExtent.height; const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, region.texOffset.x, @@ -2522,50 +2521,50 @@ void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const break; } - if (!isCompressed && (gpuTexture->flags & TextureFlagBit::GEN_MIPMAP)) { + if (!isCompressed && hasFlag(gpuTexture->flags, TextureFlagBit::GEN_MIPMAP)) { GL_CHECK(glBindTexture(gpuTexture->glTarget, gpuTexture->glTexture)); GL_CHECK(glGenerateMipmap(gpuTexture->glTarget)); } } -void GLES2CmdFuncExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmdPackage) { +void cmdFuncGLES2ExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmdPackage) { if (!cmdPackage->cmds.size()) return; - static uint cmdIndices[(int)GFXCmdType::COUNT] = {0}; + static uint cmdIndices[static_cast(GLESCmdType::COUNT)] = {0}; memset(cmdIndices, 0, sizeof(cmdIndices)); for (uint i = 0; i < cmdPackage->cmds.size(); ++i) { - GFXCmdType cmdType = cmdPackage->cmds[i]; - uint &cmdIdx = cmdIndices[(int)cmdType]; + GLESCmdType cmdType = cmdPackage->cmds[i]; + uint & cmdIdx = cmdIndices[static_cast(cmdType)]; switch (cmdType) { - case GFXCmdType::BEGIN_RENDER_PASS: { + case GLESCmdType::BEGIN_RENDER_PASS: { GLES2CmdBeginRenderPass *cmd = cmdPackage->beginRenderPassCmds[cmdIdx]; - GLES2CmdFuncBeginRenderPass(device, cmd->gpuRenderPass, cmd->gpuFBO, cmd->renderArea, cmd->numClearColors, cmd->clearColors, cmd->clearDepth, cmd->clearStencil); + cmdFuncGLES2BeginRenderPass(device, cmd->gpuRenderPass, cmd->gpuFBO, cmd->renderArea, cmd->numClearColors, cmd->clearColors, cmd->clearDepth, cmd->clearStencil); break; } - case GFXCmdType::END_RENDER_PASS: { - GLES2CmdFuncEndRenderPass(device); + case GLESCmdType::END_RENDER_PASS: { + cmdFuncGLES2EndRenderPass(device); break; } - case GFXCmdType::BIND_STATES: { + case GLESCmdType::BIND_STATES: { GLES2CmdBindStates *cmd = cmdPackage->bindStatesCmds[cmdIdx]; - GLES2CmdFuncBindState(device, cmd->gpuPipelineState, cmd->gpuInputAssembler, cmd->gpuDescriptorSets, cmd->dynamicOffsets, cmd->viewport, cmd->scissor, cmd->lineWidth, cmd->depthBiasEnabled, cmd->depthBias, cmd->blendConstants, cmd->depthBounds, cmd->stencilWriteMask, cmd->stencilCompareMask); + cmdFuncGLES2BindState(device, cmd->gpuPipelineState, cmd->gpuInputAssembler, cmd->gpuDescriptorSets, cmd->dynamicOffsets, cmd->viewport, cmd->scissor, cmd->lineWidth, cmd->depthBiasEnabled, cmd->depthBias, cmd->blendConstants, cmd->depthBounds, cmd->stencilWriteMask, cmd->stencilCompareMask); break; - } // namespace gfx - case GFXCmdType::DRAW: { + } + case GLESCmdType::DRAW: { GLES2CmdDraw *cmd = cmdPackage->drawCmds[cmdIdx]; - GLES2CmdFuncDraw(device, cmd->drawInfo); + cmdFuncGLES2Draw(device, cmd->drawInfo); break; } - case GFXCmdType::UPDATE_BUFFER: { + case GLESCmdType::UPDATE_BUFFER: { GLES2CmdUpdateBuffer *cmd = cmdPackage->updateBufferCmds[cmdIdx]; - GLES2CmdFuncUpdateBuffer(device, cmd->gpuBuffer, cmd->buffer, cmd->offset, cmd->size); + cmdFuncGLES2UpdateBuffer(device, cmd->gpuBuffer, cmd->buffer, cmd->offset, cmd->size); break; } - case GFXCmdType::COPY_BUFFER_TO_TEXTURE: { + case GLESCmdType::COPY_BUFFER_TO_TEXTURE: { GLES2CmdCopyBufferToTexture *cmd = cmdPackage->copyBufferToTextureCmds[cmdIdx]; - GLES2CmdFuncCopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions, cmd->count); + cmdFuncGLES2CopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions, cmd->count); break; } default: diff --git a/native/cocos/renderer/gfx-gles2/GLES2Commands.h b/native/cocos/renderer/gfx-gles2/GLES2Commands.h index 870275a108..ac4df60bb7 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Commands.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Commands.h @@ -1,30 +1,34 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_COMMANDS_H_ -#define CC_GFXGLES2_COMMANDS_H_ + +#pragma once + +#include "gfx-gles-common/GLESCommandPool.h" #include "GLES2GPUObjects.h" +#include "GLES2Std.h" namespace cc { namespace gfx { @@ -32,57 +36,57 @@ namespace gfx { class GLES2Device; struct GLES2DepthBias final { - float constant = 0.0f; - float clamp = 0.0f; - float slope = 0.0f; + float constant = 0.0F; + float clamp = 0.0F; + float slope = 0.0F; }; struct GLES2DepthBounds final { - float minBounds = 0.0f; - float maxBounds = 0.0f; + float minBounds = 0.0F; + float maxBounds = 0.0F; }; struct GLES2StencilWriteMask final { - StencilFace face = StencilFace::FRONT; - uint writeMask = 0; + StencilFace face = StencilFace::FRONT; + uint writeMask = 0; }; struct GLES2StencilCompareMask final { - StencilFace face = StencilFace::FRONT; - int refrence = 0; - uint compareMask = 0; + StencilFace face = StencilFace::FRONT; + int refrence = 0; + uint compareMask = 0; }; struct GLES2TextureSubres final { - uint baseMipLevel = 0; - uint levelCount = 1; + uint baseMipLevel = 0; + uint levelCount = 1; uint baseArrayLayer = 0; - uint layerCount = 1; + uint layerCount = 1; }; struct GLES2BufferTextureCopy final { - uint buffOffset = 0; - uint buffStride = 0; - uint buffTexHeight = 0; - uint texOffset[3] = {0}; - uint texExtent[3] = {0}; + uint buffOffset = 0; + uint buffStride = 0; + uint buffTexHeight = 0; + uint texOffset[3] = {0}; + uint texExtent[3] = {0}; GLES2TextureSubres texSubres; }; -class GLES2CmdBeginRenderPass final : public GFXCmd { +class GLES2CmdBeginRenderPass final : public GLESCmd { public: - GLES2GPURenderPass *gpuRenderPass = nullptr; - GLES2GPUFramebuffer *gpuFBO = nullptr; - Rect renderArea; - size_t numClearColors = 0; - Color clearColors[GFX_MAX_ATTACHMENTS]; - float clearDepth = 1.0f; - int clearStencil = 0; + GLES2GPURenderPass * gpuRenderPass = nullptr; + GLES2GPUFramebuffer *gpuFBO = nullptr; + Rect renderArea; + size_t numClearColors = 0; + Color clearColors[MAX_ATTACHMENTS]; + float clearDepth = 1.0F; + int clearStencil = 0; - GLES2CmdBeginRenderPass() : GFXCmd(GFXCmdType::BEGIN_RENDER_PASS) {} + GLES2CmdBeginRenderPass() : GLESCmd(GLESCmdType::BEGIN_RENDER_PASS) {} - virtual void clear() override { - gpuFBO = nullptr; + void clear() override { + gpuFBO = nullptr; numClearColors = 0; } }; @@ -99,108 +103,108 @@ enum class GLES2State { COUNT, }; -class GLES2CmdBindStates final : public GFXCmd { +class GLES2CmdBindStates final : public GLESCmd { public: - GLES2GPUPipelineState *gpuPipelineState = nullptr; - GLES2GPUInputAssembler *gpuInputAssembler = nullptr; + GLES2GPUPipelineState * gpuPipelineState = nullptr; + GLES2GPUInputAssembler * gpuInputAssembler = nullptr; vector gpuDescriptorSets; - vector dynamicOffsets; - Viewport viewport; - Rect scissor; - float lineWidth = 1.0f; - bool depthBiasEnabled = false; - GLES2DepthBias depthBias; - Color blendConstants; - GLES2DepthBounds depthBounds; - GLES2StencilWriteMask stencilWriteMask; - GLES2StencilCompareMask stencilCompareMask; + vector dynamicOffsets; + Viewport viewport; + Rect scissor; + float lineWidth = 1.0F; + bool depthBiasEnabled = false; + GLES2DepthBias depthBias; + Color blendConstants; + GLES2DepthBounds depthBounds; + GLES2StencilWriteMask stencilWriteMask; + GLES2StencilCompareMask stencilCompareMask; - GLES2CmdBindStates() : GFXCmd(GFXCmdType::BIND_STATES) {} + GLES2CmdBindStates() : GLESCmd(GLESCmdType::BIND_STATES) {} - virtual void clear() override { - gpuPipelineState = nullptr; + void clear() override { + gpuPipelineState = nullptr; gpuInputAssembler = nullptr; gpuDescriptorSets.clear(); dynamicOffsets.clear(); } }; -class GLES2CmdDraw final : public GFXCmd { +class GLES2CmdDraw final : public GLESCmd { public: DrawInfo drawInfo; - GLES2CmdDraw() : GFXCmd(GFXCmdType::DRAW) {} - virtual void clear() override {} + GLES2CmdDraw() : GLESCmd(GLESCmdType::DRAW) {} + void clear() override {} }; -class GLES2CmdUpdateBuffer final : public GFXCmd { +class GLES2CmdUpdateBuffer final : public GLESCmd { public: GLES2GPUBuffer *gpuBuffer = nullptr; - uint8_t *buffer = nullptr; - uint size = 0; - uint offset = 0; + const uint8_t * buffer = nullptr; + uint size = 0; + uint offset = 0; - GLES2CmdUpdateBuffer() : GFXCmd(GFXCmdType::UPDATE_BUFFER) {} + GLES2CmdUpdateBuffer() : GLESCmd(GLESCmdType::UPDATE_BUFFER) {} - virtual void clear() override { + void clear() override { gpuBuffer = nullptr; - buffer = nullptr; + buffer = nullptr; } }; -class GLES2CmdCopyBufferToTexture final : public GFXCmd { +class GLES2CmdCopyBufferToTexture final : public GLESCmd { public: - GLES2GPUTexture *gpuTexture = nullptr; - const BufferTextureCopy *regions = nullptr; - uint count = 0u; - const uint8_t *const *buffers; + GLES2GPUTexture * gpuTexture = nullptr; + const BufferTextureCopy *regions = nullptr; + uint count = 0U; + const uint8_t *const * buffers; - GLES2CmdCopyBufferToTexture() : GFXCmd(GFXCmdType::COPY_BUFFER_TO_TEXTURE) {} + GLES2CmdCopyBufferToTexture() : GLESCmd(GLESCmdType::COPY_BUFFER_TO_TEXTURE) {} - virtual void clear() override { + void clear() override { gpuTexture = nullptr; - regions = nullptr; - count = 0u; - buffers = nullptr; + regions = nullptr; + count = 0U; + buffers = nullptr; } }; class GLES2CmdPackage final : public Object { public: - CachedArray cmds; - CachedArray beginRenderPassCmds; - CachedArray bindStatesCmds; - CachedArray drawCmds; - CachedArray updateBufferCmds; + CachedArray cmds; + CachedArray beginRenderPassCmds; + CachedArray bindStatesCmds; + CachedArray drawCmds; + CachedArray updateBufferCmds; CachedArray copyBufferToTextureCmds; }; class GLES2GPUCommandAllocator final : public Object { public: - CommandPool beginRenderPassCmdPool; - CommandPool bindStatesCmdPool; - CommandPool drawCmdPool; - CommandPool updateBufferCmdPool; + CommandPool beginRenderPassCmdPool; + CommandPool bindStatesCmdPool; + CommandPool drawCmdPool; + CommandPool updateBufferCmdPool; CommandPool copyBufferToTextureCmdPool; - void clearCmds(GLES2CmdPackage *cmd_package) { - if (cmd_package->beginRenderPassCmds.size()) { - beginRenderPassCmdPool.freeCmds(cmd_package->beginRenderPassCmds); + void clearCmds(GLES2CmdPackage *cmdPackage) { + if (cmdPackage->beginRenderPassCmds.size()) { + beginRenderPassCmdPool.freeCmds(cmdPackage->beginRenderPassCmds); } - if (cmd_package->bindStatesCmds.size()) { - bindStatesCmdPool.freeCmds(cmd_package->bindStatesCmds); + if (cmdPackage->bindStatesCmds.size()) { + bindStatesCmdPool.freeCmds(cmdPackage->bindStatesCmds); } - if (cmd_package->drawCmds.size()) { - drawCmdPool.freeCmds(cmd_package->drawCmds); + if (cmdPackage->drawCmds.size()) { + drawCmdPool.freeCmds(cmdPackage->drawCmds); } - if (cmd_package->updateBufferCmds.size()) { - updateBufferCmdPool.freeCmds(cmd_package->updateBufferCmds); + if (cmdPackage->updateBufferCmds.size()) { + updateBufferCmdPool.freeCmds(cmdPackage->updateBufferCmds); } - if (cmd_package->copyBufferToTextureCmds.size()) { - copyBufferToTextureCmdPool.freeCmds(cmd_package->copyBufferToTextureCmds); + if (cmdPackage->copyBufferToTextureCmds.size()) { + copyBufferToTextureCmdPool.freeCmds(cmdPackage->copyBufferToTextureCmds); } - cmd_package->cmds.clear(); + cmdPackage->cmds.clear(); } CC_INLINE void reset() { @@ -212,35 +216,33 @@ public: } }; -CC_GLES2_API void GLES2CmdFuncCreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer); -CC_GLES2_API void GLES2CmdFuncDestroyBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer); -CC_GLES2_API void GLES2CmdFuncResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer); -CC_GLES2_API void GLES2CmdFuncCreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture); -CC_GLES2_API void GLES2CmdFuncDestroyTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture); -CC_GLES2_API void GLES2CmdFuncResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture); -CC_GLES2_API void GLES2CmdFuncCreateSampler(GLES2Device *device, GLES2GPUSampler *gpuSampler); -CC_GLES2_API void GLES2CmdFuncDestroySampler(GLES2Device *device, GLES2GPUSampler *gpuSampler); -CC_GLES2_API void GLES2CmdFuncCreateShader(GLES2Device *device, GLES2GPUShader *gpuShader); -CC_GLES2_API void GLES2CmdFuncDestroyShader(GLES2Device *device, GLES2GPUShader *gpuShader); -CC_GLES2_API void GLES2CmdFuncCreateInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler); -CC_GLES2_API void GLES2CmdFuncDestroyInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler); -CC_GLES2_API void GLES2CmdFuncCreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO); -CC_GLES2_API void GLES2CmdFuncDestroyFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO); +CC_GLES2_API void cmdFuncGLES2CreateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer); +CC_GLES2_API void cmdFuncGLES2DestroyBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer); +CC_GLES2_API void cmdFuncGLES2ResizeBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer); +CC_GLES2_API void cmdFuncGLES2CreateTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture); +CC_GLES2_API void cmdFuncGLES2DestroyTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture); +CC_GLES2_API void cmdFuncGLES2ResizeTexture(GLES2Device *device, GLES2GPUTexture *gpuTexture); +CC_GLES2_API void cmdFuncGLES2CreateSampler(GLES2Device *device, GLES2GPUSampler *gpuSampler); +CC_GLES2_API void cmdFuncGLES2DestroySampler(GLES2Device *device, GLES2GPUSampler *gpuSampler); +CC_GLES2_API void cmdFuncGLES2CreateShader(GLES2Device *device, GLES2GPUShader *gpuShader); +CC_GLES2_API void cmdFuncGLES2DestroyShader(GLES2Device *device, GLES2GPUShader *gpuShader); +CC_GLES2_API void cmdFuncGLES2CreateInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler); +CC_GLES2_API void cmdFuncGLES2DestroyInputAssembler(GLES2Device *device, GLES2GPUInputAssembler *gpuInputAssembler); +CC_GLES2_API void cmdFuncGLES2CreateFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO); +CC_GLES2_API void cmdFuncGLES2DestroyFramebuffer(GLES2Device *device, GLES2GPUFramebuffer *gpuFBO); -CC_GLES2_API void GLES2CmdFuncBeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRenderPass, GLES2GPUFramebuffer *gpuFBO, +CC_GLES2_API void cmdFuncGLES2BeginRenderPass(GLES2Device *device, GLES2GPURenderPass *gpuRenderPass, GLES2GPUFramebuffer *gpuFramebuffer, const Rect &renderArea, size_t numClearColors, const Color *clearColors, float clearDepth, int clearStencil); -CC_GLES2_API void GLES2CmdFuncEndRenderPass(GLES2Device *device); -CC_GLES2_API void GLES2CmdFuncBindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipelineState, GLES2GPUInputAssembler *gpuInputAssembler, - vector &gpuDescriptorSets, vector &dynamicOffsets, - Viewport &viewport, Rect &scissor, float lineWidth, bool depthBiasEnabled, GLES2DepthBias &depthBias, Color &blendConstants, - GLES2DepthBounds &depthBounds, GLES2StencilWriteMask &stencilWriteMask, GLES2StencilCompareMask &stencilCompareMask); -CC_GLES2_API void GLES2CmdFuncDraw(GLES2Device *device, DrawInfo &drawInfo); -CC_GLES2_API void GLES2CmdFuncUpdateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size); -CC_GLES2_API void GLES2CmdFuncCopyBuffersToTexture(GLES2Device *device, const uint8_t *const *buffers, +CC_GLES2_API void cmdFuncGLES2EndRenderPass(GLES2Device *device); +CC_GLES2_API void cmdFuncGLES2BindState(GLES2Device *device, GLES2GPUPipelineState *gpuPipelineState, GLES2GPUInputAssembler *gpuInputAssembler, + const vector &gpuDescriptorSets, const vector &dynamicOffsets, + const Viewport &viewport, const Rect &scissor, float lineWidth, bool depthBiasEnabled, const GLES2DepthBias &depthBias, const Color &blendConstants, + const GLES2DepthBounds &depthBounds, const GLES2StencilWriteMask &stencilWriteMask, const GLES2StencilCompareMask &stencilCompareMask); +CC_GLES2_API void cmdFuncGLES2Draw(GLES2Device *device, const DrawInfo &drawInfo); +CC_GLES2_API void cmdFuncGLES2UpdateBuffer(GLES2Device *device, GLES2GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size); +CC_GLES2_API void cmdFuncGLES2CopyBuffersToTexture(GLES2Device *device, const uint8_t *const *buffers, GLES2GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count); -CC_GLES2_API void GLES2CmdFuncExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmdPackage); +CC_GLES2_API void cmdFuncGLES2ExecuteCmds(GLES2Device *device, GLES2CmdPackage *cmdPackage); } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Context.cpp b/native/cocos/renderer/gfx-gles2/GLES2Context.cpp index 0482819fad..fba6a80047 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Context.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Context.cpp @@ -1,30 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Context.h" -#include "gles2w.h" +#include "GLES2Device.h" +#include "GLES2GPUObjects.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID) #include "android/native_window.h" @@ -32,7 +35,7 @@ THE SOFTWARE. #include "cocos/bindings/event/EventDispatcher.h" #endif -#define FORCE_DISABLE_VALIDATION 1 +#define FORCE_DISABLE_VALIDATION 1 namespace cc { namespace gfx { @@ -43,7 +46,7 @@ void GL_APIENTRY GLES2EGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, - const void *userParam) { + const void * userParam) { String sourceDesc; switch (source) { case GL_DEBUG_SOURCE_API_KHR: sourceDesc = "API"; break; @@ -75,7 +78,7 @@ void GL_APIENTRY GLES2EGLDebugProc(GLenum source, default: severityDesc = "NOTIFICATION"; break; } - String msg = StringUtil::Format("source: %s, type: %s, severity: %s, message: %s", + String msg = StringUtil::format("source: %s, type: %s, severity: %s, message: %s", sourceDesc.c_str(), typeDesc.c_str(), severityDesc.c_str(), message); @@ -88,39 +91,40 @@ void GL_APIENTRY GLES2EGLDebugProc(GLenum source, #endif -GLES2Context::GLES2Context(Device *device) -: Context(device) { -} +GLES2Context::GLES2Context() = default; -GLES2Context::~GLES2Context() { -} +GLES2Context::~GLES2Context() = default; #if (CC_PLATFORM == CC_PLATFORM_WINDOWS || CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_MAC_OSX) -bool GLES2Context::initialize(const ContextInfo &info) { - - _vsyncMode = info.vsyncMode; +bool GLES2Context::doInit(const ContextInfo &info) { + _vsyncMode = info.vsyncMode; _windowHandle = info.windowHandle; ////////////////////////////////////////////////////////////////////////// if (!info.sharedCtx) { + if (!gles2wInit()) { + return false; + } + _isPrimaryContex = true; - _windowHandle = info.windowHandle; + _windowHandle = info.windowHandle; #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - _nativeDisplay = (NativeDisplayType)GetDC((HWND)_windowHandle); + _nativeDisplay = GetDC(reinterpret_cast(_windowHandle)); if (!_nativeDisplay) { return false; } EGL_CHECK(_eglDisplay = eglGetDisplay(_nativeDisplay)); if (_eglDisplay == EGL_NO_DISPLAY) { - EGL_CHECK(_eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY)); + EGL_CHECK(_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)); } #else - EGL_CHECK(_eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY)); + EGL_CHECK(_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)); #endif + // If a display still couldn't be obtained, return an error. if (_eglDisplay == EGL_NO_DISPLAY) { CC_LOG_ERROR("eglGetDisplay() - FAILED."); @@ -139,21 +143,95 @@ bool GLES2Context::initialize(const ContextInfo &info) { // rather than any other API (such as OpenVG). EGL_CHECK(eglBindAPI(EGL_OPENGL_ES_API)); - _colorFmt = Format::RGBA8; + _colorFmt = Format::RGBA8; _depthStencilFmt = Format::D24S8; - const EGLint attribs[] = { + bool msaaEnabled = info.msaaEnabled; + EGLint redSize{8}, greenSize{8}, blueSize{8}, alphaSize{8}, depthSize{24}, stencilSize{8}, sampleBufferSize{msaaEnabled ? EGL_DONT_CARE : 0}, sampleSize{msaaEnabled ? EGL_DONT_CARE : 0}; + + EGLint defaultAttribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, // EGL_BUFFER_SIZE, colorBuffSize, - EGL_BLUE_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_RED_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 24, - EGL_STENCIL_SIZE, 8, + EGL_BLUE_SIZE, blueSize, + EGL_GREEN_SIZE, greenSize, + EGL_RED_SIZE, redSize, + EGL_ALPHA_SIZE, alphaSize, + EGL_DEPTH_SIZE, depthSize, + EGL_STENCIL_SIZE, stencilSize, + EGL_SAMPLE_BUFFERS, sampleBufferSize, + EGL_SAMPLES, sampleSize, EGL_NONE}; + int numConfig = 0; + + EGLConfig cfgs[128]; + + eglGetConfigs(_eglDisplay, cfgs, 128, &numConfig); + if (eglChooseConfig(_eglDisplay, defaultAttribs, NULL, 0, &numConfig)) { + _vecEGLConfig.resize(numConfig); + } else { + CC_LOG_ERROR("Query configuration failed."); + return false; + } + + int count = numConfig; + if (eglChooseConfig(_eglDisplay, defaultAttribs, _vecEGLConfig.data(), count, &numConfig) == EGL_FALSE || !numConfig) { + CC_LOG_ERROR("eglChooseConfig configuration failed."); + return false; + } + + EGLint depth{0}, stencil{0}; + + const uint8_t attrNums = 8; + uint64_t lastScore{0}; + int params[attrNums] = {0}; + + const bool performancePreferred = info.performance == Performance::HIGH_QUALITY; + for (int i = 0; i < numConfig; i++) { + int depthValue{0}; + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_RED_SIZE, ¶ms[0]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_GREEN_SIZE, ¶ms[1]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_BLUE_SIZE, ¶ms[2]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_ALPHA_SIZE, ¶ms[3]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_DEPTH_SIZE, ¶ms[4]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_STENCIL_SIZE, ¶ms[5]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_SAMPLE_BUFFERS, ¶ms[6]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_SAMPLES, ¶ms[7]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_DEPTH_ENCODING_NV, &depthValue); + + int bNonLinearDepth = (depthValue == EGL_DEPTH_ENCODING_NONLINEAR_NV) ? 1 : 0; + + /*------------------------------------------ANGLE's priority-----------------------------------------------*/ + // Favor EGLConfigLists by RGB, then Depth, then Non-linear Depth, then Stencil, then Alpha + uint64_t currScore{0}; + currScore |= ((uint64_t)std::min(std::max(params[6], 0), 15)) << 29; + currScore |= ((uint64_t)std::min(std::max(params[7], 0), 31)) << 24; + currScore |= std::min(std::abs(params[0] - redSize) + + std::abs(params[1] - greenSize) + + std::abs(params[2] - blueSize), + 127) + << 17; + currScore |= std::min(std::abs(params[4] - depthSize), 63) << 11; + currScore |= std::min(std::abs(1 - bNonLinearDepth), 1) << 10; + currScore |= std::min(std::abs(params[5] - stencilSize), 31) << 6; + currScore |= std::min(std::abs(params[3] - alphaSize), 31) << 0; + /*------------------------------------------ANGLE's priority-----------------------------------------------*/ + + // if msaaEnabled, sampleBuffers and sampleCount should be greater than 0, until iterate to the last one(can't find). + bool msaaLimit = msaaEnabled ? (params[6] > 0 && params[7] > 0) || (i == numConfig - 1) : (params[6] == 0 && params[7] == 0); + // performancePreferred ? [>=] : [<] , egl configurations store in "ascending order" + bool filter = (currScore < lastScore) ^ performancePreferred; + if ((filter || lastScore == 0) && msaaLimit) { + _eglConfig = _vecEGLConfig[i]; + depth = params[4]; + stencil = params[5]; + _sampleBuffers = params[6]; + _sampleCount = params[7]; + lastScore = currScore; + } + } + // Find a suitable EGLConfig // eglChooseConfig is provided by EGL to provide an easy way to select an appropriate configuration. It takes in the capabilities // specified in the attribute list, and returns a list of available configurations that match or exceed the capabilities requested. @@ -163,16 +241,7 @@ bool GLES2Context::initialize(const ContextInfo &info) { // advanced applications choose to do. For this application however, taking the first EGLConfig that the function returns suits // its needs perfectly, so we limit it to returning a single EGLConfig. - EGLint numConfigs; - if (eglChooseConfig(_eglDisplay, attribs, &_eglConfig, 1, &numConfigs) == EGL_FALSE || - numConfigs <= 0) { - CC_LOG_ERROR("Choosing configuration failed."); - return false; - } - - EGLint depth = attribs[13]; - EGLint stencil = attribs[15]; - CC_LOG_INFO("Setup EGLConfig: depth [%d] stencil [%d]", depth, stencil); + CC_LOG_INFO("Setup EGLConfig: depth [%d] stencil [%d] sampleBuffer [%d] sampleCount [%d]", depth, stencil, _sampleBuffers, _sampleCount); if (depth == 16 && stencil == 0) { _depthStencilFmt = Format::D16; @@ -192,8 +261,8 @@ bool GLES2Context::initialize(const ContextInfo &info) { } CC_LOG_INFO("Chosen EGLConfig: color [%s], depth stencil [%s].", - GFX_FORMAT_INFOS[(int)_colorFmt].name.c_str(), - GFX_FORMAT_INFOS[(int)_depthStencilFmt].name.c_str()); + GFX_FORMAT_INFOS[static_cast(_colorFmt)].name.c_str(), + GFX_FORMAT_INFOS[static_cast(_depthStencilFmt)].name.c_str()); /** * EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is @@ -209,12 +278,12 @@ bool GLES2Context::initialize(const ContextInfo &info) { return false; } - uint width = _device->getWidth(); - uint height = _device->getHeight(); - ANativeWindow_setBuffersGeometry((ANativeWindow *)_windowHandle, width, height, nFmt); + uint width = GLES2Device::getInstance()->getWidth(); + uint height = GLES2Device::getInstance()->getHeight(); + ANativeWindow_setBuffersGeometry(reinterpret_cast(_windowHandle), width, height, nFmt); #endif - EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, (EGLNativeWindowType)_windowHandle, NULL)); + EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, reinterpret_cast(_windowHandle), nullptr)); if (_eglSurface == EGL_NO_SURFACE) { CC_LOG_ERROR("Window surface created failed."); return false; @@ -223,14 +292,14 @@ bool GLES2Context::initialize(const ContextInfo &info) { //String eglVendor = eglQueryString(_eglDisplay, EGL_VENDOR); //String eglVersion = eglQueryString(_eglDisplay, EGL_VERSION); - EGL_CHECK(_extensions = StringUtil::Split((const char *)eglQueryString(_eglDisplay, EGL_EXTENSIONS), " ")); + EGL_CHECK(_extensions = StringUtil::split(eglQueryString(_eglDisplay, EGL_EXTENSIONS), " ")); _majorVersion = 2; _minorVersion = 0; EGLint ctxAttribs[32]; - uint n = 0; + uint n = 0; - bool hasKHRCreateCtx = CheckExtension(CC_TOSTR(EGL_KHR_create_context)); + bool hasKHRCreateCtx = checkExtension(CC_TOSTR(EGL_KHR_create_context)); if (hasKHRCreateCtx) { #if CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION ctxAttribs[n++] = EGL_CONTEXT_FLAGS_KHR; @@ -240,73 +309,38 @@ bool GLES2Context::initialize(const ContextInfo &info) { ctxAttribs[n++] = _majorVersion; ctxAttribs[n++] = EGL_CONTEXT_MINOR_VERSION_KHR; ctxAttribs[n++] = _minorVersion; - ctxAttribs[n] = EGL_NONE; + ctxAttribs[n] = EGL_NONE; } else { ctxAttribs[n++] = EGL_CONTEXT_CLIENT_VERSION; ctxAttribs[n++] = _majorVersion; - ctxAttribs[n] = EGL_NONE; + ctxAttribs[n] = EGL_NONE; } - EGL_CHECK(_eglContext = eglCreateContext(_eglDisplay, _eglConfig, NULL, ctxAttribs)); + EGL_CHECK(_eglContext = eglCreateContext(_eglDisplay, _eglConfig, nullptr, ctxAttribs)); if (!_eglContext) { CC_LOG_ERROR("Create EGL context failed."); return false; } _eglSharedContext = _eglContext; - - #if (CC_PLATFORM == CC_PLATFORM_ANDROID) - EventDispatcher::addCustomEventListener(EVENT_DESTROY_WINDOW, [=](const CustomEvent &) -> void { - if (_eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(_eglDisplay, _eglSurface); - _eglSurface = EGL_NO_SURFACE; - } - }); - - EventDispatcher::addCustomEventListener(EVENT_RECREATE_WINDOW, [=](const CustomEvent &event) -> void { - _windowHandle = (uintptr_t)event.args->ptrVal; - - EGLint nFmt; - if (eglGetConfigAttrib(_eglDisplay, _eglConfig, EGL_NATIVE_VISUAL_ID, &nFmt) == EGL_FALSE) { - CC_LOG_ERROR("Getting configuration attributes failed."); - return; - } - uint width = _device->getWidth(); - uint height = _device->getHeight(); - ANativeWindow_setBuffersGeometry((ANativeWindow *)_windowHandle, width, height, nFmt); - - EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, (EGLNativeWindowType)_windowHandle, NULL)); - if (_eglSurface == EGL_NO_SURFACE) { - CC_LOG_ERROR("Recreate window surface failed."); - return; - } - - ((GLES2Context *)_device->getContext())->MakeCurrent(); - }); - #endif - - if (!gles2wInit()) { - return false; - } - } else { - GLES2Context *sharedCtx = (GLES2Context *)info.sharedCtx; + auto *sharedCtx = static_cast(info.sharedCtx); - _majorVersion = sharedCtx->major_ver(); - _minorVersion = sharedCtx->minor_ver(); - _nativeDisplay = sharedCtx->native_display(); - _eglDisplay = sharedCtx->egl_display(); - _eglConfig = sharedCtx->egl_config(); - _eglSharedContext = sharedCtx->egl_shared_ctx(); - _eglSurface = sharedCtx->egl_surface(); - _colorFmt = sharedCtx->getColorFormat(); - _depthStencilFmt = sharedCtx->getDepthStencilFormat(); - _majorVersion = sharedCtx->major_ver(); - _minorVersion = sharedCtx->minor_ver(); - _extensions = sharedCtx->_extensions; - _isInitialized = sharedCtx->_isInitialized; + _majorVersion = sharedCtx->majorVer(); + _minorVersion = sharedCtx->minorVer(); + _nativeDisplay = sharedCtx->nativeDisplay(); + _eglDisplay = sharedCtx->eglDisplay(); + _eglConfig = sharedCtx->eglConfig(); + _eglSharedContext = sharedCtx->eglSharedCtx(); + _eglSurface = sharedCtx->eglSurface(); + _colorFmt = sharedCtx->getColorFormat(); + _depthStencilFmt = sharedCtx->getDepthStencilFormat(); + _majorVersion = sharedCtx->majorVer(); + _minorVersion = sharedCtx->minorVer(); + _extensions = sharedCtx->_extensions; + _isInitialized = sharedCtx->_isInitialized; - bool hasKHRCreateCtx = CheckExtension(CC_TOSTR(EGL_KHR_create_context)); + bool hasKHRCreateCtx = checkExtension(CC_TOSTR(EGL_KHR_create_context)); if (!hasKHRCreateCtx) { CC_LOG_INFO( "EGL context creation: EGL_KHR_create_context not supported. Minor version will be discarded, and debug disabled."); @@ -314,7 +348,7 @@ bool GLES2Context::initialize(const ContextInfo &info) { } EGLint ctxAttribs[32]; - uint n = 0; + uint n = 0; if (hasKHRCreateCtx) { ctxAttribs[n++] = EGL_CONTEXT_MAJOR_VERSION_KHR; @@ -343,38 +377,79 @@ bool GLES2Context::initialize(const ContextInfo &info) { return true; } -void GLES2Context::destroy() { +void GLES2Context::doDestroy() { EGL_CHECK(eglMakeCurrent(_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); + if (!_vecEGLConfig.empty()) { + _vecEGLConfig.clear(); + } + if (_eglContext != EGL_NO_CONTEXT) { EGL_CHECK(eglDestroyContext(_eglDisplay, _eglContext)); _eglContext = EGL_NO_CONTEXT; } - if (_isPrimaryContex && _eglSurface != EGL_NO_SURFACE) { - EGL_CHECK(eglDestroySurface(_eglDisplay, _eglSurface)); - _eglSurface = EGL_NO_SURFACE; - } + if (_isPrimaryContex) { + if (_eglSurface != EGL_NO_SURFACE) { + EGL_CHECK(eglDestroySurface(_eglDisplay, _eglSurface)); + _eglSurface = EGL_NO_SURFACE; + } - if (_eglDisplay != EGL_NO_DISPLAY) { - EGL_CHECK(eglTerminate(_eglDisplay)); - _eglDisplay = EGL_NO_DISPLAY; - } + if (_eglDisplay != EGL_NO_DISPLAY) { + EGL_CHECK(eglTerminate(_eglDisplay)); + _eglDisplay = EGL_NO_DISPLAY; + } #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - if (_isPrimaryContex && _nativeDisplay) { - ReleaseDC((HWND)_windowHandle, _nativeDisplay); - } + if (_nativeDisplay) { + ReleaseDC(reinterpret_cast(_windowHandle), _nativeDisplay); + } #endif + } _isPrimaryContex = false; - _windowHandle = 0; - _nativeDisplay = 0; - _vsyncMode = VsyncMode::OFF; - _isInitialized = false; + _windowHandle = 0; + _nativeDisplay = 0; // NOLINT(modernize-use-nullptr) portability issues + _vsyncMode = VsyncMode::OFF; + _isInitialized = false; } -bool GLES2Context::MakeCurrentImpl(bool bound) { +void GLES2Context::releaseSurface(uintptr_t /*windowHandle*/) { + #if (CC_PLATFORM == CC_PLATFORM_ANDROID) + if (_eglSurface != EGL_NO_SURFACE) { + eglDestroySurface(_eglDisplay, _eglSurface); + _eglSurface = EGL_NO_SURFACE; + } + #endif +} + +void GLES2Context::acquireSurface(uintptr_t windowHandle) { + #if (CC_PLATFORM == CC_PLATFORM_ANDROID) + _windowHandle = windowHandle; + + EGLint nFmt = 0; + if (eglGetConfigAttrib(_eglDisplay, _eglConfig, EGL_NATIVE_VISUAL_ID, &nFmt) == EGL_FALSE) { + CC_LOG_ERROR("Getting configuration attributes failed."); + return; + } + // Device's size will be updated after recreate window (in resize event) and is incorrect for now. + auto *window = reinterpret_cast(_windowHandle); + uint width = ANativeWindow_getWidth(window); + uint height = ANativeWindow_getHeight(window); + ANativeWindow_setBuffersGeometry(window, width, height, nFmt); + + EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, reinterpret_cast(_windowHandle), nullptr)); + if (_eglSurface == EGL_NO_SURFACE) { + CC_LOG_ERROR("Recreate window surface failed."); + return; + } + + static_cast(GLES2Device::getInstance()->getContext())->makeCurrent(); + GLES2Device::getInstance()->stateCache()->reset(); + #endif +} + +bool GLES2Context::makeCurrentImpl(bool bound) { bool succeeded; EGL_CHECK(succeeded = eglMakeCurrent(_eglDisplay, bound ? _eglSurface : EGL_NO_SURFACE, @@ -389,21 +464,20 @@ void GLES2Context::present() { #endif -bool GLES2Context::MakeCurrent(bool bound) { +bool GLES2Context::makeCurrent(bool bound) { if (!bound) { CC_LOG_DEBUG("eglMakeCurrent() - UNBOUNDED, Context: 0x%p", this); - return MakeCurrentImpl(false); + return makeCurrentImpl(false); } - if (MakeCurrentImpl(bound)) { + if (makeCurrentImpl(bound)) { if (!_isInitialized) { - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS || CC_PLATFORM == CC_PLATFORM_ANDROID) // Turn on or off the vertical sync depending on the input bool value. int interval = 1; switch (_vsyncMode) { case VsyncMode::OFF: interval = 0; break; - case VsyncMode::ON: interval = 1; break; + case VsyncMode::ON: case VsyncMode::RELAXED: interval = 1; break; case VsyncMode::MAILBOX: interval = 0; break; case VsyncMode::HALF: interval = 2; break; @@ -415,66 +489,68 @@ bool GLES2Context::MakeCurrent(bool bound) { return false; } #endif + _isInitialized = true; + } #if CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION && CC_PLATFORM != CC_PLATFORM_MAC_IOS - GL_CHECK(glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR)); + GL_CHECK(glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR)); + if (glDebugMessageControlKHR) { GL_CHECK(glDebugMessageControlKHR(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE)); + } + if (glDebugMessageCallbackKHR) { GL_CHECK(glDebugMessageCallbackKHR(GLES2EGLDebugProc, NULL)); + } #endif - _isInitialized = true; + ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + GL_CHECK(glPixelStorei(GL_PACK_ALIGNMENT, 1)); + GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); + GL_CHECK(glActiveTexture(GL_TEXTURE0)); - GL_CHECK(glPixelStorei(GL_PACK_ALIGNMENT, 1)); - GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); - GL_CHECK(glActiveTexture(GL_TEXTURE0)); + ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + GL_CHECK(glEnable(GL_SCISSOR_TEST)); + GL_CHECK(glEnable(GL_CULL_FACE)); + GL_CHECK(glCullFace(GL_BACK)); - GL_CHECK(glEnable(GL_SCISSOR_TEST)); - GL_CHECK(glEnable(GL_CULL_FACE)); - GL_CHECK(glCullFace(GL_BACK)); + GL_CHECK(glFrontFace(GL_CCW)); - GL_CHECK(glFrontFace(GL_CCW)); + //GL_CHECK(glDisable(GL_MULTISAMPLE)); - //GL_CHECK(glDisable(GL_MULTISAMPLE)); + ////////////////////////////////////////////////////////////////////////// + // DepthStencilState + GL_CHECK(glEnable(GL_DEPTH_TEST)); + GL_CHECK(glDepthMask(GL_TRUE)); + GL_CHECK(glDepthFunc(GL_LESS)); - ////////////////////////////////////////////////////////////////////////// - // DepthStencilState - GL_CHECK(glEnable(GL_DEPTH_TEST)); - GL_CHECK(glDepthMask(GL_TRUE)); - GL_CHECK(glDepthFunc(GL_LESS)); + GL_CHECK(glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 1, 0xffffffff)); + GL_CHECK(glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP)); + GL_CHECK(glStencilMaskSeparate(GL_FRONT, 0xffffffff)); + GL_CHECK(glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 1, 0xffffffff)); + GL_CHECK(glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP)); + GL_CHECK(glStencilMaskSeparate(GL_BACK, 0xffffffff)); - GL_CHECK(glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 1, 0xffffffff)); - GL_CHECK(glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP)); - GL_CHECK(glStencilMaskSeparate(GL_FRONT, 0xffffffff)); - GL_CHECK(glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 1, 0xffffffff)); - GL_CHECK(glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP)); - GL_CHECK(glStencilMaskSeparate(GL_BACK, 0xffffffff)); + GL_CHECK(glDisable(GL_STENCIL_TEST)); - GL_CHECK(glDisable(GL_STENCIL_TEST)); + ////////////////////////////////////////////////////////////////////////// + // BlendState - ////////////////////////////////////////////////////////////////////////// - // BlendState - - GL_CHECK(glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE)); - GL_CHECK(glDisable(GL_BLEND)); - GL_CHECK(glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD)); - GL_CHECK(glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO)); - GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); - GL_CHECK(glBlendColor((GLclampf)0.0f, (GLclampf)0.0f, (GLclampf)0.0f, (GLclampf)0.0f)); - } + GL_CHECK(glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE)); + GL_CHECK(glDisable(GL_BLEND)); + GL_CHECK(glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD)); + GL_CHECK(glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO)); + GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); + GL_CHECK(glBlendColor(0.0F, 0.0F, 0.0F, 0.0F)); CC_LOG_DEBUG("eglMakeCurrent() - SUCCEEDED, Context: 0x%p", this); return true; - } else { - CC_LOG_ERROR("MakeCurrent() - FAILED, Context: 0x%p", this); - return false; } + CC_LOG_ERROR("MakeCurrent() - FAILED, Context: 0x%p", this); + return false; } -bool GLES2Context::CheckExtension(const String &extension) const { +bool GLES2Context::checkExtension(const String &extension) const { return (std::find(_extensions.begin(), _extensions.end(), extension) != _extensions.end()); } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Context.h b/native/cocos/renderer/gfx-gles2/GLES2Context.h index 24985d31e9..0c97a3dede 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Context.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Context.h @@ -1,120 +1,103 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_EGL_CONTEXT_H_ -#define CC_GFXGLES2_EGL_CONTEXT_H_ -#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) - #ifdef __OBJC__ - #include - #endif -#else - #include - #include - #include -#endif +#pragma once -#ifndef EGL_KHR_create_context - #define EGL_KHR_create_context 1 - #define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION - #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB - #define EGL_CONTEXT_FLAGS_KHR 0x30FC - #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD - #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD - #define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE - #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF - #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 - #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 - #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 - #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 - #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 - #define EGL_OPENGL_ES3_BIT_KHR 0x00000040 -#endif +#include +#include "GLES2Std.h" +#include "GLES2Wrangler.h" +#include "gfx-base/GFXContext.h" namespace cc { namespace gfx { class CC_GLES2_API GLES2Context final : public Context { public: - GLES2Context(Device *device); - ~GLES2Context(); + GLES2Context(); + ~GLES2Context() override; -public: - virtual bool initialize(const ContextInfo &info) override; - virtual void destroy() override; - virtual void present() override; - bool MakeCurrent(bool bound); + void present() override; + bool makeCurrent(bool bound); - bool CheckExtension(const String &extension) const; + bool checkExtension(const String &extension) const; #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) CC_INLINE intptr_t eagl_context() const { return _eaglContext; } CC_INLINE intptr_t eagl_shared_ctx() const { return _eaglSharedContext; } - CC_INLINE uint getDefaultFramebuffer() const { return _defaultFBO; } + CC_INLINE uint getDefaultFramebuffer() const { return _defaultFBO; } #else - CC_INLINE NativeDisplayType native_display() const { return _nativeDisplay; } - CC_INLINE EGLDisplay egl_display() const { return _eglDisplay; } - CC_INLINE EGLConfig egl_config() const { return _eglConfig; } - CC_INLINE EGLSurface egl_surface() const { return _eglSurface; } - CC_INLINE EGLContext egl_context() const { return _eglContext; } - CC_INLINE EGLContext egl_shared_ctx() const { return _eglSharedContext; } + CC_INLINE NativeDisplayType nativeDisplay() const { return _nativeDisplay; } + CC_INLINE EGLDisplay eglDisplay() const { return _eglDisplay; } + CC_INLINE EGLConfig eglConfig() const { return _eglConfig; } + CC_INLINE EGLSurface eglSurface() const { return _eglSurface; } + CC_INLINE EGLContext eglContext() const { return _eglContext; } + CC_INLINE EGLContext eglSharedCtx() const { return _eglSharedContext; } #endif - CC_INLINE bool MakeCurrent() { return MakeCurrent(true); } - CC_INLINE int major_ver() const { return _majorVersion; } - CC_INLINE int minor_ver() const { return _minorVersion; } + CC_INLINE bool makeCurrent() { return makeCurrent(true); } + CC_INLINE int majorVer() const { return _majorVersion; } + CC_INLINE int minorVer() const { return _minorVersion; } + CC_INLINE uint8_t multiSampleCount() const { return _sampleCount; } -private: - bool MakeCurrentImpl(bool bound); + bool makeCurrentImpl(bool bound); #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) bool createCustomFrameBuffer(); - void destroyCustomFrameBuffer(); + void doDestroyCustomFrameBuffer(); #endif -private: - bool _isPrimaryContex = false; + void releaseSurface(uintptr_t windowHandle); + void acquireSurface(uintptr_t windowHandle); + +protected: + bool doInit(const ContextInfo &info) override; + void doDestroy() override; + + bool _isPrimaryContex = false; + bool _isInitialized = false; + uint8_t _sampleBuffers = 0; + uint8_t _sampleCount = 0; #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) - intptr_t _eaglContext = 0; + intptr_t _eaglContext = 0; intptr_t _eaglSharedContext = 0; // iOS needs to created frame buffer and attach color/depth/stencil buffer. - uint _defaultFBO = 0; - uint _defaultColorBuffer = 0; + uint _defaultFBO = 0; + uint _defaultColorBuffer = 0; uint _defaultDepthStencilBuffer = 0; #else - NativeDisplayType _nativeDisplay = 0; - EGLDisplay _eglDisplay = EGL_NO_DISPLAY; - EGLConfig _eglConfig = EGL_NO_CONFIG_KHR; - EGLSurface _eglSurface = EGL_NO_SURFACE; - EGLContext _eglContext = EGL_NO_CONTEXT; - EGLContext _eglSharedContext = EGL_NO_CONTEXT; + NativeDisplayType _nativeDisplay = 0; // NOLINT(modernize-use-nullptr) portability issues + EGLDisplay _eglDisplay = EGL_NO_DISPLAY; + EGLConfig _eglConfig = EGL_NO_CONFIG_KHR; + EGLSurface _eglSurface = EGL_NO_SURFACE; + EGLContext _eglContext = EGL_NO_CONTEXT; + EGLContext _eglSharedContext = EGL_NO_CONTEXT; + std::vector _vecEGLConfig; #endif - int _majorVersion = 0; - int _minorVersion = 0; + int _majorVersion = 0; + int _minorVersion = 0; StringArray _extensions; - bool _isInitialized = false; }; } // namespace gfx } // namespace cc - -#endif // CC_GFXGLES2_EGL_CONTEXT_H_ diff --git a/native/cocos/renderer/gfx-gles2/GLES2Context.mm b/native/cocos/renderer/gfx-gles2/GLES2Context.mm index 040e240603..8c52b47486 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Context.mm +++ b/native/cocos/renderer/gfx-gles2/GLES2Context.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Context.h" #include "gles2w.h" @@ -36,7 +38,7 @@ namespace gfx { #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) -bool GLES2Context::initialize(const ContextInfo &info) { +void GLES2Context::doInit(const ContextInfo &info) { _vsyncMode = info.vsyncMode; _windowHandle = info.windowHandle; @@ -67,7 +69,7 @@ bool GLES2Context::initialize(const ContextInfo &info) { _defaultFBO = sharedCtx->_defaultFBO; _defaultColorBuffer = sharedCtx->_defaultColorBuffer; _defaultDepthStencilBuffer = sharedCtx->_defaultDepthStencilBuffer; - + EAGLContext* eagl_shared_context = (EAGLContext*)sharedCtx->eagl_shared_ctx(); EAGLContext* eagl_context = [[EAGLContext alloc] initWithAPI: [eagl_shared_context API] sharegroup: [eagl_shared_context sharegroup]]; if (!eagl_context) { @@ -189,7 +191,7 @@ void GLES2Context::destroyCustomFrameBuffer() } } -void GLES2Context::destroy() { +void GLES2Context::doDestroy() { destroyCustomFrameBuffer(); if (_eaglContext) { diff --git a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.cpp b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.cpp index 3248d038e9..dd4de4fd00 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Buffer.h" @@ -33,18 +35,14 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES2DescriptorSet::GLES2DescriptorSet(Device *device) -: DescriptorSet(device) { -} +GLES2DescriptorSet::GLES2DescriptorSet() = default; GLES2DescriptorSet::~GLES2DescriptorSet() { + destroy(); } -bool GLES2DescriptorSet::initialize(const DescriptorSetInfo &info) { - - _layout = info.layout; - - const GLES2GPUDescriptorSetLayout *gpuDescriptorSetLayout = ((GLES2DescriptorSetLayout *)_layout)->gpuDescriptorSetLayout(); +void GLES2DescriptorSet::doInit(const DescriptorSetInfo & /*info*/) { + const GLES2GPUDescriptorSetLayout *gpuDescriptorSetLayout = static_cast(_layout)->gpuDescriptorSetLayout(); const size_t descriptorCount = gpuDescriptorSetLayout->descriptorCount; const size_t bindingCount = gpuDescriptorSetLayout->bindings.size(); @@ -54,7 +52,7 @@ bool GLES2DescriptorSet::initialize(const DescriptorSetInfo &info) { _gpuDescriptorSet = CC_NEW(GLES2GPUDescriptorSet); _gpuDescriptorSet->gpuDescriptors.resize(descriptorCount); - for (size_t i = 0u, k = 0u; i < bindingCount; i++) { + for (size_t i = 0U, k = 0U; i < bindingCount; i++) { const DescriptorSetLayoutBinding &binding = gpuDescriptorSetLayout->bindings[i]; for (uint j = 0; j < binding.count; j++, k++) { _gpuDescriptorSet->gpuDescriptors[k].type = binding.descriptorType; @@ -62,27 +60,21 @@ bool GLES2DescriptorSet::initialize(const DescriptorSetInfo &info) { } _gpuDescriptorSet->descriptorIndices = &gpuDescriptorSetLayout->descriptorIndices; - - return true; } -void GLES2DescriptorSet::destroy() { +void GLES2DescriptorSet::doDestroy() { if (_gpuDescriptorSet) { CC_DELETE(_gpuDescriptorSet); _gpuDescriptorSet = nullptr; } - // do remember to clear these or else it might not be properly updated when reused - _buffers.clear(); - _textures.clear(); - _samplers.clear(); } void GLES2DescriptorSet::update() { if (_isDirty && _gpuDescriptorSet) { const GLES2GPUDescriptorList &descriptors = _gpuDescriptorSet->gpuDescriptors; for (size_t i = 0; i < descriptors.size(); i++) { - if ((uint)descriptors[i].type & DESCRIPTOR_BUFFER_TYPE) { - GLES2Buffer *buffer = (GLES2Buffer *)_buffers[i]; + if (hasAnyFlags(descriptors[i].type, DESCRIPTOR_BUFFER_TYPE)) { + auto *buffer = static_cast(_buffers[i]); if (buffer) { if (buffer->gpuBuffer()) { _gpuDescriptorSet->gpuDescriptors[i].gpuBuffer = buffer->gpuBuffer(); @@ -90,12 +82,12 @@ void GLES2DescriptorSet::update() { _gpuDescriptorSet->gpuDescriptors[i].gpuBufferView = buffer->gpuBufferView(); } } - } else if ((uint)descriptors[i].type & DESCRIPTOR_SAMPLER_TYPE) { + } else if (hasAnyFlags(descriptors[i].type, DESCRIPTOR_TEXTURE_TYPE)) { if (_textures[i]) { - _gpuDescriptorSet->gpuDescriptors[i].gpuTexture = ((GLES2Texture *)_textures[i])->gpuTexture(); + _gpuDescriptorSet->gpuDescriptors[i].gpuTexture = static_cast(_textures[i])->gpuTexture(); } if (_samplers[i]) { - _gpuDescriptorSet->gpuDescriptors[i].gpuSampler = ((GLES2Sampler *)_samplers[i])->gpuSampler(); + _gpuDescriptorSet->gpuDescriptors[i].gpuSampler = static_cast(_samplers[i])->gpuSampler(); } } } diff --git a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h index ca86d4edef..42afbd8b90 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h +++ b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSet.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_DESCRIPTOR_SET_H_ #define CC_GFXGLES2_DESCRIPTOR_SET_H_ +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { @@ -31,17 +35,17 @@ class GLES2GPUDescriptorSet; class CC_GLES2_API GLES2DescriptorSet final : public DescriptorSet { public: - GLES2DescriptorSet(Device *device); + GLES2DescriptorSet(); ~GLES2DescriptorSet(); -public: - virtual bool initialize(const DescriptorSetInfo &info) override; - virtual void destroy() override; - virtual void update() override; + void update() override; CC_INLINE GLES2GPUDescriptorSet *gpuDescriptorSet() const { return _gpuDescriptorSet; } -private: +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; + GLES2GPUDescriptorSet *_gpuDescriptorSet = nullptr; }; diff --git a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.cpp b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.cpp index a395593e9f..5c1157a1ed 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Commands.h" @@ -29,56 +31,29 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES2DescriptorSetLayout::GLES2DescriptorSetLayout(Device *device) -: DescriptorSetLayout(device) { -} +GLES2DescriptorSetLayout::GLES2DescriptorSetLayout() = default; GLES2DescriptorSetLayout::~GLES2DescriptorSetLayout() { + destroy(); } -bool GLES2DescriptorSetLayout::initialize(const DescriptorSetLayoutInfo &info) { - - _bindings = info.bindings; - size_t bindingCount = _bindings.size(); - _descriptorCount = 0u; - - if (bindingCount) { - uint maxBinding = 0u; - vector flattenedIndices(bindingCount); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - flattenedIndices[i] = _descriptorCount; - _descriptorCount += binding.count; - if (binding.binding > maxBinding) maxBinding = binding.binding; - } - - _bindingIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - _descriptorIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - _bindingIndices[binding.binding] = i; - _descriptorIndices[binding.binding] = flattenedIndices[i]; - } - } - +void GLES2DescriptorSetLayout::doInit(const DescriptorSetLayoutInfo& /*info*/) { _gpuDescriptorSetLayout = CC_NEW(GLES2GPUDescriptorSetLayout); _gpuDescriptorSetLayout->descriptorCount = _descriptorCount; _gpuDescriptorSetLayout->bindingIndices = _bindingIndices; _gpuDescriptorSetLayout->descriptorIndices = _descriptorIndices; _gpuDescriptorSetLayout->bindings = _bindings; - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - if ((uint)binding.descriptorType & DESCRIPTOR_DYNAMIC_TYPE) { - for (uint j = 0u; j < binding.count; j++) { + for (auto& binding : _bindings) { + if (hasAnyFlags(binding.descriptorType, DESCRIPTOR_DYNAMIC_TYPE)) { + for (uint j = 0U; j < binding.count; j++) { _gpuDescriptorSetLayout->dynamicBindings.push_back(binding.binding); } } } - return true; } -void GLES2DescriptorSetLayout::destroy() { +void GLES2DescriptorSetLayout::doDestroy() { if (_gpuDescriptorSetLayout) { CC_DELETE(_gpuDescriptorSetLayout); _gpuDescriptorSetLayout = nullptr; diff --git a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h index 4308e5a8c1..811cf34307 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_DESCRIPTOR_SET_LAYOUT_H_ #define CC_GFXGLES2_DESCRIPTOR_SET_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { @@ -31,16 +35,15 @@ class GLES2GPUDescriptorSetLayout; class CC_GLES2_API GLES2DescriptorSetLayout final : public DescriptorSetLayout { public: - GLES2DescriptorSetLayout(Device *device); + GLES2DescriptorSetLayout(); ~GLES2DescriptorSetLayout(); -public: - virtual bool initialize(const DescriptorSetLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPUDescriptorSetLayout *gpuDescriptorSetLayout() const { return _gpuDescriptorSetLayout; } -private: +protected: + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; + GLES2GPUDescriptorSetLayout *_gpuDescriptorSetLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-gles2/GLES2Device.cpp b/native/cocos/renderer/gfx-gles2/GLES2Device.cpp index 1482e215cb..53518064d6 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Device.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Device.cpp @@ -1,40 +1,41 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Buffer.h" #include "GLES2CommandBuffer.h" -#include "GLES2PrimaryCommandBuffer.h" #include "GLES2Context.h" #include "GLES2DescriptorSet.h" #include "GLES2DescriptorSetLayout.h" #include "GLES2Device.h" -#include "GLES2Fence.h" #include "GLES2Framebuffer.h" #include "GLES2InputAssembler.h" #include "GLES2PipelineLayout.h" #include "GLES2PipelineState.h" +#include "GLES2PrimaryCommandBuffer.h" #include "GLES2Queue.h" #include "GLES2RenderPass.h" #include "GLES2Sampler.h" @@ -44,117 +45,134 @@ THE SOFTWARE. namespace cc { namespace gfx { +GLES2Device *GLES2Device::instance = nullptr; + +GLES2Device *GLES2Device::getInstance() { + return GLES2Device::instance; +} + GLES2Device::GLES2Device() { + _api = API::GLES2; + _deviceName = "GLES2"; + + GLES2Device::instance = this; } GLES2Device::~GLES2Device() { + GLES2Device::instance = nullptr; } -bool GLES2Device::initialize(const DeviceInfo &info) { - _API = API::GLES2; - _deviceName = "GLES2"; - _width = info.width; - _height = info.height; - _nativeWidth = info.nativeWidth; - _nativeHeight = info.nativeHeight; - _windowHandle = info.windowHandle; - - _bindingMappingInfo = info.bindingMappingInfo; - if (!_bindingMappingInfo.bufferOffsets.size()) { - _bindingMappingInfo.bufferOffsets.push_back(0); - } - if (!_bindingMappingInfo.samplerOffsets.size()) { - _bindingMappingInfo.samplerOffsets.push_back(0); - } - - _gpuStateCache = CC_NEW(GLES2GPUStateCache); - _gpuStagingBufferPool = CC_NEW(GLES2GPUStagingBufferPool); - +bool GLES2Device::doInit(const DeviceInfo & info) { ContextInfo ctxInfo; ctxInfo.windowHandle = _windowHandle; - ctxInfo.sharedCtx = info.sharedCtx; + ctxInfo.msaaEnabled = info.isAntiAlias; + ctxInfo.performance = Performance::HIGH_QUALITY; - _renderContext = CC_NEW(GLES2Context(this)); + _renderContext = CC_NEW(GLES2Context); if (!_renderContext->initialize(ctxInfo)) { destroy(); return false; } + + QueueInfo queueInfo; + queueInfo.type = QueueType::GRAPHICS; + _queue = createQueue(queueInfo); + + CommandBufferInfo cmdBuffInfo; + cmdBuffInfo.type = CommandBufferType::PRIMARY; + cmdBuffInfo.queue = _queue; + _cmdBuff = createCommandBuffer(cmdBuffInfo); + + _gpuStateCache = CC_NEW(GLES2GPUStateCache); + _gpuStagingBufferPool = CC_NEW(GLES2GPUStagingBufferPool); + bindRenderContext(true); - String extStr = (const char *)glGetString(GL_EXTENSIONS); - _extensions = StringUtil::Split(extStr, " "); + String extStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); + _extensions = StringUtil::split(extStr, " "); if (checkExtension("GL_OES_texture_float")) { - _features[(int)Feature::TEXTURE_FLOAT] = true; + _features[static_cast(Feature::TEXTURE_FLOAT)] = true; } if (checkExtension("GL_OES_texture_half_float")) { - _features[(int)Feature::TEXTURE_HALF_FLOAT] = true; + _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; } - _features[(int)Feature::FORMAT_R11G11B10F] = true; - _features[(int)Feature::FORMAT_D24S8] = true; - _features[(int)Feature::MSAA] = true; + _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; + _features[static_cast(Feature::FORMAT_D24S8)] = true; + _features[static_cast(Feature::MSAA)] = _renderContext->multiSampleCount() > 0; - if (checkExtension("color_buffer_float")) - _features[(int)Feature::COLOR_FLOAT] = true; + if (checkExtension("GL_OES_element_index_uint")) { + _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; + } - if (checkExtension("color_buffer_half_float")) - _features[(int)Feature::COLOR_HALF_FLOAT] = true; + if (checkExtension("color_buffer_float")) { + _features[static_cast(Feature::COLOR_FLOAT)] = true; + } - if (checkExtension("texture_float_linear")) - _features[(int)Feature::TEXTURE_FLOAT_LINEAR] = true; + if (checkExtension("color_buffer_half_float")) { + _features[static_cast(Feature::COLOR_HALF_FLOAT)] = true; + } - if (checkExtension("texture_half_float_linear")) - _features[(int)Feature::TEXTURE_HALF_FLOAT_LINEAR] = true; + if (checkExtension("texture_float_linear")) { + _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = true; + } - if (checkExtension("draw_buffers")) - _features[(int)Feature::MULTIPLE_RENDER_TARGETS] = true; + if (checkExtension("texture_half_float_linear")) { + _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; + } - if (checkExtension("blend_minmax")) - _features[(int)Feature::BLEND_MINMAX] = true; + if (checkExtension("draw_buffers")) { + _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; + glGetIntegerv(GL_MAX_DRAW_BUFFERS_EXT, reinterpret_cast(&_caps.maxColorRenderTargets)); + } - _useVAO = checkExtension("vertex_array_object"); - _useDrawInstanced = checkExtension("draw_instanced"); - _useInstancedArrays = _features[(int)Feature::INSTANCED_ARRAYS] = checkExtension("instanced_arrays"); - _useDiscardFramebuffer = checkExtension("discard_framebuffer"); + if (checkExtension("blend_minmax")) { + _features[static_cast(Feature::BLEND_MINMAX)] = true; + } + + _useVAO = checkExtension("vertex_array_object"); + _useDrawInstanced = checkExtension("draw_instanced"); + _useInstancedArrays = _features[static_cast(Feature::INSTANCED_ARRAYS)] = checkExtension("instanced_arrays"); + _useDiscardFramebuffer = checkExtension("discard_framebuffer"); String compressedFmts; if (checkExtension("compressed_ETC1")) { - _features[(int)Feature::FORMAT_ETC1] = true; + _features[static_cast(Feature::FORMAT_ETC1)] = true; compressedFmts += "etc1 "; } if (checkForETC2()) { - _features[(int)Feature::FORMAT_ETC2] = true; + _features[static_cast(Feature::FORMAT_ETC2)] = true; compressedFmts += "etc2 "; } if (checkExtension("texture_compression_pvrtc")) { - _features[(int)Feature::FORMAT_PVRTC] = true; + _features[static_cast(Feature::FORMAT_PVRTC)] = true; compressedFmts += "pvrtc "; } if (checkExtension("texture_compression_astc")) { - _features[(int)Feature::FORMAT_ASTC] = true; + _features[static_cast(Feature::FORMAT_ASTC)] = true; compressedFmts += "astc "; } - _features[static_cast(Feature::DEPTH_BOUNDS)] = true; - _features[static_cast(Feature::LINE_WIDTH)] = true; + _features[static_cast(Feature::DEPTH_BOUNDS)] = true; + _features[static_cast(Feature::LINE_WIDTH)] = true; _features[static_cast(Feature::STENCIL_COMPARE_MASK)] = true; - _features[static_cast(Feature::STENCIL_WRITE_MASK)] = true; - _features[static_cast(Feature::FORMAT_RGB8)] = true; + _features[static_cast(Feature::STENCIL_WRITE_MASK)] = true; + _features[static_cast(Feature::FORMAT_RGB8)] = true; if (checkExtension("depth_texture")) { - _features[static_cast(Feature::FORMAT_D16)] = true; - _features[static_cast(Feature::FORMAT_D24)] = true; + _features[static_cast(Feature::FORMAT_D16)] = true; + _features[static_cast(Feature::FORMAT_D24)] = true; _features[static_cast(Feature::FORMAT_D24S8)] = checkExtension("packed_depth_stencil"); } - _renderer = (const char *)glGetString(GL_RENDERER); - _vendor = (const char *)glGetString(GL_VENDOR); - _version = (const char *)glGetString(GL_VERSION); + _renderer = reinterpret_cast(glGetString(GL_RENDERER)); + _vendor = reinterpret_cast(glGetString(GL_VENDOR)); + _version = reinterpret_cast(glGetString(GL_VERSION)); CC_LOG_INFO("GLES2 device initialized."); CC_LOG_INFO("RENDERER: %s", _renderer.c_str()); @@ -165,42 +183,41 @@ bool GLES2Device::initialize(const DeviceInfo &info) { CC_LOG_INFO("USE_VAO: %s", _useVAO ? "true" : "false"); CC_LOG_INFO("COMPRESSED_FORMATS: %s", compressedFmts.c_str()); - QueueInfo queueInfo; - queueInfo.type = QueueType::GRAPHICS; - _queue = createQueue(queueInfo); + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, reinterpret_cast(&_caps.maxVertexAttributes)); + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, reinterpret_cast(&_caps.maxVertexUniformVectors)); + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, reinterpret_cast(&_caps.maxFragmentUniformVectors)); + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, reinterpret_cast(&_caps.maxTextureUnits)); + glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, reinterpret_cast(&_caps.maxVertexTextureUnits)); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, reinterpret_cast(&_caps.maxTextureSize)); + glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, reinterpret_cast(&_caps.maxCubeMapTextureSize)); + glGetIntegerv(GL_DEPTH_BITS, reinterpret_cast(&_caps.depthBits)); + glGetIntegerv(GL_STENCIL_BITS, reinterpret_cast(&_caps.stencilBits)); - CommandBufferInfo cmdBuffInfo; - cmdBuffInfo.type = CommandBufferType::PRIMARY; - cmdBuffInfo.queue = _queue; - _cmdBuff = createCommandBuffer(cmdBuffInfo); - - glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)&_maxVertexAttributes); - glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint *)&_maxVertexUniformVectors); - glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint *)&_maxFragmentUniformVectors); - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)&_maxTextureUnits); - glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, (GLint *)&_maxVertexTextureUnits); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&_maxTextureSize); - glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, (GLint *)&_maxCubeMapTextureSize); - glGetIntegerv(GL_DEPTH_BITS, (GLint *)&_depthBits); - glGetIntegerv(GL_STENCIL_BITS, (GLint *)&_stencilBits); - _uboOffsetAlignment = 1u; - - _gpuStateCache->initialize(_maxTextureUnits, _maxVertexAttributes); + _gpuStateCache->initialize(_caps.maxTextureUnits, _caps.maxVertexAttributes); return true; } -void GLES2Device::destroy() { - CC_SAFE_DESTROY(_queue); - CC_SAFE_DESTROY(_cmdBuff); - CC_SAFE_DELETE(_gpuStagingBufferPool); - CC_SAFE_DELETE(_gpuStateCache); - CC_SAFE_DESTROY(_deviceContext); - CC_SAFE_DESTROY(_renderContext); +void GLES2Device::doDestroy() { + CC_SAFE_DELETE(_gpuStagingBufferPool) + CC_SAFE_DELETE(_gpuStateCache) + + CC_SAFE_DESTROY(_cmdBuff) + CC_SAFE_DESTROY(_queue) + CC_SAFE_DESTROY(_deviceContext) + CC_SAFE_DESTROY(_renderContext) +} + +void GLES2Device::releaseSurface(uintptr_t windowHandle) { + static_cast(_context)->releaseSurface(windowHandle); +} + +void GLES2Device::acquireSurface(uintptr_t windowHandle) { + static_cast(_context)->acquireSurface(windowHandle); } void GLES2Device::resize(uint width, uint height) { - _width = width; + _width = width; _height = height; } @@ -209,7 +226,7 @@ void GLES2Device::acquire() { } void GLES2Device::present() { - GLES2Queue *queue = (GLES2Queue *)_queue; + auto *queue = static_cast(_queue); _numDrawCalls = queue->_numDrawCalls; _numInstances = queue->_numInstances; _numTriangles = queue->_numTriangles; @@ -223,11 +240,12 @@ void GLES2Device::present() { } void GLES2Device::bindRenderContext(bool bound) { - _renderContext->MakeCurrent(bound); + _renderContext->makeCurrent(bound); _context = bound ? _renderContext : nullptr; if (bound) { _threadID = std::hash()(std::this_thread::get_id()); + _gpuStateCache->reset(); } } @@ -235,92 +253,98 @@ void GLES2Device::bindDeviceContext(bool bound) { if (!_deviceContext) { ContextInfo ctxInfo; ctxInfo.windowHandle = _windowHandle; - ctxInfo.sharedCtx = _renderContext; + ctxInfo.sharedCtx = _renderContext; - _deviceContext = CC_NEW(GLES2Context(this)); + _deviceContext = CC_NEW(GLES2Context); _deviceContext->initialize(ctxInfo); } - _deviceContext->MakeCurrent(bound); + _deviceContext->makeCurrent(bound); _context = bound ? _deviceContext : nullptr; if (bound) { _threadID = std::hash()(std::this_thread::get_id()); + _gpuStateCache->reset(); } } -CommandBuffer *GLES2Device::doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) { - if (hasAgent || info.type == CommandBufferType::PRIMARY) return CC_NEW(GLES2PrimaryCommandBuffer(this)); - return CC_NEW(GLES2CommandBuffer(this)); -} - -Fence *GLES2Device::createFence() { - return CC_NEW(GLES2Fence(this)); +CommandBuffer *GLES2Device::createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) { + if (hasAgent || info.type == CommandBufferType::PRIMARY) return CC_NEW(GLES2PrimaryCommandBuffer); + return CC_NEW(GLES2CommandBuffer); } Queue *GLES2Device::createQueue() { - return CC_NEW(GLES2Queue(this)); + return CC_NEW(GLES2Queue); } Buffer *GLES2Device::createBuffer() { - return CC_NEW(GLES2Buffer(this)); + return CC_NEW(GLES2Buffer); } Texture *GLES2Device::createTexture() { - return CC_NEW(GLES2Texture(this)); + return CC_NEW(GLES2Texture); } Sampler *GLES2Device::createSampler() { - return CC_NEW(GLES2Sampler(this)); + return CC_NEW(GLES2Sampler); } Shader *GLES2Device::createShader() { - return CC_NEW(GLES2Shader(this)); + return CC_NEW(GLES2Shader); } InputAssembler *GLES2Device::createInputAssembler() { - return CC_NEW(GLES2InputAssembler(this)); + return CC_NEW(GLES2InputAssembler); } RenderPass *GLES2Device::createRenderPass() { - return CC_NEW(GLES2RenderPass(this)); + return CC_NEW(GLES2RenderPass); } Framebuffer *GLES2Device::createFramebuffer() { - return CC_NEW(GLES2Framebuffer(this)); + return CC_NEW(GLES2Framebuffer); } DescriptorSet *GLES2Device::createDescriptorSet() { - return CC_NEW(GLES2DescriptorSet(this)); + return CC_NEW(GLES2DescriptorSet); } DescriptorSetLayout *GLES2Device::createDescriptorSetLayout() { - return CC_NEW(GLES2DescriptorSetLayout(this)); + return CC_NEW(GLES2DescriptorSetLayout); } PipelineLayout *GLES2Device::createPipelineLayout() { - return CC_NEW(GLES2PipelineLayout(this)); + return CC_NEW(GLES2PipelineLayout); } PipelineState *GLES2Device::createPipelineState() { - return CC_NEW(GLES2PipelineState(this)); + return CC_NEW(GLES2PipelineState); +} + +GlobalBarrier *GLES2Device::createGlobalBarrier() { + return CC_NEW(GlobalBarrier); +} + +TextureBarrier *GLES2Device::createTextureBarrier() { + return CC_NEW(TextureBarrier); } void GLES2Device::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { - GLES2CmdFuncCopyBuffersToTexture(this, buffers, ((GLES2Texture *)dst)->gpuTexture(), regions, count); + cmdFuncGLES2CopyBuffersToTexture(this, buffers, static_cast(dst)->gpuTexture(), regions, count); } -bool GLES2Device::checkForETC2() const { +bool GLES2Device::checkForETC2() { GLint numFormats = 0; glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats); - GLint* formats = new GLint[numFormats]; + auto *formats = new GLint[numFormats]; glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); int supportNum = 0; for (GLint i = 0; i < numFormats; ++i) { - if (formats[i] == GL_COMPRESSED_RGB8_ETC2 || formats[i] == GL_COMPRESSED_RGBA8_ETC2_EAC) + if (formats[i] == GL_COMPRESSED_RGB8_ETC2 || formats[i] == GL_COMPRESSED_RGBA8_ETC2_EAC) { supportNum++; + } } - delete [] formats; + delete[] formats; return supportNum >= 2; } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Device.h b/native/cocos/renderer/gfx-gles2/GLES2Device.h index 958e73e189..2e600e1be8 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Device.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Device.h @@ -1,35 +1,40 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_DEVICE_H_ -#define CC_GFXGLES2_DEVICE_H_ + +#pragma once + +#include "GLES2Std.h" + +#include "gfx-base/GFXDevice.h" #ifndef GL_COMPRESSED_RGB8_ETC2 -#define GL_COMPRESSED_RGB8_ETC2 0x9274 + #define GL_COMPRESSED_RGB8_ETC2 0x9274 #endif #ifndef GL_COMPRESSED_RGBA8_ETC2_EAC -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 + #define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 #endif namespace cc { @@ -41,90 +46,96 @@ class GLES2GPUStagingBufferPool; class CC_GLES2_API GLES2Device final : public Device { public: - GLES2Device(); - ~GLES2Device(); + static GLES2Device *getInstance(); - using Device::createCommandBuffer; - using Device::createFence; - using Device::createQueue; + ~GLES2Device() override; + + using Device::copyBuffersToTexture; using Device::createBuffer; - using Device::createTexture; - using Device::createSampler; - using Device::createShader; - using Device::createInputAssembler; - using Device::createRenderPass; - using Device::createFramebuffer; + using Device::createCommandBuffer; using Device::createDescriptorSet; using Device::createDescriptorSetLayout; + using Device::createFramebuffer; + using Device::createGlobalBarrier; + using Device::createInputAssembler; using Device::createPipelineLayout; using Device::createPipelineState; - using Device::copyBuffersToTexture; + using Device::createQueue; + using Device::createRenderPass; + using Device::createSampler; + using Device::createShader; + using Device::createTexture; + using Device::createTextureBarrier; - virtual bool initialize(const DeviceInfo &info) override; - virtual void destroy() override; - virtual void resize(uint width, uint height) override; - virtual void acquire() override; - virtual void present() override; + void resize(uint width, uint height) override; + void acquire() override; + void present() override; - CC_INLINE bool useVAO() const { return _useVAO; } - CC_INLINE bool useDrawInstanced() const { return _useDrawInstanced; } - CC_INLINE bool useInstancedArrays() const { return _useInstancedArrays; } - CC_INLINE bool useDiscardFramebuffer() const { return _useDiscardFramebuffer; } + inline bool useVAO() const { return _useVAO; } + inline bool useDrawInstanced() const { return _useDrawInstanced; } + inline bool useInstancedArrays() const { return _useInstancedArrays; } + inline bool useDiscardFramebuffer() const { return _useDiscardFramebuffer; } - CC_INLINE GLES2GPUStateCache *stateCache() const { return _gpuStateCache; } - CC_INLINE GLES2GPUStagingBufferPool *stagingBufferPool() const { return _gpuStagingBufferPool; } + inline GLES2GPUStateCache * stateCache() const { return _gpuStateCache; } + inline GLES2GPUStagingBufferPool *stagingBufferPool() const { return _gpuStagingBufferPool; } - CC_INLINE bool checkExtension(const String &extension) const { - for (size_t i = 0; i < _extensions.size(); ++i) { - if (_extensions[i].find(extension) != String::npos) { - return true; - } - } - return false; + inline bool checkExtension(const String &extension) const { + return std::any_of(_extensions.begin(), _extensions.end(), [&extension](auto &ext) { + return ext.find(extension) != String::npos; + }); } - CC_INLINE uint getThreadID() const { return _threadID; } + inline uint getThreadID() const { return _threadID; } protected: - virtual CommandBuffer *doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; - virtual Fence *createFence() override; - virtual Queue *createQueue() override; - virtual Buffer *createBuffer() override; - virtual Texture *createTexture() override; - virtual Sampler *createSampler() override; - virtual Shader *createShader() override; - virtual InputAssembler *createInputAssembler() override; - virtual RenderPass *createRenderPass() override; - virtual Framebuffer *createFramebuffer() override; - virtual DescriptorSet *createDescriptorSet() override; - virtual DescriptorSetLayout *createDescriptorSetLayout() override; - virtual PipelineLayout *createPipelineLayout() override; - virtual PipelineState *createPipelineState() override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; + static GLES2Device *instance; - virtual void bindRenderContext(bool bound) override; - virtual void bindDeviceContext(bool bound) override; + friend class DeviceManager; + friend class GLES2Context; -private: + GLES2Device(); - bool checkForETC2() const; + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; + CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; + Queue * createQueue() override; + Buffer * createBuffer() override; + Texture * createTexture() override; + Sampler * createSampler() override; + Shader * createShader() override; + InputAssembler * createInputAssembler() override; + RenderPass * createRenderPass() override; + Framebuffer * createFramebuffer() override; + DescriptorSet * createDescriptorSet() override; + DescriptorSetLayout *createDescriptorSetLayout() override; + PipelineLayout * createPipelineLayout() override; + PipelineState * createPipelineState() override; + GlobalBarrier * createGlobalBarrier() override; + TextureBarrier * createTextureBarrier() override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; - GLES2Context *_renderContext = nullptr; - GLES2Context *_deviceContext = nullptr; - GLES2GPUStateCache *_gpuStateCache = nullptr; + void releaseSurface(uintptr_t windowHandle) override; + void acquireSurface(uintptr_t windowHandle) override; + + void bindRenderContext(bool bound) override; + void bindDeviceContext(bool bound) override; + + static bool checkForETC2(); + + GLES2Context * _renderContext = nullptr; + GLES2Context * _deviceContext = nullptr; + GLES2GPUStateCache * _gpuStateCache = nullptr; GLES2GPUStagingBufferPool *_gpuStagingBufferPool = nullptr; StringArray _extensions; - bool _useVAO = false; - bool _useDrawInstanced = false; - bool _useInstancedArrays = false; + bool _useVAO = false; + bool _useDrawInstanced = false; + bool _useInstancedArrays = false; bool _useDiscardFramebuffer = false; - uint _threadID = 0u; + uint _threadID = 0U; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Fence.cpp b/native/cocos/renderer/gfx-gles2/GLES2Fence.cpp deleted file mode 100644 index 016e35974a..0000000000 --- a/native/cocos/renderer/gfx-gles2/GLES2Fence.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "GLES2Std.h" -#include "GLES2Fence.h" -#include "GLES2Device.h" -#include "GLES2GPUObjects.h" - -namespace cc { -namespace gfx { - -GLES2Fence::GLES2Fence(Device *device) -: Fence(device) { -} - -GLES2Fence::~GLES2Fence() { -} - -bool GLES2Fence::initialize(const FenceInfo &info) { - _gpuFence = CC_NEW(GLES2GPUFence); - if (!_gpuFence) { - CC_LOG_ERROR("GLES2Fence: CC_NEW GLES2GPUFence failed."); - return false; - } - - // TODO - return true; -} - -void GLES2Fence::destroy() { - if (_gpuFence) { - // TODO - - CC_DELETE(_gpuFence); - _gpuFence = nullptr; - } -} - -void GLES2Fence::wait() { - // TODO -} - -void GLES2Fence::reset() { - // TODO -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp index b7fd3fdbe7..037eedb457 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp @@ -1,52 +1,50 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" + +#include "GLES2Commands.h" +#include "GLES2Device.h" #include "GLES2Framebuffer.h" #include "GLES2RenderPass.h" -#include "GLES2Commands.h" #include "GLES2Texture.h" namespace cc { namespace gfx { -GLES2Framebuffer::GLES2Framebuffer(Device *device) -: Framebuffer(device) { -} +GLES2Framebuffer::GLES2Framebuffer() = default; GLES2Framebuffer::~GLES2Framebuffer() { + destroy(); } -bool GLES2Framebuffer::initialize(const FramebufferInfo &info) { - - _renderPass = info.renderPass; - _colorTextures = info.colorTextures; - _depthStencilTexture = info.depthStencilTexture; - +void GLES2Framebuffer::doInit(const FramebufferInfo &info) { if (info.depthStencilMipmapLevel != 0) { CC_LOG_WARNING("Mipmap level of depth stencil attachment should be 0 in GLES2. Convert to 0."); } - if (info.colorMipmapLevels.size() > 0) { + if (!info.colorMipmapLevels.empty()) { int i = 0; for (const auto mipmapLevel : info.colorMipmapLevels) { if (mipmapLevel != 0) { @@ -56,29 +54,27 @@ bool GLES2Framebuffer::initialize(const FramebufferInfo &info) { } } - _gpuFBO = CC_NEW(GLES2GPUFramebuffer); - _gpuFBO->gpuRenderPass = ((GLES2RenderPass *)_renderPass)->gpuRenderPass(); + _gpuFBO = CC_NEW(GLES2GPUFramebuffer); + _gpuFBO->gpuRenderPass = static_cast(_renderPass)->gpuRenderPass(); _gpuFBO->gpuColorTextures.resize(_colorTextures.size()); for (size_t i = 0; i < _colorTextures.size(); ++i) { - GLES2Texture *colorTexture = (GLES2Texture *)_colorTextures[i]; + auto *colorTexture = static_cast(_colorTextures[i]); if (colorTexture) { _gpuFBO->gpuColorTextures[i] = colorTexture->gpuTexture(); } } if (_depthStencilTexture) { - _gpuFBO->gpuDepthStencilTexture = ((GLES2Texture *)_depthStencilTexture)->gpuTexture(); + _gpuFBO->gpuDepthStencilTexture = static_cast(_depthStencilTexture)->gpuTexture(); } - GLES2CmdFuncCreateFramebuffer((GLES2Device *)_device, _gpuFBO); - - return true; + cmdFuncGLES2CreateFramebuffer(GLES2Device::getInstance(), _gpuFBO); } -void GLES2Framebuffer::destroy() { +void GLES2Framebuffer::doDestroy() { if (_gpuFBO) { - GLES2CmdFuncDestroyFramebuffer((GLES2Device *)_device, _gpuFBO); + cmdFuncGLES2DestroyFramebuffer(GLES2Device::getInstance(), _gpuFBO); CC_DELETE(_gpuFBO); _gpuFBO = nullptr; } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h index eecdcbab3c..c65ad8887d 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Framebuffer.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_FRAMEBUFFER_H_ -#define CC_GFXGLES2_FRAMEBUFFER_H_ + +#pragma once + +#include "gfx-base/GFXFramebuffer.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES2GPUFramebuffer; class CC_GLES2_API GLES2Framebuffer final : public Framebuffer { public: - GLES2Framebuffer(Device *device); + GLES2Framebuffer(); ~GLES2Framebuffer(); -public: - virtual bool initialize(const FramebufferInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPUFramebuffer *gpuFBO() const { return _gpuFBO; } -private: +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; + GLES2GPUFramebuffer *_gpuFBO = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h index da5c395f8a..8a680d6d5b 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h +++ b/native/cocos/renderer/gfx-gles2/GLES2GPUObjects.h @@ -1,125 +1,128 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_GPU_OBJECTS_H_ -#define CC_GFXGLES2_GPU_OBJECTS_H_ -#include "gles2w.h" +#pragma once + +#include + +#include "GLES2Wrangler.h" +#include "base/Object.h" +#include "gfx-base/GFXDef.h" namespace cc { namespace gfx { class GLES2GPUBuffer final : public Object { public: - BufferUsage usage = BufferUsage::NONE; - MemoryUsage memUsage = MemoryUsage::NONE; - uint size = 0; - uint stride = 0; - uint count = 0; - GLenum glTarget = 0; - GLuint glBuffer = 0; - uint8_t *buffer = nullptr; + BufferUsage usage = BufferUsage::NONE; + MemoryUsage memUsage = MemoryUsage::NONE; + uint size = 0; + uint stride = 0; + uint count = 0; + GLenum glTarget = 0; + GLuint glBuffer = 0; + uint8_t * buffer = nullptr; DrawInfoList indirects; }; -typedef vector GLES2GPUBufferList; +using GLES2GPUBufferList = vector; class GLES2GPUBufferView final : public Object { public: GLES2GPUBuffer *gpuBuffer = nullptr; - uint offset = 0u; - uint range = 0u; + uint offset = 0U; + uint range = 0U; }; class GLES2GPUTexture final : public Object { public: - TextureType type = TextureType::TEX2D; - Format format = Format::UNKNOWN; - TextureUsage usage = TextureUsageBit::NONE; - uint width = 0; - uint height = 0; - uint depth = 1; - uint size = 0; - uint arrayLayer = 1; - uint mipLevel = 1; - SampleCount samples = SampleCount::X1; - TextureFlags flags = TextureFlagBit::NONE; - bool isPowerOf2 = false; - GLenum glTarget = 0; - GLenum glInternelFmt = 0; - GLenum glFormat = 0; - GLenum glType = 0; - GLenum glUsage = 0; - GLuint glTexture = 0; - GLenum glWrapS = 0; - GLenum glWrapT = 0; - GLenum glMinFilter = 0; - GLenum glMagFilter = 0; + TextureType type = TextureType::TEX2D; + Format format = Format::UNKNOWN; + TextureUsage usage = TextureUsageBit::NONE; + uint width = 0; + uint height = 0; + uint depth = 1; + uint size = 0; + uint arrayLayer = 1; + uint mipLevel = 1; + SampleCount samples = SampleCount::X1; + TextureFlags flags = TextureFlagBit::NONE; + bool isPowerOf2 = false; + GLenum glTarget = 0; + GLenum glInternelFmt = 0; + GLenum glFormat = 0; + GLenum glType = 0; + GLenum glUsage = 0; + GLuint glTexture = 0; + GLenum glWrapS = 0; + GLenum glWrapT = 0; + GLenum glMinFilter = 0; + GLenum glMagFilter = 0; }; -typedef vector GLES2GPUTextureList; +using GLES2GPUTextureList = vector; class GLES2GPUSampler final : public Object { public: - Filter minFilter = Filter::NONE; - Filter magFilter = Filter::NONE; - Filter mipFilter = Filter::NONE; - Address addressU = Address::CLAMP; - Address addressV = Address::CLAMP; - Address addressW = Address::CLAMP; - uint minLOD = 0; - uint maxLOD = 1000; - GLenum glMinFilter = 0; - GLenum glMagFilter = 0; - GLenum glWrapS = 0; - GLenum glWrapT = 0; - GLenum glWrapR = 0; + Filter minFilter = Filter::NONE; + Filter magFilter = Filter::NONE; + Filter mipFilter = Filter::NONE; + Address addressU = Address::CLAMP; + Address addressV = Address::CLAMP; + Address addressW = Address::CLAMP; + GLenum glMinFilter = 0; + GLenum glMagFilter = 0; + GLenum glWrapS = 0; + GLenum glWrapT = 0; + GLenum glWrapR = 0; }; struct GLES2GPUInput final { - uint binding = 0; + uint binding = 0; String name; - Type type = Type::UNKNOWN; - uint stride = 0; - uint count = 0; - uint size = 0; + Type type = Type::UNKNOWN; + uint stride = 0; + uint count = 0; + uint size = 0; GLenum glType = 0; - GLint glLoc = -1; + GLint glLoc = -1; }; -typedef vector GLES2GPUInputList; +using GLES2GPUInputList = vector; struct GLES2GPUUniform final { - uint binding = GFX_INVALID_BINDING; - String name; - Type type = Type::UNKNOWN; - uint stride = 0; - uint count = 0; - uint size = 0; - uint offset = 0; - GLenum glType = 0; - GLint glLoc = -1; - uint8_t *buff = nullptr; + uint binding = INVALID_BINDING; + String name; + Type type = Type::UNKNOWN; + uint stride = 0; + uint count = 0; + uint size = 0; + uint offset = 0; + GLenum glType = 0; + GLint glLoc = -1; + uint8_t *buff = nullptr; - GLES2GPUUniform() {} + GLES2GPUUniform() = default; GLES2GPUUniform(const GLES2GPUUniform &rhs) { *this = rhs; } @@ -127,20 +130,21 @@ struct GLES2GPUUniform final { GLES2GPUUniform &operator=(const GLES2GPUUniform &rhs) { if (this != &rhs) { binding = rhs.binding; - name = rhs.name; - type = rhs.type; - stride = rhs.stride; - count = rhs.count; - offset = rhs.offset; - glType = rhs.glType; - glLoc = rhs.glLoc; + name = rhs.name; + type = rhs.type; + stride = rhs.stride; + count = rhs.count; + offset = rhs.offset; + glType = rhs.glType; + glLoc = rhs.glLoc; if (size != rhs.size) { size = rhs.size; CC_SAFE_FREE(buff); - buff = (uint8_t *)CC_MALLOC(size); + buff = static_cast(CC_MALLOC(size)); } - if (buff && rhs.buff) + if (buff && rhs.buff) { memcpy(buff, rhs.buff, size); + } } return *this; } @@ -149,81 +153,81 @@ struct GLES2GPUUniform final { CC_SAFE_FREE(buff); } }; -typedef vector GLES2GPUUniformList; +using GLES2GPUUniformList = vector; struct GLES2GPUUniformBlock final { - uint set = 0; - uint binding = 0; - uint idx = 0; - String name; - uint size = 0; + uint set = 0; + uint binding = 0; + uint idx = 0; + String name; + uint size = 0; GLES2GPUUniformList glUniforms; GLES2GPUUniformList glActiveUniforms; }; -typedef vector GLES2GPUUniformBlockList; +using GLES2GPUUniformBlockList = vector; -struct GLES2GPUUniformSampler final { - uint set = 0; - uint binding = 0; +struct GLES2GPUUniformSamplerTexture final { + uint set = 0; + uint binding = 0; String name; - Type type = Type::UNKNOWN; - uint count = 0u; + Type type = Type::UNKNOWN; + uint count = 0U; vector units; - GLenum glType = 0; - GLint glLoc = -1; + GLenum glType = 0; + GLint glLoc = -1; }; -typedef vector GLES2GPUUniformSamplerList; +using GLES2GPUUniformSamplerTextureList = vector; struct GLES2GPUShaderStage final { GLES2GPUShaderStage(ShaderStageFlagBit t, String s, GLuint shader = 0) - : type(t), source(s), glShader(shader) {} + : type(t), source(std::move(std::move(s))), glShader(shader) {} ShaderStageFlagBit type; - String source; - GLuint glShader = 0; + String source; + GLuint glShader = 0; }; -typedef vector GLES2GPUShaderStageList; +using GLES2GPUShaderStageList = vector; class GLES2GPUShader final : public Object { public: - String name; - UniformBlockList blocks; - UniformSamplerList samplers; - GLuint glProgram = 0; - GLES2GPUShaderStageList gpuStages; - GLES2GPUInputList glInputs; - GLES2GPUUniformBlockList glBlocks; - GLES2GPUUniformSamplerList glSamplers; + String name; + UniformBlockList blocks; + UniformSamplerTextureList samplerTextures; + GLuint glProgram = 0; + GLES2GPUShaderStageList gpuStages; + GLES2GPUInputList glInputs; + GLES2GPUUniformBlockList glBlocks; + GLES2GPUUniformSamplerTextureList glSamplerTextures; }; struct GLES2GPUAttribute final { String name; - GLuint glBuffer = 0; - GLenum glType = 0; - uint size = 0; - uint count = 0; - uint stride = 1; - uint componentCount = 1; - bool isNormalized = false; - bool isInstanced = false; - uint offset = 0; + GLuint glBuffer = 0; + GLenum glType = 0; + uint size = 0; + uint count = 0; + uint stride = 1; + uint componentCount = 1; + bool isNormalized = false; + bool isInstanced = false; + uint offset = 0; }; -typedef vector GLES2GPUAttributeList; +using GLES2GPUAttributeList = vector; class GLES2GPUInputAssembler final : public Object { public: - AttributeList attributes; - GLES2GPUBufferList gpuVertexBuffers; - GLES2GPUBuffer *gpuIndexBuffer = nullptr; - GLES2GPUBuffer *gpuIndirectBuffer = nullptr; + AttributeList attributes; + GLES2GPUBufferList gpuVertexBuffers; + GLES2GPUBuffer * gpuIndexBuffer = nullptr; + GLES2GPUBuffer * gpuIndirectBuffer = nullptr; GLES2GPUAttributeList glAttribs; - GLenum glIndexType = 0; - map glVAOs; + GLenum glIndexType = 0; + map glVAOs; }; class GLES2GPURenderPass final : public Object { public: - ColorAttachmentList colorAttachments; + ColorAttachmentList colorAttachments; DepthStencilAttachment depthStencilAttachment; }; @@ -231,21 +235,21 @@ class GLES2GPUFramebuffer final : public Object { public: GLES2GPURenderPass *gpuRenderPass = nullptr; GLES2GPUTextureList gpuColorTextures; - GLES2GPUTexture *gpuDepthStencilTexture = nullptr; - GLuint glFramebuffer = 0; - bool isOffscreen = false; + GLES2GPUTexture * gpuDepthStencilTexture = nullptr; + GLuint glFramebuffer = 0; + bool isOffscreen = false; }; class GLES2GPUDescriptorSetLayout final : public Object { public: DescriptorSetLayoutBindingList bindings; - vector dynamicBindings; + vector dynamicBindings; vector bindingIndices; vector descriptorIndices; - uint descriptorCount = 0u; + uint descriptorCount = 0U; }; -typedef vector GLES2GPUDescriptorSetLayoutList; +using GLES2GPUDescriptorSetLayoutList = vector; class GLES2GPUPipelineLayout final : public Object { public: @@ -253,37 +257,37 @@ public: // helper storages vector> dynamicOffsetIndices; - vector dynamicOffsetOffsets; - vector dynamicOffsets; - uint dynamicOffsetCount; + vector dynamicOffsetOffsets; + vector dynamicOffsets; + uint dynamicOffsetCount; }; class GLES2GPUPipelineState final : public Object { public: - GLenum glPrimitive = GL_TRIANGLES; - GLES2GPUShader *gpuShader = nullptr; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - DynamicStateList dynamicStates; - GLES2GPUPipelineLayout *gpuLayout = nullptr; - GLES2GPURenderPass *gpuRenderPass = nullptr; + GLenum glPrimitive = GL_TRIANGLES; + GLES2GPUShader * gpuShader = nullptr; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + DynamicStateList dynamicStates; + GLES2GPUPipelineLayout *gpuLayout = nullptr; + GLES2GPURenderPass * gpuRenderPass = nullptr; GLES2GPUPipelineLayout *gpuPipelineLayout = nullptr; }; struct GLES2GPUDescriptor final { - DescriptorType type = DescriptorType::UNKNOWN; - GLES2GPUBuffer *gpuBuffer = nullptr; + DescriptorType type = DescriptorType::UNKNOWN; + GLES2GPUBuffer * gpuBuffer = nullptr; GLES2GPUBufferView *gpuBufferView = nullptr; - GLES2GPUTexture *gpuTexture = nullptr; - GLES2GPUSampler *gpuSampler = nullptr; + GLES2GPUTexture * gpuTexture = nullptr; + GLES2GPUSampler * gpuSampler = nullptr; }; -typedef vector GLES2GPUDescriptorList; +using GLES2GPUDescriptorList = vector; class GLES2GPUDescriptorSet final : public Object { public: GLES2GPUDescriptorList gpuDescriptors; - const vector *descriptorIndices = nullptr; + const vector * descriptorIndices = nullptr; }; class GLES2GPUFence final : public Object { @@ -291,80 +295,78 @@ public: }; struct GLES2ObjectCache final { - size_t numClearColors = 0u; - GLES2GPURenderPass *gpuRenderPass = nullptr; - GLES2GPUFramebuffer *gpuFramebuffer = nullptr; - GLES2GPUPipelineState *gpuPipelineState = nullptr; + size_t numClearColors = 0U; + GLES2GPURenderPass * gpuRenderPass = nullptr; + GLES2GPUFramebuffer * gpuFramebuffer = nullptr; + GLES2GPUPipelineState * gpuPipelineState = nullptr; GLES2GPUInputAssembler *gpuInputAssembler = nullptr; - bool reverseCW = false; - GLenum glPrimitive = 0; - GLenum invalidAttachments[GFX_MAX_ATTACHMENTS]; + GLenum glPrimitive = 0; + GLenum invalidAttachments[MAX_ATTACHMENTS]; }; class GLES2GPUStateCache final : public Object { public: - GLuint glArrayBuffer = 0; - GLuint glElementArrayBuffer = 0; - GLuint glUniformBuffer = 0; - GLuint glVAO = 0; - uint texUint = 0; - vector glTextures; - GLuint glProgram = 0; - vector glEnabledAttribLocs; - vector glCurrentAttribLocs; - GLuint glFramebuffer = 0; - GLuint glReadFBO = 0; - Viewport viewport; - Rect scissor; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - bool isCullFaceEnabled = true; - bool isStencilTestEnabled = false; - map texUnitCacheMap; - GLES2ObjectCache gfxStateCache; + GLuint glArrayBuffer = 0; + GLuint glElementArrayBuffer = 0; + GLuint glUniformBuffer = 0; + GLuint glVAO = 0; + uint texUint = 0; + vector glTextures; + GLuint glProgram = 0; + vector glEnabledAttribLocs; + vector glCurrentAttribLocs; + GLuint glFramebuffer = 0; + GLuint glReadFBO = 0; + Viewport viewport; + Rect scissor; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + bool isCullFaceEnabled = true; + bool isStencilTestEnabled = false; + unordered_map texUnitCacheMap; + GLES2ObjectCache gfxStateCache; void initialize(size_t texUnits, size_t vertexAttributes) { - glTextures.resize(texUnits, 0u); + glTextures.resize(texUnits, 0U); glEnabledAttribLocs.resize(vertexAttributes, false); glCurrentAttribLocs.resize(vertexAttributes, false); } void reset() { - glArrayBuffer = 0; + glArrayBuffer = 0; glElementArrayBuffer = 0; - glUniformBuffer = 0; - glVAO = 0; - texUint = 0; - glTextures.assign(glTextures.size(), 0u); + glUniformBuffer = 0; + glVAO = 0; + texUint = 0; + glTextures.assign(glTextures.size(), 0U); glProgram = 0; - glEnabledAttribLocs.assign(glEnabledAttribLocs.size(), 0u); - glCurrentAttribLocs.assign(glCurrentAttribLocs.size(), 0u); - glFramebuffer = 0; - glReadFBO = 0; - isCullFaceEnabled = true; + glEnabledAttribLocs.assign(glEnabledAttribLocs.size(), false); + glCurrentAttribLocs.assign(glCurrentAttribLocs.size(), false); + glFramebuffer = 0; + glReadFBO = 0; + isCullFaceEnabled = true; isStencilTestEnabled = false; viewport = Viewport(); - scissor = Rect(); - rs = RasterizerState(); - dss = DepthStencilState(); - bs = BlendState(); + scissor = Rect(); + rs = RasterizerState(); + dss = DepthStencilState(); + bs = BlendState(); - gfxStateCache.gpuPipelineState = nullptr; - gfxStateCache.numClearColors = 0u; - gfxStateCache.gpuRenderPass = nullptr; - gfxStateCache.gpuFramebuffer = nullptr; + gfxStateCache.gpuPipelineState = nullptr; + gfxStateCache.numClearColors = 0U; + gfxStateCache.gpuRenderPass = nullptr; + gfxStateCache.gpuFramebuffer = nullptr; gfxStateCache.gpuInputAssembler = nullptr; - gfxStateCache.glPrimitive = 0u; - gfxStateCache.reverseCW = false; + gfxStateCache.glPrimitive = 0U; } }; -constexpr size_t chunkSize = 16 * 1024 * 1024; // 16M per block by default +constexpr size_t CHUNK_SIZE = 16 * 1024 * 1024; // 16M per block by default class GLES2GPUStagingBufferPool final : public Object { public: - ~GLES2GPUStagingBufferPool() { + ~GLES2GPUStagingBufferPool() override { for (Buffer &buffer : _pool) { CC_FREE(buffer.mappedData); } @@ -372,19 +374,19 @@ public: } uint8_t *alloc(size_t size) { - size_t bufferCount = _pool.size(); - Buffer *buffer = nullptr; - for (size_t idx = 0u; idx < bufferCount; idx++) { + size_t bufferCount = _pool.size(); + Buffer *buffer = nullptr; + for (size_t idx = 0U; idx < bufferCount; idx++) { Buffer *cur = &_pool[idx]; - if (chunkSize - cur->curOffset >= size) { + if (CHUNK_SIZE - cur->curOffset >= size) { buffer = cur; break; } } if (!buffer) { _pool.resize(bufferCount + 1); - buffer = &_pool.back(); - buffer->mappedData = (uint8_t *)CC_MALLOC(chunkSize); + buffer = &_pool.back(); + buffer->mappedData = static_cast(CC_MALLOC(CHUNK_SIZE)); } uint8_t *data = buffer->mappedData + buffer->curOffset; buffer->curOffset += size; @@ -393,19 +395,17 @@ public: void reset() { for (Buffer &buffer : _pool) { - buffer.curOffset = 0u; + buffer.curOffset = 0U; } } private: struct Buffer { uint8_t *mappedData = nullptr; - size_t curOffset = 0u; + size_t curOffset = 0U; }; vector _pool; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp index 7c22e96e61..7aeca7b555 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.cpp @@ -1,90 +1,77 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" -#include "GLES2InputAssembler.h" -#include "GLES2Commands.h" + #include "GLES2Buffer.h" +#include "GLES2Commands.h" +#include "GLES2Device.h" +#include "GLES2InputAssembler.h" namespace cc { namespace gfx { -GLES2InputAssembler::GLES2InputAssembler(Device *device) -: InputAssembler(device) { -} +GLES2InputAssembler::GLES2InputAssembler() = default; GLES2InputAssembler::~GLES2InputAssembler() { + destroy(); } -bool GLES2InputAssembler::initialize(const InputAssemblerInfo &info) { - - _attributes = info.attributes; - _vertexBuffers = info.vertexBuffers; - _indexBuffer = info.indexBuffer; - _indirectBuffer = info.indirectBuffer; - - if (_indexBuffer) { - _indexCount = _indexBuffer->getCount(); - _firstIndex = 0; - } else if (_vertexBuffers.size()) { - _vertexCount = _vertexBuffers[0]->getCount(); - _firstVertex = 0; - _vertexOffset = 0; - } - - _gpuInputAssembler = CC_NEW(GLES2GPUInputAssembler); +void GLES2InputAssembler::doInit(const InputAssemblerInfo &info) { + _gpuInputAssembler = CC_NEW(GLES2GPUInputAssembler); _gpuInputAssembler->attributes = _attributes; _gpuInputAssembler->gpuVertexBuffers.resize(_vertexBuffers.size()); for (size_t i = 0; i < _gpuInputAssembler->gpuVertexBuffers.size(); ++i) { - GLES2Buffer *vb = (GLES2Buffer *)_vertexBuffers[i]; + auto *vb = static_cast(_vertexBuffers[i]); _gpuInputAssembler->gpuVertexBuffers[i] = vb->gpuBuffer(); } - if (info.indexBuffer) + if (info.indexBuffer) { _gpuInputAssembler->gpuIndexBuffer = static_cast(info.indexBuffer)->gpuBuffer(); + } - if (info.indirectBuffer) + if (info.indirectBuffer) { _gpuInputAssembler->gpuIndirectBuffer = static_cast(info.indirectBuffer)->gpuBuffer(); + } - GLES2CmdFuncCreateInputAssembler((GLES2Device *)_device, _gpuInputAssembler); - _attributesHash = computeAttributesHash(); - - return true; + cmdFuncGLES2CreateInputAssembler(GLES2Device::getInstance(), _gpuInputAssembler); } -void GLES2InputAssembler::destroy() { +void GLES2InputAssembler::doDestroy() { if (_gpuInputAssembler) { - GLES2CmdFuncDestroyInputAssembler((GLES2Device *)_device, _gpuInputAssembler); + cmdFuncGLES2DestroyInputAssembler(GLES2Device::getInstance(), _gpuInputAssembler); CC_DELETE(_gpuInputAssembler); _gpuInputAssembler = nullptr; } } void GLES2InputAssembler::ExtractCmdDraw(GLES2CmdDraw *cmd) { - cmd->drawInfo.vertexCount = _vertexCount; - cmd->drawInfo.firstVertex = _firstVertex; - cmd->drawInfo.indexCount = _indexCount; - cmd->drawInfo.firstIndex = _firstIndex; - cmd->drawInfo.vertexOffset = _vertexOffset; + cmd->drawInfo.vertexCount = _vertexCount; + cmd->drawInfo.firstVertex = _firstVertex; + cmd->drawInfo.indexCount = _indexCount; + cmd->drawInfo.firstIndex = _firstIndex; + cmd->drawInfo.vertexOffset = _vertexOffset; cmd->drawInfo.instanceCount = _instanceCount; cmd->drawInfo.firstInstance = _firstInstance; } diff --git a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h index 3f83a04574..f84d781ebb 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h +++ b/native/cocos/renderer/gfx-gles2/GLES2InputAssembler.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_INPUT_ASSEMBLER_H_ -#define CC_GFXGLES2_INPUT_ASSEMBLER_H_ + +#pragma once + +#include "gfx-base/GFXInputAssembler.h" namespace cc { namespace gfx { @@ -32,22 +35,19 @@ class GLES2CmdDraw; class CC_GLES2_API GLES2InputAssembler final : public InputAssembler { public: - GLES2InputAssembler(Device *device); + GLES2InputAssembler(); ~GLES2InputAssembler(); -public: - virtual bool initialize(const InputAssemblerInfo &info) override; - virtual void destroy() override; - void ExtractCmdDraw(GLES2CmdDraw *cmd); CC_INLINE GLES2GPUInputAssembler *gpuInputAssembler() const { return _gpuInputAssembler; } -private: +protected: + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; + GLES2GPUInputAssembler *_gpuInputAssembler = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.cpp b/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.cpp index 1218dfbca3..9ae8d2f6b9 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Commands.h" @@ -30,25 +32,22 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES2PipelineLayout::GLES2PipelineLayout(Device *device) -: PipelineLayout(device) { +GLES2PipelineLayout::GLES2PipelineLayout() +: PipelineLayout() { } GLES2PipelineLayout::~GLES2PipelineLayout() { + destroy(); } -bool GLES2PipelineLayout::initialize(const PipelineLayoutInfo &info) { - - _setLayouts = info.setLayouts; - +void GLES2PipelineLayout::doInit(const PipelineLayoutInfo &info) { _gpuPipelineLayout = CC_NEW(GLES2GPUPipelineLayout); uint offset = 0u; _gpuPipelineLayout->dynamicOffsetIndices.resize(_setLayouts.size()); for (uint i = 0u; i < _setLayouts.size(); i++) { DescriptorSetLayout *setLayout = _setLayouts[i]; - CCASSERT(setLayout != nullptr, "SetLayout should not be nullptr."); - GLES2GPUDescriptorSetLayout *gpuSetLayout = ((GLES2DescriptorSetLayout *)setLayout)->gpuDescriptorSetLayout(); + GLES2GPUDescriptorSetLayout *gpuSetLayout = static_cast(setLayout)->gpuDescriptorSetLayout(); size_t dynamicCount = gpuSetLayout->dynamicBindings.size(); vector &indices = _gpuPipelineLayout->dynamicOffsetIndices[i]; indices.assign(setLayout->getBindingIndices().size(), -1); @@ -64,11 +63,9 @@ bool GLES2PipelineLayout::initialize(const PipelineLayoutInfo &info) { _gpuPipelineLayout->dynamicOffsetOffsets.push_back(offset); _gpuPipelineLayout->dynamicOffsetCount = offset; _gpuPipelineLayout->dynamicOffsets.resize(offset); - - return true; } -void GLES2PipelineLayout::destroy() { +void GLES2PipelineLayout::doDestroy() { if (_gpuPipelineLayout) { CC_DELETE(_gpuPipelineLayout); diff --git a/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h b/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h index aa073d6a7a..8254395e74 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h +++ b/native/cocos/renderer/gfx-gles2/GLES2PipelineLayout.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_PIPELINE_LAYOUT_H_ #define CC_GFXGLES2_PIPELINE_LAYOUT_H_ +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { @@ -31,16 +35,15 @@ class GLES2GPUPipelineLayout; class CC_GLES2_API GLES2PipelineLayout final : public PipelineLayout { public: - GLES2PipelineLayout(Device *device); + GLES2PipelineLayout(); ~GLES2PipelineLayout(); -public: - virtual bool initialize(const PipelineLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPUPipelineLayout *gpuPipelineLayout() const { return _gpuPipelineLayout; } -private: +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; + GLES2GPUPipelineLayout *_gpuPipelineLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-gles2/GLES2PipelineState.cpp b/native/cocos/renderer/gfx-gles2/GLES2PipelineState.cpp index fcc18bfc37..70bae393c2 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PipelineState.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2PipelineState.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Commands.h" @@ -49,44 +51,32 @@ const GLenum GLES2Primitives[] = { GL_NONE, }; -GLES2PipelineState::GLES2PipelineState(Device *device) -: PipelineState(device) { +GLES2PipelineState::GLES2PipelineState() +: PipelineState() { } GLES2PipelineState::~GLES2PipelineState() { + destroy(); } -bool GLES2PipelineState::initialize(const PipelineStateInfo &info) { - - _primitive = info.primitive; - _shader = info.shader; - _inputState = info.inputState; - _rasterizerState = info.rasterizerState; - _depthStencilState = info.depthStencilState; - _blendState = info.blendState; - _dynamicStates = info.dynamicStates; - _renderPass = info.renderPass; - _pipelineLayout = info.pipelineLayout; - +void GLES2PipelineState::doInit(const PipelineStateInfo &info) { _gpuPipelineState = CC_NEW(GLES2GPUPipelineState); _gpuPipelineState->glPrimitive = GLES2Primitives[(int)_primitive]; - _gpuPipelineState->gpuShader = ((GLES2Shader *)_shader)->gpuShader(); + _gpuPipelineState->gpuShader = static_cast(_shader)->gpuShader(); _gpuPipelineState->rs = _rasterizerState; _gpuPipelineState->dss = _depthStencilState; _gpuPipelineState->bs = _blendState; - _gpuPipelineState->gpuRenderPass = ((GLES2RenderPass *)_renderPass)->gpuRenderPass(); - _gpuPipelineState->gpuPipelineLayout = ((GLES2PipelineLayout *)_pipelineLayout)->gpuPipelineLayout(); + _gpuPipelineState->gpuPipelineLayout = static_cast(_pipelineLayout)->gpuPipelineLayout(); + if (_renderPass) _gpuPipelineState->gpuRenderPass = static_cast(_renderPass)->gpuRenderPass(); for (uint i = 0; i < 31; i++) { if ((uint)_dynamicStates & (1 << i)) { _gpuPipelineState->dynamicStates.push_back((DynamicStateFlagBit)(1 << i)); } } - - return true; } -void GLES2PipelineState::destroy() { +void GLES2PipelineState::doDestroy() { if (_gpuPipelineState) { CC_DELETE(_gpuPipelineState); _gpuPipelineState = nullptr; diff --git a/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h b/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h index a6bbad6fc2..2b15243fa4 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h +++ b/native/cocos/renderer/gfx-gles2/GLES2PipelineState.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_PIPELINE_STATE_H_ -#define CC_GFXGLES2_PIPELINE_STATE_H_ + +#pragma once + +#include "gfx-base/GFXPipelineState.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES2GPUPipelineState; class CC_GLES2_API GLES2PipelineState final : public PipelineState { public: - GLES2PipelineState(Device *device); + GLES2PipelineState(); ~GLES2PipelineState(); -public: - virtual bool initialize(const PipelineStateInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPUPipelineState *gpuPipelineState() const { return _gpuPipelineState; } -private: +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; + GLES2GPUPipelineState *_gpuPipelineState = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.cpp b/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.cpp index 9b5c46cba6..c010ebef29 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2Buffer.h" @@ -36,113 +38,128 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES2PrimaryCommandBuffer::GLES2PrimaryCommandBuffer(Device *device) -: GLES2CommandBuffer(device) { -} - GLES2PrimaryCommandBuffer::~GLES2PrimaryCommandBuffer() { + destroy(); } -void GLES2PrimaryCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) { - _isInRenderPass = true; - GLES2GPURenderPass *gpuRenderPass = ((GLES2RenderPass *)renderPass)->gpuRenderPass(); - GLES2GPUFramebuffer *gpuFramebuffer = ((GLES2Framebuffer *)fbo)->gpuFBO(); +void GLES2PrimaryCommandBuffer::begin(RenderPass * /*renderPass*/, uint /*subpass*/, Framebuffer * /*frameBuffer*/) { + _curGPUPipelineState = nullptr; + _curGPUInputAssember = nullptr; + _curGPUDescriptorSets.assign(_curGPUDescriptorSets.size(), nullptr); - GLES2CmdFuncBeginRenderPass((GLES2Device *)_device, gpuRenderPass, gpuFramebuffer, + _numDrawCalls = 0; + _numInstances = 0; + _numTriangles = 0; +} + +void GLES2PrimaryCommandBuffer::end() { + if (_isStateInvalid) { + bindStates(); + } + _isInRenderPass = false; +} + +void GLES2PrimaryCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const * /*secondaryCBs*/, uint /*secondaryCBCount*/) { + _isInRenderPass = true; + GLES2GPURenderPass * gpuRenderPass = static_cast(renderPass)->gpuRenderPass(); + GLES2GPUFramebuffer *gpuFramebuffer = static_cast(fbo)->gpuFBO(); + + cmdFuncGLES2BeginRenderPass(GLES2Device::getInstance(), gpuRenderPass, gpuFramebuffer, renderArea, gpuRenderPass->colorAttachments.size(), colors, depth, stencil); } void GLES2PrimaryCommandBuffer::endRenderPass() { - GLES2CmdFuncEndRenderPass((GLES2Device *)_device); + cmdFuncGLES2EndRenderPass(GLES2Device::getInstance()); _isInRenderPass = false; } -void GLES2PrimaryCommandBuffer::draw(InputAssembler *ia) { - if ((_type == CommandBufferType::PRIMARY && _isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - - if (_isStateInvalid) { - vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; - vector &dynamicOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsets; - for (size_t i = 0u; i < _curDynamicOffsets.size(); i++) { - size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; - //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); - count = std::min(count, _curDynamicOffsets[i].size()); - if (count) memcpy(&dynamicOffsets[dynamicOffsetOffsets[i]], _curDynamicOffsets[i].data(), count * sizeof(uint)); - } - GLES2CmdFuncBindState((GLES2Device *)_device, _curGPUPipelineState, _curGPUInputAssember, _curGPUDescriptorSets, dynamicOffsets, - _curViewport, _curScissor, _curLineWidth, false, _curDepthBias, _curBlendConstants, _curDepthBounds, _curStencilWriteMask, _curStencilCompareMask); - - _isStateInvalid = false; +void GLES2PrimaryCommandBuffer::draw(const DrawInfo &info) { + if (_isStateInvalid) { + vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; + vector &dynamicOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsets; + for (size_t i = 0U; i < _curDynamicOffsets.size(); i++) { + size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; + //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); + count = std::min(count, _curDynamicOffsets[i].size()); + if (count) memcpy(&dynamicOffsets[dynamicOffsetOffsets[i]], _curDynamicOffsets[i].data(), count * sizeof(uint)); } + cmdFuncGLES2BindState(GLES2Device::getInstance(), _curGPUPipelineState, _curGPUInputAssember, _curGPUDescriptorSets, dynamicOffsets, + _curViewport, _curScissor, _curLineWidth, false, _curDepthBias, _curBlendConstants, _curDepthBounds, _curStencilWriteMask, _curStencilCompareMask); - DrawInfo drawInfo; - ia->extractDrawInfo(drawInfo); - GLES2CmdFuncDraw((GLES2Device *)_device, drawInfo); + _isStateInvalid = false; + } - ++_numDrawCalls; - _numInstances += ia->getInstanceCount(); - if (_curGPUPipelineState) { - switch (_curGPUPipelineState->glPrimitive) { - case GL_TRIANGLES: { - _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getInstanceCount(), 1U); - break; - } - case GL_TRIANGLE_STRIP: - case GL_TRIANGLE_FAN: { - _numTriangles += (ia->getIndexCount() - 2) * std::max(ia->getInstanceCount(), 1U); - break; - } - default: - break; + cmdFuncGLES2Draw(GLES2Device::getInstance(), info); + + ++_numDrawCalls; + _numInstances += info.instanceCount; + uint indexCount = info.indexCount ? info.indexCount : info.vertexCount; + if (_curGPUPipelineState) { + switch (_curGPUPipelineState->glPrimitive) { + case GL_TRIANGLES: { + _numTriangles += indexCount / 3 * std::max(info.instanceCount, 1U); + break; } + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_FAN: { + _numTriangles += (indexCount - 2) * std::max(info.instanceCount, 1U); + break; + } + default: + break; } - } else { - CC_LOG_ERROR("Command 'draw' must be recorded inside a render pass."); } } void GLES2PrimaryCommandBuffer::updateBuffer(Buffer *buff, const void *data, uint size) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - - GLES2GPUBuffer *gpuBuffer = ((GLES2Buffer *)buff)->gpuBuffer(); - if (gpuBuffer) { - GLES2CmdFuncUpdateBuffer((GLES2Device *)_device, gpuBuffer, data, 0u, size); - } - } else { - CC_LOG_ERROR("Command 'updateBuffer' must be recorded outside a render pass."); + GLES2GPUBuffer *gpuBuffer = static_cast(buff)->gpuBuffer(); + if (gpuBuffer) { + cmdFuncGLES2UpdateBuffer(GLES2Device::getInstance(), gpuBuffer, data, 0U, size); } } void GLES2PrimaryCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - - GLES2GPUTexture *gpuTexture = ((GLES2Texture *)texture)->gpuTexture(); - if (gpuTexture) { - GLES2CmdFuncCopyBuffersToTexture((GLES2Device *)_device, buffers, gpuTexture, regions, count); - } - } else { - CC_LOG_ERROR("Command 'copyBuffersToTexture' must be recorded outside a render pass."); + GLES2GPUTexture *gpuTexture = static_cast(texture)->gpuTexture(); + if (gpuTexture) { + cmdFuncGLES2CopyBuffersToTexture(GLES2Device::getInstance(), buffers, gpuTexture, regions, count); } } -void GLES2PrimaryCommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t count) { +void GLES2PrimaryCommandBuffer::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { for (uint i = 0; i < count; ++i) { - GLES2PrimaryCommandBuffer *cmdBuff = (GLES2PrimaryCommandBuffer *)cmdBuffs[i]; - GLES2CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); + auto *cmdBuff = static_cast(cmdBuffs[i]); - GLES2CmdFuncExecuteCmds((GLES2Device *)_device, cmdPackage); + if (!cmdBuff->_pendingPackages.empty()) { + GLES2CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); + + cmdFuncGLES2ExecuteCmds(GLES2Device::getInstance(), cmdPackage); + + cmdBuff->_pendingPackages.pop(); + cmdBuff->_freePackages.push(cmdPackage); + cmdBuff->_cmdAllocator->clearCmds(cmdPackage); + cmdBuff->_cmdAllocator->reset(); + } _numDrawCalls += cmdBuff->_numDrawCalls; _numInstances += cmdBuff->_numInstances; _numTriangles += cmdBuff->_numTriangles; - - cmdBuff->_pendingPackages.pop(); - cmdBuff->_freePackages.push(cmdPackage); } } +void GLES2PrimaryCommandBuffer::bindStates() { + vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; + vector &dynamicOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsets; + for (size_t i = 0U; i < _curDynamicOffsets.size(); i++) { + size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; + //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); + count = std::min(count, _curDynamicOffsets[i].size()); + if (count) memcpy(&dynamicOffsets[dynamicOffsetOffsets[i]], _curDynamicOffsets[i].data(), count * sizeof(uint)); + } + cmdFuncGLES2BindState(GLES2Device::getInstance(), _curGPUPipelineState, _curGPUInputAssember, _curGPUDescriptorSets, dynamicOffsets, + _curViewport, _curScissor, _curLineWidth, false, _curDepthBias, _curBlendConstants, _curDepthBounds, _curStencilWriteMask, _curStencilCompareMask); + + _isStateInvalid = false; +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.h b/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.h index 72740b3ecc..144f8cb865 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.h +++ b/native/cocos/renderer/gfx-gles2/GLES2PrimaryCommandBuffer.h @@ -1,50 +1,55 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_PRIMARY_COMMAND_BUFFER_H_ -#define CC_GFXGLES2_PRIMARY_COMMAND_BUFFER_H_ + +#pragma once #include "GLES2CommandBuffer.h" +#include "GLES2Std.h" namespace cc { namespace gfx { class CC_GLES2_API GLES2PrimaryCommandBuffer final : public GLES2CommandBuffer { +public: + GLES2PrimaryCommandBuffer() = default; + ~GLES2PrimaryCommandBuffer() override; + + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + +protected: friend class GLES2Queue; -public: - GLES2PrimaryCommandBuffer(Device *device); - ~GLES2PrimaryCommandBuffer(); - - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) override; - virtual void endRenderPass() override; - virtual void draw(InputAssembler *ia) override; - virtual void updateBuffer(Buffer *buff, const void *data, uint size) override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; - virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; + void bindStates() override; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Queue.cpp b/native/cocos/renderer/gfx-gles2/GLES2Queue.cpp index 9a1c364673..a5b5244a3b 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Queue.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Queue.cpp @@ -1,65 +1,68 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" -#include "GLES2Queue.h" -#include "GLES2Commands.h" + #include "GLES2CommandBuffer.h" +#include "GLES2Commands.h" +#include "GLES2Device.h" +#include "GLES2Queue.h" namespace cc { namespace gfx { -GLES2Queue::GLES2Queue(Device *device) -: Queue(device) { -} +GLES2Queue::GLES2Queue() = default; GLES2Queue::~GLES2Queue() { + destroy(); } -bool GLES2Queue::initialize(const QueueInfo &info) { - _type = info.type; - - return true; +void GLES2Queue::doInit(const QueueInfo &info) { } -void GLES2Queue::destroy() { +void GLES2Queue::doDestroy() { } -void GLES2Queue::submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) { - if (!_isAsync) { - for (uint i = 0; i < count; ++i) { - GLES2CommandBuffer *cmdBuff = (GLES2CommandBuffer *)cmdBuffs[i]; +void GLES2Queue::submit(CommandBuffer *const *cmdBuffs, uint count) { + for (uint i = 0; i < count; ++i) { + auto *cmdBuff = static_cast(cmdBuffs[i]); + + if (!cmdBuff->_pendingPackages.empty()) { GLES2CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); - GLES2CmdFuncExecuteCmds((GLES2Device *)_device, cmdPackage); - - _numDrawCalls += cmdBuff->_numDrawCalls; - _numInstances += cmdBuff->_numInstances; - _numTriangles += cmdBuff->_numTriangles; + cmdFuncGLES2ExecuteCmds(GLES2Device::getInstance(), cmdPackage); cmdBuff->_pendingPackages.pop(); cmdBuff->_freePackages.push(cmdPackage); + cmdBuff->_cmdAllocator->clearCmds(cmdPackage); + cmdBuff->_cmdAllocator->reset(); } + + _numDrawCalls += cmdBuff->_numDrawCalls; + _numInstances += cmdBuff->_numInstances; + _numTriangles += cmdBuff->_numTriangles; } } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Queue.h b/native/cocos/renderer/gfx-gles2/GLES2Queue.h index 49f4d79982..d124c01cd5 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Queue.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Queue.h @@ -1,45 +1,48 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_QUEUE_H_ -#define CC_GFXGLES2_QUEUE_H_ + +#pragma once + +#include "gfx-base/GFXQueue.h" namespace cc { namespace gfx { class CC_GLES2_API GLES2Queue final : public Queue { public: - GLES2Queue(Device *device); + GLES2Queue(); ~GLES2Queue(); + void submit(CommandBuffer *const *cmdBuffs, uint count) override; + +protected: friend class GLES2Device; -public: - virtual bool initialize(const QueueInfo &info) override; - virtual void destroy() override; - virtual void submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) override; + void doInit(const QueueInfo &info) override; + void doDestroy() override; -private: uint _numDrawCalls = 0; uint _numInstances = 0; uint _numTriangles = 0; @@ -47,5 +50,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2RenderPass.cpp b/native/cocos/renderer/gfx-gles2/GLES2RenderPass.cpp index 3d9a7ed971..2e540e7ef2 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2RenderPass.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2RenderPass.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" #include "GLES2RenderPass.h" #include "GLES2Commands.h" @@ -28,28 +30,21 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES2RenderPass::GLES2RenderPass(Device *device) -: RenderPass(device) { +GLES2RenderPass::GLES2RenderPass() +: RenderPass() { } GLES2RenderPass::~GLES2RenderPass() { + destroy(); } -bool GLES2RenderPass::initialize(const RenderPassInfo &info) { - - _colorAttachments = info.colorAttachments; - _depthStencilAttachment = info.depthStencilAttachment; - +void GLES2RenderPass::doInit(const RenderPassInfo &info) { _gpuRenderPass = CC_NEW(GLES2GPURenderPass); _gpuRenderPass->colorAttachments = _colorAttachments; _gpuRenderPass->depthStencilAttachment = _depthStencilAttachment; - - _hash = computeHash(); - - return true; } -void GLES2RenderPass::destroy() { +void GLES2RenderPass::doDestroy() { if (_gpuRenderPass) { CC_DELETE(_gpuRenderPass); _gpuRenderPass = nullptr; diff --git a/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h b/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h index bc29c40635..9665810c14 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h +++ b/native/cocos/renderer/gfx-gles2/GLES2RenderPass.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_RENDER_PASS_H_ -#define CC_GFXGLES2_RENDER_PASS_H_ + +#pragma once + +#include "gfx-base/GFXRenderPass.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES2GPURenderPass; class CC_GLES2_API GLES2RenderPass final : public RenderPass { public: - GLES2RenderPass(Device *device); + GLES2RenderPass(); ~GLES2RenderPass(); -public: - virtual bool initialize(const RenderPassInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPURenderPass *gpuRenderPass() const { return _gpuRenderPass; } -private: +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; + GLES2GPURenderPass *_gpuRenderPass = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Sampler.cpp b/native/cocos/renderer/gfx-gles2/GLES2Sampler.cpp index c440a21aa4..c2d219ad99 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Sampler.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Sampler.cpp @@ -1,72 +1,58 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" -#include "GLES2Sampler.h" + #include "GLES2Commands.h" +#include "GLES2Device.h" +#include "GLES2Sampler.h" namespace cc { namespace gfx { -GLES2Sampler::GLES2Sampler(Device *device) -: Sampler(device) { -} +GLES2Sampler::GLES2Sampler() = default; GLES2Sampler::~GLES2Sampler() { + destroy(); } -bool GLES2Sampler::initialize(const SamplerInfo &info) { - _minFilter = info.minFilter; - _magFilter = info.magFilter; - _mipFilter = info.mipFilter; - _addressU = info.addressU; - _addressV = info.addressV; - _addressW = info.addressW; - _maxAnisotropy = info.maxAnisotropy; - _cmpFunc = info.cmpFunc; - _borderColor = info.borderColor; - _minLOD = info.minLOD; - _maxLOD = info.maxLOD; - _mipLODBias = info.mipLODBias; - - _gpuSampler = CC_NEW(GLES2GPUSampler); +void GLES2Sampler::doInit(const SamplerInfo & /*info*/) { + _gpuSampler = CC_NEW(GLES2GPUSampler); _gpuSampler->minFilter = _minFilter; _gpuSampler->magFilter = _magFilter; _gpuSampler->mipFilter = _mipFilter; - _gpuSampler->addressU = _addressU; - _gpuSampler->addressV = _addressV; - _gpuSampler->addressW = _addressW; - _gpuSampler->minLOD = _minLOD; - _gpuSampler->maxLOD = _maxLOD; + _gpuSampler->addressU = _addressU; + _gpuSampler->addressV = _addressV; + _gpuSampler->addressW = _addressW; - GLES2CmdFuncCreateSampler((GLES2Device *)_device, _gpuSampler); - - return true; + cmdFuncGLES2CreateSampler(GLES2Device::getInstance(), _gpuSampler); } -void GLES2Sampler::destroy() { +void GLES2Sampler::doDestroy() { if (_gpuSampler) { - GLES2CmdFuncDestroySampler((GLES2Device *)_device, _gpuSampler); + cmdFuncGLES2DestroySampler(GLES2Device::getInstance(), _gpuSampler); CC_DELETE(_gpuSampler); _gpuSampler = nullptr; } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Sampler.h b/native/cocos/renderer/gfx-gles2/GLES2Sampler.h index eeaeabfe41..2688d9b3df 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Sampler.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Sampler.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_SAMPLER_H_ -#define CC_GFXGLES2_SAMPLER_H_ + +#pragma once + +#include "gfx-base/GFXSampler.h" namespace cc { namespace gfx { @@ -31,16 +34,15 @@ class GLES2GPUSampler; class CC_GLES2_API GLES2Sampler final : public Sampler { public: - GLES2Sampler(Device *device); + GLES2Sampler(); ~GLES2Sampler(); -public: - virtual bool initialize(const SamplerInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPUSampler *gpuSampler() const { return _gpuSampler; } -private: +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; + GLES2GPUSampler *_gpuSampler = nullptr; String _name; Filter _minFilter = Filter::LINEAR; @@ -59,5 +61,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Shader.cpp b/native/cocos/renderer/gfx-gles2/GLES2Shader.cpp index 86f944ec9a..15e0b9963b 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Shader.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Shader.cpp @@ -1,64 +1,59 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" -#include "GLES2Shader.h" + #include "GLES2Commands.h" +#include "GLES2Device.h" +#include "GLES2Shader.h" namespace cc { namespace gfx { -GLES2Shader::GLES2Shader(Device *device) -: Shader(device) { -} +GLES2Shader::GLES2Shader() = default; GLES2Shader::~GLES2Shader() { + destroy(); } -bool GLES2Shader::initialize(const ShaderInfo &info) { - _name = info.name; - _stages = info.stages; - _attributes = info.attributes; - _blocks = info.blocks; - _samplers = info.samplers; - - _gpuShader = CC_NEW(GLES2GPUShader); - _gpuShader->name = _name; - _gpuShader->blocks = _blocks; - _gpuShader->samplers = _samplers; +void GLES2Shader::doInit(const ShaderInfo & /*info*/) { + _gpuShader = CC_NEW(GLES2GPUShader); + _gpuShader->name = _name; + _gpuShader->blocks = _blocks; + _gpuShader->samplerTextures = _samplerTextures; for (const auto &stage : _stages) { GLES2GPUShaderStage gpuShaderStage = {stage.stage, stage.source}; _gpuShader->gpuStages.emplace_back(std::move(gpuShaderStage)); } - GLES2CmdFuncCreateShader((GLES2Device *)_device, _gpuShader); - - return true; + cmdFuncGLES2CreateShader(GLES2Device::getInstance(), _gpuShader); } -void GLES2Shader::destroy() { +void GLES2Shader::doDestroy() { if (_gpuShader) { - GLES2CmdFuncDestroyShader((GLES2Device *)_device, _gpuShader); + cmdFuncGLES2DestroyShader(GLES2Device::getInstance(), _gpuShader); CC_DELETE(_gpuShader); _gpuShader = nullptr; } diff --git a/native/cocos/renderer/gfx-gles2/GLES2Shader.h b/native/cocos/renderer/gfx-gles2/GLES2Shader.h index 6d303b479f..570fb833ca 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Shader.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Shader.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_SHADER_H_ -#define CC_GFXGLES2_SHADER_H_ + +#pragma once + +#include "gfx-base/GFXShader.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES2GPUShader; class CC_GLES2_API GLES2Shader final : public Shader { public: - GLES2Shader(Device *device); + GLES2Shader(); ~GLES2Shader(); -public: - virtual bool initialize(const ShaderInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES2GPUShader *gpuShader() const { return _gpuShader; } -private: +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; + GLES2GPUShader *_gpuShader = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Std.cpp b/native/cocos/renderer/gfx-gles2/GLES2Std.cpp index 7f0ed05b99..432486de89 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Std.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Std.cpp @@ -1,24 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" diff --git a/native/cocos/renderer/gfx-gles2/GLES2Std.h b/native/cocos/renderer/gfx-gles2/GLES2Std.h index 281dbb49dd..214779b3ef 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Std.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Std.h @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CC_GFXGLES2_STD_H__ #define __CC_GFXGLES2_STD_H__ -#include +#include "base/CoreStd.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #if defined(CC_STATIC) diff --git a/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp b/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp index 9bb2e73ecb..505a05c2fd 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Texture.cpp @@ -1,175 +1,78 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES2Std.h" -#include "GLES2Texture.h" #include "GLES2Commands.h" +#include "GLES2Device.h" +#include "GLES2Texture.h" namespace cc { namespace gfx { -GLES2Texture::GLES2Texture(Device *device) -: Texture(device) { -} +GLES2Texture::GLES2Texture() = default; GLES2Texture::~GLES2Texture() { + destroy(); } -bool GLES2Texture::initialize(const TextureInfo &info) { - - _type = info.type; - _usage = info.usage; - _format = info.format; - _width = info.width; - _height = info.height; - _depth = info.depth; - _layerCount = info.layerCount; - _levelCount = info.levelCount; - _samples = info.samples; - _flags = info.flags; - _size = FormatSize(_format, _width, _height, _depth); - -#if CC_DEBUG > 0 - switch (_format) { // device feature validation - case Format::D16: - if (_device->hasFeature(Feature::FORMAT_D16)) break; - CC_LOG_ERROR("D16 texture format is not supported on this backend"); - return false; - case Format::D16S8: - if (_device->hasFeature(Feature::FORMAT_D16S8)) break; - CC_LOG_WARNING("D16S8 texture format is not supported on this backend"); - return false; - case Format::D24: - if (_device->hasFeature(Feature::FORMAT_D24)) break; - CC_LOG_WARNING("D24 texture format is not supported on this backend"); - return false; - case Format::D24S8: - if (_device->hasFeature(Feature::FORMAT_D24S8)) break; - CC_LOG_WARNING("D24S8 texture format is not supported on this backend"); - return false; - case Format::D32F: - if (_device->hasFeature(Feature::FORMAT_D32F)) break; - CC_LOG_WARNING("D32F texture format is not supported on this backend"); - return false; - case Format::D32F_S8: - if (_device->hasFeature(Feature::FORMAT_D32FS8)) break; - CC_LOG_WARNING("D32FS8 texture format is not supported on this backend"); - return false; - case Format::RGB8: - if (_device->hasFeature(Feature::FORMAT_RGB8)) break; - CC_LOG_WARNING("RGB8 texture format is not supported on this backend"); - return false; - default: - break; - } -#endif - - if (_flags & TextureFlags::BAKUP_BUFFER) { - _buffer = (uint8_t *)CC_MALLOC(_size); - if (!_buffer) { - CC_LOG_ERROR("GLES2Texture: CC_MALLOC backup buffer failed."); - return false; - } - _device->getMemoryStatus().textureSize += _size; - } - - _gpuTexture = CC_NEW(GLES2GPUTexture); - if (!_gpuTexture) { - CC_LOG_ERROR("GLES2Texture: CC_NEW GLES2GPUTexture failed."); - return false; - } - _gpuTexture->type = _type; - _gpuTexture->format = _format; - _gpuTexture->usage = _usage; - _gpuTexture->width = _width; - _gpuTexture->height = _height; - _gpuTexture->depth = _depth; - _gpuTexture->size = _size; +void GLES2Texture::doInit(const TextureInfo & /*info*/) { + _gpuTexture = CC_NEW(GLES2GPUTexture); + _gpuTexture->type = _type; + _gpuTexture->format = _format; + _gpuTexture->usage = _usage; + _gpuTexture->width = _width; + _gpuTexture->height = _height; + _gpuTexture->depth = _depth; + _gpuTexture->size = _size; _gpuTexture->arrayLayer = _layerCount; - _gpuTexture->mipLevel = _levelCount; - _gpuTexture->samples = _samples; - _gpuTexture->flags = _flags; + _gpuTexture->mipLevel = _levelCount; + _gpuTexture->samples = _samples; + _gpuTexture->flags = _flags; _gpuTexture->isPowerOf2 = math::IsPowerOfTwo(_width) && math::IsPowerOfTwo(_height); - GLES2CmdFuncCreateTexture((GLES2Device *)_device, _gpuTexture); - _device->getMemoryStatus().textureSize += _size; - - return true; + cmdFuncGLES2CreateTexture(GLES2Device::getInstance(), _gpuTexture); } -bool GLES2Texture::initialize(const TextureViewInfo &info) { - _isTextureView = true; - +void GLES2Texture::doInit(const TextureViewInfo & /*info*/) { CC_LOG_ERROR("GLES2 doesn't support texture view"); - return false; } -void GLES2Texture::destroy() { +void GLES2Texture::doDestroy() { if (_gpuTexture) { - GLES2CmdFuncDestroyTexture((GLES2Device *)_device, _gpuTexture); - _device->getMemoryStatus().textureSize -= _size; + cmdFuncGLES2DestroyTexture(GLES2Device::getInstance(), _gpuTexture); CC_DELETE(_gpuTexture); _gpuTexture = nullptr; } - - if (_buffer) { - CC_FREE(_buffer); - _device->getMemoryStatus().textureSize -= _size; - _buffer = nullptr; - } } -void GLES2Texture::resize(uint width, uint height) { - if (_width != width || _height != height) { - uint size = FormatSize(_format, width, height, _depth); - const uint oldSize = _size; - _width = width; - _height = height; - _size = size; - - MemoryStatus &status = _device->getMemoryStatus(); - _gpuTexture->width = _width; - _gpuTexture->height = _height; - _gpuTexture->size = _size; - GLES2CmdFuncResizeTexture((GLES2Device *)_device, _gpuTexture); - status.bufferSize -= oldSize; - status.bufferSize += _size; - - if (_buffer) { - const uint8_t *oldBuffer = _buffer; - uint8_t *buffer = (uint8_t *)CC_MALLOC(_size); - if (!buffer) { - CC_LOG_ERROR("GLES2Texture: CC_MALLOC backup buffer failed when resize the texture."); - return; - } - memcpy(buffer, oldBuffer, std::min(oldSize, size)); - _buffer = buffer; - CC_FREE(oldBuffer); - status.bufferSize -= oldSize; - status.bufferSize += _size; - } - } +void GLES2Texture::doResize(uint width, uint height, uint size) { + _gpuTexture->width = width; + _gpuTexture->height = height; + _gpuTexture->size = size; + cmdFuncGLES2ResizeTexture(GLES2Device::getInstance(), _gpuTexture); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles2/GLES2Texture.h b/native/cocos/renderer/gfx-gles2/GLES2Texture.h index 1b4ef8b477..8da288a472 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Texture.h +++ b/native/cocos/renderer/gfx-gles2/GLES2Texture.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES2_TEXTURE_H_ -#define CC_GFXGLES2_TEXTURE_H_ + +#pragma once + +#include "gfx-base/GFXTexture.h" namespace cc { namespace gfx { @@ -31,22 +34,19 @@ class GLES2GPUTexture; class CC_GLES2_API GLES2Texture final : public Texture { public: - GLES2Texture(Device *device); + GLES2Texture(); ~GLES2Texture(); -public: - virtual bool initialize(const TextureInfo &info) override; - virtual bool initialize(const TextureViewInfo &info) override; - virtual void destroy() override; - virtual void resize(uint width, uint height) override; - CC_INLINE GLES2GPUTexture *gpuTexture() const { return _gpuTexture; } -private: +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; + GLES2GPUTexture *_gpuTexture = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles2/GLES2Wrangler.cpp b/native/cocos/renderer/gfx-gles2/GLES2Wrangler.cpp new file mode 100644 index 0000000000..1724a263a6 --- /dev/null +++ b/native/cocos/renderer/gfx-gles2/GLES2Wrangler.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GLES2Wrangler.h" + +#if defined(_WIN32) && !defined(ANDROID) + #define WIN32_LEAN_AND_MEAN 1 + #include + +static HMODULE libegl = NULL; +static HMODULE libgles = NULL; + +bool gles2wOpen() { + libegl = LoadLibraryA("libEGL.dll"); + libgles = LoadLibraryA("libGLESv2.dll"); + return (libegl && libgles); +} + +void *gles2wLoad(const char *proc) { + void *res = nullptr; + if (eglGetProcAddress) res = (void *)eglGetProcAddress(proc); + if (!res) res = (void *)GetProcAddress(libegl, proc); + return res; +} +#elif defined(__EMSCRIPTEN__) +bool gles2wOpen() { return true; } +void *gles2wLoad(const char *proc) { + return (void *)eglGetProcAddress(proc); +} +#else + #include + +static void *libegl = nullptr; +static void *libgles = nullptr; + +bool gles2wOpen() { + libegl = dlopen("libEGL.so", RTLD_LAZY | RTLD_GLOBAL); + libgles = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); + return (libegl && libgles); +} + +void *gles2wLoad(const char *proc) { + void *res = nullptr; + if (eglGetProcAddress) res = (void *)eglGetProcAddress(proc); + if (!res) res = dlsym(libegl, proc); + return res; +} +#endif + +bool gles2wInit(void) { + if (!gles2wOpen()) { + return false; + } + + eglwLoadProcs(gles2wLoad); + gles2wLoadProcs(gles2wLoad); + + return true; +} diff --git a/native/cocos/renderer/gfx-gles2/GLES2Wrangler.h b/native/cocos/renderer/gfx-gles2/GLES2Wrangler.h new file mode 100644 index 0000000000..e8f6136fc2 --- /dev/null +++ b/native/cocos/renderer/gfx-gles2/GLES2Wrangler.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS) + #define EGL_EGL_PROTOTYPES 0 + #include + #include + #include +#endif + +#define GL_GLES_PROTOTYPES 0 +#include + +#include +#include +#include + +bool gles2wInit(); + +#include "../gfx-gles-common/eglw.h" +#include "../gfx-gles-common/gles2w.h" diff --git a/native/cocos/renderer/gfx-gles2/GLES2Wrangler.mm b/native/cocos/renderer/gfx-gles2/GLES2Wrangler.mm new file mode 100644 index 0000000000..a04d76663d --- /dev/null +++ b/native/cocos/renderer/gfx-gles2/GLES2Wrangler.mm @@ -0,0 +1,110 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GLES2Wrangler.h" + +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + #import + #import + #import + #import + #import + #import + +static CFBundleRef g_es2Bundle; +static CFURLRef g_es2BundleURL; + +static int gles2wOpen() { + #if TARGET_IPHONE_SIMULATOR + CFStringRef frameworkPath = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework"); + #else + CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework"); + #endif + + g_es2BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, + frameworkPath, + kCFURLPOSIXPathStyle, true); + + CFRelease(frameworkPath); + + g_es2Bundle = CFBundleCreate(kCFAllocatorDefault, g_es2BundleURL); + + return (g_es2Bundle != NULL); +} + +static void *gles2wLoad(const char *proc) { + void *res; + + CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, + kCFStringEncodingASCII); + res = CFBundleGetFunctionPointerForName(g_es2Bundle, procname); + CFRelease(procname); + return res; +} +#else + // macos + #include + #include + #include + #import + #import + +static void *libegl; +static void *libgl; + +static int gles2wOpen() { + NSURL *appURL = [[NSBundle mainBundle] bundleURL]; + + std::string libPath(appURL.resourceSpecifier.UTF8String); + libPath.append("/Contents/Frameworks/libEGL.dylib"); + libegl = dlopen(libPath.c_str(), RTLD_LOCAL | RTLD_LAZY); + if (!libegl) printf("%s\n", dlerror()); + + libPath = appURL.resourceSpecifier.UTF8String; + libPath.append("/Contents/Frameworks/libGLESv2.dylib"); + libgl = dlopen(libPath.c_str(), RTLD_LOCAL | RTLD_LAZY); + if (!libgl) printf("%s\n", dlerror()); + + return (libegl && libgl); +} + +static void *gles2wLoad(const char *proc) { + void *res = nullptr; + if (eglGetProcAddress) res = (void *)eglGetProcAddress(proc); + if (!res) res = (void *)dlsym(libegl, proc); + return res; +} +#endif + +bool gles2wInit() { + if (!gles2wOpen()) { + return false; + } + + eglwLoadProcs(gles2wLoad); + gles2wLoadProcs(gles2wLoad); + + return true; +} diff --git a/native/cocos/renderer/gfx-gles2/gles2w.c b/native/cocos/renderer/gfx-gles2/gles2w.c deleted file mode 100755 index 05914cbc96..0000000000 --- a/native/cocos/renderer/gfx-gles2/gles2w.c +++ /dev/null @@ -1,802 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "gles2w.h" - -#if defined(_WIN32) && !defined(ANDROID) - #define WIN32_LEAN_AND_MEAN 1 - #include - #include - -static HMODULE libgl; - -static int open_libgl(void) { - libgl = LoadLibraryA("libGLESv2.dll"); - return (libgl != NULL); -} - -static void close_libgl(void) { - FreeLibrary(libgl); -} - -static void *get_proc(const char *proc) { - void *res; - - res = (void *)eglGetProcAddress(proc); - if (!res) - res = (void *)GetProcAddress(libgl, proc); - return res; -} -#elif defined(__APPLE__) || defined(__APPLE_CC__) - #import - #import - #import - #import - #import - -// Routine to run a system command and retrieve the output. -// From http://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c -std::string ES2_EXEC(const char *cmd) { - FILE *pipe = popen(cmd, "r"); - if (!pipe) return "ERROR"; - char buffer[128]; - std::string result = ""; - while (!feof(pipe)) { - if (fgets(buffer, 128, pipe) != NULL) - result += buffer; - } - pclose(pipe); - return result; -} - -static CFBundleRef g_es2Bundle; -static CFURLRef g_es2BundleURL; - -static int open_libgl(void) { - CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework"); - NSString *sysVersion = [UIDevice currentDevice].systemVersion; - NSArray *sysVersionComponents = [sysVersion componentsSeparatedByString:@"."]; - //BOOL isSimulator = ([[UIDevice currentDevice].model rangeOfString:@"Simulator"].location != NSNotFound); - - #if TARGET_IPHONE_SIMULATOR - bool isSimulator = true; - #else - bool isSimulator = false; - #endif - if (isSimulator) { - // Ask where Xcode is installed - std::string xcodePath = "/Applications/Xcode.app/Contents/Developer\n"; - - // The result contains an end line character. Remove it. - size_t pos = xcodePath.find("\n"); - xcodePath.erase(pos); - - char tempPath[PATH_MAX]; - sprintf(tempPath, - "%s/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.%s.sdk/System/Library/Frameworks/OpenGLES.framework", - xcodePath.c_str(), - [[sysVersionComponents objectAtIndex:0] cStringUsingEncoding:NSUTF8StringEncoding], - [[sysVersionComponents objectAtIndex:1] cStringUsingEncoding:NSUTF8StringEncoding]); - frameworkPath = CFStringCreateWithCString(kCFAllocatorDefault, tempPath, kCFStringEncodingUTF8); - } - - g_es2BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - frameworkPath, - kCFURLPOSIXPathStyle, true); - - CFRelease(frameworkPath); - - g_es2Bundle = CFBundleCreate(kCFAllocatorDefault, g_es2BundleURL); - - return (g_es2Bundle != NULL); -} - -static void close_libgl(void) { - CFRelease(g_es2Bundle); - CFRelease(g_es2BundleURL); -} - -static void *get_proc(const char *proc) { - void *res; - - CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, - kCFStringEncodingASCII); - res = CFBundleGetFunctionPointerForName(g_es2Bundle, procname); - CFRelease(procname); - return res; -} -#elif defined(__EMSCRIPTEN__) - #include -static void open_libgl() {} -static void close_libgl() {} -static void *get_proc(const char *proc) { - return (void *)eglGetProcAddress(proc); -} -#else - #include - #include - -static void *libgl; - -static int open_libgl(void) { - libgl = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); - return libgl != NULL; -} - -static void close_libgl(void) { - dlclose(libgl); -} - -static void *get_proc(const char *proc) { - void *res; - res = dlsym(libgl, proc); - return res; -} -#endif - -static struct { - int major, minor; -} version; - -static int parse_version(void) { - version.major = 2; - version.minor = 0; - - return 0; -} - -static void load_procs(void); - -int gles2wInit(void) { - if (!open_libgl()) { - return 0; - } - - load_procs(); - close_libgl(); - parse_version(); - - return 1; -} - -int gles2wIsSupported(int major, int minor) { - if (major < 2) - return 0; - if (version.major == major) - return version.minor >= minor; - return version.major >= major; -} - -void *gles2wGetProcAddress(const char *proc) { - return get_proc(proc); -} - -PFNGLACTIVETEXTUREPROC gles2wActiveTexture; -PFNGLATTACHSHADERPROC gles2wAttachShader; -PFNGLBINDATTRIBLOCATIONPROC gles2wBindAttribLocation; -PFNGLBINDBUFFERPROC gles2wBindBuffer; -PFNGLBINDFRAMEBUFFERPROC gles2wBindFramebuffer; -PFNGLBINDRENDERBUFFERPROC gles2wBindRenderbuffer; -PFNGLBINDTEXTUREPROC gles2wBindTexture; -PFNGLBLENDCOLORPROC gles2wBlendColor; -PFNGLBLENDEQUATIONPROC gles2wBlendEquation; -PFNGLBLENDEQUATIONSEPARATEPROC gles2wBlendEquationSeparate; -PFNGLBLENDFUNCPROC gles2wBlendFunc; -PFNGLBLENDFUNCSEPARATEPROC gles2wBlendFuncSeparate; -PFNGLBUFFERDATAPROC gles2wBufferData; -PFNGLBUFFERSUBDATAPROC gles2wBufferSubData; -PFNGLCHECKFRAMEBUFFERSTATUSPROC gles2wCheckFramebufferStatus; -PFNGLCLEARPROC gles2wClear; -PFNGLCLEARCOLORPROC gles2wClearColor; -PFNGLCLEARDEPTHFPROC gles2wClearDepthf; -PFNGLCLEARSTENCILPROC gles2wClearStencil; -PFNGLCOLORMASKPROC gles2wColorMask; -PFNGLCOMPILESHADERPROC gles2wCompileShader; -PFNGLCOMPRESSEDTEXIMAGE2DPROC gles2wCompressedTexImage2D; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC gles2wCompressedTexSubImage2D; -PFNGLCOPYTEXIMAGE2DPROC gles2wCopyTexImage2D; -PFNGLCOPYTEXSUBIMAGE2DPROC gles2wCopyTexSubImage2D; -PFNGLCREATEPROGRAMPROC gles2wCreateProgram; -PFNGLCREATESHADERPROC gles2wCreateShader; -PFNGLCULLFACEPROC gles2wCullFace; -PFNGLDELETEBUFFERSPROC gles2wDeleteBuffers; -PFNGLDELETEFRAMEBUFFERSPROC gles2wDeleteFramebuffers; -PFNGLDELETEPROGRAMPROC gles2wDeleteProgram; -PFNGLDELETERENDERBUFFERSPROC gles2wDeleteRenderbuffers; -PFNGLDELETESHADERPROC gles2wDeleteShader; -PFNGLDELETETEXTURESPROC gles2wDeleteTextures; -PFNGLDEPTHFUNCPROC gles2wDepthFunc; -PFNGLDEPTHMASKPROC gles2wDepthMask; -PFNGLDEPTHRANGEFPROC gles2wDepthRangef; -PFNGLDETACHSHADERPROC gles2wDetachShader; -PFNGLDISABLEPROC gles2wDisable; -PFNGLDISABLEVERTEXATTRIBARRAYPROC gles2wDisableVertexAttribArray; -PFNGLDRAWARRAYSPROC gles2wDrawArrays; -PFNGLDRAWELEMENTSPROC gles2wDrawElements; -PFNGLENABLEPROC gles2wEnable; -PFNGLENABLEVERTEXATTRIBARRAYPROC gles2wEnableVertexAttribArray; -PFNGLFINISHPROC gles2wFinish; -PFNGLFLUSHPROC gles2wFlush; -PFNGLFRAMEBUFFERRENDERBUFFERPROC gles2wFramebufferRenderbuffer; -PFNGLFRAMEBUFFERTEXTURE2DPROC gles2wFramebufferTexture2D; -PFNGLFRONTFACEPROC gles2wFrontFace; -PFNGLGENBUFFERSPROC gles2wGenBuffers; -PFNGLGENERATEMIPMAPPROC gles2wGenerateMipmap; -PFNGLGENFRAMEBUFFERSPROC gles2wGenFramebuffers; -PFNGLGENRENDERBUFFERSPROC gles2wGenRenderbuffers; -PFNGLGENTEXTURESPROC gles2wGenTextures; -PFNGLGETACTIVEATTRIBPROC gles2wGetActiveAttrib; -PFNGLGETACTIVEUNIFORMPROC gles2wGetActiveUniform; -PFNGLGETATTACHEDSHADERSPROC gles2wGetAttachedShaders; -PFNGLGETATTRIBLOCATIONPROC gles2wGetAttribLocation; -PFNGLGETBOOLEANVPROC gles2wGetBooleanv; -PFNGLGETBUFFERPARAMETERIVPROC gles2wGetBufferParameteriv; -PFNGLGETERRORPROC gles2wGetError; -PFNGLGETFLOATVPROC gles2wGetFloatv; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC gles2wGetFramebufferAttachmentParameteriv; -PFNGLGETINTEGERVPROC gles2wGetIntegerv; -PFNGLGETPROGRAMIVPROC gles2wGetProgramiv; -PFNGLGETPROGRAMINFOLOGPROC gles2wGetProgramInfoLog; -PFNGLGETRENDERBUFFERPARAMETERIVPROC gles2wGetRenderbufferParameteriv; -PFNGLGETSHADERIVPROC gles2wGetShaderiv; -PFNGLGETSHADERINFOLOGPROC gles2wGetShaderInfoLog; -PFNGLGETSHADERPRECISIONFORMATPROC gles2wGetShaderPrecisionFormat; -PFNGLGETSHADERSOURCEPROC gles2wGetShaderSource; -PFNGLGETSTRINGPROC gles2wGetString; -PFNGLGETTEXPARAMETERFVPROC gles2wGetTexParameterfv; -PFNGLGETTEXPARAMETERIVPROC gles2wGetTexParameteriv; -PFNGLGETUNIFORMFVPROC gles2wGetUniformfv; -PFNGLGETUNIFORMIVPROC gles2wGetUniformiv; -PFNGLGETUNIFORMLOCATIONPROC gles2wGetUniformLocation; -PFNGLGETVERTEXATTRIBFVPROC gles2wGetVertexAttribfv; -PFNGLGETVERTEXATTRIBIVPROC gles2wGetVertexAttribiv; -PFNGLGETVERTEXATTRIBPOINTERVPROC gles2wGetVertexAttribPointerv; -PFNGLHINTPROC gles2wHint; -PFNGLISBUFFERPROC gles2wIsBuffer; -PFNGLISENABLEDPROC gles2wIsEnabled; -PFNGLISFRAMEBUFFERPROC gles2wIsFramebuffer; -PFNGLISPROGRAMPROC gles2wIsProgram; -PFNGLISRENDERBUFFERPROC gles2wIsRenderbuffer; -PFNGLISSHADERPROC gles2wIsShader; -PFNGLISTEXTUREPROC gles2wIsTexture; -PFNGLLINEWIDTHPROC gles2wLineWidth; -PFNGLLINKPROGRAMPROC gles2wLinkProgram; -PFNGLPIXELSTOREIPROC gles2wPixelStorei; -PFNGLPOLYGONOFFSETPROC gles2wPolygonOffset; -PFNGLREADPIXELSPROC gles2wReadPixels; -PFNGLRELEASESHADERCOMPILERPROC gles2wReleaseShaderCompiler; -PFNGLRENDERBUFFERSTORAGEPROC gles2wRenderbufferStorage; -PFNGLSAMPLECOVERAGEPROC gles2wSampleCoverage; -PFNGLSCISSORPROC gles2wScissor; -PFNGLSHADERBINARYPROC gles2wShaderBinary; -PFNGLSHADERSOURCEPROC gles2wShaderSource; -PFNGLSTENCILFUNCPROC gles2wStencilFunc; -PFNGLSTENCILFUNCSEPARATEPROC gles2wStencilFuncSeparate; -PFNGLSTENCILMASKPROC gles2wStencilMask; -PFNGLSTENCILMASKSEPARATEPROC gles2wStencilMaskSeparate; -PFNGLSTENCILOPPROC gles2wStencilOp; -PFNGLSTENCILOPSEPARATEPROC gles2wStencilOpSeparate; -PFNGLTEXIMAGE2DPROC gles2wTexImage2D; -PFNGLTEXPARAMETERFPROC gles2wTexParameterf; -PFNGLTEXPARAMETERFVPROC gles2wTexParameterfv; -PFNGLTEXPARAMETERIPROC gles2wTexParameteri; -PFNGLTEXPARAMETERIVPROC gles2wTexParameteriv; -PFNGLTEXSUBIMAGE2DPROC gles2wTexSubImage2D; -PFNGLUNIFORM1FPROC gles2wUniform1f; -PFNGLUNIFORM1FVPROC gles2wUniform1fv; -PFNGLUNIFORM1IPROC gles2wUniform1i; -PFNGLUNIFORM1IVPROC gles2wUniform1iv; -PFNGLUNIFORM2FPROC gles2wUniform2f; -PFNGLUNIFORM2FVPROC gles2wUniform2fv; -PFNGLUNIFORM2IPROC gles2wUniform2i; -PFNGLUNIFORM2IVPROC gles2wUniform2iv; -PFNGLUNIFORM3FPROC gles2wUniform3f; -PFNGLUNIFORM3FVPROC gles2wUniform3fv; -PFNGLUNIFORM3IPROC gles2wUniform3i; -PFNGLUNIFORM3IVPROC gles2wUniform3iv; -PFNGLUNIFORM4FPROC gles2wUniform4f; -PFNGLUNIFORM4FVPROC gles2wUniform4fv; -PFNGLUNIFORM4IPROC gles2wUniform4i; -PFNGLUNIFORM4IVPROC gles2wUniform4iv; -PFNGLUNIFORMMATRIX2FVPROC gles2wUniformMatrix2fv; -PFNGLUNIFORMMATRIX3FVPROC gles2wUniformMatrix3fv; -PFNGLUNIFORMMATRIX4FVPROC gles2wUniformMatrix4fv; -PFNGLUSEPROGRAMPROC gles2wUseProgram; -PFNGLVALIDATEPROGRAMPROC gles2wValidateProgram; -PFNGLVERTEXATTRIB1FPROC gles2wVertexAttrib1f; -PFNGLVERTEXATTRIB1FVPROC gles2wVertexAttrib1fv; -PFNGLVERTEXATTRIB2FPROC gles2wVertexAttrib2f; -PFNGLVERTEXATTRIB2FVPROC gles2wVertexAttrib2fv; -PFNGLVERTEXATTRIB3FPROC gles2wVertexAttrib3f; -PFNGLVERTEXATTRIB3FVPROC gles2wVertexAttrib3fv; -PFNGLVERTEXATTRIB4FPROC gles2wVertexAttrib4f; -PFNGLVERTEXATTRIB4FVPROC gles2wVertexAttrib4fv; -PFNGLVERTEXATTRIBPOINTERPROC gles2wVertexAttribPointer; -PFNGLVIEWPORTPROC gles2wViewport; -PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gles2wEGLImageTargetTexture2DOES; -PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC gles2wEGLImageTargetRenderbufferStorageOES; -PFNGLGETPROGRAMBINARYOESPROC gles2wGetProgramBinaryOES; -PFNGLPROGRAMBINARYOESPROC gles2wProgramBinaryOES; -PFNGLMAPBUFFEROESPROC gles2wMapBufferOES; -PFNGLUNMAPBUFFEROESPROC gles2wUnmapBufferOES; -PFNGLGETBUFFERPOINTERVOESPROC gles2wGetBufferPointervOES; -PFNGLTEXIMAGE3DOESPROC gles2wTexImage3DOES; -PFNGLTEXSUBIMAGE3DOESPROC gles2wTexSubImage3DOES; -PFNGLCOPYTEXSUBIMAGE3DOESPROC gles2wCopyTexSubImage3DOES; -PFNGLCOMPRESSEDTEXIMAGE3DOESPROC gles2wCompressedTexImage3DOES; -PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC gles2wCompressedTexSubImage3DOES; -PFNGLFRAMEBUFFERTEXTURE3DOESPROC gles2wFramebufferTexture3DOES; -PFNGLBINDVERTEXARRAYOESPROC gles2wBindVertexArrayOES; -PFNGLDELETEVERTEXARRAYSOESPROC gles2wDeleteVertexArraysOES; -PFNGLGENVERTEXARRAYSOESPROC gles2wGenVertexArraysOES; -PFNGLISVERTEXARRAYOESPROC gles2wIsVertexArrayOES; -PFNGLDEBUGMESSAGECONTROLKHRPROC gles2wDebugMessageControlKHR; -PFNGLDEBUGMESSAGEINSERTKHRPROC gles2wDebugMessageInsertKHR; -PFNGLDEBUGMESSAGECALLBACKKHRPROC gles2wDebugMessageCallbackKHR; -PFNGLGETDEBUGMESSAGELOGKHRPROC gles2wGetDebugMessageLogKHR; -PFNGLPUSHDEBUGGROUPKHRPROC gles2wPushDebugGroupKHR; -PFNGLPOPDEBUGGROUPKHRPROC gles2wPopDebugGroupKHR; -PFNGLOBJECTLABELKHRPROC gles2wObjectLabelKHR; -PFNGLGETOBJECTLABELKHRPROC gles2wGetObjectLabelKHR; -PFNGLOBJECTPTRLABELKHRPROC gles2wObjectPtrLabelKHR; -PFNGLGETOBJECTPTRLABELKHRPROC gles2wGetObjectPtrLabelKHR; -PFNGLGETPOINTERVKHRPROC gles2wGetPointervKHR; -PFNGLGETPERFMONITORGROUPSAMDPROC gles2wGetPerfMonitorGroupsAMD; -PFNGLGETPERFMONITORCOUNTERSAMDPROC gles2wGetPerfMonitorCountersAMD; -PFNGLGETPERFMONITORGROUPSTRINGAMDPROC gles2wGetPerfMonitorGroupStringAMD; -PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC gles2wGetPerfMonitorCounterStringAMD; -PFNGLGETPERFMONITORCOUNTERINFOAMDPROC gles2wGetPerfMonitorCounterInfoAMD; -PFNGLGENPERFMONITORSAMDPROC gles2wGenPerfMonitorsAMD; -PFNGLDELETEPERFMONITORSAMDPROC gles2wDeletePerfMonitorsAMD; -PFNGLSELECTPERFMONITORCOUNTERSAMDPROC gles2wSelectPerfMonitorCountersAMD; -PFNGLBEGINPERFMONITORAMDPROC gles2wBeginPerfMonitorAMD; -PFNGLENDPERFMONITORAMDPROC gles2wEndPerfMonitorAMD; -PFNGLGETPERFMONITORCOUNTERDATAAMDPROC gles2wGetPerfMonitorCounterDataAMD; -PFNGLBLITFRAMEBUFFERANGLEPROC gles2wBlitFramebufferANGLE; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC gles2wRenderbufferStorageMultisampleANGLE; -PFNGLDRAWARRAYSINSTANCEDANGLEPROC gles2wDrawArraysInstancedANGLE; -PFNGLDRAWELEMENTSINSTANCEDANGLEPROC gles2wDrawElementsInstancedANGLE; -PFNGLVERTEXATTRIBDIVISORANGLEPROC gles2wVertexAttribDivisorANGLE; -PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC gles2wGetTranslatedShaderSourceANGLE; -PFNGLDRAWARRAYSINSTANCEDEXTPROC gles2wDrawArraysInstancedEXT; -PFNGLDRAWELEMENTSINSTANCEDEXTPROC gles2wDrawElementsInstancedEXT; -PFNGLVERTEXATTRIBDIVISOREXTPROC gles2wVertexAttribDivisorEXT; -PFNGLCOPYTEXTURELEVELSAPPLEPROC gles2wCopyTextureLevelsAPPLE; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC gles2wRenderbufferStorageMultisampleAPPLE; -PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC gles2wResolveMultisampleFramebufferAPPLE; -PFNGLFENCESYNCAPPLEPROC gles2wFenceSyncAPPLE; -PFNGLISSYNCAPPLEPROC gles2wIsSyncAPPLE; -PFNGLDELETESYNCAPPLEPROC gles2wDeleteSyncAPPLE; -PFNGLCLIENTWAITSYNCAPPLEPROC gles2wClientWaitSyncAPPLE; -PFNGLWAITSYNCAPPLEPROC gles2wWaitSyncAPPLE; -PFNGLGETINTEGER64VAPPLEPROC gles2wGetInteger64vAPPLE; -PFNGLGETSYNCIVAPPLEPROC gles2wGetSyncivAPPLE; -PFNGLLABELOBJECTEXTPROC gles2wLabelObjectEXT; -PFNGLGETOBJECTLABELEXTPROC gles2wGetObjectLabelEXT; -PFNGLINSERTEVENTMARKEREXTPROC gles2wInsertEventMarkerEXT; -PFNGLPUSHGROUPMARKEREXTPROC gles2wPushGroupMarkerEXT; -PFNGLPOPGROUPMARKEREXTPROC gles2wPopGroupMarkerEXT; -PFNGLDISCARDFRAMEBUFFEREXTPROC gles2wDiscardFramebufferEXT; -PFNGLGENQUERIESEXTPROC gles2wGenQueriesEXT; -PFNGLDELETEQUERIESEXTPROC gles2wDeleteQueriesEXT; -PFNGLISQUERYEXTPROC gles2wIsQueryEXT; -PFNGLBEGINQUERYEXTPROC gles2wBeginQueryEXT; -PFNGLENDQUERYEXTPROC gles2wEndQueryEXT; -PFNGLQUERYCOUNTEREXTPROC gles2wQueryCounterEXT; -PFNGLGETQUERYIVEXTPROC gles2wGetQueryivEXT; -PFNGLGETQUERYOBJECTIVEXTPROC gles2wGetQueryObjectivEXT; -PFNGLGETQUERYOBJECTUIVEXTPROC gles2wGetQueryObjectuivEXT; -PFNGLGETQUERYOBJECTI64VEXTPROC gles2wGetQueryObjecti64vEXT; -PFNGLGETQUERYOBJECTUI64VEXTPROC gles2wGetQueryObjectui64vEXT; -PFNGLMAPBUFFERRANGEEXTPROC gles2wMapBufferRangeEXT; -PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC gles2wFlushMappedBufferRangeEXT; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC gles2wRenderbufferStorageMultisampleEXT; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC gles2wFramebufferTexture2DMultisampleEXT; -PFNGLREADBUFFERINDEXEDEXTPROC gles2wReadBufferIndexedEXT; -PFNGLDRAWBUFFERSINDEXEDEXTPROC gles2wDrawBuffersIndexedEXT; -PFNGLGETINTEGERI_VEXTPROC gles2wGetIntegeri_vEXT; -PFNGLMULTIDRAWARRAYSEXTPROC gles2wMultiDrawArraysEXT; -PFNGLMULTIDRAWELEMENTSEXTPROC gles2wMultiDrawElementsEXT; -PFNGLGETGRAPHICSRESETSTATUSEXTPROC gles2wGetGraphicsResetStatusEXT; -PFNGLREADNPIXELSEXTPROC gles2wReadnPixelsEXT; -PFNGLGETNUNIFORMFVEXTPROC gles2wGetnUniformfvEXT; -PFNGLGETNUNIFORMIVEXTPROC gles2wGetnUniformivEXT; -PFNGLUSEPROGRAMSTAGESEXTPROC gles2wUseProgramStagesEXT; -PFNGLACTIVESHADERPROGRAMEXTPROC gles2wActiveShaderProgramEXT; -PFNGLCREATESHADERPROGRAMVEXTPROC gles2wCreateShaderProgramvEXT; -PFNGLBINDPROGRAMPIPELINEEXTPROC gles2wBindProgramPipelineEXT; -PFNGLDELETEPROGRAMPIPELINESEXTPROC gles2wDeleteProgramPipelinesEXT; -PFNGLGENPROGRAMPIPELINESEXTPROC gles2wGenProgramPipelinesEXT; -PFNGLISPROGRAMPIPELINEEXTPROC gles2wIsProgramPipelineEXT; -PFNGLPROGRAMPARAMETERIEXTPROC gles2wProgramParameteriEXT; -PFNGLGETPROGRAMPIPELINEIVEXTPROC gles2wGetProgramPipelineivEXT; -PFNGLPROGRAMUNIFORM1IEXTPROC gles2wProgramUniform1iEXT; -PFNGLPROGRAMUNIFORM2IEXTPROC gles2wProgramUniform2iEXT; -PFNGLPROGRAMUNIFORM3IEXTPROC gles2wProgramUniform3iEXT; -PFNGLPROGRAMUNIFORM4IEXTPROC gles2wProgramUniform4iEXT; -PFNGLPROGRAMUNIFORM1FEXTPROC gles2wProgramUniform1fEXT; -PFNGLPROGRAMUNIFORM2FEXTPROC gles2wProgramUniform2fEXT; -PFNGLPROGRAMUNIFORM3FEXTPROC gles2wProgramUniform3fEXT; -PFNGLPROGRAMUNIFORM4FEXTPROC gles2wProgramUniform4fEXT; -PFNGLPROGRAMUNIFORM1IVEXTPROC gles2wProgramUniform1ivEXT; -PFNGLPROGRAMUNIFORM2IVEXTPROC gles2wProgramUniform2ivEXT; -PFNGLPROGRAMUNIFORM3IVEXTPROC gles2wProgramUniform3ivEXT; -PFNGLPROGRAMUNIFORM4IVEXTPROC gles2wProgramUniform4ivEXT; -PFNGLPROGRAMUNIFORM1FVEXTPROC gles2wProgramUniform1fvEXT; -PFNGLPROGRAMUNIFORM2FVEXTPROC gles2wProgramUniform2fvEXT; -PFNGLPROGRAMUNIFORM3FVEXTPROC gles2wProgramUniform3fvEXT; -PFNGLPROGRAMUNIFORM4FVEXTPROC gles2wProgramUniform4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC gles2wProgramUniformMatrix2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC gles2wProgramUniformMatrix3fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC gles2wProgramUniformMatrix4fvEXT; -PFNGLVALIDATEPROGRAMPIPELINEEXTPROC gles2wValidateProgramPipelineEXT; -PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC gles2wGetProgramPipelineInfoLogEXT; -PFNGLTEXSTORAGE1DEXTPROC gles2wTexStorage1DEXT; -PFNGLTEXSTORAGE2DEXTPROC gles2wTexStorage2DEXT; -PFNGLTEXSTORAGE3DEXTPROC gles2wTexStorage3DEXT; -PFNGLTEXTURESTORAGE1DEXTPROC gles2wTextureStorage1DEXT; -PFNGLTEXTURESTORAGE2DEXTPROC gles2wTextureStorage2DEXT; -PFNGLTEXTURESTORAGE3DEXTPROC gles2wTextureStorage3DEXT; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC gles2wRenderbufferStorageMultisampleIMG; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC gles2wFramebufferTexture2DMultisampleIMG; -PFNGLCOVERAGEMASKNVPROC gles2wCoverageMaskNV; -PFNGLCOVERAGEOPERATIONNVPROC gles2wCoverageOperationNV; -PFNGLDRAWBUFFERSNVPROC gles2wDrawBuffersNV; -PFNGLDRAWARRAYSINSTANCEDNVPROC gles2wDrawArraysInstancedNV; -PFNGLDRAWELEMENTSINSTANCEDNVPROC gles2wDrawElementsInstancedNV; -PFNGLDELETEFENCESNVPROC gles2wDeleteFencesNV; -PFNGLGENFENCESNVPROC gles2wGenFencesNV; -PFNGLISFENCENVPROC gles2wIsFenceNV; -PFNGLTESTFENCENVPROC gles2wTestFenceNV; -PFNGLGETFENCEIVNVPROC gles2wGetFenceivNV; -PFNGLFINISHFENCENVPROC gles2wFinishFenceNV; -PFNGLSETFENCENVPROC gles2wSetFenceNV; -PFNGLBLITFRAMEBUFFERNVPROC gles2wBlitFramebufferNV; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC gles2wRenderbufferStorageMultisampleNV; -PFNGLVERTEXATTRIBDIVISORNVPROC gles2wVertexAttribDivisorNV; -PFNGLREADBUFFERNVPROC gles2wReadBufferNV; -PFNGLALPHAFUNCQCOMPROC gles2wAlphaFuncQCOM; -PFNGLGETDRIVERCONTROLSQCOMPROC gles2wGetDriverControlsQCOM; -PFNGLGETDRIVERCONTROLSTRINGQCOMPROC gles2wGetDriverControlStringQCOM; -PFNGLENABLEDRIVERCONTROLQCOMPROC gles2wEnableDriverControlQCOM; -PFNGLDISABLEDRIVERCONTROLQCOMPROC gles2wDisableDriverControlQCOM; -PFNGLEXTGETTEXTURESQCOMPROC gles2wExtGetTexturesQCOM; -PFNGLEXTGETBUFFERSQCOMPROC gles2wExtGetBuffersQCOM; -PFNGLEXTGETRENDERBUFFERSQCOMPROC gles2wExtGetRenderbuffersQCOM; -PFNGLEXTGETFRAMEBUFFERSQCOMPROC gles2wExtGetFramebuffersQCOM; -PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC gles2wExtGetTexLevelParameterivQCOM; -PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC gles2wExtTexObjectStateOverrideiQCOM; -PFNGLEXTGETTEXSUBIMAGEQCOMPROC gles2wExtGetTexSubImageQCOM; -PFNGLEXTGETBUFFERPOINTERVQCOMPROC gles2wExtGetBufferPointervQCOM; -PFNGLEXTGETSHADERSQCOMPROC gles2wExtGetShadersQCOM; -PFNGLEXTGETPROGRAMSQCOMPROC gles2wExtGetProgramsQCOM; -PFNGLEXTISPROGRAMBINARYQCOMPROC gles2wExtIsProgramBinaryQCOM; -PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC gles2wExtGetProgramBinarySourceQCOM; -PFNGLSTARTTILINGQCOMPROC gles2wStartTilingQCOM; -PFNGLENDTILINGQCOMPROC gles2wEndTilingQCOM; - -static void load_procs(void) { - gles2wActiveTexture = (PFNGLACTIVETEXTUREPROC)get_proc("glActiveTexture"); - gles2wAttachShader = (PFNGLATTACHSHADERPROC)get_proc("glAttachShader"); - gles2wBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)get_proc("glBindAttribLocation"); - gles2wBindBuffer = (PFNGLBINDBUFFERPROC)get_proc("glBindBuffer"); - gles2wBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)get_proc("glBindFramebuffer"); - gles2wBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)get_proc("glBindRenderbuffer"); - gles2wBindTexture = (PFNGLBINDTEXTUREPROC)get_proc("glBindTexture"); - gles2wBlendColor = (PFNGLBLENDCOLORPROC)get_proc("glBlendColor"); - gles2wBlendEquation = (PFNGLBLENDEQUATIONPROC)get_proc("glBlendEquation"); - gles2wBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)get_proc("glBlendEquationSeparate"); - gles2wBlendFunc = (PFNGLBLENDFUNCPROC)get_proc("glBlendFunc"); - gles2wBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)get_proc("glBlendFuncSeparate"); - gles2wBufferData = (PFNGLBUFFERDATAPROC)get_proc("glBufferData"); - gles2wBufferSubData = (PFNGLBUFFERSUBDATAPROC)get_proc("glBufferSubData"); - gles2wCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)get_proc("glCheckFramebufferStatus"); - gles2wClear = (PFNGLCLEARPROC)get_proc("glClear"); - gles2wClearColor = (PFNGLCLEARCOLORPROC)get_proc("glClearColor"); - gles2wClearDepthf = (PFNGLCLEARDEPTHFPROC)get_proc("glClearDepthf"); - gles2wClearStencil = (PFNGLCLEARSTENCILPROC)get_proc("glClearStencil"); - gles2wColorMask = (PFNGLCOLORMASKPROC)get_proc("glColorMask"); - gles2wCompileShader = (PFNGLCOMPILESHADERPROC)get_proc("glCompileShader"); - gles2wCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)get_proc("glCompressedTexImage2D"); - gles2wCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)get_proc("glCompressedTexSubImage2D"); - gles2wCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)get_proc("glCopyTexImage2D"); - gles2wCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)get_proc("glCopyTexSubImage2D"); - gles2wCreateProgram = (PFNGLCREATEPROGRAMPROC)get_proc("glCreateProgram"); - gles2wCreateShader = (PFNGLCREATESHADERPROC)get_proc("glCreateShader"); - gles2wCullFace = (PFNGLCULLFACEPROC)get_proc("glCullFace"); - gles2wDeleteBuffers = (PFNGLDELETEBUFFERSPROC)get_proc("glDeleteBuffers"); - gles2wDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)get_proc("glDeleteFramebuffers"); - gles2wDeleteProgram = (PFNGLDELETEPROGRAMPROC)get_proc("glDeleteProgram"); - gles2wDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)get_proc("glDeleteRenderbuffers"); - gles2wDeleteShader = (PFNGLDELETESHADERPROC)get_proc("glDeleteShader"); - gles2wDeleteTextures = (PFNGLDELETETEXTURESPROC)get_proc("glDeleteTextures"); - gles2wDepthFunc = (PFNGLDEPTHFUNCPROC)get_proc("glDepthFunc"); - gles2wDepthMask = (PFNGLDEPTHMASKPROC)get_proc("glDepthMask"); - gles2wDepthRangef = (PFNGLDEPTHRANGEFPROC)get_proc("glDepthRangef"); - gles2wDetachShader = (PFNGLDETACHSHADERPROC)get_proc("glDetachShader"); - gles2wDisable = (PFNGLDISABLEPROC)get_proc("glDisable"); - gles2wDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)get_proc("glDisableVertexAttribArray"); - gles2wDrawArrays = (PFNGLDRAWARRAYSPROC)get_proc("glDrawArrays"); - gles2wDrawElements = (PFNGLDRAWELEMENTSPROC)get_proc("glDrawElements"); - gles2wEnable = (PFNGLENABLEPROC)get_proc("glEnable"); - gles2wEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)get_proc("glEnableVertexAttribArray"); - gles2wFinish = (PFNGLFINISHPROC)get_proc("glFinish"); - gles2wFlush = (PFNGLFLUSHPROC)get_proc("glFlush"); - gles2wFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)get_proc("glFramebufferRenderbuffer"); - gles2wFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)get_proc("glFramebufferTexture2D"); - gles2wFrontFace = (PFNGLFRONTFACEPROC)get_proc("glFrontFace"); - gles2wGenBuffers = (PFNGLGENBUFFERSPROC)get_proc("glGenBuffers"); - gles2wGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)get_proc("glGenerateMipmap"); - gles2wGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)get_proc("glGenFramebuffers"); - gles2wGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)get_proc("glGenRenderbuffers"); - gles2wGenTextures = (PFNGLGENTEXTURESPROC)get_proc("glGenTextures"); - gles2wGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)get_proc("glGetActiveAttrib"); - gles2wGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)get_proc("glGetActiveUniform"); - gles2wGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)get_proc("glGetAttachedShaders"); - gles2wGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)get_proc("glGetAttribLocation"); - gles2wGetBooleanv = (PFNGLGETBOOLEANVPROC)get_proc("glGetBooleanv"); - gles2wGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)get_proc("glGetBufferParameteriv"); - gles2wGetError = (PFNGLGETERRORPROC)get_proc("glGetError"); - gles2wGetFloatv = (PFNGLGETFLOATVPROC)get_proc("glGetFloatv"); - gles2wGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)get_proc("glGetFramebufferAttachmentParameteriv"); - gles2wGetIntegerv = (PFNGLGETINTEGERVPROC)get_proc("glGetIntegerv"); - gles2wGetProgramiv = (PFNGLGETPROGRAMIVPROC)get_proc("glGetProgramiv"); - gles2wGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)get_proc("glGetProgramInfoLog"); - gles2wGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)get_proc("glGetRenderbufferParameteriv"); - gles2wGetShaderiv = (PFNGLGETSHADERIVPROC)get_proc("glGetShaderiv"); - gles2wGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)get_proc("glGetShaderInfoLog"); - gles2wGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)get_proc("glGetShaderPrecisionFormat"); - gles2wGetShaderSource = (PFNGLGETSHADERSOURCEPROC)get_proc("glGetShaderSource"); - gles2wGetString = (PFNGLGETSTRINGPROC)get_proc("glGetString"); - gles2wGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)get_proc("glGetTexParameterfv"); - gles2wGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)get_proc("glGetTexParameteriv"); - gles2wGetUniformfv = (PFNGLGETUNIFORMFVPROC)get_proc("glGetUniformfv"); - gles2wGetUniformiv = (PFNGLGETUNIFORMIVPROC)get_proc("glGetUniformiv"); - gles2wGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)get_proc("glGetUniformLocation"); - gles2wGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)get_proc("glGetVertexAttribfv"); - gles2wGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)get_proc("glGetVertexAttribiv"); - gles2wGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)get_proc("glGetVertexAttribPointerv"); - gles2wHint = (PFNGLHINTPROC)get_proc("glHint"); - gles2wIsBuffer = (PFNGLISBUFFERPROC)get_proc("glIsBuffer"); - gles2wIsEnabled = (PFNGLISENABLEDPROC)get_proc("glIsEnabled"); - gles2wIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)get_proc("glIsFramebuffer"); - gles2wIsProgram = (PFNGLISPROGRAMPROC)get_proc("glIsProgram"); - gles2wIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)get_proc("glIsRenderbuffer"); - gles2wIsShader = (PFNGLISSHADERPROC)get_proc("glIsShader"); - gles2wIsTexture = (PFNGLISTEXTUREPROC)get_proc("glIsTexture"); - gles2wLineWidth = (PFNGLLINEWIDTHPROC)get_proc("glLineWidth"); - gles2wLinkProgram = (PFNGLLINKPROGRAMPROC)get_proc("glLinkProgram"); - gles2wPixelStorei = (PFNGLPIXELSTOREIPROC)get_proc("glPixelStorei"); - gles2wPolygonOffset = (PFNGLPOLYGONOFFSETPROC)get_proc("glPolygonOffset"); - gles2wReadPixels = (PFNGLREADPIXELSPROC)get_proc("glReadPixels"); - gles2wReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)get_proc("glReleaseShaderCompiler"); - gles2wRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)get_proc("glRenderbufferStorage"); - gles2wSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)get_proc("glSampleCoverage"); - gles2wScissor = (PFNGLSCISSORPROC)get_proc("glScissor"); - gles2wShaderBinary = (PFNGLSHADERBINARYPROC)get_proc("glShaderBinary"); - gles2wShaderSource = (PFNGLSHADERSOURCEPROC)get_proc("glShaderSource"); - gles2wStencilFunc = (PFNGLSTENCILFUNCPROC)get_proc("glStencilFunc"); - gles2wStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)get_proc("glStencilFuncSeparate"); - gles2wStencilMask = (PFNGLSTENCILMASKPROC)get_proc("glStencilMask"); - gles2wStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)get_proc("glStencilMaskSeparate"); - gles2wStencilOp = (PFNGLSTENCILOPPROC)get_proc("glStencilOp"); - gles2wStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)get_proc("glStencilOpSeparate"); - gles2wTexImage2D = (PFNGLTEXIMAGE2DPROC)get_proc("glTexImage2D"); - gles2wTexParameterf = (PFNGLTEXPARAMETERFPROC)get_proc("glTexParameterf"); - gles2wTexParameterfv = (PFNGLTEXPARAMETERFVPROC)get_proc("glTexParameterfv"); - gles2wTexParameteri = (PFNGLTEXPARAMETERIPROC)get_proc("glTexParameteri"); - gles2wTexParameteriv = (PFNGLTEXPARAMETERIVPROC)get_proc("glTexParameteriv"); - gles2wTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)get_proc("glTexSubImage2D"); - gles2wUniform1f = (PFNGLUNIFORM1FPROC)get_proc("glUniform1f"); - gles2wUniform1fv = (PFNGLUNIFORM1FVPROC)get_proc("glUniform1fv"); - gles2wUniform1i = (PFNGLUNIFORM1IPROC)get_proc("glUniform1i"); - gles2wUniform1iv = (PFNGLUNIFORM1IVPROC)get_proc("glUniform1iv"); - gles2wUniform2f = (PFNGLUNIFORM2FPROC)get_proc("glUniform2f"); - gles2wUniform2fv = (PFNGLUNIFORM2FVPROC)get_proc("glUniform2fv"); - gles2wUniform2i = (PFNGLUNIFORM2IPROC)get_proc("glUniform2i"); - gles2wUniform2iv = (PFNGLUNIFORM2IVPROC)get_proc("glUniform2iv"); - gles2wUniform3f = (PFNGLUNIFORM3FPROC)get_proc("glUniform3f"); - gles2wUniform3fv = (PFNGLUNIFORM3FVPROC)get_proc("glUniform3fv"); - gles2wUniform3i = (PFNGLUNIFORM3IPROC)get_proc("glUniform3i"); - gles2wUniform3iv = (PFNGLUNIFORM3IVPROC)get_proc("glUniform3iv"); - gles2wUniform4f = (PFNGLUNIFORM4FPROC)get_proc("glUniform4f"); - gles2wUniform4fv = (PFNGLUNIFORM4FVPROC)get_proc("glUniform4fv"); - gles2wUniform4i = (PFNGLUNIFORM4IPROC)get_proc("glUniform4i"); - gles2wUniform4iv = (PFNGLUNIFORM4IVPROC)get_proc("glUniform4iv"); - gles2wUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)get_proc("glUniformMatrix2fv"); - gles2wUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)get_proc("glUniformMatrix3fv"); - gles2wUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)get_proc("glUniformMatrix4fv"); - gles2wUseProgram = (PFNGLUSEPROGRAMPROC)get_proc("glUseProgram"); - gles2wValidateProgram = (PFNGLVALIDATEPROGRAMPROC)get_proc("glValidateProgram"); - gles2wVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)get_proc("glVertexAttrib1f"); - gles2wVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)get_proc("glVertexAttrib1fv"); - gles2wVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)get_proc("glVertexAttrib2f"); - gles2wVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)get_proc("glVertexAttrib2fv"); - gles2wVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)get_proc("glVertexAttrib3f"); - gles2wVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)get_proc("glVertexAttrib3fv"); - gles2wVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)get_proc("glVertexAttrib4f"); - gles2wVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)get_proc("glVertexAttrib4fv"); - gles2wVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)get_proc("glVertexAttribPointer"); - gles2wViewport = (PFNGLVIEWPORTPROC)get_proc("glViewport"); - gles2wEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)get_proc("glEGLImageTargetTexture2DOES"); - gles2wEGLImageTargetRenderbufferStorageOES = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)get_proc("glEGLImageTargetRenderbufferStorageOES"); - gles2wGetProgramBinaryOES = (PFNGLGETPROGRAMBINARYOESPROC)get_proc("glGetProgramBinaryOES"); - gles2wProgramBinaryOES = (PFNGLPROGRAMBINARYOESPROC)get_proc("glProgramBinaryOES"); - gles2wMapBufferOES = (PFNGLMAPBUFFEROESPROC)get_proc("glMapBufferOES"); - gles2wUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC)get_proc("glUnmapBufferOES"); - gles2wGetBufferPointervOES = (PFNGLGETBUFFERPOINTERVOESPROC)get_proc("glGetBufferPointervOES"); - gles2wTexImage3DOES = (PFNGLTEXIMAGE3DOESPROC)get_proc("glTexImage3DOES"); - gles2wTexSubImage3DOES = (PFNGLTEXSUBIMAGE3DOESPROC)get_proc("glTexSubImage3DOES"); - gles2wCopyTexSubImage3DOES = (PFNGLCOPYTEXSUBIMAGE3DOESPROC)get_proc("glCopyTexSubImage3DOES"); - gles2wCompressedTexImage3DOES = (PFNGLCOMPRESSEDTEXIMAGE3DOESPROC)get_proc("glCompressedTexImage3DOES"); - gles2wCompressedTexSubImage3DOES = (PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC)get_proc("glCompressedTexSubImage3DOES"); - gles2wFramebufferTexture3DOES = (PFNGLFRAMEBUFFERTEXTURE3DOESPROC)get_proc("glFramebufferTexture3DOES"); - gles2wBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC)get_proc("glBindVertexArrayOES"); - gles2wDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC)get_proc("glDeleteVertexArraysOES"); - gles2wGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)get_proc("glGenVertexArraysOES"); - gles2wIsVertexArrayOES = (PFNGLISVERTEXARRAYOESPROC)get_proc("glIsVertexArrayOES"); - gles2wDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC)get_proc("glDebugMessageControlKHR"); - gles2wDebugMessageInsertKHR = (PFNGLDEBUGMESSAGEINSERTKHRPROC)get_proc("glDebugMessageInsertKHR"); - gles2wDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)get_proc("glDebugMessageCallbackKHR"); - gles2wGetDebugMessageLogKHR = (PFNGLGETDEBUGMESSAGELOGKHRPROC)get_proc("glGetDebugMessageLogKHR"); - gles2wPushDebugGroupKHR = (PFNGLPUSHDEBUGGROUPKHRPROC)get_proc("glPushDebugGroupKHR"); - gles2wPopDebugGroupKHR = (PFNGLPOPDEBUGGROUPKHRPROC)get_proc("glPopDebugGroupKHR"); - gles2wObjectLabelKHR = (PFNGLOBJECTLABELKHRPROC)get_proc("glObjectLabelKHR"); - gles2wGetObjectLabelKHR = (PFNGLGETOBJECTLABELKHRPROC)get_proc("glGetObjectLabelKHR"); - gles2wObjectPtrLabelKHR = (PFNGLOBJECTPTRLABELKHRPROC)get_proc("glObjectPtrLabelKHR"); - gles2wGetObjectPtrLabelKHR = (PFNGLGETOBJECTPTRLABELKHRPROC)get_proc("glGetObjectPtrLabelKHR"); - gles2wGetPointervKHR = (PFNGLGETPOINTERVKHRPROC)get_proc("glGetPointervKHR"); - gles2wGetPerfMonitorGroupsAMD = (PFNGLGETPERFMONITORGROUPSAMDPROC)get_proc("glGetPerfMonitorGroupsAMD"); - gles2wGetPerfMonitorCountersAMD = (PFNGLGETPERFMONITORCOUNTERSAMDPROC)get_proc("glGetPerfMonitorCountersAMD"); - gles2wGetPerfMonitorGroupStringAMD = (PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)get_proc("glGetPerfMonitorGroupStringAMD"); - gles2wGetPerfMonitorCounterStringAMD = (PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)get_proc("glGetPerfMonitorCounterStringAMD"); - gles2wGetPerfMonitorCounterInfoAMD = (PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)get_proc("glGetPerfMonitorCounterInfoAMD"); - gles2wGenPerfMonitorsAMD = (PFNGLGENPERFMONITORSAMDPROC)get_proc("glGenPerfMonitorsAMD"); - gles2wDeletePerfMonitorsAMD = (PFNGLDELETEPERFMONITORSAMDPROC)get_proc("glDeletePerfMonitorsAMD"); - gles2wSelectPerfMonitorCountersAMD = (PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)get_proc("glSelectPerfMonitorCountersAMD"); - gles2wBeginPerfMonitorAMD = (PFNGLBEGINPERFMONITORAMDPROC)get_proc("glBeginPerfMonitorAMD"); - gles2wEndPerfMonitorAMD = (PFNGLENDPERFMONITORAMDPROC)get_proc("glEndPerfMonitorAMD"); - gles2wGetPerfMonitorCounterDataAMD = (PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)get_proc("glGetPerfMonitorCounterDataAMD"); - gles2wBlitFramebufferANGLE = (PFNGLBLITFRAMEBUFFERANGLEPROC)get_proc("glBlitFramebufferANGLE"); - gles2wRenderbufferStorageMultisampleANGLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)get_proc("glRenderbufferStorageMultisampleANGLE"); - gles2wDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC)get_proc("glDrawArraysInstancedANGLE"); - gles2wDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)get_proc("glDrawElementsInstancedANGLE"); - gles2wVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC)get_proc("glVertexAttribDivisorANGLE"); - gles2wGetTranslatedShaderSourceANGLE = (PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)get_proc("glGetTranslatedShaderSourceANGLE"); - gles2wDrawArraysInstancedEXT = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)get_proc("glDrawArraysInstancedEXT"); - gles2wDrawElementsInstancedEXT = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)get_proc("glDrawElementsInstancedEXT"); - gles2wVertexAttribDivisorEXT = (PFNGLVERTEXATTRIBDIVISOREXTPROC)get_proc("glVertexAttribDivisorEXT"); - gles2wCopyTextureLevelsAPPLE = (PFNGLCOPYTEXTURELEVELSAPPLEPROC)get_proc("glCopyTextureLevelsAPPLE"); - gles2wRenderbufferStorageMultisampleAPPLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC)get_proc("glRenderbufferStorageMultisampleAPPLE"); - gles2wResolveMultisampleFramebufferAPPLE = (PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC)get_proc("glResolveMultisampleFramebufferAPPLE"); - gles2wFenceSyncAPPLE = (PFNGLFENCESYNCAPPLEPROC)get_proc("glFenceSyncAPPLE"); - gles2wIsSyncAPPLE = (PFNGLISSYNCAPPLEPROC)get_proc("glIsSyncAPPLE"); - gles2wDeleteSyncAPPLE = (PFNGLDELETESYNCAPPLEPROC)get_proc("glDeleteSyncAPPLE"); - gles2wClientWaitSyncAPPLE = (PFNGLCLIENTWAITSYNCAPPLEPROC)get_proc("glClientWaitSyncAPPLE"); - gles2wWaitSyncAPPLE = (PFNGLWAITSYNCAPPLEPROC)get_proc("glWaitSyncAPPLE"); - gles2wGetInteger64vAPPLE = (PFNGLGETINTEGER64VAPPLEPROC)get_proc("glGetInteger64vAPPLE"); - gles2wGetSyncivAPPLE = (PFNGLGETSYNCIVAPPLEPROC)get_proc("glGetSyncivAPPLE"); - gles2wLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC)get_proc("glLabelObjectEXT"); - gles2wGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC)get_proc("glGetObjectLabelEXT"); - gles2wInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)get_proc("glInsertEventMarkerEXT"); - gles2wPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)get_proc("glPushGroupMarkerEXT"); - gles2wPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)get_proc("glPopGroupMarkerEXT"); - gles2wDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)get_proc("glDiscardFramebufferEXT"); - gles2wGenQueriesEXT = (PFNGLGENQUERIESEXTPROC)get_proc("glGenQueriesEXT"); - gles2wDeleteQueriesEXT = (PFNGLDELETEQUERIESEXTPROC)get_proc("glDeleteQueriesEXT"); - gles2wIsQueryEXT = (PFNGLISQUERYEXTPROC)get_proc("glIsQueryEXT"); - gles2wBeginQueryEXT = (PFNGLBEGINQUERYEXTPROC)get_proc("glBeginQueryEXT"); - gles2wEndQueryEXT = (PFNGLENDQUERYEXTPROC)get_proc("glEndQueryEXT"); - gles2wQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)get_proc("glQueryCounterEXT"); - gles2wGetQueryivEXT = (PFNGLGETQUERYIVEXTPROC)get_proc("glGetQueryivEXT"); - gles2wGetQueryObjectivEXT = (PFNGLGETQUERYOBJECTIVEXTPROC)get_proc("glGetQueryObjectivEXT"); - gles2wGetQueryObjectuivEXT = (PFNGLGETQUERYOBJECTUIVEXTPROC)get_proc("glGetQueryObjectuivEXT"); - gles2wGetQueryObjecti64vEXT = (PFNGLGETQUERYOBJECTI64VEXTPROC)get_proc("glGetQueryObjecti64vEXT"); - gles2wGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)get_proc("glGetQueryObjectui64vEXT"); - gles2wMapBufferRangeEXT = (PFNGLMAPBUFFERRANGEEXTPROC)get_proc("glMapBufferRangeEXT"); - gles2wFlushMappedBufferRangeEXT = (PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC)get_proc("glFlushMappedBufferRangeEXT"); - gles2wRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)get_proc("glRenderbufferStorageMultisampleEXT"); - gles2wFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)get_proc("glFramebufferTexture2DMultisampleEXT"); - gles2wReadBufferIndexedEXT = (PFNGLREADBUFFERINDEXEDEXTPROC)get_proc("glReadBufferIndexedEXT"); - gles2wDrawBuffersIndexedEXT = (PFNGLDRAWBUFFERSINDEXEDEXTPROC)get_proc("glDrawBuffersIndexedEXT"); - gles2wGetIntegeri_vEXT = (PFNGLGETINTEGERI_VEXTPROC)get_proc("glGetIntegeri_vEXT"); - gles2wMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC)get_proc("glMultiDrawArraysEXT"); - gles2wMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC)get_proc("glMultiDrawElementsEXT"); - gles2wGetGraphicsResetStatusEXT = (PFNGLGETGRAPHICSRESETSTATUSEXTPROC)get_proc("glGetGraphicsResetStatusEXT"); - gles2wReadnPixelsEXT = (PFNGLREADNPIXELSEXTPROC)get_proc("glReadnPixelsEXT"); - gles2wGetnUniformfvEXT = (PFNGLGETNUNIFORMFVEXTPROC)get_proc("glGetnUniformfvEXT"); - gles2wGetnUniformivEXT = (PFNGLGETNUNIFORMIVEXTPROC)get_proc("glGetnUniformivEXT"); - gles2wUseProgramStagesEXT = (PFNGLUSEPROGRAMSTAGESEXTPROC)get_proc("glUseProgramStagesEXT"); - gles2wActiveShaderProgramEXT = (PFNGLACTIVESHADERPROGRAMEXTPROC)get_proc("glActiveShaderProgramEXT"); - gles2wCreateShaderProgramvEXT = (PFNGLCREATESHADERPROGRAMVEXTPROC)get_proc("glCreateShaderProgramvEXT"); - gles2wBindProgramPipelineEXT = (PFNGLBINDPROGRAMPIPELINEEXTPROC)get_proc("glBindProgramPipelineEXT"); - gles2wDeleteProgramPipelinesEXT = (PFNGLDELETEPROGRAMPIPELINESEXTPROC)get_proc("glDeleteProgramPipelinesEXT"); - gles2wGenProgramPipelinesEXT = (PFNGLGENPROGRAMPIPELINESEXTPROC)get_proc("glGenProgramPipelinesEXT"); - gles2wIsProgramPipelineEXT = (PFNGLISPROGRAMPIPELINEEXTPROC)get_proc("glIsProgramPipelineEXT"); - gles2wProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)get_proc("glProgramParameteriEXT"); - gles2wGetProgramPipelineivEXT = (PFNGLGETPROGRAMPIPELINEIVEXTPROC)get_proc("glGetProgramPipelineivEXT"); - gles2wProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC)get_proc("glProgramUniform1iEXT"); - gles2wProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC)get_proc("glProgramUniform2iEXT"); - gles2wProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC)get_proc("glProgramUniform3iEXT"); - gles2wProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC)get_proc("glProgramUniform4iEXT"); - gles2wProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC)get_proc("glProgramUniform1fEXT"); - gles2wProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC)get_proc("glProgramUniform2fEXT"); - gles2wProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC)get_proc("glProgramUniform3fEXT"); - gles2wProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC)get_proc("glProgramUniform4fEXT"); - gles2wProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC)get_proc("glProgramUniform1ivEXT"); - gles2wProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC)get_proc("glProgramUniform2ivEXT"); - gles2wProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC)get_proc("glProgramUniform3ivEXT"); - gles2wProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC)get_proc("glProgramUniform4ivEXT"); - gles2wProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC)get_proc("glProgramUniform1fvEXT"); - gles2wProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC)get_proc("glProgramUniform2fvEXT"); - gles2wProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC)get_proc("glProgramUniform3fvEXT"); - gles2wProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC)get_proc("glProgramUniform4fvEXT"); - gles2wProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)get_proc("glProgramUniformMatrix2fvEXT"); - gles2wProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)get_proc("glProgramUniformMatrix3fvEXT"); - gles2wProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)get_proc("glProgramUniformMatrix4fvEXT"); - gles2wValidateProgramPipelineEXT = (PFNGLVALIDATEPROGRAMPIPELINEEXTPROC)get_proc("glValidateProgramPipelineEXT"); - gles2wGetProgramPipelineInfoLogEXT = (PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC)get_proc("glGetProgramPipelineInfoLogEXT"); - gles2wTexStorage1DEXT = (PFNGLTEXSTORAGE1DEXTPROC)get_proc("glTexStorage1DEXT"); - gles2wTexStorage2DEXT = (PFNGLTEXSTORAGE2DEXTPROC)get_proc("glTexStorage2DEXT"); - gles2wTexStorage3DEXT = (PFNGLTEXSTORAGE3DEXTPROC)get_proc("glTexStorage3DEXT"); - gles2wTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC)get_proc("glTextureStorage1DEXT"); - gles2wTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)get_proc("glTextureStorage2DEXT"); - gles2wTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)get_proc("glTextureStorage3DEXT"); - gles2wRenderbufferStorageMultisampleIMG = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC)get_proc("glRenderbufferStorageMultisampleIMG"); - gles2wFramebufferTexture2DMultisampleIMG = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC)get_proc("glFramebufferTexture2DMultisampleIMG"); - gles2wCoverageMaskNV = (PFNGLCOVERAGEMASKNVPROC)get_proc("glCoverageMaskNV"); - gles2wCoverageOperationNV = (PFNGLCOVERAGEOPERATIONNVPROC)get_proc("glCoverageOperationNV"); - gles2wDrawBuffersNV = (PFNGLDRAWBUFFERSNVPROC)get_proc("glDrawBuffersNV"); - gles2wDrawArraysInstancedNV = (PFNGLDRAWARRAYSINSTANCEDNVPROC)get_proc("glDrawArraysInstancedNV"); - gles2wDrawElementsInstancedNV = (PFNGLDRAWELEMENTSINSTANCEDNVPROC)get_proc("glDrawElementsInstancedNV"); - gles2wDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)get_proc("glDeleteFencesNV"); - gles2wGenFencesNV = (PFNGLGENFENCESNVPROC)get_proc("glGenFencesNV"); - gles2wIsFenceNV = (PFNGLISFENCENVPROC)get_proc("glIsFenceNV"); - gles2wTestFenceNV = (PFNGLTESTFENCENVPROC)get_proc("glTestFenceNV"); - gles2wGetFenceivNV = (PFNGLGETFENCEIVNVPROC)get_proc("glGetFenceivNV"); - gles2wFinishFenceNV = (PFNGLFINISHFENCENVPROC)get_proc("glFinishFenceNV"); - gles2wSetFenceNV = (PFNGLSETFENCENVPROC)get_proc("glSetFenceNV"); - gles2wBlitFramebufferNV = (PFNGLBLITFRAMEBUFFERNVPROC)get_proc("glBlitFramebufferNV"); - gles2wRenderbufferStorageMultisampleNV = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC)get_proc("glRenderbufferStorageMultisampleNV"); - gles2wVertexAttribDivisorNV = (PFNGLVERTEXATTRIBDIVISORNVPROC)get_proc("glVertexAttribDivisorNV"); - gles2wReadBufferNV = (PFNGLREADBUFFERNVPROC)get_proc("glReadBufferNV"); - gles2wAlphaFuncQCOM = (PFNGLALPHAFUNCQCOMPROC)get_proc("glAlphaFuncQCOM"); - gles2wGetDriverControlsQCOM = (PFNGLGETDRIVERCONTROLSQCOMPROC)get_proc("glGetDriverControlsQCOM"); - gles2wGetDriverControlStringQCOM = (PFNGLGETDRIVERCONTROLSTRINGQCOMPROC)get_proc("glGetDriverControlStringQCOM"); - gles2wEnableDriverControlQCOM = (PFNGLENABLEDRIVERCONTROLQCOMPROC)get_proc("glEnableDriverControlQCOM"); - gles2wDisableDriverControlQCOM = (PFNGLDISABLEDRIVERCONTROLQCOMPROC)get_proc("glDisableDriverControlQCOM"); - gles2wExtGetTexturesQCOM = (PFNGLEXTGETTEXTURESQCOMPROC)get_proc("glExtGetTexturesQCOM"); - gles2wExtGetBuffersQCOM = (PFNGLEXTGETBUFFERSQCOMPROC)get_proc("glExtGetBuffersQCOM"); - gles2wExtGetRenderbuffersQCOM = (PFNGLEXTGETRENDERBUFFERSQCOMPROC)get_proc("glExtGetRenderbuffersQCOM"); - gles2wExtGetFramebuffersQCOM = (PFNGLEXTGETFRAMEBUFFERSQCOMPROC)get_proc("glExtGetFramebuffersQCOM"); - gles2wExtGetTexLevelParameterivQCOM = (PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC)get_proc("glExtGetTexLevelParameterivQCOM"); - gles2wExtTexObjectStateOverrideiQCOM = (PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC)get_proc("glExtTexObjectStateOverrideiQCOM"); - gles2wExtGetTexSubImageQCOM = (PFNGLEXTGETTEXSUBIMAGEQCOMPROC)get_proc("glExtGetTexSubImageQCOM"); - gles2wExtGetBufferPointervQCOM = (PFNGLEXTGETBUFFERPOINTERVQCOMPROC)get_proc("glExtGetBufferPointervQCOM"); - gles2wExtGetShadersQCOM = (PFNGLEXTGETSHADERSQCOMPROC)get_proc("glExtGetShadersQCOM"); - gles2wExtGetProgramsQCOM = (PFNGLEXTGETPROGRAMSQCOMPROC)get_proc("glExtGetProgramsQCOM"); - gles2wExtIsProgramBinaryQCOM = (PFNGLEXTISPROGRAMBINARYQCOMPROC)get_proc("glExtIsProgramBinaryQCOM"); - gles2wExtGetProgramBinarySourceQCOM = (PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC)get_proc("glExtGetProgramBinarySourceQCOM"); - gles2wStartTilingQCOM = (PFNGLSTARTTILINGQCOMPROC)get_proc("glStartTilingQCOM"); - gles2wEndTilingQCOM = (PFNGLENDTILINGQCOMPROC)get_proc("glEndTilingQCOM"); -} diff --git a/native/cocos/renderer/gfx-gles2/gles2w.h b/native/cocos/renderer/gfx-gles2/gles2w.h deleted file mode 100755 index 1f5987572e..0000000000 --- a/native/cocos/renderer/gfx-gles2/gles2w.h +++ /dev/null @@ -1,996 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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. -****************************************************************************/ -#pragma once - -#if defined(__APPLE__) || defined(__APPLE_CC__) - #include - #if TARGET_OS_IPHONE - #include - // Prevent Apple's non-standard extension header from being included - #define __gl_es20ext_h_ - #else - #include - #endif -#else - #include -#endif - -#include -#include -#include - -typedef khronos_int64_t GLint64EXT; -typedef khronos_uint64_t GLuint64EXT; - -#ifndef __gl2_h_ - #define __gl2_h_ -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef GL_EXT_texture_sRGB - #define GL_EXT_texture_sRGB 1 - - #define GL_SRGB_EXT 0x8C40 - #define GL_SRGB8_EXT 0x8C41 - #define GL_SRGB_ALPHA_EXT 0x8C42 - #define GL_SRGB8_ALPHA8_EXT 0x8C43 - #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 - -#endif /* GL_EXT_texture_sRGB */ - -/* gles2w api */ -int gles2wInit(void); -int gles2wIsSupported(int major, int minor); -void *gles2wGetProcAddress(const char *proc); - -/* OpenGL functions */ -typedef void(GL_APIENTRY *PFNGLACTIVETEXTUREPROC)(GLenum texture); -typedef void(GL_APIENTRY *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); -typedef void(GL_APIENTRY *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); -typedef void(GL_APIENTRY *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); -typedef void(GL_APIENTRY *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); -typedef void(GL_APIENTRY *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -typedef void(GL_APIENTRY *PFNGLBLENDCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void(GL_APIENTRY *PFNGLBLENDEQUATIONPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); -typedef void(GL_APIENTRY *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -typedef void(GL_APIENTRY *PFNGLBLENDFUNCSEPARATEPROC)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void(GL_APIENTRY *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void(GL_APIENTRY *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef GLenum(GL_APIENTRY *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLCLEARPROC)(GLbitfield mask); -typedef void(GL_APIENTRY *PFNGLCLEARCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void(GL_APIENTRY *PFNGLCLEARDEPTHFPROC)(GLclampf depth); -typedef void(GL_APIENTRY *PFNGLCLEARSTENCILPROC)(GLint s); -typedef void(GL_APIENTRY *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -typedef void(GL_APIENTRY *PFNGLCOMPILESHADERPROC)(GLuint shader); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void(GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef GLuint(GL_APIENTRY *PFNGLCREATEPROGRAMPROC)(void); -typedef GLuint(GL_APIENTRY *PFNGLCREATESHADERPROC)(GLenum type); -typedef void(GL_APIENTRY *PFNGLCULLFACEPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); -typedef void(GL_APIENTRY *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); -typedef void(GL_APIENTRY *PFNGLDELETEPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); -typedef void(GL_APIENTRY *PFNGLDELETESHADERPROC)(GLuint shader); -typedef void(GL_APIENTRY *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); -typedef void(GL_APIENTRY *PFNGLDEPTHFUNCPROC)(GLenum func); -typedef void(GL_APIENTRY *PFNGLDEPTHMASKPROC)(GLboolean flag); -typedef void(GL_APIENTRY *PFNGLDEPTHRANGEFPROC)(GLclampf zNear, GLclampf zFar); -typedef void(GL_APIENTRY *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); -typedef void(GL_APIENTRY *PFNGLDISABLEPROC)(GLenum cap); -typedef void(GL_APIENTRY *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); -typedef void(GL_APIENTRY *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -typedef void(GL_APIENTRY *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -typedef void(GL_APIENTRY *PFNGLENABLEPROC)(GLenum cap); -typedef void(GL_APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); -typedef void(GL_APIENTRY *PFNGLFINISHPROC)(void); -typedef void(GL_APIENTRY *PFNGLFLUSHPROC)(void); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void(GL_APIENTRY *PFNGLFRONTFACEPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); -typedef void(GL_APIENTRY *PFNGLGENERATEMIPMAPPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); -typedef void(GL_APIENTRY *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); -typedef void(GL_APIENTRY *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); -typedef void(GL_APIENTRY *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders); -typedef GLint(GL_APIENTRY *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *params); -typedef void(GL_APIENTRY *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef GLenum(GL_APIENTRY *PFNGLGETERRORPROC)(void); -typedef void(GL_APIENTRY *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETINTEGERVPROC)(GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog); -typedef void(GL_APIENTRY *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog); -typedef void(GL_APIENTRY *PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -typedef void(GL_APIENTRY *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -typedef const GLubyte *(GL_APIENTRY *PFNGLGETSTRINGPROC)(GLenum name); -typedef void(GL_APIENTRY *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); -typedef GLint(GL_APIENTRY *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, GLvoid **pointer); -typedef void(GL_APIENTRY *PFNGLHINTPROC)(GLenum target, GLenum mode); -typedef GLboolean(GL_APIENTRY *PFNGLISBUFFERPROC)(GLuint buffer); -typedef GLboolean(GL_APIENTRY *PFNGLISENABLEDPROC)(GLenum cap); -typedef GLboolean(GL_APIENTRY *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); -typedef GLboolean(GL_APIENTRY *PFNGLISPROGRAMPROC)(GLuint program); -typedef GLboolean(GL_APIENTRY *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); -typedef GLboolean(GL_APIENTRY *PFNGLISSHADERPROC)(GLuint shader); -typedef GLboolean(GL_APIENTRY *PFNGLISTEXTUREPROC)(GLuint texture); -typedef void(GL_APIENTRY *PFNGLLINEWIDTHPROC)(GLfloat width); -typedef void(GL_APIENTRY *PFNGLLINKPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); -typedef void(GL_APIENTRY *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); -typedef void(GL_APIENTRY *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLRELEASESHADERCOMPILERPROC)(void); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLSAMPLECOVERAGEPROC)(GLclampf value, GLboolean invert); -typedef void(GL_APIENTRY *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLSHADERBINARYPROC)(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); -typedef void(GL_APIENTRY *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length); -typedef void(GL_APIENTRY *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILMASKPROC)(GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); -typedef void(GL_APIENTRY *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -typedef void(GL_APIENTRY *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); -typedef void(GL_APIENTRY *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLUNIFORM1FPROC)(GLint location, GLfloat x); -typedef void(GL_APIENTRY *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM1IPROC)(GLint location, GLint x); -typedef void(GL_APIENTRY *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM2FPROC)(GLint location, GLfloat x, GLfloat y); -typedef void(GL_APIENTRY *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM2IPROC)(GLint location, GLint x, GLint y); -typedef void(GL_APIENTRY *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM3FPROC)(GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void(GL_APIENTRY *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM3IPROC)(GLint location, GLint x, GLint y, GLint z); -typedef void(GL_APIENTRY *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM4FPROC)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void(GL_APIENTRY *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM4IPROC)(GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void(GL_APIENTRY *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUSEPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLVALIDATEPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB1FPROC)(GLuint indx, GLfloat x); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB1FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB2FPROC)(GLuint indx, GLfloat x, GLfloat y); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB2FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB3FPROC)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB3FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB4FPROC)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB4FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr); -typedef void(GL_APIENTRY *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum target, GLeglImageOES image); -typedef void(GL_APIENTRY *PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)(GLenum target, GLeglImageOES image); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMBINARYOESPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void(GL_APIENTRY *PFNGLPROGRAMBINARYOESPROC)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -typedef void *(GL_APIENTRY *PFNGLMAPBUFFEROESPROC)(GLenum target, GLenum access); -typedef GLboolean(GL_APIENTRY *PFNGLUNMAPBUFFEROESPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLGETBUFFERPOINTERVOESPROC)(GLenum target, GLenum pname, GLvoid **params); -typedef void(GL_APIENTRY *PFNGLTEXIMAGE3DOESPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLTEXSUBIMAGE3DOESPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE3DOESPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE3DOESPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE3DOESPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void(GL_APIENTRY *PFNGLBINDVERTEXARRAYOESPROC)(GLuint array); -typedef void(GL_APIENTRY *PFNGLDELETEVERTEXARRAYSOESPROC)(GLsizei n, const GLuint *arrays); -typedef void(GL_APIENTRY *PFNGLGENVERTEXARRAYSOESPROC)(GLsizei n, GLuint *arrays); -typedef GLboolean(GL_APIENTRY *PFNGLISVERTEXARRAYOESPROC)(GLuint array); -typedef void(GL_APIENTRY *PFNGLDEBUGMESSAGECONTROLKHRPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void(GL_APIENTRY *PFNGLDEBUGMESSAGEINSERTKHRPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void(GL_APIENTRY *PFNGLDEBUGMESSAGECALLBACKKHRPROC)(GLDEBUGPROCKHR callback, const void *userParam); -typedef GLuint(GL_APIENTRY *PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void(GL_APIENTRY *PFNGLPUSHDEBUGGROUPKHRPROC)(GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void(GL_APIENTRY *PFNGLPOPDEBUGGROUPKHRPROC)(void); -typedef void(GL_APIENTRY *PFNGLOBJECTLABELKHRPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void(GL_APIENTRY *PFNGLGETOBJECTLABELKHRPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void(GL_APIENTRY *PFNGLOBJECTPTRLABELKHRPROC)(const void *ptr, GLsizei length, const GLchar *label); -typedef void(GL_APIENTRY *PFNGLGETOBJECTPTRLABELKHRPROC)(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void(GL_APIENTRY *PFNGLGETPOINTERVKHRPROC)(GLenum pname, void **params); -typedef void(GL_APIENTRY *PFNGLGETPERFMONITORGROUPSAMDPROC)(GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void(GL_APIENTRY *PFNGLGETPERFMONITORCOUNTERSAMDPROC)(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void(GL_APIENTRY *PFNGLGETPERFMONITORGROUPSTRINGAMDPROC)(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void(GL_APIENTRY *PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC)(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void(GL_APIENTRY *PFNGLGETPERFMONITORCOUNTERINFOAMDPROC)(GLuint group, GLuint counter, GLenum pname, GLvoid *data); -typedef void(GL_APIENTRY *PFNGLGENPERFMONITORSAMDPROC)(GLsizei n, GLuint *monitors); -typedef void(GL_APIENTRY *PFNGLDELETEPERFMONITORSAMDPROC)(GLsizei n, GLuint *monitors); -typedef void(GL_APIENTRY *PFNGLSELECTPERFMONITORCOUNTERSAMDPROC)(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -typedef void(GL_APIENTRY *PFNGLBEGINPERFMONITORAMDPROC)(GLuint monitor); -typedef void(GL_APIENTRY *PFNGLENDPERFMONITORAMDPROC)(GLuint monitor); -typedef void(GL_APIENTRY *PFNGLGETPERFMONITORCOUNTERDATAAMDPROC)(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -typedef void(GL_APIENTRY *PFNGLBLITFRAMEBUFFERANGLEPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLDRAWARRAYSINSTANCEDANGLEPROC)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void(GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDANGLEPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBDIVISORANGLEPROC)(GLuint index, GLuint divisor); -typedef void(GL_APIENTRY *PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -typedef void(GL_APIENTRY *PFNGLDRAWARRAYSINSTANCEDEXTPROC)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void(GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDEXTPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBDIVISOREXTPROC)(GLuint index, GLuint divisor); -typedef void(GL_APIENTRY *PFNGLCOPYTEXTURELEVELSAPPLEPROC)(GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); -typedef void(GL_APIENTRY *PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC)(void); -typedef GLsync(GL_APIENTRY *PFNGLFENCESYNCAPPLEPROC)(GLenum condition, GLbitfield flags); -typedef GLboolean(GL_APIENTRY *PFNGLISSYNCAPPLEPROC)(GLsync sync); -typedef void(GL_APIENTRY *PFNGLDELETESYNCAPPLEPROC)(GLsync sync); -typedef GLenum(GL_APIENTRY *PFNGLCLIENTWAITSYNCAPPLEPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void(GL_APIENTRY *PFNGLWAITSYNCAPPLEPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void(GL_APIENTRY *PFNGLGETINTEGER64VAPPLEPROC)(GLenum pname, GLint64 *params); -typedef void(GL_APIENTRY *PFNGLGETSYNCIVAPPLEPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -typedef void(GL_APIENTRY *PFNGLLABELOBJECTEXTPROC)(GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void(GL_APIENTRY *PFNGLGETOBJECTLABELEXTPROC)(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void(GL_APIENTRY *PFNGLINSERTEVENTMARKEREXTPROC)(GLsizei length, const GLchar *marker); -typedef void(GL_APIENTRY *PFNGLPUSHGROUPMARKEREXTPROC)(GLsizei length, const GLchar *marker); -typedef void(GL_APIENTRY *PFNGLPOPGROUPMARKEREXTPROC)(void); -typedef void(GL_APIENTRY *PFNGLDISCARDFRAMEBUFFEREXTPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments); -typedef void(GL_APIENTRY *PFNGLGENQUERIESEXTPROC)(GLsizei n, GLuint *ids); -typedef void(GL_APIENTRY *PFNGLDELETEQUERIESEXTPROC)(GLsizei n, const GLuint *ids); -typedef GLboolean(GL_APIENTRY *PFNGLISQUERYEXTPROC)(GLuint id); -typedef void(GL_APIENTRY *PFNGLBEGINQUERYEXTPROC)(GLenum target, GLuint id); -typedef void(GL_APIENTRY *PFNGLENDQUERYEXTPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLQUERYCOUNTEREXTPROC)(GLuint id, GLenum target); -typedef void(GL_APIENTRY *PFNGLGETQUERYIVEXTPROC)(GLenum target, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETQUERYOBJECTIVEXTPROC)(GLuint id, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETQUERYOBJECTUIVEXTPROC)(GLuint id, GLenum pname, GLuint *params); -typedef void(GL_APIENTRY *PFNGLGETQUERYOBJECTI64VEXTPROC)(GLuint id, GLenum pname, GLint64EXT *params); -typedef void(GL_APIENTRY *PFNGLGETQUERYOBJECTUI64VEXTPROC)(GLuint id, GLenum pname, GLuint64EXT *params); -typedef void *(GL_APIENTRY *PFNGLMAPBUFFERRANGEEXTPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void(GL_APIENTRY *PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC)(GLenum target, GLintptr offset, GLsizeiptr length); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -typedef void(GL_APIENTRY *PFNGLREADBUFFERINDEXEDEXTPROC)(GLenum src, GLint index); -typedef void(GL_APIENTRY *PFNGLDRAWBUFFERSINDEXEDEXTPROC)(GLint n, const GLenum *location, const GLint *indices); -typedef void(GL_APIENTRY *PFNGLGETINTEGERI_VEXTPROC)(GLenum target, GLuint index, GLint *data); -typedef void(GL_APIENTRY *PFNGLMULTIDRAWARRAYSEXTPROC)(GLenum, const GLint *, const GLsizei *, GLsizei); -//typedef void (GL_APIENTRY* PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -typedef GLenum(GL_APIENTRY *PFNGLGETGRAPHICSRESETSTATUSEXTPROC)(void); -typedef void(GL_APIENTRY *PFNGLREADNPIXELSEXTPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void(GL_APIENTRY *PFNGLGETNUNIFORMFVEXTPROC)(GLuint program, GLint location, GLsizei bufSize, float *params); -typedef void(GL_APIENTRY *PFNGLGETNUNIFORMIVEXTPROC)(GLuint program, GLint location, GLsizei bufSize, GLint *params); -typedef void(GL_APIENTRY *PFNGLUSEPROGRAMSTAGESEXTPROC)(GLuint pipeline, GLbitfield stages, GLuint program); -typedef void(GL_APIENTRY *PFNGLACTIVESHADERPROGRAMEXTPROC)(GLuint pipeline, GLuint program); -typedef GLuint(GL_APIENTRY *PFNGLCREATESHADERPROGRAMVEXTPROC)(GLenum type, GLsizei count, const GLchar **strings); -typedef void(GL_APIENTRY *PFNGLBINDPROGRAMPIPELINEEXTPROC)(GLuint pipeline); -typedef void(GL_APIENTRY *PFNGLDELETEPROGRAMPIPELINESEXTPROC)(GLsizei n, const GLuint *pipelines); -typedef void(GL_APIENTRY *PFNGLGENPROGRAMPIPELINESEXTPROC)(GLsizei n, GLuint *pipelines); -typedef GLboolean(GL_APIENTRY *PFNGLISPROGRAMPIPELINEEXTPROC)(GLuint pipeline); -typedef void(GL_APIENTRY *PFNGLPROGRAMPARAMETERIEXTPROC)(GLuint program, GLenum pname, GLint value); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMPIPELINEIVEXTPROC)(GLuint pipeline, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1IEXTPROC)(GLuint program, GLint location, GLint x); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2IEXTPROC)(GLuint program, GLint location, GLint x, GLint y); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3IEXTPROC)(GLuint program, GLint location, GLint x, GLint y, GLint z); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4IEXTPROC)(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1FEXTPROC)(GLuint program, GLint location, GLfloat x); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2FEXTPROC)(GLuint program, GLint location, GLfloat x, GLfloat y); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3FEXTPROC)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4FEXTPROC)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLVALIDATEPROGRAMPIPELINEEXTPROC)(GLuint pipeline); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void(GL_APIENTRY *PFNGLTEXSTORAGE1DEXTPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void(GL_APIENTRY *PFNGLTEXSTORAGE2DEXTPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLTEXSTORAGE3DEXTPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void(GL_APIENTRY *PFNGLTEXTURESTORAGE1DEXTPROC)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void(GL_APIENTRY *PFNGLTEXTURESTORAGE2DEXTPROC)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLTEXTURESTORAGE3DEXTPROC)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -typedef void(GL_APIENTRY *PFNGLCOVERAGEMASKNVPROC)(GLboolean mask); -typedef void(GL_APIENTRY *PFNGLCOVERAGEOPERATIONNVPROC)(GLenum operation); -typedef void(GL_APIENTRY *PFNGLDRAWBUFFERSNVPROC)(GLsizei n, const GLenum *bufs); -typedef void(GL_APIENTRY *PFNGLDRAWARRAYSINSTANCEDNVPROC)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void(GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDNVPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -typedef void(GL_APIENTRY *PFNGLDELETEFENCESNVPROC)(GLsizei, const GLuint *); -typedef void(GL_APIENTRY *PFNGLGENFENCESNVPROC)(GLsizei, GLuint *); -typedef GLboolean(GL_APIENTRY *PFNGLISFENCENVPROC)(GLuint); -typedef GLboolean(GL_APIENTRY *PFNGLTESTFENCENVPROC)(GLuint); -typedef void(GL_APIENTRY *PFNGLGETFENCEIVNVPROC)(GLuint, GLenum, GLint *); -typedef void(GL_APIENTRY *PFNGLFINISHFENCENVPROC)(GLuint); -typedef void(GL_APIENTRY *PFNGLSETFENCENVPROC)(GLuint, GLenum); -typedef void(GL_APIENTRY *PFNGLBLITFRAMEBUFFERNVPROC)(int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBDIVISORNVPROC)(GLuint index, GLuint divisor); -typedef void(GL_APIENTRY *PFNGLREADBUFFERNVPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLALPHAFUNCQCOMPROC)(GLenum func, GLclampf ref); -typedef void(GL_APIENTRY *PFNGLGETDRIVERCONTROLSQCOMPROC)(GLint *num, GLsizei size, GLuint *driverControls); -typedef void(GL_APIENTRY *PFNGLGETDRIVERCONTROLSTRINGQCOMPROC)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -typedef void(GL_APIENTRY *PFNGLENABLEDRIVERCONTROLQCOMPROC)(GLuint driverControl); -typedef void(GL_APIENTRY *PFNGLDISABLEDRIVERCONTROLQCOMPROC)(GLuint driverControl); -typedef void(GL_APIENTRY *PFNGLEXTGETTEXTURESQCOMPROC)(GLuint *textures, GLint maxTextures, GLint *numTextures); -typedef void(GL_APIENTRY *PFNGLEXTGETBUFFERSQCOMPROC)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -typedef void(GL_APIENTRY *PFNGLEXTGETRENDERBUFFERSQCOMPROC)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -typedef void(GL_APIENTRY *PFNGLEXTGETFRAMEBUFFERSQCOMPROC)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -typedef void(GL_APIENTRY *PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC)(GLenum target, GLenum pname, GLint param); -typedef void(GL_APIENTRY *PFNGLEXTGETTEXSUBIMAGEQCOMPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -typedef void(GL_APIENTRY *PFNGLEXTGETBUFFERPOINTERVQCOMPROC)(GLenum target, GLvoid **params); -typedef void(GL_APIENTRY *PFNGLEXTGETSHADERSQCOMPROC)(GLuint *shaders, GLint maxShaders, GLint *numShaders); -typedef void(GL_APIENTRY *PFNGLEXTGETPROGRAMSQCOMPROC)(GLuint *programs, GLint maxPrograms, GLint *numPrograms); -typedef GLboolean(GL_APIENTRY *PFNGLEXTISPROGRAMBINARYQCOMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC)(GLuint program, GLenum shadertype, GLchar *source, GLint *length); -typedef void(GL_APIENTRY *PFNGLSTARTTILINGQCOMPROC)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -typedef void(GL_APIENTRY *PFNGLENDTILINGQCOMPROC)(GLbitfield preserveMask); - -extern PFNGLACTIVETEXTUREPROC gles2wActiveTexture; -extern PFNGLATTACHSHADERPROC gles2wAttachShader; -extern PFNGLBINDATTRIBLOCATIONPROC gles2wBindAttribLocation; -extern PFNGLBINDBUFFERPROC gles2wBindBuffer; -extern PFNGLBINDFRAMEBUFFERPROC gles2wBindFramebuffer; -extern PFNGLBINDRENDERBUFFERPROC gles2wBindRenderbuffer; -extern PFNGLBINDTEXTUREPROC gles2wBindTexture; -extern PFNGLBLENDCOLORPROC gles2wBlendColor; -extern PFNGLBLENDEQUATIONPROC gles2wBlendEquation; -extern PFNGLBLENDEQUATIONSEPARATEPROC gles2wBlendEquationSeparate; -extern PFNGLBLENDFUNCPROC gles2wBlendFunc; -extern PFNGLBLENDFUNCSEPARATEPROC gles2wBlendFuncSeparate; -extern PFNGLBUFFERDATAPROC gles2wBufferData; -extern PFNGLBUFFERSUBDATAPROC gles2wBufferSubData; -extern PFNGLCHECKFRAMEBUFFERSTATUSPROC gles2wCheckFramebufferStatus; -extern PFNGLCLEARPROC gles2wClear; -extern PFNGLCLEARCOLORPROC gles2wClearColor; -extern PFNGLCLEARDEPTHFPROC gles2wClearDepthf; -extern PFNGLCLEARSTENCILPROC gles2wClearStencil; -extern PFNGLCOLORMASKPROC gles2wColorMask; -extern PFNGLCOMPILESHADERPROC gles2wCompileShader; -extern PFNGLCOMPRESSEDTEXIMAGE2DPROC gles2wCompressedTexImage2D; -extern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC gles2wCompressedTexSubImage2D; -extern PFNGLCOPYTEXIMAGE2DPROC gles2wCopyTexImage2D; -extern PFNGLCOPYTEXSUBIMAGE2DPROC gles2wCopyTexSubImage2D; -extern PFNGLCREATEPROGRAMPROC gles2wCreateProgram; -extern PFNGLCREATESHADERPROC gles2wCreateShader; -extern PFNGLCULLFACEPROC gles2wCullFace; -extern PFNGLDELETEBUFFERSPROC gles2wDeleteBuffers; -extern PFNGLDELETEFRAMEBUFFERSPROC gles2wDeleteFramebuffers; -extern PFNGLDELETEPROGRAMPROC gles2wDeleteProgram; -extern PFNGLDELETERENDERBUFFERSPROC gles2wDeleteRenderbuffers; -extern PFNGLDELETESHADERPROC gles2wDeleteShader; -extern PFNGLDELETETEXTURESPROC gles2wDeleteTextures; -extern PFNGLDEPTHFUNCPROC gles2wDepthFunc; -extern PFNGLDEPTHMASKPROC gles2wDepthMask; -extern PFNGLDEPTHRANGEFPROC gles2wDepthRangef; -extern PFNGLDETACHSHADERPROC gles2wDetachShader; -extern PFNGLDISABLEPROC gles2wDisable; -extern PFNGLDISABLEVERTEXATTRIBARRAYPROC gles2wDisableVertexAttribArray; -extern PFNGLDRAWARRAYSPROC gles2wDrawArrays; -extern PFNGLDRAWELEMENTSPROC gles2wDrawElements; -extern PFNGLENABLEPROC gles2wEnable; -extern PFNGLENABLEVERTEXATTRIBARRAYPROC gles2wEnableVertexAttribArray; -extern PFNGLFINISHPROC gles2wFinish; -extern PFNGLFLUSHPROC gles2wFlush; -extern PFNGLFRAMEBUFFERRENDERBUFFERPROC gles2wFramebufferRenderbuffer; -extern PFNGLFRAMEBUFFERTEXTURE2DPROC gles2wFramebufferTexture2D; -extern PFNGLFRONTFACEPROC gles2wFrontFace; -extern PFNGLGENBUFFERSPROC gles2wGenBuffers; -extern PFNGLGENERATEMIPMAPPROC gles2wGenerateMipmap; -extern PFNGLGENFRAMEBUFFERSPROC gles2wGenFramebuffers; -extern PFNGLGENRENDERBUFFERSPROC gles2wGenRenderbuffers; -extern PFNGLGENTEXTURESPROC gles2wGenTextures; -extern PFNGLGETACTIVEATTRIBPROC gles2wGetActiveAttrib; -extern PFNGLGETACTIVEUNIFORMPROC gles2wGetActiveUniform; -extern PFNGLGETATTACHEDSHADERSPROC gles2wGetAttachedShaders; -extern PFNGLGETATTRIBLOCATIONPROC gles2wGetAttribLocation; -extern PFNGLGETBOOLEANVPROC gles2wGetBooleanv; -extern PFNGLGETBUFFERPARAMETERIVPROC gles2wGetBufferParameteriv; -extern PFNGLGETERRORPROC gles2wGetError; -extern PFNGLGETFLOATVPROC gles2wGetFloatv; -extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC gles2wGetFramebufferAttachmentParameteriv; -extern PFNGLGETINTEGERVPROC gles2wGetIntegerv; -extern PFNGLGETPROGRAMIVPROC gles2wGetProgramiv; -extern PFNGLGETPROGRAMINFOLOGPROC gles2wGetProgramInfoLog; -extern PFNGLGETRENDERBUFFERPARAMETERIVPROC gles2wGetRenderbufferParameteriv; -extern PFNGLGETSHADERIVPROC gles2wGetShaderiv; -extern PFNGLGETSHADERINFOLOGPROC gles2wGetShaderInfoLog; -extern PFNGLGETSHADERPRECISIONFORMATPROC gles2wGetShaderPrecisionFormat; -extern PFNGLGETSHADERSOURCEPROC gles2wGetShaderSource; -extern PFNGLGETSTRINGPROC gles2wGetString; -extern PFNGLGETTEXPARAMETERFVPROC gles2wGetTexParameterfv; -extern PFNGLGETTEXPARAMETERIVPROC gles2wGetTexParameteriv; -extern PFNGLGETUNIFORMFVPROC gles2wGetUniformfv; -extern PFNGLGETUNIFORMIVPROC gles2wGetUniformiv; -extern PFNGLGETUNIFORMLOCATIONPROC gles2wGetUniformLocation; -extern PFNGLGETVERTEXATTRIBFVPROC gles2wGetVertexAttribfv; -extern PFNGLGETVERTEXATTRIBIVPROC gles2wGetVertexAttribiv; -extern PFNGLGETVERTEXATTRIBPOINTERVPROC gles2wGetVertexAttribPointerv; -extern PFNGLHINTPROC gles2wHint; -extern PFNGLISBUFFERPROC gles2wIsBuffer; -extern PFNGLISENABLEDPROC gles2wIsEnabled; -extern PFNGLISFRAMEBUFFERPROC gles2wIsFramebuffer; -extern PFNGLISPROGRAMPROC gles2wIsProgram; -extern PFNGLISRENDERBUFFERPROC gles2wIsRenderbuffer; -extern PFNGLISSHADERPROC gles2wIsShader; -extern PFNGLISTEXTUREPROC gles2wIsTexture; -extern PFNGLLINEWIDTHPROC gles2wLineWidth; -extern PFNGLLINKPROGRAMPROC gles2wLinkProgram; -extern PFNGLPIXELSTOREIPROC gles2wPixelStorei; -extern PFNGLPOLYGONOFFSETPROC gles2wPolygonOffset; -extern PFNGLREADPIXELSPROC gles2wReadPixels; -extern PFNGLRELEASESHADERCOMPILERPROC gles2wReleaseShaderCompiler; -extern PFNGLRENDERBUFFERSTORAGEPROC gles2wRenderbufferStorage; -extern PFNGLSAMPLECOVERAGEPROC gles2wSampleCoverage; -extern PFNGLSCISSORPROC gles2wScissor; -extern PFNGLSHADERBINARYPROC gles2wShaderBinary; -extern PFNGLSHADERSOURCEPROC gles2wShaderSource; -extern PFNGLSTENCILFUNCPROC gles2wStencilFunc; -extern PFNGLSTENCILFUNCSEPARATEPROC gles2wStencilFuncSeparate; -extern PFNGLSTENCILMASKPROC gles2wStencilMask; -extern PFNGLSTENCILMASKSEPARATEPROC gles2wStencilMaskSeparate; -extern PFNGLSTENCILOPPROC gles2wStencilOp; -extern PFNGLSTENCILOPSEPARATEPROC gles2wStencilOpSeparate; -extern PFNGLTEXIMAGE2DPROC gles2wTexImage2D; -extern PFNGLTEXPARAMETERFPROC gles2wTexParameterf; -extern PFNGLTEXPARAMETERFVPROC gles2wTexParameterfv; -extern PFNGLTEXPARAMETERIPROC gles2wTexParameteri; -extern PFNGLTEXPARAMETERIVPROC gles2wTexParameteriv; -extern PFNGLTEXSUBIMAGE2DPROC gles2wTexSubImage2D; -extern PFNGLUNIFORM1FPROC gles2wUniform1f; -extern PFNGLUNIFORM1FVPROC gles2wUniform1fv; -extern PFNGLUNIFORM1IPROC gles2wUniform1i; -extern PFNGLUNIFORM1IVPROC gles2wUniform1iv; -extern PFNGLUNIFORM2FPROC gles2wUniform2f; -extern PFNGLUNIFORM2FVPROC gles2wUniform2fv; -extern PFNGLUNIFORM2IPROC gles2wUniform2i; -extern PFNGLUNIFORM2IVPROC gles2wUniform2iv; -extern PFNGLUNIFORM3FPROC gles2wUniform3f; -extern PFNGLUNIFORM3FVPROC gles2wUniform3fv; -extern PFNGLUNIFORM3IPROC gles2wUniform3i; -extern PFNGLUNIFORM3IVPROC gles2wUniform3iv; -extern PFNGLUNIFORM4FPROC gles2wUniform4f; -extern PFNGLUNIFORM4FVPROC gles2wUniform4fv; -extern PFNGLUNIFORM4IPROC gles2wUniform4i; -extern PFNGLUNIFORM4IVPROC gles2wUniform4iv; -extern PFNGLUNIFORMMATRIX2FVPROC gles2wUniformMatrix2fv; -extern PFNGLUNIFORMMATRIX3FVPROC gles2wUniformMatrix3fv; -extern PFNGLUNIFORMMATRIX4FVPROC gles2wUniformMatrix4fv; -extern PFNGLUSEPROGRAMPROC gles2wUseProgram; -extern PFNGLVALIDATEPROGRAMPROC gles2wValidateProgram; -extern PFNGLVERTEXATTRIB1FPROC gles2wVertexAttrib1f; -extern PFNGLVERTEXATTRIB1FVPROC gles2wVertexAttrib1fv; -extern PFNGLVERTEXATTRIB2FPROC gles2wVertexAttrib2f; -extern PFNGLVERTEXATTRIB2FVPROC gles2wVertexAttrib2fv; -extern PFNGLVERTEXATTRIB3FPROC gles2wVertexAttrib3f; -extern PFNGLVERTEXATTRIB3FVPROC gles2wVertexAttrib3fv; -extern PFNGLVERTEXATTRIB4FPROC gles2wVertexAttrib4f; -extern PFNGLVERTEXATTRIB4FVPROC gles2wVertexAttrib4fv; -extern PFNGLVERTEXATTRIBPOINTERPROC gles2wVertexAttribPointer; -extern PFNGLVIEWPORTPROC gles2wViewport; -extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gles2wEGLImageTargetTexture2DOES; -extern PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC gles2wEGLImageTargetRenderbufferStorageOES; -extern PFNGLGETPROGRAMBINARYOESPROC gles2wGetProgramBinaryOES; -extern PFNGLPROGRAMBINARYOESPROC gles2wProgramBinaryOES; -extern PFNGLMAPBUFFEROESPROC gles2wMapBufferOES; -extern PFNGLUNMAPBUFFEROESPROC gles2wUnmapBufferOES; -extern PFNGLGETBUFFERPOINTERVOESPROC gles2wGetBufferPointervOES; -extern PFNGLTEXIMAGE3DOESPROC gles2wTexImage3DOES; -extern PFNGLTEXSUBIMAGE3DOESPROC gles2wTexSubImage3DOES; -extern PFNGLCOPYTEXSUBIMAGE3DOESPROC gles2wCopyTexSubImage3DOES; -extern PFNGLCOMPRESSEDTEXIMAGE3DOESPROC gles2wCompressedTexImage3DOES; -extern PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC gles2wCompressedTexSubImage3DOES; -extern PFNGLFRAMEBUFFERTEXTURE3DOESPROC gles2wFramebufferTexture3DOES; -extern PFNGLBINDVERTEXARRAYOESPROC gles2wBindVertexArrayOES; -extern PFNGLDELETEVERTEXARRAYSOESPROC gles2wDeleteVertexArraysOES; -extern PFNGLGENVERTEXARRAYSOESPROC gles2wGenVertexArraysOES; -extern PFNGLISVERTEXARRAYOESPROC gles2wIsVertexArrayOES; -extern PFNGLDEBUGMESSAGECONTROLKHRPROC gles2wDebugMessageControlKHR; -extern PFNGLDEBUGMESSAGEINSERTKHRPROC gles2wDebugMessageInsertKHR; -extern PFNGLDEBUGMESSAGECALLBACKKHRPROC gles2wDebugMessageCallbackKHR; -extern PFNGLGETDEBUGMESSAGELOGKHRPROC gles2wGetDebugMessageLogKHR; -extern PFNGLPUSHDEBUGGROUPKHRPROC gles2wPushDebugGroupKHR; -extern PFNGLPOPDEBUGGROUPKHRPROC gles2wPopDebugGroupKHR; -extern PFNGLOBJECTLABELKHRPROC gles2wObjectLabelKHR; -extern PFNGLGETOBJECTLABELKHRPROC gles2wGetObjectLabelKHR; -extern PFNGLOBJECTPTRLABELKHRPROC gles2wObjectPtrLabelKHR; -extern PFNGLGETOBJECTPTRLABELKHRPROC gles2wGetObjectPtrLabelKHR; -extern PFNGLGETPOINTERVKHRPROC gles2wGetPointervKHR; -extern PFNGLGETPERFMONITORGROUPSAMDPROC gles2wGetPerfMonitorGroupsAMD; -extern PFNGLGETPERFMONITORCOUNTERSAMDPROC gles2wGetPerfMonitorCountersAMD; -extern PFNGLGETPERFMONITORGROUPSTRINGAMDPROC gles2wGetPerfMonitorGroupStringAMD; -extern PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC gles2wGetPerfMonitorCounterStringAMD; -extern PFNGLGETPERFMONITORCOUNTERINFOAMDPROC gles2wGetPerfMonitorCounterInfoAMD; -extern PFNGLGENPERFMONITORSAMDPROC gles2wGenPerfMonitorsAMD; -extern PFNGLDELETEPERFMONITORSAMDPROC gles2wDeletePerfMonitorsAMD; -extern PFNGLSELECTPERFMONITORCOUNTERSAMDPROC gles2wSelectPerfMonitorCountersAMD; -extern PFNGLBEGINPERFMONITORAMDPROC gles2wBeginPerfMonitorAMD; -extern PFNGLENDPERFMONITORAMDPROC gles2wEndPerfMonitorAMD; -extern PFNGLGETPERFMONITORCOUNTERDATAAMDPROC gles2wGetPerfMonitorCounterDataAMD; -extern PFNGLBLITFRAMEBUFFERANGLEPROC gles2wBlitFramebufferANGLE; -extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC gles2wRenderbufferStorageMultisampleANGLE; -extern PFNGLDRAWARRAYSINSTANCEDANGLEPROC gles2wDrawArraysInstancedANGLE; -extern PFNGLDRAWELEMENTSINSTANCEDANGLEPROC gles2wDrawElementsInstancedANGLE; -extern PFNGLVERTEXATTRIBDIVISORANGLEPROC gles2wVertexAttribDivisorANGLE; -extern PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC gles2wGetTranslatedShaderSourceANGLE; -extern PFNGLDRAWARRAYSINSTANCEDEXTPROC gles2wDrawArraysInstancedEXT; -extern PFNGLDRAWELEMENTSINSTANCEDEXTPROC gles2wDrawElementsInstancedEXT; -extern PFNGLVERTEXATTRIBDIVISOREXTPROC gles2wVertexAttribDivisorEXT; -extern PFNGLCOPYTEXTURELEVELSAPPLEPROC gles2wCopyTextureLevelsAPPLE; -extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC gles2wRenderbufferStorageMultisampleAPPLE; -extern PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC gles2wResolveMultisampleFramebufferAPPLE; -extern PFNGLFENCESYNCAPPLEPROC gles2wFenceSyncAPPLE; -extern PFNGLISSYNCAPPLEPROC gles2wIsSyncAPPLE; -extern PFNGLDELETESYNCAPPLEPROC gles2wDeleteSyncAPPLE; -extern PFNGLCLIENTWAITSYNCAPPLEPROC gles2wClientWaitSyncAPPLE; -extern PFNGLWAITSYNCAPPLEPROC gles2wWaitSyncAPPLE; -extern PFNGLGETINTEGER64VAPPLEPROC gles2wGetInteger64vAPPLE; -extern PFNGLGETSYNCIVAPPLEPROC gles2wGetSyncivAPPLE; -extern PFNGLLABELOBJECTEXTPROC gles2wLabelObjectEXT; -extern PFNGLGETOBJECTLABELEXTPROC gles2wGetObjectLabelEXT; -extern PFNGLINSERTEVENTMARKEREXTPROC gles2wInsertEventMarkerEXT; -extern PFNGLPUSHGROUPMARKEREXTPROC gles2wPushGroupMarkerEXT; -extern PFNGLPOPGROUPMARKEREXTPROC gles2wPopGroupMarkerEXT; -extern PFNGLDISCARDFRAMEBUFFEREXTPROC gles2wDiscardFramebufferEXT; -extern PFNGLGENQUERIESEXTPROC gles2wGenQueriesEXT; -extern PFNGLDELETEQUERIESEXTPROC gles2wDeleteQueriesEXT; -extern PFNGLISQUERYEXTPROC gles2wIsQueryEXT; -extern PFNGLBEGINQUERYEXTPROC gles2wBeginQueryEXT; -extern PFNGLENDQUERYEXTPROC gles2wEndQueryEXT; -extern PFNGLQUERYCOUNTEREXTPROC gles2wQueryCounterEXT; -extern PFNGLGETQUERYIVEXTPROC gles2wGetQueryivEXT; -extern PFNGLGETQUERYOBJECTIVEXTPROC gles2wGetQueryObjectivEXT; -extern PFNGLGETQUERYOBJECTUIVEXTPROC gles2wGetQueryObjectuivEXT; -extern PFNGLGETQUERYOBJECTI64VEXTPROC gles2wGetQueryObjecti64vEXT; -extern PFNGLGETQUERYOBJECTUI64VEXTPROC gles2wGetQueryObjectui64vEXT; -extern PFNGLMAPBUFFERRANGEEXTPROC gles2wMapBufferRangeEXT; -extern PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC gles2wFlushMappedBufferRangeEXT; -extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC gles2wRenderbufferStorageMultisampleEXT; -extern PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC gles2wFramebufferTexture2DMultisampleEXT; -extern PFNGLREADBUFFERINDEXEDEXTPROC gles2wReadBufferIndexedEXT; -extern PFNGLDRAWBUFFERSINDEXEDEXTPROC gles2wDrawBuffersIndexedEXT; -extern PFNGLGETINTEGERI_VEXTPROC gles2wGetIntegeri_vEXT; -extern PFNGLMULTIDRAWARRAYSEXTPROC gles2wMultiDrawArraysEXT; -extern PFNGLMULTIDRAWELEMENTSEXTPROC gles2wMultiDrawElementsEXT; -extern PFNGLGETGRAPHICSRESETSTATUSEXTPROC gles2wGetGraphicsResetStatusEXT; -extern PFNGLREADNPIXELSEXTPROC gles2wReadnPixelsEXT; -extern PFNGLGETNUNIFORMFVEXTPROC gles2wGetnUniformfvEXT; -extern PFNGLGETNUNIFORMIVEXTPROC gles2wGetnUniformivEXT; -extern PFNGLUSEPROGRAMSTAGESEXTPROC gles2wUseProgramStagesEXT; -extern PFNGLACTIVESHADERPROGRAMEXTPROC gles2wActiveShaderProgramEXT; -extern PFNGLCREATESHADERPROGRAMVEXTPROC gles2wCreateShaderProgramvEXT; -extern PFNGLBINDPROGRAMPIPELINEEXTPROC gles2wBindProgramPipelineEXT; -extern PFNGLDELETEPROGRAMPIPELINESEXTPROC gles2wDeleteProgramPipelinesEXT; -extern PFNGLGENPROGRAMPIPELINESEXTPROC gles2wGenProgramPipelinesEXT; -extern PFNGLISPROGRAMPIPELINEEXTPROC gles2wIsProgramPipelineEXT; -extern PFNGLPROGRAMPARAMETERIEXTPROC gles2wProgramParameteriEXT; -extern PFNGLGETPROGRAMPIPELINEIVEXTPROC gles2wGetProgramPipelineivEXT; -extern PFNGLPROGRAMUNIFORM1IEXTPROC gles2wProgramUniform1iEXT; -extern PFNGLPROGRAMUNIFORM2IEXTPROC gles2wProgramUniform2iEXT; -extern PFNGLPROGRAMUNIFORM3IEXTPROC gles2wProgramUniform3iEXT; -extern PFNGLPROGRAMUNIFORM4IEXTPROC gles2wProgramUniform4iEXT; -extern PFNGLPROGRAMUNIFORM1FEXTPROC gles2wProgramUniform1fEXT; -extern PFNGLPROGRAMUNIFORM2FEXTPROC gles2wProgramUniform2fEXT; -extern PFNGLPROGRAMUNIFORM3FEXTPROC gles2wProgramUniform3fEXT; -extern PFNGLPROGRAMUNIFORM4FEXTPROC gles2wProgramUniform4fEXT; -extern PFNGLPROGRAMUNIFORM1IVEXTPROC gles2wProgramUniform1ivEXT; -extern PFNGLPROGRAMUNIFORM2IVEXTPROC gles2wProgramUniform2ivEXT; -extern PFNGLPROGRAMUNIFORM3IVEXTPROC gles2wProgramUniform3ivEXT; -extern PFNGLPROGRAMUNIFORM4IVEXTPROC gles2wProgramUniform4ivEXT; -extern PFNGLPROGRAMUNIFORM1FVEXTPROC gles2wProgramUniform1fvEXT; -extern PFNGLPROGRAMUNIFORM2FVEXTPROC gles2wProgramUniform2fvEXT; -extern PFNGLPROGRAMUNIFORM3FVEXTPROC gles2wProgramUniform3fvEXT; -extern PFNGLPROGRAMUNIFORM4FVEXTPROC gles2wProgramUniform4fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC gles2wProgramUniformMatrix2fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC gles2wProgramUniformMatrix3fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC gles2wProgramUniformMatrix4fvEXT; -extern PFNGLVALIDATEPROGRAMPIPELINEEXTPROC gles2wValidateProgramPipelineEXT; -extern PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC gles2wGetProgramPipelineInfoLogEXT; -extern PFNGLTEXSTORAGE1DEXTPROC gles2wTexStorage1DEXT; -extern PFNGLTEXSTORAGE2DEXTPROC gles2wTexStorage2DEXT; -extern PFNGLTEXSTORAGE3DEXTPROC gles2wTexStorage3DEXT; -extern PFNGLTEXTURESTORAGE1DEXTPROC gles2wTextureStorage1DEXT; -extern PFNGLTEXTURESTORAGE2DEXTPROC gles2wTextureStorage2DEXT; -extern PFNGLTEXTURESTORAGE3DEXTPROC gles2wTextureStorage3DEXT; -extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC gles2wRenderbufferStorageMultisampleIMG; -extern PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC gles2wFramebufferTexture2DMultisampleIMG; -extern PFNGLCOVERAGEMASKNVPROC gles2wCoverageMaskNV; -extern PFNGLCOVERAGEOPERATIONNVPROC gles2wCoverageOperationNV; -extern PFNGLDRAWBUFFERSNVPROC gles2wDrawBuffersNV; -extern PFNGLDRAWARRAYSINSTANCEDNVPROC gles2wDrawArraysInstancedNV; -extern PFNGLDRAWELEMENTSINSTANCEDNVPROC gles2wDrawElementsInstancedNV; -extern PFNGLDELETEFENCESNVPROC gles2wDeleteFencesNV; -extern PFNGLGENFENCESNVPROC gles2wGenFencesNV; -extern PFNGLISFENCENVPROC gles2wIsFenceNV; -extern PFNGLTESTFENCENVPROC gles2wTestFenceNV; -extern PFNGLGETFENCEIVNVPROC gles2wGetFenceivNV; -extern PFNGLFINISHFENCENVPROC gles2wFinishFenceNV; -extern PFNGLSETFENCENVPROC gles2wSetFenceNV; -extern PFNGLBLITFRAMEBUFFERNVPROC gles2wBlitFramebufferNV; -extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC gles2wRenderbufferStorageMultisampleNV; -extern PFNGLVERTEXATTRIBDIVISORNVPROC gles2wVertexAttribDivisorNV; -extern PFNGLREADBUFFERNVPROC gles2wReadBufferNV; -extern PFNGLALPHAFUNCQCOMPROC gles2wAlphaFuncQCOM; -extern PFNGLGETDRIVERCONTROLSQCOMPROC gles2wGetDriverControlsQCOM; -extern PFNGLGETDRIVERCONTROLSTRINGQCOMPROC gles2wGetDriverControlStringQCOM; -extern PFNGLENABLEDRIVERCONTROLQCOMPROC gles2wEnableDriverControlQCOM; -extern PFNGLDISABLEDRIVERCONTROLQCOMPROC gles2wDisableDriverControlQCOM; -extern PFNGLEXTGETTEXTURESQCOMPROC gles2wExtGetTexturesQCOM; -extern PFNGLEXTGETBUFFERSQCOMPROC gles2wExtGetBuffersQCOM; -extern PFNGLEXTGETRENDERBUFFERSQCOMPROC gles2wExtGetRenderbuffersQCOM; -extern PFNGLEXTGETFRAMEBUFFERSQCOMPROC gles2wExtGetFramebuffersQCOM; -extern PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC gles2wExtGetTexLevelParameterivQCOM; -extern PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC gles2wExtTexObjectStateOverrideiQCOM; -extern PFNGLEXTGETTEXSUBIMAGEQCOMPROC gles2wExtGetTexSubImageQCOM; -extern PFNGLEXTGETBUFFERPOINTERVQCOMPROC gles2wExtGetBufferPointervQCOM; -extern PFNGLEXTGETSHADERSQCOMPROC gles2wExtGetShadersQCOM; -extern PFNGLEXTGETPROGRAMSQCOMPROC gles2wExtGetProgramsQCOM; -extern PFNGLEXTISPROGRAMBINARYQCOMPROC gles2wExtIsProgramBinaryQCOM; -extern PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC gles2wExtGetProgramBinarySourceQCOM; -extern PFNGLSTARTTILINGQCOMPROC gles2wStartTilingQCOM; -extern PFNGLENDTILINGQCOMPROC gles2wEndTilingQCOM; - -#define glActiveTexture gles2wActiveTexture -#define glAttachShader gles2wAttachShader -#define glBindAttribLocation gles2wBindAttribLocation -#define glBindBuffer gles2wBindBuffer -#define glBindFramebuffer gles2wBindFramebuffer -#define glBindRenderbuffer gles2wBindRenderbuffer -#define glBindTexture gles2wBindTexture -#define glBlendColor gles2wBlendColor -#define glBlendEquation gles2wBlendEquation -#define glBlendEquationSeparate gles2wBlendEquationSeparate -#define glBlendFunc gles2wBlendFunc -#define glBlendFuncSeparate gles2wBlendFuncSeparate -#define glBufferData gles2wBufferData -#define glBufferSubData gles2wBufferSubData -#define glCheckFramebufferStatus gles2wCheckFramebufferStatus -#define glClear gles2wClear -#define glClearColor gles2wClearColor -#define glClearDepthf gles2wClearDepthf -#define glClearStencil gles2wClearStencil -#define glColorMask gles2wColorMask -#define glCompileShader gles2wCompileShader -#define glCompressedTexImage2D gles2wCompressedTexImage2D -#define glCompressedTexSubImage2D gles2wCompressedTexSubImage2D -#define glCopyTexImage2D gles2wCopyTexImage2D -#define glCopyTexSubImage2D gles2wCopyTexSubImage2D -#define glCreateProgram gles2wCreateProgram -#define glCreateShader gles2wCreateShader -#define glCullFace gles2wCullFace -#define glDeleteBuffers gles2wDeleteBuffers -#define glDeleteFramebuffers gles2wDeleteFramebuffers -#define glDeleteProgram gles2wDeleteProgram -#define glDeleteRenderbuffers gles2wDeleteRenderbuffers -#define glDeleteShader gles2wDeleteShader -#define glDeleteTextures gles2wDeleteTextures -#define glDepthFunc gles2wDepthFunc -#define glDepthMask gles2wDepthMask -#define glDepthRangef gles2wDepthRangef -#define glDetachShader gles2wDetachShader -#define glDisable gles2wDisable -#define glDisableVertexAttribArray gles2wDisableVertexAttribArray -#define glDrawArrays gles2wDrawArrays -#define glDrawElements gles2wDrawElements -#define glEnable gles2wEnable -#define glEnableVertexAttribArray gles2wEnableVertexAttribArray -#define glFinish gles2wFinish -#define glFlush gles2wFlush -#define glFramebufferRenderbuffer gles2wFramebufferRenderbuffer -#define glFramebufferTexture2D gles2wFramebufferTexture2D -#define glFrontFace gles2wFrontFace -#define glGenBuffers gles2wGenBuffers -#define glGenerateMipmap gles2wGenerateMipmap -#define glGenFramebuffers gles2wGenFramebuffers -#define glGenRenderbuffers gles2wGenRenderbuffers -#define glGenTextures gles2wGenTextures -#define glGetActiveAttrib gles2wGetActiveAttrib -#define glGetActiveUniform gles2wGetActiveUniform -#define glGetAttachedShaders gles2wGetAttachedShaders -#define glGetAttribLocation gles2wGetAttribLocation -#define glGetBooleanv gles2wGetBooleanv -#define glGetBufferParameteriv gles2wGetBufferParameteriv -#define glGetError gles2wGetError -#define glGetFloatv gles2wGetFloatv -#define glGetFramebufferAttachmentParameteriv gles2wGetFramebufferAttachmentParameteriv -#define glGetIntegerv gles2wGetIntegerv -#define glGetProgramiv gles2wGetProgramiv -#define glGetProgramInfoLog gles2wGetProgramInfoLog -#define glGetRenderbufferParameteriv gles2wGetRenderbufferParameteriv -#define glGetShaderiv gles2wGetShaderiv -#define glGetShaderInfoLog gles2wGetShaderInfoLog -#define glGetShaderPrecisionFormat gles2wGetShaderPrecisionFormat -#define glGetShaderSource gles2wGetShaderSource -#define glGetString gles2wGetString -#define glGetTexParameterfv gles2wGetTexParameterfv -#define glGetTexParameteriv gles2wGetTexParameteriv -#define glGetUniformfv gles2wGetUniformfv -#define glGetUniformiv gles2wGetUniformiv -#define glGetUniformLocation gles2wGetUniformLocation -#define glGetVertexAttribfv gles2wGetVertexAttribfv -#define glGetVertexAttribiv gles2wGetVertexAttribiv -#define glGetVertexAttribPointerv gles2wGetVertexAttribPointerv -#define glHint gles2wHint -#define glIsBuffer gles2wIsBuffer -#define glIsEnabled gles2wIsEnabled -#define glIsFramebuffer gles2wIsFramebuffer -#define glIsProgram gles2wIsProgram -#define glIsRenderbuffer gles2wIsRenderbuffer -#define glIsShader gles2wIsShader -#define glIsTexture gles2wIsTexture -#define glLineWidth gles2wLineWidth -#define glLinkProgram gles2wLinkProgram -#define glPixelStorei gles2wPixelStorei -#define glPolygonOffset gles2wPolygonOffset -#define glReadPixels gles2wReadPixels -#define glReleaseShaderCompiler gles2wReleaseShaderCompiler -#define glRenderbufferStorage gles2wRenderbufferStorage -#define glSampleCoverage gles2wSampleCoverage -#define glScissor gles2wScissor -#define glShaderBinary gles2wShaderBinary -#define glShaderSource gles2wShaderSource -#define glStencilFunc gles2wStencilFunc -#define glStencilFuncSeparate gles2wStencilFuncSeparate -#define glStencilMask gles2wStencilMask -#define glStencilMaskSeparate gles2wStencilMaskSeparate -#define glStencilOp gles2wStencilOp -#define glStencilOpSeparate gles2wStencilOpSeparate -#define glTexImage2D gles2wTexImage2D -#define glTexParameterf gles2wTexParameterf -#define glTexParameterfv gles2wTexParameterfv -#define glTexParameteri gles2wTexParameteri -#define glTexParameteriv gles2wTexParameteriv -#define glTexSubImage2D gles2wTexSubImage2D -#define glUniform1f gles2wUniform1f -#define glUniform1fv gles2wUniform1fv -#define glUniform1i gles2wUniform1i -#define glUniform1iv gles2wUniform1iv -#define glUniform2f gles2wUniform2f -#define glUniform2fv gles2wUniform2fv -#define glUniform2i gles2wUniform2i -#define glUniform2iv gles2wUniform2iv -#define glUniform3f gles2wUniform3f -#define glUniform3fv gles2wUniform3fv -#define glUniform3i gles2wUniform3i -#define glUniform3iv gles2wUniform3iv -#define glUniform4f gles2wUniform4f -#define glUniform4fv gles2wUniform4fv -#define glUniform4i gles2wUniform4i -#define glUniform4iv gles2wUniform4iv -#define glUniformMatrix2fv gles2wUniformMatrix2fv -#define glUniformMatrix3fv gles2wUniformMatrix3fv -#define glUniformMatrix4fv gles2wUniformMatrix4fv -#define glUseProgram gles2wUseProgram -#define glValidateProgram gles2wValidateProgram -#define glVertexAttrib1f gles2wVertexAttrib1f -#define glVertexAttrib1fv gles2wVertexAttrib1fv -#define glVertexAttrib2f gles2wVertexAttrib2f -#define glVertexAttrib2fv gles2wVertexAttrib2fv -#define glVertexAttrib3f gles2wVertexAttrib3f -#define glVertexAttrib3fv gles2wVertexAttrib3fv -#define glVertexAttrib4f gles2wVertexAttrib4f -#define glVertexAttrib4fv gles2wVertexAttrib4fv -#define glVertexAttribPointer gles2wVertexAttribPointer -#define glViewport gles2wViewport -#define glEGLImageTargetTexture2DOES gles2wEGLImageTargetTexture2DOES -#define glEGLImageTargetRenderbufferStorageOES gles2wEGLImageTargetRenderbufferStorageOES -#define glGetProgramBinaryOES gles2wGetProgramBinaryOES -#define glProgramBinaryOES gles2wProgramBinaryOES -#define glMapBufferOES gles2wMapBufferOES -#define glUnmapBufferOES gles2wUnmapBufferOES -#define glGetBufferPointervOES gles2wGetBufferPointervOES -#define glTexImage3DOES gles2wTexImage3DOES -#define glTexSubImage3DOES gles2wTexSubImage3DOES -#define glCopyTexSubImage3DOES gles2wCopyTexSubImage3DOES -#define glCompressedTexImage3DOES gles2wCompressedTexImage3DOES -#define glCompressedTexSubImage3DOES gles2wCompressedTexSubImage3DOES -#define glFramebufferTexture3DOES gles2wFramebufferTexture3DOES -#define glBindVertexArrayOES gles2wBindVertexArrayOES -#define glDeleteVertexArraysOES gles2wDeleteVertexArraysOES -#define glGenVertexArraysOES gles2wGenVertexArraysOES -#define glIsVertexArrayOES gles2wIsVertexArrayOES -#define glDebugMessageControlKHR gles2wDebugMessageControlKHR -#define glDebugMessageInsertKHR gles2wDebugMessageInsertKHR -#define glDebugMessageCallbackKHR gles2wDebugMessageCallbackKHR -#define glGetDebugMessageLogKHR gles2wGetDebugMessageLogKHR -#define glPushDebugGroupKHR gles2wPushDebugGroupKHR -#define glPopDebugGroupKHR gles2wPopDebugGroupKHR -#define glObjectLabelKHR gles2wObjectLabelKHR -#define glGetObjectLabelKHR gles2wGetObjectLabelKHR -#define glObjectPtrLabelKHR gles2wObjectPtrLabelKHR -#define glGetObjectPtrLabelKHR gles2wGetObjectPtrLabelKHR -#define glGetPointervKHR gles2wGetPointervKHR -#define glGetPerfMonitorGroupsAMD gles2wGetPerfMonitorGroupsAMD -#define glGetPerfMonitorCountersAMD gles2wGetPerfMonitorCountersAMD -#define glGetPerfMonitorGroupStringAMD gles2wGetPerfMonitorGroupStringAMD -#define glGetPerfMonitorCounterStringAMD gles2wGetPerfMonitorCounterStringAMD -#define glGetPerfMonitorCounterInfoAMD gles2wGetPerfMonitorCounterInfoAMD -#define glGenPerfMonitorsAMD gles2wGenPerfMonitorsAMD -#define glDeletePerfMonitorsAMD gles2wDeletePerfMonitorsAMD -#define glSelectPerfMonitorCountersAMD gles2wSelectPerfMonitorCountersAMD -#define glBeginPerfMonitorAMD gles2wBeginPerfMonitorAMD -#define glEndPerfMonitorAMD gles2wEndPerfMonitorAMD -#define glGetPerfMonitorCounterDataAMD gles2wGetPerfMonitorCounterDataAMD -#define glBlitFramebufferANGLE gles2wBlitFramebufferANGLE -#define glRenderbufferStorageMultisampleANGLE gles2wRenderbufferStorageMultisampleANGLE -#define glDrawArraysInstancedANGLE gles2wDrawArraysInstancedANGLE -#define glDrawElementsInstancedANGLE gles2wDrawElementsInstancedANGLE -#define glVertexAttribDivisorANGLE gles2wVertexAttribDivisorANGLE -#define glGetTranslatedShaderSourceANGLE gles2wGetTranslatedShaderSourceANGLE -#define glDrawArraysInstancedEXT gles2wDrawArraysInstancedEXT -#define glDrawElementsInstancedEXT gles2wDrawElementsInstancedEXT -#define glVertexAttribDivisorEXT gles2wVertexAttribDivisorEXT -#define glCopyTextureLevelsAPPLE gles2wCopyTextureLevelsAPPLE -#define glRenderbufferStorageMultisampleAPPLE gles2wRenderbufferStorageMultisampleAPPLE -#define glResolveMultisampleFramebufferAPPLE gles2wResolveMultisampleFramebufferAPPLE -#define glFenceSyncAPPLE gles2wFenceSyncAPPLE -#define glIsSyncAPPLE gles2wIsSyncAPPLE -#define glDeleteSyncAPPLE gles2wDeleteSyncAPPLE -#define glClientWaitSyncAPPLE gles2wClientWaitSyncAPPLE -#define glWaitSyncAPPLE gles2wWaitSyncAPPLE -#define glGetInteger64vAPPLE gles2wGetInteger64vAPPLE -#define glGetSyncivAPPLE gles2wGetSyncivAPPLE -#define glLabelObjectEXT gles2wLabelObjectEXT -#define glGetObjectLabelEXT gles2wGetObjectLabelEXT -#define glInsertEventMarkerEXT gles2wInsertEventMarkerEXT -#define glPushGroupMarkerEXT gles2wPushGroupMarkerEXT -#define glPopGroupMarkerEXT gles2wPopGroupMarkerEXT -#define glDiscardFramebufferEXT gles2wDiscardFramebufferEXT -#define glGenQueriesEXT gles2wGenQueriesEXT -#define glDeleteQueriesEXT gles2wDeleteQueriesEXT -#define glIsQueryEXT gles2wIsQueryEXT -#define glBeginQueryEXT gles2wBeginQueryEXT -#define glEndQueryEXT gles2wEndQueryEXT -#define glQueryCounterEXT gles2wQueryCounterEXT -#define glGetQueryivEXT gles2wGetQueryivEXT -#define glGetQueryObjectivEXT gles2wGetQueryObjectivEXT -#define glGetQueryObjectuivEXT gles2wGetQueryObjectuivEXT -#define glGetQueryObjecti64vEXT gles2wGetQueryObjecti64vEXT -#define glGetQueryObjectui64vEXT gles2wGetQueryObjectui64vEXT -#define glMapBufferRangeEXT gles2wMapBufferRangeEXT -#define glFlushMappedBufferRangeEXT gles2wFlushMappedBufferRangeEXT -#define glRenderbufferStorageMultisampleEXT gles2wRenderbufferStorageMultisampleEXT -#define glFramebufferTexture2DMultisampleEXT gles2wFramebufferTexture2DMultisampleEXT -#define glReadBufferIndexedEXT gles2wReadBufferIndexedEXT -#define glDrawBuffersIndexedEXT gles2wDrawBuffersIndexedEXT -#define glGetIntegeri_vEXT gles2wGetIntegeri_vEXT -#define glMultiDrawArraysEXT gles2wMultiDrawArraysEXT -#define glMultiDrawElementsEXT gles2wMultiDrawElementsEXT -#define glGetGraphicsResetStatusEXT gles2wGetGraphicsResetStatusEXT -#define glReadnPixelsEXT gles2wReadnPixelsEXT -#define glGetnUniformfvEXT gles2wGetnUniformfvEXT -#define glGetnUniformivEXT gles2wGetnUniformivEXT -#define glUseProgramStagesEXT gles2wUseProgramStagesEXT -#define glActiveShaderProgramEXT gles2wActiveShaderProgramEXT -#define glCreateShaderProgramvEXT gles2wCreateShaderProgramvEXT -#define glBindProgramPipelineEXT gles2wBindProgramPipelineEXT -#define glDeleteProgramPipelinesEXT gles2wDeleteProgramPipelinesEXT -#define glGenProgramPipelinesEXT gles2wGenProgramPipelinesEXT -#define glIsProgramPipelineEXT gles2wIsProgramPipelineEXT -#define glProgramParameteriEXT gles2wProgramParameteriEXT -#define glGetProgramPipelineivEXT gles2wGetProgramPipelineivEXT -#define glProgramUniform1iEXT gles2wProgramUniform1iEXT -#define glProgramUniform2iEXT gles2wProgramUniform2iEXT -#define glProgramUniform3iEXT gles2wProgramUniform3iEXT -#define glProgramUniform4iEXT gles2wProgramUniform4iEXT -#define glProgramUniform1fEXT gles2wProgramUniform1fEXT -#define glProgramUniform2fEXT gles2wProgramUniform2fEXT -#define glProgramUniform3fEXT gles2wProgramUniform3fEXT -#define glProgramUniform4fEXT gles2wProgramUniform4fEXT -#define glProgramUniform1ivEXT gles2wProgramUniform1ivEXT -#define glProgramUniform2ivEXT gles2wProgramUniform2ivEXT -#define glProgramUniform3ivEXT gles2wProgramUniform3ivEXT -#define glProgramUniform4ivEXT gles2wProgramUniform4ivEXT -#define glProgramUniform1fvEXT gles2wProgramUniform1fvEXT -#define glProgramUniform2fvEXT gles2wProgramUniform2fvEXT -#define glProgramUniform3fvEXT gles2wProgramUniform3fvEXT -#define glProgramUniform4fvEXT gles2wProgramUniform4fvEXT -#define glProgramUniformMatrix2fvEXT gles2wProgramUniformMatrix2fvEXT -#define glProgramUniformMatrix3fvEXT gles2wProgramUniformMatrix3fvEXT -#define glProgramUniformMatrix4fvEXT gles2wProgramUniformMatrix4fvEXT -#define glValidateProgramPipelineEXT gles2wValidateProgramPipelineEXT -#define glGetProgramPipelineInfoLogEXT gles2wGetProgramPipelineInfoLogEXT -#define glTexStorage1DEXT gles2wTexStorage1DEXT -#define glTexStorage2DEXT gles2wTexStorage2DEXT -#define glTexStorage3DEXT gles2wTexStorage3DEXT -#define glTextureStorage1DEXT gles2wTextureStorage1DEXT -#define glTextureStorage2DEXT gles2wTextureStorage2DEXT -#define glTextureStorage3DEXT gles2wTextureStorage3DEXT -#define glRenderbufferStorageMultisampleIMG gles2wRenderbufferStorageMultisampleIMG -#define glFramebufferTexture2DMultisampleIMG gles2wFramebufferTexture2DMultisampleIMG -#define glCoverageMaskNV gles2wCoverageMaskNV -#define glCoverageOperationNV gles2wCoverageOperationNV -#define glDrawBuffersNV gles2wDrawBuffersNV -#define glDrawArraysInstancedNV gles2wDrawArraysInstancedNV -#define glDrawElementsInstancedNV gles2wDrawElementsInstancedNV -#define glDeleteFencesNV gles2wDeleteFencesNV -#define glGenFencesNV gles2wGenFencesNV -#define glIsFenceNV gles2wIsFenceNV -#define glTestFenceNV gles2wTestFenceNV -#define glGetFenceivNV gles2wGetFenceivNV -#define glFinishFenceNV gles2wFinishFenceNV -#define glSetFenceNV gles2wSetFenceNV -#define glBlitFramebufferNV gles2wBlitFramebufferNV -#define glRenderbufferStorageMultisampleNV gles2wRenderbufferStorageMultisampleNV -#define glVertexAttribDivisorNV gles2wVertexAttribDivisorNV -#define glReadBufferNV gles2wReadBufferNV -#define glAlphaFuncQCOM gles2wAlphaFuncQCOM -#define glGetDriverControlsQCOM gles2wGetDriverControlsQCOM -#define glGetDriverControlStringQCOM gles2wGetDriverControlStringQCOM -#define glEnableDriverControlQCOM gles2wEnableDriverControlQCOM -#define glDisableDriverControlQCOM gles2wDisableDriverControlQCOM -#define glExtGetTexturesQCOM gles2wExtGetTexturesQCOM -#define glExtGetBuffersQCOM gles2wExtGetBuffersQCOM -#define glExtGetRenderbuffersQCOM gles2wExtGetRenderbuffersQCOM -#define glExtGetFramebuffersQCOM gles2wExtGetFramebuffersQCOM -#define glExtGetTexLevelParameterivQCOM gles2wExtGetTexLevelParameterivQCOM -#define glExtTexObjectStateOverrideiQCOM gles2wExtTexObjectStateOverrideiQCOM -#define glExtGetTexSubImageQCOM gles2wExtGetTexSubImageQCOM -#define glExtGetBufferPointervQCOM gles2wExtGetBufferPointervQCOM -#define glExtGetShadersQCOM gles2wExtGetShadersQCOM -#define glExtGetProgramsQCOM gles2wExtGetProgramsQCOM -#define glExtIsProgramBinaryQCOM gles2wExtIsProgramBinaryQCOM -#define glExtGetProgramBinarySourceQCOM gles2wExtGetProgramBinarySourceQCOM -#define glStartTilingQCOM gles2wStartTilingQCOM -#define glEndTilingQCOM gles2wEndTilingQCOM - -#ifdef __cplusplus -} -#endif diff --git a/native/cocos/renderer/gfx-gles2/gles2w.mm b/native/cocos/renderer/gfx-gles2/gles2w.mm deleted file mode 100755 index 8d6042d559..0000000000 --- a/native/cocos/renderer/gfx-gles2/gles2w.mm +++ /dev/null @@ -1,835 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "gles2w.h" - -#if defined(_WIN32) && !defined(ANDROID) -#define WIN32_LEAN_AND_MEAN 1 -#include -#include - -static HMODULE libgl; - -static int open_libgl(void) -{ - libgl = LoadLibraryA("libGLESv2.dll"); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - FreeLibrary(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - - res = (void*)eglGetProcAddress(proc); - if (!res) - res = (void*)GetProcAddress(libgl, proc); - return res; -} -#elif defined(__APPLE__) || defined(__APPLE_CC__) -#if TARGET_OS_IPHONE -#import -#import -#import -#import -#import - -// Routine to run a system command and retrieve the output. -// From http://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c -std::string ES2_EXEC(const char* cmd) { - FILE* pipe = popen(cmd, "r"); - if (!pipe) return "ERROR"; - char buffer[128]; - std::string result = ""; - while(!feof(pipe)) { - if(fgets(buffer, 128, pipe) != NULL) - result += buffer; - } - pclose(pipe); - return result; -} - -static CFBundleRef g_es2Bundle; -static CFURLRef g_es2BundleURL; - -static int open_libgl(void) -{ -#if TARGET_IPHONE_SIMULATOR - CFStringRef frameworkPath = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework"); -#else - CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework"); -#endif - - g_es2BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - frameworkPath, - kCFURLPOSIXPathStyle, true); - - CFRelease(frameworkPath); - - g_es2Bundle = CFBundleCreate(kCFAllocatorDefault, g_es2BundleURL); - - return (g_es2Bundle != NULL); -} - -static void close_libgl(void) -{ - CFRelease(g_es2Bundle); - CFRelease(g_es2BundleURL); -} - -static void *get_proc(const char *proc) -{ - void *res; - - CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, - kCFStringEncodingASCII); - res = CFBundleGetFunctionPointerForName(g_es2Bundle, procname); - CFRelease(procname); - return res; -} -#else -// macos -#include -#include -#include -#import -#import - -static void* libgl; - -static int open_libgl(void) -{ - NSURL *appURL = [[NSBundle mainBundle] bundleURL]; - std::string libPath(appURL.resourceSpecifier.UTF8String); - libPath.append("/Contents/Frameworks/libGLESv2.dylib"); - - libgl = dlopen(libPath.c_str(), RTLD_LOCAL|RTLD_LAZY); - if (!libgl) - printf("%s\n", dlerror()); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - dlclose(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - - res = (void*)eglGetProcAddress(proc); - if (!res) - res = (void*)dlsym(libgl, proc); - return res; -} -#endif // #if TARGET_OS_IPHONE -#elif defined(__EMSCRIPTEN__) -#include -static void open_libgl() {} -static void close_libgl() {} -static void *get_proc(const char *proc) -{ - return (void*)eglGetProcAddress(proc); -} -#else -#include -#include - -static void *libgl; - -static int open_libgl(void) -{ - libgl = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); - return libgl != NULL; -} - -static void close_libgl(void) -{ - dlclose(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - res = dlsym(libgl, proc); - return res; -} -#endif - -static struct { - int major, minor; -} version; - -static int parse_version(void) -{ - version.major = 2; - version.minor = 0; - - return 0; -} - -static void load_procs(void); - -int gles2wInit(void) -{ - if (!open_libgl()) - { - return 0; - } - - load_procs(); - close_libgl(); - parse_version(); - - return 1; -} - -int gles2wIsSupported(int major, int minor) -{ - if (major < 2) - return 0; - if (version.major == major) - return version.minor >= minor; - return version.major >= major; -} - -void *gles2wGetProcAddress(const char *proc) -{ - return get_proc(proc); -} - -PFNGLACTIVETEXTUREPROC gles2wActiveTexture; -PFNGLATTACHSHADERPROC gles2wAttachShader; -PFNGLBINDATTRIBLOCATIONPROC gles2wBindAttribLocation; -PFNGLBINDBUFFERPROC gles2wBindBuffer; -PFNGLBINDFRAMEBUFFERPROC gles2wBindFramebuffer; -PFNGLBINDRENDERBUFFERPROC gles2wBindRenderbuffer; -PFNGLBINDTEXTUREPROC gles2wBindTexture; -PFNGLBLENDCOLORPROC gles2wBlendColor; -PFNGLBLENDEQUATIONPROC gles2wBlendEquation; -PFNGLBLENDEQUATIONSEPARATEPROC gles2wBlendEquationSeparate; -PFNGLBLENDFUNCPROC gles2wBlendFunc; -PFNGLBLENDFUNCSEPARATEPROC gles2wBlendFuncSeparate; -PFNGLBUFFERDATAPROC gles2wBufferData; -PFNGLBUFFERSUBDATAPROC gles2wBufferSubData; -PFNGLCHECKFRAMEBUFFERSTATUSPROC gles2wCheckFramebufferStatus; -PFNGLCLEARPROC gles2wClear; -PFNGLCLEARCOLORPROC gles2wClearColor; -PFNGLCLEARDEPTHFPROC gles2wClearDepthf; -PFNGLCLEARSTENCILPROC gles2wClearStencil; -PFNGLCOLORMASKPROC gles2wColorMask; -PFNGLCOMPILESHADERPROC gles2wCompileShader; -PFNGLCOMPRESSEDTEXIMAGE2DPROC gles2wCompressedTexImage2D; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC gles2wCompressedTexSubImage2D; -PFNGLCOPYTEXIMAGE2DPROC gles2wCopyTexImage2D; -PFNGLCOPYTEXSUBIMAGE2DPROC gles2wCopyTexSubImage2D; -PFNGLCREATEPROGRAMPROC gles2wCreateProgram; -PFNGLCREATESHADERPROC gles2wCreateShader; -PFNGLCULLFACEPROC gles2wCullFace; -PFNGLDELETEBUFFERSPROC gles2wDeleteBuffers; -PFNGLDELETEFRAMEBUFFERSPROC gles2wDeleteFramebuffers; -PFNGLDELETEPROGRAMPROC gles2wDeleteProgram; -PFNGLDELETERENDERBUFFERSPROC gles2wDeleteRenderbuffers; -PFNGLDELETESHADERPROC gles2wDeleteShader; -PFNGLDELETETEXTURESPROC gles2wDeleteTextures; -PFNGLDEPTHFUNCPROC gles2wDepthFunc; -PFNGLDEPTHMASKPROC gles2wDepthMask; -PFNGLDEPTHRANGEFPROC gles2wDepthRangef; -PFNGLDETACHSHADERPROC gles2wDetachShader; -PFNGLDISABLEPROC gles2wDisable; -PFNGLDISABLEVERTEXATTRIBARRAYPROC gles2wDisableVertexAttribArray; -PFNGLDRAWARRAYSPROC gles2wDrawArrays; -PFNGLDRAWELEMENTSPROC gles2wDrawElements; -PFNGLENABLEPROC gles2wEnable; -PFNGLENABLEVERTEXATTRIBARRAYPROC gles2wEnableVertexAttribArray; -PFNGLFINISHPROC gles2wFinish; -PFNGLFLUSHPROC gles2wFlush; -PFNGLFRAMEBUFFERRENDERBUFFERPROC gles2wFramebufferRenderbuffer; -PFNGLFRAMEBUFFERTEXTURE2DPROC gles2wFramebufferTexture2D; -PFNGLFRONTFACEPROC gles2wFrontFace; -PFNGLGENBUFFERSPROC gles2wGenBuffers; -PFNGLGENERATEMIPMAPPROC gles2wGenerateMipmap; -PFNGLGENFRAMEBUFFERSPROC gles2wGenFramebuffers; -PFNGLGENRENDERBUFFERSPROC gles2wGenRenderbuffers; -PFNGLGENTEXTURESPROC gles2wGenTextures; -PFNGLGETACTIVEATTRIBPROC gles2wGetActiveAttrib; -PFNGLGETACTIVEUNIFORMPROC gles2wGetActiveUniform; -PFNGLGETATTACHEDSHADERSPROC gles2wGetAttachedShaders; -PFNGLGETATTRIBLOCATIONPROC gles2wGetAttribLocation; -PFNGLGETBOOLEANVPROC gles2wGetBooleanv; -PFNGLGETBUFFERPARAMETERIVPROC gles2wGetBufferParameteriv; -PFNGLGETERRORPROC gles2wGetError; -PFNGLGETFLOATVPROC gles2wGetFloatv; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC gles2wGetFramebufferAttachmentParameteriv; -PFNGLGETINTEGERVPROC gles2wGetIntegerv; -PFNGLGETPROGRAMIVPROC gles2wGetProgramiv; -PFNGLGETPROGRAMINFOLOGPROC gles2wGetProgramInfoLog; -PFNGLGETRENDERBUFFERPARAMETERIVPROC gles2wGetRenderbufferParameteriv; -PFNGLGETSHADERIVPROC gles2wGetShaderiv; -PFNGLGETSHADERINFOLOGPROC gles2wGetShaderInfoLog; -PFNGLGETSHADERPRECISIONFORMATPROC gles2wGetShaderPrecisionFormat; -PFNGLGETSHADERSOURCEPROC gles2wGetShaderSource; -PFNGLGETSTRINGPROC gles2wGetString; -PFNGLGETTEXPARAMETERFVPROC gles2wGetTexParameterfv; -PFNGLGETTEXPARAMETERIVPROC gles2wGetTexParameteriv; -PFNGLGETUNIFORMFVPROC gles2wGetUniformfv; -PFNGLGETUNIFORMIVPROC gles2wGetUniformiv; -PFNGLGETUNIFORMLOCATIONPROC gles2wGetUniformLocation; -PFNGLGETVERTEXATTRIBFVPROC gles2wGetVertexAttribfv; -PFNGLGETVERTEXATTRIBIVPROC gles2wGetVertexAttribiv; -PFNGLGETVERTEXATTRIBPOINTERVPROC gles2wGetVertexAttribPointerv; -PFNGLHINTPROC gles2wHint; -PFNGLISBUFFERPROC gles2wIsBuffer; -PFNGLISENABLEDPROC gles2wIsEnabled; -PFNGLISFRAMEBUFFERPROC gles2wIsFramebuffer; -PFNGLISPROGRAMPROC gles2wIsProgram; -PFNGLISRENDERBUFFERPROC gles2wIsRenderbuffer; -PFNGLISSHADERPROC gles2wIsShader; -PFNGLISTEXTUREPROC gles2wIsTexture; -PFNGLLINEWIDTHPROC gles2wLineWidth; -PFNGLLINKPROGRAMPROC gles2wLinkProgram; -PFNGLPIXELSTOREIPROC gles2wPixelStorei; -PFNGLPOLYGONOFFSETPROC gles2wPolygonOffset; -PFNGLREADPIXELSPROC gles2wReadPixels; -PFNGLRELEASESHADERCOMPILERPROC gles2wReleaseShaderCompiler; -PFNGLRENDERBUFFERSTORAGEPROC gles2wRenderbufferStorage; -PFNGLSAMPLECOVERAGEPROC gles2wSampleCoverage; -PFNGLSCISSORPROC gles2wScissor; -PFNGLSHADERBINARYPROC gles2wShaderBinary; -PFNGLSHADERSOURCEPROC gles2wShaderSource; -PFNGLSTENCILFUNCPROC gles2wStencilFunc; -PFNGLSTENCILFUNCSEPARATEPROC gles2wStencilFuncSeparate; -PFNGLSTENCILMASKPROC gles2wStencilMask; -PFNGLSTENCILMASKSEPARATEPROC gles2wStencilMaskSeparate; -PFNGLSTENCILOPPROC gles2wStencilOp; -PFNGLSTENCILOPSEPARATEPROC gles2wStencilOpSeparate; -PFNGLTEXIMAGE2DPROC gles2wTexImage2D; -PFNGLTEXPARAMETERFPROC gles2wTexParameterf; -PFNGLTEXPARAMETERFVPROC gles2wTexParameterfv; -PFNGLTEXPARAMETERIPROC gles2wTexParameteri; -PFNGLTEXPARAMETERIVPROC gles2wTexParameteriv; -PFNGLTEXSUBIMAGE2DPROC gles2wTexSubImage2D; -PFNGLUNIFORM1FPROC gles2wUniform1f; -PFNGLUNIFORM1FVPROC gles2wUniform1fv; -PFNGLUNIFORM1IPROC gles2wUniform1i; -PFNGLUNIFORM1IVPROC gles2wUniform1iv; -PFNGLUNIFORM2FPROC gles2wUniform2f; -PFNGLUNIFORM2FVPROC gles2wUniform2fv; -PFNGLUNIFORM2IPROC gles2wUniform2i; -PFNGLUNIFORM2IVPROC gles2wUniform2iv; -PFNGLUNIFORM3FPROC gles2wUniform3f; -PFNGLUNIFORM3FVPROC gles2wUniform3fv; -PFNGLUNIFORM3IPROC gles2wUniform3i; -PFNGLUNIFORM3IVPROC gles2wUniform3iv; -PFNGLUNIFORM4FPROC gles2wUniform4f; -PFNGLUNIFORM4FVPROC gles2wUniform4fv; -PFNGLUNIFORM4IPROC gles2wUniform4i; -PFNGLUNIFORM4IVPROC gles2wUniform4iv; -PFNGLUNIFORMMATRIX2FVPROC gles2wUniformMatrix2fv; -PFNGLUNIFORMMATRIX3FVPROC gles2wUniformMatrix3fv; -PFNGLUNIFORMMATRIX4FVPROC gles2wUniformMatrix4fv; -PFNGLUSEPROGRAMPROC gles2wUseProgram; -PFNGLVALIDATEPROGRAMPROC gles2wValidateProgram; -PFNGLVERTEXATTRIB1FPROC gles2wVertexAttrib1f; -PFNGLVERTEXATTRIB1FVPROC gles2wVertexAttrib1fv; -PFNGLVERTEXATTRIB2FPROC gles2wVertexAttrib2f; -PFNGLVERTEXATTRIB2FVPROC gles2wVertexAttrib2fv; -PFNGLVERTEXATTRIB3FPROC gles2wVertexAttrib3f; -PFNGLVERTEXATTRIB3FVPROC gles2wVertexAttrib3fv; -PFNGLVERTEXATTRIB4FPROC gles2wVertexAttrib4f; -PFNGLVERTEXATTRIB4FVPROC gles2wVertexAttrib4fv; -PFNGLVERTEXATTRIBPOINTERPROC gles2wVertexAttribPointer; -PFNGLVIEWPORTPROC gles2wViewport; -PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gles2wEGLImageTargetTexture2DOES; -PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC gles2wEGLImageTargetRenderbufferStorageOES; -PFNGLGETPROGRAMBINARYOESPROC gles2wGetProgramBinaryOES; -PFNGLPROGRAMBINARYOESPROC gles2wProgramBinaryOES; -PFNGLMAPBUFFEROESPROC gles2wMapBufferOES; -PFNGLUNMAPBUFFEROESPROC gles2wUnmapBufferOES; -PFNGLGETBUFFERPOINTERVOESPROC gles2wGetBufferPointervOES; -PFNGLTEXIMAGE3DOESPROC gles2wTexImage3DOES; -PFNGLTEXSUBIMAGE3DOESPROC gles2wTexSubImage3DOES; -PFNGLCOPYTEXSUBIMAGE3DOESPROC gles2wCopyTexSubImage3DOES; -PFNGLCOMPRESSEDTEXIMAGE3DOESPROC gles2wCompressedTexImage3DOES; -PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC gles2wCompressedTexSubImage3DOES; -PFNGLFRAMEBUFFERTEXTURE3DOESPROC gles2wFramebufferTexture3DOES; -PFNGLBINDVERTEXARRAYOESPROC gles2wBindVertexArrayOES; -PFNGLDELETEVERTEXARRAYSOESPROC gles2wDeleteVertexArraysOES; -PFNGLGENVERTEXARRAYSOESPROC gles2wGenVertexArraysOES; -PFNGLISVERTEXARRAYOESPROC gles2wIsVertexArrayOES; -PFNGLDEBUGMESSAGECONTROLKHRPROC gles2wDebugMessageControlKHR; -PFNGLDEBUGMESSAGEINSERTKHRPROC gles2wDebugMessageInsertKHR; -PFNGLDEBUGMESSAGECALLBACKKHRPROC gles2wDebugMessageCallbackKHR; -PFNGLGETDEBUGMESSAGELOGKHRPROC gles2wGetDebugMessageLogKHR; -PFNGLPUSHDEBUGGROUPKHRPROC gles2wPushDebugGroupKHR; -PFNGLPOPDEBUGGROUPKHRPROC gles2wPopDebugGroupKHR; -PFNGLOBJECTLABELKHRPROC gles2wObjectLabelKHR; -PFNGLGETOBJECTLABELKHRPROC gles2wGetObjectLabelKHR; -PFNGLOBJECTPTRLABELKHRPROC gles2wObjectPtrLabelKHR; -PFNGLGETOBJECTPTRLABELKHRPROC gles2wGetObjectPtrLabelKHR; -PFNGLGETPOINTERVKHRPROC gles2wGetPointervKHR; -PFNGLGETPERFMONITORGROUPSAMDPROC gles2wGetPerfMonitorGroupsAMD; -PFNGLGETPERFMONITORCOUNTERSAMDPROC gles2wGetPerfMonitorCountersAMD; -PFNGLGETPERFMONITORGROUPSTRINGAMDPROC gles2wGetPerfMonitorGroupStringAMD; -PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC gles2wGetPerfMonitorCounterStringAMD; -PFNGLGETPERFMONITORCOUNTERINFOAMDPROC gles2wGetPerfMonitorCounterInfoAMD; -PFNGLGENPERFMONITORSAMDPROC gles2wGenPerfMonitorsAMD; -PFNGLDELETEPERFMONITORSAMDPROC gles2wDeletePerfMonitorsAMD; -PFNGLSELECTPERFMONITORCOUNTERSAMDPROC gles2wSelectPerfMonitorCountersAMD; -PFNGLBEGINPERFMONITORAMDPROC gles2wBeginPerfMonitorAMD; -PFNGLENDPERFMONITORAMDPROC gles2wEndPerfMonitorAMD; -PFNGLGETPERFMONITORCOUNTERDATAAMDPROC gles2wGetPerfMonitorCounterDataAMD; -PFNGLBLITFRAMEBUFFERANGLEPROC gles2wBlitFramebufferANGLE; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC gles2wRenderbufferStorageMultisampleANGLE; -PFNGLDRAWARRAYSINSTANCEDANGLEPROC gles2wDrawArraysInstancedANGLE; -PFNGLDRAWELEMENTSINSTANCEDANGLEPROC gles2wDrawElementsInstancedANGLE; -PFNGLVERTEXATTRIBDIVISORANGLEPROC gles2wVertexAttribDivisorANGLE; -PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC gles2wGetTranslatedShaderSourceANGLE; -PFNGLDRAWARRAYSINSTANCEDEXTPROC gles2wDrawArraysInstancedEXT; -PFNGLDRAWELEMENTSINSTANCEDEXTPROC gles2wDrawElementsInstancedEXT; -PFNGLVERTEXATTRIBDIVISOREXTPROC gles2wVertexAttribDivisorEXT; -PFNGLCOPYTEXTURELEVELSAPPLEPROC gles2wCopyTextureLevelsAPPLE; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC gles2wRenderbufferStorageMultisampleAPPLE; -PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC gles2wResolveMultisampleFramebufferAPPLE; -PFNGLFENCESYNCAPPLEPROC gles2wFenceSyncAPPLE; -PFNGLISSYNCAPPLEPROC gles2wIsSyncAPPLE; -PFNGLDELETESYNCAPPLEPROC gles2wDeleteSyncAPPLE; -PFNGLCLIENTWAITSYNCAPPLEPROC gles2wClientWaitSyncAPPLE; -PFNGLWAITSYNCAPPLEPROC gles2wWaitSyncAPPLE; -PFNGLGETINTEGER64VAPPLEPROC gles2wGetInteger64vAPPLE; -PFNGLGETSYNCIVAPPLEPROC gles2wGetSyncivAPPLE; -PFNGLLABELOBJECTEXTPROC gles2wLabelObjectEXT; -PFNGLGETOBJECTLABELEXTPROC gles2wGetObjectLabelEXT; -PFNGLINSERTEVENTMARKEREXTPROC gles2wInsertEventMarkerEXT; -PFNGLPUSHGROUPMARKEREXTPROC gles2wPushGroupMarkerEXT; -PFNGLPOPGROUPMARKEREXTPROC gles2wPopGroupMarkerEXT; -PFNGLDISCARDFRAMEBUFFEREXTPROC gles2wDiscardFramebufferEXT; -PFNGLGENQUERIESEXTPROC gles2wGenQueriesEXT; -PFNGLDELETEQUERIESEXTPROC gles2wDeleteQueriesEXT; -PFNGLISQUERYEXTPROC gles2wIsQueryEXT; -PFNGLBEGINQUERYEXTPROC gles2wBeginQueryEXT; -PFNGLENDQUERYEXTPROC gles2wEndQueryEXT; -PFNGLQUERYCOUNTEREXTPROC gles2wQueryCounterEXT; -PFNGLGETQUERYIVEXTPROC gles2wGetQueryivEXT; -PFNGLGETQUERYOBJECTIVEXTPROC gles2wGetQueryObjectivEXT; -PFNGLGETQUERYOBJECTUIVEXTPROC gles2wGetQueryObjectuivEXT; -PFNGLGETQUERYOBJECTI64VEXTPROC gles2wGetQueryObjecti64vEXT; -PFNGLGETQUERYOBJECTUI64VEXTPROC gles2wGetQueryObjectui64vEXT; -PFNGLMAPBUFFERRANGEEXTPROC gles2wMapBufferRangeEXT; -PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC gles2wFlushMappedBufferRangeEXT; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC gles2wRenderbufferStorageMultisampleEXT; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC gles2wFramebufferTexture2DMultisampleEXT; -PFNGLREADBUFFERINDEXEDEXTPROC gles2wReadBufferIndexedEXT; -PFNGLDRAWBUFFERSINDEXEDEXTPROC gles2wDrawBuffersIndexedEXT; -PFNGLGETINTEGERI_VEXTPROC gles2wGetIntegeri_vEXT; -PFNGLMULTIDRAWARRAYSEXTPROC gles2wMultiDrawArraysEXT; -PFNGLMULTIDRAWELEMENTSEXTPROC gles2wMultiDrawElementsEXT; -PFNGLGETGRAPHICSRESETSTATUSEXTPROC gles2wGetGraphicsResetStatusEXT; -PFNGLREADNPIXELSEXTPROC gles2wReadnPixelsEXT; -PFNGLGETNUNIFORMFVEXTPROC gles2wGetnUniformfvEXT; -PFNGLGETNUNIFORMIVEXTPROC gles2wGetnUniformivEXT; -PFNGLUSEPROGRAMSTAGESEXTPROC gles2wUseProgramStagesEXT; -PFNGLACTIVESHADERPROGRAMEXTPROC gles2wActiveShaderProgramEXT; -PFNGLCREATESHADERPROGRAMVEXTPROC gles2wCreateShaderProgramvEXT; -PFNGLBINDPROGRAMPIPELINEEXTPROC gles2wBindProgramPipelineEXT; -PFNGLDELETEPROGRAMPIPELINESEXTPROC gles2wDeleteProgramPipelinesEXT; -PFNGLGENPROGRAMPIPELINESEXTPROC gles2wGenProgramPipelinesEXT; -PFNGLISPROGRAMPIPELINEEXTPROC gles2wIsProgramPipelineEXT; -PFNGLPROGRAMPARAMETERIEXTPROC gles2wProgramParameteriEXT; -PFNGLGETPROGRAMPIPELINEIVEXTPROC gles2wGetProgramPipelineivEXT; -PFNGLPROGRAMUNIFORM1IEXTPROC gles2wProgramUniform1iEXT; -PFNGLPROGRAMUNIFORM2IEXTPROC gles2wProgramUniform2iEXT; -PFNGLPROGRAMUNIFORM3IEXTPROC gles2wProgramUniform3iEXT; -PFNGLPROGRAMUNIFORM4IEXTPROC gles2wProgramUniform4iEXT; -PFNGLPROGRAMUNIFORM1FEXTPROC gles2wProgramUniform1fEXT; -PFNGLPROGRAMUNIFORM2FEXTPROC gles2wProgramUniform2fEXT; -PFNGLPROGRAMUNIFORM3FEXTPROC gles2wProgramUniform3fEXT; -PFNGLPROGRAMUNIFORM4FEXTPROC gles2wProgramUniform4fEXT; -PFNGLPROGRAMUNIFORM1IVEXTPROC gles2wProgramUniform1ivEXT; -PFNGLPROGRAMUNIFORM2IVEXTPROC gles2wProgramUniform2ivEXT; -PFNGLPROGRAMUNIFORM3IVEXTPROC gles2wProgramUniform3ivEXT; -PFNGLPROGRAMUNIFORM4IVEXTPROC gles2wProgramUniform4ivEXT; -PFNGLPROGRAMUNIFORM1FVEXTPROC gles2wProgramUniform1fvEXT; -PFNGLPROGRAMUNIFORM2FVEXTPROC gles2wProgramUniform2fvEXT; -PFNGLPROGRAMUNIFORM3FVEXTPROC gles2wProgramUniform3fvEXT; -PFNGLPROGRAMUNIFORM4FVEXTPROC gles2wProgramUniform4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC gles2wProgramUniformMatrix2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC gles2wProgramUniformMatrix3fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC gles2wProgramUniformMatrix4fvEXT; -PFNGLVALIDATEPROGRAMPIPELINEEXTPROC gles2wValidateProgramPipelineEXT; -PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC gles2wGetProgramPipelineInfoLogEXT; -PFNGLTEXSTORAGE1DEXTPROC gles2wTexStorage1DEXT; -PFNGLTEXSTORAGE2DEXTPROC gles2wTexStorage2DEXT; -PFNGLTEXSTORAGE3DEXTPROC gles2wTexStorage3DEXT; -PFNGLTEXTURESTORAGE1DEXTPROC gles2wTextureStorage1DEXT; -PFNGLTEXTURESTORAGE2DEXTPROC gles2wTextureStorage2DEXT; -PFNGLTEXTURESTORAGE3DEXTPROC gles2wTextureStorage3DEXT; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC gles2wRenderbufferStorageMultisampleIMG; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC gles2wFramebufferTexture2DMultisampleIMG; -PFNGLCOVERAGEMASKNVPROC gles2wCoverageMaskNV; -PFNGLCOVERAGEOPERATIONNVPROC gles2wCoverageOperationNV; -PFNGLDRAWBUFFERSNVPROC gles2wDrawBuffersNV; -PFNGLDRAWARRAYSINSTANCEDNVPROC gles2wDrawArraysInstancedNV; -PFNGLDRAWELEMENTSINSTANCEDNVPROC gles2wDrawElementsInstancedNV; -PFNGLDELETEFENCESNVPROC gles2wDeleteFencesNV; -PFNGLGENFENCESNVPROC gles2wGenFencesNV; -PFNGLISFENCENVPROC gles2wIsFenceNV; -PFNGLTESTFENCENVPROC gles2wTestFenceNV; -PFNGLGETFENCEIVNVPROC gles2wGetFenceivNV; -PFNGLFINISHFENCENVPROC gles2wFinishFenceNV; -PFNGLSETFENCENVPROC gles2wSetFenceNV; -PFNGLBLITFRAMEBUFFERNVPROC gles2wBlitFramebufferNV; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC gles2wRenderbufferStorageMultisampleNV; -PFNGLVERTEXATTRIBDIVISORNVPROC gles2wVertexAttribDivisorNV; -PFNGLREADBUFFERNVPROC gles2wReadBufferNV; -PFNGLALPHAFUNCQCOMPROC gles2wAlphaFuncQCOM; -PFNGLGETDRIVERCONTROLSQCOMPROC gles2wGetDriverControlsQCOM; -PFNGLGETDRIVERCONTROLSTRINGQCOMPROC gles2wGetDriverControlStringQCOM; -PFNGLENABLEDRIVERCONTROLQCOMPROC gles2wEnableDriverControlQCOM; -PFNGLDISABLEDRIVERCONTROLQCOMPROC gles2wDisableDriverControlQCOM; -PFNGLEXTGETTEXTURESQCOMPROC gles2wExtGetTexturesQCOM; -PFNGLEXTGETBUFFERSQCOMPROC gles2wExtGetBuffersQCOM; -PFNGLEXTGETRENDERBUFFERSQCOMPROC gles2wExtGetRenderbuffersQCOM; -PFNGLEXTGETFRAMEBUFFERSQCOMPROC gles2wExtGetFramebuffersQCOM; -PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC gles2wExtGetTexLevelParameterivQCOM; -PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC gles2wExtTexObjectStateOverrideiQCOM; -PFNGLEXTGETTEXSUBIMAGEQCOMPROC gles2wExtGetTexSubImageQCOM; -PFNGLEXTGETBUFFERPOINTERVQCOMPROC gles2wExtGetBufferPointervQCOM; -PFNGLEXTGETSHADERSQCOMPROC gles2wExtGetShadersQCOM; -PFNGLEXTGETPROGRAMSQCOMPROC gles2wExtGetProgramsQCOM; -PFNGLEXTISPROGRAMBINARYQCOMPROC gles2wExtIsProgramBinaryQCOM; -PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC gles2wExtGetProgramBinarySourceQCOM; -PFNGLSTARTTILINGQCOMPROC gles2wStartTilingQCOM; -PFNGLENDTILINGQCOMPROC gles2wEndTilingQCOM; - -static void load_procs(void) -{ - gles2wActiveTexture = (PFNGLACTIVETEXTUREPROC) get_proc("glActiveTexture"); - gles2wAttachShader = (PFNGLATTACHSHADERPROC) get_proc("glAttachShader"); - gles2wBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) get_proc("glBindAttribLocation"); - gles2wBindBuffer = (PFNGLBINDBUFFERPROC) get_proc("glBindBuffer"); - gles2wBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) get_proc("glBindFramebuffer"); - gles2wBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) get_proc("glBindRenderbuffer"); - gles2wBindTexture = (PFNGLBINDTEXTUREPROC) get_proc("glBindTexture"); - gles2wBlendColor = (PFNGLBLENDCOLORPROC) get_proc("glBlendColor"); - gles2wBlendEquation = (PFNGLBLENDEQUATIONPROC) get_proc("glBlendEquation"); - gles2wBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) get_proc("glBlendEquationSeparate"); - gles2wBlendFunc = (PFNGLBLENDFUNCPROC) get_proc("glBlendFunc"); - gles2wBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) get_proc("glBlendFuncSeparate"); - gles2wBufferData = (PFNGLBUFFERDATAPROC) get_proc("glBufferData"); - gles2wBufferSubData = (PFNGLBUFFERSUBDATAPROC) get_proc("glBufferSubData"); - gles2wCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) get_proc("glCheckFramebufferStatus"); - gles2wClear = (PFNGLCLEARPROC) get_proc("glClear"); - gles2wClearColor = (PFNGLCLEARCOLORPROC) get_proc("glClearColor"); - gles2wClearDepthf = (PFNGLCLEARDEPTHFPROC) get_proc("glClearDepthf"); - gles2wClearStencil = (PFNGLCLEARSTENCILPROC) get_proc("glClearStencil"); - gles2wColorMask = (PFNGLCOLORMASKPROC) get_proc("glColorMask"); - gles2wCompileShader = (PFNGLCOMPILESHADERPROC) get_proc("glCompileShader"); - gles2wCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) get_proc("glCompressedTexImage2D"); - gles2wCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) get_proc("glCompressedTexSubImage2D"); - gles2wCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) get_proc("glCopyTexImage2D"); - gles2wCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) get_proc("glCopyTexSubImage2D"); - gles2wCreateProgram = (PFNGLCREATEPROGRAMPROC) get_proc("glCreateProgram"); - gles2wCreateShader = (PFNGLCREATESHADERPROC) get_proc("glCreateShader"); - gles2wCullFace = (PFNGLCULLFACEPROC) get_proc("glCullFace"); - gles2wDeleteBuffers = (PFNGLDELETEBUFFERSPROC) get_proc("glDeleteBuffers"); - gles2wDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) get_proc("glDeleteFramebuffers"); - gles2wDeleteProgram = (PFNGLDELETEPROGRAMPROC) get_proc("glDeleteProgram"); - gles2wDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) get_proc("glDeleteRenderbuffers"); - gles2wDeleteShader = (PFNGLDELETESHADERPROC) get_proc("glDeleteShader"); - gles2wDeleteTextures = (PFNGLDELETETEXTURESPROC) get_proc("glDeleteTextures"); - gles2wDepthFunc = (PFNGLDEPTHFUNCPROC) get_proc("glDepthFunc"); - gles2wDepthMask = (PFNGLDEPTHMASKPROC) get_proc("glDepthMask"); - gles2wDepthRangef = (PFNGLDEPTHRANGEFPROC) get_proc("glDepthRangef"); - gles2wDetachShader = (PFNGLDETACHSHADERPROC) get_proc("glDetachShader"); - gles2wDisable = (PFNGLDISABLEPROC) get_proc("glDisable"); - gles2wDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) get_proc("glDisableVertexAttribArray"); - gles2wDrawArrays = (PFNGLDRAWARRAYSPROC) get_proc("glDrawArrays"); - gles2wDrawElements = (PFNGLDRAWELEMENTSPROC) get_proc("glDrawElements"); - gles2wEnable = (PFNGLENABLEPROC) get_proc("glEnable"); - gles2wEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) get_proc("glEnableVertexAttribArray"); - gles2wFinish = (PFNGLFINISHPROC) get_proc("glFinish"); - gles2wFlush = (PFNGLFLUSHPROC) get_proc("glFlush"); - gles2wFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) get_proc("glFramebufferRenderbuffer"); - gles2wFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) get_proc("glFramebufferTexture2D"); - gles2wFrontFace = (PFNGLFRONTFACEPROC) get_proc("glFrontFace"); - gles2wGenBuffers = (PFNGLGENBUFFERSPROC) get_proc("glGenBuffers"); - gles2wGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) get_proc("glGenerateMipmap"); - gles2wGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) get_proc("glGenFramebuffers"); - gles2wGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) get_proc("glGenRenderbuffers"); - gles2wGenTextures = (PFNGLGENTEXTURESPROC) get_proc("glGenTextures"); - gles2wGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) get_proc("glGetActiveAttrib"); - gles2wGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) get_proc("glGetActiveUniform"); - gles2wGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) get_proc("glGetAttachedShaders"); - gles2wGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) get_proc("glGetAttribLocation"); - gles2wGetBooleanv = (PFNGLGETBOOLEANVPROC) get_proc("glGetBooleanv"); - gles2wGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) get_proc("glGetBufferParameteriv"); - gles2wGetError = (PFNGLGETERRORPROC) get_proc("glGetError"); - gles2wGetFloatv = (PFNGLGETFLOATVPROC) get_proc("glGetFloatv"); - gles2wGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) get_proc("glGetFramebufferAttachmentParameteriv"); - gles2wGetIntegerv = (PFNGLGETINTEGERVPROC) get_proc("glGetIntegerv"); - gles2wGetProgramiv = (PFNGLGETPROGRAMIVPROC) get_proc("glGetProgramiv"); - gles2wGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) get_proc("glGetProgramInfoLog"); - gles2wGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) get_proc("glGetRenderbufferParameteriv"); - gles2wGetShaderiv = (PFNGLGETSHADERIVPROC) get_proc("glGetShaderiv"); - gles2wGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) get_proc("glGetShaderInfoLog"); - gles2wGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC) get_proc("glGetShaderPrecisionFormat"); - gles2wGetShaderSource = (PFNGLGETSHADERSOURCEPROC) get_proc("glGetShaderSource"); - gles2wGetString = (PFNGLGETSTRINGPROC) get_proc("glGetString"); - gles2wGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) get_proc("glGetTexParameterfv"); - gles2wGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) get_proc("glGetTexParameteriv"); - gles2wGetUniformfv = (PFNGLGETUNIFORMFVPROC) get_proc("glGetUniformfv"); - gles2wGetUniformiv = (PFNGLGETUNIFORMIVPROC) get_proc("glGetUniformiv"); - gles2wGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) get_proc("glGetUniformLocation"); - gles2wGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) get_proc("glGetVertexAttribfv"); - gles2wGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) get_proc("glGetVertexAttribiv"); - gles2wGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) get_proc("glGetVertexAttribPointerv"); - gles2wHint = (PFNGLHINTPROC) get_proc("glHint"); - gles2wIsBuffer = (PFNGLISBUFFERPROC) get_proc("glIsBuffer"); - gles2wIsEnabled = (PFNGLISENABLEDPROC) get_proc("glIsEnabled"); - gles2wIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) get_proc("glIsFramebuffer"); - gles2wIsProgram = (PFNGLISPROGRAMPROC) get_proc("glIsProgram"); - gles2wIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) get_proc("glIsRenderbuffer"); - gles2wIsShader = (PFNGLISSHADERPROC) get_proc("glIsShader"); - gles2wIsTexture = (PFNGLISTEXTUREPROC) get_proc("glIsTexture"); - gles2wLineWidth = (PFNGLLINEWIDTHPROC) get_proc("glLineWidth"); - gles2wLinkProgram = (PFNGLLINKPROGRAMPROC) get_proc("glLinkProgram"); - gles2wPixelStorei = (PFNGLPIXELSTOREIPROC) get_proc("glPixelStorei"); - gles2wPolygonOffset = (PFNGLPOLYGONOFFSETPROC) get_proc("glPolygonOffset"); - gles2wReadPixels = (PFNGLREADPIXELSPROC) get_proc("glReadPixels"); - gles2wReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC) get_proc("glReleaseShaderCompiler"); - gles2wRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) get_proc("glRenderbufferStorage"); - gles2wSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) get_proc("glSampleCoverage"); - gles2wScissor = (PFNGLSCISSORPROC) get_proc("glScissor"); - gles2wShaderBinary = (PFNGLSHADERBINARYPROC) get_proc("glShaderBinary"); - gles2wShaderSource = (PFNGLSHADERSOURCEPROC) get_proc("glShaderSource"); - gles2wStencilFunc = (PFNGLSTENCILFUNCPROC) get_proc("glStencilFunc"); - gles2wStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) get_proc("glStencilFuncSeparate"); - gles2wStencilMask = (PFNGLSTENCILMASKPROC) get_proc("glStencilMask"); - gles2wStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) get_proc("glStencilMaskSeparate"); - gles2wStencilOp = (PFNGLSTENCILOPPROC) get_proc("glStencilOp"); - gles2wStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) get_proc("glStencilOpSeparate"); - gles2wTexImage2D = (PFNGLTEXIMAGE2DPROC) get_proc("glTexImage2D"); - gles2wTexParameterf = (PFNGLTEXPARAMETERFPROC) get_proc("glTexParameterf"); - gles2wTexParameterfv = (PFNGLTEXPARAMETERFVPROC) get_proc("glTexParameterfv"); - gles2wTexParameteri = (PFNGLTEXPARAMETERIPROC) get_proc("glTexParameteri"); - gles2wTexParameteriv = (PFNGLTEXPARAMETERIVPROC) get_proc("glTexParameteriv"); - gles2wTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) get_proc("glTexSubImage2D"); - gles2wUniform1f = (PFNGLUNIFORM1FPROC) get_proc("glUniform1f"); - gles2wUniform1fv = (PFNGLUNIFORM1FVPROC) get_proc("glUniform1fv"); - gles2wUniform1i = (PFNGLUNIFORM1IPROC) get_proc("glUniform1i"); - gles2wUniform1iv = (PFNGLUNIFORM1IVPROC) get_proc("glUniform1iv"); - gles2wUniform2f = (PFNGLUNIFORM2FPROC) get_proc("glUniform2f"); - gles2wUniform2fv = (PFNGLUNIFORM2FVPROC) get_proc("glUniform2fv"); - gles2wUniform2i = (PFNGLUNIFORM2IPROC) get_proc("glUniform2i"); - gles2wUniform2iv = (PFNGLUNIFORM2IVPROC) get_proc("glUniform2iv"); - gles2wUniform3f = (PFNGLUNIFORM3FPROC) get_proc("glUniform3f"); - gles2wUniform3fv = (PFNGLUNIFORM3FVPROC) get_proc("glUniform3fv"); - gles2wUniform3i = (PFNGLUNIFORM3IPROC) get_proc("glUniform3i"); - gles2wUniform3iv = (PFNGLUNIFORM3IVPROC) get_proc("glUniform3iv"); - gles2wUniform4f = (PFNGLUNIFORM4FPROC) get_proc("glUniform4f"); - gles2wUniform4fv = (PFNGLUNIFORM4FVPROC) get_proc("glUniform4fv"); - gles2wUniform4i = (PFNGLUNIFORM4IPROC) get_proc("glUniform4i"); - gles2wUniform4iv = (PFNGLUNIFORM4IVPROC) get_proc("glUniform4iv"); - gles2wUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) get_proc("glUniformMatrix2fv"); - gles2wUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) get_proc("glUniformMatrix3fv"); - gles2wUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) get_proc("glUniformMatrix4fv"); - gles2wUseProgram = (PFNGLUSEPROGRAMPROC) get_proc("glUseProgram"); - gles2wValidateProgram = (PFNGLVALIDATEPROGRAMPROC) get_proc("glValidateProgram"); - gles2wVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) get_proc("glVertexAttrib1f"); - gles2wVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) get_proc("glVertexAttrib1fv"); - gles2wVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) get_proc("glVertexAttrib2f"); - gles2wVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) get_proc("glVertexAttrib2fv"); - gles2wVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) get_proc("glVertexAttrib3f"); - gles2wVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) get_proc("glVertexAttrib3fv"); - gles2wVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) get_proc("glVertexAttrib4f"); - gles2wVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) get_proc("glVertexAttrib4fv"); - gles2wVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) get_proc("glVertexAttribPointer"); - gles2wViewport = (PFNGLVIEWPORTPROC) get_proc("glViewport"); - gles2wEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) get_proc("glEGLImageTargetTexture2DOES"); - gles2wEGLImageTargetRenderbufferStorageOES = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) get_proc("glEGLImageTargetRenderbufferStorageOES"); - gles2wGetProgramBinaryOES = (PFNGLGETPROGRAMBINARYOESPROC) get_proc("glGetProgramBinaryOES"); - gles2wProgramBinaryOES = (PFNGLPROGRAMBINARYOESPROC) get_proc("glProgramBinaryOES"); - gles2wMapBufferOES = (PFNGLMAPBUFFEROESPROC) get_proc("glMapBufferOES"); - gles2wUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC) get_proc("glUnmapBufferOES"); - gles2wGetBufferPointervOES = (PFNGLGETBUFFERPOINTERVOESPROC) get_proc("glGetBufferPointervOES"); - gles2wTexImage3DOES = (PFNGLTEXIMAGE3DOESPROC) get_proc("glTexImage3DOES"); - gles2wTexSubImage3DOES = (PFNGLTEXSUBIMAGE3DOESPROC) get_proc("glTexSubImage3DOES"); - gles2wCopyTexSubImage3DOES = (PFNGLCOPYTEXSUBIMAGE3DOESPROC) get_proc("glCopyTexSubImage3DOES"); - gles2wCompressedTexImage3DOES = (PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) get_proc("glCompressedTexImage3DOES"); - gles2wCompressedTexSubImage3DOES = (PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) get_proc("glCompressedTexSubImage3DOES"); - gles2wFramebufferTexture3DOES = (PFNGLFRAMEBUFFERTEXTURE3DOESPROC) get_proc("glFramebufferTexture3DOES"); - gles2wBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC) get_proc("glBindVertexArrayOES"); - gles2wDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC) get_proc("glDeleteVertexArraysOES"); - gles2wGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC) get_proc("glGenVertexArraysOES"); - gles2wIsVertexArrayOES = (PFNGLISVERTEXARRAYOESPROC) get_proc("glIsVertexArrayOES"); - gles2wDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC) get_proc("glDebugMessageControlKHR"); - gles2wDebugMessageInsertKHR = (PFNGLDEBUGMESSAGEINSERTKHRPROC) get_proc("glDebugMessageInsertKHR"); - gles2wDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC) get_proc("glDebugMessageCallbackKHR"); - gles2wGetDebugMessageLogKHR = (PFNGLGETDEBUGMESSAGELOGKHRPROC) get_proc("glGetDebugMessageLogKHR"); - gles2wPushDebugGroupKHR = (PFNGLPUSHDEBUGGROUPKHRPROC) get_proc("glPushDebugGroupKHR"); - gles2wPopDebugGroupKHR = (PFNGLPOPDEBUGGROUPKHRPROC) get_proc("glPopDebugGroupKHR"); - gles2wObjectLabelKHR = (PFNGLOBJECTLABELKHRPROC) get_proc("glObjectLabelKHR"); - gles2wGetObjectLabelKHR = (PFNGLGETOBJECTLABELKHRPROC) get_proc("glGetObjectLabelKHR"); - gles2wObjectPtrLabelKHR = (PFNGLOBJECTPTRLABELKHRPROC) get_proc("glObjectPtrLabelKHR"); - gles2wGetObjectPtrLabelKHR = (PFNGLGETOBJECTPTRLABELKHRPROC) get_proc("glGetObjectPtrLabelKHR"); - gles2wGetPointervKHR = (PFNGLGETPOINTERVKHRPROC) get_proc("glGetPointervKHR"); - gles2wGetPerfMonitorGroupsAMD = (PFNGLGETPERFMONITORGROUPSAMDPROC) get_proc("glGetPerfMonitorGroupsAMD"); - gles2wGetPerfMonitorCountersAMD = (PFNGLGETPERFMONITORCOUNTERSAMDPROC) get_proc("glGetPerfMonitorCountersAMD"); - gles2wGetPerfMonitorGroupStringAMD = (PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) get_proc("glGetPerfMonitorGroupStringAMD"); - gles2wGetPerfMonitorCounterStringAMD = (PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) get_proc("glGetPerfMonitorCounterStringAMD"); - gles2wGetPerfMonitorCounterInfoAMD = (PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) get_proc("glGetPerfMonitorCounterInfoAMD"); - gles2wGenPerfMonitorsAMD = (PFNGLGENPERFMONITORSAMDPROC) get_proc("glGenPerfMonitorsAMD"); - gles2wDeletePerfMonitorsAMD = (PFNGLDELETEPERFMONITORSAMDPROC) get_proc("glDeletePerfMonitorsAMD"); - gles2wSelectPerfMonitorCountersAMD = (PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) get_proc("glSelectPerfMonitorCountersAMD"); - gles2wBeginPerfMonitorAMD = (PFNGLBEGINPERFMONITORAMDPROC) get_proc("glBeginPerfMonitorAMD"); - gles2wEndPerfMonitorAMD = (PFNGLENDPERFMONITORAMDPROC) get_proc("glEndPerfMonitorAMD"); - gles2wGetPerfMonitorCounterDataAMD = (PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) get_proc("glGetPerfMonitorCounterDataAMD"); - gles2wBlitFramebufferANGLE = (PFNGLBLITFRAMEBUFFERANGLEPROC) get_proc("glBlitFramebufferANGLE"); - gles2wRenderbufferStorageMultisampleANGLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) get_proc("glRenderbufferStorageMultisampleANGLE"); - gles2wDrawArraysInstancedANGLE = (PFNGLDRAWARRAYSINSTANCEDANGLEPROC) get_proc("glDrawArraysInstancedANGLE"); - gles2wDrawElementsInstancedANGLE = (PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) get_proc("glDrawElementsInstancedANGLE"); - gles2wVertexAttribDivisorANGLE = (PFNGLVERTEXATTRIBDIVISORANGLEPROC) get_proc("glVertexAttribDivisorANGLE"); - gles2wGetTranslatedShaderSourceANGLE = (PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) get_proc("glGetTranslatedShaderSourceANGLE"); - gles2wDrawArraysInstancedEXT = (PFNGLDRAWARRAYSINSTANCEDEXTPROC) get_proc("glDrawArraysInstancedEXT"); - gles2wDrawElementsInstancedEXT = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC) get_proc("glDrawElementsInstancedEXT"); - gles2wVertexAttribDivisorEXT = (PFNGLVERTEXATTRIBDIVISOREXTPROC) get_proc("glVertexAttribDivisorEXT"); - gles2wCopyTextureLevelsAPPLE = (PFNGLCOPYTEXTURELEVELSAPPLEPROC) get_proc("glCopyTextureLevelsAPPLE"); - gles2wRenderbufferStorageMultisampleAPPLE = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) get_proc("glRenderbufferStorageMultisampleAPPLE"); - gles2wResolveMultisampleFramebufferAPPLE = (PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) get_proc("glResolveMultisampleFramebufferAPPLE"); - gles2wFenceSyncAPPLE = (PFNGLFENCESYNCAPPLEPROC) get_proc("glFenceSyncAPPLE"); - gles2wIsSyncAPPLE = (PFNGLISSYNCAPPLEPROC) get_proc("glIsSyncAPPLE"); - gles2wDeleteSyncAPPLE = (PFNGLDELETESYNCAPPLEPROC) get_proc("glDeleteSyncAPPLE"); - gles2wClientWaitSyncAPPLE = (PFNGLCLIENTWAITSYNCAPPLEPROC) get_proc("glClientWaitSyncAPPLE"); - gles2wWaitSyncAPPLE = (PFNGLWAITSYNCAPPLEPROC) get_proc("glWaitSyncAPPLE"); - gles2wGetInteger64vAPPLE = (PFNGLGETINTEGER64VAPPLEPROC) get_proc("glGetInteger64vAPPLE"); - gles2wGetSyncivAPPLE = (PFNGLGETSYNCIVAPPLEPROC) get_proc("glGetSyncivAPPLE"); - gles2wLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC) get_proc("glLabelObjectEXT"); - gles2wGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC) get_proc("glGetObjectLabelEXT"); - gles2wInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC) get_proc("glInsertEventMarkerEXT"); - gles2wPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC) get_proc("glPushGroupMarkerEXT"); - gles2wPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC) get_proc("glPopGroupMarkerEXT"); - gles2wDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC) get_proc("glDiscardFramebufferEXT"); - gles2wGenQueriesEXT = (PFNGLGENQUERIESEXTPROC) get_proc("glGenQueriesEXT"); - gles2wDeleteQueriesEXT = (PFNGLDELETEQUERIESEXTPROC) get_proc("glDeleteQueriesEXT"); - gles2wIsQueryEXT = (PFNGLISQUERYEXTPROC) get_proc("glIsQueryEXT"); - gles2wBeginQueryEXT = (PFNGLBEGINQUERYEXTPROC) get_proc("glBeginQueryEXT"); - gles2wEndQueryEXT = (PFNGLENDQUERYEXTPROC) get_proc("glEndQueryEXT"); - gles2wQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC) get_proc("glQueryCounterEXT"); - gles2wGetQueryivEXT = (PFNGLGETQUERYIVEXTPROC) get_proc("glGetQueryivEXT"); - gles2wGetQueryObjectivEXT = (PFNGLGETQUERYOBJECTIVEXTPROC) get_proc("glGetQueryObjectivEXT"); - gles2wGetQueryObjectuivEXT = (PFNGLGETQUERYOBJECTUIVEXTPROC) get_proc("glGetQueryObjectuivEXT"); - gles2wGetQueryObjecti64vEXT = (PFNGLGETQUERYOBJECTI64VEXTPROC) get_proc("glGetQueryObjecti64vEXT"); - gles2wGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC) get_proc("glGetQueryObjectui64vEXT"); - gles2wMapBufferRangeEXT = (PFNGLMAPBUFFERRANGEEXTPROC) get_proc("glMapBufferRangeEXT"); - gles2wFlushMappedBufferRangeEXT = (PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) get_proc("glFlushMappedBufferRangeEXT"); - gles2wRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) get_proc("glRenderbufferStorageMultisampleEXT"); - gles2wFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) get_proc("glFramebufferTexture2DMultisampleEXT"); - gles2wReadBufferIndexedEXT = (PFNGLREADBUFFERINDEXEDEXTPROC) get_proc("glReadBufferIndexedEXT"); - gles2wDrawBuffersIndexedEXT = (PFNGLDRAWBUFFERSINDEXEDEXTPROC) get_proc("glDrawBuffersIndexedEXT"); - gles2wGetIntegeri_vEXT = (PFNGLGETINTEGERI_VEXTPROC) get_proc("glGetIntegeri_vEXT"); - gles2wMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC) get_proc("glMultiDrawArraysEXT"); - gles2wMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC) get_proc("glMultiDrawElementsEXT"); - gles2wGetGraphicsResetStatusEXT = (PFNGLGETGRAPHICSRESETSTATUSEXTPROC) get_proc("glGetGraphicsResetStatusEXT"); - gles2wReadnPixelsEXT = (PFNGLREADNPIXELSEXTPROC) get_proc("glReadnPixelsEXT"); - gles2wGetnUniformfvEXT = (PFNGLGETNUNIFORMFVEXTPROC) get_proc("glGetnUniformfvEXT"); - gles2wGetnUniformivEXT = (PFNGLGETNUNIFORMIVEXTPROC) get_proc("glGetnUniformivEXT"); - gles2wUseProgramStagesEXT = (PFNGLUSEPROGRAMSTAGESEXTPROC) get_proc("glUseProgramStagesEXT"); - gles2wActiveShaderProgramEXT = (PFNGLACTIVESHADERPROGRAMEXTPROC) get_proc("glActiveShaderProgramEXT"); - gles2wCreateShaderProgramvEXT = (PFNGLCREATESHADERPROGRAMVEXTPROC) get_proc("glCreateShaderProgramvEXT"); - gles2wBindProgramPipelineEXT = (PFNGLBINDPROGRAMPIPELINEEXTPROC) get_proc("glBindProgramPipelineEXT"); - gles2wDeleteProgramPipelinesEXT = (PFNGLDELETEPROGRAMPIPELINESEXTPROC) get_proc("glDeleteProgramPipelinesEXT"); - gles2wGenProgramPipelinesEXT = (PFNGLGENPROGRAMPIPELINESEXTPROC) get_proc("glGenProgramPipelinesEXT"); - gles2wIsProgramPipelineEXT = (PFNGLISPROGRAMPIPELINEEXTPROC) get_proc("glIsProgramPipelineEXT"); - gles2wProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC) get_proc("glProgramParameteriEXT"); - gles2wGetProgramPipelineivEXT = (PFNGLGETPROGRAMPIPELINEIVEXTPROC) get_proc("glGetProgramPipelineivEXT"); - gles2wProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC) get_proc("glProgramUniform1iEXT"); - gles2wProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC) get_proc("glProgramUniform2iEXT"); - gles2wProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC) get_proc("glProgramUniform3iEXT"); - gles2wProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC) get_proc("glProgramUniform4iEXT"); - gles2wProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC) get_proc("glProgramUniform1fEXT"); - gles2wProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC) get_proc("glProgramUniform2fEXT"); - gles2wProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC) get_proc("glProgramUniform3fEXT"); - gles2wProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC) get_proc("glProgramUniform4fEXT"); - gles2wProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC) get_proc("glProgramUniform1ivEXT"); - gles2wProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC) get_proc("glProgramUniform2ivEXT"); - gles2wProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC) get_proc("glProgramUniform3ivEXT"); - gles2wProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC) get_proc("glProgramUniform4ivEXT"); - gles2wProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC) get_proc("glProgramUniform1fvEXT"); - gles2wProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC) get_proc("glProgramUniform2fvEXT"); - gles2wProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC) get_proc("glProgramUniform3fvEXT"); - gles2wProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC) get_proc("glProgramUniform4fvEXT"); - gles2wProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) get_proc("glProgramUniformMatrix2fvEXT"); - gles2wProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) get_proc("glProgramUniformMatrix3fvEXT"); - gles2wProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) get_proc("glProgramUniformMatrix4fvEXT"); - gles2wValidateProgramPipelineEXT = (PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) get_proc("glValidateProgramPipelineEXT"); - gles2wGetProgramPipelineInfoLogEXT = (PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) get_proc("glGetProgramPipelineInfoLogEXT"); - gles2wTexStorage1DEXT = (PFNGLTEXSTORAGE1DEXTPROC) get_proc("glTexStorage1DEXT"); - gles2wTexStorage2DEXT = (PFNGLTEXSTORAGE2DEXTPROC) get_proc("glTexStorage2DEXT"); - gles2wTexStorage3DEXT = (PFNGLTEXSTORAGE3DEXTPROC) get_proc("glTexStorage3DEXT"); - gles2wTextureStorage1DEXT = (PFNGLTEXTURESTORAGE1DEXTPROC) get_proc("glTextureStorage1DEXT"); - gles2wTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC) get_proc("glTextureStorage2DEXT"); - gles2wTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC) get_proc("glTextureStorage3DEXT"); - gles2wRenderbufferStorageMultisampleIMG = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) get_proc("glRenderbufferStorageMultisampleIMG"); - gles2wFramebufferTexture2DMultisampleIMG = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) get_proc("glFramebufferTexture2DMultisampleIMG"); - gles2wCoverageMaskNV = (PFNGLCOVERAGEMASKNVPROC) get_proc("glCoverageMaskNV"); - gles2wCoverageOperationNV = (PFNGLCOVERAGEOPERATIONNVPROC) get_proc("glCoverageOperationNV"); - gles2wDrawBuffersNV = (PFNGLDRAWBUFFERSNVPROC) get_proc("glDrawBuffersNV"); - gles2wDrawArraysInstancedNV = (PFNGLDRAWARRAYSINSTANCEDNVPROC) get_proc("glDrawArraysInstancedNV"); - gles2wDrawElementsInstancedNV = (PFNGLDRAWELEMENTSINSTANCEDNVPROC) get_proc("glDrawElementsInstancedNV"); - gles2wDeleteFencesNV = (PFNGLDELETEFENCESNVPROC) get_proc("glDeleteFencesNV"); - gles2wGenFencesNV = (PFNGLGENFENCESNVPROC) get_proc("glGenFencesNV"); - gles2wIsFenceNV = (PFNGLISFENCENVPROC) get_proc("glIsFenceNV"); - gles2wTestFenceNV = (PFNGLTESTFENCENVPROC) get_proc("glTestFenceNV"); - gles2wGetFenceivNV = (PFNGLGETFENCEIVNVPROC) get_proc("glGetFenceivNV"); - gles2wFinishFenceNV = (PFNGLFINISHFENCENVPROC) get_proc("glFinishFenceNV"); - gles2wSetFenceNV = (PFNGLSETFENCENVPROC) get_proc("glSetFenceNV"); - gles2wBlitFramebufferNV = (PFNGLBLITFRAMEBUFFERNVPROC) get_proc("glBlitFramebufferNV"); - gles2wRenderbufferStorageMultisampleNV = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) get_proc("glRenderbufferStorageMultisampleNV"); - gles2wVertexAttribDivisorNV = (PFNGLVERTEXATTRIBDIVISORNVPROC) get_proc("glVertexAttribDivisorNV"); - gles2wReadBufferNV = (PFNGLREADBUFFERNVPROC) get_proc("glReadBufferNV"); - gles2wAlphaFuncQCOM = (PFNGLALPHAFUNCQCOMPROC) get_proc("glAlphaFuncQCOM"); - gles2wGetDriverControlsQCOM = (PFNGLGETDRIVERCONTROLSQCOMPROC) get_proc("glGetDriverControlsQCOM"); - gles2wGetDriverControlStringQCOM = (PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) get_proc("glGetDriverControlStringQCOM"); - gles2wEnableDriverControlQCOM = (PFNGLENABLEDRIVERCONTROLQCOMPROC) get_proc("glEnableDriverControlQCOM"); - gles2wDisableDriverControlQCOM = (PFNGLDISABLEDRIVERCONTROLQCOMPROC) get_proc("glDisableDriverControlQCOM"); - gles2wExtGetTexturesQCOM = (PFNGLEXTGETTEXTURESQCOMPROC) get_proc("glExtGetTexturesQCOM"); - gles2wExtGetBuffersQCOM = (PFNGLEXTGETBUFFERSQCOMPROC) get_proc("glExtGetBuffersQCOM"); - gles2wExtGetRenderbuffersQCOM = (PFNGLEXTGETRENDERBUFFERSQCOMPROC) get_proc("glExtGetRenderbuffersQCOM"); - gles2wExtGetFramebuffersQCOM = (PFNGLEXTGETFRAMEBUFFERSQCOMPROC) get_proc("glExtGetFramebuffersQCOM"); - gles2wExtGetTexLevelParameterivQCOM = (PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) get_proc("glExtGetTexLevelParameterivQCOM"); - gles2wExtTexObjectStateOverrideiQCOM = (PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) get_proc("glExtTexObjectStateOverrideiQCOM"); - gles2wExtGetTexSubImageQCOM = (PFNGLEXTGETTEXSUBIMAGEQCOMPROC) get_proc("glExtGetTexSubImageQCOM"); - gles2wExtGetBufferPointervQCOM = (PFNGLEXTGETBUFFERPOINTERVQCOMPROC) get_proc("glExtGetBufferPointervQCOM"); - gles2wExtGetShadersQCOM = (PFNGLEXTGETSHADERSQCOMPROC) get_proc("glExtGetShadersQCOM"); - gles2wExtGetProgramsQCOM = (PFNGLEXTGETPROGRAMSQCOMPROC) get_proc("glExtGetProgramsQCOM"); - gles2wExtIsProgramBinaryQCOM = (PFNGLEXTISPROGRAMBINARYQCOMPROC) get_proc("glExtIsProgramBinaryQCOM"); - gles2wExtGetProgramBinarySourceQCOM = (PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) get_proc("glExtGetProgramBinarySourceQCOM"); - gles2wStartTilingQCOM = (PFNGLSTARTTILINGQCOMPROC) get_proc("glStartTilingQCOM"); - gles2wEndTilingQCOM = (PFNGLENDTILINGQCOMPROC) get_proc("glEndTilingQCOM"); -} diff --git a/native/cocos/renderer/gfx-gles3/CMakeLists.txt b/native/cocos/renderer/gfx-gles3/CMakeLists.txt deleted file mode 100644 index 90b7d9c87d..0000000000 --- a/native/cocos/renderer/gfx-gles3/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ -set(TARGET_NAME GFXGLES3) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src - ${GFX_EXTERNAL_PATH}/glsl_optimizer/src/mesa - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-gles3 -) - -if(WIN32) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/pvrsdk/include) - - if(COCOS_CPU_X64) - set(PVRSDK_LIB_DIR ${GFX_EXTERNAL_PATH}/pvrsdk/lib/Windows_x86_64) - else() - set(PVRSDK_LIB_DIR ${GFX_EXTERNAL_PATH}/pvrsdk/lib/Windows_x86_32) - endif() - - link_libraries( - ${PVRSDK_LIB_DIR}/libEGL.lib - ${PVRSDK_LIB_DIR}/libGLESv2.lib - ) -endif() - -if(COCOS_PLATFORM_OSX) - list(APPEND INCLUDE_FILES ${GFX_EXTERNAL_PATH}/pvrsdk/include) - set(PVRSDK_LIB_DIR ${GFX_EXTERNAL_PATH}/pvrsdk/lib/OSX_x86) - - link_libraries( - ${PVRSDK_LIB_DIR}/libEGL.dylib - ${PVRSDK_LIB_DIR}/libGLESv2.dylib - ) -endif() - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles3/gles3w.c") -else() - list(REMOVE_ITEM ALL_FILES "${COCOS_SRC_PATH}/renderer/gfx-gles3/gles3w.mm") -endif() - -add_definitions("-DCC_GLES3_EXPORTS") -if(WIN32) - add_definitions("-DGLEW_BUILD") -endif() -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_link_libraries(${TARGET_NAME} Core) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXGLES3) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXGLES3_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/GLES3Std.h" "${CMAKE_CURRENT_SOURCE_DIR}/GLES3Std.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-gles3/GFXGLES3.h b/native/cocos/renderer/gfx-gles3/GFXGLES3.h index 4a6d88f7e1..c58adb7c6e 100644 --- a/native/cocos/renderer/gfx-gles3/GFXGLES3.h +++ b/native/cocos/renderer/gfx-gles3/GFXGLES3.h @@ -1,30 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_H_ -#define CC_GFXGLES3_H_ + +#pragma once #include "GLES3Std.h" #include "GLES3Device.h" - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp b/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp index edcd748e03..221dae928b 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Buffer.cpp @@ -1,129 +1,91 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Buffer.h" #include "GLES3Commands.h" +#include "GLES3Device.h" namespace cc { namespace gfx { -GLES3Buffer::GLES3Buffer(Device *device) -: Buffer(device) { -} +GLES3Buffer::GLES3Buffer() = default; GLES3Buffer::~GLES3Buffer() { + destroy(); } -bool GLES3Buffer::initialize(const BufferInfo &info) { - _usage = info.usage; - _memUsage = info.memUsage; - _size = info.size; - _stride = std::max(info.stride, 1U); - _count = _size / _stride; - _flags = info.flags; - - _gpuBuffer = CC_NEW(GLES3GPUBuffer); - if (!_gpuBuffer) { - CC_LOG_ERROR("GLES3Buffer: CC_NEW GLES3GPUBuffer failed."); - return false; - } - _gpuBuffer->usage = _usage; +void GLES3Buffer::doInit(const BufferInfo & /*info*/) { + _gpuBuffer = CC_NEW(GLES3GPUBuffer); + _gpuBuffer->usage = _usage; _gpuBuffer->memUsage = _memUsage; - _gpuBuffer->size = _size; - _gpuBuffer->stride = _stride; - _gpuBuffer->count = _count; + _gpuBuffer->size = _size; + _gpuBuffer->stride = _stride; + _gpuBuffer->count = _count; - if (_usage & BufferUsageBit::INDIRECT) { + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { _gpuBuffer->indirects.resize(_count); } - GLES3CmdFuncCreateBuffer((GLES3Device *)_device, _gpuBuffer); - _device->getMemoryStatus().bufferSize += _size; - - return true; + cmdFuncGLES3CreateBuffer(GLES3Device::getInstance(), _gpuBuffer); } -bool GLES3Buffer::initialize(const BufferViewInfo &info) { - - _isBufferView = true; - - GLES3Buffer *buffer = (GLES3Buffer *)info.buffer; - - _usage = buffer->_usage; - _memUsage = buffer->_memUsage; - _size = _stride = info.range; - _count = 1u; - _flags = buffer->_flags; - - _gpuBuffer = CC_NEW(GLES3GPUBuffer); - _gpuBuffer->usage = _usage; - _gpuBuffer->memUsage = _memUsage; - _gpuBuffer->size = _size; - _gpuBuffer->stride = _stride; - _gpuBuffer->count = _count; - _gpuBuffer->glTarget = buffer->_gpuBuffer->glTarget; - _gpuBuffer->glBuffer = buffer->_gpuBuffer->glBuffer; - _gpuBuffer->glOffset = info.offset; - _gpuBuffer->buffer = buffer->_gpuBuffer->buffer; +void GLES3Buffer::doInit(const BufferViewInfo &info) { + auto *buffer = static_cast(info.buffer); + _gpuBuffer = CC_NEW(GLES3GPUBuffer); + _gpuBuffer->usage = _usage; + _gpuBuffer->memUsage = _memUsage; + _gpuBuffer->size = _size; + _gpuBuffer->stride = _stride; + _gpuBuffer->count = _count; + _gpuBuffer->glTarget = buffer->_gpuBuffer->glTarget; + _gpuBuffer->glBuffer = buffer->_gpuBuffer->glBuffer; + _gpuBuffer->glOffset = info.offset; + _gpuBuffer->buffer = buffer->_gpuBuffer->buffer; _gpuBuffer->indirects = buffer->_gpuBuffer->indirects; - - return true; } -void GLES3Buffer::destroy() { +void GLES3Buffer::doDestroy() { if (_gpuBuffer) { if (!_isBufferView) { - GLES3CmdFuncDestroyBuffer((GLES3Device *)_device, _gpuBuffer); - _device->getMemoryStatus().bufferSize -= _size; + cmdFuncGLES3DestroyBuffer(GLES3Device::getInstance(), _gpuBuffer); } CC_DELETE(_gpuBuffer); _gpuBuffer = nullptr; } } -void GLES3Buffer::resize(uint size) { - CCASSERT(!_isBufferView, "Cannot resize buffer views"); - - if (_size != size) { - const uint oldSize = _size; - _size = size; - _count = _size / _stride; - - MemoryStatus &status = _device->getMemoryStatus(); - _gpuBuffer->size = _size; - _gpuBuffer->count = _count; - GLES3CmdFuncResizeBuffer((GLES3Device *)_device, _gpuBuffer); - status.bufferSize -= oldSize; - status.bufferSize += _size; - } +void GLES3Buffer::doResize(uint size, uint count) { + _gpuBuffer->size = size; + _gpuBuffer->count = count; + cmdFuncGLES3ResizeBuffer(GLES3Device::getInstance(), _gpuBuffer); } -void GLES3Buffer::update(void *buffer, uint size) { - CCASSERT(!_isBufferView, "Cannot update through buffer views"); - - GLES3CmdFuncUpdateBuffer((GLES3Device *)_device, _gpuBuffer, buffer, 0u, size); +void GLES3Buffer::update(const void *buffer, uint size) { + cmdFuncGLES3UpdateBuffer(GLES3Device::getInstance(), _gpuBuffer, buffer, 0U, size); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles3/GLES3Buffer.h b/native/cocos/renderer/gfx-gles3/GLES3Buffer.h index a816a32296..112df80941 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Buffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Buffer.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_BUFFER_H_ -#define CC_GFXGLES3_BUFFER_H_ + +#pragma once + +#include "GLES3Std.h" +#include "gfx-base/GFXBuffer.h" namespace cc { namespace gfx { @@ -31,23 +35,21 @@ class GLES3GPUBuffer; class CC_GLES3_API GLES3Buffer final : public Buffer { public: - GLES3Buffer(Device *device); - ~GLES3Buffer(); + GLES3Buffer(); + ~GLES3Buffer() override; -public: - virtual bool initialize(const BufferInfo &info) override; - virtual bool initialize(const BufferViewInfo &info) override; - virtual void destroy() override; - virtual void resize(uint size) override; - virtual void update(void *buffer, uint size) override; + void update(const void *buffer, uint size) override; CC_INLINE GLES3GPUBuffer *gpuBuffer() const { return _gpuBuffer; } -private: +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doDestroy() override; + void doResize(uint size, uint count) override; + GLES3GPUBuffer *_gpuBuffer = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cpp b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cpp index 00ac174091..9dd64d2aa6 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Buffer.h" @@ -28,6 +30,7 @@ THE SOFTWARE. #include "GLES3DescriptorSet.h" #include "GLES3Device.h" #include "GLES3Framebuffer.h" +#include "GLES3GlobalBarrier.h" #include "GLES3InputAssembler.h" #include "GLES3PipelineState.h" #include "GLES3RenderPass.h" @@ -36,28 +39,22 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES3CommandBuffer::GLES3CommandBuffer(Device *device) -: CommandBuffer(device) { -} - GLES3CommandBuffer::~GLES3CommandBuffer() { + destroy(); } -bool GLES3CommandBuffer::initialize(const CommandBufferInfo &info) { - _type = info.type; - _queue = info.queue; - - _cmdAllocator = CC_NEW(GLES3GPUCommandAllocator); +void GLES3CommandBuffer::doInit(const CommandBufferInfo & /*info*/) { + _cmdAllocator = CC_NEW(GLES3GPUCommandAllocator); _curCmdPackage = CC_NEW(GLES3CmdPackage); - size_t setCount = ((GLES3Device *)_device)->bindingMappingInfo().bufferOffsets.size(); + size_t setCount = GLES3Device::getInstance()->bindingMappingInfo().bufferOffsets.size(); _curGPUDescriptorSets.resize(setCount); _curDynamicOffsets.resize(setCount); - - return true; } -void GLES3CommandBuffer::destroy() { +void GLES3CommandBuffer::doDestroy() { + if (!_cmdAllocator) return; + _cmdAllocator->clearCmds(_curCmdPackage); CC_SAFE_DELETE(_curCmdPackage); @@ -76,11 +73,10 @@ void GLES3CommandBuffer::destroy() { } _cmdAllocator->reset(); - CC_DELETE(_cmdAllocator); + CC_SAFE_DELETE(_cmdAllocator); } -void GLES3CommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) { - _cmdAllocator->clearCmds(_curCmdPackage); +void GLES3CommandBuffer::begin(RenderPass * /*renderPass*/, uint /*subpass*/, Framebuffer * /*frameBuffer*/) { _curGPUPipelineState = nullptr; _curGPUInputAssember = nullptr; _curGPUDescriptorSets.assign(_curGPUDescriptorSets.size(), nullptr); @@ -88,11 +84,13 @@ void GLES3CommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer _numDrawCalls = 0; _numInstances = 0; _numTriangles = 0; + + _cmdAllocator->clearCmds(_curCmdPackage); } void GLES3CommandBuffer::end() { if (_isStateInvalid) { - BindStates(); + bindStates(); } _isInRenderPass = false; @@ -105,43 +103,43 @@ void GLES3CommandBuffer::end() { } } -void GLES3CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) { +void GLES3CommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const * /*secondaryCBs*/, uint /*secondaryCBCount*/) { _isInRenderPass = true; GLES3CmdBeginRenderPass *cmd = _cmdAllocator->beginRenderPassCmdPool.alloc(); - cmd->gpuRenderPass = ((GLES3RenderPass *)renderPass)->gpuRenderPass(); - cmd->gpuFBO = ((GLES3Framebuffer *)fbo)->gpuFBO(); - cmd->renderArea = renderArea; - cmd->numClearColors = cmd->gpuRenderPass->colorAttachments.size(); + cmd->gpuRenderPass = static_cast(renderPass)->gpuRenderPass(); + cmd->gpuFBO = static_cast(fbo)->gpuFBO(); + cmd->renderArea = renderArea; + cmd->numClearColors = cmd->gpuRenderPass->colorAttachments.size(); for (size_t i = 0; i < cmd->numClearColors; ++i) { cmd->clearColors[i] = colors[i]; } - cmd->clearDepth = depth; + cmd->clearDepth = depth; cmd->clearStencil = stencil; _curCmdPackage->beginRenderPassCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::BEGIN_RENDER_PASS); + _curCmdPackage->cmds.push(GLESCmdType::BEGIN_RENDER_PASS); } void GLES3CommandBuffer::endRenderPass() { _isInRenderPass = false; - _curCmdPackage->cmds.push(GFXCmdType::END_RENDER_PASS); + _curCmdPackage->cmds.push(GLESCmdType::END_RENDER_PASS); } void GLES3CommandBuffer::bindPipelineState(PipelineState *pso) { - GLES3GPUPipelineState *gpuPipelineState = ((GLES3PipelineState *)pso)->gpuPipelineState(); + GLES3GPUPipelineState *gpuPipelineState = static_cast(pso)->gpuPipelineState(); if (_curGPUPipelineState != gpuPipelineState) { _curGPUPipelineState = gpuPipelineState; - _isStateInvalid = true; + _isStateInvalid = true; } } void GLES3CommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) { CCASSERT(_curGPUDescriptorSets.size() > set, "Invalid set index"); - GLES3GPUDescriptorSet *gpuDescriptorSet = ((GLES3DescriptorSet *)descriptorSet)->gpuDescriptorSet(); + GLES3GPUDescriptorSet *gpuDescriptorSet = static_cast(descriptorSet)->gpuDescriptorSet(); if (_curGPUDescriptorSets[set] != gpuDescriptorSet) { _curGPUDescriptorSets[set] = gpuDescriptorSet; - _isStateInvalid = true; + _isStateInvalid = true; } if (dynamicOffsetCount) { _curDynamicOffsets[set].assign(dynamicOffsets, dynamicOffsets + dynamicOffsetCount); @@ -150,8 +148,8 @@ void GLES3CommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSe } void GLES3CommandBuffer::bindInputAssembler(InputAssembler *ia) { - _curGPUInputAssember = ((GLES3InputAssembler *)ia)->gpuInputAssembler(); - _isStateInvalid = true; + _curGPUInputAssember = static_cast(ia)->gpuInputAssembler(); + _isStateInvalid = true; } void GLES3CommandBuffer::setViewport(const Viewport &vp) { @@ -163,7 +161,7 @@ void GLES3CommandBuffer::setViewport(const Viewport &vp) { math::IsNotEqualF(_curViewport.minDepth, vp.minDepth) || math::IsNotEqualF(_curViewport.maxDepth, vp.maxDepth)) { - _curViewport = vp; + _curViewport = vp; _isStateInvalid = true; } } @@ -174,14 +172,14 @@ void GLES3CommandBuffer::setScissor(const Rect &rect) { (_curScissor.width != rect.width) || (_curScissor.height != rect.height)) { - _curScissor = rect; + _curScissor = rect; _isStateInvalid = true; } } void GLES3CommandBuffer::setLineWidth(float width) { if (math::IsNotEqualF(_curLineWidth, width)) { - _curLineWidth = width; + _curLineWidth = width; _isStateInvalid = true; } } @@ -192,9 +190,9 @@ void GLES3CommandBuffer::setDepthBias(float constant, float clamp, float slope) math::IsNotEqualF(_curDepthBias.slope, slope)) { _curDepthBias.constant = constant; - _curDepthBias.clamp = clamp; - _curDepthBias.slope = slope; - _isStateInvalid = true; + _curDepthBias.clamp = clamp; + _curDepthBias.slope = slope; + _isStateInvalid = true; } } @@ -208,7 +206,7 @@ void GLES3CommandBuffer::setBlendConstants(const Color &constants) { _curBlendConstants.y = constants.y; _curBlendConstants.z = constants.z; _curBlendConstants.w = constants.w; - _isStateInvalid = true; + _isStateInvalid = true; } } @@ -218,7 +216,7 @@ void GLES3CommandBuffer::setDepthBound(float minBounds, float maxBounds) { _curDepthBounds.minBounds = minBounds; _curDepthBounds.maxBounds = maxBounds; - _isStateInvalid = true; + _isStateInvalid = true; } } @@ -226,9 +224,9 @@ void GLES3CommandBuffer::setStencilWriteMask(StencilFace face, uint mask) { if ((_curStencilWriteMask.face != face) || (_curStencilWriteMask.writeMask != mask)) { - _curStencilWriteMask.face = face; + _curStencilWriteMask.face = face; _curStencilWriteMask.writeMask = mask; - _isStateInvalid = true; + _isStateInvalid = true; } } @@ -237,91 +235,91 @@ void GLES3CommandBuffer::setStencilCompareMask(StencilFace face, int ref, uint m (_curStencilCompareMask.refrence != ref) || (_curStencilCompareMask.compareMask != mask)) { - _curStencilCompareMask.face = face; - _curStencilCompareMask.refrence = ref; + _curStencilCompareMask.face = face; + _curStencilCompareMask.refrence = ref; _curStencilCompareMask.compareMask = mask; - _isStateInvalid = true; + _isStateInvalid = true; } } -void GLES3CommandBuffer::draw(InputAssembler *ia) { - if ((_type == CommandBufferType::PRIMARY && _isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { +void GLES3CommandBuffer::nextSubpass() { +} - if (_isStateInvalid) { - BindStates(); - } +void GLES3CommandBuffer::draw(const DrawInfo &info) { + if (_isStateInvalid) { + bindStates(); + } - GLES3CmdDraw *cmd = _cmdAllocator->drawCmdPool.alloc(); - ((GLES3InputAssembler *)ia)->ExtractCmdDraw(cmd); - _curCmdPackage->drawCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::DRAW); + GLES3CmdDraw *cmd = _cmdAllocator->drawCmdPool.alloc(); + cmd->drawInfo = info; + _curCmdPackage->drawCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::DRAW); - ++_numDrawCalls; - _numInstances += ia->getInstanceCount(); - if (_curGPUPipelineState) { - switch (_curGPUPipelineState->glPrimitive) { - case GL_TRIANGLES: { - _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getInstanceCount(), 1U); - break; - } - case GL_TRIANGLE_STRIP: - case GL_TRIANGLE_FAN: { - _numTriangles += (ia->getIndexCount() - 2) * std::max(ia->getInstanceCount(), 1U); - break; - } - default: - break; + ++_numDrawCalls; + _numInstances += info.instanceCount; + if (_curGPUPipelineState) { + uint indexCount = info.indexCount ? info.indexCount : info.vertexCount; + switch (_curGPUPipelineState->glPrimitive) { + case GL_TRIANGLES: { + _numTriangles += indexCount / 3 * std::max(info.instanceCount, 1U); + break; } + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_FAN: { + _numTriangles += (indexCount - 2) * std::max(info.instanceCount, 1U); + break; + } + default: + break; } - } else { - CC_LOG_ERROR("Command 'draw' must be recorded inside a render pass."); } } void GLES3CommandBuffer::updateBuffer(Buffer *buff, const void *data, uint size) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { + GLES3GPUBuffer *gpuBuffer = static_cast(buff)->gpuBuffer(); + if (gpuBuffer) { + GLES3CmdUpdateBuffer *cmd = _cmdAllocator->updateBufferCmdPool.alloc(); + cmd->gpuBuffer = gpuBuffer; + cmd->size = size; + cmd->buffer = static_cast(data); - GLES3GPUBuffer *gpuBuffer = ((GLES3Buffer *)buff)->gpuBuffer(); - if (gpuBuffer) { - GLES3CmdUpdateBuffer *cmd = _cmdAllocator->updateBufferCmdPool.alloc(); - cmd->gpuBuffer = gpuBuffer; - cmd->size = size; - cmd->buffer = (uint8_t *)data; - - _curCmdPackage->updateBufferCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::UPDATE_BUFFER); - } - } else { - CC_LOG_ERROR("Command 'updateBuffer' must be recorded outside a render pass."); + _curCmdPackage->updateBufferCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::UPDATE_BUFFER); } } +void GLES3CommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { + GLES3CmdBlitTexture *cmd = _cmdAllocator->blitTextureCmdPool.alloc(); + if (srcTexture) cmd->gpuTextureSrc = static_cast(srcTexture)->gpuTexture(); + if (dstTexture) cmd->gpuTextureDst = static_cast(dstTexture)->gpuTexture(); + cmd->regions = regions; + cmd->count = count; + cmd->filter = filter; + + _curCmdPackage->blitTextureCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::BLIT_TEXTURE); +} + void GLES3CommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { + GLES3GPUTexture *gpuTexture = static_cast(texture)->gpuTexture(); + if (gpuTexture) { + GLES3CmdCopyBufferToTexture *cmd = _cmdAllocator->copyBufferToTextureCmdPool.alloc(); + cmd->gpuTexture = gpuTexture; + cmd->gpuTexture = gpuTexture; + cmd->regions = regions; + cmd->count = count; + cmd->buffers = buffers; - GLES3GPUTexture *gpuTexture = ((GLES3Texture *)texture)->gpuTexture(); - if (gpuTexture) { - GLES3CmdCopyBufferToTexture *cmd = _cmdAllocator->copyBufferToTextureCmdPool.alloc(); - cmd->gpuTexture = gpuTexture; - cmd->gpuTexture = gpuTexture; - cmd->regions = regions; - cmd->count = count; - cmd->buffers = buffers; - - _curCmdPackage->copyBufferToTextureCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::COPY_BUFFER_TO_TEXTURE); - } - } else { - CC_LOG_ERROR("Command 'copyBuffersToTexture' must be recorded outside a render pass."); + _curCmdPackage->copyBufferToTextureCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::COPY_BUFFER_TO_TEXTURE); } } -void GLES3CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t count) { +void GLES3CommandBuffer::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { + CCASSERT(false, "Command 'execute' must be recorded in primary command buffers."); + for (uint i = 0; i < count; ++i) { - GLES3CommandBuffer *cmdBuff = (GLES3CommandBuffer *)cmdBuffs[i]; + auto * cmdBuff = static_cast(cmdBuffs[i]); GLES3CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); for (uint j = 0; j < cmdPackage->beginRenderPassCmds.size(); ++j) { @@ -339,6 +337,16 @@ void GLES3CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t ++cmd->refCount; _curCmdPackage->drawCmds.push(cmd); } + for (uint j = 0; j < cmdPackage->dispatchCmds.size(); ++j) { + GLES3CmdDispatch *cmd = cmdPackage->dispatchCmds[j]; + ++cmd->refCount; + _curCmdPackage->dispatchCmds.push(cmd); + } + for (uint j = 0; j < cmdPackage->barrierCmds.size(); ++j) { + GLES3CmdBarrier *cmd = cmdPackage->barrierCmds[j]; + ++cmd->refCount; + _curCmdPackage->barrierCmds.push(cmd); + } for (uint j = 0; j < cmdPackage->updateBufferCmds.size(); ++j) { GLES3CmdUpdateBuffer *cmd = cmdPackage->updateBufferCmds[j]; ++cmd->refCount; @@ -349,6 +357,11 @@ void GLES3CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t ++cmd->refCount; _curCmdPackage->copyBufferToTextureCmds.push(cmd); } + for (uint j = 0; j < cmdPackage->blitTextureCmds.size(); ++j) { + GLES3CmdBlitTexture *cmd = cmdPackage->blitTextureCmds[j]; + ++cmd->refCount; + _curCmdPackage->blitTextureCmds.push(cmd); + } _curCmdPackage->cmds.concat(cmdPackage->cmds); _numDrawCalls += cmdBuff->_numDrawCalls; @@ -357,20 +370,24 @@ void GLES3CommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t cmdBuff->_pendingPackages.pop(); cmdBuff->_freePackages.push(cmdPackage); + + // current cmd allocator strategy will not work here: (but it doesn't matter anyways) + // allocators are designed to only free the cmds they allocated + // but here we are essentially 'transfering' the owner ship + //cmdBuff->_cmdAllocator->clearCmds(cmdPackage); } } -void GLES3CommandBuffer::BindStates() { +void GLES3CommandBuffer::bindStates() { GLES3CmdBindStates *cmd = _cmdAllocator->bindStatesCmdPool.alloc(); - - cmd->gpuPipelineState = _curGPUPipelineState; - cmd->gpuInputAssembler = _curGPUInputAssember; - cmd->gpuDescriptorSets = _curGPUDescriptorSets; + cmd->gpuPipelineState = _curGPUPipelineState; + cmd->gpuInputAssembler = _curGPUInputAssember; + cmd->gpuDescriptorSets = _curGPUDescriptorSets; if (_curGPUPipelineState) { vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; cmd->dynamicOffsets.resize(_curGPUPipelineState->gpuPipelineLayout->dynamicOffsetCount); - for (size_t i = 0u; i < _curDynamicOffsets.size(); i++) { + for (size_t i = 0U; i < _curDynamicOffsets.size(); i++) { size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); count = std::min(count, _curDynamicOffsets[i].size()); @@ -378,22 +395,52 @@ void GLES3CommandBuffer::BindStates() { } } - cmd->viewport = _curViewport; - cmd->scissor = _curScissor; - cmd->lineWidth = _curLineWidth; - cmd->depthBias = _curDepthBias; - cmd->blendConstants.x = _curBlendConstants.x; - cmd->blendConstants.y = _curBlendConstants.y; - cmd->blendConstants.z = _curBlendConstants.z; - cmd->blendConstants.w = _curBlendConstants.w; - cmd->depthBounds = _curDepthBounds; - cmd->stencilWriteMask = _curStencilWriteMask; + cmd->viewport = _curViewport; + cmd->scissor = _curScissor; + cmd->lineWidth = _curLineWidth; + cmd->depthBias = _curDepthBias; + cmd->blendConstants.x = _curBlendConstants.x; + cmd->blendConstants.y = _curBlendConstants.y; + cmd->blendConstants.z = _curBlendConstants.z; + cmd->blendConstants.w = _curBlendConstants.w; + cmd->depthBounds = _curDepthBounds; + cmd->stencilWriteMask = _curStencilWriteMask; cmd->stencilCompareMask = _curStencilCompareMask; _curCmdPackage->bindStatesCmds.push(cmd); - _curCmdPackage->cmds.push(GFXCmdType::BIND_STATES); + _curCmdPackage->cmds.push(GLESCmdType::BIND_STATES); _isStateInvalid = false; } +void GLES3CommandBuffer::dispatch(const DispatchInfo &info) { + if (_isStateInvalid) { + bindStates(); + } + + GLES3CmdDispatch *cmd = _cmdAllocator->dispatchCmdPool.alloc(); + if (info.indirectBuffer) { + cmd->dispatchInfo.indirectBuffer = static_cast(info.indirectBuffer)->gpuBuffer(); + cmd->dispatchInfo.indirectOffset = info.indirectOffset; + } else { + cmd->dispatchInfo.groupCountX = info.groupCountX; + cmd->dispatchInfo.groupCountY = info.groupCountY; + cmd->dispatchInfo.groupCountZ = info.groupCountZ; + } + _curCmdPackage->dispatchCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::DISPATCH); +} + +void GLES3CommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const * /*textureBarriers*/, const Texture *const * /*textures*/, uint /*textureBarrierCount*/) { + if (!barrier) return; + + const auto *gpuBarrier = static_cast(barrier)->gpuBarrier(); + + GLES3CmdBarrier *cmd = _cmdAllocator->barrierCmdPool.alloc(); + cmd->barriers = gpuBarrier->glBarriers; + cmd->barriersByRegion = gpuBarrier->glBarriersByRegion; + _curCmdPackage->barrierCmds.push(cmd); + _curCmdPackage->cmds.push(GLESCmdType::BARRIER); +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h index 6cb9011242..435719c593 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3CommandBuffer.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_COMMAND_BUFFER_H_ -#define CC_GFXGLES3_COMMAND_BUFFER_H_ + +#pragma once + +#include "gfx-base/GFXCommandBuffer.h" #include "GLES3Commands.h" @@ -32,37 +35,41 @@ namespace gfx { class GLES3GPUCommandAllocator; class CC_GLES3_API GLES3CommandBuffer : public CommandBuffer { - friend class GLES3Queue; - public: - GLES3CommandBuffer(Device *device); - ~GLES3CommandBuffer(); + GLES3CommandBuffer() = default; + ~GLES3CommandBuffer() override; - virtual bool initialize(const CommandBufferInfo &info) override; - virtual void destroy() override; - - virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) override; - virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) override; - virtual void endRenderPass() override; - virtual void bindPipelineState(PipelineState *pso) override; - virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; - virtual void bindInputAssembler(InputAssembler *ia) override; - virtual void setViewport(const Viewport &vp) override; - virtual void setScissor(const Rect &rect) override; - virtual void setLineWidth(float width) override; - virtual void setDepthBias(float constant, float clamp, float slope) override; - virtual void setBlendConstants(const Color &constants) override; - virtual void setDepthBound(float minBounds, float maxBounds) override; - virtual void setStencilWriteMask(StencilFace face, uint mask) override; - virtual void setStencilCompareMask(StencilFace face, int ref, uint mask) override; - virtual void draw(InputAssembler *ia) override; - virtual void updateBuffer(Buffer *buff, const void *data, uint size) override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; - virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void bindPipelineState(PipelineState *pso) override; + void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; + void bindInputAssembler(InputAssembler *ia) override; + void setViewport(const Viewport &vp) override; + void setScissor(const Rect &rect) override; + void setLineWidth(float width) override; + void setDepthBias(float constant, float clamp, float slope) override; + void setBlendConstants(const Color &constants) override; + void setDepthBound(float minBounds, float maxBounds) override; + void setStencilWriteMask(StencilFace face, uint mask) override; + void setStencilCompareMask(StencilFace face, int ref, uint mask) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; protected: - virtual void BindStates(); + friend class GLES3Queue; + + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; + + virtual void bindStates(); GLES3GPUCommandAllocator *_cmdAllocator = nullptr; GLES3CmdPackage *_curCmdPackage = nullptr; @@ -75,7 +82,7 @@ protected: vector> _curDynamicOffsets; Viewport _curViewport; Rect _curScissor; - float _curLineWidth = 1.0f; + float _curLineWidth = 1.0F; GLES3DepthBias _curDepthBias; Color _curBlendConstants; GLES3DepthBounds _curDepthBounds; @@ -86,5 +93,3 @@ protected: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp index 4c7cfc760c..71b67ea041 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Commands.h" @@ -35,7 +37,7 @@ namespace cc { namespace gfx { namespace { -GLenum MapGLInternalFormat(Format format) { +GLenum mapGLInternalFormat(Format format) { switch (format) { case Format::A8: return GL_ALPHA; case Format::L8: return GL_LUMINANCE; @@ -119,35 +121,35 @@ GLenum MapGLInternalFormat(Format format) { case Format::PVRTC_RGB4: return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; case Format::PVRTC_RGBA4: return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - case Format::ASTC_RGBA_4x4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; - case Format::ASTC_RGBA_5x4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; - case Format::ASTC_RGBA_5x5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; - case Format::ASTC_RGBA_6x5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; - case Format::ASTC_RGBA_6x6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; - case Format::ASTC_RGBA_8x5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; - case Format::ASTC_RGBA_8x6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; - case Format::ASTC_RGBA_8x8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; - case Format::ASTC_RGBA_10x5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; - case Format::ASTC_RGBA_10x6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; - case Format::ASTC_RGBA_10x8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; - case Format::ASTC_RGBA_10x10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; - case Format::ASTC_RGBA_12x10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; - case Format::ASTC_RGBA_12x12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; + case Format::ASTC_RGBA_4X4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; + case Format::ASTC_RGBA_5X4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; + case Format::ASTC_RGBA_5X5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; + case Format::ASTC_RGBA_6X5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; + case Format::ASTC_RGBA_6X6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; + case Format::ASTC_RGBA_8X5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; + case Format::ASTC_RGBA_8X6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; + case Format::ASTC_RGBA_8X8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; + case Format::ASTC_RGBA_10X5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; + case Format::ASTC_RGBA_10X6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; + case Format::ASTC_RGBA_10X8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; + case Format::ASTC_RGBA_10X10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; + case Format::ASTC_RGBA_12X10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; + case Format::ASTC_RGBA_12X12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; - case Format::ASTC_SRGBA_4x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; - case Format::ASTC_SRGBA_5x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; - case Format::ASTC_SRGBA_5x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; - case Format::ASTC_SRGBA_6x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; - case Format::ASTC_SRGBA_6x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; - case Format::ASTC_SRGBA_8x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; - case Format::ASTC_SRGBA_8x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; - case Format::ASTC_SRGBA_8x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; - case Format::ASTC_SRGBA_10x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; - case Format::ASTC_SRGBA_10x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; - case Format::ASTC_SRGBA_10x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; - case Format::ASTC_SRGBA_10x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; - case Format::ASTC_SRGBA_12x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; - case Format::ASTC_SRGBA_12x12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; + case Format::ASTC_SRGBA_4X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; + case Format::ASTC_SRGBA_5X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; + case Format::ASTC_SRGBA_5X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; + case Format::ASTC_SRGBA_6X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; + case Format::ASTC_SRGBA_6X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; + case Format::ASTC_SRGBA_8X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; + case Format::ASTC_SRGBA_8X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; + case Format::ASTC_SRGBA_8X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; + case Format::ASTC_SRGBA_10X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; + case Format::ASTC_SRGBA_10X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; + case Format::ASTC_SRGBA_10X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; + case Format::ASTC_SRGBA_10X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; + case Format::ASTC_SRGBA_12X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; + case Format::ASTC_SRGBA_12X12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; default: { CCASSERT(false, "Unsupported Format, convert to GL internal format failed."); @@ -156,7 +158,7 @@ GLenum MapGLInternalFormat(Format format) { } } -GLenum MapGLFormat(Format format) { +GLenum mapGLFormat(Format format) { switch (format) { case Format::A8: return GL_ALPHA; case Format::L8: return GL_LUMINANCE; @@ -200,11 +202,11 @@ GLenum MapGLFormat(Format format) { case Format::RGB32F: return GL_RGB; case Format::RGBA32UI: case Format::RGBA32I: - case Format::RGBA32F: return GL_RGBA; + case Format::RGBA32F: case Format::RGB10A2: return GL_RGBA; - case Format::R11G11B10F: return GL_RGB; + case Format::R11G11B10F: case Format::R5G6B5: return GL_RGB; - case Format::RGB5A1: return GL_RGBA; + case Format::RGB5A1: case Format::RGBA4: return GL_RGBA; case Format::D16: return GL_DEPTH_COMPONENT; case Format::D16S8: return GL_DEPTH_STENCIL; @@ -239,35 +241,35 @@ GLenum MapGLFormat(Format format) { case Format::PVRTC_RGB4: return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; case Format::PVRTC_RGBA4: return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - case Format::ASTC_RGBA_4x4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; - case Format::ASTC_RGBA_5x4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; - case Format::ASTC_RGBA_5x5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; - case Format::ASTC_RGBA_6x5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; - case Format::ASTC_RGBA_6x6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; - case Format::ASTC_RGBA_8x5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; - case Format::ASTC_RGBA_8x6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; - case Format::ASTC_RGBA_8x8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; - case Format::ASTC_RGBA_10x5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; - case Format::ASTC_RGBA_10x6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; - case Format::ASTC_RGBA_10x8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; - case Format::ASTC_RGBA_10x10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; - case Format::ASTC_RGBA_12x10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; - case Format::ASTC_RGBA_12x12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; + case Format::ASTC_RGBA_4X4: return GL_COMPRESSED_RGBA_ASTC_4x4_KHR; + case Format::ASTC_RGBA_5X4: return GL_COMPRESSED_RGBA_ASTC_5x4_KHR; + case Format::ASTC_RGBA_5X5: return GL_COMPRESSED_RGBA_ASTC_5x5_KHR; + case Format::ASTC_RGBA_6X5: return GL_COMPRESSED_RGBA_ASTC_6x5_KHR; + case Format::ASTC_RGBA_6X6: return GL_COMPRESSED_RGBA_ASTC_6x6_KHR; + case Format::ASTC_RGBA_8X5: return GL_COMPRESSED_RGBA_ASTC_8x5_KHR; + case Format::ASTC_RGBA_8X6: return GL_COMPRESSED_RGBA_ASTC_8x6_KHR; + case Format::ASTC_RGBA_8X8: return GL_COMPRESSED_RGBA_ASTC_8x8_KHR; + case Format::ASTC_RGBA_10X5: return GL_COMPRESSED_RGBA_ASTC_10x5_KHR; + case Format::ASTC_RGBA_10X6: return GL_COMPRESSED_RGBA_ASTC_10x6_KHR; + case Format::ASTC_RGBA_10X8: return GL_COMPRESSED_RGBA_ASTC_10x8_KHR; + case Format::ASTC_RGBA_10X10: return GL_COMPRESSED_RGBA_ASTC_10x10_KHR; + case Format::ASTC_RGBA_12X10: return GL_COMPRESSED_RGBA_ASTC_12x10_KHR; + case Format::ASTC_RGBA_12X12: return GL_COMPRESSED_RGBA_ASTC_12x12_KHR; - case Format::ASTC_SRGBA_4x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; - case Format::ASTC_SRGBA_5x4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; - case Format::ASTC_SRGBA_5x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; - case Format::ASTC_SRGBA_6x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; - case Format::ASTC_SRGBA_6x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; - case Format::ASTC_SRGBA_8x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; - case Format::ASTC_SRGBA_8x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; - case Format::ASTC_SRGBA_8x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; - case Format::ASTC_SRGBA_10x5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; - case Format::ASTC_SRGBA_10x6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; - case Format::ASTC_SRGBA_10x8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; - case Format::ASTC_SRGBA_10x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; - case Format::ASTC_SRGBA_12x10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; - case Format::ASTC_SRGBA_12x12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; + case Format::ASTC_SRGBA_4X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; + case Format::ASTC_SRGBA_5X4: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR; + case Format::ASTC_SRGBA_5X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR; + case Format::ASTC_SRGBA_6X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR; + case Format::ASTC_SRGBA_6X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR; + case Format::ASTC_SRGBA_8X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR; + case Format::ASTC_SRGBA_8X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR; + case Format::ASTC_SRGBA_8X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR; + case Format::ASTC_SRGBA_10X5: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR; + case Format::ASTC_SRGBA_10X6: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR; + case Format::ASTC_SRGBA_10X8: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR; + case Format::ASTC_SRGBA_10X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR; + case Format::ASTC_SRGBA_12X10: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR; + case Format::ASTC_SRGBA_12X12: return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR; default: { CCASSERT(false, "Unsupported Format, convert to WebGL format failed."); @@ -276,7 +278,7 @@ GLenum MapGLFormat(Format format) { } } -GLenum MapGLType(Type type) { +GLenum mapGLType(Type type) { switch (type) { case Type::BOOL: return GL_BOOL; case Type::BOOL2: return GL_BOOL_VEC2; @@ -311,7 +313,7 @@ GLenum MapGLType(Type type) { } } -Type MapType(GLenum glType) { +Type mapType(GLenum glType) { switch (glType) { case GL_BOOL: return Type::BOOL; case GL_BOOL_VEC2: return Type::BOOL2; @@ -349,7 +351,7 @@ Type MapType(GLenum glType) { } } -GLenum FormatToGLType(Format format) { +GLenum formatToGLType(Format format) { switch (format) { case Format::R8: return GL_UNSIGNED_BYTE; case Format::R8SN: return GL_BYTE; @@ -373,7 +375,7 @@ GLenum FormatToGLType(Format format) { case Format::RG32UI: return GL_UNSIGNED_INT; case Format::RG32I: return GL_INT; - case Format::RGB8: return GL_UNSIGNED_BYTE; + case Format::RGB8: case Format::SRGB8: return GL_UNSIGNED_BYTE; case Format::RGB8SN: return GL_BYTE; case Format::RGB8UI: return GL_UNSIGNED_BYTE; @@ -385,7 +387,7 @@ GLenum FormatToGLType(Format format) { case Format::RGB32UI: return GL_UNSIGNED_INT; case Format::RGB32I: return GL_INT; - case Format::RGBA8: return GL_UNSIGNED_BYTE; + case Format::RGBA8: case Format::SRGB8_A8: return GL_UNSIGNED_BYTE; case Format::RGBA8SN: return GL_BYTE; case Format::RGBA8UI: return GL_UNSIGNED_BYTE; @@ -401,7 +403,7 @@ GLenum FormatToGLType(Format format) { case Format::R11G11B10F: return GL_UNSIGNED_INT_10F_11F_11F_REV; case Format::RGB5A1: return GL_UNSIGNED_SHORT_5_5_5_1; case Format::RGBA4: return GL_UNSIGNED_SHORT_4_4_4_4; - case Format::RGB10A2: return GL_UNSIGNED_INT_2_10_10_10_REV; + case Format::RGB10A2: case Format::RGB10A2UI: return GL_UNSIGNED_INT_2_10_10_10_REV; case Format::RGB9E5: return GL_FLOAT; @@ -412,66 +414,66 @@ GLenum FormatToGLType(Format format) { case Format::D32F: return GL_FLOAT; case Format::D32F_S8: return GL_FLOAT_32_UNSIGNED_INT_24_8_REV; - case Format::BC1: return GL_UNSIGNED_BYTE; - case Format::BC1_SRGB: return GL_UNSIGNED_BYTE; - case Format::BC2: return GL_UNSIGNED_BYTE; - case Format::BC2_SRGB: return GL_UNSIGNED_BYTE; - case Format::BC3: return GL_UNSIGNED_BYTE; - case Format::BC3_SRGB: return GL_UNSIGNED_BYTE; + case Format::BC1: + case Format::BC1_SRGB: + case Format::BC2: + case Format::BC2_SRGB: + case Format::BC3: + case Format::BC3_SRGB: case Format::BC4: return GL_UNSIGNED_BYTE; case Format::BC4_SNORM: return GL_BYTE; case Format::BC5: return GL_UNSIGNED_BYTE; case Format::BC5_SNORM: return GL_BYTE; - case Format::BC6H_SF16: return GL_FLOAT; + case Format::BC6H_SF16: case Format::BC6H_UF16: return GL_FLOAT; - case Format::BC7: return GL_UNSIGNED_BYTE; - case Format::BC7_SRGB: return GL_UNSIGNED_BYTE; + case Format::BC7: + case Format::BC7_SRGB: - case Format::ETC_RGB8: return GL_UNSIGNED_BYTE; - case Format::ETC2_RGB8: return GL_UNSIGNED_BYTE; - case Format::ETC2_SRGB8: return GL_UNSIGNED_BYTE; - case Format::ETC2_RGB8_A1: return GL_UNSIGNED_BYTE; - case Format::ETC2_SRGB8_A1: return GL_UNSIGNED_BYTE; + case Format::ETC_RGB8: + case Format::ETC2_RGB8: + case Format::ETC2_SRGB8: + case Format::ETC2_RGB8_A1: + case Format::ETC2_SRGB8_A1: case Format::EAC_R11: return GL_UNSIGNED_BYTE; case Format::EAC_R11SN: return GL_BYTE; case Format::EAC_RG11: return GL_UNSIGNED_BYTE; case Format::EAC_RG11SN: return GL_BYTE; - case Format::PVRTC_RGB2: return GL_UNSIGNED_BYTE; - case Format::PVRTC_RGBA2: return GL_UNSIGNED_BYTE; - case Format::PVRTC_RGB4: return GL_UNSIGNED_BYTE; - case Format::PVRTC_RGBA4: return GL_UNSIGNED_BYTE; - case Format::PVRTC2_2BPP: return GL_UNSIGNED_BYTE; - case Format::PVRTC2_4BPP: return GL_UNSIGNED_BYTE; + case Format::PVRTC_RGB2: + case Format::PVRTC_RGBA2: + case Format::PVRTC_RGB4: + case Format::PVRTC_RGBA4: + case Format::PVRTC2_2BPP: + case Format::PVRTC2_4BPP: - case Format::ASTC_RGBA_4x4: - case Format::ASTC_RGBA_5x4: - case Format::ASTC_RGBA_5x5: - case Format::ASTC_RGBA_6x5: - case Format::ASTC_RGBA_6x6: - case Format::ASTC_RGBA_8x5: - case Format::ASTC_RGBA_8x6: - case Format::ASTC_RGBA_8x8: - case Format::ASTC_RGBA_10x5: - case Format::ASTC_RGBA_10x6: - case Format::ASTC_RGBA_10x8: - case Format::ASTC_RGBA_10x10: - case Format::ASTC_RGBA_12x10: - case Format::ASTC_RGBA_12x12: - case Format::ASTC_SRGBA_4x4: - case Format::ASTC_SRGBA_5x4: - case Format::ASTC_SRGBA_5x5: - case Format::ASTC_SRGBA_6x5: - case Format::ASTC_SRGBA_6x6: - case Format::ASTC_SRGBA_8x5: - case Format::ASTC_SRGBA_8x6: - case Format::ASTC_SRGBA_8x8: - case Format::ASTC_SRGBA_10x5: - case Format::ASTC_SRGBA_10x6: - case Format::ASTC_SRGBA_10x8: - case Format::ASTC_SRGBA_10x10: - case Format::ASTC_SRGBA_12x10: - case Format::ASTC_SRGBA_12x12: + case Format::ASTC_RGBA_4X4: + case Format::ASTC_RGBA_5X4: + case Format::ASTC_RGBA_5X5: + case Format::ASTC_RGBA_6X5: + case Format::ASTC_RGBA_6X6: + case Format::ASTC_RGBA_8X5: + case Format::ASTC_RGBA_8X6: + case Format::ASTC_RGBA_8X8: + case Format::ASTC_RGBA_10X5: + case Format::ASTC_RGBA_10X6: + case Format::ASTC_RGBA_10X8: + case Format::ASTC_RGBA_10X10: + case Format::ASTC_RGBA_12X10: + case Format::ASTC_RGBA_12X12: + case Format::ASTC_SRGBA_4X4: + case Format::ASTC_SRGBA_5X4: + case Format::ASTC_SRGBA_5X5: + case Format::ASTC_SRGBA_6X5: + case Format::ASTC_SRGBA_6X6: + case Format::ASTC_SRGBA_8X5: + case Format::ASTC_SRGBA_8X6: + case Format::ASTC_SRGBA_8X8: + case Format::ASTC_SRGBA_10X5: + case Format::ASTC_SRGBA_10X6: + case Format::ASTC_SRGBA_10X8: + case Format::ASTC_SRGBA_10X10: + case Format::ASTC_SRGBA_12X10: + case Format::ASTC_SRGBA_12X12: return GL_UNSIGNED_BYTE; default: { @@ -480,7 +482,7 @@ GLenum FormatToGLType(Format format) { } } -uint GLTypeSize(GLenum glType) { +uint glTypeSize(GLenum glType) { switch (glType) { case GL_BOOL: return 4; case GL_BOOL_VEC2: return 8; @@ -497,7 +499,7 @@ uint GLTypeSize(GLenum glType) { case GL_FLOAT: return 4; case GL_FLOAT_VEC2: return 8; case GL_FLOAT_VEC3: return 12; - case GL_FLOAT_VEC4: return 16; + case GL_FLOAT_VEC4: case GL_FLOAT_MAT2: return 16; case GL_FLOAT_MAT2x3: return 24; case GL_FLOAT_MAT2x4: return 32; @@ -507,18 +509,18 @@ uint GLTypeSize(GLenum glType) { case GL_FLOAT_MAT4x2: return 32; case GL_FLOAT_MAT4x3: return 48; case GL_FLOAT_MAT4: return 64; - case GL_SAMPLER_2D: return 4; - case GL_SAMPLER_2D_ARRAY: return 4; - case GL_SAMPLER_2D_ARRAY_SHADOW: return 4; - case GL_SAMPLER_3D: return 4; - case GL_SAMPLER_CUBE: return 4; - case GL_INT_SAMPLER_2D: return 4; - case GL_INT_SAMPLER_2D_ARRAY: return 4; - case GL_INT_SAMPLER_3D: return 4; - case GL_INT_SAMPLER_CUBE: return 4; - case GL_UNSIGNED_INT_SAMPLER_2D: return 4; - case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: return 4; - case GL_UNSIGNED_INT_SAMPLER_3D: return 4; + case GL_SAMPLER_2D: + case GL_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY_SHADOW: + case GL_SAMPLER_3D: + case GL_SAMPLER_CUBE: + case GL_INT_SAMPLER_2D: + case GL_INT_SAMPLER_2D_ARRAY: + case GL_INT_SAMPLER_3D: + case GL_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_2D: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_3D: case GL_UNSIGNED_INT_SAMPLER_CUBE: return 4; default: { CCASSERT(false, "Unsupported GLType, get type failed."); @@ -527,16 +529,16 @@ uint GLTypeSize(GLenum glType) { } } -uint GLComponentCount(GLenum glType) { +uint glComponentCount(GLenum glType) { switch (glType) { - case GL_FLOAT_MAT2: return 2; - case GL_FLOAT_MAT2x3: return 2; + case GL_FLOAT_MAT2: + case GL_FLOAT_MAT2x3: case GL_FLOAT_MAT2x4: return 2; - case GL_FLOAT_MAT3x2: return 3; - case GL_FLOAT_MAT3: return 3; + case GL_FLOAT_MAT3x2: + case GL_FLOAT_MAT3: case GL_FLOAT_MAT3x4: return 3; - case GL_FLOAT_MAT4x2: return 4; - case GL_FLOAT_MAT4x3: return 4; + case GL_FLOAT_MAT4x2: + case GL_FLOAT_MAT4x3: case GL_FLOAT_MAT4: return 4; default: { return 1; @@ -598,20 +600,33 @@ const GLenum GLES3_BLEND_FACTORS[] = { GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, }; + +const GLenum GLES3_FILTERS[] = { + GL_NONE, + GL_NEAREST, + GL_LINEAR, + GL_NONE, +}; + +const GLenum GL_MEMORY_ACCESS[] = { + GL_READ_ONLY, + GL_WRITE_ONLY, + GL_READ_WRITE, +}; } // namespace -void GLES3CmdFuncCreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { - GLenum glUsage = (gpuBuffer->memUsage & MemoryUsageBit::HOST ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); +void cmdFuncGLES3CreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { + GLenum glUsage = hasFlag(gpuBuffer->memUsage, MemoryUsageBit::HOST) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - if (gpuBuffer->usage & BufferUsageBit::VERTEX) { + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) { gpuBuffer->glTarget = GL_ARRAY_BUFFER; GL_CHECK(glGenBuffers(1, &gpuBuffer->glBuffer)); if (gpuBuffer->size) { if (USE_VAO) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -624,14 +639,14 @@ void GLES3CmdFuncCreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); device->stateCache()->glArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDEX) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) { gpuBuffer->glTarget = GL_ELEMENT_ARRAY_BUFFER; GL_CHECK(glGenBuffers(1, &gpuBuffer->glBuffer)); if (gpuBuffer->size) { if (USE_VAO) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -644,7 +659,7 @@ void GLES3CmdFuncCreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); device->stateCache()->glElementArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::UNIFORM) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::UNIFORM)) { gpuBuffer->glTarget = GL_UNIFORM_BUFFER; GL_CHECK(glGenBuffers(1, &gpuBuffer->glBuffer)); if (gpuBuffer->size) { @@ -656,11 +671,23 @@ void GLES3CmdFuncCreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_UNIFORM_BUFFER, 0)); device->stateCache()->glUniformBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::STORAGE)) { + gpuBuffer->glTarget = GL_SHADER_STORAGE_BUFFER; + GL_CHECK(glGenBuffers(1, &gpuBuffer->glBuffer)); + if (gpuBuffer->size) { + if (device->stateCache()->glShaderStorageBuffer != gpuBuffer->glBuffer) { + GL_CHECK(glBindBuffer(GL_SHADER_STORAGE_BUFFER, gpuBuffer->glBuffer)); + } + + GL_CHECK(glBufferData(GL_SHADER_STORAGE_BUFFER, gpuBuffer->size, nullptr, glUsage)); + GL_CHECK(glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0)); + device->stateCache()->glShaderStorageBuffer = 0; + } + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { gpuBuffer->glTarget = GL_NONE; - } else if ((gpuBuffer->usage & BufferUsageBit::TRANSFER_DST) || - (gpuBuffer->usage & BufferUsageBit::TRANSFER_SRC)) { - gpuBuffer->buffer = (uint8_t *)CC_MALLOC(gpuBuffer->size); + } else if ((hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_DST)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_SRC))) { + gpuBuffer->buffer = static_cast(CC_MALLOC(gpuBuffer->size)); gpuBuffer->glTarget = GL_NONE; } else { CCASSERT(false, "Unsupported BufferType, create buffer failed."); @@ -668,15 +695,15 @@ void GLES3CmdFuncCreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { } } -void GLES3CmdFuncDestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { +void cmdFuncGLES3DestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; if (gpuBuffer->glBuffer) { - if (gpuBuffer->usage & BufferUsageBit::VERTEX) { + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) { if (USE_VAO) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -684,11 +711,11 @@ void GLES3CmdFuncDestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); device->stateCache()->glArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDEX) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) { if (USE_VAO) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -696,13 +723,13 @@ void GLES3CmdFuncDestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); device->stateCache()->glElementArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::UNIFORM) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::UNIFORM)) { vector &ubo = device->stateCache()->glBindUBOs; for (GLuint i = 0; i < ubo.size(); i++) { if (ubo[i] == gpuBuffer->glBuffer) { GL_CHECK(glBindBufferBase(GL_UNIFORM_BUFFER, i, 0)); device->stateCache()->glUniformBuffer = 0; - ubo[i] = 0; + ubo[i] = 0; } } if (device->stateCache()->glUniformBuffer == gpuBuffer->glBuffer) { @@ -710,24 +737,38 @@ void GLES3CmdFuncDestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { device->stateCache()->glUniformBuffer = 0; } } + if (hasFlag(gpuBuffer->usage, BufferUsageBit::STORAGE)) { + vector &ssbo = device->stateCache()->glBindSSBOs; + for (GLuint i = 0; i < ssbo.size(); i++) { + if (ssbo[i] == gpuBuffer->glBuffer) { + GL_CHECK(glBindBufferBase(GL_UNIFORM_BUFFER, i, 0)); + device->stateCache()->glShaderStorageBuffer = 0; + ssbo[i] = 0; + } + } + if (device->stateCache()->glShaderStorageBuffer == gpuBuffer->glBuffer) { + GL_CHECK(glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0)); + device->stateCache()->glShaderStorageBuffer = 0; + } + } GL_CHECK(glDeleteBuffers(1, &gpuBuffer->glBuffer)); gpuBuffer->glBuffer = 0; } - CC_SAFE_FREE(gpuBuffer->buffer); + CC_SAFE_FREE(gpuBuffer->buffer) } -void GLES3CmdFuncResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { +void cmdFuncGLES3ResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLenum glUsage = (gpuBuffer->memUsage & MemoryUsageBit::HOST ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); + GLenum glUsage = (hasFlag(gpuBuffer->memUsage, MemoryUsageBit::HOST) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); - if (gpuBuffer->usage & BufferUsageBit::VERTEX) { + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) { gpuBuffer->glTarget = GL_ARRAY_BUFFER; if (gpuBuffer->size) { if (USE_VAO) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -740,13 +781,13 @@ void GLES3CmdFuncResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); device->stateCache()->glArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDEX) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) { gpuBuffer->glTarget = GL_ELEMENT_ARRAY_BUFFER; if (gpuBuffer->size) { if (USE_VAO) { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } } @@ -759,7 +800,7 @@ void GLES3CmdFuncResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); device->stateCache()->glElementArrayBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::UNIFORM) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::UNIFORM)) { gpuBuffer->glTarget = GL_UNIFORM_BUFFER; if (gpuBuffer->size) { if (device->stateCache()->glUniformBuffer != gpuBuffer->glBuffer) { @@ -770,15 +811,15 @@ void GLES3CmdFuncResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { GL_CHECK(glBindBuffer(GL_UNIFORM_BUFFER, 0)); device->stateCache()->glUniformBuffer = 0; } - } else if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { gpuBuffer->indirects.resize(gpuBuffer->count); gpuBuffer->glTarget = GL_NONE; - } else if ((gpuBuffer->usage & BufferUsageBit::TRANSFER_DST) || - (gpuBuffer->usage & BufferUsageBit::TRANSFER_SRC)) { + } else if ((hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_DST)) || + (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_SRC))) { if (gpuBuffer->buffer) { CC_FREE(gpuBuffer->buffer); } - gpuBuffer->buffer = (uint8_t *)CC_MALLOC(gpuBuffer->size); + gpuBuffer->buffer = static_cast(CC_MALLOC(gpuBuffer->size)); gpuBuffer->glTarget = GL_NONE; } else { CCASSERT(false, "Unsupported BufferType, resize buffer failed."); @@ -786,10 +827,10 @@ void GLES3CmdFuncResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer) { } } -void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) { - gpuTexture->glInternelFmt = MapGLInternalFormat(gpuTexture->format); - gpuTexture->glFormat = MapGLFormat(gpuTexture->format); - gpuTexture->glType = FormatToGLType(gpuTexture->format); +void cmdFuncGLES3CreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) { + gpuTexture->glInternelFmt = mapGLInternalFormat(gpuTexture->format); + gpuTexture->glFormat = mapGLFormat(gpuTexture->format); + gpuTexture->glType = formatToGLType(gpuTexture->format); switch (gpuTexture->type) { case TextureType::TEX2D: { @@ -803,10 +844,10 @@ void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } uint w = gpuTexture->width; uint h = gpuTexture->height; - if (gpuTexture->flags & TextureFlagBit::IMMUTABLE) { + if (hasFlag(gpuTexture->flags, TextureFlagBit::IMMUTABLE)) { GL_CHECK(glTexStorage2D(GL_TEXTURE_2D, gpuTexture->mipLevel, gpuTexture->glInternelFmt, w, h)); } else { - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { GL_CHECK(glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); w = std::max(1U, w >> 1); @@ -814,7 +855,7 @@ void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } } else { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -835,10 +876,10 @@ void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } uint w = gpuTexture->width; uint h = gpuTexture->height; - if (gpuTexture->flags & TextureFlagBit::IMMUTABLE) { + if (hasFlag(gpuTexture->flags, TextureFlagBit::IMMUTABLE)) { GL_CHECK(glTexStorage2D(GL_TEXTURE_CUBE_MAP, gpuTexture->mipLevel, gpuTexture->glInternelFmt, w, h)); } else { - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { for (uint f = 0; f < 6; ++f) { GL_CHECK(glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture->glInternelFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); @@ -848,7 +889,7 @@ void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } } else { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); for (uint f = 0; f < 6; ++f) { GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); } @@ -864,24 +905,26 @@ void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) CCASSERT(false, "Unsupported TextureType, create texture failed."); break; } -} // namespace gfx +} -void GLES3CmdFuncDestroyTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) { +void cmdFuncGLES3DestroyTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) { if (gpuTexture->glTexture) { for (GLuint &glTexture : device->stateCache()->glTextures) { if (glTexture == gpuTexture->glTexture) { glTexture = 0; } } + device->framebufferCacheMap()->onTextureDestroy(gpuTexture); + GL_CHECK(glDeleteTextures(1, &gpuTexture->glTexture)); gpuTexture->glTexture = 0; } } -void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) { - gpuTexture->glInternelFmt = MapGLInternalFormat(gpuTexture->format); - gpuTexture->glFormat = MapGLFormat(gpuTexture->format); - gpuTexture->glType = FormatToGLType(gpuTexture->format); +void cmdFuncGLES3ResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) { + gpuTexture->glInternelFmt = mapGLInternalFormat(gpuTexture->format); + gpuTexture->glFormat = mapGLFormat(gpuTexture->format); + gpuTexture->glType = formatToGLType(gpuTexture->format); switch (gpuTexture->type) { case TextureType::TEX2D: { @@ -894,7 +937,7 @@ void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } uint w = gpuTexture->width; uint h = gpuTexture->height; - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { GL_CHECK(glTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, gpuTexture->glFormat, gpuTexture->glType, nullptr)); w = std::max(1U, w >> 1); @@ -902,7 +945,7 @@ void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } } else { for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_2D, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -919,7 +962,7 @@ void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) GL_CHECK(glBindTexture(GL_TEXTURE_CUBE_MAP, gpuTexture->glTexture)); glTexture = gpuTexture->glTexture; } - if (!GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed) { + if (!GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed) { for (uint f = 0; f < 6; ++f) { uint w = gpuTexture->width; uint h = gpuTexture->height; @@ -934,7 +977,7 @@ void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) uint w = gpuTexture->width; uint h = gpuTexture->height; for (uint i = 0; i < gpuTexture->mipLevel; ++i) { - uint imgSize = FormatSize(gpuTexture->format, w, h, 1); + uint imgSize = formatSize(gpuTexture->format, w, h, 1); GL_CHECK(glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture->glInternelFmt, w, h, 0, imgSize, nullptr)); w = std::max(1U, w >> 1); h = std::max(1U, h >> 1); @@ -950,7 +993,7 @@ void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture) } } -void GLES3CmdFuncCreateSampler(GLES3Device *device, GLES3GPUSampler *gpuSampler) { +void cmdFuncGLES3CreateSampler(GLES3Device * /*device*/, GLES3GPUSampler *gpuSampler) { GL_CHECK(glGenSamplers(1, &gpuSampler->glSampler)); if (gpuSampler->minFilter == Filter::LINEAR || gpuSampler->minFilter == Filter::ANISOTROPIC) { if (gpuSampler->mipFilter == Filter::LINEAR || gpuSampler->mipFilter == Filter::ANISOTROPIC) { @@ -976,19 +1019,19 @@ void GLES3CmdFuncCreateSampler(GLES3Device *device, GLES3GPUSampler *gpuSampler) gpuSampler->glMagFilter = GL_NEAREST; } - gpuSampler->glWrapS = GLES3_WRAPS[(int)gpuSampler->addressU]; - gpuSampler->glWrapT = GLES3_WRAPS[(int)gpuSampler->addressV]; - gpuSampler->glWrapR = GLES3_WRAPS[(int)gpuSampler->addressW]; + gpuSampler->glWrapS = GLES3_WRAPS[static_cast(gpuSampler->addressU)]; + gpuSampler->glWrapT = GLES3_WRAPS[static_cast(gpuSampler->addressV)]; + gpuSampler->glWrapR = GLES3_WRAPS[static_cast(gpuSampler->addressW)]; GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_MIN_FILTER, gpuSampler->glMinFilter)); GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_MAG_FILTER, gpuSampler->glMagFilter)); GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_WRAP_S, gpuSampler->glWrapS)); GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_WRAP_T, gpuSampler->glWrapT)); GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_WRAP_R, gpuSampler->glWrapR)); - GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_MIN_LOD, gpuSampler->minLOD)); - GL_CHECK(glSamplerParameteri(gpuSampler->glSampler, GL_TEXTURE_MAX_LOD, gpuSampler->maxLOD)); + GL_CHECK(glSamplerParameterf(gpuSampler->glSampler, GL_TEXTURE_MIN_LOD, 0.F)); + GL_CHECK(glSamplerParameterf(gpuSampler->glSampler, GL_TEXTURE_MAX_LOD, 1000.F)); } -void GLES3CmdFuncDestroySampler(GLES3Device *device, GLES3GPUSampler *gpuSampler) { +void cmdFuncGLES3DestroySampler(GLES3Device *device, GLES3GPUSampler *gpuSampler) { if (gpuSampler->glSampler) { for (GLuint &glSampler : device->stateCache()->glSamplers) { if (glSampler == gpuSampler->glSampler) { @@ -1000,25 +1043,32 @@ void GLES3CmdFuncDestroySampler(GLES3Device *device, GLES3GPUSampler *gpuSampler } } -void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { +void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { GLenum glShaderStage = 0; String shaderStageStr; - GLint status; + GLint status; for (size_t i = 0; i < gpuShader->gpuStages.size(); ++i) { GLES3GPUShaderStage &gpuStage = gpuShader->gpuStages[i]; + uint version = 300; switch (gpuStage.type) { case ShaderStageFlagBit::VERTEX: { - glShaderStage = GL_VERTEX_SHADER; + glShaderStage = GL_VERTEX_SHADER; shaderStageStr = "Vertex Shader"; break; } case ShaderStageFlagBit::FRAGMENT: { - glShaderStage = GL_FRAGMENT_SHADER; + glShaderStage = GL_FRAGMENT_SHADER; shaderStageStr = "Fragment Shader"; break; } + case ShaderStageFlagBit::COMPUTE: { + glShaderStage = GL_COMPUTE_SHADER; + shaderStageStr = "Compute Shader"; + version = 310; + break; + } default: { CCASSERT(false, "Unsupported ShaderStageFlagBit"); return; @@ -1026,8 +1076,8 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { } GL_CHECK(gpuStage.glShader = glCreateShader(glShaderStage)); - String shaderSource = "#version 300 es\n" + gpuStage.source; - const char *source = shaderSource.c_str(); + String shaderSource = StringUtil::format("#version %u es\n", version) + gpuStage.source; + const char *source = shaderSource.c_str(); GL_CHECK(glShaderSource(gpuStage.glShader, 1, (const GLchar **)&source, nullptr)); GL_CHECK(glCompileShader(gpuStage.glShader)); @@ -1037,11 +1087,11 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { GL_CHECK(glGetShaderiv(gpuStage.glShader, GL_INFO_LOG_LENGTH, &logSize)); ++logSize; - GLchar *logs = (GLchar *)CC_MALLOC(logSize); + auto *logs = static_cast(CC_MALLOC(logSize)); GL_CHECK(glGetShaderInfoLog(gpuStage.glShader, logSize, nullptr, logs)); CC_LOG_ERROR("%s in %s compilation failed.", shaderStageStr.c_str(), gpuShader->name.c_str()); - CC_LOG_ERROR("Shader source: %s", gpuStage.source.c_str()); + CC_LOG_ERROR("Shader source: %s", source); CC_LOG_ERROR(logs); CC_FREE(logs); GL_CHECK(glDeleteShader(gpuStage.glShader)); @@ -1077,10 +1127,9 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_INFO_LOG_LENGTH, &logSize)); if (logSize) { ++logSize; - GLchar *logs = (GLchar *)CC_MALLOC(logSize); + auto *logs = static_cast(CC_MALLOC(logSize)); GL_CHECK(glGetProgramInfoLog(gpuShader->glProgram, logSize, nullptr, logs)); - CC_LOG_ERROR("Failed to link shader '%s'.", gpuShader->name.c_str()); CC_LOG_ERROR(logs); CC_FREE(logs); return; @@ -1090,14 +1139,14 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { CC_LOG_INFO("Shader '%s' compilation succeeded.", gpuShader->name.c_str()); GLint attrMaxLength = 0; - GLint attrCount = 0; + GLint attrCount = 0; GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &attrMaxLength)); GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_ACTIVE_ATTRIBUTES, &attrCount)); - GLchar glName[256]; + GLchar glName[256]; GLsizei glLength; GLsizei glSize; - GLenum glType; + GLenum glType; gpuShader->glInputs.resize(attrCount); for (GLint i = 0; i < attrCount; ++i) { @@ -1112,149 +1161,139 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { GL_CHECK(gpuInput.glLoc = glGetAttribLocation(gpuShader->glProgram, glName)); gpuInput.binding = gpuInput.glLoc; - gpuInput.name = glName; - gpuInput.type = MapType(glType); - gpuInput.stride = GLTypeSize(glType); - gpuInput.count = glSize; - gpuInput.size = gpuInput.stride * gpuInput.count; - gpuInput.glType = glType; + gpuInput.name = glName; + gpuInput.type = mapType(glType); + gpuInput.count = glSize; + gpuInput.size = gpuInput.stride * gpuInput.count; + gpuInput.glType = glType; } - // create uniform blocks + // create buffers GLint blockCount; GL_CHECK(glGetProgramiv(gpuShader->glProgram, GL_ACTIVE_UNIFORM_BLOCKS, &blockCount)); - if (blockCount) { - GLint glBlockSize = 0; - GLint glBlockUniforms = 0; - uint32_t blockIdx = 0; - gpuShader->glBlocks.resize(blockCount); - for (GLint i = 0; i < blockCount; ++i) { - GLES3GPUUniformBlock &gpuBlock = gpuShader->glBlocks[i]; - memset(glName, 0, sizeof(glName)); - GL_CHECK(glGetActiveUniformBlockName(gpuShader->glProgram, i, 255, &glLength, glName)); + GLint bufferCount = 0; + if (device->getMinorVersion() > 0) { + GL_CHECK(glGetProgramInterfaceiv(gpuShader->glProgram, GL_SHADER_STORAGE_BLOCK, GL_ACTIVE_RESOURCES, &bufferCount)); + } - char *offset = strchr(glName, '['); - if (offset) { - glName[offset - glName] = '\0'; - } + gpuShader->glBuffers.resize(blockCount + bufferCount); - gpuBlock.name = glName; - gpuBlock.binding = GFX_INVALID_BINDING; - for (size_t b = 0; b < gpuShader->blocks.size(); ++b) { - UniformBlock &block = gpuShader->blocks[b]; - if (block.name == gpuBlock.name) { - gpuBlock.set = block.set; - gpuBlock.binding = block.binding; - gpuBlock.glBinding = block.binding + device->bindingMappingInfo().bufferOffsets[block.set]; - break; - } - } + for (GLint i = 0; i < blockCount; ++i) { + GLES3GPUUniformBuffer &glBlock = gpuShader->glBuffers[i]; + memset(glName, 0, sizeof(glName)); + GL_CHECK(glGetActiveUniformBlockName(gpuShader->glProgram, i, 255, &glLength, glName)); - if (gpuBlock.binding != GFX_INVALID_BINDING) { - blockIdx = i; - - GL_CHECK(glUniformBlockBinding(gpuShader->glProgram, blockIdx, gpuBlock.glBinding)); - - GL_CHECK(glGetActiveUniformBlockiv(gpuShader->glProgram, i, GL_UNIFORM_BLOCK_DATA_SIZE, &glBlockSize)); - GL_CHECK(glGetActiveUniformBlockiv(gpuShader->glProgram, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &glBlockUniforms)); - GL_CHECK(glUniformBlockBinding(gpuShader->glProgram, blockIdx, gpuBlock.glBinding)); - - gpuBlock.size = glBlockSize; - gpuBlock.glUniforms.resize(glBlockUniforms); - - vector indices(glBlockUniforms); - GL_CHECK(glGetActiveUniformBlockiv(gpuShader->glProgram, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, &indices[0])); - // vector sizes(glBlockUniforms); - // GL_CHECK(glGetActiveUniformsiv(gpuShader->glProgram, glBlockUniforms, (const GLuint*)indices.data(), GL_UNIFORM_SIZE, &sizes[0])); - vector offsets(glBlockUniforms); - GL_CHECK(glGetActiveUniformsiv(gpuShader->glProgram, glBlockUniforms, (const GLuint *)indices.data(), GL_UNIFORM_OFFSET, &offsets[0])); - - for (GLint u = 0; u < glBlockUniforms; ++u) { - GLES3GPUUniform &uniform = gpuBlock.glUniforms[u]; - - GLint idx = indices[u]; - memset(glName, 0, sizeof(glName)); - GL_CHECK(glGetActiveUniform(gpuShader->glProgram, idx, 255, &glLength, &glSize, &glType, glName)); - offset = strchr(glName, '['); - if (offset) { - glName[offset - glName] = '\0'; - } - - uniform.binding = GFX_INVALID_BINDING; - uniform.name = glName; - uniform.type = MapType(glType); - uniform.stride = GFX_TYPE_SIZES[(int)uniform.type]; - uniform.count = glSize; - uniform.size = uniform.stride * uniform.count; - uniform.offset = offsets[u]; - uniform.glType = glType; - uniform.glLoc = -1; - } - } // if + char *offset = strchr(glName, '['); + if (offset) { + glName[offset - glName] = '\0'; } - } // if - // create uniform samplers - if (gpuShader->samplers.size()) { - gpuShader->glSamplers.resize(gpuShader->samplers.size()); + glBlock.name = glName; + glBlock.set = INVALID_BINDING; + glBlock.binding = INVALID_BINDING; + for (size_t b = 0; b < gpuShader->blocks.size(); ++b) { + UniformBlock &block = gpuShader->blocks[b]; + if (block.name == glBlock.name) { + glBlock.set = block.set; + glBlock.binding = block.binding; + glBlock.glBinding = block.binding + device->bindingMappingInfo().bufferOffsets[block.set]; + GL_CHECK(glUniformBlockBinding(gpuShader->glProgram, i, glBlock.glBinding)); + break; + } + } + } - for (size_t i = 0; i < gpuShader->glSamplers.size(); ++i) { - UniformSampler &sampler = gpuShader->samplers[i]; - GLES3GPUUniformSampler &gpuSampler = gpuShader->glSamplers[i]; - gpuSampler.set = sampler.set; - gpuSampler.binding = sampler.binding; - gpuSampler.name = sampler.name; - gpuSampler.type = sampler.type; - gpuSampler.count = sampler.count; - gpuSampler.glType = MapGLType(gpuSampler.type); - gpuSampler.glLoc = -1; + for (GLint i = 0; i < bufferCount; ++i) { + GLES3GPUUniformBuffer &glBuffer = gpuShader->glBuffers[blockCount + i]; + memset(glName, 0, sizeof(glName)); + GL_CHECK(glGetProgramResourceName(gpuShader->glProgram, GL_SHADER_STORAGE_BLOCK, i, 255, &glLength, glName)); + + char *offset = strchr(glName, '['); + if (offset) { + glName[offset - glName] = '\0'; + } + + glBuffer.name = glName; + glBuffer.set = INVALID_BINDING; + glBuffer.binding = INVALID_BINDING; + glBuffer.isStorage = true; + for (size_t b = 0; b < gpuShader->blocks.size(); ++b) { + UniformStorageBuffer &buffer = gpuShader->buffers[b]; + if (buffer.name == glBuffer.name) { + glBuffer.set = buffer.set; + glBuffer.binding = buffer.binding; + + // no way to specify SSBO bindings here until 4.3 core + GLenum prop = GL_BUFFER_BINDING; + GL_CHECK(glGetProgramResourceiv(gpuShader->glProgram, GL_SHADER_STORAGE_BLOCK, i, 1, &prop, 1, nullptr, (GLint *)&glBuffer.glBinding)); + break; + } + } + } + + // create uniform sampler textures + if (!gpuShader->samplerTextures.empty()) { + gpuShader->glSamplerTextures.resize(gpuShader->samplerTextures.size()); + + for (size_t i = 0; i < gpuShader->glSamplerTextures.size(); ++i) { + UniformSamplerTexture & samplerTexture = gpuShader->samplerTextures[i]; + GLES3GPUUniformSamplerTexture &gpuSamplerTexture = gpuShader->glSamplerTextures[i]; + gpuSamplerTexture.set = samplerTexture.set; + gpuSamplerTexture.binding = samplerTexture.binding; + gpuSamplerTexture.name = samplerTexture.name; + gpuSamplerTexture.type = samplerTexture.type; + gpuSamplerTexture.count = samplerTexture.count; + gpuSamplerTexture.glType = mapGLType(gpuSamplerTexture.type); + gpuSamplerTexture.glLoc = -1; } } // texture unit index mapping optimization - vector glActiveSamplers; - vector glActiveSamplerLocations; - const BindingMappingInfo &bindingMappingInfo = device->bindingMappingInfo(); - map &texUnitCacheMap = device->stateCache()->texUnitCacheMap; + vector glActiveSamplerTextures; + vector glActiveSamplerLocations; + const BindingMappingInfo & bindingMappingInfo = device->bindingMappingInfo(); + unordered_map & texUnitCacheMap = device->stateCache()->texUnitCacheMap; - uint flexibleSetBaseOffset = 0u; - for (uint i = 0u; i < gpuShader->blocks.size(); i++) { - if (gpuShader->blocks[i].set == bindingMappingInfo.flexibleSet) { + // sampler bindings in the flexible set comes strictly after buffer bindings + // so we need to subtract the buffer count for these samplers + uint flexibleSetBaseOffset = 0U; + for (GLES3GPUUniformBuffer &buffer : gpuShader->glBuffers) { + if (buffer.set == bindingMappingInfo.flexibleSet) { flexibleSetBaseOffset++; } } - uint arrayOffset = 0u; + uint arrayOffset = 0U; - for (uint i = 0u; i < gpuShader->samplers.size(); i++) { - const UniformSampler &sampler = gpuShader->samplers[i]; - GLint glLoc; - GL_CHECK(glLoc = glGetUniformLocation(gpuShader->glProgram, sampler.name.c_str())); + for (uint i = 0U; i < gpuShader->samplerTextures.size(); i++) { + const UniformSamplerTexture &samplerTexture = gpuShader->samplerTextures[i]; + GLint glLoc = -1; + GL_CHECK(glLoc = glGetUniformLocation(gpuShader->glProgram, samplerTexture.name.c_str())); if (glLoc >= 0) { - glActiveSamplers.push_back(gpuShader->glSamplers[i]); + glActiveSamplerTextures.push_back(gpuShader->glSamplerTextures[i]); glActiveSamplerLocations.push_back(glLoc); } - if (!texUnitCacheMap.count(sampler.name)) { - uint binding = sampler.binding + bindingMappingInfo.samplerOffsets[sampler.set] + arrayOffset; - if (sampler.set == bindingMappingInfo.flexibleSet) binding -= flexibleSetBaseOffset; - texUnitCacheMap[sampler.name] = binding % device->getMaxTextureUnits(); - arrayOffset += sampler.count - 1; + if (texUnitCacheMap.count(samplerTexture.name) == 0U) { + uint binding = samplerTexture.binding + bindingMappingInfo.samplerOffsets[samplerTexture.set] + arrayOffset; + if (samplerTexture.set == bindingMappingInfo.flexibleSet) binding -= flexibleSetBaseOffset; + texUnitCacheMap[samplerTexture.name] = binding % device->getCapabilities().maxTextureUnits; + arrayOffset += samplerTexture.count - 1; } } - if (glActiveSamplers.size()) { - vector usedTexUnits(device->getMaxTextureUnits(), false); + if (!glActiveSamplerTextures.empty()) { + vector usedTexUnits(device->getCapabilities().maxTextureUnits, false); // try to reuse existing mappings first - for (uint i = 0u; i < glActiveSamplers.size(); i++) { - GLES3GPUUniformSampler &glSampler = glActiveSamplers[i]; + for (uint i = 0U; i < glActiveSamplerTextures.size(); i++) { + GLES3GPUUniformSamplerTexture &glSampler = glActiveSamplerTextures[i]; - if (texUnitCacheMap.count(glSampler.name)) { + if (texUnitCacheMap.count(glSampler.name) != 0U) { uint cachedUnit = texUnitCacheMap[glSampler.name]; glSampler.glLoc = glActiveSamplerLocations[i]; - for (uint t = 0u; t < glSampler.count; t++) { - while (usedTexUnits[cachedUnit]) { - cachedUnit = (cachedUnit + 1) % device->getMaxTextureUnits(); + for (uint t = 0U; t < glSampler.count; t++) { + while (usedTexUnits[cachedUnit]) { // the shader already compiles so we should be safe to do this here + cachedUnit = (cachedUnit + 1) % device->getCapabilities().maxTextureUnits; } glSampler.units.push_back(cachedUnit); usedTexUnits[cachedUnit] = true; @@ -1262,17 +1301,17 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { } } // fill in the rest sequencially - uint unitIdx = 0u; - for (uint i = 0u; i < glActiveSamplers.size(); i++) { - GLES3GPUUniformSampler &glSampler = glActiveSamplers[i]; + uint unitIdx = 0U; + for (uint i = 0U; i < glActiveSamplerTextures.size(); i++) { + GLES3GPUUniformSamplerTexture &glSampler = glActiveSamplerTextures[i]; if (glSampler.glLoc < 0) { glSampler.glLoc = glActiveSamplerLocations[i]; - for (uint t = 0u; t < glSampler.count; t++) { + for (uint t = 0U; t < glSampler.count; t++) { while (usedTexUnits[unitIdx]) { - unitIdx = (unitIdx + 1) % device->getMaxTextureUnits(); + unitIdx = (unitIdx + 1) % device->getCapabilities().maxTextureUnits; } - if (!texUnitCacheMap.count(glSampler.name)) { + if (texUnitCacheMap.count(glSampler.name) == 0U) { texUnitCacheMap[glSampler.name] = unitIdx; } glSampler.units.push_back(unitIdx); @@ -1285,35 +1324,54 @@ void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader) { GL_CHECK(glUseProgram(gpuShader->glProgram)); } - for (size_t i = 0; i < glActiveSamplers.size(); ++i) { - GLES3GPUUniformSampler &gpuSampler = glActiveSamplers[i]; - GL_CHECK(glUniform1iv(gpuSampler.glLoc, (GLsizei)gpuSampler.units.size(), gpuSampler.units.data())); + for (GLES3GPUUniformSamplerTexture &gpuSamplerTexture : glActiveSamplerTextures) { + GL_CHECK(glUniform1iv(gpuSamplerTexture.glLoc, (GLsizei)gpuSamplerTexture.units.size(), gpuSamplerTexture.units.data())); } if (device->stateCache()->glProgram != gpuShader->glProgram) { GL_CHECK(glUseProgram(device->stateCache()->glProgram)); } } + gpuShader->glSamplerTextures = glActiveSamplerTextures; - // strip out the inactive ones - gpuShader->glSamplers = glActiveSamplers; + // create uniform storage images + if (!gpuShader->images.empty()) { + for (size_t i = 0; i < gpuShader->images.size(); ++i) { + UniformStorageImage &image = gpuShader->images[i]; + GLint glLoc = -1; + GL_CHECK(glLoc = glGetUniformLocation(gpuShader->glProgram, image.name.c_str())); + if (glLoc >= 0) { + GLES3GPUUniformStorageImage gpuImage; + gpuImage.set = image.set; + gpuImage.binding = image.binding; + gpuImage.name = image.name; + gpuImage.type = image.type; + gpuImage.count = image.count; + gpuImage.glMemoryAccess = GL_MEMORY_ACCESS[static_cast(image.memoryAccess)]; + gpuImage.units.resize(gpuImage.count); + gpuImage.glLoc = glLoc; + // storage image units are immutable + GL_CHECK(glGetUniformiv(gpuShader->glProgram, gpuImage.glLoc, gpuImage.units.data())); + gpuShader->glImages.push_back(gpuImage); + } + } + } } -void GLES3CmdFuncDestroyShader(GLES3Device *device, GLES3GPUShader *gpuShader) { +void cmdFuncGLES3DestroyShader(GLES3Device *device, GLES3GPUShader *gpuShader) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; if (gpuShader->glProgram) { if (device->stateCache()->glProgram == gpuShader->glProgram) { GL_CHECK(glUseProgram(0)); device->stateCache()->glProgram = 0; - gfxStateCache.gpuPipelineState = nullptr; + gfxStateCache.gpuPipelineState = nullptr; } GL_CHECK(glDeleteProgram(gpuShader->glProgram)); gpuShader->glProgram = 0; } } -void GLES3CmdFuncCreateInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler) { - +void cmdFuncGLES3CreateInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler) { if (gpuInputAssembler->gpuIndexBuffer) { switch (gpuInputAssembler->gpuIndexBuffer->stride) { case 1: gpuInputAssembler->glIndexType = GL_UNSIGNED_BYTE; break; @@ -1325,37 +1383,37 @@ void GLES3CmdFuncCreateInputAssembler(GLES3Device *device, GLES3GPUInputAssemble } } - vector streamOffsets(device->getMaxVertexAttributes(), 0u); + vector streamOffsets(device->getCapabilities().maxVertexAttributes, 0U); gpuInputAssembler->glAttribs.resize(gpuInputAssembler->attributes.size()); for (size_t i = 0; i < gpuInputAssembler->glAttribs.size(); ++i) { GLES3GPUAttribute &gpuAttribute = gpuInputAssembler->glAttribs[i]; - const Attribute &attrib = gpuInputAssembler->attributes[i]; - GLES3GPUBuffer *gpuVB = (GLES3GPUBuffer *)gpuInputAssembler->gpuVertexBuffers[attrib.stream]; + const Attribute & attrib = gpuInputAssembler->attributes[i]; + auto * gpuVB = static_cast(gpuInputAssembler->gpuVertexBuffers[attrib.stream]); - gpuAttribute.name = attrib.name; - gpuAttribute.glType = FormatToGLType(attrib.format); - gpuAttribute.size = GFX_FORMAT_INFOS[(int)attrib.format].size; - gpuAttribute.count = GFX_FORMAT_INFOS[(int)attrib.format].count; - gpuAttribute.componentCount = GLComponentCount(gpuAttribute.glType); - gpuAttribute.isNormalized = attrib.isNormalized; - gpuAttribute.isInstanced = attrib.isInstanced; - gpuAttribute.offset = streamOffsets[attrib.stream]; + gpuAttribute.name = attrib.name; + gpuAttribute.glType = formatToGLType(attrib.format); + gpuAttribute.size = GFX_FORMAT_INFOS[static_cast(attrib.format)].size; + gpuAttribute.count = GFX_FORMAT_INFOS[static_cast(attrib.format)].count; + gpuAttribute.componentCount = glComponentCount(gpuAttribute.glType); + gpuAttribute.isNormalized = attrib.isNormalized; + gpuAttribute.isInstanced = attrib.isInstanced; + gpuAttribute.offset = streamOffsets[attrib.stream]; if (gpuVB) { gpuAttribute.glBuffer = gpuVB->glBuffer; - gpuAttribute.stride = gpuVB->stride; + gpuAttribute.stride = gpuVB->stride; } streamOffsets[attrib.stream] += gpuAttribute.size; } } -void GLES3CmdFuncDestroyInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler) { +void cmdFuncGLES3DestroyInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; for (auto it = gpuInputAssembler->glVAOs.begin(); it != gpuInputAssembler->glVAOs.end(); ++it) { if (device->stateCache()->glVAO == it->second) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } GL_CHECK(glDeleteVertexArrays(1, &it->second)); @@ -1363,9 +1421,9 @@ void GLES3CmdFuncDestroyInputAssembler(GLES3Device *device, GLES3GPUInputAssembl gpuInputAssembler->glVAOs.clear(); } -void GLES3CmdFuncCreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO) { - size_t colorViewCount = gpuFBO->gpuColorTextures.size(); - uint swapchainImageIndices = 0; +void cmdFuncGLES3CreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO) { + size_t colorViewCount = gpuFBO->gpuColorTextures.size(); + uint swapchainImageIndices = 0; for (size_t i = 0; i < colorViewCount; ++i) { if (!gpuFBO->gpuColorTextures[i]) { swapchainImageIndices |= (1 << i); @@ -1379,13 +1437,13 @@ void GLES3CmdFuncCreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpu if (gpuFBO->isOffscreen) { GL_CHECK(glGenFramebuffers(1, &gpuFBO->glFramebuffer)); - if (device->stateCache()->glFramebuffer != gpuFBO->glFramebuffer) { - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, gpuFBO->glFramebuffer)); - device->stateCache()->glFramebuffer = gpuFBO->glFramebuffer; + if (device->stateCache()->glDrawFramebuffer != gpuFBO->glFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gpuFBO->glFramebuffer)); + device->stateCache()->glDrawFramebuffer = gpuFBO->glFramebuffer; } - GLenum attachments[GFX_MAX_ATTACHMENTS] = {0}; - uint attachmentCount = 0; + GLenum attachments[MAX_ATTACHMENTS] = {0}; + uint attachmentCount = 0; size_t colorMipmapLevelCount = gpuFBO->colorMipmapLevels.size(); for (size_t i = 0; i < gpuFBO->gpuColorTextures.size(); ++i) { @@ -1395,22 +1453,22 @@ void GLES3CmdFuncCreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpu if (i < colorMipmapLevelCount) { mipmapLevel = gpuFBO->colorMipmapLevels[i]; } - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, (GLenum)(GL_COLOR_ATTACHMENT0 + i), gpuColorTexture->glTarget, gpuColorTexture->glTexture, mipmapLevel)); + GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, (GLenum)(GL_COLOR_ATTACHMENT0 + i), gpuColorTexture->glTarget, gpuColorTexture->glTexture, mipmapLevel)); - attachments[attachmentCount++] = (GLenum)(GL_COLOR_ATTACHMENT0 + i); + attachments[attachmentCount++] = static_cast(GL_COLOR_ATTACHMENT0 + i); } } if (gpuFBO->gpuDepthStencilTexture) { GLES3GPUTexture *gpuDepthStencilTexture = gpuFBO->gpuDepthStencilTexture; - const GLenum glAttachment = GFX_FORMAT_INFOS[(int)gpuDepthStencilTexture->format].hasStencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT; - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, glAttachment, gpuDepthStencilTexture->glTarget, gpuDepthStencilTexture->glTexture, gpuFBO->depthStencilMipmapLevel)); + const GLenum glAttachment = GFX_FORMAT_INFOS[static_cast(gpuDepthStencilTexture->format)].hasStencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT; + GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, glAttachment, gpuDepthStencilTexture->glTarget, gpuDepthStencilTexture->glTexture, gpuFBO->depthStencilMipmapLevel)); } GL_CHECK(glDrawBuffers(attachmentCount, attachments)); GLenum status; - GL_CHECK(status = glCheckFramebufferStatus(GL_FRAMEBUFFER)); + GL_CHECK(status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER)); if (status != GL_FRAMEBUFFER_COMPLETE) { switch (status) { case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: { @@ -1439,12 +1497,12 @@ void GLES3CmdFuncCreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpu } } -void GLES3CmdFuncDestroyFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO) { +void cmdFuncGLES3DestroyFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO) { if (gpuFBO->isOffscreen) { if (gpuFBO->glFramebuffer) { - if (device->stateCache()->glFramebuffer == gpuFBO->glFramebuffer) { - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0)); - device->stateCache()->glFramebuffer = 0; + if (device->stateCache()->glDrawFramebuffer == gpuFBO->glFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)); + device->stateCache()->glDrawFramebuffer = 0; } GL_CHECK(glDeleteFramebuffers(1, &gpuFBO->glFramebuffer)); gpuFBO->glFramebuffer = 0; @@ -1452,22 +1510,20 @@ void GLES3CmdFuncDestroyFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gp } } -void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRenderPass, GLES3GPUFramebuffer *gpuFramebuffer, const Rect &renderArea, size_t numClearColors, const Color *clearColors, float clearDepth, int clearStencil) { +void cmdFuncGLES3BeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRenderPass, GLES3GPUFramebuffer *gpuFramebuffer, const Rect &renderArea, size_t numClearColors, const Color *clearColors, float clearDepth, int clearStencil) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - gfxStateCache.gpuRenderPass = gpuRenderPass; - gfxStateCache.gpuFramebuffer = gpuFramebuffer; - gfxStateCache.numClearColors = numClearColors; + gfxStateCache.gpuRenderPass = gpuRenderPass; + gfxStateCache.gpuFramebuffer = gpuFramebuffer; + gfxStateCache.numClearColors = numClearColors; GLenum *invalidAttachments = gfxStateCache.invalidAttachments; GLES3GPUStateCache *cache = device->stateCache(); if (gpuFramebuffer && gpuRenderPass) { - if (cache->glFramebuffer != gpuFramebuffer->glFramebuffer) { - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, gpuFramebuffer->glFramebuffer)); - cache->glFramebuffer = gpuFramebuffer->glFramebuffer; - // render targets are drawn with flipped-Y - gfxStateCache.reverseCW = gpuFramebuffer->isOffscreen; + if (cache->glDrawFramebuffer != gpuFramebuffer->glFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gpuFramebuffer->glFramebuffer)); + cache->glDrawFramebuffer = gpuFramebuffer->glFramebuffer; } if (cache->viewport.left != renderArea.x || @@ -1475,9 +1531,9 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen cache->viewport.width != renderArea.width || cache->viewport.height != renderArea.height) { GL_CHECK(glViewport(renderArea.x, renderArea.y, renderArea.width, renderArea.height)); - cache->viewport.left = renderArea.x; - cache->viewport.top = renderArea.y; - cache->viewport.width = renderArea.width; + cache->viewport.left = renderArea.x; + cache->viewport.top = renderArea.y; + cache->viewport.width = renderArea.width; cache->viewport.height = renderArea.height; } @@ -1486,14 +1542,18 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen cache->scissor.width != renderArea.width || cache->scissor.height != renderArea.height) { GL_CHECK(glScissor(renderArea.x, renderArea.y, renderArea.width, renderArea.height)); - cache->scissor.x = renderArea.x; - cache->scissor.y = renderArea.y; - cache->scissor.width = renderArea.width; + cache->scissor.x = renderArea.x; + cache->scissor.y = renderArea.y; + cache->scissor.width = renderArea.width; cache->scissor.height = renderArea.height; } - GLbitfield glClears = 0; - uint numAttachments = 0; + GLbitfield glClears = 0; + uint numAttachments = 0; + bool hasBoundFBO = gpuFramebuffer->isOffscreen; +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + hasBoundFBO = true; +#endif for (uint j = 0; j < numClearColors; ++j) { const ColorAttachment &colorAttachment = gpuRenderPass->colorAttachments[j]; @@ -1505,8 +1565,8 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen GL_CHECK(glColorMask(true, true, true, true)); } - if (gpuFramebuffer->isOffscreen) { - static float fColors[4]; + if (hasBoundFBO) { + static float fColors[4]{}; fColors[0] = clearColors[j].x; fColors[1] = clearColors[j].y; fColors[2] = clearColors[j].z; @@ -1521,7 +1581,7 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen } case LoadOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR); break; } default:; @@ -1530,7 +1590,7 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen } // for if (gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN) { - bool hasDepth = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasDepth; + bool hasDepth = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasDepth; if (hasDepth) { switch (gpuRenderPass->depthStencilAttachment.depthLoadOp) { case LoadOp::LOAD: break; // GL default behaviour @@ -1544,13 +1604,13 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen } case LoadOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_DEPTH_ATTACHMENT : GL_DEPTH); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_DEPTH_ATTACHMENT : GL_DEPTH); break; } default:; } } // if (hasDepth) - bool hasStencils = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasStencil; + bool hasStencils = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasStencil; if (hasStencils) { switch (gpuRenderPass->depthStencilAttachment.depthLoadOp) { case LoadOp::LOAD: break; // GL default behaviour @@ -1567,7 +1627,7 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen } case LoadOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_STENCIL_ATTACHMENT : GL_STENCIL); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_STENCIL_ATTACHMENT : GL_STENCIL); break; } default:; @@ -1576,7 +1636,7 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen } if (numAttachments) { - GL_CHECK(glInvalidateFramebuffer(GL_FRAMEBUFFER, numAttachments, invalidAttachments)); + GL_CHECK(glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER, numAttachments, invalidAttachments)); } if (glClears) { @@ -1609,12 +1669,16 @@ void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRen } } -void GLES3CmdFuncEndRenderPass(GLES3Device *device) { - GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - size_t numClearColors = gfxStateCache.numClearColors; - GLES3GPURenderPass *gpuRenderPass = gfxStateCache.gpuRenderPass; - GLES3GPUFramebuffer *gpuFramebuffer = gfxStateCache.gpuFramebuffer; - GLenum *invalidAttachments = gfxStateCache.invalidAttachments; +void cmdFuncGLES3EndRenderPass(GLES3Device *device) { + GLES3ObjectCache & gfxStateCache = device->stateCache()->gfxStateCache; + size_t numClearColors = gfxStateCache.numClearColors; + GLES3GPURenderPass * gpuRenderPass = gfxStateCache.gpuRenderPass; + GLES3GPUFramebuffer *gpuFramebuffer = gfxStateCache.gpuFramebuffer; + GLenum * invalidAttachments = gfxStateCache.invalidAttachments; + bool hasBoundFBO = gpuFramebuffer->isOffscreen; +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + hasBoundFBO = true; +#endif uint numAttachments = 0; for (uint j = 0; j < numClearColors; ++j) { @@ -1624,7 +1688,7 @@ void GLES3CmdFuncEndRenderPass(GLES3Device *device) { case StoreOp::STORE: break; case StoreOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_COLOR_ATTACHMENT0 + j : GL_COLOR); break; } default:; @@ -1633,25 +1697,25 @@ void GLES3CmdFuncEndRenderPass(GLES3Device *device) { } // for if (gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN) { - bool hasDepth = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasDepth; + bool hasDepth = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasDepth; if (hasDepth) { switch (gpuRenderPass->depthStencilAttachment.depthStoreOp) { case StoreOp::STORE: break; case StoreOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_DEPTH_ATTACHMENT : GL_DEPTH); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_DEPTH_ATTACHMENT : GL_DEPTH); break; } default:; } } // if (hasDepth) - bool hasStencils = GFX_FORMAT_INFOS[(int)gpuRenderPass->depthStencilAttachment.format].hasStencil; + bool hasStencils = GFX_FORMAT_INFOS[static_cast(gpuRenderPass->depthStencilAttachment.format)].hasStencil; if (hasStencils) { switch (gpuRenderPass->depthStencilAttachment.stencilStoreOp) { case StoreOp::STORE: break; case StoreOp::DISCARD: { // invalidate fbo - invalidAttachments[numAttachments++] = (gpuFramebuffer->isOffscreen ? GL_STENCIL_ATTACHMENT : GL_STENCIL); + invalidAttachments[numAttachments++] = (hasBoundFBO ? GL_STENCIL_ATTACHMENT : GL_STENCIL); break; } default:; @@ -1660,28 +1724,28 @@ void GLES3CmdFuncEndRenderPass(GLES3Device *device) { } if (numAttachments) { - GL_CHECK(glInvalidateFramebuffer(GL_FRAMEBUFFER, numAttachments, invalidAttachments)); + GL_CHECK(glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER, numAttachments, invalidAttachments)); } } -void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipelineState, GLES3GPUInputAssembler *gpuInputAssembler, - vector &gpuDescriptorSets, vector &dynamicOffsets, Viewport &viewport, Rect &scissor, - float lineWidth, bool depthBiasEnabled, GLES3DepthBias &depthBias, Color &blendConstants, GLES3DepthBounds &depthBounds, - GLES3StencilWriteMask &stencilWriteMask, GLES3StencilCompareMask &stencilCompareMask) { +void cmdFuncGLES3BindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipelineState, GLES3GPUInputAssembler *gpuInputAssembler, + const vector &gpuDescriptorSets, const vector &dynamicOffsets, + const Viewport &viewport, const Rect &scissor, float lineWidth, bool depthBiasEnabled, const GLES3DepthBias &depthBias, const Color & /*blendConstants*/, + const GLES3DepthBounds & /*depthBounds*/, const GLES3StencilWriteMask &stencilWriteMask, const GLES3StencilCompareMask &stencilCompareMask) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLES3GPUStateCache *cache = device->stateCache(); - bool isShaderChanged = false; + GLES3GPUStateCache *cache = device->stateCache(); + bool isShaderChanged = false; if (gpuPipelineState && gpuPipelineState != gfxStateCache.gpuPipelineState) { gfxStateCache.gpuPipelineState = gpuPipelineState; - gfxStateCache.glPrimitive = gpuPipelineState->glPrimitive; + gfxStateCache.glPrimitive = gpuPipelineState->glPrimitive; if (gpuPipelineState->gpuShader) { if (cache->glProgram != gpuPipelineState->gpuShader->glProgram) { GL_CHECK(glUseProgram(gpuPipelineState->gpuShader->glProgram)); cache->glProgram = gpuPipelineState->gpuShader->glProgram; - isShaderChanged = true; + isShaderChanged = true; } } @@ -1713,10 +1777,9 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli } cache->rs.cullMode = gpuPipelineState->rs.cullMode; } - bool isFrontFaceCCW = gpuPipelineState->rs.isFrontFaceCCW != gfxStateCache.reverseCW; - if (cache->rs.isFrontFaceCCW != isFrontFaceCCW) { - GL_CHECK(glFrontFace(isFrontFaceCCW ? GL_CCW : GL_CW)); - cache->rs.isFrontFaceCCW = isFrontFaceCCW; + if (cache->rs.isFrontFaceCCW != gpuPipelineState->rs.isFrontFaceCCW) { + GL_CHECK(glFrontFace(gpuPipelineState->rs.isFrontFaceCCW ? GL_CCW : GL_CW)); + cache->rs.isFrontFaceCCW = gpuPipelineState->rs.isFrontFaceCCW; } if ((cache->rs.depthBias != gpuPipelineState->rs.depthBias) || (cache->rs.depthBiasSlop != gpuPipelineState->rs.depthBiasSlop)) { @@ -1765,8 +1828,8 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GLES3_CMP_FUNCS[(int)gpuPipelineState->dss.stencilFuncFront], gpuPipelineState->dss.stencilRefFront, gpuPipelineState->dss.stencilReadMaskFront)); - cache->dss.stencilFuncFront = gpuPipelineState->dss.stencilFuncFront; - cache->dss.stencilRefFront = gpuPipelineState->dss.stencilRefFront; + cache->dss.stencilFuncFront = gpuPipelineState->dss.stencilFuncFront; + cache->dss.stencilRefFront = gpuPipelineState->dss.stencilRefFront; cache->dss.stencilReadMaskFront = gpuPipelineState->dss.stencilReadMaskFront; } if (cache->dss.stencilFailOpFront != gpuPipelineState->dss.stencilFailOpFront || @@ -1776,9 +1839,9 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GLES3_STENCIL_OPS[(int)gpuPipelineState->dss.stencilFailOpFront], GLES3_STENCIL_OPS[(int)gpuPipelineState->dss.stencilZFailOpFront], GLES3_STENCIL_OPS[(int)gpuPipelineState->dss.stencilPassOpFront])); - cache->dss.stencilFailOpFront = gpuPipelineState->dss.stencilFailOpFront; + cache->dss.stencilFailOpFront = gpuPipelineState->dss.stencilFailOpFront; cache->dss.stencilZFailOpFront = gpuPipelineState->dss.stencilZFailOpFront; - cache->dss.stencilPassOpFront = gpuPipelineState->dss.stencilPassOpFront; + cache->dss.stencilPassOpFront = gpuPipelineState->dss.stencilPassOpFront; } if (cache->dss.stencilWriteMaskFront != gpuPipelineState->dss.stencilWriteMaskFront) { GL_CHECK(glStencilMaskSeparate(GL_FRONT, gpuPipelineState->dss.stencilWriteMaskFront)); @@ -1793,8 +1856,8 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GLES3_CMP_FUNCS[(int)gpuPipelineState->dss.stencilFuncBack], gpuPipelineState->dss.stencilRefBack, gpuPipelineState->dss.stencilReadMaskBack)); - cache->dss.stencilFuncBack = gpuPipelineState->dss.stencilFuncBack; - cache->dss.stencilRefBack = gpuPipelineState->dss.stencilRefBack; + cache->dss.stencilFuncBack = gpuPipelineState->dss.stencilFuncBack; + cache->dss.stencilRefBack = gpuPipelineState->dss.stencilRefBack; cache->dss.stencilReadMaskBack = gpuPipelineState->dss.stencilReadMaskBack; } if (cache->dss.stencilFailOpBack != gpuPipelineState->dss.stencilFailOpBack || @@ -1804,9 +1867,9 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GLES3_STENCIL_OPS[(int)gpuPipelineState->dss.stencilFailOpBack], GLES3_STENCIL_OPS[(int)gpuPipelineState->dss.stencilZFailOpBack], GLES3_STENCIL_OPS[(int)gpuPipelineState->dss.stencilPassOpBack])); - cache->dss.stencilFailOpBack = gpuPipelineState->dss.stencilFailOpBack; + cache->dss.stencilFailOpBack = gpuPipelineState->dss.stencilFailOpBack; cache->dss.stencilZFailOpBack = gpuPipelineState->dss.stencilZFailOpBack; - cache->dss.stencilPassOpBack = gpuPipelineState->dss.stencilPassOpBack; + cache->dss.stencilPassOpBack = gpuPipelineState->dss.stencilPassOpBack; } if (cache->dss.stencilWriteMaskBack != gpuPipelineState->dss.stencilWriteMaskBack) { GL_CHECK(glStencilMaskSeparate(GL_BACK, gpuPipelineState->dss.stencilWriteMaskBack)); @@ -1826,7 +1889,6 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli cache->bs.blendColor.y != gpuPipelineState->bs.blendColor.y || cache->bs.blendColor.z != gpuPipelineState->bs.blendColor.z || cache->bs.blendColor.w != gpuPipelineState->bs.blendColor.w) { - GL_CHECK(glBlendColor(gpuPipelineState->bs.blendColor.x, gpuPipelineState->bs.blendColor.y, gpuPipelineState->bs.blendColor.z, @@ -1834,8 +1896,8 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli cache->bs.blendColor = gpuPipelineState->bs.blendColor; } - BlendTarget &cacheTarget = cache->bs.targets[0]; - const BlendTarget &target = gpuPipelineState->bs.targets[0]; + BlendTarget & cacheTarget = cache->bs.targets[0]; + const BlendTarget &target = gpuPipelineState->bs.targets[0]; if (cacheTarget.blend != target.blend) { if (!cacheTarget.blend) { GL_CHECK(glEnable(GL_BLEND)); @@ -1848,7 +1910,7 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli cacheTarget.blendAlphaEq != target.blendAlphaEq) { GL_CHECK(glBlendEquationSeparate(GLES3_BLEND_OPS[(int)target.blendEq], GLES3_BLEND_OPS[(int)target.blendAlphaEq])); - cacheTarget.blendEq = target.blendEq; + cacheTarget.blendEq = target.blendEq; cacheTarget.blendAlphaEq = target.blendAlphaEq; } if (cacheTarget.blendSrc != target.blendSrc || @@ -1859,8 +1921,8 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GLES3_BLEND_FACTORS[(int)target.blendDst], GLES3_BLEND_FACTORS[(int)target.blendSrcAlpha], GLES3_BLEND_FACTORS[(int)target.blendDstAlpha])); - cacheTarget.blendSrc = target.blendSrc; - cacheTarget.blendDst = target.blendDst; + cacheTarget.blendSrc = target.blendSrc; + cacheTarget.blendDst = target.blendDst; cacheTarget.blendSrcAlpha = target.blendSrcAlpha; cacheTarget.blendDstAlpha = target.blendDstAlpha; } @@ -1875,63 +1937,77 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli // bind descriptor sets if (gpuPipelineState && gpuPipelineState->gpuShader && gpuPipelineState->gpuPipelineLayout) { - - size_t blockLen = gpuPipelineState->gpuShader->glBlocks.size(); const vector> &dynamicOffsetIndices = gpuPipelineState->gpuPipelineLayout->dynamicOffsetIndices; - for (size_t j = 0; j < blockLen; j++) { - const GLES3GPUUniformBlock &glBlock = gpuPipelineState->gpuShader->glBlocks[j]; + size_t bufferLen = gpuPipelineState->gpuShader->glBuffers.size(); + for (size_t j = 0; j < bufferLen; j++) { + const GLES3GPUUniformBuffer &glBuffer = gpuPipelineState->gpuShader->glBuffers[j]; - CCASSERT(gpuDescriptorSets.size() > glBlock.set, "Invalid set index"); - const GLES3GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glBlock.set]; - const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glBlock.binding); - const GLES3GPUDescriptor &gpuDescriptor = gpuDescriptorSet->gpuDescriptors[descriptorIndex]; + CCASSERT(gpuDescriptorSets.size() > glBuffer.set, "Invalid set index"); + const GLES3GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glBuffer.set]; + const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glBuffer.binding); + const GLES3GPUDescriptor & gpuDescriptor = gpuDescriptorSet->gpuDescriptors[descriptorIndex]; if (!gpuDescriptor.gpuBuffer) { CC_LOG_ERROR("Buffer binding '%s' at set %d binding %d is not bounded", - glBlock.name.c_str(), glBlock.set, glBlock.binding); + glBuffer.name.c_str(), glBuffer.set, glBuffer.binding); continue; } uint offset = gpuDescriptor.gpuBuffer->glOffset; - const vector &dynamicOffsetSetIndices = dynamicOffsetIndices[glBlock.set]; - int dynamicOffsetIndex = glBlock.binding < dynamicOffsetSetIndices.size() ? dynamicOffsetSetIndices[glBlock.binding] : -1; + const vector &dynamicOffsetSetIndices = dynamicOffsetIndices[glBuffer.set]; + int dynamicOffsetIndex = glBuffer.binding < dynamicOffsetSetIndices.size() ? dynamicOffsetSetIndices[glBuffer.binding] : -1; if (dynamicOffsetIndex >= 0) offset += dynamicOffsets[dynamicOffsetIndex]; - if (cache->glBindUBOs[glBlock.glBinding] != gpuDescriptor.gpuBuffer->glBuffer || - cache->glBindUBOOffsets[glBlock.glBinding] != offset) { - if (offset) { - GL_CHECK(glBindBufferRange(GL_UNIFORM_BUFFER, glBlock.glBinding, gpuDescriptor.gpuBuffer->glBuffer, - offset, gpuDescriptor.gpuBuffer->size)); - } else { - GL_CHECK(glBindBufferBase(GL_UNIFORM_BUFFER, glBlock.glBinding, gpuDescriptor.gpuBuffer->glBuffer)); + if (glBuffer.isStorage) { + if (cache->glBindSSBOs[glBuffer.glBinding] != gpuDescriptor.gpuBuffer->glBuffer || + cache->glBindSSBOOffsets[glBuffer.glBinding] != offset) { + if (offset) { + GL_CHECK(glBindBufferRange(GL_SHADER_STORAGE_BUFFER, glBuffer.glBinding, gpuDescriptor.gpuBuffer->glBuffer, + offset, gpuDescriptor.gpuBuffer->size)); + } else { + GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, glBuffer.glBinding, gpuDescriptor.gpuBuffer->glBuffer)); + } + cache->glShaderStorageBuffer = cache->glBindSSBOs[glBuffer.glBinding] = gpuDescriptor.gpuBuffer->glBuffer; + cache->glBindSSBOOffsets[glBuffer.glBinding] = offset; + } + } else { + if (cache->glBindUBOs[glBuffer.glBinding] != gpuDescriptor.gpuBuffer->glBuffer || + cache->glBindUBOOffsets[glBuffer.glBinding] != offset) { + if (offset) { + GL_CHECK(glBindBufferRange(GL_UNIFORM_BUFFER, glBuffer.glBinding, gpuDescriptor.gpuBuffer->glBuffer, + offset, gpuDescriptor.gpuBuffer->size)); + } else { + GL_CHECK(glBindBufferBase(GL_UNIFORM_BUFFER, glBuffer.glBinding, gpuDescriptor.gpuBuffer->glBuffer)); + } + cache->glUniformBuffer = cache->glBindUBOs[glBuffer.glBinding] = gpuDescriptor.gpuBuffer->glBuffer; + cache->glBindUBOOffsets[glBuffer.glBinding] = offset; } - cache->glUniformBuffer = cache->glBindUBOs[glBlock.glBinding] = gpuDescriptor.gpuBuffer->glBuffer; - cache->glBindUBOOffsets[glBlock.glBinding] = offset; } } - size_t samplerLen = gpuPipelineState->gpuShader->glSamplers.size(); - for (size_t j = 0; j < samplerLen; j++) { - const GLES3GPUUniformSampler &glSampler = gpuPipelineState->gpuShader->glSamplers[j]; + size_t samplerTextureLen = gpuPipelineState->gpuShader->glSamplerTextures.size(); + for (size_t j = 0; j < samplerTextureLen; j++) { + const GLES3GPUUniformSamplerTexture &glSamplerTexture = gpuPipelineState->gpuShader->glSamplerTextures[j]; - CCASSERT(gpuDescriptorSets.size() > glSampler.set, "Invalid set index"); - const GLES3GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glSampler.set]; - const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glSampler.binding); - const GLES3GPUDescriptor *gpuDescriptor = &gpuDescriptorSet->gpuDescriptors[descriptorIndex]; + CCASSERT(gpuDescriptorSets.size() > glSamplerTexture.set, "Invalid set index"); + const GLES3GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glSamplerTexture.set]; + const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glSamplerTexture.binding); + const GLES3GPUDescriptor * gpuDescriptor = &gpuDescriptorSet->gpuDescriptors[descriptorIndex]; - for (size_t u = 0; u < glSampler.units.size(); u++, gpuDescriptor++) { - uint unit = (uint)glSampler.units[u]; + for (size_t u = 0; u < glSamplerTexture.units.size(); u++, gpuDescriptor++) { + uint unit = static_cast(glSamplerTexture.units[u]); if (!gpuDescriptor->gpuTexture || !gpuDescriptor->gpuSampler) { - CC_LOG_ERROR("Sampler binding '%s' at set %d binding %d index %d is not bounded", - glSampler.name.c_str(), glSampler.set, glSampler.binding, u); + CC_LOG_ERROR("Sampler texture '%s' at binding %d set %d index %d is not bounded", + glSamplerTexture.name.c_str(), glSamplerTexture.set, glSamplerTexture.binding, u); continue; } if (gpuDescriptor->gpuTexture->size > 0) { GLuint glTexture = gpuDescriptor->gpuTexture->glTexture; + if (cache->glTextures[unit] != glTexture) { if (cache->texUint != unit) { GL_CHECK(glActiveTexture(GL_TEXTURE0 + unit)); @@ -1948,6 +2024,34 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli } } } + + size_t imageLen = gpuPipelineState->gpuShader->glImages.size(); + for (size_t j = 0; j < imageLen; j++) { + const GLES3GPUUniformStorageImage &glImage = gpuPipelineState->gpuShader->glImages[j]; + + CCASSERT(gpuDescriptorSets.size() > glImage.set, "Invalid set index"); + const GLES3GPUDescriptorSet *gpuDescriptorSet = gpuDescriptorSets[glImage.set]; + const uint descriptorIndex = gpuDescriptorSet->descriptorIndices->at(glImage.binding); + const GLES3GPUDescriptor * gpuDescriptor = &gpuDescriptorSet->gpuDescriptors[descriptorIndex]; + + for (size_t u = 0; u < glImage.units.size(); u++, gpuDescriptor++) { + uint unit = static_cast(glImage.units[u]); + + if (!gpuDescriptor->gpuTexture) { + CC_LOG_ERROR("Storage image '%s' at binding %d set %d index %d is not bounded", + glImage.name.c_str(), glImage.set, glImage.binding, u); + continue; + } + + if (gpuDescriptor->gpuTexture->size > 0) { + GLuint glTexture = gpuDescriptor->gpuTexture->glTexture; + + if (cache->glImages[unit] != glTexture) { + GL_CHECK(glBindImageTexture(unit, glTexture, 0, GL_TRUE, 0, glImage.glMemoryAccess, gpuDescriptor->gpuTexture->glInternelFmt)); + } + } + } + } } // if // bind vao @@ -1955,7 +2059,7 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli (isShaderChanged || gpuInputAssembler != gfxStateCache.gpuInputAssembler)) { gfxStateCache.gpuInputAssembler = gpuInputAssembler; if (USE_VAO) { - GLuint hash = gpuPipelineState->gpuShader->glProgram ^ device->getThreadID(); + GLuint hash = gpuPipelineState->gpuShader->glProgram ^ device->getThreadID(); GLuint glVAO = gpuInputAssembler->glVAOs[hash]; if (!glVAO) { GL_CHECK(glGenVertexArrays(1, &glVAO)); @@ -1964,16 +2068,15 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); - for (size_t j = 0; j < gpuPipelineState->gpuShader->glInputs.size(); ++j) { - const GLES3GPUInput &gpuInput = gpuPipelineState->gpuShader->glInputs[j]; + for (auto &gpuInput : gpuPipelineState->gpuShader->glInputs) { for (size_t a = 0; a < gpuInputAssembler->attributes.size(); ++a) { const GLES3GPUAttribute &gpuAttribute = gpuInputAssembler->glAttribs[a]; if (gpuAttribute.name == gpuInput.name) { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, gpuAttribute.glBuffer)); for (uint c = 0; c < gpuAttribute.componentCount; ++c) { - GLint glLoc = gpuInput.glLoc + c; - uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; + GLint glLoc = gpuInput.glLoc + c; + uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; GL_CHECK(glEnableVertexAttribArray(glLoc)); cache->glEnabledAttribLocs[glLoc] = true; @@ -1992,8 +2095,8 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GL_CHECK(glBindVertexArray(0)); GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0)); GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); - cache->glVAO = 0; - cache->glArrayBuffer = 0; + cache->glVAO = 0; + cache->glArrayBuffer = 0; cache->glElementArrayBuffer = 0; } @@ -2002,12 +2105,11 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli cache->glVAO = glVAO; } } else { - for (uint a = 0; a < cache->glCurrentAttribLocs.size(); ++a) { - cache->glCurrentAttribLocs[a] = false; + for (auto &&glCurrentAttribLoc : cache->glCurrentAttribLocs) { + glCurrentAttribLoc = false; } - for (size_t j = 0; j < gpuPipelineState->gpuShader->glInputs.size(); ++j) { - const GLES3GPUInput &gpuInput = gpuPipelineState->gpuShader->glInputs[j]; + for (auto &gpuInput : gpuPipelineState->gpuShader->glInputs) { for (size_t a = 0; a < gpuInputAssembler->attributes.size(); ++a) { const GLES3GPUAttribute &gpuAttribute = gpuInputAssembler->glAttribs[a]; if (gpuAttribute.name == gpuInput.name) { @@ -2017,8 +2119,8 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli } for (uint c = 0; c < gpuAttribute.componentCount; ++c) { - GLint glLoc = gpuInput.glLoc + c; - uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; + GLint glLoc = gpuInput.glLoc + c; + uint attribOffset = gpuAttribute.offset + gpuAttribute.size * c; GL_CHECK(glEnableVertexAttribArray(glLoc)); cache->glCurrentAttribLocs[glLoc] = true; cache->glEnabledAttribLocs[glLoc] = true; @@ -2068,18 +2170,19 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli } break; case DynamicStateFlagBit::DEPTH_BIAS: - if (cache->rs.depthBiasEnabled != depthBiasEnabled) { - if (depthBiasEnabled) + if (static_cast(cache->rs.depthBiasEnabled) != depthBiasEnabled) { + if (depthBiasEnabled) { GL_CHECK(glEnable(GL_POLYGON_OFFSET_FILL)); - else + } else { GL_CHECK(glDisable(GL_POLYGON_OFFSET_FILL)); + } cache->rs.depthBiasEnabled = depthBiasEnabled; } if ((cache->rs.depthBias != depthBias.constant) || (cache->rs.depthBiasSlop != depthBias.slope)) { GL_CHECK(glPolygonOffset(depthBias.constant, depthBias.slope)); - cache->rs.depthBias = depthBias.constant; + cache->rs.depthBias = depthBias.constant; cache->rs.depthBiasSlop = depthBias.slope; } break; @@ -2114,7 +2217,7 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli (cache->dss.stencilWriteMaskBack != stencilWriteMask.writeMask)) { GL_CHECK(glStencilMask(stencilWriteMask.writeMask)); cache->dss.stencilWriteMaskFront = stencilWriteMask.writeMask; - cache->dss.stencilWriteMaskBack = stencilWriteMask.writeMask; + cache->dss.stencilWriteMaskBack = stencilWriteMask.writeMask; } break; } @@ -2122,31 +2225,31 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli case DynamicStateFlagBit::STENCIL_COMPARE_MASK: switch (stencilCompareMask.face) { case StencilFace::FRONT: - if ((cache->dss.stencilRefFront != (uint)stencilCompareMask.refrence) || + if ((cache->dss.stencilRefFront != static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskFront != stencilCompareMask.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_FRONT, GLES3_CMP_FUNCS[(int)cache->dss.stencilFuncFront], stencilCompareMask.refrence, stencilCompareMask.compareMask)); - cache->dss.stencilRefFront = stencilCompareMask.refrence; + cache->dss.stencilRefFront = stencilCompareMask.refrence; cache->dss.stencilReadMaskFront = stencilCompareMask.compareMask; } break; case StencilFace::BACK: - if ((cache->dss.stencilRefBack != (uint)stencilCompareMask.refrence) || + if ((cache->dss.stencilRefBack != static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskBack != stencilCompareMask.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_BACK, GLES3_CMP_FUNCS[(int)cache->dss.stencilFuncBack], stencilCompareMask.refrence, stencilCompareMask.compareMask)); - cache->dss.stencilRefBack = stencilCompareMask.refrence; + cache->dss.stencilRefBack = stencilCompareMask.refrence; cache->dss.stencilReadMaskBack = stencilCompareMask.compareMask; } break; case StencilFace::ALL: - if ((cache->dss.stencilRefFront != (uint)stencilCompareMask.refrence) || + if ((cache->dss.stencilRefFront != static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskFront != stencilCompareMask.compareMask) || - (cache->dss.stencilRefBack != (uint)stencilCompareMask.refrence) || + (cache->dss.stencilRefBack != static_cast(stencilCompareMask.refrence)) || (cache->dss.stencilReadMaskBack != stencilCompareMask.compareMask)) { GL_CHECK(glStencilFuncSeparate(GL_FRONT, GLES3_CMP_FUNCS[(int)cache->dss.stencilFuncFront], @@ -2156,10 +2259,10 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli GLES3_CMP_FUNCS[(int)cache->dss.stencilFuncBack], stencilCompareMask.refrence, stencilCompareMask.compareMask)); - cache->dss.stencilRefFront = stencilCompareMask.refrence; + cache->dss.stencilRefFront = stencilCompareMask.refrence; cache->dss.stencilReadMaskFront = stencilCompareMask.compareMask; - cache->dss.stencilRefBack = stencilCompareMask.refrence; - cache->dss.stencilReadMaskBack = stencilCompareMask.compareMask; + cache->dss.stencilRefBack = stencilCompareMask.refrence; + cache->dss.stencilReadMaskBack = stencilCompareMask.compareMask; } break; } @@ -2172,17 +2275,17 @@ void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipeli } } -void GLES3CmdFuncDraw(GLES3Device *device, DrawInfo &drawInfo) { - GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - GLES3GPUPipelineState *gpuPipelineState = gfxStateCache.gpuPipelineState; +void cmdFuncGLES3Draw(GLES3Device *device, const DrawInfo &drawInfo) { + GLES3ObjectCache & gfxStateCache = device->stateCache()->gfxStateCache; + GLES3GPUPipelineState * gpuPipelineState = gfxStateCache.gpuPipelineState; GLES3GPUInputAssembler *gpuInputAssembler = gfxStateCache.gpuInputAssembler; - GLenum glPrimitive = gfxStateCache.glPrimitive; + GLenum glPrimitive = gfxStateCache.glPrimitive; if (gpuInputAssembler && gpuPipelineState) { if (!gpuInputAssembler->gpuIndirectBuffer) { if (gpuInputAssembler->gpuIndexBuffer) { if (drawInfo.indexCount > 0) { - uint8_t *offset = 0; + uint8_t *offset = nullptr; offset += drawInfo.firstIndex * gpuInputAssembler->gpuIndexBuffer->stride; if (drawInfo.instanceCount == 0) { GL_CHECK(glDrawElements(glPrimitive, drawInfo.indexCount, gpuInputAssembler->glIndexType, offset)); @@ -2202,7 +2305,7 @@ void GLES3CmdFuncDraw(GLES3Device *device, DrawInfo &drawInfo) { const DrawInfo &draw = gpuInputAssembler->gpuIndirectBuffer->indirects[j]; if (gpuInputAssembler->gpuIndexBuffer) { if (draw.indexCount > 0) { - uint8_t *offset = 0; + uint8_t *offset = nullptr; offset += draw.firstIndex * gpuInputAssembler->gpuIndexBuffer->stride; if (draw.instanceCount == 0) { GL_CHECK(glDrawElements(glPrimitive, draw.indexCount, gpuInputAssembler->glIndexType, offset)); @@ -2222,18 +2325,36 @@ void GLES3CmdFuncDraw(GLES3Device *device, DrawInfo &drawInfo) { } } -void GLES3CmdFuncUpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size) { +void cmdFuncGLES3Dispatch(GLES3Device *device, const GLES3GPUDispatchInfo &info) { + GLES3GPUStateCache *cache = device->stateCache(); + if (info.indirectBuffer) { + if (cache->glDispatchIndirectBuffer != info.indirectBuffer->glBuffer) { + GL_CHECK(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, info.indirectBuffer->glBuffer)); + cache->glDispatchIndirectBuffer = info.indirectBuffer->glBuffer; + } + GL_CHECK(glDispatchComputeIndirect(info.indirectOffset)); + } else { + GL_CHECK(glDispatchCompute(info.groupCountX, info.groupCountY, info.groupCountZ)); + } +} + +void cmdFuncGLES3MemoryBarrier(GLES3Device * /*device*/, GLbitfield barriers, GLbitfield barriersByRegion) { + if (barriers) glMemoryBarrier(barriers); + if (barriersByRegion) glMemoryBarrierByRegion(barriersByRegion); +} + +void cmdFuncGLES3UpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size) { GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache; - if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { - memcpy((uint8_t *)gpuBuffer->indirects.data() + offset, buffer, size); - } else if (gpuBuffer->usage & BufferUsageBit::TRANSFER_SRC) { - memcpy((uint8_t *)gpuBuffer->buffer + offset, buffer, size); + if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { + memcpy(reinterpret_cast(gpuBuffer->indirects.data()) + offset, buffer, size); + } else if (hasFlag(gpuBuffer->usage, BufferUsageBit::TRANSFER_SRC)) { + memcpy(gpuBuffer->buffer + offset, buffer, size); } else { switch (gpuBuffer->glTarget) { case GL_ARRAY_BUFFER: { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } if (device->stateCache()->glArrayBuffer != gpuBuffer->glBuffer) { @@ -2246,7 +2367,7 @@ void GLES3CmdFuncUpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, co case GL_ELEMENT_ARRAY_BUFFER: { if (device->stateCache()->glVAO) { GL_CHECK(glBindVertexArray(0)); - device->stateCache()->glVAO = 0; + device->stateCache()->glVAO = 0; gfxStateCache.gpuInputAssembler = nullptr; } if (device->stateCache()->glElementArrayBuffer != gpuBuffer->glBuffer) { @@ -2264,6 +2385,14 @@ void GLES3CmdFuncUpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, co GL_CHECK(glBufferSubData(GL_UNIFORM_BUFFER, offset, size, buffer)); break; } + case GL_SHADER_STORAGE_BUFFER: { + if (device->stateCache()->glShaderStorageBuffer != gpuBuffer->glBuffer) { + GL_CHECK(glBindBuffer(GL_SHADER_STORAGE_BUFFER, gpuBuffer->glBuffer)); + device->stateCache()->glShaderStorageBuffer = gpuBuffer->glBuffer; + } + GL_CHECK(glBufferSubData(GL_SHADER_STORAGE_BUFFER, offset, size, buffer)); + break; + } default: CCASSERT(false, "Unsupported BufferType, update buffer failed."); break; @@ -2271,15 +2400,15 @@ void GLES3CmdFuncUpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, co } } -void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const *buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count) { +void cmdFuncGLES3CopyBuffersToTexture(GLES3Device *device, const uint8_t *const *buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count) { GLuint &glTexture = device->stateCache()->glTextures[device->stateCache()->texUint]; if (glTexture != gpuTexture->glTexture) { GL_CHECK(glBindTexture(gpuTexture->glTarget, gpuTexture->glTexture)); glTexture = gpuTexture->glTexture; } - bool isCompressed = GFX_FORMAT_INFOS[(int)gpuTexture->format].isCompressed; - uint n = 0; + bool isCompressed = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].isCompressed; + uint n = 0; switch (gpuTexture->glTarget) { case GL_TEXTURE_2D: { @@ -2287,11 +2416,11 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const uint h; for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; - w = region.texExtent.width; - h = region.texExtent.height; - const uint8_t *buff = buffers[n++]; + w = region.texExtent.width; + h = region.texExtent.height; + const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage2D(GL_TEXTURE_2D, region.texSubres.mipLevel, region.texOffset.x, @@ -2317,16 +2446,16 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const uint w; uint h; for (size_t i = 0; i < count; ++i) { - const BufferTextureCopy ®ion = regions[i]; - uint d = region.texSubres.layerCount; - uint layerCount = d + region.texSubres.baseArrayLayer; + const BufferTextureCopy ®ion = regions[i]; + uint d = region.texSubres.layerCount; + uint layerCount = d + region.texSubres.baseArrayLayer; for (uint z = region.texSubres.baseArrayLayer; z < layerCount; ++z) { - w = region.texExtent.width; - h = region.texExtent.height; + w = region.texExtent.width; + h = region.texExtent.height; const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, region.texSubres.mipLevel, region.texOffset.x, @@ -2357,12 +2486,12 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const uint d; for (size_t i = 0; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; - w = region.texExtent.width; - h = region.texExtent.height; - d = region.texExtent.depth; - const uint8_t *buff = buffers[n++]; + w = region.texExtent.width; + h = region.texExtent.height; + d = region.texExtent.depth; + const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage3D(GL_TEXTURE_3D, region.texSubres.mipLevel, region.texOffset.x, @@ -2391,14 +2520,14 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const uint h; uint f; for (size_t i = 0; i < count; ++i) { - const BufferTextureCopy ®ion = regions[i]; - uint faceCount = region.texSubres.baseArrayLayer + region.texSubres.layerCount; + const BufferTextureCopy ®ion = regions[i]; + uint faceCount = region.texSubres.baseArrayLayer + region.texSubres.layerCount; for (f = region.texSubres.baseArrayLayer; f < faceCount; ++f) { - w = region.texExtent.width; - h = region.texExtent.height; + w = region.texExtent.width; + h = region.texExtent.height; const uint8_t *buff = buffers[n++]; if (isCompressed) { - GLsizei memSize = (GLsizei)FormatSize(gpuTexture->format, w, h, 1); + auto memSize = static_cast(formatSize(gpuTexture->format, w, h, 1)); GL_CHECK(glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, region.texOffset.x, @@ -2427,50 +2556,109 @@ void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const break; } - if (!isCompressed && gpuTexture->flags & TextureFlagBit::GEN_MIPMAP) { + if (!isCompressed && hasFlag(gpuTexture->flags, TextureFlagBit::GEN_MIPMAP)) { GL_CHECK(glBindTexture(gpuTexture->glTarget, gpuTexture->glTexture)); GL_CHECK(glGenerateMipmap(gpuTexture->glTarget)); } } -void GLES3CmdFuncExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmdPackage) { +void cmdFuncGLES3BlitTexture(GLES3Device *device, GLES3GPUTexture *gpuTextureSrc, GLES3GPUTexture *gpuTextureDst, const TextureBlit *regions, uint count, Filter filter) { + GLES3GPUStateCache *cache = device->stateCache(); + + GLbitfield mask = 0U; + const FormatInfo &info = GFX_FORMAT_INFOS[static_cast(gpuTextureSrc->format)]; + if (info.hasDepth || info.hasStencil) { + if (info.hasDepth) mask |= GL_DEPTH_BUFFER_BIT; + if (info.hasStencil) mask |= GL_STENCIL_BUFFER_BIT; + } else { + mask = GL_COLOR_BUFFER_BIT; + } + + for (uint i = 0U; i < count; ++i) { + const TextureBlit ®ion = regions[i]; + + GLuint srcFramebuffer = 0U; + if (gpuTextureSrc) srcFramebuffer = device->framebufferCacheMap()->getFramebufferFromTexture(gpuTextureSrc, region.srcSubres); +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + else + srcFramebuffer = static_cast(device->getContext())->getDefaultFramebuffer(); +#endif + if (cache->glReadFramebuffer != srcFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, srcFramebuffer)); + cache->glReadFramebuffer = srcFramebuffer; + } + + GLuint dstFramebuffer = 0U; + if (gpuTextureDst) dstFramebuffer = device->framebufferCacheMap()->getFramebufferFromTexture(gpuTextureDst, region.srcSubres); +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + else + srcFramebuffer = static_cast(device->getContext())->getDefaultFramebuffer(); +#endif + if (cache->glDrawFramebuffer != dstFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFramebuffer)); + cache->glDrawFramebuffer = dstFramebuffer; + } + + GL_CHECK(glBlitFramebuffer( + region.srcOffset.x, region.srcOffset.y, region.srcOffset.x + region.srcExtent.width, region.srcOffset.y + region.srcExtent.height, + region.dstOffset.x, region.dstOffset.y, region.dstOffset.x + region.dstExtent.width, region.dstOffset.y + region.dstExtent.height, + mask, GLES3_FILTERS[(uint)filter])); + } +} + +void cmdFuncGLES3ExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmdPackage) { if (!cmdPackage->cmds.size()) return; - static uint cmdIndices[(int)GFXCmdType::COUNT] = {0}; + static uint cmdIndices[static_cast(GLESCmdType::COUNT)] = {0}; memset(cmdIndices, 0, sizeof(cmdIndices)); for (uint i = 0; i < cmdPackage->cmds.size(); ++i) { - GFXCmdType cmdType = cmdPackage->cmds[i]; - uint &cmdIdx = cmdIndices[(int)cmdType]; + GLESCmdType cmdType = cmdPackage->cmds[i]; + uint & cmdIdx = cmdIndices[static_cast(cmdType)]; switch (cmdType) { - case GFXCmdType::BEGIN_RENDER_PASS: { + case GLESCmdType::BEGIN_RENDER_PASS: { GLES3CmdBeginRenderPass *cmd = cmdPackage->beginRenderPassCmds[cmdIdx]; - GLES3CmdFuncBeginRenderPass(device, cmd->gpuRenderPass, cmd->gpuFBO, cmd->renderArea, cmd->numClearColors, cmd->clearColors, cmd->clearDepth, cmd->clearStencil); + cmdFuncGLES3BeginRenderPass(device, cmd->gpuRenderPass, cmd->gpuFBO, cmd->renderArea, cmd->numClearColors, cmd->clearColors, cmd->clearDepth, cmd->clearStencil); break; } - case GFXCmdType::END_RENDER_PASS: { - GLES3CmdFuncEndRenderPass(device); + case GLESCmdType::END_RENDER_PASS: { + cmdFuncGLES3EndRenderPass(device); break; } - case GFXCmdType::BIND_STATES: { + case GLESCmdType::BIND_STATES: { GLES3CmdBindStates *cmd = cmdPackage->bindStatesCmds[cmdIdx]; - GLES3CmdFuncBindState(device, cmd->gpuPipelineState, cmd->gpuInputAssembler, cmd->gpuDescriptorSets, cmd->dynamicOffsets, cmd->viewport, cmd->scissor, cmd->lineWidth, cmd->depthBiasEnabled, cmd->depthBias, cmd->blendConstants, cmd->depthBounds, cmd->stencilWriteMask, cmd->stencilCompareMask); + cmdFuncGLES3BindState(device, cmd->gpuPipelineState, cmd->gpuInputAssembler, cmd->gpuDescriptorSets, cmd->dynamicOffsets, cmd->viewport, cmd->scissor, cmd->lineWidth, cmd->depthBiasEnabled, cmd->depthBias, cmd->blendConstants, cmd->depthBounds, cmd->stencilWriteMask, cmd->stencilCompareMask); break; - } // case BIND_STATES - case GFXCmdType::DRAW: { + } + case GLESCmdType::DRAW: { GLES3CmdDraw *cmd = cmdPackage->drawCmds[cmdIdx]; - GLES3CmdFuncDraw(device, cmd->drawInfo); + cmdFuncGLES3Draw(device, cmd->drawInfo); break; } - case GFXCmdType::UPDATE_BUFFER: { + case GLESCmdType::DISPATCH: { + GLES3CmdDispatch *cmd = cmdPackage->dispatchCmds[cmdIdx]; + cmdFuncGLES3Dispatch(device, cmd->dispatchInfo); + break; + } + case GLESCmdType::BARRIER: { + GLES3CmdBarrier *cmd = cmdPackage->barrierCmds[cmdIdx]; + cmdFuncGLES3MemoryBarrier(device, cmd->barriers, cmd->barriersByRegion); + break; + } + case GLESCmdType::UPDATE_BUFFER: { GLES3CmdUpdateBuffer *cmd = cmdPackage->updateBufferCmds[cmdIdx]; - GLES3CmdFuncUpdateBuffer(device, cmd->gpuBuffer, cmd->buffer, cmd->offset, cmd->size); + cmdFuncGLES3UpdateBuffer(device, cmd->gpuBuffer, cmd->buffer, cmd->offset, cmd->size); break; } - case GFXCmdType::COPY_BUFFER_TO_TEXTURE: { + case GLESCmdType::COPY_BUFFER_TO_TEXTURE: { GLES3CmdCopyBufferToTexture *cmd = cmdPackage->copyBufferToTextureCmds[cmdIdx]; - GLES3CmdFuncCopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions, cmd->count); + cmdFuncGLES3CopyBuffersToTexture(device, cmd->buffers, cmd->gpuTexture, cmd->regions, cmd->count); + break; + } + case GLESCmdType::BLIT_TEXTURE: { + GLES3CmdBlitTexture *cmd = cmdPackage->blitTextureCmds[cmdIdx]; + cmdFuncGLES3BlitTexture(device, cmd->gpuTextureSrc, cmd->gpuTextureDst, cmd->regions, cmd->count, cmd->filter); break; } default: diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.h b/native/cocos/renderer/gfx-gles3/GLES3Commands.h index 7bb350162e..24f99d9dea 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.h @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_COMMANDS_H_ -#define CC_GFXGLES3_COMMANDS_H_ + +#pragma once #include "GLES3GPUObjects.h" +#include "gfx-gles-common/GLESCommandPool.h" namespace cc { namespace gfx { @@ -32,57 +34,57 @@ namespace gfx { class GLES3Device; struct GLES3DepthBias final { - float constant = 0.0f; - float clamp = 0.0f; - float slope = 0.0f; + float constant = 0.0F; + float clamp = 0.0F; + float slope = 0.0F; }; struct GLES3DepthBounds final { - float minBounds = 0.0f; - float maxBounds = 0.0f; + float minBounds = 0.0F; + float maxBounds = 0.0F; }; struct GLES3StencilWriteMask final { - StencilFace face = StencilFace::FRONT; - uint writeMask = 0; + StencilFace face = StencilFace::FRONT; + uint writeMask = 0; }; struct GLES3StencilCompareMask final { - StencilFace face = StencilFace::FRONT; - int refrence = 0; - uint compareMask = 0; + StencilFace face = StencilFace::FRONT; + int refrence = 0; + uint compareMask = 0; }; struct GLES3TextureSubres final { - uint baseMipLevel = 0; - uint levelCount = 1; + uint baseMipLevel = 0; + uint levelCount = 1; uint baseArrayLayer = 0; - uint layerCount = 1; + uint layerCount = 1; }; struct GLES3BufferTextureCopy final { - uint buffOffset = 0; - uint buffStride = 0; - uint buffTexHeight = 0; - uint texOffset[3] = {0}; - uint texExtent[3] = {0}; + uint buffOffset = 0; + uint buffStride = 0; + uint buffTexHeight = 0; + uint texOffset[3] = {0}; + uint texExtent[3] = {0}; GLES3TextureSubres texSubres; }; -class GLES3CmdBeginRenderPass final : public GFXCmd { +class GLES3CmdBeginRenderPass final : public GLESCmd { public: - GLES3GPURenderPass *gpuRenderPass = nullptr; - GLES3GPUFramebuffer *gpuFBO = nullptr; - Rect renderArea; - size_t numClearColors = 0; - Color clearColors[GFX_MAX_ATTACHMENTS]; - float clearDepth = 1.0f; - int clearStencil = 0; + GLES3GPURenderPass * gpuRenderPass = nullptr; + GLES3GPUFramebuffer *gpuFBO = nullptr; + Rect renderArea; + size_t numClearColors = 0; + Color clearColors[MAX_ATTACHMENTS]; + float clearDepth = 1.0F; + int clearStencil = 0; - GLES3CmdBeginRenderPass() : GFXCmd(GFXCmdType::BEGIN_RENDER_PASS) {} + GLES3CmdBeginRenderPass() : GLESCmd(GLESCmdType::BEGIN_RENDER_PASS) {} - virtual void clear() override { - gpuFBO = nullptr; + void clear() override { + gpuFBO = nullptr; numClearColors = 0; } }; @@ -99,148 +101,208 @@ enum class GLES3State { COUNT, }; -class GLES3CmdBindStates final : public GFXCmd { +class GLES3CmdBindStates final : public GLESCmd { public: - GLES3GPUPipelineState *gpuPipelineState = nullptr; - GLES3GPUInputAssembler *gpuInputAssembler = nullptr; + GLES3GPUPipelineState * gpuPipelineState = nullptr; + GLES3GPUInputAssembler * gpuInputAssembler = nullptr; vector gpuDescriptorSets; - vector dynamicOffsets; - Viewport viewport; - Rect scissor; - float lineWidth = 1.0f; - bool depthBiasEnabled = false; - GLES3DepthBias depthBias; - Color blendConstants; - GLES3DepthBounds depthBounds; - GLES3StencilWriteMask stencilWriteMask; - GLES3StencilCompareMask stencilCompareMask; + vector dynamicOffsets; + Viewport viewport; + Rect scissor; + float lineWidth = 1.0F; + bool depthBiasEnabled = false; + GLES3DepthBias depthBias; + Color blendConstants; + GLES3DepthBounds depthBounds; + GLES3StencilWriteMask stencilWriteMask; + GLES3StencilCompareMask stencilCompareMask; - GLES3CmdBindStates() : GFXCmd(GFXCmdType::BIND_STATES) {} + GLES3CmdBindStates() : GLESCmd(GLESCmdType::BIND_STATES) {} - virtual void clear() override { - gpuPipelineState = nullptr; + void clear() override { + gpuPipelineState = nullptr; gpuInputAssembler = nullptr; gpuDescriptorSets.clear(); dynamicOffsets.clear(); } }; -class GLES3CmdDraw final : public GFXCmd { +class GLES3CmdDraw final : public GLESCmd { public: DrawInfo drawInfo; - GLES3CmdDraw() : GFXCmd(GFXCmdType::DRAW) {} - virtual void clear() override {} + GLES3CmdDraw() : GLESCmd(GLESCmdType::DRAW) {} + void clear() override {} }; -class GLES3CmdUpdateBuffer final : public GFXCmd { +class GLES3CmdDispatch final : public GLESCmd { public: - GLES3GPUBuffer *gpuBuffer = nullptr; - uint8_t *buffer = nullptr; - uint size = 0; - uint offset = 0; + GLES3GPUDispatchInfo dispatchInfo; - GLES3CmdUpdateBuffer() : GFXCmd(GFXCmdType::UPDATE_BUFFER) {} - - virtual void clear() override { - gpuBuffer = nullptr; - buffer = nullptr; + GLES3CmdDispatch() : GLESCmd(GLESCmdType::DISPATCH) {} + void clear() override { + dispatchInfo.indirectBuffer = nullptr; + dispatchInfo.indirectOffset = 0; } }; -class GLES3CmdCopyBufferToTexture final : public GFXCmd { +class GLES3CmdBarrier final : public GLESCmd { public: - GLES3GPUTexture *gpuTexture = nullptr; - const BufferTextureCopy *regions = nullptr; - uint count = 0u; - const uint8_t *const *buffers; + GLbitfield barriers = 0U; + GLbitfield barriersByRegion = 0U; - GLES3CmdCopyBufferToTexture() : GFXCmd(GFXCmdType::COPY_BUFFER_TO_TEXTURE) {} + GLES3CmdBarrier() : GLESCmd(GLESCmdType::BARRIER) {} + void clear() override { + barriers = 0U; + barriersByRegion = 0U; + } +}; - virtual void clear() override { +class GLES3CmdUpdateBuffer final : public GLESCmd { +public: + GLES3GPUBuffer *gpuBuffer = nullptr; + const uint8_t * buffer = nullptr; + uint size = 0; + uint offset = 0; + + GLES3CmdUpdateBuffer() : GLESCmd(GLESCmdType::UPDATE_BUFFER) {} + + void clear() override { + gpuBuffer = nullptr; + buffer = nullptr; + } +}; + +class GLES3CmdCopyBufferToTexture final : public GLESCmd { +public: + GLES3GPUTexture * gpuTexture = nullptr; + const BufferTextureCopy *regions = nullptr; + uint count = 0U; + const uint8_t *const * buffers; + + GLES3CmdCopyBufferToTexture() : GLESCmd(GLESCmdType::COPY_BUFFER_TO_TEXTURE) {} + + void clear() override { gpuTexture = nullptr; - regions = nullptr; - count = 0u; - buffers = nullptr; + regions = nullptr; + count = 0U; + buffers = nullptr; + } +}; + +class GLES3CmdBlitTexture final : public GLESCmd { +public: + GLES3GPUTexture * gpuTextureSrc = nullptr; + GLES3GPUTexture * gpuTextureDst = nullptr; + const TextureBlit *regions = nullptr; + uint count = 0U; + Filter filter = Filter::POINT; + + GLES3CmdBlitTexture() : GLESCmd(GLESCmdType::BLIT_TEXTURE) {} + + void clear() override { + gpuTextureSrc = nullptr; + gpuTextureDst = nullptr; + regions = nullptr; + count = 0U; } }; class GLES3CmdPackage final : public Object { public: - CachedArray cmds; - CachedArray beginRenderPassCmds; - CachedArray bindStatesCmds; - CachedArray drawCmds; - CachedArray updateBufferCmds; + CachedArray cmds; + CachedArray beginRenderPassCmds; + CachedArray bindStatesCmds; + CachedArray drawCmds; + CachedArray dispatchCmds; + CachedArray barrierCmds; + CachedArray updateBufferCmds; CachedArray copyBufferToTextureCmds; + CachedArray blitTextureCmds; }; class GLES3GPUCommandAllocator final : public Object { public: - CommandPool beginRenderPassCmdPool; - CommandPool bindStatesCmdPool; - CommandPool drawCmdPool; - CommandPool updateBufferCmdPool; + CommandPool beginRenderPassCmdPool; + CommandPool bindStatesCmdPool; + CommandPool drawCmdPool; + CommandPool dispatchCmdPool; + CommandPool barrierCmdPool; + CommandPool updateBufferCmdPool; CommandPool copyBufferToTextureCmdPool; + CommandPool blitTextureCmdPool; - void clearCmds(GLES3CmdPackage *cmd_package) { - if (cmd_package->beginRenderPassCmds.size()) { - beginRenderPassCmdPool.freeCmds(cmd_package->beginRenderPassCmds); + void clearCmds(GLES3CmdPackage *cmdPackage) { + if (cmdPackage->beginRenderPassCmds.size()) { + beginRenderPassCmdPool.freeCmds(cmdPackage->beginRenderPassCmds); } - if (cmd_package->bindStatesCmds.size()) { - bindStatesCmdPool.freeCmds(cmd_package->bindStatesCmds); + if (cmdPackage->bindStatesCmds.size()) { + bindStatesCmdPool.freeCmds(cmdPackage->bindStatesCmds); } - if (cmd_package->drawCmds.size()) { - drawCmdPool.freeCmds(cmd_package->drawCmds); + if (cmdPackage->drawCmds.size()) { + drawCmdPool.freeCmds(cmdPackage->drawCmds); } - if (cmd_package->updateBufferCmds.size()) { - updateBufferCmdPool.freeCmds(cmd_package->updateBufferCmds); + if (cmdPackage->dispatchCmds.size()) { + dispatchCmdPool.freeCmds(cmdPackage->dispatchCmds); } - if (cmd_package->copyBufferToTextureCmds.size()) { - copyBufferToTextureCmdPool.freeCmds(cmd_package->copyBufferToTextureCmds); + if (cmdPackage->barrierCmds.size()) { + barrierCmdPool.freeCmds(cmdPackage->barrierCmds); + } + if (cmdPackage->updateBufferCmds.size()) { + updateBufferCmdPool.freeCmds(cmdPackage->updateBufferCmds); + } + if (cmdPackage->copyBufferToTextureCmds.size()) { + copyBufferToTextureCmdPool.freeCmds(cmdPackage->copyBufferToTextureCmds); + } + if (cmdPackage->blitTextureCmds.size()) { + blitTextureCmdPool.freeCmds(cmdPackage->blitTextureCmds); } - cmd_package->cmds.clear(); + cmdPackage->cmds.clear(); } CC_INLINE void reset() { beginRenderPassCmdPool.release(); bindStatesCmdPool.release(); drawCmdPool.release(); + dispatchCmdPool.release(); + barrierCmdPool.release(); updateBufferCmdPool.release(); copyBufferToTextureCmdPool.release(); + blitTextureCmdPool.release(); } }; -CC_GLES3_API void GLES3CmdFuncCreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer); -CC_GLES3_API void GLES3CmdFuncDestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer); -CC_GLES3_API void GLES3CmdFuncResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer); -CC_GLES3_API void GLES3CmdFuncCreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture); -CC_GLES3_API void GLES3CmdFuncDestroyTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture); -CC_GLES3_API void GLES3CmdFuncResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture); -CC_GLES3_API void GLES3CmdFuncCreateSampler(GLES3Device *device, GLES3GPUSampler *gpuSampler); -CC_GLES3_API void GLES3CmdFuncDestroySampler(GLES3Device *device, GLES3GPUSampler *gpuSampler); -CC_GLES3_API void GLES3CmdFuncCreateShader(GLES3Device *device, GLES3GPUShader *gpuShader); -CC_GLES3_API void GLES3CmdFuncDestroyShader(GLES3Device *device, GLES3GPUShader *gpuShader); -CC_GLES3_API void GLES3CmdFuncCreateInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler); -CC_GLES3_API void GLES3CmdFuncDestroyInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler); -CC_GLES3_API void GLES3CmdFuncCreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO); -CC_GLES3_API void GLES3CmdFuncDestroyFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO); +CC_GLES3_API void cmdFuncGLES3CreateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer); +CC_GLES3_API void cmdFuncGLES3DestroyBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer); +CC_GLES3_API void cmdFuncGLES3ResizeBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer); +CC_GLES3_API void cmdFuncGLES3CreateTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture); +CC_GLES3_API void cmdFuncGLES3DestroyTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture); +CC_GLES3_API void cmdFuncGLES3ResizeTexture(GLES3Device *device, GLES3GPUTexture *gpuTexture); +CC_GLES3_API void cmdFuncGLES3CreateSampler(GLES3Device *device, GLES3GPUSampler *gpuSampler); +CC_GLES3_API void cmdFuncGLES3DestroySampler(GLES3Device *device, GLES3GPUSampler *gpuSampler); +CC_GLES3_API void cmdFuncGLES3CreateShader(GLES3Device *device, GLES3GPUShader *gpuShader); +CC_GLES3_API void cmdFuncGLES3DestroyShader(GLES3Device *device, GLES3GPUShader *gpuShader); +CC_GLES3_API void cmdFuncGLES3CreateInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler); +CC_GLES3_API void cmdFuncGLES3DestroyInputAssembler(GLES3Device *device, GLES3GPUInputAssembler *gpuInputAssembler); +CC_GLES3_API void cmdFuncGLES3CreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO); +CC_GLES3_API void cmdFuncGLES3DestroyFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpuFBO); -CC_GLES3_API void GLES3CmdFuncBeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRenderPass, GLES3GPUFramebuffer *gpuFBO, +CC_GLES3_API void cmdFuncGLES3BeginRenderPass(GLES3Device *device, GLES3GPURenderPass *gpuRenderPass, GLES3GPUFramebuffer *gpuFramebuffer, const Rect &renderArea, size_t numClearColors, const Color *clearColors, float clearDepth, int clearStencil); -CC_GLES3_API void GLES3CmdFuncEndRenderPass(GLES3Device *device); -CC_GLES3_API void GLES3CmdFuncBindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipelineState, GLES3GPUInputAssembler *gpuInputAssembler, - vector &gpuDescriptorSets, vector &dynamicOffsets, - Viewport &viewport, Rect &scissor, float lineWidth, bool depthBiasEnabled, GLES3DepthBias &depthBias, Color &blendConstants, - GLES3DepthBounds &depthBounds, GLES3StencilWriteMask &stencilWriteMask, GLES3StencilCompareMask &stencilCompareMask); -CC_GLES3_API void GLES3CmdFuncDraw(GLES3Device *device, DrawInfo &drawInfo); -CC_GLES3_API void GLES3CmdFuncUpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size); -CC_GLES3_API void GLES3CmdFuncCopyBuffersToTexture(GLES3Device *device, const uint8_t *const *buffers, +CC_GLES3_API void cmdFuncGLES3EndRenderPass(GLES3Device *device); +CC_GLES3_API void cmdFuncGLES3BindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipelineState, GLES3GPUInputAssembler *gpuInputAssembler, + const vector &gpuDescriptorSets, const vector &dynamicOffsets, + const Viewport &viewport, const Rect &scissor, float lineWidth, bool depthBiasEnabled, const GLES3DepthBias &depthBias, const Color &blendConstants, + const GLES3DepthBounds &depthBounds, const GLES3StencilWriteMask &stencilWriteMask, const GLES3StencilCompareMask &stencilCompareMask); +CC_GLES3_API void cmdFuncGLES3Draw(GLES3Device *device, const DrawInfo &drawInfo); +CC_GLES3_API void cmdFuncGLES3UpdateBuffer(GLES3Device *device, GLES3GPUBuffer *gpuBuffer, const void *buffer, uint offset, uint size); +CC_GLES3_API void cmdFuncGLES3CopyBuffersToTexture(GLES3Device *device, const uint8_t *const *buffers, GLES3GPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count); -CC_GLES3_API void GLES3CmdFuncExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmdPackage); +CC_GLES3_API void cmdFuncGLES3BlitTexture(GLES3Device *device, GLES3GPUTexture *gpuTextureSrc, GLES3GPUTexture *gpuTextureDst, const TextureBlit *regions, uint count, Filter filter); +CC_GLES3_API void cmdFuncGLES3ExecuteCmds(GLES3Device *device, GLES3CmdPackage *cmdPackage); +CC_GLES3_API void cmdFuncGLES3Dispatch(GLES3Device *device, const GLES3GPUDispatchInfo &info); +CC_GLES3_API void cmdFuncGLES3MemoryBarrier(GLES3Device *device, GLbitfield barriers, GLbitfield barriersByRegion); } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Context.cpp b/native/cocos/renderer/gfx-gles3/GLES3Context.cpp index aa558506d5..68e7e78ff8 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Context.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Context.cpp @@ -1,38 +1,39 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Context.h" -#include "gles3w.h" +#include "GLES3Device.h" +#include "GLES3GPUObjects.h" #if (CC_PLATFORM == CC_PLATFORM_ANDROID) #include "android/native_window.h" - #include "cocos/bindings/event/CustomEventTypes.h" - #include "cocos/bindings/event/EventDispatcher.h" #endif -#define FORCE_DISABLE_VALIDATION 1 +#define FORCE_DISABLE_VALIDATION 1 namespace cc { namespace gfx { @@ -71,7 +72,7 @@ void GL_APIENTRY GLES3EGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum default: severityDesc = "NOTIFICATION"; } - String msg = StringUtil::Format("source: %s, type: %s, severity: %s, message: %s", + String msg = StringUtil::format("source: %s, type: %s, severity: %s, message: %s", sourceDesc.c_str(), typeDesc.c_str(), severityDesc.c_str(), message); if (severity == GL_DEBUG_SEVERITY_HIGH_KHR) { @@ -83,39 +84,40 @@ void GL_APIENTRY GLES3EGLDebugProc(GLenum source, GLenum type, GLuint id, GLenum #endif -GLES3Context::GLES3Context(Device *device) -: Context(device) { -} +GLES3Context::GLES3Context() = default; -GLES3Context::~GLES3Context() { -} +GLES3Context::~GLES3Context() = default; #if (CC_PLATFORM == CC_PLATFORM_WINDOWS || CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_MAC_OSX) -bool GLES3Context::initialize(const ContextInfo &info) { - - _vsyncMode = info.vsyncMode; +bool GLES3Context::doInit(const ContextInfo &info) { + _vsyncMode = info.vsyncMode; _windowHandle = info.windowHandle; ////////////////////////////////////////////////////////////////////////// if (!info.sharedCtx) { + if (!gles3wInit()) { + return false; + } + _isPrimaryContex = true; - _windowHandle = info.windowHandle; + _windowHandle = info.windowHandle; #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - _nativeDisplay = (NativeDisplayType)GetDC((HWND)_windowHandle); + _nativeDisplay = GetDC(reinterpret_cast(_windowHandle)); if (!_nativeDisplay) { return false; } EGL_CHECK(_eglDisplay = eglGetDisplay(_nativeDisplay)); if (_eglDisplay == EGL_NO_DISPLAY) { - EGL_CHECK(_eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY)); + EGL_CHECK(_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)); } #else - EGL_CHECK(_eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY)); + EGL_CHECK(_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY)); #endif + // If a display still couldn't be obtained, return an error. if (_eglDisplay == EGL_NO_DISPLAY) { CC_LOG_ERROR("eglGetDisplay() - FAILED."); @@ -129,26 +131,103 @@ bool GLES3Context::initialize(const ContextInfo &info) { return false; } - // Make OpenGL ES the current API. - // EGL needs a way to know that any subsequent EGL calls are going to be affecting OpenGL ES, - // rather than any other API (such as OpenVG). + // Make OpenGL ES the current API. + // EGL needs a way to know that any subsequent EGL calls are going to be affecting OpenGL ES, + // rather than any other API (such as OpenVG). EGL_CHECK(eglBindAPI(EGL_OPENGL_ES_API)); - _colorFmt = Format::RGBA8; + _colorFmt = Format::RGBA8; _depthStencilFmt = Format::D24S8; - const EGLint attribs[] = { + bool msaaEnabled = info.msaaEnabled; + EGLint redSize{8}, greenSize{8}, blueSize{8}, alphaSize{8}, depthSize{24}, stencilSize{8}, sampleBufferSize{msaaEnabled ? EGL_DONT_CARE : 0}, sampleSize{msaaEnabled ? EGL_DONT_CARE : 0}; + + EGLint defaultAttribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, // EGL_BUFFER_SIZE, colorBuffSize, - EGL_BLUE_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_RED_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 24, - EGL_STENCIL_SIZE, 8, + EGL_BLUE_SIZE, blueSize, + EGL_GREEN_SIZE, greenSize, + EGL_RED_SIZE, redSize, + EGL_ALPHA_SIZE, alphaSize, + EGL_DEPTH_SIZE, depthSize, + EGL_STENCIL_SIZE, stencilSize, + EGL_SAMPLE_BUFFERS, sampleBufferSize, + EGL_SAMPLES, sampleSize, EGL_NONE}; + int numConfig = 0; + unsigned int success = false; + do { + EGL_CHECK(success = eglChooseConfig(_eglDisplay, defaultAttribs, NULL, 0, &numConfig)); + } while (0); + if (success) { + _vecEGLConfig.resize(numConfig); + } else { + CC_LOG_ERROR("Query configuration failed."); + return false; + } + + int count = numConfig; + do { + EGL_CHECK(success = eglChooseConfig(_eglDisplay, defaultAttribs, _vecEGLConfig.data(), count, &numConfig)); + } while (0); + if (success == EGL_FALSE || !numConfig) { + CC_LOG_ERROR("eglChooseConfig configuration failed."); + return false; + } + + EGLint depth{0}, stencil{0}; + + const uint8_t attrNums = 8; + uint64_t lastScore{0}; + int params[attrNums] = {0}; + + const bool performancePreferred = info.performance == Performance::HIGH_QUALITY; + for (int i = 0; i < numConfig; i++) { + int depthValue{0}; + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_RED_SIZE, ¶ms[0]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_GREEN_SIZE, ¶ms[1]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_BLUE_SIZE, ¶ms[2]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_ALPHA_SIZE, ¶ms[3]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_DEPTH_SIZE, ¶ms[4]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_STENCIL_SIZE, ¶ms[5]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_SAMPLE_BUFFERS, ¶ms[6]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_SAMPLES, ¶ms[7]); + eglGetConfigAttrib(_eglDisplay, _vecEGLConfig[i], EGL_DEPTH_ENCODING_NV, &depthValue); + + int bNonLinearDepth = (depthValue == EGL_DEPTH_ENCODING_NONLINEAR_NV) ? 1 : 0; + + /*------------------------------------------ANGLE's priority-----------------------------------------------*/ + // Favor EGLConfigLists by RGB, then Depth, then Non-linear Depth, then Stencil, then Alpha + uint64_t currScore{0}; + currScore |= ((uint64_t)std::min(std::max(params[6], 0), 15)) << 29; + currScore |= ((uint64_t)std::min(std::max(params[7], 0), 31)) << 24; + currScore |= std::min(std::abs(params[0] - redSize) + + std::abs(params[1] - greenSize) + + std::abs(params[2] - blueSize), + 127) + << 17; + currScore |= std::min(std::abs(params[4] - depthSize), 63) << 11; + currScore |= std::min(std::abs(1 - bNonLinearDepth), 1) << 10; + currScore |= std::min(std::abs(params[5] - stencilSize), 31) << 6; + currScore |= std::min(std::abs(params[3] - alphaSize), 31) << 0; + /*------------------------------------------ANGLE's priority-----------------------------------------------*/ + + // if msaaEnabled, sampleBuffers and sampleCount should be greater than 0, until iterate to the last one(can't find). + bool msaaLimit = msaaEnabled ? (params[6] > 0 && params[7] > 0) || (i == numConfig - 1) : (params[6] == 0 && params[7] == 0); + // performancePreferred ? [>=] : [<] , egl configurations store in "ascending order" + bool filter = (currScore < lastScore) ^ performancePreferred; + if ((filter || lastScore == 0) && msaaLimit) { + _eglConfig = _vecEGLConfig[i]; + depth = params[4]; + stencil = params[5]; + _sampleBuffers = params[6]; + _sampleCount = params[7]; + lastScore = currScore; + } + } + // Find a suitable EGLConfig // eglChooseConfig is provided by EGL to provide an easy way to select an appropriate configuration. It takes in the capabilities // specified in the attribute list, and returns a list of available configurations that match or exceed the capabilities requested. @@ -158,15 +237,7 @@ bool GLES3Context::initialize(const ContextInfo &info) { // advanced applications choose to do. For this application however, taking the first EGLConfig that the function returns suits // its needs perfectly, so we limit it to returning a single EGLConfig. - EGLint numConfigs; - if (eglChooseConfig(_eglDisplay, attribs, &_eglConfig, 1, &numConfigs) == EGL_FALSE || numConfigs <= 0) { - CC_LOG_ERROR("Choosing configuration failed."); - return false; - } - - EGLint depth = attribs[13]; - EGLint stencil = attribs[15]; - CC_LOG_INFO("Setup EGLConfig: depth [%d] stencil [%d]", depth, stencil); + CC_LOG_INFO("Setup EGLConfig: depth [%d] stencil [%d] sampleBuffer [%d] sampleCount [%d]", depth, stencil, _sampleBuffers, _sampleCount); if (depth == 16 && stencil == 0) { _depthStencilFmt = Format::D16; @@ -186,13 +257,13 @@ bool GLES3Context::initialize(const ContextInfo &info) { } CC_LOG_INFO("Chosen EGLConfig: color [%s], depth stencil [%s].", - GFX_FORMAT_INFOS[(int)_colorFmt].name.c_str(), - GFX_FORMAT_INFOS[(int)_depthStencilFmt].name.c_str()); + GFX_FORMAT_INFOS[static_cast(_colorFmt)].name.c_str(), + GFX_FORMAT_INFOS[static_cast(_depthStencilFmt)].name.c_str()); /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is - * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). - * As soon as we picked a EGLConfig, we can safely reconfigure the - * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */ + * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). + * As soon as we picked a EGLConfig, we can safely reconfigure the + * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */ #if (CC_PLATFORM == CC_PLATFORM_ANDROID) EGLint nFmt; @@ -201,12 +272,12 @@ bool GLES3Context::initialize(const ContextInfo &info) { return false; } - uint width = _device->getWidth(); - uint height = _device->getHeight(); - ANativeWindow_setBuffersGeometry((ANativeWindow *)_windowHandle, width, height, nFmt); + uint width = GLES3Device::getInstance()->getWidth(); + uint height = GLES3Device::getInstance()->getHeight(); + ANativeWindow_setBuffersGeometry(reinterpret_cast(_windowHandle), width, height, nFmt); #endif - EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, (EGLNativeWindowType)_windowHandle, NULL)); + EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, reinterpret_cast(_windowHandle), nullptr)); if (_eglSurface == EGL_NO_SURFACE) { auto err = eglGetError(); CC_LOG_ERROR("Window surface created failed. code %d", err); @@ -216,17 +287,20 @@ bool GLES3Context::initialize(const ContextInfo &info) { //String eglVendor = eglQueryString(_eglDisplay, EGL_VENDOR); //String eglVersion = eglQueryString(_eglDisplay, EGL_VERSION); - EGL_CHECK(_extensions = StringUtil::Split((const char *)eglQueryString(_eglDisplay, EGL_EXTENSIONS), " ")); + EGL_CHECK(_extensions = StringUtil::split(eglQueryString(_eglDisplay, EGL_EXTENSIONS), " ")); _majorVersion = 3; _minorVersion = 0; EGLint ctxAttribs[32]; - uint n = 0; + uint n = 0; - bool hasKHRCreateCtx = CheckExtension(CC_TOSTR(EGL_KHR_create_context)); + bool hasKHRCreateCtx = checkExtension(CC_TOSTR(EGL_KHR_create_context)); if (hasKHRCreateCtx) { for (int m = 2; m >= 0; --m) { - n = 0; + #if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) + m = 0; // Mac OpenGL doesn't really support ES 3.1+ features + #endif + n = 0; ctxAttribs[n++] = EGL_CONTEXT_MAJOR_VERSION_KHR; ctxAttribs[n++] = _majorVersion; ctxAttribs[n++] = EGL_CONTEXT_MINOR_VERSION_KHR; @@ -238,7 +312,7 @@ bool GLES3Context::initialize(const ContextInfo &info) { #endif ctxAttribs[n] = EGL_NONE; - EGL_CHECK(_eglContext = eglCreateContext(_eglDisplay, _eglConfig, NULL, ctxAttribs)); + EGL_CHECK(_eglContext = eglCreateContext(_eglDisplay, _eglConfig, nullptr, ctxAttribs)); if (_eglContext) { _minorVersion = m; break; @@ -247,8 +321,8 @@ bool GLES3Context::initialize(const ContextInfo &info) { } else { ctxAttribs[n++] = EGL_CONTEXT_CLIENT_VERSION; ctxAttribs[n++] = _majorVersion; - ctxAttribs[n] = EGL_NONE; - EGL_CHECK(_eglContext = eglCreateContext(_eglDisplay, _eglConfig, NULL, ctxAttribs)); + ctxAttribs[n] = EGL_NONE; + EGL_CHECK(_eglContext = eglCreateContext(_eglDisplay, _eglConfig, nullptr, ctxAttribs)); } if (!_eglContext) { @@ -257,66 +331,29 @@ bool GLES3Context::initialize(const ContextInfo &info) { } _eglSharedContext = _eglContext; - - #if (CC_PLATFORM == CC_PLATFORM_ANDROID) - EventDispatcher::addCustomEventListener(EVENT_DESTROY_WINDOW, [=](const CustomEvent &) -> void { - if (_eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(_eglDisplay, _eglSurface); - _eglSurface = EGL_NO_SURFACE; - } - }); - - EventDispatcher::addCustomEventListener(EVENT_RECREATE_WINDOW, [=](const CustomEvent &event) -> void { - _windowHandle = (uintptr_t)event.args->ptrVal; - - EGLint nFmt; - if (eglGetConfigAttrib(_eglDisplay, _eglConfig, EGL_NATIVE_VISUAL_ID, &nFmt) == EGL_FALSE) { - CC_LOG_ERROR("Getting configuration attributes failed."); - return; - } - uint width = _device->getWidth(); - uint height = _device->getHeight(); - ANativeWindow_setBuffersGeometry((ANativeWindow *)_windowHandle, width, height, nFmt); - - EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, (EGLNativeWindowType)_windowHandle, NULL)); - if (_eglSurface == EGL_NO_SURFACE) { - CC_LOG_ERROR("Recreate window surface failed."); - return; - } - - ((GLES3Context *)_device->getContext())->MakeCurrent(); - }); - #endif - - if (!gles3wInit()) { - return false; - } - } else { - GLES3Context *sharedCtx = (GLES3Context *)info.sharedCtx; + auto *sharedCtx = static_cast(info.sharedCtx); - _majorVersion = sharedCtx->major_ver(); - _minorVersion = sharedCtx->minor_ver(); - _nativeDisplay = sharedCtx->native_display(); - _eglDisplay = sharedCtx->egl_display(); - _eglConfig = sharedCtx->egl_config(); - _eglSharedContext = sharedCtx->egl_shared_ctx(); - _eglSurface = sharedCtx->egl_surface(); - _colorFmt = sharedCtx->getColorFormat(); - _depthStencilFmt = sharedCtx->getDepthStencilFormat(); - _majorVersion = sharedCtx->major_ver(); - _minorVersion = sharedCtx->minor_ver(); - _extensions = sharedCtx->_extensions; - _isInitialized = sharedCtx->_isInitialized; + _majorVersion = sharedCtx->majorVer(); + _minorVersion = sharedCtx->minorVer(); + _nativeDisplay = sharedCtx->nativeDisplay(); + _eglDisplay = sharedCtx->eglDisplay(); + _eglConfig = sharedCtx->eglConfig(); + _eglSharedContext = sharedCtx->eglSharedCtx(); + _eglSurface = sharedCtx->eglSurface(); + _colorFmt = sharedCtx->getColorFormat(); + _depthStencilFmt = sharedCtx->getDepthStencilFormat(); + _extensions = sharedCtx->_extensions; + _isInitialized = sharedCtx->_isInitialized; - bool hasKHRCreateCtx = CheckExtension(CC_TOSTR(EGL_KHR_create_context)); + bool hasKHRCreateCtx = checkExtension(CC_TOSTR(EGL_KHR_create_context)); if (!hasKHRCreateCtx) { CC_LOG_INFO("EGL context creation: EGL_KHR_create_context not supported. Minor version will be discarded, and debug disabled."); _minorVersion = 0; } EGLint ctxAttribs[32]; - uint n = 0; + uint n = 0; if (hasKHRCreateCtx) { ctxAttribs[n++] = EGL_CONTEXT_MAJOR_VERSION_KHR; @@ -345,38 +382,79 @@ bool GLES3Context::initialize(const ContextInfo &info) { return true; } -void GLES3Context::destroy() { +void GLES3Context::doDestroy() { EGL_CHECK(eglMakeCurrent(_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)); + if (!_vecEGLConfig.empty()) { + _vecEGLConfig.clear(); + } + if (_eglContext != EGL_NO_CONTEXT) { EGL_CHECK(eglDestroyContext(_eglDisplay, _eglContext)); _eglContext = EGL_NO_CONTEXT; } - if (_isPrimaryContex && _eglSurface != EGL_NO_SURFACE) { - EGL_CHECK(eglDestroySurface(_eglDisplay, _eglSurface)); - _eglSurface = EGL_NO_SURFACE; - } + if (_isPrimaryContex) { + if (_eglSurface != EGL_NO_SURFACE) { + EGL_CHECK(eglDestroySurface(_eglDisplay, _eglSurface)); + _eglSurface = EGL_NO_SURFACE; + } - if (_eglDisplay != EGL_NO_DISPLAY) { - EGL_CHECK(eglTerminate(_eglDisplay)); - _eglDisplay = EGL_NO_DISPLAY; - } + if (_eglDisplay != EGL_NO_DISPLAY) { + EGL_CHECK(eglTerminate(_eglDisplay)); + _eglDisplay = EGL_NO_DISPLAY; + } #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - if (_isPrimaryContex && _nativeDisplay) { - ReleaseDC((HWND)_windowHandle, _nativeDisplay); - } + if (_nativeDisplay) { + ReleaseDC(reinterpret_cast(_windowHandle), _nativeDisplay); + } #endif + } _isPrimaryContex = false; - _windowHandle = 0; - _nativeDisplay = 0; - _vsyncMode = VsyncMode::OFF; - _isInitialized = false; + _windowHandle = 0; + _nativeDisplay = 0; // NOLINT(modernize-use-nullptr) portability issues + _vsyncMode = VsyncMode::OFF; + _isInitialized = false; } -bool GLES3Context::MakeCurrentImpl(bool bound) { +void GLES3Context::releaseSurface(uintptr_t /*windowHandle*/) { + #if (CC_PLATFORM == CC_PLATFORM_ANDROID) + if (_eglSurface != EGL_NO_SURFACE) { + eglDestroySurface(_eglDisplay, _eglSurface); + _eglSurface = EGL_NO_SURFACE; + } + #endif +} + +void GLES3Context::acquireSurface(uintptr_t windowHandle) { + #if (CC_PLATFORM == CC_PLATFORM_ANDROID) + _windowHandle = windowHandle; + + EGLint nFmt; + if (eglGetConfigAttrib(_eglDisplay, _eglConfig, EGL_NATIVE_VISUAL_ID, &nFmt) == EGL_FALSE) { + CC_LOG_ERROR("Getting configuration attributes failed."); + return; + } + // Device's size will be updated after recreate window (in resize event) and is incorrect for now. + auto *window = reinterpret_cast(_windowHandle); + uint width = ANativeWindow_getWidth(window); + uint height = ANativeWindow_getHeight(window); + ANativeWindow_setBuffersGeometry(window, width, height, nFmt); + + EGL_CHECK(_eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, reinterpret_cast(_windowHandle), nullptr)); + if (_eglSurface == EGL_NO_SURFACE) { + CC_LOG_ERROR("Recreate window surface failed."); + return; + } + + static_cast(GLES3Device::getInstance()->getContext())->makeCurrent(); + GLES3Device::getInstance()->stateCache()->reset(); + #endif +} + +bool GLES3Context::makeCurrentImpl(bool bound) { bool succeeded; EGL_CHECK(succeeded = eglMakeCurrent(_eglDisplay, bound ? _eglSurface : EGL_NO_SURFACE, @@ -391,20 +469,20 @@ void GLES3Context::present() { #endif -bool GLES3Context::MakeCurrent(bool bound) { +bool GLES3Context::makeCurrent(bool bound) { if (!bound) { CC_LOG_DEBUG("eglMakeCurrent() - UNBOUNDED, Context: 0x%p", this); - return MakeCurrentImpl(false); + return makeCurrentImpl(false); } - if (MakeCurrentImpl(bound)) { + if (makeCurrentImpl(bound)) { if (!_isInitialized) { #if (CC_PLATFORM == CC_PLATFORM_WINDOWS || CC_PLATFORM == CC_PLATFORM_ANDROID) // Turn on or off the vertical sync depending on the input bool value. int interval = 1; switch (_vsyncMode) { case VsyncMode::OFF: interval = 0; break; - case VsyncMode::ON: interval = 1; break; + case VsyncMode::ON: case VsyncMode::RELAXED: interval = 1; break; case VsyncMode::MAILBOX: interval = 0; break; case VsyncMode::HALF: interval = 2; break; @@ -416,66 +494,68 @@ bool GLES3Context::MakeCurrent(bool bound) { return false; } #endif + _isInitialized = true; + } #if CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION && CC_PLATFORM != CC_PLATFORM_MAC_IOS - GL_CHECK(glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR)); + GL_CHECK(glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR)); + if (glDebugMessageControlKHR) { GL_CHECK(glDebugMessageControlKHR(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE)); + } + if (glDebugMessageCallbackKHR) { GL_CHECK(glDebugMessageCallbackKHR(GLES3EGLDebugProc, NULL)); + } #endif - _isInitialized = true; + ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + GL_CHECK(glPixelStorei(GL_PACK_ALIGNMENT, 1)); + GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); + GL_CHECK(glActiveTexture(GL_TEXTURE0)); - GL_CHECK(glPixelStorei(GL_PACK_ALIGNMENT, 1)); - GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); - GL_CHECK(glActiveTexture(GL_TEXTURE0)); + ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + GL_CHECK(glEnable(GL_SCISSOR_TEST)); + GL_CHECK(glEnable(GL_CULL_FACE)); + GL_CHECK(glCullFace(GL_BACK)); - GL_CHECK(glEnable(GL_SCISSOR_TEST)); - GL_CHECK(glEnable(GL_CULL_FACE)); - GL_CHECK(glCullFace(GL_BACK)); + GL_CHECK(glFrontFace(GL_CCW)); - GL_CHECK(glFrontFace(GL_CCW)); + GL_CHECK(glDisable(GL_SAMPLE_COVERAGE)); - //GL_CHECK(glDisable(GL_MULTISAMPLE)); + ////////////////////////////////////////////////////////////////////////// + // DepthStencilState + GL_CHECK(glEnable(GL_DEPTH_TEST)); + GL_CHECK(glDepthMask(GL_TRUE)); + GL_CHECK(glDepthFunc(GL_LESS)); - ////////////////////////////////////////////////////////////////////////// - // DepthStencilState - GL_CHECK(glEnable(GL_DEPTH_TEST)); - GL_CHECK(glDepthMask(GL_TRUE)); - GL_CHECK(glDepthFunc(GL_LESS)); + GL_CHECK(glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 1, 0xffffffff)); + GL_CHECK(glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP)); + GL_CHECK(glStencilMaskSeparate(GL_FRONT, 0xffffffff)); + GL_CHECK(glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 1, 0xffffffff)); + GL_CHECK(glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP)); + GL_CHECK(glStencilMaskSeparate(GL_BACK, 0xffffffff)); - GL_CHECK(glStencilFuncSeparate(GL_FRONT, GL_ALWAYS, 1, 0xffffffff)); - GL_CHECK(glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP)); - GL_CHECK(glStencilMaskSeparate(GL_FRONT, 0xffffffff)); - GL_CHECK(glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 1, 0xffffffff)); - GL_CHECK(glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP)); - GL_CHECK(glStencilMaskSeparate(GL_BACK, 0xffffffff)); + GL_CHECK(glDisable(GL_STENCIL_TEST)); - GL_CHECK(glDisable(GL_STENCIL_TEST)); + ////////////////////////////////////////////////////////////////////////// + // BlendState - ////////////////////////////////////////////////////////////////////////// - // BlendState - - GL_CHECK(glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE)); - GL_CHECK(glDisable(GL_BLEND)); - GL_CHECK(glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD)); - GL_CHECK(glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO)); - GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); - GL_CHECK(glBlendColor((GLclampf)0.0f, (GLclampf)0.0f, (GLclampf)0.0f, (GLclampf)0.0f)); - } + GL_CHECK(glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE)); + GL_CHECK(glDisable(GL_BLEND)); + GL_CHECK(glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD)); + GL_CHECK(glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO)); + GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); + GL_CHECK(glBlendColor(0.0F, 0.0F, 0.0F, 0.0F)); CC_LOG_DEBUG("eglMakeCurrent() - SUCCEEDED, Context: 0x%p", this); return true; - } else { - CC_LOG_ERROR("MakeCurrent() - FAILED, Context: 0x%p", this); - return false; } + CC_LOG_ERROR("MakeCurrent() - FAILED, Context: 0x%p", this); + return false; } -bool GLES3Context::CheckExtension(const String &extension) const { +bool GLES3Context::checkExtension(const String &extension) const { return (std::find(_extensions.begin(), _extensions.end(), extension) != _extensions.end()); } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Context.h b/native/cocos/renderer/gfx-gles3/GLES3Context.h index 407e012d6a..301ec7e732 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Context.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Context.h @@ -1,119 +1,102 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_EGL_CONTEXT_H_ -#define CC_GFXGLES3_EGL_CONTEXT_H_ -#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) - #ifdef __OBJC__ - #include - #endif -#else - #include - #include - #include -#endif +#pragma once -#ifndef EGL_KHR_create_context - #define EGL_KHR_create_context 1 - #define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION - #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB - #define EGL_CONTEXT_FLAGS_KHR 0x30FC - #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD - #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD - #define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE - #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF - #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 - #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 - #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 - #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 - #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 - #define EGL_OPENGL_ES3_BIT_KHR 0x00000040 -#endif +#include +#include "GLES3Std.h" +#include "GLES3Wrangler.h" +#include "gfx-base/GFXContext.h" namespace cc { namespace gfx { class CC_GLES3_API GLES3Context final : public Context { public: - GLES3Context(Device *device); - ~GLES3Context(); + GLES3Context(); + ~GLES3Context() override; -public: - virtual bool initialize(const ContextInfo &info) override; - virtual void destroy() override; - virtual void present() override; + void present() override; - bool MakeCurrent(bool bound); - bool CheckExtension(const String &extension) const; + bool makeCurrent(bool bound); + bool checkExtension(const String &extension) const; #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) CC_INLINE intptr_t eagl_context() const { return _eaglContext; } CC_INLINE intptr_t eagl_shared_ctx() const { return _eaglSharedContext; } - CC_INLINE uint getDefaultFramebuffer() const { return _defaultFBO; } + CC_INLINE uint getDefaultFramebuffer() const { return _defaultFBO; } #else - CC_INLINE NativeDisplayType native_display() const { return _nativeDisplay; } - CC_INLINE EGLDisplay egl_display() const { return _eglDisplay; } - CC_INLINE EGLConfig egl_config() const { return _eglConfig; } - CC_INLINE EGLSurface egl_surface() const { return _eglSurface; } - CC_INLINE EGLContext egl_context() const { return _eglContext; } - CC_INLINE EGLContext egl_shared_ctx() const { return _eglSharedContext; } + CC_INLINE NativeDisplayType nativeDisplay() const { return _nativeDisplay; } + CC_INLINE EGLDisplay eglDisplay() const { return _eglDisplay; } + CC_INLINE EGLConfig eglConfig() const { return _eglConfig; } + CC_INLINE EGLSurface eglSurface() const { return _eglSurface; } + CC_INLINE EGLContext eglContext() const { return _eglContext; } + CC_INLINE EGLContext eglSharedCtx() const { return _eglSharedContext; } #endif - CC_INLINE bool MakeCurrent() { return MakeCurrent(true); } - CC_INLINE int major_ver() const { return _majorVersion; } - CC_INLINE int minor_ver() const { return _minorVersion; } + CC_INLINE bool makeCurrent() { return makeCurrent(true); } + CC_INLINE int majorVer() const { return _majorVersion; } + CC_INLINE int minorVer() const { return _minorVersion; } + CC_INLINE uint8_t multiSampleCount() const { return _sampleCount; } -private: - bool MakeCurrentImpl(bool bound); + void releaseSurface(uintptr_t windowHandle); + void acquireSurface(uintptr_t windowHandle); + +protected: + bool makeCurrentImpl(bool bound); #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) bool createCustomFrameBuffer(); - void destroyCustomFrameBuffer(); + void doDestroyCustomFrameBuffer(); #endif -private: - bool _isPrimaryContex = false; + bool doInit(const ContextInfo &info) override; + void doDestroy() override; + + bool _isPrimaryContex = false; + bool _isInitialized = false; + uint8_t _sampleBuffers = 0; + uint8_t _sampleCount = 0; #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) - intptr_t _eaglContext = 0; + intptr_t _eaglContext = 0; intptr_t _eaglSharedContext = 0; // iOS needs to created frame buffer and attach color/depth/stencil buffer. - uint _defaultFBO = 0; - uint _defaultColorBuffer = 0; + uint _defaultFBO = 0; + uint _defaultColorBuffer = 0; uint _defaultDepthStencilBuffer = 0; #else - NativeDisplayType _nativeDisplay = 0; - EGLDisplay _eglDisplay = EGL_NO_DISPLAY; - EGLConfig _eglConfig = EGL_NO_CONFIG_KHR; - EGLSurface _eglSurface = EGL_NO_SURFACE; - EGLContext _eglContext = EGL_NO_CONTEXT; - EGLContext _eglSharedContext = EGL_NO_CONTEXT; + NativeDisplayType _nativeDisplay = 0; // NOLINT(modernize-use-nullptr) portability issues + EGLDisplay _eglDisplay = EGL_NO_DISPLAY; + EGLConfig _eglConfig = EGL_NO_CONFIG_KHR; + EGLSurface _eglSurface = EGL_NO_SURFACE; + EGLContext _eglContext = EGL_NO_CONTEXT; + EGLContext _eglSharedContext = EGL_NO_CONTEXT; + std::vector _vecEGLConfig; #endif - int _majorVersion = 0; - int _minorVersion = 0; + int _majorVersion = 0; + int _minorVersion = 0; StringArray _extensions; - bool _isInitialized = false; }; } // namespace gfx } // namespace cc - -#endif // CC_GFXGLES3_EGL_CONTEXT_H_ diff --git a/native/cocos/renderer/gfx-gles3/GLES3Context.mm b/native/cocos/renderer/gfx-gles3/GLES3Context.mm index 66d989045f..479777b464 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Context.mm +++ b/native/cocos/renderer/gfx-gles3/GLES3Context.mm @@ -1,29 +1,30 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Context.h" -#include "gles3w.h" #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) @@ -32,7 +33,7 @@ THE SOFTWARE. namespace cc { namespace gfx { -bool GLES3Context::initialize(const ContextInfo &info) { +void GLES3Context::doInit(const ContextInfo &info) { _vsyncMode = info.vsyncMode; _windowHandle = info.windowHandle; @@ -51,7 +52,7 @@ bool GLES3Context::initialize(const ContextInfo &info) { CC_LOG_ERROR("Create EAGL context failed."); return false; } - + _eaglContext = (intptr_t)eagl_context; _eaglSharedContext = (intptr_t)eagl_context; _majorVersion = 3; @@ -73,7 +74,7 @@ bool GLES3Context::initialize(const ContextInfo &info) { CC_LOG_ERROR("Create EGL context with share context [0x%p] failed.", eagl_shared_context); return false; } - + _eaglContext = (intptr_t)eagl_context; _eaglSharedContext = (intptr_t)eagl_shared_context; } @@ -188,7 +189,7 @@ void GLES3Context::destroyCustomFrameBuffer() { } } -void GLES3Context::destroy() { +void GLES3Context::doDestroy() { destroyCustomFrameBuffer(); if (_eaglContext) { diff --git a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.cpp b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.cpp index 0485ad36c4..e9f1b8a825 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Buffer.h" @@ -33,28 +35,20 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES3DescriptorSet::GLES3DescriptorSet(Device *device) -: DescriptorSet(device) { -} +GLES3DescriptorSet::GLES3DescriptorSet() = default; GLES3DescriptorSet::~GLES3DescriptorSet() { + destroy(); } -bool GLES3DescriptorSet::initialize(const DescriptorSetInfo &info) { - - _layout = info.layout; - - const GLES3GPUDescriptorSetLayout *gpuDescriptorSetLayout = ((GLES3DescriptorSetLayout *)_layout)->gpuDescriptorSetLayout(); +void GLES3DescriptorSet::doInit(const DescriptorSetInfo & /*info*/) { + const GLES3GPUDescriptorSetLayout *gpuDescriptorSetLayout = static_cast(_layout)->gpuDescriptorSetLayout(); const size_t descriptorCount = gpuDescriptorSetLayout->descriptorCount; const size_t bindingCount = gpuDescriptorSetLayout->bindings.size(); - _buffers.resize(descriptorCount); - _textures.resize(descriptorCount); - _samplers.resize(descriptorCount); - _gpuDescriptorSet = CC_NEW(GLES3GPUDescriptorSet); _gpuDescriptorSet->gpuDescriptors.resize(descriptorCount); - for (size_t i = 0u, k = 0u; i < bindingCount; i++) { + for (size_t i = 0U, k = 0U; i < bindingCount; i++) { const DescriptorSetLayoutBinding &binding = gpuDescriptorSetLayout->bindings[i]; for (uint j = 0; j < binding.count; j++, k++) { _gpuDescriptorSet->gpuDescriptors[k].type = binding.descriptorType; @@ -62,35 +56,29 @@ bool GLES3DescriptorSet::initialize(const DescriptorSetInfo &info) { } _gpuDescriptorSet->descriptorIndices = &gpuDescriptorSetLayout->descriptorIndices; - - return true; } -void GLES3DescriptorSet::destroy() { +void GLES3DescriptorSet::doDestroy() { if (_gpuDescriptorSet) { CC_DELETE(_gpuDescriptorSet); _gpuDescriptorSet = nullptr; } - // do remember to clear these or else it might not be properly updated when reused - _buffers.clear(); - _textures.clear(); - _samplers.clear(); } void GLES3DescriptorSet::update() { if (_isDirty && _gpuDescriptorSet) { const GLES3GPUDescriptorList &descriptors = _gpuDescriptorSet->gpuDescriptors; for (size_t i = 0; i < descriptors.size(); i++) { - if ((uint)descriptors[i].type & DESCRIPTOR_BUFFER_TYPE) { + if (hasAnyFlags(descriptors[i].type, DESCRIPTOR_BUFFER_TYPE)) { if (_buffers[i]) { - _gpuDescriptorSet->gpuDescriptors[i].gpuBuffer = ((GLES3Buffer *)_buffers[i])->gpuBuffer(); + _gpuDescriptorSet->gpuDescriptors[i].gpuBuffer = static_cast(_buffers[i])->gpuBuffer(); } - } else if ((uint)descriptors[i].type & DESCRIPTOR_SAMPLER_TYPE) { + } else if (hasAnyFlags(descriptors[i].type, DESCRIPTOR_TEXTURE_TYPE)) { if (_textures[i]) { - _gpuDescriptorSet->gpuDescriptors[i].gpuTexture = ((GLES3Texture *)_textures[i])->gpuTexture(); + _gpuDescriptorSet->gpuDescriptors[i].gpuTexture = static_cast(_textures[i])->gpuTexture(); } if (_samplers[i]) { - _gpuDescriptorSet->gpuDescriptors[i].gpuSampler = ((GLES3Sampler *)_samplers[i])->gpuSampler(); + _gpuDescriptorSet->gpuDescriptors[i].gpuSampler = static_cast(_samplers[i])->gpuSampler(); } } } diff --git a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h index 76b60fce93..2bb082e9b7 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h +++ b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSet.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_DESCRIPTOR_SET_H_ #define CC_GFXGLES3_DESCRIPTOR_SET_H_ +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { @@ -31,17 +35,17 @@ class GLES3GPUDescriptorSet; class CC_GLES3_API GLES3DescriptorSet final : public DescriptorSet { public: - GLES3DescriptorSet(Device *device); + GLES3DescriptorSet(); ~GLES3DescriptorSet(); -public: - virtual bool initialize(const DescriptorSetInfo &info) override; - virtual void destroy() override; - virtual void update() override; + void update() override; CC_INLINE GLES3GPUDescriptorSet *gpuDescriptorSet() const { return _gpuDescriptorSet; } -private: +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; + GLES3GPUDescriptorSet *_gpuDescriptorSet = nullptr; }; diff --git a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.cpp b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.cpp index ac02b23736..78f67b410a 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Commands.h" @@ -29,56 +31,29 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES3DescriptorSetLayout::GLES3DescriptorSetLayout(Device *device) -: DescriptorSetLayout(device) { -} +GLES3DescriptorSetLayout::GLES3DescriptorSetLayout() = default; GLES3DescriptorSetLayout::~GLES3DescriptorSetLayout() { + destroy(); } -bool GLES3DescriptorSetLayout::initialize(const DescriptorSetLayoutInfo &info) { - - _bindings = info.bindings; - size_t bindingCount = _bindings.size(); - _descriptorCount = 0u; - - if (bindingCount) { - uint maxBinding = 0u; - vector flattenedIndices(bindingCount); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - flattenedIndices[i] = _descriptorCount; - _descriptorCount += binding.count; - if (binding.binding > maxBinding) maxBinding = binding.binding; - } - - _bindingIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - _descriptorIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - _bindingIndices[binding.binding] = i; - _descriptorIndices[binding.binding] = flattenedIndices[i]; - } - } - +void GLES3DescriptorSetLayout::doInit(const DescriptorSetLayoutInfo& /*info*/) { _gpuDescriptorSetLayout = CC_NEW(GLES3GPUDescriptorSetLayout); _gpuDescriptorSetLayout->descriptorCount = _descriptorCount; _gpuDescriptorSetLayout->bindingIndices = _bindingIndices; _gpuDescriptorSetLayout->descriptorIndices = _descriptorIndices; _gpuDescriptorSetLayout->bindings = _bindings; - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - if ((uint)binding.descriptorType & DESCRIPTOR_DYNAMIC_TYPE) { - for (uint j = 0u; j < binding.count; j++) { + for (auto& binding : _bindings) { + if (hasAnyFlags(binding.descriptorType, DESCRIPTOR_DYNAMIC_TYPE)) { + for (uint j = 0U; j < binding.count; j++) { _gpuDescriptorSetLayout->dynamicBindings.push_back(binding.binding); } } } - return true; } -void GLES3DescriptorSetLayout::destroy() { +void GLES3DescriptorSetLayout::doDestroy() { if (_gpuDescriptorSetLayout) { CC_DELETE(_gpuDescriptorSetLayout); _gpuDescriptorSetLayout = nullptr; diff --git a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h index b89b7fc57d..53ea3ca0c6 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_DESCRIPTOR_SET_LAYOUT_H_ #define CC_GFXGLES3_DESCRIPTOR_SET_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { @@ -31,16 +35,15 @@ class GLES3GPUDescriptorSetLayout; class CC_GLES3_API GLES3DescriptorSetLayout final : public DescriptorSetLayout { public: - GLES3DescriptorSetLayout(Device *device); + GLES3DescriptorSetLayout(); ~GLES3DescriptorSetLayout(); -public: - virtual bool initialize(const DescriptorSetLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPUDescriptorSetLayout *gpuDescriptorSetLayout() const { return _gpuDescriptorSetLayout; } -private: +protected: + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; + GLES3GPUDescriptorSetLayout *_gpuDescriptorSetLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp index 95b18b7db1..e5c60c183d 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Buffer.h" @@ -29,8 +31,8 @@ THE SOFTWARE. #include "GLES3DescriptorSet.h" #include "GLES3DescriptorSetLayout.h" #include "GLES3Device.h" -#include "GLES3Fence.h" #include "GLES3Framebuffer.h" +#include "GLES3GlobalBarrier.h" #include "GLES3InputAssembler.h" #include "GLES3PipelineLayout.h" #include "GLES3PipelineState.h" @@ -44,100 +46,117 @@ THE SOFTWARE. namespace cc { namespace gfx { +GLES3Device *GLES3Device::instance = nullptr; + +GLES3Device *GLES3Device::getInstance() { + return GLES3Device::instance; +} + GLES3Device::GLES3Device() { + _api = API::GLES3; + _deviceName = "GLES3"; + + GLES3Device::instance = this; } GLES3Device::~GLES3Device() { + GLES3Device::instance = nullptr; } -bool GLES3Device::initialize(const DeviceInfo &info) { - _API = API::GLES3; - _deviceName = "GLES3"; - _width = info.width; - _height = info.height; - _nativeWidth = info.nativeWidth; - _nativeHeight = info.nativeHeight; - _windowHandle = info.windowHandle; - - _bindingMappingInfo = info.bindingMappingInfo; - if (!_bindingMappingInfo.bufferOffsets.size()) { - _bindingMappingInfo.bufferOffsets.push_back(0); - } - if (!_bindingMappingInfo.samplerOffsets.size()) { - _bindingMappingInfo.samplerOffsets.push_back(0); - } - - _gpuStateCache = CC_NEW(GLES3GPUStateCache); - _gpuStagingBufferPool = CC_NEW(GLES3GPUStagingBufferPool); - +bool GLES3Device::doInit(const DeviceInfo & info) { ContextInfo ctxInfo; ctxInfo.windowHandle = _windowHandle; - ctxInfo.sharedCtx = info.sharedCtx; + ctxInfo.msaaEnabled = info.isAntiAlias; + ctxInfo.performance = Performance::HIGH_QUALITY; - _renderContext = CC_NEW(GLES3Context(this)); + _renderContext = CC_NEW(GLES3Context); if (!_renderContext->initialize(ctxInfo)) { destroy(); return false; } + + QueueInfo queueInfo; + queueInfo.type = QueueType::GRAPHICS; + _queue = createQueue(queueInfo); + + CommandBufferInfo cmdBuffInfo; + cmdBuffInfo.type = CommandBufferType::PRIMARY; + cmdBuffInfo.queue = _queue; + _cmdBuff = createCommandBuffer(cmdBuffInfo); + + _gpuStateCache = CC_NEW(GLES3GPUStateCache); + _gpuStagingBufferPool = CC_NEW(GLES3GPUStagingBufferPool); + _gpuFramebufferCacheMap = CC_NEW(GLES3GPUFramebufferCacheMap(_gpuStateCache)); + bindRenderContext(true); - String extStr = (const char *)glGetString(GL_EXTENSIONS); - _extensions = StringUtil::Split(extStr, " "); + String extStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); + _extensions = StringUtil::split(extStr, " "); - _features[(int)Feature::TEXTURE_FLOAT] = true; - _features[(int)Feature::TEXTURE_HALF_FLOAT] = true; - _features[(int)Feature::FORMAT_R11G11B10F] = true; - _features[(int)Feature::FORMAT_D24S8] = true; - _features[(int)Feature::MSAA] = true; - _features[(int)Feature::INSTANCED_ARRAYS] = true; - _features[(int)Feature::MULTIPLE_RENDER_TARGETS] = true; - _features[(uint)Feature::BLEND_MINMAX] = true; + _features[static_cast(Feature::MSAA)] = _renderContext->multiSampleCount() > 0; + _features[static_cast(Feature::TEXTURE_FLOAT)] = true; + _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; + _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; + _features[static_cast(Feature::FORMAT_D24S8)] = true; + _features[static_cast(Feature::INSTANCED_ARRAYS)] = true; + _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; + _features[static_cast(Feature::BLEND_MINMAX)] = true; + _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; - if (checkExtension("color_buffer_float")) - _features[(int)Feature::COLOR_FLOAT] = true; + uint minorVersion = static_cast(_context)->minorVer(); + if (minorVersion) { + _features[static_cast(Feature::COMPUTE_SHADER)] = true; + } - if (checkExtension("color_buffer_half_float")) - _features[(int)Feature::COLOR_HALF_FLOAT] = true; + if (checkExtension("color_buffer_float")) { + _features[static_cast(Feature::COLOR_FLOAT)] = true; + } - if (checkExtension("texture_float_linear")) - _features[(int)Feature::TEXTURE_FLOAT_LINEAR] = true; + if (checkExtension("color_buffer_half_float")) { + _features[static_cast(Feature::COLOR_HALF_FLOAT)] = true; + } - if (checkExtension("texture_half_float_linear")) - _features[(int)Feature::TEXTURE_HALF_FLOAT_LINEAR] = true; + if (checkExtension("texture_float_linear")) { + _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = true; + } + + if (checkExtension("texture_half_float_linear")) { + _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; + } String compressedFmts; if (checkExtension("compressed_ETC1")) { - _features[(int)Feature::FORMAT_ETC1] = true; + _features[static_cast(Feature::FORMAT_ETC1)] = true; compressedFmts += "etc1 "; } - _features[(int)Feature::FORMAT_ETC2] = true; + _features[static_cast(Feature::FORMAT_ETC2)] = true; compressedFmts += "etc2 "; if (checkExtension("texture_compression_pvrtc")) { - _features[(int)Feature::FORMAT_PVRTC] = true; + _features[static_cast(Feature::FORMAT_PVRTC)] = true; compressedFmts += "pvrtc "; } if (checkExtension("texture_compression_astc")) { - _features[(int)Feature::FORMAT_ASTC] = true; + _features[static_cast(Feature::FORMAT_ASTC)] = true; compressedFmts += "astc "; } - _features[static_cast(Feature::DEPTH_BOUNDS)] = true; - _features[static_cast(Feature::LINE_WIDTH)] = true; + _features[static_cast(Feature::DEPTH_BOUNDS)] = true; + _features[static_cast(Feature::LINE_WIDTH)] = true; _features[static_cast(Feature::STENCIL_COMPARE_MASK)] = true; - _features[static_cast(Feature::STENCIL_WRITE_MASK)] = true; - _features[static_cast(Feature::FORMAT_RGB8)] = true; - _features[static_cast(Feature::FORMAT_D16)] = true; - _features[static_cast(Feature::FORMAT_D24)] = true; - _features[static_cast(Feature::FORMAT_D32F)] = true; - _features[static_cast(Feature::FORMAT_D24S8)] = true; - _features[static_cast(Feature::FORMAT_D32FS8)] = true; + _features[static_cast(Feature::STENCIL_WRITE_MASK)] = true; + _features[static_cast(Feature::FORMAT_RGB8)] = true; + _features[static_cast(Feature::FORMAT_D16)] = true; + _features[static_cast(Feature::FORMAT_D24)] = true; + _features[static_cast(Feature::FORMAT_D32F)] = true; + _features[static_cast(Feature::FORMAT_D24S8)] = true; + _features[static_cast(Feature::FORMAT_D32FS8)] = true; - _renderer = (const char *)glGetString(GL_RENDERER); - _vendor = (const char *)glGetString(GL_VENDOR); - _version = (const char *)glGetString(GL_VERSION); + _renderer = reinterpret_cast(glGetString(GL_RENDERER)); + _vendor = reinterpret_cast(glGetString(GL_VENDOR)); + _version = reinterpret_cast(glGetString(GL_VERSION)); CC_LOG_INFO("GLES3 device initialized."); CC_LOG_INFO("RENDERER: %s", _renderer.c_str()); @@ -147,44 +166,60 @@ bool GLES3Device::initialize(const DeviceInfo &info) { CC_LOG_INFO("NATIVE_SIZE: %d x %d", _nativeWidth, _nativeHeight); CC_LOG_INFO("COMPRESSED_FORMATS: %s", compressedFmts.c_str()); - QueueInfo queueInfo; - queueInfo.type = QueueType::GRAPHICS; - _queue = createQueue(queueInfo); + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, reinterpret_cast(&_caps.maxVertexAttributes)); + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, reinterpret_cast(&_caps.maxVertexUniformVectors)); + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, reinterpret_cast(&_caps.maxFragmentUniformVectors)); + glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, reinterpret_cast(&_caps.maxUniformBufferBindings)); + glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, reinterpret_cast(&_caps.maxUniformBlockSize)); + glGetIntegerv(GL_MAX_DRAW_BUFFERS, reinterpret_cast(&_caps.maxColorRenderTargets)); + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, reinterpret_cast(&_caps.maxTextureUnits)); + glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, reinterpret_cast(&_caps.maxVertexTextureUnits)); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, reinterpret_cast(&_caps.maxTextureSize)); + glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, reinterpret_cast(&_caps.maxCubeMapTextureSize)); + glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, reinterpret_cast(&_caps.uboOffsetAlignment)); + glGetIntegerv(GL_DEPTH_BITS, reinterpret_cast(&_caps.depthBits)); + glGetIntegerv(GL_STENCIL_BITS, reinterpret_cast(&_caps.stencilBits)); - CommandBufferInfo cmdBuffInfo; - cmdBuffInfo.type = CommandBufferType::PRIMARY; - cmdBuffInfo.queue = _queue; - _cmdBuff = createCommandBuffer(cmdBuffInfo); + if (minorVersion) { + glGetIntegerv(GL_MAX_IMAGE_UNITS, reinterpret_cast(&_caps.maxImageUnits)); + glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, reinterpret_cast(&_caps.maxShaderStorageBlockSize)); + glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, reinterpret_cast(&_caps.maxShaderStorageBufferBindings)); + glGetIntegerv(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE, reinterpret_cast(&_caps.maxComputeSharedMemorySize)); + glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, reinterpret_cast(&_caps.maxComputeWorkGroupInvocations)); + glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, reinterpret_cast(&_caps.maxComputeWorkGroupSize.x)); + glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, reinterpret_cast(&_caps.maxComputeWorkGroupSize.y)); + glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, reinterpret_cast(&_caps.maxComputeWorkGroupSize.z)); + glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, reinterpret_cast(&_caps.maxComputeWorkGroupCount.x)); + glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, reinterpret_cast(&_caps.maxComputeWorkGroupCount.y)); + glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, reinterpret_cast(&_caps.maxComputeWorkGroupCount.z)); + } - glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)&_maxVertexAttributes); - glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, (GLint *)&_maxVertexUniformVectors); - glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, (GLint *)&_maxFragmentUniformVectors); - glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)&_maxUniformBufferBindings); - glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, (GLint *)&_maxUniformBlockSize); - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)&_maxTextureUnits); - glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, (GLint *)&_maxVertexTextureUnits); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&_maxTextureSize); - glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, (GLint *)&_maxCubeMapTextureSize); - glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, (GLint *)&_uboOffsetAlignment); - glGetIntegerv(GL_DEPTH_BITS, (GLint *)&_depthBits); - glGetIntegerv(GL_STENCIL_BITS, (GLint *)&_stencilBits); - - _gpuStateCache->initialize(_maxTextureUnits, _maxUniformBufferBindings, _maxVertexAttributes); + _gpuStateCache->initialize(_caps.maxTextureUnits, _caps.maxImageUnits, _caps.maxUniformBufferBindings, _caps.maxShaderStorageBufferBindings, _caps.maxVertexAttributes); return true; } -void GLES3Device::destroy() { - CC_SAFE_DESTROY(_queue); - CC_SAFE_DESTROY(_cmdBuff); - CC_SAFE_DELETE(_gpuStagingBufferPool); - CC_SAFE_DELETE(_gpuStateCache); - CC_SAFE_DESTROY(_deviceContext); - CC_SAFE_DESTROY(_renderContext); +void GLES3Device::doDestroy() { + CC_SAFE_DELETE(_gpuFramebufferCacheMap) + CC_SAFE_DELETE(_gpuStagingBufferPool) + CC_SAFE_DELETE(_gpuStateCache) + + CC_SAFE_DESTROY(_cmdBuff) + CC_SAFE_DESTROY(_queue) + CC_SAFE_DESTROY(_deviceContext) + CC_SAFE_DESTROY(_renderContext) +} + +void GLES3Device::releaseSurface(const uintptr_t windowHandle) { + static_cast(_context)->releaseSurface(windowHandle); +} + +void GLES3Device::acquireSurface(const uintptr_t windowHandle) { + static_cast(_context)->acquireSurface(windowHandle); } void GLES3Device::resize(uint width, uint height) { - _width = width; + _width = width; _height = height; } @@ -193,7 +228,7 @@ void GLES3Device::acquire() { } void GLES3Device::present() { - GLES3Queue *queue = (GLES3Queue *)_queue; + auto *queue = static_cast(_queue); _numDrawCalls = queue->_numDrawCalls; _numInstances = queue->_numInstances; _numTriangles = queue->_numTriangles; @@ -207,11 +242,12 @@ void GLES3Device::present() { } void GLES3Device::bindRenderContext(bool bound) { - _renderContext->MakeCurrent(bound); + _renderContext->makeCurrent(bound); _context = bound ? _renderContext : nullptr; if (bound) { _threadID = std::hash()(std::this_thread::get_id()); + _gpuStateCache->reset(); } } @@ -219,78 +255,85 @@ void GLES3Device::bindDeviceContext(bool bound) { if (!_deviceContext) { ContextInfo ctxInfo; ctxInfo.windowHandle = _windowHandle; - ctxInfo.sharedCtx = _renderContext; + ctxInfo.sharedCtx = _renderContext; - _deviceContext = CC_NEW(GLES3Context(this)); + _deviceContext = CC_NEW(GLES3Context); _deviceContext->initialize(ctxInfo); } - _deviceContext->MakeCurrent(bound); + _deviceContext->makeCurrent(bound); _context = bound ? _deviceContext : nullptr; if (bound) { _threadID = std::hash()(std::this_thread::get_id()); + _gpuStateCache->reset(); } } -CommandBuffer *GLES3Device::doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) { - if (hasAgent || info.type == CommandBufferType::PRIMARY) return CC_NEW(GLES3PrimaryCommandBuffer(this)); - return CC_NEW(GLES3CommandBuffer(this)); -} +uint GLES3Device::getMinorVersion() const { return static_cast(_context)->minorVer(); } -Fence *GLES3Device::createFence() { - return CC_NEW(GLES3Fence(this)); +CommandBuffer *GLES3Device::createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) { + if (hasAgent || info.type == CommandBufferType::PRIMARY) return CC_NEW(GLES3PrimaryCommandBuffer); + return CC_NEW(GLES3CommandBuffer); } Queue *GLES3Device::createQueue() { - return CC_NEW(GLES3Queue(this)); + return CC_NEW(GLES3Queue); } Buffer *GLES3Device::createBuffer() { - return CC_NEW(GLES3Buffer(this)); + return CC_NEW(GLES3Buffer); } Texture *GLES3Device::createTexture() { - return CC_NEW(GLES3Texture(this)); + return CC_NEW(GLES3Texture); } Sampler *GLES3Device::createSampler() { - return CC_NEW(GLES3Sampler(this)); + return CC_NEW(GLES3Sampler); } Shader *GLES3Device::createShader() { - return CC_NEW(GLES3Shader(this)); + return CC_NEW(GLES3Shader); } InputAssembler *GLES3Device::createInputAssembler() { - return CC_NEW(GLES3InputAssembler(this)); + return CC_NEW(GLES3InputAssembler); } RenderPass *GLES3Device::createRenderPass() { - return CC_NEW(GLES3RenderPass(this)); + return CC_NEW(GLES3RenderPass); } Framebuffer *GLES3Device::createFramebuffer() { - return CC_NEW(GLES3Framebuffer(this)); + return CC_NEW(GLES3Framebuffer); } DescriptorSet *GLES3Device::createDescriptorSet() { - return CC_NEW(GLES3DescriptorSet(this)); + return CC_NEW(GLES3DescriptorSet); } DescriptorSetLayout *GLES3Device::createDescriptorSetLayout() { - return CC_NEW(GLES3DescriptorSetLayout(this)); + return CC_NEW(GLES3DescriptorSetLayout); } PipelineLayout *GLES3Device::createPipelineLayout() { - return CC_NEW(GLES3PipelineLayout(this)); + return CC_NEW(GLES3PipelineLayout); } PipelineState *GLES3Device::createPipelineState() { - return CC_NEW(GLES3PipelineState(this)); + return CC_NEW(GLES3PipelineState); +} + +GlobalBarrier *GLES3Device::createGlobalBarrier() { + return CC_NEW(GLES3GlobalBarrier); +} + +TextureBarrier *GLES3Device::createTextureBarrier() { + return CC_NEW(TextureBarrier); } void GLES3Device::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { - GLES3CmdFuncCopyBuffersToTexture(this, buffers, ((GLES3Texture *)dst)->gpuTexture(), regions, count); + cmdFuncGLES3CopyBuffersToTexture(this, buffers, static_cast(dst)->gpuTexture(), regions, count); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.h b/native/cocos/renderer/gfx-gles3/GLES3Device.h index 4d6fd6963b..72ad27874f 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_DEVICE_H_ -#define CC_GFXGLES3_DEVICE_H_ + +#pragma once + +#include "GLES3Std.h" +#include "gfx-base/GFXDevice.h" namespace cc { namespace gfx { @@ -30,80 +34,91 @@ namespace gfx { class GLES3Context; class GLES3GPUStateCache; class GLES3GPUStagingBufferPool; +class GLES3GPUFramebufferCacheMap; class CC_GLES3_API GLES3Device final : public Device { public: - GLES3Device(); - ~GLES3Device(); + static GLES3Device *getInstance(); - using Device::createCommandBuffer; - using Device::createFence; - using Device::createQueue; + ~GLES3Device() override; + + using Device::copyBuffersToTexture; using Device::createBuffer; - using Device::createTexture; - using Device::createSampler; - using Device::createShader; - using Device::createInputAssembler; - using Device::createRenderPass; - using Device::createFramebuffer; + using Device::createCommandBuffer; using Device::createDescriptorSet; using Device::createDescriptorSetLayout; + using Device::createFramebuffer; + using Device::createGlobalBarrier; + using Device::createInputAssembler; using Device::createPipelineLayout; using Device::createPipelineState; - using Device::copyBuffersToTexture; + using Device::createQueue; + using Device::createRenderPass; + using Device::createSampler; + using Device::createShader; + using Device::createTexture; + using Device::createTextureBarrier; - virtual bool initialize(const DeviceInfo &info) override; - virtual void destroy() override; - virtual void resize(uint width, uint height) override; - virtual void acquire() override; - virtual void present() override; + void resize(uint width, uint height) override; + void acquire() override; + void present() override; - CC_INLINE GLES3GPUStateCache *stateCache() const { return _gpuStateCache; } - CC_INLINE GLES3GPUStagingBufferPool *stagingBufferPool() const { return _gpuStagingBufferPool; } + inline GLES3GPUStateCache * stateCache() const { return _gpuStateCache; } + inline GLES3GPUStagingBufferPool * stagingBufferPool() const { return _gpuStagingBufferPool; } + inline GLES3GPUFramebufferCacheMap *framebufferCacheMap() const { return _gpuFramebufferCacheMap; } + inline uint getThreadID() const { return _threadID; } - CC_INLINE bool checkExtension(const String &extension) const { - for (size_t i = 0; i < _extensions.size(); ++i) { - if (_extensions[i].find(extension) != String::npos) { - return true; - } - } - return false; + inline bool checkExtension(const String &extension) const { + return std::any_of(_extensions.begin(), _extensions.end(), [&extension](auto &ext) { + return ext.find(extension) != String::npos; + }); } - CC_INLINE uint getThreadID() const { return _threadID; } + uint getMinorVersion() const; protected: - virtual CommandBuffer *doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; - virtual Fence *createFence() override; - virtual Queue *createQueue() override; - virtual Buffer *createBuffer() override; - virtual Texture *createTexture() override; - virtual Sampler *createSampler() override; - virtual Shader *createShader() override; - virtual InputAssembler *createInputAssembler() override; - virtual RenderPass *createRenderPass() override; - virtual Framebuffer *createFramebuffer() override; - virtual DescriptorSet *createDescriptorSet() override; - virtual DescriptorSetLayout *createDescriptorSetLayout() override; - virtual PipelineLayout *createPipelineLayout() override; - virtual PipelineState *createPipelineState() override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; + static GLES3Device *instance; - virtual void bindRenderContext(bool bound) override; - virtual void bindDeviceContext(bool bound) override; + friend class DeviceManager; + friend class GLES3Context; -private: - GLES3Context *_renderContext = nullptr; - GLES3Context *_deviceContext = nullptr; - GLES3GPUStateCache *_gpuStateCache = nullptr; - GLES3GPUStagingBufferPool *_gpuStagingBufferPool = nullptr; + GLES3Device(); + + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; + CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; + Queue * createQueue() override; + Buffer * createBuffer() override; + Texture * createTexture() override; + Sampler * createSampler() override; + Shader * createShader() override; + InputAssembler * createInputAssembler() override; + RenderPass * createRenderPass() override; + Framebuffer * createFramebuffer() override; + DescriptorSet * createDescriptorSet() override; + DescriptorSetLayout *createDescriptorSetLayout() override; + PipelineLayout * createPipelineLayout() override; + PipelineState * createPipelineState() override; + GlobalBarrier * createGlobalBarrier() override; + TextureBarrier * createTextureBarrier() override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; + + void releaseSurface(uintptr_t windowHandle) override; + void acquireSurface(uintptr_t windowHandle) override; + + void bindRenderContext(bool bound) override; + void bindDeviceContext(bool bound) override; + + GLES3Context * _renderContext = nullptr; + GLES3Context * _deviceContext = nullptr; + GLES3GPUStateCache * _gpuStateCache = nullptr; + GLES3GPUStagingBufferPool * _gpuStagingBufferPool = nullptr; + GLES3GPUFramebufferCacheMap *_gpuFramebufferCacheMap = nullptr; StringArray _extensions; - uint _threadID = 0u; + uint _threadID = 0U; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Fence.cpp b/native/cocos/renderer/gfx-gles3/GLES3Fence.cpp deleted file mode 100644 index b88e0cb1c7..0000000000 --- a/native/cocos/renderer/gfx-gles3/GLES3Fence.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "GLES3Std.h" -#include "GLES3Fence.h" -#include "GLES3Device.h" -#include "GLES3GPUObjects.h" - -namespace cc { -namespace gfx { - -GLES3Fence::GLES3Fence(Device *device) -: Fence(device) { -} - -GLES3Fence::~GLES3Fence() { -} - -bool GLES3Fence::initialize(const FenceInfo &info) { - _gpuFence = CC_NEW(GLES3GPUFence); - if (!_gpuFence) { - CC_LOG_ERROR("GLES2Fence: CC_NEW GLES3GPUFence failed."); - return false; - } - - // TODO - - return true; -} - -void GLES3Fence::destroy() { - if (_gpuFence) { - // TODO - - CC_DELETE(_gpuFence); - _gpuFence = nullptr; - } -} - -void GLES3Fence::wait() { - // TODO -} - -void GLES3Fence::reset() { - // TODO -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/gfx-gles3/GLES3Fence.h b/native/cocos/renderer/gfx-gles3/GLES3Fence.h deleted file mode 100644 index df11e05b8a..0000000000 --- a/native/cocos/renderer/gfx-gles3/GLES3Fence.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 CC_GFXGLES3_FENCE_H_ -#define CC_GFXGLES3_FENCE_H_ - -namespace cc { -namespace gfx { - -class GLES3GPUFence; - -class CC_GLES3_API GLES3Fence final : public Fence { -public: - GLES3Fence(Device *device); - ~GLES3Fence(); - -public: - virtual bool initialize(const FenceInfo &info) override; - virtual void destroy() override; - virtual void wait() override; - virtual void reset() override; - -private: - GLES3GPUFence *_gpuFence = nullptr; -}; - -} // namespace gfx -} // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp index 22b463a56d..45ca5e241b 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp @@ -1,50 +1,48 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" + +#include "GLES3Commands.h" +#include "GLES3Device.h" #include "GLES3Framebuffer.h" #include "GLES3RenderPass.h" -#include "GLES3Commands.h" #include "GLES3Texture.h" namespace cc { namespace gfx { -GLES3Framebuffer::GLES3Framebuffer(Device *device) -: Framebuffer(device) { -} +GLES3Framebuffer::GLES3Framebuffer() = default; GLES3Framebuffer::~GLES3Framebuffer() { + destroy(); } -bool GLES3Framebuffer::initialize(const FramebufferInfo &info) { - - _renderPass = info.renderPass; - _colorTextures = info.colorTextures; - _depthStencilTexture = info.depthStencilTexture; - - _gpuFBO = CC_NEW(GLES3GPUFramebuffer); - _gpuFBO->gpuRenderPass = ((GLES3RenderPass *)_renderPass)->gpuRenderPass(); +void GLES3Framebuffer::doInit(const FramebufferInfo &info) { + _gpuFBO = CC_NEW(GLES3GPUFramebuffer); + _gpuFBO->gpuRenderPass = static_cast(_renderPass)->gpuRenderPass(); _gpuFBO->depthStencilMipmapLevel = info.depthStencilMipmapLevel; for (uint mipLevel : info.colorMipmapLevels) { _gpuFBO->colorMipmapLevels.push_back(mipLevel); @@ -52,24 +50,22 @@ bool GLES3Framebuffer::initialize(const FramebufferInfo &info) { _gpuFBO->gpuColorTextures.resize(_colorTextures.size()); for (size_t i = 0; i < _colorTextures.size(); ++i) { - GLES3Texture *colorTexture = (GLES3Texture *)_colorTextures[i]; + auto *colorTexture = static_cast(_colorTextures[i]); if (colorTexture) { _gpuFBO->gpuColorTextures[i] = colorTexture->gpuTexture(); } } if (_depthStencilTexture) { - _gpuFBO->gpuDepthStencilTexture = ((GLES3Texture *)_depthStencilTexture)->gpuTexture(); + _gpuFBO->gpuDepthStencilTexture = static_cast(_depthStencilTexture)->gpuTexture(); } - GLES3CmdFuncCreateFramebuffer((GLES3Device *)_device, _gpuFBO); - - return true; + cmdFuncGLES3CreateFramebuffer(GLES3Device::getInstance(), _gpuFBO); } -void GLES3Framebuffer::destroy() { +void GLES3Framebuffer::doDestroy() { if (_gpuFBO) { - GLES3CmdFuncDestroyFramebuffer((GLES3Device *)_device, _gpuFBO); + cmdFuncGLES3DestroyFramebuffer(GLES3Device::getInstance(), _gpuFBO); CC_DELETE(_gpuFBO); _gpuFBO = nullptr; } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h index ccb3307871..b428502b5b 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Framebuffer.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_FRAMEBUFFER_H_ -#define CC_GFXGLES3_FRAMEBUFFER_H_ + +#pragma once + +#include "gfx-base/GFXFramebuffer.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES3GPUFramebuffer; class CC_GLES3_API GLES3Framebuffer final : public Framebuffer { public: - GLES3Framebuffer(Device *device); + GLES3Framebuffer(); ~GLES3Framebuffer(); -public: - virtual bool initialize(const FramebufferInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPUFramebuffer *gpuFBO() const { return _gpuFBO; } -private: +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; + GLES3GPUFramebuffer *_gpuFBO = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h index 54155f4264..2c3bbb9e2e 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h +++ b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h @@ -1,194 +1,218 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_GPU_OBJECTS_H_ -#define CC_GFXGLES3_GPU_OBJECTS_H_ -#include "gles3w.h" +#pragma once + +#include + +#include "gfx-base/GFXDef.h" + +#include "GLES3Std.h" +#include "GLES3Wrangler.h" namespace cc { namespace gfx { class GLES3GPUBuffer final : public Object { public: - BufferUsage usage = BufferUsage::NONE; - MemoryUsage memUsage = MemoryUsage::NONE; - uint size = 0; - uint stride = 0; - uint count = 0; - GLenum glTarget = 0; - GLuint glBuffer = 0; - GLuint glOffset = 0; - uint8_t *buffer = nullptr; + BufferUsage usage = BufferUsage::NONE; + MemoryUsage memUsage = MemoryUsage::NONE; + uint size = 0; + uint stride = 0; + uint count = 0; + GLenum glTarget = 0; + GLuint glBuffer = 0; + GLuint glOffset = 0; + uint8_t * buffer = nullptr; DrawInfoList indirects; }; -typedef vector GLES3GPUBufferList; +using GLES3GPUBufferList = vector; class GLES3GPUTexture final : public Object { public: - TextureType type = TextureType::TEX2D; - Format format = Format::UNKNOWN; - TextureUsage usage = TextureUsageBit::NONE; - uint width = 0; - uint height = 0; - uint depth = 1; - uint size = 0; - uint arrayLayer = 1; - uint mipLevel = 1; - SampleCount samples = SampleCount::X1; - TextureFlags flags = TextureFlagBit::NONE; - bool isPowerOf2 = false; - GLenum glTarget = 0; - GLenum glInternelFmt = 0; - GLenum glFormat = 0; - GLenum glType = 0; - GLenum glUsage = 0; - GLuint glTexture = 0; - GLenum glWrapS = 0; - GLenum glWrapT = 0; - GLenum glMinFilter = 0; - GLenum glMagFilter = 0; + TextureType type = TextureType::TEX2D; + Format format = Format::UNKNOWN; + TextureUsage usage = TextureUsageBit::NONE; + uint width = 0; + uint height = 0; + uint depth = 1; + uint size = 0; + uint arrayLayer = 1; + uint mipLevel = 1; + SampleCount samples = SampleCount::X1; + TextureFlags flags = TextureFlagBit::NONE; + bool isPowerOf2 = false; + GLenum glTarget = 0; + GLenum glInternelFmt = 0; + GLenum glFormat = 0; + GLenum glType = 0; + GLenum glUsage = 0; + GLuint glTexture = 0; + GLenum glWrapS = 0; + GLenum glWrapT = 0; + GLenum glMinFilter = 0; + GLenum glMagFilter = 0; }; -typedef vector GLES3GPUTextureList; +using GLES3GPUTextureList = vector; class GLES3GPUSampler final : public Object { public: - Filter minFilter = Filter::NONE; - Filter magFilter = Filter::NONE; - Filter mipFilter = Filter::NONE; - Address addressU = Address::CLAMP; - Address addressV = Address::CLAMP; - Address addressW = Address::CLAMP; - uint minLOD = 0; - uint maxLOD = 1000; - GLuint glSampler = 0; - GLenum glMinFilter = 0; - GLenum glMagFilter = 0; - GLenum glWrapS = 0; - GLenum glWrapT = 0; - GLenum glWrapR = 0; + Filter minFilter = Filter::NONE; + Filter magFilter = Filter::NONE; + Filter mipFilter = Filter::NONE; + Address addressU = Address::CLAMP; + Address addressV = Address::CLAMP; + Address addressW = Address::CLAMP; + GLuint glSampler = 0; + GLenum glMinFilter = 0; + GLenum glMagFilter = 0; + GLenum glWrapS = 0; + GLenum glWrapT = 0; + GLenum glWrapR = 0; }; struct GLES3GPUInput final { - uint binding = 0; + uint binding = 0; String name; - Type type = Type::UNKNOWN; - uint stride = 0; - uint count = 0; - uint size = 0; + Type type = Type::UNKNOWN; + uint stride = 0; + uint count = 0; + uint size = 0; GLenum glType = 0; - GLint glLoc = -1; + GLint glLoc = -1; }; -typedef vector GLES3GPUInputList; +using GLES3GPUInputList = vector; struct GLES3GPUUniform final { - uint binding = GFX_INVALID_BINDING; + uint binding = INVALID_BINDING; String name; - Type type = Type::UNKNOWN; - uint stride = 0; - uint count = 0; - uint size = 0; - uint offset = 0; + Type type = Type::UNKNOWN; + uint stride = 0; + uint count = 0; + uint size = 0; + uint offset = 0; GLenum glType = 0; - GLint glLoc = -1; + GLint glLoc = -1; }; -typedef vector GLES3GPUUniformList; +using GLES3GPUUniformList = vector; -struct GLES3GPUUniformBlock final { - uint set = GFX_INVALID_BINDING; - uint binding = GFX_INVALID_BINDING; - uint idx = 0; +struct GLES3GPUUniformBuffer final { + uint set = INVALID_BINDING; + uint binding = INVALID_BINDING; String name; - uint size = 0; - uint glBinding = GFX_INVALID_BINDING; - GLES3GPUUniformList glUniforms; - GLES3GPUUniformList glActiveUniforms; + uint size = 0; + uint glBinding = 0xffffffff; + bool isStorage = false; }; -typedef vector GLES3GPUUniformBlockList; +using GLES3GPUUniformBufferList = vector; -struct GLES3GPUUniformSampler final { - uint set = 0; - uint binding = 0; +struct GLES3GPUUniformSamplerTexture final { + uint set = 0; + uint binding = 0; String name; - Type type = Type::UNKNOWN; - uint count = 0u; + Type type = Type::UNKNOWN; + uint count = 0U; vector units; - GLenum glType = 0; - GLint glLoc = -1; + GLenum glType = 0; + GLint glLoc = -1; }; -typedef vector GLES3GPUUniformSamplerList; +using GLES3GPUUniformSamplerTextureList = vector; + +struct GLES3GPUUniformStorageImage final { + uint set = 0; + uint binding = 0; + String name; + Type type = Type::UNKNOWN; + uint count = 0U; + + vector units; + GLenum glMemoryAccess = GL_READ_WRITE; + GLint glLoc = -1; +}; +using GLES3GPUUniformStorageImageList = vector; struct GLES3GPUShaderStage final { GLES3GPUShaderStage(ShaderStageFlagBit t, String s, GLuint shader = 0) - : type(t), source(s), glShader(shader) {} + : type(t), + source(std::move(std::move(s))), + glShader(shader) {} ShaderStageFlagBit type; - String source; - GLuint glShader = 0; + String source; + GLuint glShader = 0; }; -typedef vector GLES3GPUShaderStageList; +using GLES3GPUShaderStageList = vector; class GLES3GPUShader final : public Object { public: - String name; - UniformBlockList blocks; - UniformSamplerList samplers; - GLuint glProgram = 0; - GLES3GPUShaderStageList gpuStages; - GLES3GPUInputList glInputs; - GLES3GPUUniformBlockList glBlocks; - GLES3GPUUniformSamplerList glSamplers; + String name; + UniformBlockList blocks; + UniformStorageBufferList buffers; + UniformSamplerTextureList samplerTextures; + UniformSamplerList samplers; + UniformTextureList textures; + UniformStorageImageList images; + UniformInputAttachmentList subpassInputs; + + GLES3GPUShaderStageList gpuStages; + GLuint glProgram = 0; + GLES3GPUInputList glInputs; + GLES3GPUUniformBufferList glBuffers; + GLES3GPUUniformSamplerTextureList glSamplerTextures; + GLES3GPUUniformStorageImageList glImages; }; struct GLES3GPUAttribute final { String name; - GLuint glBuffer = 0; - GLenum glType = 0; - uint size = 0; - uint count = 0; - uint stride = 1; - uint componentCount = 1; - bool isNormalized = false; - bool isInstanced = false; - uint offset = 0; + GLuint glBuffer = 0; + GLenum glType = 0; + uint size = 0; + uint count = 0; + uint stride = 1; + uint componentCount = 1; + bool isNormalized = false; + bool isInstanced = false; + uint offset = 0; }; -typedef vector GLES3GPUAttributeList; +using GLES3GPUAttributeList = vector; class GLES3GPUInputAssembler final : public Object { public: - AttributeList attributes; - GLES3GPUBufferList gpuVertexBuffers; - GLES3GPUBuffer *gpuIndexBuffer = nullptr; - GLES3GPUBuffer *gpuIndirectBuffer = nullptr; + AttributeList attributes; + GLES3GPUBufferList gpuVertexBuffers; + GLES3GPUBuffer * gpuIndexBuffer = nullptr; + GLES3GPUBuffer * gpuIndirectBuffer = nullptr; GLES3GPUAttributeList glAttribs; - GLenum glIndexType = 0; - map glVAOs; + GLenum glIndexType = 0; + map glVAOs; }; class GLES3GPURenderPass final : public Object { public: - ColorAttachmentList colorAttachments; + ColorAttachmentList colorAttachments; DepthStencilAttachment depthStencilAttachment; }; @@ -196,23 +220,23 @@ class GLES3GPUFramebuffer final : public Object { public: GLES3GPURenderPass *gpuRenderPass = nullptr; GLES3GPUTextureList gpuColorTextures; - vector colorMipmapLevels; - GLES3GPUTexture *gpuDepthStencilTexture = nullptr; - GLint depthStencilMipmapLevel = 0; - GLuint glFramebuffer = 0; - bool isOffscreen = false; + vector colorMipmapLevels; + GLES3GPUTexture * gpuDepthStencilTexture = nullptr; + GLint depthStencilMipmapLevel = 0; + GLuint glFramebuffer = 0; + bool isOffscreen = false; }; class GLES3GPUDescriptorSetLayout final : public Object { public: DescriptorSetLayoutBindingList bindings; - vector dynamicBindings; + vector dynamicBindings; vector bindingIndices; vector descriptorIndices; - uint descriptorCount = 0u; + uint descriptorCount = 0U; }; -typedef vector GLES3GPUDescriptorSetLayoutList; +using GLES3GPUDescriptorSetLayoutList = vector; class GLES3GPUPipelineLayout final : public Object { public: @@ -220,126 +244,206 @@ public: // helper storages vector> dynamicOffsetIndices; - vector dynamicOffsetOffsets; - vector dynamicOffsets; - uint dynamicOffsetCount; + vector dynamicOffsetOffsets; + vector dynamicOffsets; + uint dynamicOffsetCount; }; class GLES3GPUPipelineState final : public Object { public: - GLenum glPrimitive = GL_TRIANGLES; - GLES3GPUShader *gpuShader = nullptr; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - DynamicStateList dynamicStates; - GLES3GPUPipelineLayout *gpuLayout = nullptr; - GLES3GPURenderPass *gpuRenderPass = nullptr; + GLenum glPrimitive = GL_TRIANGLES; + GLES3GPUShader * gpuShader = nullptr; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + DynamicStateList dynamicStates; + GLES3GPUPipelineLayout *gpuLayout = nullptr; + GLES3GPURenderPass * gpuRenderPass = nullptr; GLES3GPUPipelineLayout *gpuPipelineLayout = nullptr; }; struct GLES3GPUDescriptor final { - DescriptorType type = DescriptorType::UNKNOWN; - GLES3GPUBuffer *gpuBuffer = nullptr; + DescriptorType type = DescriptorType::UNKNOWN; + GLES3GPUBuffer * gpuBuffer = nullptr; GLES3GPUTexture *gpuTexture = nullptr; GLES3GPUSampler *gpuSampler = nullptr; }; -typedef vector GLES3GPUDescriptorList; +using GLES3GPUDescriptorList = vector; class GLES3GPUDescriptorSet final : public Object { public: GLES3GPUDescriptorList gpuDescriptors; - const vector *descriptorIndices = nullptr; + const vector * descriptorIndices = nullptr; }; -class GLES3GPUFence final : public Object { +class GLES3GPUGlobalBarrier final : public Object { public: + GLbitfield glBarriers = 0U; + GLbitfield glBarriersByRegion = 0U; +}; + +struct GLES3GPUDispatchInfo final : public Object { + uint groupCountX = 0; + uint groupCountY = 0; + uint groupCountZ = 0; + + GLES3GPUBuffer *indirectBuffer = nullptr; + uint indirectOffset = 0; }; struct GLES3ObjectCache final { - size_t numClearColors = 0u; - GLES3GPURenderPass *gpuRenderPass = nullptr; - GLES3GPUFramebuffer *gpuFramebuffer = nullptr; - GLES3GPUPipelineState *gpuPipelineState = nullptr; + size_t numClearColors = 0U; + GLES3GPURenderPass * gpuRenderPass = nullptr; + GLES3GPUFramebuffer * gpuFramebuffer = nullptr; + GLES3GPUPipelineState * gpuPipelineState = nullptr; GLES3GPUInputAssembler *gpuInputAssembler = nullptr; - bool reverseCW = false; - GLenum glPrimitive = 0; - GLenum invalidAttachments[GFX_MAX_ATTACHMENTS]; + GLenum glPrimitive = 0; + GLenum invalidAttachments[MAX_ATTACHMENTS]; }; class GLES3GPUStateCache final : public Object { public: - GLuint glArrayBuffer = 0; - GLuint glElementArrayBuffer = 0; - GLuint glUniformBuffer = 0; - vector glBindUBOs; - vector glBindUBOOffsets; - GLuint glVAO = 0; - uint texUint = 0; - vector glTextures; - vector glSamplers; - GLuint glProgram = 0; - vector glEnabledAttribLocs; - vector glCurrentAttribLocs; - GLuint glFramebuffer = 0; - GLuint glReadFBO = 0; - Viewport viewport; - Rect scissor; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - bool isCullFaceEnabled = true; - bool isStencilTestEnabled = false; - map texUnitCacheMap; - GLES3ObjectCache gfxStateCache; + GLuint glArrayBuffer = 0; + GLuint glElementArrayBuffer = 0; + GLuint glUniformBuffer = 0; + vector glBindUBOs; + vector glBindUBOOffsets; + GLuint glShaderStorageBuffer = 0; + vector glBindSSBOs; + vector glBindSSBOOffsets; + GLuint glDispatchIndirectBuffer = 0; + GLuint glVAO = 0; + uint texUint = 0; + vector glTextures; + vector glImages; + vector glSamplers; + GLuint glProgram = 0; + vector glEnabledAttribLocs; + vector glCurrentAttribLocs; + GLuint glReadFramebuffer = 0; + GLuint glDrawFramebuffer = 0; + Viewport viewport; + Rect scissor; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + bool isCullFaceEnabled = true; + bool isStencilTestEnabled = false; + unordered_map texUnitCacheMap; + GLES3ObjectCache gfxStateCache; - void initialize(size_t texUnits, size_t bufferBindings, size_t vertexAttributes) { - glBindUBOs.resize(bufferBindings, 0u); - glBindUBOOffsets.resize(bufferBindings, 0u); - glTextures.resize(texUnits, 0u); - glSamplers.resize(texUnits, 0u); + void initialize(size_t texUnits, size_t imageUnits, size_t uboBindings, size_t ssboBindings, size_t vertexAttributes) { + glBindUBOs.resize(uboBindings, 0U); + glBindUBOOffsets.resize(uboBindings, 0U); + glBindSSBOs.resize(ssboBindings, 0U); + glBindSSBOOffsets.resize(ssboBindings, 0U); + glTextures.resize(texUnits, 0U); + glSamplers.resize(texUnits, 0U); + glImages.resize(imageUnits, 0U); glEnabledAttribLocs.resize(vertexAttributes, false); glCurrentAttribLocs.resize(vertexAttributes, false); } void reset() { - glArrayBuffer = 0; + glArrayBuffer = 0; glElementArrayBuffer = 0; - glUniformBuffer = 0; - glBindUBOs.assign(glBindUBOs.size(), 0u); - glBindUBOOffsets.assign(glBindUBOOffsets.size(), 0u); - glVAO = 0; - texUint = 0; - glTextures.assign(glTextures.size(), 0u); - glSamplers.assign(glSamplers.size(), 0u); + glUniformBuffer = 0; + glBindUBOs.assign(glBindUBOs.size(), 0U); + glBindUBOOffsets.assign(glBindUBOOffsets.size(), 0U); + glShaderStorageBuffer = 0; + glBindSSBOs.assign(glBindSSBOs.size(), 0U); + glBindSSBOOffsets.assign(glBindSSBOOffsets.size(), 0U); + glDispatchIndirectBuffer = 0; + glVAO = 0; + texUint = 0; + glTextures.assign(glTextures.size(), 0U); + glImages.assign(glImages.size(), 0U); + glSamplers.assign(glSamplers.size(), 0U); glProgram = 0; - glEnabledAttribLocs.assign(glEnabledAttribLocs.size(), 0u); - glCurrentAttribLocs.assign(glCurrentAttribLocs.size(), 0u); - glFramebuffer = 0; - glReadFBO = 0; - isCullFaceEnabled = true; + glEnabledAttribLocs.assign(glEnabledAttribLocs.size(), false); + glCurrentAttribLocs.assign(glCurrentAttribLocs.size(), false); + glReadFramebuffer = 0; + glDrawFramebuffer = 0; + isCullFaceEnabled = true; isStencilTestEnabled = false; viewport = Viewport(); - scissor = Rect(); - rs = RasterizerState(); - dss = DepthStencilState(); - bs = BlendState(); + scissor = Rect(); + rs = RasterizerState(); + dss = DepthStencilState(); + bs = BlendState(); - gfxStateCache.numClearColors = 0u; - gfxStateCache.gpuRenderPass = nullptr; - gfxStateCache.gpuFramebuffer = nullptr; - gfxStateCache.gpuPipelineState = nullptr; + gfxStateCache.numClearColors = 0U; + gfxStateCache.gpuRenderPass = nullptr; + gfxStateCache.gpuFramebuffer = nullptr; + gfxStateCache.gpuPipelineState = nullptr; gfxStateCache.gpuInputAssembler = nullptr; - gfxStateCache.glPrimitive = 0u; - gfxStateCache.reverseCW = false; + gfxStateCache.glPrimitive = 0U; } }; -constexpr size_t chunkSize = 16 * 1024 * 1024; // 16M per block by default +class GLES3GPUFramebufferCacheMap final : public Object { +public: + explicit GLES3GPUFramebufferCacheMap(GLES3GPUStateCache *cache) : _cache(cache) {} + + ~GLES3GPUFramebufferCacheMap() override = default; + + GLuint getFramebufferFromTexture(const GLES3GPUTexture *gpuTexture, const TextureSubresLayers &subres) { + // TODO(YunHsiao): single layer support using glFramebufferTextureLayer + + if (_map[gpuTexture->glTexture].empty()) _map[gpuTexture->glTexture].resize(gpuTexture->mipLevel, 0U); + + if (!_map[gpuTexture->glTexture][subres.mipLevel]) { + GLuint glFramebuffer = 0U; + GL_CHECK(glGenFramebuffers(1, &glFramebuffer)); + if (_cache->glDrawFramebuffer != glFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, glFramebuffer)); + _cache->glDrawFramebuffer = glFramebuffer; + } + + const FormatInfo &info = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)]; + GLenum attachment = GL_COLOR_ATTACHMENT0; + if (info.hasStencil) { + attachment = GL_DEPTH_STENCIL_ATTACHMENT; + } else if (info.hasDepth) { + attachment = GL_DEPTH_ATTACHMENT; + } + GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, gpuTexture->glTarget, gpuTexture->glTexture, subres.mipLevel)); + + GLenum status; + GL_CHECK(status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER)); + CCASSERT(status == GL_FRAMEBUFFER_COMPLETE, "frambuffer incomplete"); + + _map[gpuTexture->glTexture][subres.mipLevel] = glFramebuffer; + } + + return _map[gpuTexture->glTexture][subres.mipLevel]; + } + + void onTextureDestroy(const GLES3GPUTexture *gpuTexture) { + if (_map.count(gpuTexture->glTexture)) { + for (GLuint glFramebuffer : _map[gpuTexture->glTexture]) { + if (!glFramebuffer) continue; + + if (_cache->glDrawFramebuffer == glFramebuffer || _cache->glReadFramebuffer == glFramebuffer) { + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0)); + _cache->glDrawFramebuffer = _cache->glReadFramebuffer = 0; + } + GL_CHECK(glDeleteFramebuffers(1, &glFramebuffer)); + } + _map.erase(gpuTexture->glTexture); + } + } + +private: + GLES3GPUStateCache * _cache = nullptr; + unordered_map> _map; // texture -> mip level -> framebuffer +}; + +constexpr size_t CHUNK_SIZE = 16 * 1024 * 1024; // 16M per block by default class GLES3GPUStagingBufferPool final : public Object { public: - ~GLES3GPUStagingBufferPool() { + ~GLES3GPUStagingBufferPool() override { for (Buffer &buffer : _pool) { CC_FREE(buffer.mappedData); } @@ -347,19 +451,19 @@ public: } uint8_t *alloc(size_t size) { - size_t bufferCount = _pool.size(); - Buffer *buffer = nullptr; - for (size_t idx = 0u; idx < bufferCount; idx++) { + size_t bufferCount = _pool.size(); + Buffer *buffer = nullptr; + for (size_t idx = 0U; idx < bufferCount; idx++) { Buffer *cur = &_pool[idx]; - if (chunkSize - cur->curOffset >= size) { + if (CHUNK_SIZE - cur->curOffset >= size) { buffer = cur; break; } } if (!buffer) { _pool.resize(bufferCount + 1); - buffer = &_pool.back(); - buffer->mappedData = (uint8_t *)CC_MALLOC(chunkSize); + buffer = &_pool.back(); + buffer->mappedData = static_cast(CC_MALLOC(CHUNK_SIZE)); } uint8_t *data = buffer->mappedData + buffer->curOffset; buffer->curOffset += size; @@ -368,19 +472,17 @@ public: void reset() { for (Buffer &buffer : _pool) { - buffer.curOffset = 0u; + buffer.curOffset = 0U; } } private: struct Buffer { uint8_t *mappedData = nullptr; - size_t curOffset = 0u; + size_t curOffset = 0U; }; vector _pool; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.cpp b/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.cpp new file mode 100644 index 0000000000..de6774d493 --- /dev/null +++ b/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GLES3Std.h" + +#include "GLES3GPUObjects.h" +#include "GLES3GlobalBarrier.h" + +namespace cc { +namespace gfx { + +GLES3GlobalBarrier::GLES3GlobalBarrier() +: GlobalBarrier() { +} + +GLES3GlobalBarrier::~GLES3GlobalBarrier() { + CC_SAFE_DELETE(_gpuBarrier); +} + +void GLES3GlobalBarrier::doInit(const GlobalBarrierInfo &info) { + _gpuBarrier = CC_NEW(GLES3GPUGlobalBarrier); + + bool hasShaderWrites = false; + for (size_t i = 0u; i < info.prevAccesses.size(); ++i) { + switch (info.prevAccesses[i]) { + case AccessType::COMPUTE_SHADER_WRITE: + case AccessType::VERTEX_SHADER_WRITE: + case AccessType::FRAGMENT_SHADER_WRITE: + case AccessType::COLOR_ATTACHMENT_WRITE: + case AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE: + hasShaderWrites = true; + break; + default: + break; + } + } + + if (hasShaderWrites) { + for (size_t i = 0u; i < info.nextAccesses.size(); ++i) { + switch (info.nextAccesses[i]) { + case AccessType::INDIRECT_BUFFER: + _gpuBarrier->glBarriers |= GL_COMMAND_BARRIER_BIT; + break; + case AccessType::INDEX_BUFFER: + _gpuBarrier->glBarriers |= GL_ELEMENT_ARRAY_BARRIER_BIT; + break; + case AccessType::VERTEX_BUFFER: + _gpuBarrier->glBarriers |= GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT; + break; + case AccessType::COMPUTE_SHADER_READ_UNIFORM_BUFFER: + case AccessType::VERTEX_SHADER_READ_UNIFORM_BUFFER: + case AccessType::FRAGMENT_SHADER_READ_UNIFORM_BUFFER: + _gpuBarrier->glBarriersByRegion |= GL_UNIFORM_BARRIER_BIT; + break; + case AccessType::COMPUTE_SHADER_READ_TEXTURE: + case AccessType::VERTEX_SHADER_READ_TEXTURE: + case AccessType::FRAGMENT_SHADER_READ_TEXTURE: + case AccessType::FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT: + case AccessType::FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT: + _gpuBarrier->glBarriersByRegion |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; + _gpuBarrier->glBarriersByRegion |= GL_TEXTURE_FETCH_BARRIER_BIT; + break; + case AccessType::COMPUTE_SHADER_READ_OTHER: + case AccessType::VERTEX_SHADER_READ_OTHER: + case AccessType::FRAGMENT_SHADER_READ_OTHER: + _gpuBarrier->glBarriersByRegion |= GL_SHADER_STORAGE_BARRIER_BIT; + break; + case AccessType::COLOR_ATTACHMENT_READ: + case AccessType::DEPTH_STENCIL_ATTACHMENT_READ: + _gpuBarrier->glBarriersByRegion |= GL_FRAMEBUFFER_BARRIER_BIT; + break; + case AccessType::TRANSFER_READ: + _gpuBarrier->glBarriersByRegion |= GL_FRAMEBUFFER_BARRIER_BIT; + _gpuBarrier->glBarriers |= GL_TEXTURE_UPDATE_BARRIER_BIT; + _gpuBarrier->glBarriers |= GL_BUFFER_UPDATE_BARRIER_BIT; + _gpuBarrier->glBarriers |= GL_PIXEL_BUFFER_BARRIER_BIT; + break; + case AccessType::COMPUTE_SHADER_WRITE: + case AccessType::VERTEX_SHADER_WRITE: + case AccessType::FRAGMENT_SHADER_WRITE: + _gpuBarrier->glBarriersByRegion |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; + _gpuBarrier->glBarriersByRegion |= GL_SHADER_STORAGE_BARRIER_BIT; + break; + case AccessType::COLOR_ATTACHMENT_WRITE: + case AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE: + _gpuBarrier->glBarriersByRegion |= GL_FRAMEBUFFER_BARRIER_BIT; + break; + case AccessType::TRANSFER_WRITE: + _gpuBarrier->glBarriersByRegion |= GL_FRAMEBUFFER_BARRIER_BIT; + _gpuBarrier->glBarriers |= GL_TEXTURE_UPDATE_BARRIER_BIT; + _gpuBarrier->glBarriers |= GL_BUFFER_UPDATE_BARRIER_BIT; + _gpuBarrier->glBarriers |= GL_PIXEL_BUFFER_BARRIER_BIT; + break; + case AccessType::HOST_PREINITIALIZED: + case AccessType::HOST_WRITE: + case AccessType::PRESENT: + default: + break; + } + } + } +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h b/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h new file mode 100644 index 0000000000..cc4af621c5 --- /dev/null +++ b/native/cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h @@ -0,0 +1,48 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once +#include "gfx-base/GFXGlobalBarrier.h" + +namespace cc { +namespace gfx { + +class GLES3GPUGlobalBarrier; + +class CC_DLL GLES3GlobalBarrier : public GlobalBarrier { +public: + GLES3GlobalBarrier(); + ~GLES3GlobalBarrier(); + + CC_INLINE const GLES3GPUGlobalBarrier *gpuBarrier() const { return _gpuBarrier; } + +protected: + void doInit(const GlobalBarrierInfo &info) override; + + GLES3GPUGlobalBarrier *_gpuBarrier = nullptr; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp index a883adde49..e0eaf817a7 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp @@ -1,90 +1,77 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" -#include "GLES3InputAssembler.h" -#include "GLES3Commands.h" + #include "GLES3Buffer.h" +#include "GLES3Commands.h" +#include "GLES3Device.h" +#include "GLES3InputAssembler.h" namespace cc { namespace gfx { -GLES3InputAssembler::GLES3InputAssembler(Device *device) -: InputAssembler(device) { -} +GLES3InputAssembler::GLES3InputAssembler() = default; GLES3InputAssembler::~GLES3InputAssembler() { + destroy(); } -bool GLES3InputAssembler::initialize(const InputAssemblerInfo &info) { - - _attributes = info.attributes; - _vertexBuffers = info.vertexBuffers; - _indexBuffer = info.indexBuffer; - _indirectBuffer = info.indirectBuffer; - - if (_indexBuffer) { - _indexCount = _indexBuffer->getCount(); - _firstIndex = 0; - } else if (_vertexBuffers.size()) { - _vertexCount = _vertexBuffers[0]->getCount(); - _firstVertex = 0; - _vertexOffset = 0; - } - - _gpuInputAssembler = CC_NEW(GLES3GPUInputAssembler); +void GLES3InputAssembler::doInit(const InputAssemblerInfo &info) { + _gpuInputAssembler = CC_NEW(GLES3GPUInputAssembler); _gpuInputAssembler->attributes = _attributes; _gpuInputAssembler->gpuVertexBuffers.resize(_vertexBuffers.size()); for (size_t i = 0; i < _gpuInputAssembler->gpuVertexBuffers.size(); ++i) { - GLES3Buffer *vb = (GLES3Buffer *)_vertexBuffers[i]; + auto *vb = static_cast(_vertexBuffers[i]); _gpuInputAssembler->gpuVertexBuffers[i] = vb->gpuBuffer(); } - if (info.indexBuffer) + if (info.indexBuffer) { _gpuInputAssembler->gpuIndexBuffer = static_cast(info.indexBuffer)->gpuBuffer(); + } - if (info.indirectBuffer) + if (info.indirectBuffer) { _gpuInputAssembler->gpuIndirectBuffer = static_cast(info.indirectBuffer)->gpuBuffer(); + } - GLES3CmdFuncCreateInputAssembler((GLES3Device *)_device, _gpuInputAssembler); - _attributesHash = computeAttributesHash(); - - return true; + cmdFuncGLES3CreateInputAssembler(GLES3Device::getInstance(), _gpuInputAssembler); } -void GLES3InputAssembler::destroy() { +void GLES3InputAssembler::doDestroy() { if (_gpuInputAssembler) { - GLES3CmdFuncDestroyInputAssembler((GLES3Device *)_device, _gpuInputAssembler); + cmdFuncGLES3DestroyInputAssembler(GLES3Device::getInstance(), _gpuInputAssembler); CC_DELETE(_gpuInputAssembler); _gpuInputAssembler = nullptr; } } void GLES3InputAssembler::ExtractCmdDraw(GLES3CmdDraw *cmd) { - cmd->drawInfo.vertexCount = _vertexCount; - cmd->drawInfo.firstVertex = _firstVertex; - cmd->drawInfo.indexCount = _indexCount; - cmd->drawInfo.firstIndex = _firstIndex; - cmd->drawInfo.vertexOffset = _vertexOffset; + cmd->drawInfo.vertexCount = _vertexCount; + cmd->drawInfo.firstVertex = _firstVertex; + cmd->drawInfo.indexCount = _indexCount; + cmd->drawInfo.firstIndex = _firstIndex; + cmd->drawInfo.vertexOffset = _vertexOffset; cmd->drawInfo.instanceCount = _instanceCount; cmd->drawInfo.firstInstance = _firstInstance; } diff --git a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h index 165b083948..89314f69d6 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h +++ b/native/cocos/renderer/gfx-gles3/GLES3InputAssembler.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_INPUT_ASSEMBLER_H_ -#define CC_GFXGLES3_INPUT_ASSEMBLER_H_ + +#pragma once + +#include "gfx-base/GFXInputAssembler.h" namespace cc { namespace gfx { @@ -32,22 +35,19 @@ class GLES3CmdDraw; class CC_GLES3_API GLES3InputAssembler final : public InputAssembler { public: - GLES3InputAssembler(Device *device); + GLES3InputAssembler(); ~GLES3InputAssembler(); -public: - virtual bool initialize(const InputAssemblerInfo &info) override; - virtual void destroy() override; - void ExtractCmdDraw(GLES3CmdDraw *cmd); CC_INLINE GLES3GPUInputAssembler *gpuInputAssembler() const { return _gpuInputAssembler; } -private: +protected: + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; + GLES3GPUInputAssembler *_gpuInputAssembler = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp b/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp index 28a6bcda54..ac1f599104 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Commands.h" @@ -30,25 +32,22 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES3PipelineLayout::GLES3PipelineLayout(Device *device) -: PipelineLayout(device) { +GLES3PipelineLayout::GLES3PipelineLayout() +: PipelineLayout() { } GLES3PipelineLayout::~GLES3PipelineLayout() { + destroy(); } -bool GLES3PipelineLayout::initialize(const PipelineLayoutInfo &info) { - - _setLayouts = info.setLayouts; - +void GLES3PipelineLayout::doInit(const PipelineLayoutInfo &info) { _gpuPipelineLayout = CC_NEW(GLES3GPUPipelineLayout); uint offset = 0u; _gpuPipelineLayout->dynamicOffsetIndices.resize(_setLayouts.size()); for (uint i = 0u; i < _setLayouts.size(); i++) { DescriptorSetLayout *setLayout = _setLayouts[i]; - CCASSERT(setLayout != nullptr, "SetLayout should not be nullptr."); - GLES3GPUDescriptorSetLayout *gpuSetLayout = ((GLES3DescriptorSetLayout *)setLayout)->gpuDescriptorSetLayout(); + GLES3GPUDescriptorSetLayout *gpuSetLayout = static_cast(setLayout)->gpuDescriptorSetLayout(); size_t dynamicCount = gpuSetLayout->dynamicBindings.size(); vector &indices = _gpuPipelineLayout->dynamicOffsetIndices[i]; indices.assign(setLayout->getBindingIndices().size(), -1); @@ -64,11 +63,9 @@ bool GLES3PipelineLayout::initialize(const PipelineLayoutInfo &info) { _gpuPipelineLayout->dynamicOffsetOffsets.push_back(offset); _gpuPipelineLayout->dynamicOffsetCount = offset; _gpuPipelineLayout->dynamicOffsets.resize(offset); - - return true; } -void GLES3PipelineLayout::destroy() { +void GLES3PipelineLayout::doDestroy() { if (_gpuPipelineLayout) { CC_DELETE(_gpuPipelineLayout); diff --git a/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h b/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h index f05e67f74a..989c519b1c 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h +++ b/native/cocos/renderer/gfx-gles3/GLES3PipelineLayout.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_PIPELINE_LAYOUT_H_ #define CC_GFXGLES3_PIPELINE_LAYOUT_H_ +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { @@ -31,16 +35,15 @@ class GLES3GPUPipelineLayout; class CC_GLES3_API GLES3PipelineLayout final : public PipelineLayout { public: - GLES3PipelineLayout(Device *device); + GLES3PipelineLayout(); ~GLES3PipelineLayout(); -public: - virtual bool initialize(const PipelineLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPUPipelineLayout *gpuPipelineLayout() const { return _gpuPipelineLayout; } -private: +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; + GLES3GPUPipelineLayout *_gpuPipelineLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-gles3/GLES3PipelineState.cpp b/native/cocos/renderer/gfx-gles3/GLES3PipelineState.cpp index 16ee5cebdd..83fe62fe7d 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PipelineState.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3PipelineState.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Commands.h" @@ -49,44 +51,32 @@ const GLenum GLES3Primitives[] = { GL_NONE, }; -GLES3PipelineState::GLES3PipelineState(Device *device) -: PipelineState(device) { +GLES3PipelineState::GLES3PipelineState() +: PipelineState() { } GLES3PipelineState::~GLES3PipelineState() { + destroy(); } -bool GLES3PipelineState::initialize(const PipelineStateInfo &info) { - - _primitive = info.primitive; - _shader = info.shader; - _inputState = info.inputState; - _rasterizerState = info.rasterizerState; - _depthStencilState = info.depthStencilState; - _blendState = info.blendState; - _dynamicStates = info.dynamicStates; - _renderPass = info.renderPass; - _pipelineLayout = info.pipelineLayout; - +void GLES3PipelineState::doInit(const PipelineStateInfo &info) { _gpuPipelineState = CC_NEW(GLES3GPUPipelineState); _gpuPipelineState->glPrimitive = GLES3Primitives[(int)_primitive]; - _gpuPipelineState->gpuShader = ((GLES3Shader *)_shader)->gpuShader(); + _gpuPipelineState->gpuShader = static_cast(_shader)->gpuShader(); _gpuPipelineState->rs = _rasterizerState; _gpuPipelineState->dss = _depthStencilState; _gpuPipelineState->bs = _blendState; - _gpuPipelineState->gpuRenderPass = ((GLES3RenderPass *)_renderPass)->gpuRenderPass(); - _gpuPipelineState->gpuPipelineLayout = ((GLES3PipelineLayout *)_pipelineLayout)->gpuPipelineLayout(); + _gpuPipelineState->gpuPipelineLayout = static_cast(_pipelineLayout)->gpuPipelineLayout(); + if (_renderPass) _gpuPipelineState->gpuRenderPass = static_cast(_renderPass)->gpuRenderPass(); for (uint i = 0; i < 31; i++) { if ((uint)_dynamicStates & (1 << i)) { _gpuPipelineState->dynamicStates.push_back((DynamicStateFlagBit)(1 << i)); } } - - return true; } -void GLES3PipelineState::destroy() { +void GLES3PipelineState::doDestroy() { if (_gpuPipelineState) { CC_DELETE(_gpuPipelineState); _gpuPipelineState = nullptr; diff --git a/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h b/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h index ddc1a79ff2..15b228c03c 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h +++ b/native/cocos/renderer/gfx-gles3/GLES3PipelineState.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_PIPELINE_STATE_H_ -#define CC_GFXGLES3_PIPELINE_STATE_H_ + +#pragma once + +#include "gfx-base/GFXPipelineState.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES3GPUPipelineState; class CC_GLES3_API GLES3PipelineState final : public PipelineState { public: - GLES3PipelineState(Device *device); + GLES3PipelineState(); ~GLES3PipelineState(); -public: - virtual bool initialize(const PipelineStateInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPUPipelineState *gpuPipelineState() const { return _gpuPipelineState; } -private: +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; + GLES3GPUPipelineState *_gpuPipelineState = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp b/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp index 2b05dc1fe5..c9f41c277e 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp @@ -1,32 +1,35 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Buffer.h" #include "GLES3DescriptorSet.h" #include "GLES3Device.h" #include "GLES3Framebuffer.h" +#include "GLES3GlobalBarrier.h" #include "GLES3InputAssembler.h" #include "GLES3PipelineState.h" #include "GLES3PrimaryCommandBuffer.h" @@ -36,113 +39,150 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES3PrimaryCommandBuffer::GLES3PrimaryCommandBuffer(Device *device) -: GLES3CommandBuffer(device) { -} - GLES3PrimaryCommandBuffer::~GLES3PrimaryCommandBuffer() { + destroy(); } -void GLES3PrimaryCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) { - _isInRenderPass = true; - GLES3GPURenderPass *gpuRenderPass = ((GLES3RenderPass *)renderPass)->gpuRenderPass(); - GLES3GPUFramebuffer *gpuFramebuffer = ((GLES3Framebuffer *)fbo)->gpuFBO(); +void GLES3PrimaryCommandBuffer::begin(RenderPass * /*renderPass*/, uint /*subpass*/, Framebuffer * /*frameBuffer*/) { + _curGPUPipelineState = nullptr; + _curGPUInputAssember = nullptr; + _curGPUDescriptorSets.assign(_curGPUDescriptorSets.size(), nullptr); - GLES3CmdFuncBeginRenderPass((GLES3Device *)_device, gpuRenderPass, gpuFramebuffer, + _numDrawCalls = 0; + _numInstances = 0; + _numTriangles = 0; +} + +void GLES3PrimaryCommandBuffer::end() { + if (_isStateInvalid) { + bindStates(); + } + _isInRenderPass = false; +} + +void GLES3PrimaryCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const * /*secondaryCBs*/, uint /*secondaryCBCount*/) { + _isInRenderPass = true; + GLES3GPURenderPass * gpuRenderPass = static_cast(renderPass)->gpuRenderPass(); + GLES3GPUFramebuffer *gpuFramebuffer = static_cast(fbo)->gpuFBO(); + + cmdFuncGLES3BeginRenderPass(GLES3Device::getInstance(), gpuRenderPass, gpuFramebuffer, renderArea, gpuRenderPass->colorAttachments.size(), colors, depth, stencil); } void GLES3PrimaryCommandBuffer::endRenderPass() { - GLES3CmdFuncEndRenderPass((GLES3Device *)_device); + cmdFuncGLES3EndRenderPass(GLES3Device::getInstance()); _isInRenderPass = false; } -void GLES3PrimaryCommandBuffer::draw(InputAssembler *ia) { - if ((_type == CommandBufferType::PRIMARY && _isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { +void GLES3PrimaryCommandBuffer::draw(const DrawInfo &info) { + if (_isStateInvalid) { + bindStates(); + } - if (_isStateInvalid) { - vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; - vector &dynamicOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsets; - for (size_t i = 0u; i < _curDynamicOffsets.size(); i++) { - size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; - //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); - count = std::min(count, _curDynamicOffsets[i].size()); - if (count) memcpy(&dynamicOffsets[dynamicOffsetOffsets[i]], _curDynamicOffsets[i].data(), count * sizeof(uint)); + cmdFuncGLES3Draw(GLES3Device::getInstance(), info); + + ++_numDrawCalls; + _numInstances += info.instanceCount; + if (_curGPUPipelineState) { + uint indexCount = info.indexCount ? info.indexCount : info.vertexCount; + switch (_curGPUPipelineState->glPrimitive) { + case GL_TRIANGLES: { + _numTriangles += indexCount / 3 * std::max(info.instanceCount, 1U); + break; } - GLES3CmdFuncBindState((GLES3Device *)_device, _curGPUPipelineState, _curGPUInputAssember, _curGPUDescriptorSets, dynamicOffsets, - _curViewport, _curScissor, _curLineWidth, false, _curDepthBias, _curBlendConstants, _curDepthBounds, _curStencilWriteMask, _curStencilCompareMask); - - _isStateInvalid = false; - } - - DrawInfo drawInfo; - ia->extractDrawInfo(drawInfo); - GLES3CmdFuncDraw((GLES3Device *)_device, drawInfo); - - ++_numDrawCalls; - _numInstances += ia->getInstanceCount(); - if (_curGPUPipelineState) { - switch (_curGPUPipelineState->glPrimitive) { - case GL_TRIANGLES: { - _numTriangles += ia->getIndexCount() / 3 * std::max(ia->getInstanceCount(), 1U); - break; - } - case GL_TRIANGLE_STRIP: - case GL_TRIANGLE_FAN: { - _numTriangles += (ia->getIndexCount() - 2) * std::max(ia->getInstanceCount(), 1U); - break; - } - default: - break; + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_FAN: { + _numTriangles += (indexCount - 2) * std::max(info.instanceCount, 1U); + break; } + default: + break; } - } else { - CC_LOG_ERROR("Command 'draw' must be recorded inside a render pass."); } } void GLES3PrimaryCommandBuffer::updateBuffer(Buffer *buff, const void *data, uint size) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - - GLES3GPUBuffer *gpuBuffer = ((GLES3Buffer *)buff)->gpuBuffer(); - if (gpuBuffer) { - GLES3CmdFuncUpdateBuffer((GLES3Device *)_device, gpuBuffer, data, 0u, size); - } - } else { - CC_LOG_ERROR("Command 'updateBuffer' must be recorded outside a render pass."); + GLES3GPUBuffer *gpuBuffer = static_cast(buff)->gpuBuffer(); + if (gpuBuffer) { + cmdFuncGLES3UpdateBuffer(GLES3Device::getInstance(), gpuBuffer, data, 0U, size); } } void GLES3PrimaryCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { - if ((_type == CommandBufferType::PRIMARY && !_isInRenderPass) || - (_type == CommandBufferType::SECONDARY)) { - - GLES3GPUTexture *gpuTexture = ((GLES3Texture *)texture)->gpuTexture(); - if (gpuTexture) { - GLES3CmdFuncCopyBuffersToTexture((GLES3Device *)_device, buffers, gpuTexture, regions, count); - } - } else { - CC_LOG_ERROR("Command 'copyBuffersToTexture' must be recorded outside a render pass."); + GLES3GPUTexture *gpuTexture = static_cast(texture)->gpuTexture(); + if (gpuTexture) { + cmdFuncGLES3CopyBuffersToTexture(GLES3Device::getInstance(), buffers, gpuTexture, regions, count); } } -void GLES3PrimaryCommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint32_t count) { - for (uint i = 0; i < count; ++i) { - GLES3PrimaryCommandBuffer *cmdBuff = (GLES3PrimaryCommandBuffer *)cmdBuffs[i]; - GLES3CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); +void GLES3PrimaryCommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { + GLES3GPUTexture *gpuTextureSrc = nullptr; + GLES3GPUTexture *gpuTextureDst = nullptr; + if (srcTexture) gpuTextureSrc = static_cast(srcTexture)->gpuTexture(); + if (dstTexture) gpuTextureDst = static_cast(dstTexture)->gpuTexture(); - GLES3CmdFuncExecuteCmds((GLES3Device *)_device, cmdPackage); + cmdFuncGLES3BlitTexture(GLES3Device::getInstance(), gpuTextureSrc, gpuTextureDst, regions, count, filter); +} + +void GLES3PrimaryCommandBuffer::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { + for (uint i = 0; i < count; ++i) { + auto *cmdBuff = static_cast(cmdBuffs[i]); + + if (!cmdBuff->_pendingPackages.empty()) { + GLES3CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); + + cmdFuncGLES3ExecuteCmds(GLES3Device::getInstance(), cmdPackage); + + cmdBuff->_pendingPackages.pop(); + cmdBuff->_freePackages.push(cmdPackage); + cmdBuff->_cmdAllocator->clearCmds(cmdPackage); + cmdBuff->_cmdAllocator->reset(); + } _numDrawCalls += cmdBuff->_numDrawCalls; _numInstances += cmdBuff->_numInstances; _numTriangles += cmdBuff->_numTriangles; - - cmdBuff->_pendingPackages.pop(); - cmdBuff->_freePackages.push(cmdPackage); } } +void GLES3PrimaryCommandBuffer::bindStates() { + vector &dynamicOffsetOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsetOffsets; + vector &dynamicOffsets = _curGPUPipelineState->gpuPipelineLayout->dynamicOffsets; + for (size_t i = 0U; i < _curDynamicOffsets.size(); i++) { + size_t count = dynamicOffsetOffsets[i + 1] - dynamicOffsetOffsets[i]; + //CCASSERT(_curDynamicOffsets[i].size() >= count, "missing dynamic offsets?"); + count = std::min(count, _curDynamicOffsets[i].size()); + if (count) memcpy(&dynamicOffsets[dynamicOffsetOffsets[i]], _curDynamicOffsets[i].data(), count * sizeof(uint)); + } + cmdFuncGLES3BindState(GLES3Device::getInstance(), _curGPUPipelineState, _curGPUInputAssember, _curGPUDescriptorSets, dynamicOffsets, + _curViewport, _curScissor, _curLineWidth, false, _curDepthBias, _curBlendConstants, _curDepthBounds, _curStencilWriteMask, _curStencilCompareMask); + + _isStateInvalid = false; +} + +void GLES3PrimaryCommandBuffer::dispatch(const DispatchInfo &info) { + if (_isStateInvalid) { + bindStates(); + } + + GLES3GPUDispatchInfo gpuInfo; + if (info.indirectBuffer) { + gpuInfo.indirectBuffer = static_cast(info.indirectBuffer)->gpuBuffer(); + gpuInfo.indirectOffset = info.indirectOffset; + } else { + gpuInfo.groupCountX = info.groupCountX; + gpuInfo.groupCountY = info.groupCountY; + gpuInfo.groupCountZ = info.groupCountZ; + } + cmdFuncGLES3Dispatch(GLES3Device::getInstance(), gpuInfo); +} + +void GLES3PrimaryCommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const * /*textureBarriers*/, const Texture *const * /*textures*/, uint /*textureBarrierCount*/) { + if (!barrier) return; + + const auto *gpuBarrier = static_cast(barrier)->gpuBarrier(); + cmdFuncGLES3MemoryBarrier(GLES3Device::getInstance(), gpuBarrier->glBarriers, gpuBarrier->glBarriersByRegion); +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.h b/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.h index a4af97b926..b1682b8878 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.h +++ b/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.h @@ -1,28 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_PRIMARY_COMMAND_BUFFER_H_ -#define CC_GFXGLES3_PRIMARY_COMMAND_BUFFER_H_ + +#pragma once #include "GLES3CommandBuffer.h" @@ -30,21 +31,27 @@ namespace cc { namespace gfx { class CC_GLES3_API GLES3PrimaryCommandBuffer final : public GLES3CommandBuffer { +public: + GLES3PrimaryCommandBuffer() = default; + ~GLES3PrimaryCommandBuffer() override; + + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + +protected: friend class GLES3Queue; -public: - GLES3PrimaryCommandBuffer(Device *device); - ~GLES3PrimaryCommandBuffer(); - - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) override; - virtual void endRenderPass() override; - virtual void draw(InputAssembler *ia) override; - virtual void updateBuffer(Buffer *buff, const void *data, uint size) override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; - virtual void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; + void bindStates() override; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Queue.cpp b/native/cocos/renderer/gfx-gles3/GLES3Queue.cpp index ab536ec121..b4540096a5 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Queue.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Queue.cpp @@ -1,65 +1,68 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" -#include "GLES3Queue.h" -#include "GLES3Commands.h" + #include "GLES3CommandBuffer.h" +#include "GLES3Commands.h" +#include "GLES3Device.h" +#include "GLES3Queue.h" namespace cc { namespace gfx { -GLES3Queue::GLES3Queue(Device *device) -: Queue(device) { -} +GLES3Queue::GLES3Queue() = default; GLES3Queue::~GLES3Queue() { + destroy(); } -bool GLES3Queue::initialize(const QueueInfo &info) { - _type = info.type; - - return true; +void GLES3Queue::doInit(const QueueInfo &info) { } -void GLES3Queue::destroy() { +void GLES3Queue::doDestroy() { } -void GLES3Queue::submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) { - if (!_isAsync) { - for (uint i = 0; i < count; ++i) { - GLES3CommandBuffer *cmdBuff = (GLES3CommandBuffer *)cmdBuffs[i]; +void GLES3Queue::submit(CommandBuffer *const *cmdBuffs, uint count) { + for (uint i = 0; i < count; ++i) { + auto *cmdBuff = static_cast(cmdBuffs[i]); + + if (!cmdBuff->_pendingPackages.empty()) { GLES3CmdPackage *cmdPackage = cmdBuff->_pendingPackages.front(); - GLES3CmdFuncExecuteCmds((GLES3Device *)_device, cmdPackage); - - _numDrawCalls += cmdBuff->_numDrawCalls; - _numInstances += cmdBuff->_numInstances; - _numTriangles += cmdBuff->_numTriangles; + cmdFuncGLES3ExecuteCmds(GLES3Device::getInstance(), cmdPackage); cmdBuff->_pendingPackages.pop(); cmdBuff->_freePackages.push(cmdPackage); + cmdBuff->_cmdAllocator->clearCmds(cmdPackage); + cmdBuff->_cmdAllocator->reset(); } + + _numDrawCalls += cmdBuff->_numDrawCalls; + _numInstances += cmdBuff->_numInstances; + _numTriangles += cmdBuff->_numTriangles; } } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Queue.h b/native/cocos/renderer/gfx-gles3/GLES3Queue.h index 0a5590bc05..030187e976 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Queue.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Queue.h @@ -1,45 +1,48 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_QUEUE_H_ -#define CC_GFXGLES3_QUEUE_H_ + +#pragma once + +#include "gfx-base/GFXQueue.h" namespace cc { namespace gfx { class CC_GLES3_API GLES3Queue final : public Queue { public: - GLES3Queue(Device *device); + GLES3Queue(); ~GLES3Queue(); + void submit(CommandBuffer *const *cmdBuffs, uint count) override; + +protected: friend class GLES3Device; -public: - virtual bool initialize(const QueueInfo &info) override; - virtual void destroy() override; - virtual void submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) override; + void doInit(const QueueInfo &info) override; + void doDestroy() override; -private: uint _numDrawCalls = 0; uint _numInstances = 0; uint _numTriangles = 0; @@ -47,5 +50,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3RenderPass.cpp b/native/cocos/renderer/gfx-gles3/GLES3RenderPass.cpp index fc94a1fd6b..5a1b33a61a 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3RenderPass.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3RenderPass.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3RenderPass.h" #include "GLES3Commands.h" @@ -28,28 +30,21 @@ THE SOFTWARE. namespace cc { namespace gfx { -GLES3RenderPass::GLES3RenderPass(Device *device) -: RenderPass(device) { +GLES3RenderPass::GLES3RenderPass() +: RenderPass() { } GLES3RenderPass::~GLES3RenderPass() { + destroy(); } -bool GLES3RenderPass::initialize(const RenderPassInfo &info) { - - _colorAttachments = info.colorAttachments; - _depthStencilAttachment = info.depthStencilAttachment; - +void GLES3RenderPass::doInit(const RenderPassInfo &info) { _gpuRenderPass = CC_NEW(GLES3GPURenderPass); _gpuRenderPass->colorAttachments = _colorAttachments; _gpuRenderPass->depthStencilAttachment = _depthStencilAttachment; - - _hash = computeHash(); - - return true; } -void GLES3RenderPass::destroy() { +void GLES3RenderPass::doDestroy() { if (_gpuRenderPass) { CC_DELETE(_gpuRenderPass); _gpuRenderPass = nullptr; diff --git a/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h b/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h index 4ef83598ea..ff265304e8 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h +++ b/native/cocos/renderer/gfx-gles3/GLES3RenderPass.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_RENDER_PASS_H_ -#define CC_GFXGLES3_RENDER_PASS_H_ + +#pragma once + +#include "gfx-base/GFXRenderPass.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES3GPURenderPass; class CC_GLES3_API GLES3RenderPass final : public RenderPass { public: - GLES3RenderPass(Device *device); + GLES3RenderPass(); ~GLES3RenderPass(); -public: - virtual bool initialize(const RenderPassInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPURenderPass *gpuRenderPass() const { return _gpuRenderPass; } -private: +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; + GLES3GPURenderPass *_gpuRenderPass = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Sampler.cpp b/native/cocos/renderer/gfx-gles3/GLES3Sampler.cpp index dfddcc9f04..69f8fde7eb 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Sampler.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Sampler.cpp @@ -1,72 +1,58 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" -#include "GLES3Sampler.h" + #include "GLES3Commands.h" +#include "GLES3Device.h" +#include "GLES3Sampler.h" namespace cc { namespace gfx { -GLES3Sampler::GLES3Sampler(Device *device) -: Sampler(device) { -} +GLES3Sampler::GLES3Sampler() = default; GLES3Sampler::~GLES3Sampler() { + destroy(); } -bool GLES3Sampler::initialize(const SamplerInfo &info) { - _minFilter = info.minFilter; - _magFilter = info.magFilter; - _mipFilter = info.mipFilter; - _addressU = info.addressU; - _addressV = info.addressV; - _addressW = info.addressW; - _maxAnisotropy = info.maxAnisotropy; - _cmpFunc = info.cmpFunc; - _borderColor = info.borderColor; - _minLOD = info.minLOD; - _maxLOD = info.maxLOD; - _mipLODBias = info.mipLODBias; - - _gpuSampler = CC_NEW(GLES3GPUSampler); +void GLES3Sampler::doInit(const SamplerInfo & /*info*/) { + _gpuSampler = CC_NEW(GLES3GPUSampler); _gpuSampler->minFilter = _minFilter; _gpuSampler->magFilter = _magFilter; _gpuSampler->mipFilter = _mipFilter; - _gpuSampler->addressU = _addressU; - _gpuSampler->addressV = _addressV; - _gpuSampler->addressW = _addressW; - _gpuSampler->minLOD = _minLOD; - _gpuSampler->maxLOD = _maxLOD; + _gpuSampler->addressU = _addressU; + _gpuSampler->addressV = _addressV; + _gpuSampler->addressW = _addressW; - GLES3CmdFuncCreateSampler((GLES3Device *)_device, _gpuSampler); - - return true; + cmdFuncGLES3CreateSampler(GLES3Device::getInstance(), _gpuSampler); } -void GLES3Sampler::destroy() { +void GLES3Sampler::doDestroy() { if (_gpuSampler) { - GLES3CmdFuncDestroySampler((GLES3Device *)_device, _gpuSampler); + cmdFuncGLES3DestroySampler(GLES3Device::getInstance(), _gpuSampler); CC_DELETE(_gpuSampler); _gpuSampler = nullptr; } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Sampler.h b/native/cocos/renderer/gfx-gles3/GLES3Sampler.h index 070c1b9b15..58b284215f 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Sampler.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Sampler.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_SAMPLER_H_ -#define CC_GFXGLES3_SAMPLER_H_ + +#pragma once + +#include "gfx-base/GFXSampler.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES3GPUSampler; class CC_GLES3_API GLES3Sampler final : public Sampler { public: - GLES3Sampler(Device *device); + GLES3Sampler(); ~GLES3Sampler(); -public: - virtual bool initialize(const SamplerInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPUSampler *gpuSampler() const { return _gpuSampler; } -private: +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; + GLES3GPUSampler *_gpuSampler = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Shader.cpp b/native/cocos/renderer/gfx-gles3/GLES3Shader.cpp index 078bcf7a4e..0ec4984292 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Shader.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Shader.cpp @@ -1,64 +1,64 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" -#include "GLES3Shader.h" + #include "GLES3Commands.h" +#include "GLES3Device.h" +#include "GLES3Shader.h" namespace cc { namespace gfx { -GLES3Shader::GLES3Shader(Device *device) -: Shader(device) { -} +GLES3Shader::GLES3Shader() = default; GLES3Shader::~GLES3Shader() { + destroy(); } -bool GLES3Shader::initialize(const ShaderInfo &info) { - _name = info.name; - _stages = info.stages; - _attributes = info.attributes; - _blocks = info.blocks; - _samplers = info.samplers; - - _gpuShader = CC_NEW(GLES3GPUShader); - _gpuShader->name = _name; - _gpuShader->blocks = _blocks; - _gpuShader->samplers = _samplers; +void GLES3Shader::doInit(const ShaderInfo & /*info*/) { + _gpuShader = CC_NEW(GLES3GPUShader); + _gpuShader->name = _name; + _gpuShader->blocks = _blocks; + _gpuShader->buffers = _buffers; + _gpuShader->samplerTextures = _samplerTextures; + _gpuShader->samplers = _samplers; + _gpuShader->textures = _textures; + _gpuShader->images = _images; + _gpuShader->subpassInputs = _subpassInputs; for (const auto &stage : _stages) { GLES3GPUShaderStage gpuShaderStage = {stage.stage, stage.source}; _gpuShader->gpuStages.emplace_back(std::move(gpuShaderStage)); } - GLES3CmdFuncCreateShader((GLES3Device *)_device, _gpuShader); - - return true; + cmdFuncGLES3CreateShader(GLES3Device::getInstance(), _gpuShader); } -void GLES3Shader::destroy() { +void GLES3Shader::doDestroy() { if (_gpuShader) { - GLES3CmdFuncDestroyShader((GLES3Device *)_device, _gpuShader); + cmdFuncGLES3DestroyShader(GLES3Device::getInstance(), _gpuShader); CC_DELETE(_gpuShader); _gpuShader = nullptr; } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Shader.h b/native/cocos/renderer/gfx-gles3/GLES3Shader.h index 0c67aa5487..8676161eb4 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Shader.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Shader.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_SHADER_H_ -#define CC_GFXGLES3_SHADER_H_ + +#pragma once + +#include "gfx-base/GFXShader.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class GLES3GPUShader; class CC_GLES3_API GLES3Shader final : public Shader { public: - GLES3Shader(Device *device); + GLES3Shader(); ~GLES3Shader(); -public: - virtual bool initialize(const ShaderInfo &info) override; - virtual void destroy() override; - CC_INLINE GLES3GPUShader *gpuShader() const { return _gpuShader; } -private: +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; + GLES3GPUShader *_gpuShader = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Std.cpp b/native/cocos/renderer/gfx-gles3/GLES3Std.cpp index 3ecf526b4b..86ee1990ac 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Std.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Std.cpp @@ -1,24 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" diff --git a/native/cocos/renderer/gfx-gles3/GLES3Std.h b/native/cocos/renderer/gfx-gles3/GLES3Std.h index cefd910876..4b7e0d4002 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Std.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Std.h @@ -1,29 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include +#include "base/CoreStd.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #if defined(CC_STATIC) diff --git a/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp b/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp index 7831ea0393..99dd7734c1 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp @@ -1,104 +1,45 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "GLES3Std.h" #include "GLES3Commands.h" +#include "GLES3Device.h" #include "GLES3Texture.h" namespace cc { namespace gfx { -GLES3Texture::GLES3Texture(Device *device) -: Texture(device) { -} +GLES3Texture::GLES3Texture() = default; GLES3Texture::~GLES3Texture() { + destroy(); } -bool GLES3Texture::initialize(const TextureInfo &info) { - - _type = info.type; - _usage = info.usage; - _format = info.format; - _width = info.width; - _height = info.height; - _depth = info.depth; - _layerCount = info.layerCount; - _levelCount = info.levelCount; - _samples = info.samples; - _flags = info.flags; - _size = FormatSize(_format, _width, _height, _depth); - -#if CC_DEBUG > 0 - switch (_format) { // device feature validation - case Format::D16: - if (_device->hasFeature(Feature::FORMAT_D16)) break; - CC_LOG_ERROR("D16 texture format is not supported on this backend"); - return false; - case Format::D16S8: - if (_device->hasFeature(Feature::FORMAT_D16S8)) break; - CC_LOG_WARNING("D16S8 texture format is not supported on this backend"); - return false; - case Format::D24: - if (_device->hasFeature(Feature::FORMAT_D24)) break; - CC_LOG_WARNING("D24 texture format is not supported on this backend"); - return false; - case Format::D24S8: - if (_device->hasFeature(Feature::FORMAT_D24S8)) break; - CC_LOG_WARNING("D24S8 texture format is not supported on this backend"); - return false; - case Format::D32F: - if (_device->hasFeature(Feature::FORMAT_D32F)) break; - CC_LOG_WARNING("D32F texture format is not supported on this backend"); - return false; - case Format::D32F_S8: - if (_device->hasFeature(Feature::FORMAT_D32FS8)) break; - CC_LOG_WARNING("D32FS8 texture format is not supported on this backend"); - return false; - case Format::RGB8: - if (_device->hasFeature(Feature::FORMAT_RGB8)) break; - CC_LOG_WARNING("RGB8 texture format is not supported on this backend"); - return false; - default: - break; - } -#endif - - if (_flags & TextureFlags::BAKUP_BUFFER) { - _buffer = (uint8_t *)CC_MALLOC(_size); - if (!_buffer) { - CC_LOG_ERROR("GLES3Texture: CC_MALLOC backup buffer failed."); - return false; - } - _device->getMemoryStatus().textureSize += _size; - } - +void GLES3Texture::doInit(const TextureInfo & /*info*/) { _gpuTexture = CC_NEW(GLES3GPUTexture); - if (!_gpuTexture) { - CC_LOG_ERROR("GLES3Texture: CC_NEW GLES3GPUTexture failed."); - return false; - } _gpuTexture->type = _type; _gpuTexture->format = _format; _gpuTexture->usage = _usage; @@ -112,64 +53,26 @@ bool GLES3Texture::initialize(const TextureInfo &info) { _gpuTexture->flags = _flags; _gpuTexture->isPowerOf2 = math::IsPowerOfTwo(_width) && math::IsPowerOfTwo(_height); - GLES3CmdFuncCreateTexture((GLES3Device *)_device, _gpuTexture); - _device->getMemoryStatus().textureSize += _size; - - return true; + cmdFuncGLES3CreateTexture(GLES3Device::getInstance(), _gpuTexture); } -bool GLES3Texture::initialize(const TextureViewInfo &info) { - _isTextureView = true; - +void GLES3Texture::doInit(const TextureViewInfo & /*info*/) { CC_LOG_ERROR("GLES3 doesn't support texture view."); - return false; } -void GLES3Texture::destroy() { +void GLES3Texture::doDestroy() { if (_gpuTexture) { - GLES3CmdFuncDestroyTexture((GLES3Device *)_device, _gpuTexture); - _device->getMemoryStatus().textureSize -= _size; + cmdFuncGLES3DestroyTexture(GLES3Device::getInstance(), _gpuTexture); CC_DELETE(_gpuTexture); _gpuTexture = nullptr; } - - if (_buffer) { - CC_FREE(_buffer); - _device->getMemoryStatus().textureSize -= _size; - _buffer = nullptr; - } } -void GLES3Texture::resize(uint width, uint height) { - if (_width != width || _height != height) { - uint size = FormatSize(_format, width, height, _depth); - const uint oldSize = _size; - _width = width; - _height = height; - _size = size; - - MemoryStatus &status = _device->getMemoryStatus(); - _gpuTexture->width = _width; - _gpuTexture->height = _height; - _gpuTexture->size = _size; - GLES3CmdFuncResizeTexture((GLES3Device *)_device, _gpuTexture); - status.bufferSize -= oldSize; - status.bufferSize += _size; - - if (_buffer) { - const uint8_t *oldBuffer = _buffer; - uint8_t *buffer = (uint8_t *)CC_MALLOC(_size); - if (!buffer) { - CC_LOG_ERROR("GLES3Texture: CC_MALLOC backup buffer failed when resize the texture."); - return; - } - memcpy(buffer, oldBuffer, std::min(oldSize, size)); - _buffer = buffer; - CC_FREE(oldBuffer); - status.bufferSize -= oldSize; - status.bufferSize += _size; - } - } +void GLES3Texture::doResize(uint width, uint height, uint size) { + _gpuTexture->width = width; + _gpuTexture->height = height; + _gpuTexture->size = size; + cmdFuncGLES3ResizeTexture(GLES3Device::getInstance(), _gpuTexture); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-gles3/GLES3Texture.h b/native/cocos/renderer/gfx-gles3/GLES3Texture.h index 68b0220b5c..37d11eee37 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Texture.h +++ b/native/cocos/renderer/gfx-gles3/GLES3Texture.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXGLES3_TEXTURE_H_ -#define CC_GFXGLES3_TEXTURE_H_ + +#pragma once + +#include "gfx-base/GFXTexture.h" namespace cc { namespace gfx { @@ -31,22 +34,19 @@ class GLES3GPUTexture; class CC_GLES3_API GLES3Texture final : public Texture { public: - GLES3Texture(Device *device); + GLES3Texture(); ~GLES3Texture(); -public: - virtual bool initialize(const TextureInfo &info) override; - virtual bool initialize(const TextureViewInfo &info) override; - virtual void destroy() override; - virtual void resize(uint width, uint height) override; - CC_INLINE GLES3GPUTexture *gpuTexture() const { return _gpuTexture; } -private: +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; + GLES3GPUTexture *_gpuTexture = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Wrangler.cpp b/native/cocos/renderer/gfx-gles3/GLES3Wrangler.cpp new file mode 100644 index 0000000000..e0491aadde --- /dev/null +++ b/native/cocos/renderer/gfx-gles3/GLES3Wrangler.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GLES3Wrangler.h" + +#if defined(_WIN32) && !defined(ANDROID) + #define WIN32_LEAN_AND_MEAN 1 + #include + +static HMODULE libegl = NULL; +static HMODULE libgles = NULL; + +bool gles3wOpen() { + libegl = LoadLibraryA("libEGL.dll"); + libgles = LoadLibraryA("libGLESv2.dll"); + return (libegl && libgles); +} + +void *gles3wLoad(const char *proc) { + void *res = nullptr; + if (eglGetProcAddress) res = (void *)eglGetProcAddress(proc); + if (!res) res = (void *)GetProcAddress(libegl, proc); + return res; +} +#elif defined(__EMSCRIPTEN__) +bool gles3wOpen() { return true; } +void *gles3wLoad(const char *proc) { + return (void *)eglGetProcAddress(proc); +} +#else + #include + +static void *libegl = nullptr; +static void *libgles = nullptr; + +bool gles3wOpen() { + libegl = dlopen("libEGL.so", RTLD_LAZY | RTLD_GLOBAL); + libgles = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); + return (libegl && libgles); +} + +void *gles3wLoad(const char *proc) { + void *res = nullptr; + if (eglGetProcAddress) res = (void *)eglGetProcAddress(proc); + if (!res) res = dlsym(libegl, proc); + return res; +} +#endif + +bool gles3wInit(void) { + if (!gles3wOpen()) { + return false; + } + + eglwLoadProcs(gles3wLoad); + gles2wLoadProcs(gles3wLoad); + gles3wLoadProcs(gles3wLoad); + + return true; +} diff --git a/native/cocos/renderer/gfx-gles3/GLES3Wrangler.h b/native/cocos/renderer/gfx-gles3/GLES3Wrangler.h new file mode 100644 index 0000000000..fb2b652797 --- /dev/null +++ b/native/cocos/renderer/gfx-gles3/GLES3Wrangler.h @@ -0,0 +1,46 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS) + #define EGL_EGL_PROTOTYPES 0 + #include + #include + #include +#endif + +#define GL_GLES_PROTOTYPES 0 +#include + +#include +#include +#include + +bool gles3wInit(); + +#include "../gfx-gles-common/eglw.h" +#include "../gfx-gles-common/gles2w.h" +#include "../gfx-gles-common/gles3w.h" diff --git a/native/cocos/renderer/gfx-gles3/GLES3Wrangler.mm b/native/cocos/renderer/gfx-gles3/GLES3Wrangler.mm new file mode 100644 index 0000000000..eefd790504 --- /dev/null +++ b/native/cocos/renderer/gfx-gles3/GLES3Wrangler.mm @@ -0,0 +1,110 @@ +/**************************************************************************** + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GLES3Wrangler.h" + +#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) + #import + #import + #import + #import + #import + #import + +static CFBundleRef g_es3Bundle; +static CFURLRef g_es3BundleURL; + +static int gles3wOpen() { + #if TARGET_IPHONE_SIMULATOR + CFStringRef frameworkPath = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework"); + #else + CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework"); + #endif + + g_es3BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, + frameworkPath, + kCFURLPOSIXPathStyle, true); + + CFRelease(frameworkPath); + + g_es3Bundle = CFBundleCreate(kCFAllocatorDefault, g_es3BundleURL); + + return (g_es3Bundle != NULL); +} + +static void *gles3wLoad(const char *proc) { + void *res; + + CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, + kCFStringEncodingASCII); + res = CFBundleGetFunctionPointerForName(g_es3Bundle, procname); + CFRelease(procname); + return res; +} +#else + #include + #include + #include + #import + #import + +static void *libegl; +static void *libgl; + +static int gles3wOpen() { + NSURL *appURL = [[NSBundle mainBundle] bundleURL]; + + std::string libPath(appURL.resourceSpecifier.UTF8String); + libPath.append("/Contents/Frameworks/libEGL.dylib"); + libegl = dlopen(libPath.c_str(), RTLD_LOCAL | RTLD_LAZY); + if (!libegl) printf("%s\n", dlerror()); + + libPath = appURL.resourceSpecifier.UTF8String; + libPath.append("/Contents/Frameworks/libGLESv2.dylib"); + libgl = dlopen(libPath.c_str(), RTLD_LOCAL | RTLD_LAZY); + if (!libgl) printf("%s\n", dlerror()); + + return (libegl && libgl); +} + +static void *gles3wLoad(const char *proc) { + void *res = nullptr; + if (eglGetProcAddress) res = (void *)eglGetProcAddress(proc); + if (!res) res = (void *)dlsym(libegl, proc); + return res; +} +#endif + +bool gles3wInit() { + if (!gles3wOpen()) { + return false; + } + + eglwLoadProcs(gles3wLoad); + gles2wLoadProcs(gles3wLoad); + gles3wLoadProcs(gles3wLoad); + + return true; +} diff --git a/native/cocos/renderer/gfx-gles3/gles3w.c b/native/cocos/renderer/gfx-gles3/gles3w.c deleted file mode 100755 index ce93f3298d..0000000000 --- a/native/cocos/renderer/gfx-gles3/gles3w.c +++ /dev/null @@ -1,795 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "gles3w.h" - -#if defined(_WIN32) && !defined(ANDROID) -#define WIN32_LEAN_AND_MEAN 1 -#include -#include - -static HMODULE libgl; - -static int open_libgl(void) -{ - libgl = LoadLibraryA("libGLESv2.dll"); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - FreeLibrary(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - - res = (void*)eglGetProcAddress(proc); - if (!res) - res = (void*)GetProcAddress(libgl, proc); - return res; -} -#elif defined(__APPLE__) || defined(__APPLE_CC__) -#import -#import -#import -#import -#import -#import - -// Routine to run a system command and retrieve the output. -// From http://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c -std::string ES3_EXEC(const char* cmd) { - FILE* pipe = popen(cmd, "r"); - if (!pipe) return "ERROR"; - char buffer[128]; - std::string result = ""; - while(!feof(pipe)) { - if(fgets(buffer, 128, pipe) != NULL) - result += buffer; - } - pclose(pipe); - return result; -} - -static CFBundleRef g_es3Bundle; -static CFURLRef g_es3BundleURL; - -static int open_libgl(void) -{ - CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework"); - NSString *sysVersion = [UIDevice currentDevice].systemVersion; - NSArray *sysVersionComponents = [sysVersion componentsSeparatedByString:@"."]; - //BOOL isSimulator = ([[UIDevice currentDevice].model rangeOfString:@"Simulator"].location != NSNotFound); - -#if TARGET_IPHONE_SIMULATOR - bool isSimulator = true; -#else - bool isSimulator = false; -#endif - if(isSimulator) - { - // Ask where Xcode is installed - std::string xcodePath = "/Applications/Xcode.app/Contents/Developer\n"; - - // The result contains an end line character. Remove it. - size_t pos = xcodePath.find("\n"); - xcodePath.erase(pos); - - char tempPath[PATH_MAX]; - sprintf(tempPath, - "%s/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.%s.sdk/System/Library/Frameworks/OpenGLES.framework", - xcodePath.c_str(), - [[sysVersionComponents objectAtIndex:0] cStringUsingEncoding:NSUTF8StringEncoding], - [[sysVersionComponents objectAtIndex:1] cStringUsingEncoding:NSUTF8StringEncoding]); - frameworkPath = CFStringCreateWithCString(kCFAllocatorDefault, tempPath, kCFStringEncodingUTF8); - } - - g_es3BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - frameworkPath, - kCFURLPOSIXPathStyle, true); - - CFRelease(frameworkPath); - - g_es3Bundle = CFBundleCreate(kCFAllocatorDefault, g_es3BundleURL); - - return (g_es3Bundle != NULL); -} - -static void close_libgl(void) -{ - CFRelease(g_es3Bundle); - CFRelease(g_es3BundleURL); -} - -static void *get_proc(const char *proc) -{ - void *res; - - CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, - kCFStringEncodingASCII); - res = CFBundleGetFunctionPointerForName(g_es3Bundle, procname); - CFRelease(procname); - return res; -} -#else -#include -#include - -static void *libgl; - -static int open_libgl(void) -{ - libgl = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - dlclose(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - res = dlsym(libgl, proc); - return res; -} -#endif - -static struct { - int major, minor; -} version; - -static int parse_version(void) -{ - if (!glGetIntegerv) - return -1; - - glGetIntegerv(GL_MAJOR_VERSION, &version.major); - glGetIntegerv(GL_MINOR_VERSION, &version.minor); - - if (version.major < 3) - return -1; - return 0; -} - -static void load_procs(void); - -int gles3wInit(void) -{ - if (!open_libgl()) - { - return 0; - } - - load_procs(); - close_libgl(); - parse_version(); - - return 1; -} - -int gles3wIsSupported(int major, int minor) -{ - if (major <= 3) - return 0; - if (version.major == major) - return version.minor >= minor; - return version.major >= major; -} - -void *gles3wGetProcAddress(const char *proc) -{ - return get_proc(proc); -} - -PFNGLACTIVETEXTUREPROC gles3wActiveTexture; -PFNGLATTACHSHADERPROC gles3wAttachShader; -PFNGLBINDATTRIBLOCATIONPROC gles3wBindAttribLocation; -PFNGLBINDBUFFERPROC gles3wBindBuffer; -PFNGLBINDFRAMEBUFFERPROC gles3wBindFramebuffer; -PFNGLBINDRENDERBUFFERPROC gles3wBindRenderbuffer; -PFNGLBINDTEXTUREPROC gles3wBindTexture; -PFNGLBLENDCOLORPROC gles3wBlendColor; -PFNGLBLENDEQUATIONPROC gles3wBlendEquation; -PFNGLBLENDEQUATIONSEPARATEPROC gles3wBlendEquationSeparate; -PFNGLBLENDFUNCPROC gles3wBlendFunc; -PFNGLBLENDFUNCSEPARATEPROC gles3wBlendFuncSeparate; -PFNGLBUFFERDATAPROC gles3wBufferData; -PFNGLBUFFERSUBDATAPROC gles3wBufferSubData; -PFNGLCHECKFRAMEBUFFERSTATUSPROC gles3wCheckFramebufferStatus; -PFNGLCLEARPROC gles3wClear; -PFNGLCLEARCOLORPROC gles3wClearColor; -PFNGLCLEARDEPTHFPROC gles3wClearDepthf; -PFNGLCLEARSTENCILPROC gles3wClearStencil; -PFNGLCOLORMASKPROC gles3wColorMask; -PFNGLCOMPILESHADERPROC gles3wCompileShader; -PFNGLCOMPRESSEDTEXIMAGE2DPROC gles3wCompressedTexImage2D; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC gles3wCompressedTexSubImage2D; -PFNGLCOPYTEXIMAGE2DPROC gles3wCopyTexImage2D; -PFNGLCOPYTEXSUBIMAGE2DPROC gles3wCopyTexSubImage2D; -PFNGLCREATEPROGRAMPROC gles3wCreateProgram; -PFNGLCREATESHADERPROC gles3wCreateShader; -PFNGLCULLFACEPROC gles3wCullFace; -PFNGLDELETEBUFFERSPROC gles3wDeleteBuffers; -PFNGLDELETEFRAMEBUFFERSPROC gles3wDeleteFramebuffers; -PFNGLDELETEPROGRAMPROC gles3wDeleteProgram; -PFNGLDELETERENDERBUFFERSPROC gles3wDeleteRenderbuffers; -PFNGLDELETESHADERPROC gles3wDeleteShader; -PFNGLDELETETEXTURESPROC gles3wDeleteTextures; -PFNGLDEPTHFUNCPROC gles3wDepthFunc; -PFNGLDEPTHMASKPROC gles3wDepthMask; -PFNGLDEPTHRANGEFPROC gles3wDepthRangef; -PFNGLDETACHSHADERPROC gles3wDetachShader; -PFNGLDISABLEPROC gles3wDisable; -PFNGLDISABLEVERTEXATTRIBARRAYPROC gles3wDisableVertexAttribArray; -PFNGLDRAWARRAYSPROC gles3wDrawArrays; -PFNGLDRAWELEMENTSPROC gles3wDrawElements; -PFNGLENABLEPROC gles3wEnable; -PFNGLENABLEVERTEXATTRIBARRAYPROC gles3wEnableVertexAttribArray; -PFNGLFINISHPROC gles3wFinish; -PFNGLFLUSHPROC gles3wFlush; -PFNGLFRAMEBUFFERRENDERBUFFERPROC gles3wFramebufferRenderbuffer; -PFNGLFRAMEBUFFERTEXTURE2DPROC gles3wFramebufferTexture2D; -PFNGLFRONTFACEPROC gles3wFrontFace; -PFNGLGENBUFFERSPROC gles3wGenBuffers; -PFNGLGENERATEMIPMAPPROC gles3wGenerateMipmap; -PFNGLGENFRAMEBUFFERSPROC gles3wGenFramebuffers; -PFNGLGENRENDERBUFFERSPROC gles3wGenRenderbuffers; -PFNGLGENTEXTURESPROC gles3wGenTextures; -PFNGLGETACTIVEATTRIBPROC gles3wGetActiveAttrib; -PFNGLGETACTIVEUNIFORMPROC gles3wGetActiveUniform; -PFNGLGETATTACHEDSHADERSPROC gles3wGetAttachedShaders; -PFNGLGETATTRIBLOCATIONPROC gles3wGetAttribLocation; -PFNGLGETBOOLEANVPROC gles3wGetBooleanv; -PFNGLGETBUFFERPARAMETERIVPROC gles3wGetBufferParameteriv; -PFNGLGETERRORPROC gles3wGetError; -PFNGLGETFLOATVPROC gles3wGetFloatv; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC gles3wGetFramebufferAttachmentParameteriv; -PFNGLGETINTEGERVPROC gles3wGetIntegerv; -PFNGLGETPROGRAMIVPROC gles3wGetProgramiv; -PFNGLGETPROGRAMINFOLOGPROC gles3wGetProgramInfoLog; -PFNGLGETRENDERBUFFERPARAMETERIVPROC gles3wGetRenderbufferParameteriv; -PFNGLGETSHADERIVPROC gles3wGetShaderiv; -PFNGLGETSHADERINFOLOGPROC gles3wGetShaderInfoLog; -PFNGLGETSHADERPRECISIONFORMATPROC gles3wGetShaderPrecisionFormat; -PFNGLGETSHADERSOURCEPROC gles3wGetShaderSource; -PFNGLGETSTRINGPROC gles3wGetString; -PFNGLGETTEXPARAMETERFVPROC gles3wGetTexParameterfv; -PFNGLGETTEXPARAMETERIVPROC gles3wGetTexParameteriv; -PFNGLGETUNIFORMFVPROC gles3wGetUniformfv; -PFNGLGETUNIFORMIVPROC gles3wGetUniformiv; -PFNGLGETUNIFORMLOCATIONPROC gles3wGetUniformLocation; -PFNGLGETVERTEXATTRIBFVPROC gles3wGetVertexAttribfv; -PFNGLGETVERTEXATTRIBIVPROC gles3wGetVertexAttribiv; -PFNGLGETVERTEXATTRIBPOINTERVPROC gles3wGetVertexAttribPointerv; -PFNGLHINTPROC gles3wHint; -PFNGLISBUFFERPROC gles3wIsBuffer; -PFNGLISENABLEDPROC gles3wIsEnabled; -PFNGLISFRAMEBUFFERPROC gles3wIsFramebuffer; -PFNGLISPROGRAMPROC gles3wIsProgram; -PFNGLISRENDERBUFFERPROC gles3wIsRenderbuffer; -PFNGLISSHADERPROC gles3wIsShader; -PFNGLISTEXTUREPROC gles3wIsTexture; -PFNGLLINEWIDTHPROC gles3wLineWidth; -PFNGLLINKPROGRAMPROC gles3wLinkProgram; -PFNGLPIXELSTOREIPROC gles3wPixelStorei; -PFNGLPOLYGONOFFSETPROC gles3wPolygonOffset; -PFNGLREADPIXELSPROC gles3wReadPixels; -PFNGLRELEASESHADERCOMPILERPROC gles3wReleaseShaderCompiler; -PFNGLRENDERBUFFERSTORAGEPROC gles3wRenderbufferStorage; -PFNGLSAMPLECOVERAGEPROC gles3wSampleCoverage; -PFNGLSCISSORPROC gles3wScissor; -PFNGLSHADERBINARYPROC gles3wShaderBinary; -PFNGLSHADERSOURCEPROC gles3wShaderSource; -PFNGLSTENCILFUNCPROC gles3wStencilFunc; -PFNGLSTENCILFUNCSEPARATEPROC gles3wStencilFuncSeparate; -PFNGLSTENCILMASKPROC gles3wStencilMask; -PFNGLSTENCILMASKSEPARATEPROC gles3wStencilMaskSeparate; -PFNGLSTENCILOPPROC gles3wStencilOp; -PFNGLSTENCILOPSEPARATEPROC gles3wStencilOpSeparate; -PFNGLTEXIMAGE2DPROC gles3wTexImage2D; -PFNGLTEXPARAMETERFPROC gles3wTexParameterf; -PFNGLTEXPARAMETERFVPROC gles3wTexParameterfv; -PFNGLTEXPARAMETERIPROC gles3wTexParameteri; -PFNGLTEXPARAMETERIVPROC gles3wTexParameteriv; -PFNGLTEXSUBIMAGE2DPROC gles3wTexSubImage2D; -PFNGLUNIFORM1FPROC gles3wUniform1f; -PFNGLUNIFORM1FVPROC gles3wUniform1fv; -PFNGLUNIFORM1IPROC gles3wUniform1i; -PFNGLUNIFORM1IVPROC gles3wUniform1iv; -PFNGLUNIFORM2FPROC gles3wUniform2f; -PFNGLUNIFORM2FVPROC gles3wUniform2fv; -PFNGLUNIFORM2IPROC gles3wUniform2i; -PFNGLUNIFORM2IVPROC gles3wUniform2iv; -PFNGLUNIFORM3FPROC gles3wUniform3f; -PFNGLUNIFORM3FVPROC gles3wUniform3fv; -PFNGLUNIFORM3IPROC gles3wUniform3i; -PFNGLUNIFORM3IVPROC gles3wUniform3iv; -PFNGLUNIFORM4FPROC gles3wUniform4f; -PFNGLUNIFORM4FVPROC gles3wUniform4fv; -PFNGLUNIFORM4IPROC gles3wUniform4i; -PFNGLUNIFORM4IVPROC gles3wUniform4iv; -PFNGLUNIFORMMATRIX2FVPROC gles3wUniformMatrix2fv; -PFNGLUNIFORMMATRIX3FVPROC gles3wUniformMatrix3fv; -PFNGLUNIFORMMATRIX4FVPROC gles3wUniformMatrix4fv; -PFNGLUSEPROGRAMPROC gles3wUseProgram; -PFNGLVALIDATEPROGRAMPROC gles3wValidateProgram; -PFNGLVERTEXATTRIB1FPROC gles3wVertexAttrib1f; -PFNGLVERTEXATTRIB1FVPROC gles3wVertexAttrib1fv; -PFNGLVERTEXATTRIB2FPROC gles3wVertexAttrib2f; -PFNGLVERTEXATTRIB2FVPROC gles3wVertexAttrib2fv; -PFNGLVERTEXATTRIB3FPROC gles3wVertexAttrib3f; -PFNGLVERTEXATTRIB3FVPROC gles3wVertexAttrib3fv; -PFNGLVERTEXATTRIB4FPROC gles3wVertexAttrib4f; -PFNGLVERTEXATTRIB4FVPROC gles3wVertexAttrib4fv; -PFNGLVERTEXATTRIBPOINTERPROC gles3wVertexAttribPointer; -PFNGLVIEWPORTPROC gles3wViewport; -PFNGLREADBUFFERPROC gles3wReadBuffer; -PFNGLDRAWRANGEELEMENTSPROC gles3wDrawRangeElements; -PFNGLTEXIMAGE3DPROC gles3wTexImage3D; -PFNGLTEXSUBIMAGE3DPROC gles3wTexSubImage3D; -PFNGLCOPYTEXSUBIMAGE3DPROC gles3wCopyTexSubImage3D; -PFNGLCOMPRESSEDTEXIMAGE3DPROC gles3wCompressedTexImage3D; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC gles3wCompressedTexSubImage3D; -PFNGLGENQUERIESPROC gles3wGenQueries; -PFNGLDELETEQUERIESPROC gles3wDeleteQueries; -PFNGLISQUERYPROC gles3wIsQuery; -PFNGLBEGINQUERYPROC gles3wBeginQuery; -PFNGLENDQUERYPROC gles3wEndQuery; -PFNGLGETQUERYIVPROC gles3wGetQueryiv; -PFNGLGETQUERYOBJECTUIVPROC gles3wGetQueryObjectuiv; -PFNGLUNMAPBUFFERPROC gles3wUnmapBuffer; -PFNGLGETBUFFERPOINTERVPROC gles3wGetBufferPointerv; -PFNGLDRAWBUFFERSPROC gles3wDrawBuffers; -PFNGLUNIFORMMATRIX2X3FVPROC gles3wUniformMatrix2x3fv; -PFNGLUNIFORMMATRIX3X2FVPROC gles3wUniformMatrix3x2fv; -PFNGLUNIFORMMATRIX2X4FVPROC gles3wUniformMatrix2x4fv; -PFNGLUNIFORMMATRIX4X2FVPROC gles3wUniformMatrix4x2fv; -PFNGLUNIFORMMATRIX3X4FVPROC gles3wUniformMatrix3x4fv; -PFNGLUNIFORMMATRIX4X3FVPROC gles3wUniformMatrix4x3fv; -PFNGLBLITFRAMEBUFFERPROC gles3wBlitFramebuffer; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC gles3wRenderbufferStorageMultisample; -PFNGLFRAMEBUFFERTEXTURELAYERPROC gles3wFramebufferTextureLayer; -PFNGLMAPBUFFERRANGEPROC gles3wMapBufferRange; -PFNGLFLUSHMAPPEDBUFFERRANGEPROC gles3wFlushMappedBufferRange; -PFNGLBINDVERTEXARRAYPROC gles3wBindVertexArray; -PFNGLDELETEVERTEXARRAYSPROC gles3wDeleteVertexArrays; -PFNGLGENVERTEXARRAYSPROC gles3wGenVertexArrays; -PFNGLISVERTEXARRAYPROC gles3wIsVertexArray; -PFNGLGETINTEGERI_VPROC gles3wGetIntegeri_v; -PFNGLBEGINTRANSFORMFEEDBACKPROC gles3wBeginTransformFeedback; -PFNGLENDTRANSFORMFEEDBACKPROC gles3wEndTransformFeedback; -PFNGLBINDBUFFERRANGEPROC gles3wBindBufferRange; -PFNGLBINDBUFFERBASEPROC gles3wBindBufferBase; -PFNGLTRANSFORMFEEDBACKVARYINGSPROC gles3wTransformFeedbackVaryings; -PFNGLGETTRANSFORMFEEDBACKVARYINGPROC gles3wGetTransformFeedbackVarying; -PFNGLVERTEXATTRIBIPOINTERPROC gles3wVertexAttribIPointer; -PFNGLGETVERTEXATTRIBIIVPROC gles3wGetVertexAttribIiv; -PFNGLGETVERTEXATTRIBIUIVPROC gles3wGetVertexAttribIuiv; -PFNGLVERTEXATTRIBI4IPROC gles3wVertexAttribI4i; -PFNGLVERTEXATTRIBI4UIPROC gles3wVertexAttribI4ui; -PFNGLVERTEXATTRIBI4IVPROC gles3wVertexAttribI4iv; -PFNGLVERTEXATTRIBI4UIVPROC gles3wVertexAttribI4uiv; -PFNGLGETUNIFORMUIVPROC gles3wGetUniformuiv; -PFNGLGETFRAGDATALOCATIONPROC gles3wGetFragDataLocation; -PFNGLUNIFORM1UIPROC gles3wUniform1ui; -PFNGLUNIFORM2UIPROC gles3wUniform2ui; -PFNGLUNIFORM3UIPROC gles3wUniform3ui; -PFNGLUNIFORM4UIPROC gles3wUniform4ui; -PFNGLUNIFORM1UIVPROC gles3wUniform1uiv; -PFNGLUNIFORM2UIVPROC gles3wUniform2uiv; -PFNGLUNIFORM3UIVPROC gles3wUniform3uiv; -PFNGLUNIFORM4UIVPROC gles3wUniform4uiv; -PFNGLCLEARBUFFERIVPROC gles3wClearBufferiv; -PFNGLCLEARBUFFERUIVPROC gles3wClearBufferuiv; -PFNGLCLEARBUFFERFVPROC gles3wClearBufferfv; -PFNGLCLEARBUFFERFIPROC gles3wClearBufferfi; -PFNGLGETSTRINGIPROC gles3wGetStringi; -PFNGLCOPYBUFFERSUBDATAPROC gles3wCopyBufferSubData; -PFNGLGETUNIFORMINDICESPROC gles3wGetUniformIndices; -PFNGLGETACTIVEUNIFORMSIVPROC gles3wGetActiveUniformsiv; -PFNGLGETUNIFORMBLOCKINDEXPROC gles3wGetUniformBlockIndex; -PFNGLGETACTIVEUNIFORMBLOCKIVPROC gles3wGetActiveUniformBlockiv; -PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC gles3wGetActiveUniformBlockName; -PFNGLUNIFORMBLOCKBINDINGPROC gles3wUniformBlockBinding; -PFNGLDRAWARRAYSINSTANCEDPROC gles3wDrawArraysInstanced; -PFNGLDRAWELEMENTSINSTANCEDPROC gles3wDrawElementsInstanced; -PFNGLFENCESYNCPROC gles3wFenceSync; -PFNGLISSYNCPROC gles3wIsSync; -PFNGLDELETESYNCPROC gles3wDeleteSync; -PFNGLCLIENTWAITSYNCPROC gles3wClientWaitSync; -PFNGLWAITSYNCPROC gles3wWaitSync; -PFNGLGETINTEGER64VPROC gles3wGetInteger64v; -PFNGLGETSYNCIVPROC gles3wGetSynciv; -PFNGLGETINTEGER64I_VPROC gles3wGetInteger64i_v; -PFNGLGETBUFFERPARAMETERI64VPROC gles3wGetBufferParameteri64v; -PFNGLGENSAMPLERSPROC gles3wGenSamplers; -PFNGLDELETESAMPLERSPROC gles3wDeleteSamplers; -PFNGLISSAMPLERPROC gles3wIsSampler; -PFNGLBINDSAMPLERPROC gles3wBindSampler; -PFNGLSAMPLERPARAMETERIPROC gles3wSamplerParameteri; -PFNGLSAMPLERPARAMETERIVPROC gles3wSamplerParameteriv; -PFNGLSAMPLERPARAMETERFPROC gles3wSamplerParameterf; -PFNGLSAMPLERPARAMETERFVPROC gles3wSamplerParameterfv; -PFNGLGETSAMPLERPARAMETERIVPROC gles3wGetSamplerParameteriv; -PFNGLGETSAMPLERPARAMETERFVPROC gles3wGetSamplerParameterfv; -PFNGLVERTEXATTRIBDIVISORPROC gles3wVertexAttribDivisor; -PFNGLBINDTRANSFORMFEEDBACKPROC gles3wBindTransformFeedback; -PFNGLDELETETRANSFORMFEEDBACKSPROC gles3wDeleteTransformFeedbacks; -PFNGLGENTRANSFORMFEEDBACKSPROC gles3wGenTransformFeedbacks; -PFNGLISTRANSFORMFEEDBACKPROC gles3wIsTransformFeedback; -PFNGLPAUSETRANSFORMFEEDBACKPROC gles3wPauseTransformFeedback; -PFNGLRESUMETRANSFORMFEEDBACKPROC gles3wResumeTransformFeedback; -PFNGLGETPROGRAMBINARYPROC gles3wGetProgramBinary; -PFNGLPROGRAMBINARYPROC gles3wProgramBinary; -PFNGLPROGRAMPARAMETERIPROC gles3wProgramParameteri; -PFNGLINVALIDATEFRAMEBUFFERPROC gles3wInvalidateFramebuffer; -PFNGLINVALIDATESUBFRAMEBUFFERPROC gles3wInvalidateSubFramebuffer; -PFNGLTEXSTORAGE2DPROC gles3wTexStorage2D; -PFNGLTEXSTORAGE3DPROC gles3wTexStorage3D; -PFNGLGETINTERNALFORMATIVPROC gles3wGetInternalformativ; -PFNGLUSEPROGRAMSTAGESEXTPROC gles3wUseProgramStagesEXT; -PFNGLACTIVESHADERPROGRAMEXTPROC gles3wActiveShaderProgramEXT; -PFNGLCREATESHADERPROGRAMVEXTPROC gles3wCreateShaderProgramvEXT; -PFNGLBINDPROGRAMPIPELINEEXTPROC gles3wBindProgramPipelineEXT; -PFNGLDELETEPROGRAMPIPELINESEXTPROC gles3wDeleteProgramPipelinesEXT; -PFNGLGENPROGRAMPIPELINESEXTPROC gles3wGenProgramPipelinesEXT; -PFNGLISPROGRAMPIPELINEEXTPROC gles3wIsProgramPipelineEXT; -PFNGLPROGRAMPARAMETERIEXTPROC gles3wProgramParameteriEXT; -PFNGLGETPROGRAMPIPELINEIVEXTPROC gles3wGetProgramPipelineivEXT; -PFNGLPROGRAMUNIFORM1IEXTPROC gles3wProgramUniform1iEXT; -PFNGLPROGRAMUNIFORM2IEXTPROC gles3wProgramUniform2iEXT; -PFNGLPROGRAMUNIFORM3IEXTPROC gles3wProgramUniform3iEXT; -PFNGLPROGRAMUNIFORM4IEXTPROC gles3wProgramUniform4iEXT; -PFNGLPROGRAMUNIFORM1FEXTPROC gles3wProgramUniform1fEXT; -PFNGLPROGRAMUNIFORM2FEXTPROC gles3wProgramUniform2fEXT; -PFNGLPROGRAMUNIFORM3FEXTPROC gles3wProgramUniform3fEXT; -PFNGLPROGRAMUNIFORM4FEXTPROC gles3wProgramUniform4fEXT; -PFNGLPROGRAMUNIFORM1IVEXTPROC gles3wProgramUniform1ivEXT; -PFNGLPROGRAMUNIFORM2IVEXTPROC gles3wProgramUniform2ivEXT; -PFNGLPROGRAMUNIFORM3IVEXTPROC gles3wProgramUniform3ivEXT; -PFNGLPROGRAMUNIFORM4IVEXTPROC gles3wProgramUniform4ivEXT; -PFNGLPROGRAMUNIFORM1FVEXTPROC gles3wProgramUniform1fvEXT; -PFNGLPROGRAMUNIFORM2FVEXTPROC gles3wProgramUniform2fvEXT; -PFNGLPROGRAMUNIFORM3FVEXTPROC gles3wProgramUniform3fvEXT; -PFNGLPROGRAMUNIFORM4FVEXTPROC gles3wProgramUniform4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC gles3wProgramUniformMatrix2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC gles3wProgramUniformMatrix3fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC gles3wProgramUniformMatrix4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC gles3wProgramUniformMatrix2x3fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC gles3wProgramUniformMatrix3x2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC gles3wProgramUniformMatrix2x4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC gles3wProgramUniformMatrix4x2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC gles3wProgramUniformMatrix3x4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC gles3wProgramUniformMatrix4x3fvEXT; -PFNGLVALIDATEPROGRAMPIPELINEEXTPROC gles3wValidateProgramPipelineEXT; -PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC gles3wGetProgramPipelineInfoLogEXT; -PFNGLLABELOBJECTEXTPROC gles3wLabelObjectEXT; -PFNGLGETOBJECTLABELEXTPROC gles3wGetObjectLabelEXT; -PFNGLINSERTEVENTMARKEREXTPROC gles3wInsertEventMarkerEXT; -PFNGLPUSHGROUPMARKEREXTPROC gles3wPushGroupMarkerEXT; -PFNGLPOPGROUPMARKEREXTPROC gles3wPopGroupMarkerEXT; - -PFNGLDEBUGMESSAGECONTROLKHRPROC gles3wDebugMessageControlKHR; -PFNGLDEBUGMESSAGECALLBACKKHRPROC gles3wDebugMessageCallbackKHR; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC gles3wFramebufferTexture2DMultisampleEXT; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC gles3wFramebufferTexture2DMultisampleIMG; - -static void load_procs(void) -{ - gles3wActiveTexture = (PFNGLACTIVETEXTUREPROC) get_proc("glActiveTexture"); - gles3wAttachShader = (PFNGLATTACHSHADERPROC) get_proc("glAttachShader"); - gles3wBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) get_proc("glBindAttribLocation"); - gles3wBindBuffer = (PFNGLBINDBUFFERPROC) get_proc("glBindBuffer"); - gles3wBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) get_proc("glBindFramebuffer"); - gles3wBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) get_proc("glBindRenderbuffer"); - gles3wBindTexture = (PFNGLBINDTEXTUREPROC) get_proc("glBindTexture"); - gles3wBlendColor = (PFNGLBLENDCOLORPROC) get_proc("glBlendColor"); - gles3wBlendEquation = (PFNGLBLENDEQUATIONPROC) get_proc("glBlendEquation"); - gles3wBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) get_proc("glBlendEquationSeparate"); - gles3wBlendFunc = (PFNGLBLENDFUNCPROC) get_proc("glBlendFunc"); - gles3wBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) get_proc("glBlendFuncSeparate"); - gles3wBufferData = (PFNGLBUFFERDATAPROC) get_proc("glBufferData"); - gles3wBufferSubData = (PFNGLBUFFERSUBDATAPROC) get_proc("glBufferSubData"); - gles3wCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) get_proc("glCheckFramebufferStatus"); - gles3wClear = (PFNGLCLEARPROC) get_proc("glClear"); - gles3wClearColor = (PFNGLCLEARCOLORPROC) get_proc("glClearColor"); - gles3wClearDepthf = (PFNGLCLEARDEPTHFPROC) get_proc("glClearDepthf"); - gles3wClearStencil = (PFNGLCLEARSTENCILPROC) get_proc("glClearStencil"); - gles3wColorMask = (PFNGLCOLORMASKPROC) get_proc("glColorMask"); - gles3wCompileShader = (PFNGLCOMPILESHADERPROC) get_proc("glCompileShader"); - gles3wCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) get_proc("glCompressedTexImage2D"); - gles3wCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) get_proc("glCompressedTexSubImage2D"); - gles3wCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) get_proc("glCopyTexImage2D"); - gles3wCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) get_proc("glCopyTexSubImage2D"); - gles3wCreateProgram = (PFNGLCREATEPROGRAMPROC) get_proc("glCreateProgram"); - gles3wCreateShader = (PFNGLCREATESHADERPROC) get_proc("glCreateShader"); - gles3wCullFace = (PFNGLCULLFACEPROC) get_proc("glCullFace"); - gles3wDeleteBuffers = (PFNGLDELETEBUFFERSPROC) get_proc("glDeleteBuffers"); - gles3wDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) get_proc("glDeleteFramebuffers"); - gles3wDeleteProgram = (PFNGLDELETEPROGRAMPROC) get_proc("glDeleteProgram"); - gles3wDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) get_proc("glDeleteRenderbuffers"); - gles3wDeleteShader = (PFNGLDELETESHADERPROC) get_proc("glDeleteShader"); - gles3wDeleteTextures = (PFNGLDELETETEXTURESPROC) get_proc("glDeleteTextures"); - gles3wDepthFunc = (PFNGLDEPTHFUNCPROC) get_proc("glDepthFunc"); - gles3wDepthMask = (PFNGLDEPTHMASKPROC) get_proc("glDepthMask"); - gles3wDepthRangef = (PFNGLDEPTHRANGEFPROC) get_proc("glDepthRangef"); - gles3wDetachShader = (PFNGLDETACHSHADERPROC) get_proc("glDetachShader"); - gles3wDisable = (PFNGLDISABLEPROC) get_proc("glDisable"); - gles3wDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) get_proc("glDisableVertexAttribArray"); - gles3wDrawArrays = (PFNGLDRAWARRAYSPROC) get_proc("glDrawArrays"); - gles3wDrawElements = (PFNGLDRAWELEMENTSPROC) get_proc("glDrawElements"); - gles3wEnable = (PFNGLENABLEPROC) get_proc("glEnable"); - gles3wEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) get_proc("glEnableVertexAttribArray"); - gles3wFinish = (PFNGLFINISHPROC) get_proc("glFinish"); - gles3wFlush = (PFNGLFLUSHPROC) get_proc("glFlush"); - gles3wFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) get_proc("glFramebufferRenderbuffer"); - gles3wFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) get_proc("glFramebufferTexture2D"); - gles3wFrontFace = (PFNGLFRONTFACEPROC) get_proc("glFrontFace"); - gles3wGenBuffers = (PFNGLGENBUFFERSPROC) get_proc("glGenBuffers"); - gles3wGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) get_proc("glGenerateMipmap"); - gles3wGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) get_proc("glGenFramebuffers"); - gles3wGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) get_proc("glGenRenderbuffers"); - gles3wGenTextures = (PFNGLGENTEXTURESPROC) get_proc("glGenTextures"); - gles3wGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) get_proc("glGetActiveAttrib"); - gles3wGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) get_proc("glGetActiveUniform"); - gles3wGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) get_proc("glGetAttachedShaders"); - gles3wGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) get_proc("glGetAttribLocation"); - gles3wGetBooleanv = (PFNGLGETBOOLEANVPROC) get_proc("glGetBooleanv"); - gles3wGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) get_proc("glGetBufferParameteriv"); - gles3wGetError = (PFNGLGETERRORPROC) get_proc("glGetError"); - gles3wGetFloatv = (PFNGLGETFLOATVPROC) get_proc("glGetFloatv"); - gles3wGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) get_proc("glGetFramebufferAttachmentParameteriv"); - gles3wGetIntegerv = (PFNGLGETINTEGERVPROC) get_proc("glGetIntegerv"); - gles3wGetProgramiv = (PFNGLGETPROGRAMIVPROC) get_proc("glGetProgramiv"); - gles3wGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) get_proc("glGetProgramInfoLog"); - gles3wGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) get_proc("glGetRenderbufferParameteriv"); - gles3wGetShaderiv = (PFNGLGETSHADERIVPROC) get_proc("glGetShaderiv"); - gles3wGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) get_proc("glGetShaderInfoLog"); - gles3wGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC) get_proc("glGetShaderPrecisionFormat"); - gles3wGetShaderSource = (PFNGLGETSHADERSOURCEPROC) get_proc("glGetShaderSource"); - gles3wGetString = (PFNGLGETSTRINGPROC) get_proc("glGetString"); - gles3wGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) get_proc("glGetTexParameterfv"); - gles3wGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) get_proc("glGetTexParameteriv"); - gles3wGetUniformfv = (PFNGLGETUNIFORMFVPROC) get_proc("glGetUniformfv"); - gles3wGetUniformiv = (PFNGLGETUNIFORMIVPROC) get_proc("glGetUniformiv"); - gles3wGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) get_proc("glGetUniformLocation"); - gles3wGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) get_proc("glGetVertexAttribfv"); - gles3wGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) get_proc("glGetVertexAttribiv"); - gles3wGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) get_proc("glGetVertexAttribPointerv"); - gles3wHint = (PFNGLHINTPROC) get_proc("glHint"); - gles3wIsBuffer = (PFNGLISBUFFERPROC) get_proc("glIsBuffer"); - gles3wIsEnabled = (PFNGLISENABLEDPROC) get_proc("glIsEnabled"); - gles3wIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) get_proc("glIsFramebuffer"); - gles3wIsProgram = (PFNGLISPROGRAMPROC) get_proc("glIsProgram"); - gles3wIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) get_proc("glIsRenderbuffer"); - gles3wIsShader = (PFNGLISSHADERPROC) get_proc("glIsShader"); - gles3wIsTexture = (PFNGLISTEXTUREPROC) get_proc("glIsTexture"); - gles3wLineWidth = (PFNGLLINEWIDTHPROC) get_proc("glLineWidth"); - gles3wLinkProgram = (PFNGLLINKPROGRAMPROC) get_proc("glLinkProgram"); - gles3wPixelStorei = (PFNGLPIXELSTOREIPROC) get_proc("glPixelStorei"); - gles3wPolygonOffset = (PFNGLPOLYGONOFFSETPROC) get_proc("glPolygonOffset"); - gles3wReadPixels = (PFNGLREADPIXELSPROC) get_proc("glReadPixels"); - gles3wReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC) get_proc("glReleaseShaderCompiler"); - gles3wRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) get_proc("glRenderbufferStorage"); - gles3wSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) get_proc("glSampleCoverage"); - gles3wScissor = (PFNGLSCISSORPROC) get_proc("glScissor"); - gles3wShaderBinary = (PFNGLSHADERBINARYPROC) get_proc("glShaderBinary"); - gles3wShaderSource = (PFNGLSHADERSOURCEPROC) get_proc("glShaderSource"); - gles3wStencilFunc = (PFNGLSTENCILFUNCPROC) get_proc("glStencilFunc"); - gles3wStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) get_proc("glStencilFuncSeparate"); - gles3wStencilMask = (PFNGLSTENCILMASKPROC) get_proc("glStencilMask"); - gles3wStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) get_proc("glStencilMaskSeparate"); - gles3wStencilOp = (PFNGLSTENCILOPPROC) get_proc("glStencilOp"); - gles3wStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) get_proc("glStencilOpSeparate"); - gles3wTexImage2D = (PFNGLTEXIMAGE2DPROC) get_proc("glTexImage2D"); - gles3wTexParameterf = (PFNGLTEXPARAMETERFPROC) get_proc("glTexParameterf"); - gles3wTexParameterfv = (PFNGLTEXPARAMETERFVPROC) get_proc("glTexParameterfv"); - gles3wTexParameteri = (PFNGLTEXPARAMETERIPROC) get_proc("glTexParameteri"); - gles3wTexParameteriv = (PFNGLTEXPARAMETERIVPROC) get_proc("glTexParameteriv"); - gles3wTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) get_proc("glTexSubImage2D"); - gles3wUniform1f = (PFNGLUNIFORM1FPROC) get_proc("glUniform1f"); - gles3wUniform1fv = (PFNGLUNIFORM1FVPROC) get_proc("glUniform1fv"); - gles3wUniform1i = (PFNGLUNIFORM1IPROC) get_proc("glUniform1i"); - gles3wUniform1iv = (PFNGLUNIFORM1IVPROC) get_proc("glUniform1iv"); - gles3wUniform2f = (PFNGLUNIFORM2FPROC) get_proc("glUniform2f"); - gles3wUniform2fv = (PFNGLUNIFORM2FVPROC) get_proc("glUniform2fv"); - gles3wUniform2i = (PFNGLUNIFORM2IPROC) get_proc("glUniform2i"); - gles3wUniform2iv = (PFNGLUNIFORM2IVPROC) get_proc("glUniform2iv"); - gles3wUniform3f = (PFNGLUNIFORM3FPROC) get_proc("glUniform3f"); - gles3wUniform3fv = (PFNGLUNIFORM3FVPROC) get_proc("glUniform3fv"); - gles3wUniform3i = (PFNGLUNIFORM3IPROC) get_proc("glUniform3i"); - gles3wUniform3iv = (PFNGLUNIFORM3IVPROC) get_proc("glUniform3iv"); - gles3wUniform4f = (PFNGLUNIFORM4FPROC) get_proc("glUniform4f"); - gles3wUniform4fv = (PFNGLUNIFORM4FVPROC) get_proc("glUniform4fv"); - gles3wUniform4i = (PFNGLUNIFORM4IPROC) get_proc("glUniform4i"); - gles3wUniform4iv = (PFNGLUNIFORM4IVPROC) get_proc("glUniform4iv"); - gles3wUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) get_proc("glUniformMatrix2fv"); - gles3wUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) get_proc("glUniformMatrix3fv"); - gles3wUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) get_proc("glUniformMatrix4fv"); - gles3wUseProgram = (PFNGLUSEPROGRAMPROC) get_proc("glUseProgram"); - gles3wValidateProgram = (PFNGLVALIDATEPROGRAMPROC) get_proc("glValidateProgram"); - gles3wVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) get_proc("glVertexAttrib1f"); - gles3wVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) get_proc("glVertexAttrib1fv"); - gles3wVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) get_proc("glVertexAttrib2f"); - gles3wVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) get_proc("glVertexAttrib2fv"); - gles3wVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) get_proc("glVertexAttrib3f"); - gles3wVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) get_proc("glVertexAttrib3fv"); - gles3wVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) get_proc("glVertexAttrib4f"); - gles3wVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) get_proc("glVertexAttrib4fv"); - gles3wVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) get_proc("glVertexAttribPointer"); - gles3wViewport = (PFNGLVIEWPORTPROC) get_proc("glViewport"); - gles3wReadBuffer = (PFNGLREADBUFFERPROC) get_proc("glReadBuffer"); - gles3wDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) get_proc("glDrawRangeElements"); - gles3wTexImage3D = (PFNGLTEXIMAGE3DPROC) get_proc("glTexImage3D"); - gles3wTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC) get_proc("glTexSubImage3D"); - gles3wCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC) get_proc("glCopyTexSubImage3D"); - gles3wCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC) get_proc("glCompressedTexImage3D"); - gles3wCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) get_proc("glCompressedTexSubImage3D"); - gles3wGenQueries = (PFNGLGENQUERIESPROC) get_proc("glGenQueries"); - gles3wDeleteQueries = (PFNGLDELETEQUERIESPROC) get_proc("glDeleteQueries"); - gles3wIsQuery = (PFNGLISQUERYPROC) get_proc("glIsQuery"); - gles3wBeginQuery = (PFNGLBEGINQUERYPROC) get_proc("glBeginQuery"); - gles3wEndQuery = (PFNGLENDQUERYPROC) get_proc("glEndQuery"); - gles3wGetQueryiv = (PFNGLGETQUERYIVPROC) get_proc("glGetQueryiv"); - gles3wGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) get_proc("glGetQueryObjectuiv"); - gles3wUnmapBuffer = (PFNGLUNMAPBUFFERPROC) get_proc("glUnmapBuffer"); - gles3wGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) get_proc("glGetBufferPointerv"); - gles3wDrawBuffers = (PFNGLDRAWBUFFERSPROC) get_proc("glDrawBuffers"); - gles3wUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) get_proc("glUniformMatrix2x3fv"); - gles3wUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC) get_proc("glUniformMatrix3x2fv"); - gles3wUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC) get_proc("glUniformMatrix2x4fv"); - gles3wUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC) get_proc("glUniformMatrix4x2fv"); - gles3wUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC) get_proc("glUniformMatrix3x4fv"); - gles3wUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC) get_proc("glUniformMatrix4x3fv"); - gles3wBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) get_proc("glBlitFramebuffer"); - gles3wRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) get_proc("glRenderbufferStorageMultisample"); - gles3wFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) get_proc("glFramebufferTextureLayer"); - gles3wMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) get_proc("glMapBufferRange"); - gles3wFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) get_proc("glFlushMappedBufferRange"); - gles3wBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) get_proc("glBindVertexArray"); - gles3wDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) get_proc("glDeleteVertexArrays"); - gles3wGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) get_proc("glGenVertexArrays"); - gles3wIsVertexArray = (PFNGLISVERTEXARRAYPROC) get_proc("glIsVertexArray"); - gles3wGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) get_proc("glGetIntegeri_v"); - gles3wBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) get_proc("glBeginTransformFeedback"); - gles3wEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) get_proc("glEndTransformFeedback"); - gles3wBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) get_proc("glBindBufferRange"); - gles3wBindBufferBase = (PFNGLBINDBUFFERBASEPROC) get_proc("glBindBufferBase"); - gles3wTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) get_proc("glTransformFeedbackVaryings"); - gles3wGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) get_proc("glGetTransformFeedbackVarying"); - gles3wVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) get_proc("glVertexAttribIPointer"); - gles3wGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC) get_proc("glGetVertexAttribIiv"); - gles3wGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC) get_proc("glGetVertexAttribIuiv"); - gles3wVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC) get_proc("glVertexAttribI4i"); - gles3wVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC) get_proc("glVertexAttribI4ui"); - gles3wVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC) get_proc("glVertexAttribI4iv"); - gles3wVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC) get_proc("glVertexAttribI4uiv"); - gles3wGetUniformuiv = (PFNGLGETUNIFORMUIVPROC) get_proc("glGetUniformuiv"); - gles3wGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC) get_proc("glGetFragDataLocation"); - gles3wUniform1ui = (PFNGLUNIFORM1UIPROC) get_proc("glUniform1ui"); - gles3wUniform2ui = (PFNGLUNIFORM2UIPROC) get_proc("glUniform2ui"); - gles3wUniform3ui = (PFNGLUNIFORM3UIPROC) get_proc("glUniform3ui"); - gles3wUniform4ui = (PFNGLUNIFORM4UIPROC) get_proc("glUniform4ui"); - gles3wUniform1uiv = (PFNGLUNIFORM1UIVPROC) get_proc("glUniform1uiv"); - gles3wUniform2uiv = (PFNGLUNIFORM2UIVPROC) get_proc("glUniform2uiv"); - gles3wUniform3uiv = (PFNGLUNIFORM3UIVPROC) get_proc("glUniform3uiv"); - gles3wUniform4uiv = (PFNGLUNIFORM4UIVPROC) get_proc("glUniform4uiv"); - gles3wClearBufferiv = (PFNGLCLEARBUFFERIVPROC) get_proc("glClearBufferiv"); - gles3wClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC) get_proc("glClearBufferuiv"); - gles3wClearBufferfv = (PFNGLCLEARBUFFERFVPROC) get_proc("glClearBufferfv"); - gles3wClearBufferfi = (PFNGLCLEARBUFFERFIPROC) get_proc("glClearBufferfi"); - gles3wGetStringi = (PFNGLGETSTRINGIPROC) get_proc("glGetStringi"); - gles3wCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC) get_proc("glCopyBufferSubData"); - gles3wGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC) get_proc("glGetUniformIndices"); - gles3wGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC) get_proc("glGetActiveUniformsiv"); - gles3wGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) get_proc("glGetUniformBlockIndex"); - gles3wGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC) get_proc("glGetActiveUniformBlockiv"); - gles3wGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) get_proc("glGetActiveUniformBlockName"); - gles3wUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) get_proc("glUniformBlockBinding"); - gles3wDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) get_proc("glDrawArraysInstanced"); - gles3wDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) get_proc("glDrawElementsInstanced"); - gles3wFenceSync = (PFNGLFENCESYNCPROC) get_proc("glFenceSync"); - gles3wIsSync = (PFNGLISSYNCPROC) get_proc("glIsSync"); - gles3wDeleteSync = (PFNGLDELETESYNCPROC) get_proc("glDeleteSync"); - gles3wClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) get_proc("glClientWaitSync"); - gles3wWaitSync = (PFNGLWAITSYNCPROC) get_proc("glWaitSync"); - gles3wGetInteger64v = (PFNGLGETINTEGER64VPROC) get_proc("glGetInteger64v"); - gles3wGetSynciv = (PFNGLGETSYNCIVPROC) get_proc("glGetSynciv"); - gles3wGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC) get_proc("glGetInteger64i_v"); - gles3wGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC) get_proc("glGetBufferParameteri64v"); - gles3wGenSamplers = (PFNGLGENSAMPLERSPROC) get_proc("glGenSamplers"); - gles3wDeleteSamplers = (PFNGLDELETESAMPLERSPROC) get_proc("glDeleteSamplers"); - gles3wIsSampler = (PFNGLISSAMPLERPROC) get_proc("glIsSampler"); - gles3wBindSampler = (PFNGLBINDSAMPLERPROC) get_proc("glBindSampler"); - gles3wSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC) get_proc("glSamplerParameteri"); - gles3wSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC) get_proc("glSamplerParameteriv"); - gles3wSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC) get_proc("glSamplerParameterf"); - gles3wSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC) get_proc("glSamplerParameterfv"); - gles3wGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC) get_proc("glGetSamplerParameteriv"); - gles3wGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC) get_proc("glGetSamplerParameterfv"); - gles3wVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) get_proc("glVertexAttribDivisor"); - gles3wBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC) get_proc("glBindTransformFeedback"); - gles3wDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC) get_proc("glDeleteTransformFeedbacks"); - gles3wGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC) get_proc("glGenTransformFeedbacks"); - gles3wIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC) get_proc("glIsTransformFeedback"); - gles3wPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC) get_proc("glPauseTransformFeedback"); - gles3wResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC) get_proc("glResumeTransformFeedback"); - gles3wGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC) get_proc("glGetProgramBinary"); - gles3wProgramBinary = (PFNGLPROGRAMBINARYPROC) get_proc("glProgramBinary"); - gles3wProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC) get_proc("glProgramParameteri"); - gles3wInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC) get_proc("glInvalidateFramebuffer"); - gles3wInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC) get_proc("glInvalidateSubFramebuffer"); - gles3wTexStorage2D = (PFNGLTEXSTORAGE2DPROC) get_proc("glTexStorage2D"); - gles3wTexStorage3D = (PFNGLTEXSTORAGE3DPROC) get_proc("glTexStorage3D"); - gles3wGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC) get_proc("glGetInternalformativ"); - gles3wLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC) get_proc("glLabelObjectEXT"); - gles3wGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC) get_proc("glGetObjectLabelEXT"); - gles3wInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC) get_proc("glInsertEventMarkerEXT"); - gles3wPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC) get_proc("glPushGroupMarkerEXT"); - gles3wPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC) get_proc("glPopGroupMarkerEXT"); - gles3wUseProgramStagesEXT = (PFNGLUSEPROGRAMSTAGESEXTPROC) get_proc("glUseProgramStagesEXT"); - gles3wActiveShaderProgramEXT = (PFNGLACTIVESHADERPROGRAMEXTPROC) get_proc("glActiveShaderProgramEXT"); - gles3wCreateShaderProgramvEXT = (PFNGLCREATESHADERPROGRAMVEXTPROC) get_proc("glCreateShaderProgramvEXT"); - gles3wBindProgramPipelineEXT = (PFNGLBINDPROGRAMPIPELINEEXTPROC) get_proc("glBindProgramPipelineEXT"); - gles3wDeleteProgramPipelinesEXT = (PFNGLDELETEPROGRAMPIPELINESEXTPROC) get_proc("glDeleteProgramPipelinesEXT"); - gles3wGenProgramPipelinesEXT = (PFNGLGENPROGRAMPIPELINESEXTPROC) get_proc("glGenProgramPipelinesEXT"); - gles3wIsProgramPipelineEXT = (PFNGLISPROGRAMPIPELINEEXTPROC) get_proc("glIsProgramPipelineEXT"); - gles3wProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC) get_proc("glProgramParameteriEXT"); - gles3wGetProgramPipelineivEXT = (PFNGLGETPROGRAMPIPELINEIVEXTPROC) get_proc("glGetProgramPipelineivEXT"); - gles3wProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC) get_proc("glProgramUniform1iEXT"); - gles3wProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC) get_proc("glProgramUniform2iEXT"); - gles3wProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC) get_proc("glProgramUniform3iEXT"); - gles3wProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC) get_proc("glProgramUniform4iEXT"); - gles3wProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC) get_proc("glProgramUniform1fEXT"); - gles3wProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC) get_proc("glProgramUniform2fEXT"); - gles3wProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC) get_proc("glProgramUniform3fEXT"); - gles3wProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC) get_proc("glProgramUniform4fEXT"); - gles3wProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC) get_proc("glProgramUniform1ivEXT"); - gles3wProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC) get_proc("glProgramUniform2ivEXT"); - gles3wProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC) get_proc("glProgramUniform3ivEXT"); - gles3wProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC) get_proc("glProgramUniform4ivEXT"); - gles3wProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC) get_proc("glProgramUniform1fvEXT"); - gles3wProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC) get_proc("glProgramUniform2fvEXT"); - gles3wProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC) get_proc("glProgramUniform3fvEXT"); - gles3wProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC) get_proc("glProgramUniform4fvEXT"); - gles3wProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) get_proc("glProgramUniformMatrix2fvEXT"); - gles3wProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) get_proc("glProgramUniformMatrix3fvEXT"); - gles3wProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) get_proc("glProgramUniformMatrix4fvEXT"); - gles3wProgramUniformMatrix2x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) get_proc("glProgramUniformMatrix2x3fvEXT"); - gles3wProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) get_proc("glProgramUniformMatrix3x2fvEXT"); - gles3wProgramUniformMatrix2x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) get_proc("glProgramUniformMatrix2x4fvEXT"); - gles3wProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) get_proc("glProgramUniformMatrix4x2fvEXT"); - gles3wProgramUniformMatrix3x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) get_proc("glProgramUniformMatrix3x4fvEXT"); - gles3wProgramUniformMatrix4x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) get_proc("glProgramUniformMatrix4x3fvEXT"); - gles3wValidateProgramPipelineEXT = (PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) get_proc("glValidateProgramPipelineEXT"); - gles3wGetProgramPipelineInfoLogEXT = (PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) get_proc("glGetProgramPipelineInfoLogEXT"); - - gles3wDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC)get_proc("glDebugMessageControlKHR"); - gles3wDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)get_proc("glDebugMessageCallbackKHR"); - gles3wFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)get_proc("glFramebufferTexture2DMultisampleEXT"); - gles3wFramebufferTexture2DMultisampleIMG = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC)get_proc("glFramebufferTexture2DMultisampleIMG"); -} diff --git a/native/cocos/renderer/gfx-gles3/gles3w.h b/native/cocos/renderer/gfx-gles3/gles3w.h deleted file mode 100755 index 84139e4f98..0000000000 --- a/native/cocos/renderer/gfx-gles3/gles3w.h +++ /dev/null @@ -1,958 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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. -****************************************************************************/ -#pragma once - -#if defined(__APPLE__) || defined(__APPLE_CC__) - #include - #if TARGET_OS_IPHONE - #include - // Prevent Apple's non-standard extension header from being included - #define __gl_es30ext_h_ - #else - #include - #endif -#else - #include -#endif - -#include -#include -#include -#include - -#ifndef __gl3_h_ - #define __gl3_h_ -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef GL_EXT_texture_sRGB - #define GL_EXT_texture_sRGB 1 - - #define GL_SRGB_EXT 0x8C40 - #define GL_SRGB8_EXT 0x8C41 - #define GL_SRGB_ALPHA_EXT 0x8C42 - #define GL_SRGB8_ALPHA8_EXT 0x8C43 - #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 - -#endif /* GL_EXT_texture_sRGB */ - -/* gles3w api */ -int gles3wInit(); -int gles3wIsSupported(int major, int minor); -void *gles3wGetProcAddress(const char *proc); - -/* OpenGL functions */ -typedef void(GL_APIENTRY *PFNGLACTIVETEXTUREPROC)(GLenum texture); -typedef void(GL_APIENTRY *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); -typedef void(GL_APIENTRY *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); -typedef void(GL_APIENTRY *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); -typedef void(GL_APIENTRY *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); -typedef void(GL_APIENTRY *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -typedef void(GL_APIENTRY *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void(GL_APIENTRY *PFNGLBLENDEQUATIONPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); -typedef void(GL_APIENTRY *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -typedef void(GL_APIENTRY *PFNGLBLENDFUNCSEPARATEPROC)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void(GL_APIENTRY *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void(GL_APIENTRY *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef GLenum(GL_APIENTRY *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLCLEARPROC)(GLbitfield mask); -typedef void(GL_APIENTRY *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void(GL_APIENTRY *PFNGLCLEARDEPTHFPROC)(GLfloat depth); -typedef void(GL_APIENTRY *PFNGLCLEARSTENCILPROC)(GLint s); -typedef void(GL_APIENTRY *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -typedef void(GL_APIENTRY *PFNGLCOMPILESHADERPROC)(GLuint shader); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void(GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef GLuint(GL_APIENTRY *PFNGLCREATEPROGRAMPROC)(void); -typedef GLuint(GL_APIENTRY *PFNGLCREATESHADERPROC)(GLenum type); -typedef void(GL_APIENTRY *PFNGLCULLFACEPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); -typedef void(GL_APIENTRY *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); -typedef void(GL_APIENTRY *PFNGLDELETEPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); -typedef void(GL_APIENTRY *PFNGLDELETESHADERPROC)(GLuint shader); -typedef void(GL_APIENTRY *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); -typedef void(GL_APIENTRY *PFNGLDEPTHFUNCPROC)(GLenum func); -typedef void(GL_APIENTRY *PFNGLDEPTHMASKPROC)(GLboolean flag); -typedef void(GL_APIENTRY *PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); -typedef void(GL_APIENTRY *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); -typedef void(GL_APIENTRY *PFNGLDISABLEPROC)(GLenum cap); -typedef void(GL_APIENTRY *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); -typedef void(GL_APIENTRY *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -typedef void(GL_APIENTRY *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -typedef void(GL_APIENTRY *PFNGLENABLEPROC)(GLenum cap); -typedef void(GL_APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); -typedef void(GL_APIENTRY *PFNGLFINISHPROC)(void); -typedef void(GL_APIENTRY *PFNGLFLUSHPROC)(void); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void(GL_APIENTRY *PFNGLFRONTFACEPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); -typedef void(GL_APIENTRY *PFNGLGENERATEMIPMAPPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); -typedef void(GL_APIENTRY *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); -typedef void(GL_APIENTRY *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); -typedef void(GL_APIENTRY *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders); -typedef GLint(GL_APIENTRY *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *params); -typedef void(GL_APIENTRY *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef GLenum(GL_APIENTRY *PFNGLGETERRORPROC)(void); -typedef void(GL_APIENTRY *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETINTEGERVPROC)(GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog); -typedef void(GL_APIENTRY *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog); -typedef void(GL_APIENTRY *PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -typedef void(GL_APIENTRY *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -typedef const GLubyte *(GL_APIENTRY *PFNGLGETSTRINGPROC)(GLenum name); -typedef void(GL_APIENTRY *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); -typedef GLint(GL_APIENTRY *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, GLvoid **pointer); -typedef void(GL_APIENTRY *PFNGLHINTPROC)(GLenum target, GLenum mode); -typedef GLboolean(GL_APIENTRY *PFNGLISBUFFERPROC)(GLuint buffer); -typedef GLboolean(GL_APIENTRY *PFNGLISENABLEDPROC)(GLenum cap); -typedef GLboolean(GL_APIENTRY *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); -typedef GLboolean(GL_APIENTRY *PFNGLISPROGRAMPROC)(GLuint program); -typedef GLboolean(GL_APIENTRY *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); -typedef GLboolean(GL_APIENTRY *PFNGLISSHADERPROC)(GLuint shader); -typedef GLboolean(GL_APIENTRY *PFNGLISTEXTUREPROC)(GLuint texture); -typedef void(GL_APIENTRY *PFNGLLINEWIDTHPROC)(GLfloat width); -typedef void(GL_APIENTRY *PFNGLLINKPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); -typedef void(GL_APIENTRY *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); -typedef void(GL_APIENTRY *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLRELEASESHADERCOMPILERPROC)(void); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); -typedef void(GL_APIENTRY *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLSHADERBINARYPROC)(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); -typedef void(GL_APIENTRY *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length); -typedef void(GL_APIENTRY *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILMASKPROC)(GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); -typedef void(GL_APIENTRY *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); -typedef void(GL_APIENTRY *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -typedef void(GL_APIENTRY *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -typedef void(GL_APIENTRY *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); -typedef void(GL_APIENTRY *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLUNIFORM1FPROC)(GLint location, GLfloat x); -typedef void(GL_APIENTRY *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM1IPROC)(GLint location, GLint x); -typedef void(GL_APIENTRY *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM2FPROC)(GLint location, GLfloat x, GLfloat y); -typedef void(GL_APIENTRY *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM2IPROC)(GLint location, GLint x, GLint y); -typedef void(GL_APIENTRY *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM3FPROC)(GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void(GL_APIENTRY *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM3IPROC)(GLint location, GLint x, GLint y, GLint z); -typedef void(GL_APIENTRY *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM4FPROC)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void(GL_APIENTRY *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *v); -typedef void(GL_APIENTRY *PFNGLUNIFORM4IPROC)(GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void(GL_APIENTRY *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *v); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUSEPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLVALIDATEPROGRAMPROC)(GLuint program); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB1FPROC)(GLuint indx, GLfloat x); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB1FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB2FPROC)(GLuint indx, GLfloat x, GLfloat y); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB2FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB3FPROC)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB3FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB4FPROC)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIB4FVPROC)(GLuint indx, const GLfloat *values); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr); -typedef void(GL_APIENTRY *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLREADBUFFERPROC)(GLenum mode); -typedef void(GL_APIENTRY *PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void(GL_APIENTRY *PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void(GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void(GL_APIENTRY *PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); -typedef void(GL_APIENTRY *PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); -typedef GLboolean(GL_APIENTRY *PFNGLISQUERYPROC)(GLuint id); -typedef void(GL_APIENTRY *PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); -typedef void(GL_APIENTRY *PFNGLENDQUERYPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); -typedef GLboolean(GL_APIENTRY *PFNGLUNMAPBUFFERPROC)(GLenum target); -typedef void(GL_APIENTRY *PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, GLvoid **params); -typedef void(GL_APIENTRY *PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void(GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef GLvoid *(GL_APIENTRY *PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void(GL_APIENTRY *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); -typedef void(GL_APIENTRY *PFNGLBINDVERTEXARRAYPROC)(GLuint array); -typedef void(GL_APIENTRY *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); -typedef void(GL_APIENTRY *PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); -typedef GLboolean(GL_APIENTRY *PFNGLISVERTEXARRAYPROC)(GLuint array); -typedef void(GL_APIENTRY *PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); -typedef void(GL_APIENTRY *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); -typedef void(GL_APIENTRY *PFNGLENDTRANSFORMFEEDBACKPROC)(void); -typedef void(GL_APIENTRY *PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void(GL_APIENTRY *PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); -typedef void(GL_APIENTRY *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode); -typedef void(GL_APIENTRY *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); -typedef void(GL_APIENTRY *PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); -typedef GLint(GL_APIENTRY *PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); -typedef void(GL_APIENTRY *PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); -typedef void(GL_APIENTRY *PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); -typedef void(GL_APIENTRY *PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void(GL_APIENTRY *PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void(GL_APIENTRY *PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); -typedef void(GL_APIENTRY *PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); -typedef void(GL_APIENTRY *PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); -typedef void(GL_APIENTRY *PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); -typedef void(GL_APIENTRY *PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); -typedef void(GL_APIENTRY *PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); -typedef void(GL_APIENTRY *PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef const GLubyte *(GL_APIENTRY *PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); -typedef void(GL_APIENTRY *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void(GL_APIENTRY *PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices); -typedef void(GL_APIENTRY *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -typedef GLuint(GL_APIENTRY *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); -typedef void(GL_APIENTRY *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -typedef void(GL_APIENTRY *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -typedef void(GL_APIENTRY *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); -typedef void(GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount); -typedef GLsync(GL_APIENTRY *PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); -typedef GLboolean(GL_APIENTRY *PFNGLISSYNCPROC)(GLsync sync); -typedef void(GL_APIENTRY *PFNGLDELETESYNCPROC)(GLsync sync); -typedef GLenum(GL_APIENTRY *PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void(GL_APIENTRY *PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void(GL_APIENTRY *PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *params); -typedef void(GL_APIENTRY *PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -typedef void(GL_APIENTRY *PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); -typedef void(GL_APIENTRY *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 *params); -typedef void(GL_APIENTRY *PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); -typedef void(GL_APIENTRY *PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint *samplers); -typedef GLboolean(GL_APIENTRY *PFNGLISSAMPLERPROC)(GLuint sampler); -typedef void(GL_APIENTRY *PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); -typedef void(GL_APIENTRY *PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); -typedef void(GL_APIENTRY *PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint *param); -typedef void(GL_APIENTRY *PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); -typedef void(GL_APIENTRY *PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat *param); -typedef void(GL_APIENTRY *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat *params); -typedef void(GL_APIENTRY *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); -typedef void(GL_APIENTRY *PFNGLBINDTRANSFORMFEEDBACKPROC)(GLenum target, GLuint id); -typedef void(GL_APIENTRY *PFNGLDELETETRANSFORMFEEDBACKSPROC)(GLsizei n, const GLuint *ids); -typedef void(GL_APIENTRY *PFNGLGENTRANSFORMFEEDBACKSPROC)(GLsizei n, GLuint *ids); -typedef GLboolean(GL_APIENTRY *PFNGLISTRANSFORMFEEDBACKPROC)(GLuint id); -typedef void(GL_APIENTRY *PFNGLPAUSETRANSFORMFEEDBACKPROC)(void); -typedef void(GL_APIENTRY *PFNGLRESUMETRANSFORMFEEDBACKPROC)(void); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMBINARYPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void(GL_APIENTRY *PFNGLPROGRAMBINARYPROC)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); -typedef void(GL_APIENTRY *PFNGLPROGRAMPARAMETERIPROC)(GLuint program, GLenum pname, GLint value); -typedef void(GL_APIENTRY *PFNGLINVALIDATEFRAMEBUFFERPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments); -typedef void(GL_APIENTRY *PFNGLINVALIDATESUBFRAMEBUFFERPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLTEXSTORAGE2DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void(GL_APIENTRY *PFNGLTEXSTORAGE3DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void(GL_APIENTRY *PFNGLGETINTERNALFORMATIVPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -typedef void(GL_APIENTRY *PFNGLLABELOBJECTEXTPROC)(GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void(GL_APIENTRY *PFNGLGETOBJECTLABELEXTPROC)(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void(GL_APIENTRY *PFNGLINSERTEVENTMARKEREXTPROC)(GLsizei length, const GLchar *marker); -typedef void(GL_APIENTRY *PFNGLPUSHGROUPMARKEREXTPROC)(GLsizei length, const GLchar *marker); -typedef void(GL_APIENTRY *PFNGLPOPGROUPMARKEREXTPROC)(void); -typedef void(GL_APIENTRY *PFNGLUSEPROGRAMSTAGESEXTPROC)(GLuint pipeline, GLbitfield stages, GLuint program); -typedef void(GL_APIENTRY *PFNGLACTIVESHADERPROGRAMEXTPROC)(GLuint pipeline, GLuint program); -typedef GLuint(GL_APIENTRY *PFNGLCREATESHADERPROGRAMVEXTPROC)(GLenum type, GLsizei count, const GLchar **strings); -typedef void(GL_APIENTRY *PFNGLBINDPROGRAMPIPELINEEXTPROC)(GLuint pipeline); -typedef void(GL_APIENTRY *PFNGLDELETEPROGRAMPIPELINESEXTPROC)(GLsizei n, const GLuint *pipelines); -typedef void(GL_APIENTRY *PFNGLGENPROGRAMPIPELINESEXTPROC)(GLsizei n, GLuint *pipelines); -typedef GLboolean(GL_APIENTRY *PFNGLISPROGRAMPIPELINEEXTPROC)(GLuint pipeline); -typedef void(GL_APIENTRY *PFNGLPROGRAMPARAMETERIEXTPROC)(GLuint program, GLenum pname, GLint value); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMPIPELINEIVEXTPROC)(GLuint pipeline, GLenum pname, GLint *params); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1IEXTPROC)(GLuint program, GLint location, GLint x); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2IEXTPROC)(GLuint program, GLint location, GLint x, GLint y); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3IEXTPROC)(GLuint program, GLint location, GLint x, GLint y, GLint z); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4IEXTPROC)(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1FEXTPROC)(GLuint program, GLint location, GLfloat x); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2FEXTPROC)(GLuint program, GLint location, GLfloat x, GLfloat y); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3FEXTPROC)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4FEXTPROC)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4IVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM1FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM2FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM3FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORM4FVEXTPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void(GL_APIENTRY *PFNGLVALIDATEPROGRAMPIPELINEEXTPROC)(GLuint pipeline); -typedef void(GL_APIENTRY *PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - -typedef void(GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC)(GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); - -extern PFNGLACTIVETEXTUREPROC gles3wActiveTexture; -extern PFNGLATTACHSHADERPROC gles3wAttachShader; -extern PFNGLBINDATTRIBLOCATIONPROC gles3wBindAttribLocation; -extern PFNGLBINDBUFFERPROC gles3wBindBuffer; -extern PFNGLBINDFRAMEBUFFERPROC gles3wBindFramebuffer; -extern PFNGLBINDRENDERBUFFERPROC gles3wBindRenderbuffer; -extern PFNGLBINDTEXTUREPROC gles3wBindTexture; -extern PFNGLBLENDCOLORPROC gles3wBlendColor; -extern PFNGLBLENDEQUATIONPROC gles3wBlendEquation; -extern PFNGLBLENDEQUATIONSEPARATEPROC gles3wBlendEquationSeparate; -extern PFNGLBLENDFUNCPROC gles3wBlendFunc; -extern PFNGLBLENDFUNCSEPARATEPROC gles3wBlendFuncSeparate; -extern PFNGLBUFFERDATAPROC gles3wBufferData; -extern PFNGLBUFFERSUBDATAPROC gles3wBufferSubData; -extern PFNGLCHECKFRAMEBUFFERSTATUSPROC gles3wCheckFramebufferStatus; -extern PFNGLCLEARPROC gles3wClear; -extern PFNGLCLEARCOLORPROC gles3wClearColor; -extern PFNGLCLEARDEPTHFPROC gles3wClearDepthf; -extern PFNGLCLEARSTENCILPROC gles3wClearStencil; -extern PFNGLCOLORMASKPROC gles3wColorMask; -extern PFNGLCOMPILESHADERPROC gles3wCompileShader; -extern PFNGLCOMPRESSEDTEXIMAGE2DPROC gles3wCompressedTexImage2D; -extern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC gles3wCompressedTexSubImage2D; -extern PFNGLCOPYTEXIMAGE2DPROC gles3wCopyTexImage2D; -extern PFNGLCOPYTEXSUBIMAGE2DPROC gles3wCopyTexSubImage2D; -extern PFNGLCREATEPROGRAMPROC gles3wCreateProgram; -extern PFNGLCREATESHADERPROC gles3wCreateShader; -extern PFNGLCULLFACEPROC gles3wCullFace; -extern PFNGLDELETEBUFFERSPROC gles3wDeleteBuffers; -extern PFNGLDELETEFRAMEBUFFERSPROC gles3wDeleteFramebuffers; -extern PFNGLDELETEPROGRAMPROC gles3wDeleteProgram; -extern PFNGLDELETERENDERBUFFERSPROC gles3wDeleteRenderbuffers; -extern PFNGLDELETESHADERPROC gles3wDeleteShader; -extern PFNGLDELETETEXTURESPROC gles3wDeleteTextures; -extern PFNGLDEPTHFUNCPROC gles3wDepthFunc; -extern PFNGLDEPTHMASKPROC gles3wDepthMask; -extern PFNGLDEPTHRANGEFPROC gles3wDepthRangef; -extern PFNGLDETACHSHADERPROC gles3wDetachShader; -extern PFNGLDISABLEPROC gles3wDisable; -extern PFNGLDISABLEVERTEXATTRIBARRAYPROC gles3wDisableVertexAttribArray; -extern PFNGLDRAWARRAYSPROC gles3wDrawArrays; -extern PFNGLDRAWELEMENTSPROC gles3wDrawElements; -extern PFNGLENABLEPROC gles3wEnable; -extern PFNGLENABLEVERTEXATTRIBARRAYPROC gles3wEnableVertexAttribArray; -extern PFNGLFINISHPROC gles3wFinish; -extern PFNGLFLUSHPROC gles3wFlush; -extern PFNGLFRAMEBUFFERRENDERBUFFERPROC gles3wFramebufferRenderbuffer; -extern PFNGLFRAMEBUFFERTEXTURE2DPROC gles3wFramebufferTexture2D; -extern PFNGLFRONTFACEPROC gles3wFrontFace; -extern PFNGLGENBUFFERSPROC gles3wGenBuffers; -extern PFNGLGENERATEMIPMAPPROC gles3wGenerateMipmap; -extern PFNGLGENFRAMEBUFFERSPROC gles3wGenFramebuffers; -extern PFNGLGENRENDERBUFFERSPROC gles3wGenRenderbuffers; -extern PFNGLGENTEXTURESPROC gles3wGenTextures; -extern PFNGLGETACTIVEATTRIBPROC gles3wGetActiveAttrib; -extern PFNGLGETACTIVEUNIFORMPROC gles3wGetActiveUniform; -extern PFNGLGETATTACHEDSHADERSPROC gles3wGetAttachedShaders; -extern PFNGLGETATTRIBLOCATIONPROC gles3wGetAttribLocation; -extern PFNGLGETBOOLEANVPROC gles3wGetBooleanv; -extern PFNGLGETBUFFERPARAMETERIVPROC gles3wGetBufferParameteriv; -extern PFNGLGETERRORPROC gles3wGetError; -extern PFNGLGETFLOATVPROC gles3wGetFloatv; -extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC gles3wGetFramebufferAttachmentParameteriv; -extern PFNGLGETINTEGERVPROC gles3wGetIntegerv; -extern PFNGLGETPROGRAMIVPROC gles3wGetProgramiv; -extern PFNGLGETPROGRAMINFOLOGPROC gles3wGetProgramInfoLog; -extern PFNGLGETRENDERBUFFERPARAMETERIVPROC gles3wGetRenderbufferParameteriv; -extern PFNGLGETSHADERIVPROC gles3wGetShaderiv; -extern PFNGLGETSHADERINFOLOGPROC gles3wGetShaderInfoLog; -extern PFNGLGETSHADERPRECISIONFORMATPROC gles3wGetShaderPrecisionFormat; -extern PFNGLGETSHADERSOURCEPROC gles3wGetShaderSource; -extern PFNGLGETSTRINGPROC gles3wGetString; -extern PFNGLGETTEXPARAMETERFVPROC gles3wGetTexParameterfv; -extern PFNGLGETTEXPARAMETERIVPROC gles3wGetTexParameteriv; -extern PFNGLGETUNIFORMFVPROC gles3wGetUniformfv; -extern PFNGLGETUNIFORMIVPROC gles3wGetUniformiv; -extern PFNGLGETUNIFORMLOCATIONPROC gles3wGetUniformLocation; -extern PFNGLGETVERTEXATTRIBFVPROC gles3wGetVertexAttribfv; -extern PFNGLGETVERTEXATTRIBIVPROC gles3wGetVertexAttribiv; -extern PFNGLGETVERTEXATTRIBPOINTERVPROC gles3wGetVertexAttribPointerv; -extern PFNGLHINTPROC gles3wHint; -extern PFNGLISBUFFERPROC gles3wIsBuffer; -extern PFNGLISENABLEDPROC gles3wIsEnabled; -extern PFNGLISFRAMEBUFFERPROC gles3wIsFramebuffer; -extern PFNGLISPROGRAMPROC gles3wIsProgram; -extern PFNGLISRENDERBUFFERPROC gles3wIsRenderbuffer; -extern PFNGLISSHADERPROC gles3wIsShader; -extern PFNGLISTEXTUREPROC gles3wIsTexture; -extern PFNGLLINEWIDTHPROC gles3wLineWidth; -extern PFNGLLINKPROGRAMPROC gles3wLinkProgram; -extern PFNGLPIXELSTOREIPROC gles3wPixelStorei; -extern PFNGLPOLYGONOFFSETPROC gles3wPolygonOffset; -extern PFNGLREADPIXELSPROC gles3wReadPixels; -extern PFNGLRELEASESHADERCOMPILERPROC gles3wReleaseShaderCompiler; -extern PFNGLRENDERBUFFERSTORAGEPROC gles3wRenderbufferStorage; -extern PFNGLSAMPLECOVERAGEPROC gles3wSampleCoverage; -extern PFNGLSCISSORPROC gles3wScissor; -extern PFNGLSHADERBINARYPROC gles3wShaderBinary; -extern PFNGLSHADERSOURCEPROC gles3wShaderSource; -extern PFNGLSTENCILFUNCPROC gles3wStencilFunc; -extern PFNGLSTENCILFUNCSEPARATEPROC gles3wStencilFuncSeparate; -extern PFNGLSTENCILMASKPROC gles3wStencilMask; -extern PFNGLSTENCILMASKSEPARATEPROC gles3wStencilMaskSeparate; -extern PFNGLSTENCILOPPROC gles3wStencilOp; -extern PFNGLSTENCILOPSEPARATEPROC gles3wStencilOpSeparate; -extern PFNGLTEXIMAGE2DPROC gles3wTexImage2D; -extern PFNGLTEXPARAMETERFPROC gles3wTexParameterf; -extern PFNGLTEXPARAMETERFVPROC gles3wTexParameterfv; -extern PFNGLTEXPARAMETERIPROC gles3wTexParameteri; -extern PFNGLTEXPARAMETERIVPROC gles3wTexParameteriv; -extern PFNGLTEXSUBIMAGE2DPROC gles3wTexSubImage2D; -extern PFNGLUNIFORM1FPROC gles3wUniform1f; -extern PFNGLUNIFORM1FVPROC gles3wUniform1fv; -extern PFNGLUNIFORM1IPROC gles3wUniform1i; -extern PFNGLUNIFORM1IVPROC gles3wUniform1iv; -extern PFNGLUNIFORM2FPROC gles3wUniform2f; -extern PFNGLUNIFORM2FVPROC gles3wUniform2fv; -extern PFNGLUNIFORM2IPROC gles3wUniform2i; -extern PFNGLUNIFORM2IVPROC gles3wUniform2iv; -extern PFNGLUNIFORM3FPROC gles3wUniform3f; -extern PFNGLUNIFORM3FVPROC gles3wUniform3fv; -extern PFNGLUNIFORM3IPROC gles3wUniform3i; -extern PFNGLUNIFORM3IVPROC gles3wUniform3iv; -extern PFNGLUNIFORM4FPROC gles3wUniform4f; -extern PFNGLUNIFORM4FVPROC gles3wUniform4fv; -extern PFNGLUNIFORM4IPROC gles3wUniform4i; -extern PFNGLUNIFORM4IVPROC gles3wUniform4iv; -extern PFNGLUNIFORMMATRIX2FVPROC gles3wUniformMatrix2fv; -extern PFNGLUNIFORMMATRIX3FVPROC gles3wUniformMatrix3fv; -extern PFNGLUNIFORMMATRIX4FVPROC gles3wUniformMatrix4fv; -extern PFNGLUSEPROGRAMPROC gles3wUseProgram; -extern PFNGLVALIDATEPROGRAMPROC gles3wValidateProgram; -extern PFNGLVERTEXATTRIB1FPROC gles3wVertexAttrib1f; -extern PFNGLVERTEXATTRIB1FVPROC gles3wVertexAttrib1fv; -extern PFNGLVERTEXATTRIB2FPROC gles3wVertexAttrib2f; -extern PFNGLVERTEXATTRIB2FVPROC gles3wVertexAttrib2fv; -extern PFNGLVERTEXATTRIB3FPROC gles3wVertexAttrib3f; -extern PFNGLVERTEXATTRIB3FVPROC gles3wVertexAttrib3fv; -extern PFNGLVERTEXATTRIB4FPROC gles3wVertexAttrib4f; -extern PFNGLVERTEXATTRIB4FVPROC gles3wVertexAttrib4fv; -extern PFNGLVERTEXATTRIBPOINTERPROC gles3wVertexAttribPointer; -extern PFNGLVIEWPORTPROC gles3wViewport; -extern PFNGLREADBUFFERPROC gles3wReadBuffer; -extern PFNGLDRAWRANGEELEMENTSPROC gles3wDrawRangeElements; -extern PFNGLTEXIMAGE3DPROC gles3wTexImage3D; -extern PFNGLTEXSUBIMAGE3DPROC gles3wTexSubImage3D; -extern PFNGLCOPYTEXSUBIMAGE3DPROC gles3wCopyTexSubImage3D; -extern PFNGLCOMPRESSEDTEXIMAGE3DPROC gles3wCompressedTexImage3D; -extern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC gles3wCompressedTexSubImage3D; -extern PFNGLGENQUERIESPROC gles3wGenQueries; -extern PFNGLDELETEQUERIESPROC gles3wDeleteQueries; -extern PFNGLISQUERYPROC gles3wIsQuery; -extern PFNGLBEGINQUERYPROC gles3wBeginQuery; -extern PFNGLENDQUERYPROC gles3wEndQuery; -extern PFNGLGETQUERYIVPROC gles3wGetQueryiv; -extern PFNGLGETQUERYOBJECTUIVPROC gles3wGetQueryObjectuiv; -extern PFNGLUNMAPBUFFERPROC gles3wUnmapBuffer; -extern PFNGLGETBUFFERPOINTERVPROC gles3wGetBufferPointerv; -extern PFNGLDRAWBUFFERSPROC gles3wDrawBuffers; -extern PFNGLUNIFORMMATRIX2X3FVPROC gles3wUniformMatrix2x3fv; -extern PFNGLUNIFORMMATRIX3X2FVPROC gles3wUniformMatrix3x2fv; -extern PFNGLUNIFORMMATRIX2X4FVPROC gles3wUniformMatrix2x4fv; -extern PFNGLUNIFORMMATRIX4X2FVPROC gles3wUniformMatrix4x2fv; -extern PFNGLUNIFORMMATRIX3X4FVPROC gles3wUniformMatrix3x4fv; -extern PFNGLUNIFORMMATRIX4X3FVPROC gles3wUniformMatrix4x3fv; -extern PFNGLBLITFRAMEBUFFERPROC gles3wBlitFramebuffer; -extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC gles3wRenderbufferStorageMultisample; -extern PFNGLFRAMEBUFFERTEXTURELAYERPROC gles3wFramebufferTextureLayer; -extern PFNGLMAPBUFFERRANGEPROC gles3wMapBufferRange; -extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC gles3wFlushMappedBufferRange; -extern PFNGLBINDVERTEXARRAYPROC gles3wBindVertexArray; -extern PFNGLDELETEVERTEXARRAYSPROC gles3wDeleteVertexArrays; -extern PFNGLGENVERTEXARRAYSPROC gles3wGenVertexArrays; -extern PFNGLISVERTEXARRAYPROC gles3wIsVertexArray; -extern PFNGLGETINTEGERI_VPROC gles3wGetIntegeri_v; -extern PFNGLBEGINTRANSFORMFEEDBACKPROC gles3wBeginTransformFeedback; -extern PFNGLENDTRANSFORMFEEDBACKPROC gles3wEndTransformFeedback; -extern PFNGLBINDBUFFERRANGEPROC gles3wBindBufferRange; -extern PFNGLBINDBUFFERBASEPROC gles3wBindBufferBase; -extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC gles3wTransformFeedbackVaryings; -extern PFNGLGETTRANSFORMFEEDBACKVARYINGPROC gles3wGetTransformFeedbackVarying; -extern PFNGLVERTEXATTRIBIPOINTERPROC gles3wVertexAttribIPointer; -extern PFNGLGETVERTEXATTRIBIIVPROC gles3wGetVertexAttribIiv; -extern PFNGLGETVERTEXATTRIBIUIVPROC gles3wGetVertexAttribIuiv; -extern PFNGLVERTEXATTRIBI4IPROC gles3wVertexAttribI4i; -extern PFNGLVERTEXATTRIBI4UIPROC gles3wVertexAttribI4ui; -extern PFNGLVERTEXATTRIBI4IVPROC gles3wVertexAttribI4iv; -extern PFNGLVERTEXATTRIBI4UIVPROC gles3wVertexAttribI4uiv; -extern PFNGLGETUNIFORMUIVPROC gles3wGetUniformuiv; -extern PFNGLGETFRAGDATALOCATIONPROC gles3wGetFragDataLocation; -extern PFNGLUNIFORM1UIPROC gles3wUniform1ui; -extern PFNGLUNIFORM2UIPROC gles3wUniform2ui; -extern PFNGLUNIFORM3UIPROC gles3wUniform3ui; -extern PFNGLUNIFORM4UIPROC gles3wUniform4ui; -extern PFNGLUNIFORM1UIVPROC gles3wUniform1uiv; -extern PFNGLUNIFORM2UIVPROC gles3wUniform2uiv; -extern PFNGLUNIFORM3UIVPROC gles3wUniform3uiv; -extern PFNGLUNIFORM4UIVPROC gles3wUniform4uiv; -extern PFNGLCLEARBUFFERIVPROC gles3wClearBufferiv; -extern PFNGLCLEARBUFFERUIVPROC gles3wClearBufferuiv; -extern PFNGLCLEARBUFFERFVPROC gles3wClearBufferfv; -extern PFNGLCLEARBUFFERFIPROC gles3wClearBufferfi; -extern PFNGLGETSTRINGIPROC gles3wGetStringi; -extern PFNGLCOPYBUFFERSUBDATAPROC gles3wCopyBufferSubData; -extern PFNGLGETUNIFORMINDICESPROC gles3wGetUniformIndices; -extern PFNGLGETACTIVEUNIFORMSIVPROC gles3wGetActiveUniformsiv; -extern PFNGLGETUNIFORMBLOCKINDEXPROC gles3wGetUniformBlockIndex; -extern PFNGLGETACTIVEUNIFORMBLOCKIVPROC gles3wGetActiveUniformBlockiv; -extern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC gles3wGetActiveUniformBlockName; -extern PFNGLUNIFORMBLOCKBINDINGPROC gles3wUniformBlockBinding; -extern PFNGLDRAWARRAYSINSTANCEDPROC gles3wDrawArraysInstanced; -extern PFNGLDRAWELEMENTSINSTANCEDPROC gles3wDrawElementsInstanced; -extern PFNGLFENCESYNCPROC gles3wFenceSync; -extern PFNGLISSYNCPROC gles3wIsSync; -extern PFNGLDELETESYNCPROC gles3wDeleteSync; -extern PFNGLCLIENTWAITSYNCPROC gles3wClientWaitSync; -extern PFNGLWAITSYNCPROC gles3wWaitSync; -extern PFNGLGETINTEGER64VPROC gles3wGetInteger64v; -extern PFNGLGETSYNCIVPROC gles3wGetSynciv; -extern PFNGLGETINTEGER64I_VPROC gles3wGetInteger64i_v; -extern PFNGLGETBUFFERPARAMETERI64VPROC gles3wGetBufferParameteri64v; -extern PFNGLGENSAMPLERSPROC gles3wGenSamplers; -extern PFNGLDELETESAMPLERSPROC gles3wDeleteSamplers; -extern PFNGLISSAMPLERPROC gles3wIsSampler; -extern PFNGLBINDSAMPLERPROC gles3wBindSampler; -extern PFNGLSAMPLERPARAMETERIPROC gles3wSamplerParameteri; -extern PFNGLSAMPLERPARAMETERIVPROC gles3wSamplerParameteriv; -extern PFNGLSAMPLERPARAMETERFPROC gles3wSamplerParameterf; -extern PFNGLSAMPLERPARAMETERFVPROC gles3wSamplerParameterfv; -extern PFNGLGETSAMPLERPARAMETERIVPROC gles3wGetSamplerParameteriv; -extern PFNGLGETSAMPLERPARAMETERFVPROC gles3wGetSamplerParameterfv; -extern PFNGLVERTEXATTRIBDIVISORPROC gles3wVertexAttribDivisor; -extern PFNGLBINDTRANSFORMFEEDBACKPROC gles3wBindTransformFeedback; -extern PFNGLDELETETRANSFORMFEEDBACKSPROC gles3wDeleteTransformFeedbacks; -extern PFNGLGENTRANSFORMFEEDBACKSPROC gles3wGenTransformFeedbacks; -extern PFNGLISTRANSFORMFEEDBACKPROC gles3wIsTransformFeedback; -extern PFNGLPAUSETRANSFORMFEEDBACKPROC gles3wPauseTransformFeedback; -extern PFNGLRESUMETRANSFORMFEEDBACKPROC gles3wResumeTransformFeedback; -extern PFNGLGETPROGRAMBINARYPROC gles3wGetProgramBinary; -extern PFNGLPROGRAMBINARYPROC gles3wProgramBinary; -extern PFNGLPROGRAMPARAMETERIPROC gles3wProgramParameteri; -extern PFNGLINVALIDATEFRAMEBUFFERPROC gles3wInvalidateFramebuffer; -extern PFNGLINVALIDATESUBFRAMEBUFFERPROC gles3wInvalidateSubFramebuffer; -extern PFNGLTEXSTORAGE2DPROC gles3wTexStorage2D; -extern PFNGLTEXSTORAGE3DPROC gles3wTexStorage3D; -extern PFNGLGETINTERNALFORMATIVPROC gles3wGetInternalformativ; -extern PFNGLLABELOBJECTEXTPROC gles3wLabelObjectEXT; -extern PFNGLGETOBJECTLABELEXTPROC gles3wGetObjectLabelEXT; -extern PFNGLINSERTEVENTMARKEREXTPROC gles3wInsertEventMarkerEXT; -extern PFNGLPUSHGROUPMARKEREXTPROC gles3wPushGroupMarkerEXT; -extern PFNGLPOPGROUPMARKEREXTPROC gles3wPopGroupMarkerEXT; -extern PFNGLUSEPROGRAMSTAGESEXTPROC gles3wUseProgramStagesEXT; -extern PFNGLACTIVESHADERPROGRAMEXTPROC gles3wActiveShaderProgramEXT; -extern PFNGLCREATESHADERPROGRAMVEXTPROC gles3wCreateShaderProgramvEXT; -extern PFNGLBINDPROGRAMPIPELINEEXTPROC gles3wBindProgramPipelineEXT; -extern PFNGLDELETEPROGRAMPIPELINESEXTPROC gles3wDeleteProgramPipelinesEXT; -extern PFNGLGENPROGRAMPIPELINESEXTPROC gles3wGenProgramPipelinesEXT; -extern PFNGLISPROGRAMPIPELINEEXTPROC gles3wIsProgramPipelineEXT; -extern PFNGLPROGRAMPARAMETERIEXTPROC gles3wProgramParameteriEXT; -extern PFNGLGETPROGRAMPIPELINEIVEXTPROC gles3wGetProgramPipelineivEXT; -extern PFNGLPROGRAMUNIFORM1IEXTPROC gles3wProgramUniform1iEXT; -extern PFNGLPROGRAMUNIFORM2IEXTPROC gles3wProgramUniform2iEXT; -extern PFNGLPROGRAMUNIFORM3IEXTPROC gles3wProgramUniform3iEXT; -extern PFNGLPROGRAMUNIFORM4IEXTPROC gles3wProgramUniform4iEXT; -extern PFNGLPROGRAMUNIFORM1FEXTPROC gles3wProgramUniform1fEXT; -extern PFNGLPROGRAMUNIFORM2FEXTPROC gles3wProgramUniform2fEXT; -extern PFNGLPROGRAMUNIFORM3FEXTPROC gles3wProgramUniform3fEXT; -extern PFNGLPROGRAMUNIFORM4FEXTPROC gles3wProgramUniform4fEXT; -extern PFNGLPROGRAMUNIFORM1IVEXTPROC gles3wProgramUniform1ivEXT; -extern PFNGLPROGRAMUNIFORM2IVEXTPROC gles3wProgramUniform2ivEXT; -extern PFNGLPROGRAMUNIFORM3IVEXTPROC gles3wProgramUniform3ivEXT; -extern PFNGLPROGRAMUNIFORM4IVEXTPROC gles3wProgramUniform4ivEXT; -extern PFNGLPROGRAMUNIFORM1FVEXTPROC gles3wProgramUniform1fvEXT; -extern PFNGLPROGRAMUNIFORM2FVEXTPROC gles3wProgramUniform2fvEXT; -extern PFNGLPROGRAMUNIFORM3FVEXTPROC gles3wProgramUniform3fvEXT; -extern PFNGLPROGRAMUNIFORM4FVEXTPROC gles3wProgramUniform4fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC gles3wProgramUniformMatrix2fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC gles3wProgramUniformMatrix3fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC gles3wProgramUniformMatrix4fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC gles3wProgramUniformMatrix2x3fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC gles3wProgramUniformMatrix3x2fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC gles3wProgramUniformMatrix2x4fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC gles3wProgramUniformMatrix4x2fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC gles3wProgramUniformMatrix3x4fvEXT; -extern PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC gles3wProgramUniformMatrix4x3fvEXT; -extern PFNGLVALIDATEPROGRAMPIPELINEEXTPROC gles3wValidateProgramPipelineEXT; -extern PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC gles3wGetProgramPipelineInfoLogEXT; - -extern PFNGLDEBUGMESSAGECONTROLKHRPROC gles3wDebugMessageControlKHR; -extern PFNGLDEBUGMESSAGECALLBACKKHRPROC gles3wDebugMessageCallbackKHR; -extern PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC gles3wFramebufferTexture2DMultisampleEXT; -extern PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC gles3wFramebufferTexture2DMultisampleIMG; - -#define glActiveTexture gles3wActiveTexture -#define glAttachShader gles3wAttachShader -#define glBindAttribLocation gles3wBindAttribLocation -#define glBindBuffer gles3wBindBuffer -#define glBindFramebuffer gles3wBindFramebuffer -#define glBindRenderbuffer gles3wBindRenderbuffer -#define glBindTexture gles3wBindTexture -#define glBlendColor gles3wBlendColor -#define glBlendEquation gles3wBlendEquation -#define glBlendEquationSeparate gles3wBlendEquationSeparate -#define glBlendFunc gles3wBlendFunc -#define glBlendFuncSeparate gles3wBlendFuncSeparate -#define glBufferData gles3wBufferData -#define glBufferSubData gles3wBufferSubData -#define glCheckFramebufferStatus gles3wCheckFramebufferStatus -#define glClear gles3wClear -#define glClearColor gles3wClearColor -#define glClearDepthf gles3wClearDepthf -#define glClearStencil gles3wClearStencil -#define glColorMask gles3wColorMask -#define glCompileShader gles3wCompileShader -#define glCompressedTexImage2D gles3wCompressedTexImage2D -#define glCompressedTexSubImage2D gles3wCompressedTexSubImage2D -#define glCopyTexImage2D gles3wCopyTexImage2D -#define glCopyTexSubImage2D gles3wCopyTexSubImage2D -#define glCreateProgram gles3wCreateProgram -#define glCreateShader gles3wCreateShader -#define glCullFace gles3wCullFace -#define glDeleteBuffers gles3wDeleteBuffers -#define glDeleteFramebuffers gles3wDeleteFramebuffers -#define glDeleteProgram gles3wDeleteProgram -#define glDeleteRenderbuffers gles3wDeleteRenderbuffers -#define glDeleteShader gles3wDeleteShader -#define glDeleteTextures gles3wDeleteTextures -#define glDepthFunc gles3wDepthFunc -#define glDepthMask gles3wDepthMask -#define glDepthRangef gles3wDepthRangef -#define glDetachShader gles3wDetachShader -#define glDisable gles3wDisable -#define glDisableVertexAttribArray gles3wDisableVertexAttribArray -#define glDrawArrays gles3wDrawArrays -#define glDrawElements gles3wDrawElements -#define glEnable gles3wEnable -#define glEnableVertexAttribArray gles3wEnableVertexAttribArray -#define glFinish gles3wFinish -#define glFlush gles3wFlush -#define glFramebufferRenderbuffer gles3wFramebufferRenderbuffer -#define glFramebufferTexture2D gles3wFramebufferTexture2D -#define glFrontFace gles3wFrontFace -#define glGenBuffers gles3wGenBuffers -#define glGenerateMipmap gles3wGenerateMipmap -#define glGenFramebuffers gles3wGenFramebuffers -#define glGenRenderbuffers gles3wGenRenderbuffers -#define glGenTextures gles3wGenTextures -#define glGetActiveAttrib gles3wGetActiveAttrib -#define glGetActiveUniform gles3wGetActiveUniform -#define glGetAttachedShaders gles3wGetAttachedShaders -#define glGetAttribLocation gles3wGetAttribLocation -#define glGetBooleanv gles3wGetBooleanv -#define glGetBufferParameteriv gles3wGetBufferParameteriv -#define glGetError gles3wGetError -#define glGetFloatv gles3wGetFloatv -#define glGetFramebufferAttachmentParameteriv gles3wGetFramebufferAttachmentParameteriv -#define glGetIntegerv gles3wGetIntegerv -#define glGetProgramiv gles3wGetProgramiv -#define glGetProgramInfoLog gles3wGetProgramInfoLog -#define glGetRenderbufferParameteriv gles3wGetRenderbufferParameteriv -#define glGetShaderiv gles3wGetShaderiv -#define glGetShaderInfoLog gles3wGetShaderInfoLog -#define glGetShaderPrecisionFormat gles3wGetShaderPrecisionFormat -#define glGetShaderSource gles3wGetShaderSource -#define glGetString gles3wGetString -#define glGetTexParameterfv gles3wGetTexParameterfv -#define glGetTexParameteriv gles3wGetTexParameteriv -#define glGetUniformfv gles3wGetUniformfv -#define glGetUniformiv gles3wGetUniformiv -#define glGetUniformLocation gles3wGetUniformLocation -#define glGetVertexAttribfv gles3wGetVertexAttribfv -#define glGetVertexAttribiv gles3wGetVertexAttribiv -#define glGetVertexAttribPointerv gles3wGetVertexAttribPointerv -#define glHint gles3wHint -#define glIsBuffer gles3wIsBuffer -#define glIsEnabled gles3wIsEnabled -#define glIsFramebuffer gles3wIsFramebuffer -#define glIsProgram gles3wIsProgram -#define glIsRenderbuffer gles3wIsRenderbuffer -#define glIsShader gles3wIsShader -#define glIsTexture gles3wIsTexture -#define glLineWidth gles3wLineWidth -#define glLinkProgram gles3wLinkProgram -#define glPixelStorei gles3wPixelStorei -#define glPolygonOffset gles3wPolygonOffset -#define glReadPixels gles3wReadPixels -#define glReleaseShaderCompiler gles3wReleaseShaderCompiler -#define glRenderbufferStorage gles3wRenderbufferStorage -#define glSampleCoverage gles3wSampleCoverage -#define glScissor gles3wScissor -#define glShaderBinary gles3wShaderBinary -#define glShaderSource gles3wShaderSource -#define glStencilFunc gles3wStencilFunc -#define glStencilFuncSeparate gles3wStencilFuncSeparate -#define glStencilMask gles3wStencilMask -#define glStencilMaskSeparate gles3wStencilMaskSeparate -#define glStencilOp gles3wStencilOp -#define glStencilOpSeparate gles3wStencilOpSeparate -#define glTexImage2D gles3wTexImage2D -#define glTexParameterf gles3wTexParameterf -#define glTexParameterfv gles3wTexParameterfv -#define glTexParameteri gles3wTexParameteri -#define glTexParameteriv gles3wTexParameteriv -#define glTexSubImage2D gles3wTexSubImage2D -#define glUniform1f gles3wUniform1f -#define glUniform1fv gles3wUniform1fv -#define glUniform1i gles3wUniform1i -#define glUniform1iv gles3wUniform1iv -#define glUniform2f gles3wUniform2f -#define glUniform2fv gles3wUniform2fv -#define glUniform2i gles3wUniform2i -#define glUniform2iv gles3wUniform2iv -#define glUniform3f gles3wUniform3f -#define glUniform3fv gles3wUniform3fv -#define glUniform3i gles3wUniform3i -#define glUniform3iv gles3wUniform3iv -#define glUniform4f gles3wUniform4f -#define glUniform4fv gles3wUniform4fv -#define glUniform4i gles3wUniform4i -#define glUniform4iv gles3wUniform4iv -#define glUniformMatrix2fv gles3wUniformMatrix2fv -#define glUniformMatrix3fv gles3wUniformMatrix3fv -#define glUniformMatrix4fv gles3wUniformMatrix4fv -#define glUseProgram gles3wUseProgram -#define glValidateProgram gles3wValidateProgram -#define glVertexAttrib1f gles3wVertexAttrib1f -#define glVertexAttrib1fv gles3wVertexAttrib1fv -#define glVertexAttrib2f gles3wVertexAttrib2f -#define glVertexAttrib2fv gles3wVertexAttrib2fv -#define glVertexAttrib3f gles3wVertexAttrib3f -#define glVertexAttrib3fv gles3wVertexAttrib3fv -#define glVertexAttrib4f gles3wVertexAttrib4f -#define glVertexAttrib4fv gles3wVertexAttrib4fv -#define glVertexAttribPointer gles3wVertexAttribPointer -#define glViewport gles3wViewport -#define glReadBuffer gles3wReadBuffer -#define glDrawRangeElements gles3wDrawRangeElements -#define glTexImage3D gles3wTexImage3D -#define glTexSubImage3D gles3wTexSubImage3D -#define glCopyTexSubImage3D gles3wCopyTexSubImage3D -#define glCompressedTexImage3D gles3wCompressedTexImage3D -#define glCompressedTexSubImage3D gles3wCompressedTexSubImage3D -#define glGenQueries gles3wGenQueries -#define glDeleteQueries gles3wDeleteQueries -#define glIsQuery gles3wIsQuery -#define glBeginQuery gles3wBeginQuery -#define glEndQuery gles3wEndQuery -#define glGetQueryiv gles3wGetQueryiv -#define glGetQueryObjectuiv gles3wGetQueryObjectuiv -#define glUnmapBuffer gles3wUnmapBuffer -#define glGetBufferPointerv gles3wGetBufferPointerv -#define glDrawBuffers gles3wDrawBuffers -#define glUniformMatrix2x3fv gles3wUniformMatrix2x3fv -#define glUniformMatrix3x2fv gles3wUniformMatrix3x2fv -#define glUniformMatrix2x4fv gles3wUniformMatrix2x4fv -#define glUniformMatrix4x2fv gles3wUniformMatrix4x2fv -#define glUniformMatrix3x4fv gles3wUniformMatrix3x4fv -#define glUniformMatrix4x3fv gles3wUniformMatrix4x3fv -#define glBlitFramebuffer gles3wBlitFramebuffer -#define glRenderbufferStorageMultisample gles3wRenderbufferStorageMultisample -#define glFramebufferTextureLayer gles3wFramebufferTextureLayer -#define glMapBufferRange gles3wMapBufferRange -#define glFlushMappedBufferRange gles3wFlushMappedBufferRange -#define glBindVertexArray gles3wBindVertexArray -#define glDeleteVertexArrays gles3wDeleteVertexArrays -#define glGenVertexArrays gles3wGenVertexArrays -#define glIsVertexArray gles3wIsVertexArray -#define glGetIntegeri_v gles3wGetIntegeri_v -#define glBeginTransformFeedback gles3wBeginTransformFeedback -#define glEndTransformFeedback gles3wEndTransformFeedback -#define glBindBufferRange gles3wBindBufferRange -#define glBindBufferBase gles3wBindBufferBase -#define glTransformFeedbackVaryings gles3wTransformFeedbackVaryings -#define glGetTransformFeedbackVarying gles3wGetTransformFeedbackVarying -#define glVertexAttribIPointer gles3wVertexAttribIPointer -#define glGetVertexAttribIiv gles3wGetVertexAttribIiv -#define glGetVertexAttribIuiv gles3wGetVertexAttribIuiv -#define glVertexAttribI4i gles3wVertexAttribI4i -#define glVertexAttribI4ui gles3wVertexAttribI4ui -#define glVertexAttribI4iv gles3wVertexAttribI4iv -#define glVertexAttribI4uiv gles3wVertexAttribI4uiv -#define glGetUniformuiv gles3wGetUniformuiv -#define glGetFragDataLocation gles3wGetFragDataLocation -#define glUniform1ui gles3wUniform1ui -#define glUniform2ui gles3wUniform2ui -#define glUniform3ui gles3wUniform3ui -#define glUniform4ui gles3wUniform4ui -#define glUniform1uiv gles3wUniform1uiv -#define glUniform2uiv gles3wUniform2uiv -#define glUniform3uiv gles3wUniform3uiv -#define glUniform4uiv gles3wUniform4uiv -#define glClearBufferiv gles3wClearBufferiv -#define glClearBufferuiv gles3wClearBufferuiv -#define glClearBufferfv gles3wClearBufferfv -#define glClearBufferfi gles3wClearBufferfi -#define glGetStringi gles3wGetStringi -#define glCopyBufferSubData gles3wCopyBufferSubData -#define glGetUniformIndices gles3wGetUniformIndices -#define glGetActiveUniformsiv gles3wGetActiveUniformsiv -#define glGetUniformBlockIndex gles3wGetUniformBlockIndex -#define glGetActiveUniformBlockiv gles3wGetActiveUniformBlockiv -#define glGetActiveUniformBlockName gles3wGetActiveUniformBlockName -#define glUniformBlockBinding gles3wUniformBlockBinding -#define glDrawArraysInstanced gles3wDrawArraysInstanced -#define glDrawElementsInstanced gles3wDrawElementsInstanced -#define glFenceSync gles3wFenceSync -#define glIsSync gles3wIsSync -#define glDeleteSync gles3wDeleteSync -#define glClientWaitSync gles3wClientWaitSync -#define glWaitSync gles3wWaitSync -#define glGetInteger64v gles3wGetInteger64v -#define glGetSynciv gles3wGetSynciv -#define glGetInteger64i_v gles3wGetInteger64i_v -#define glGetBufferParameteri64v gles3wGetBufferParameteri64v -#define glGenSamplers gles3wGenSamplers -#define glDeleteSamplers gles3wDeleteSamplers -#define glIsSampler gles3wIsSampler -#define glBindSampler gles3wBindSampler -#define glSamplerParameteri gles3wSamplerParameteri -#define glSamplerParameteriv gles3wSamplerParameteriv -#define glSamplerParameterf gles3wSamplerParameterf -#define glSamplerParameterfv gles3wSamplerParameterfv -#define glGetSamplerParameteriv gles3wGetSamplerParameteriv -#define glGetSamplerParameterfv gles3wGetSamplerParameterfv -#define glVertexAttribDivisor gles3wVertexAttribDivisor -#define glBindTransformFeedback gles3wBindTransformFeedback -#define glDeleteTransformFeedbacks gles3wDeleteTransformFeedbacks -#define glGenTransformFeedbacks gles3wGenTransformFeedbacks -#define glIsTransformFeedback gles3wIsTransformFeedback -#define glPauseTransformFeedback gles3wPauseTransformFeedback -#define glResumeTransformFeedback gles3wResumeTransformFeedback -#define glGetProgramBinary gles3wGetProgramBinary -#define glProgramBinary gles3wProgramBinary -#define glProgramParameteri gles3wProgramParameteri -#define glInvalidateFramebuffer gles3wInvalidateFramebuffer -#define glInvalidateSubFramebuffer gles3wInvalidateSubFramebuffer -#define glTexStorage2D gles3wTexStorage2D -#define glTexStorage3D gles3wTexStorage3D -#define glGetInternalformativ gles3wGetInternalformativ -#define glLabelObjectEXT gles3wLabelObjectEXT -#define glGetObjectLabelEXT gles3wGetObjectLabelEXT -#define glInsertEventMarkerEXT gles3wInsertEventMarkerEXT -#define glPushGroupMarkerEXT gles3wPushGroupMarkerEXT -#define glPopGroupMarkerEXT gles3wPopGroupMarkerEXT -#define glUseProgramStagesEXT gles3wUseProgramStagesEXT -#define glActiveShaderProgramEXT gles3wActiveShaderProgramEXT -#define glCreateShaderProgramvEXT gles3wCreateShaderProgramvEXT -#define glBindProgramPipelineEXT gles3wBindProgramPipelineEXT -#define glDeleteProgramPipelinesEXT gles3wDeleteProgramPipelinesEXT -#define glGenProgramPipelinesEXT gles3wGenProgramPipelinesEXT -#define glIsProgramPipelineEXT gles3wIsProgramPipelineEXT -#define glProgramParameteriEXT gles3wProgramParameteriEXT -#define glGetProgramPipelineivEXT gles3wGetProgramPipelineivEXT -#define glProgramUniform1iEXT gles3wProgramUniform1iEXT -#define glProgramUniform2iEXT gles3wProgramUniform2iEXT -#define glProgramUniform3iEXT gles3wProgramUniform3iEXT -#define glProgramUniform4iEXT gles3wProgramUniform4iEXT -#define glProgramUniform1fEXT gles3wProgramUniform1fEXT -#define glProgramUniform2fEXT gles3wProgramUniform2fEXT -#define glProgramUniform3fEXT gles3wProgramUniform3fEXT -#define glProgramUniform4fEXT gles3wProgramUniform4fEXT -#define glProgramUniform1ivEXT gles3wProgramUniform1ivEXT -#define glProgramUniform2ivEXT gles3wProgramUniform2ivEXT -#define glProgramUniform3ivEXT gles3wProgramUniform3ivEXT -#define glProgramUniform4ivEXT gles3wProgramUniform4ivEXT -#define glProgramUniform1fvEXT gles3wProgramUniform1fvEXT -#define glProgramUniform2fvEXT gles3wProgramUniform2fvEXT -#define glProgramUniform3fvEXT gles3wProgramUniform3fvEXT -#define glProgramUniform4fvEXT gles3wProgramUniform4fvEXT -#define glProgramUniformMatrix2fvEXT gles3wProgramUniformMatrix2fvEXT -#define glProgramUniformMatrix3fvEXT gles3wProgramUniformMatrix3fvEXT -#define glProgramUniformMatrix4fvEXT gles3wProgramUniformMatrix4fvEXT -#define glProgramUniformMatrix2x3fvEXT gles3wProgramUniformMatrix2x3fvEXT -#define glProgramUniformMatrix3x2fvEXT gles3wProgramUniformMatrix3x2fvEXT -#define glProgramUniformMatrix2x4fvEXT gles3wProgramUniformMatrix2x4fvEXT -#define glProgramUniformMatrix4x2fvEXT gles3wProgramUniformMatrix4x2fvEXT -#define glProgramUniformMatrix3x4fvEXT gles3wProgramUniformMatrix3x4fvEXT -#define glProgramUniformMatrix4x3fvEXT gles3wProgramUniformMatrix4x3fvEXT -#define glValidateProgramPipelineEXT gles3wValidateProgramPipelineEXT -#define glGetProgramPipelineInfoLogEXT gles3wGetProgramPipelineInfoLogEXT - -#define glDebugMessageControlKHR gles3wDebugMessageControlKHR -#define glDebugMessageCallbackKHR gles3wDebugMessageCallbackKHR -#define glFramebufferTexture2DMultisampleEXT gles3wFramebufferTexture2DMultisampleEXT -#define glFramebufferTexture2DMultisampleIMG gles3wFramebufferTexture2DMultisampleIMG - -#ifdef __cplusplus -} -#endif diff --git a/native/cocos/renderer/gfx-gles3/gles3w.mm b/native/cocos/renderer/gfx-gles3/gles3w.mm deleted file mode 100755 index 065a7be7ad..0000000000 --- a/native/cocos/renderer/gfx-gles3/gles3w.mm +++ /dev/null @@ -1,820 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "gles3w.h" - -#if defined(_WIN32) && !defined(ANDROID) -#define WIN32_LEAN_AND_MEAN 1 -#include -#include - -static HMODULE libgl; - -static int open_libgl(void) -{ - libgl = LoadLibraryA("libGLESv2.dll"); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - FreeLibrary(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - - res = (void*)eglGetProcAddress(proc); - if (!res) - res = (void*)GetProcAddress(libgl, proc); - return res; -} -#elif defined(__APPLE__) || defined(__APPLE_CC__) -#if TARGET_OS_IPHONE -#import -#import -#import -#import -#import -#import - -// Routine to run a system command and retrieve the output. -// From http://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c -std::string ES3_EXEC(const char* cmd) { - FILE* pipe = popen(cmd, "r"); - if (!pipe) return "ERROR"; - char buffer[128]; - std::string result = ""; - while(!feof(pipe)) { - if(fgets(buffer, 128, pipe) != NULL) - result += buffer; - } - pclose(pipe); - return result; -} - -static CFBundleRef g_es3Bundle; -static CFURLRef g_es3BundleURL; - -static int open_libgl(void) -{ -#if TARGET_IPHONE_SIMULATOR - CFStringRef frameworkPath = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework"); -#else - CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework"); -#endif - - g_es3BundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - frameworkPath, - kCFURLPOSIXPathStyle, true); - - CFRelease(frameworkPath); - - g_es3Bundle = CFBundleCreate(kCFAllocatorDefault, g_es3BundleURL); - - return (g_es3Bundle != NULL); -} - -static void close_libgl(void) -{ - CFRelease(g_es3Bundle); - CFRelease(g_es3BundleURL); -} - -static void *get_proc(const char *proc) -{ - void *res; - - CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, - kCFStringEncodingASCII); - res = CFBundleGetFunctionPointerForName(g_es3Bundle, procname); - CFRelease(procname); - return res; -} -#else -// macos -#include -#include -#include -#import -#import - -static void* libgl; - -static int open_libgl(void) -{ - NSURL *appURL = [[NSBundle mainBundle] bundleURL]; - std::string libPath(appURL.resourceSpecifier.UTF8String); - libPath.append("/Contents/Frameworks/libGLESv2.dylib"); - - libgl = dlopen(libPath.c_str(), RTLD_LOCAL|RTLD_LAZY); - if (!libgl) - printf("%s\n", dlerror()); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - dlclose(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - - res = (void*)eglGetProcAddress(proc); - if (!res) - res = (void*)dlsym(libgl, proc); - return res; -} -#endif // #if TARGET_OS_IPHONE -#elif defined(__EMSCRIPTEN__) -#include -static void open_libgl() {} -static void close_libgl() {} -static void *get_proc(const char *proc) -{ - return (void*)eglGetProcAddress(proc); -} -#else -#include -#include - -static void *libgl; - -static int open_libgl(void) -{ - libgl = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); - return (libgl != NULL); -} - -static void close_libgl(void) -{ - dlclose(libgl); -} - -static void *get_proc(const char *proc) -{ - void *res; - res = dlsym(libgl, proc); - return res; -} -#endif - -static struct { - int major, minor; -} version; - -static int parse_version(void) -{ - if (!glGetIntegerv) - return -1; - - glGetIntegerv(GL_MAJOR_VERSION, &version.major); - glGetIntegerv(GL_MINOR_VERSION, &version.minor); - - if (version.major < 3) - return -1; - return 0; -} - -static void load_procs(void); - -int gles3wInit(void) -{ - if (!open_libgl()) - { - NSLog(@"Failed to open libgl"); - return 0; - } - - load_procs(); - close_libgl(); - parse_version(); - - return 1; -} - -int gles3wIsSupported(int major, int minor) -{ - if (major <= 3) - return 0; - if (version.major == major) - return version.minor >= minor; - return version.major >= major; -} - -void *gles3wGetProcAddress(const char *proc) -{ - return get_proc(proc); -} - -PFNGLACTIVETEXTUREPROC gles3wActiveTexture; -PFNGLATTACHSHADERPROC gles3wAttachShader; -PFNGLBINDATTRIBLOCATIONPROC gles3wBindAttribLocation; -PFNGLBINDBUFFERPROC gles3wBindBuffer; -PFNGLBINDFRAMEBUFFERPROC gles3wBindFramebuffer; -PFNGLBINDRENDERBUFFERPROC gles3wBindRenderbuffer; -PFNGLBINDTEXTUREPROC gles3wBindTexture; -PFNGLBLENDCOLORPROC gles3wBlendColor; -PFNGLBLENDEQUATIONPROC gles3wBlendEquation; -PFNGLBLENDEQUATIONSEPARATEPROC gles3wBlendEquationSeparate; -PFNGLBLENDFUNCPROC gles3wBlendFunc; -PFNGLBLENDFUNCSEPARATEPROC gles3wBlendFuncSeparate; -PFNGLBUFFERDATAPROC gles3wBufferData; -PFNGLBUFFERSUBDATAPROC gles3wBufferSubData; -PFNGLCHECKFRAMEBUFFERSTATUSPROC gles3wCheckFramebufferStatus; -PFNGLCLEARPROC gles3wClear; -PFNGLCLEARCOLORPROC gles3wClearColor; -PFNGLCLEARDEPTHFPROC gles3wClearDepthf; -PFNGLCLEARSTENCILPROC gles3wClearStencil; -PFNGLCOLORMASKPROC gles3wColorMask; -PFNGLCOMPILESHADERPROC gles3wCompileShader; -PFNGLCOMPRESSEDTEXIMAGE2DPROC gles3wCompressedTexImage2D; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC gles3wCompressedTexSubImage2D; -PFNGLCOPYTEXIMAGE2DPROC gles3wCopyTexImage2D; -PFNGLCOPYTEXSUBIMAGE2DPROC gles3wCopyTexSubImage2D; -PFNGLCREATEPROGRAMPROC gles3wCreateProgram; -PFNGLCREATESHADERPROC gles3wCreateShader; -PFNGLCULLFACEPROC gles3wCullFace; -PFNGLDELETEBUFFERSPROC gles3wDeleteBuffers; -PFNGLDELETEFRAMEBUFFERSPROC gles3wDeleteFramebuffers; -PFNGLDELETEPROGRAMPROC gles3wDeleteProgram; -PFNGLDELETERENDERBUFFERSPROC gles3wDeleteRenderbuffers; -PFNGLDELETESHADERPROC gles3wDeleteShader; -PFNGLDELETETEXTURESPROC gles3wDeleteTextures; -PFNGLDEPTHFUNCPROC gles3wDepthFunc; -PFNGLDEPTHMASKPROC gles3wDepthMask; -PFNGLDEPTHRANGEFPROC gles3wDepthRangef; -PFNGLDETACHSHADERPROC gles3wDetachShader; -PFNGLDISABLEPROC gles3wDisable; -PFNGLDISABLEVERTEXATTRIBARRAYPROC gles3wDisableVertexAttribArray; -PFNGLDRAWARRAYSPROC gles3wDrawArrays; -PFNGLDRAWELEMENTSPROC gles3wDrawElements; -PFNGLENABLEPROC gles3wEnable; -PFNGLENABLEVERTEXATTRIBARRAYPROC gles3wEnableVertexAttribArray; -PFNGLFINISHPROC gles3wFinish; -PFNGLFLUSHPROC gles3wFlush; -PFNGLFRAMEBUFFERRENDERBUFFERPROC gles3wFramebufferRenderbuffer; -PFNGLFRAMEBUFFERTEXTURE2DPROC gles3wFramebufferTexture2D; -PFNGLFRONTFACEPROC gles3wFrontFace; -PFNGLGENBUFFERSPROC gles3wGenBuffers; -PFNGLGENERATEMIPMAPPROC gles3wGenerateMipmap; -PFNGLGENFRAMEBUFFERSPROC gles3wGenFramebuffers; -PFNGLGENRENDERBUFFERSPROC gles3wGenRenderbuffers; -PFNGLGENTEXTURESPROC gles3wGenTextures; -PFNGLGETACTIVEATTRIBPROC gles3wGetActiveAttrib; -PFNGLGETACTIVEUNIFORMPROC gles3wGetActiveUniform; -PFNGLGETATTACHEDSHADERSPROC gles3wGetAttachedShaders; -PFNGLGETATTRIBLOCATIONPROC gles3wGetAttribLocation; -PFNGLGETBOOLEANVPROC gles3wGetBooleanv; -PFNGLGETBUFFERPARAMETERIVPROC gles3wGetBufferParameteriv; -PFNGLGETERRORPROC gles3wGetError; -PFNGLGETFLOATVPROC gles3wGetFloatv; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC gles3wGetFramebufferAttachmentParameteriv; -PFNGLGETINTEGERVPROC gles3wGetIntegerv; -PFNGLGETPROGRAMIVPROC gles3wGetProgramiv; -PFNGLGETPROGRAMINFOLOGPROC gles3wGetProgramInfoLog; -PFNGLGETRENDERBUFFERPARAMETERIVPROC gles3wGetRenderbufferParameteriv; -PFNGLGETSHADERIVPROC gles3wGetShaderiv; -PFNGLGETSHADERINFOLOGPROC gles3wGetShaderInfoLog; -PFNGLGETSHADERPRECISIONFORMATPROC gles3wGetShaderPrecisionFormat; -PFNGLGETSHADERSOURCEPROC gles3wGetShaderSource; -PFNGLGETSTRINGPROC gles3wGetString; -PFNGLGETTEXPARAMETERFVPROC gles3wGetTexParameterfv; -PFNGLGETTEXPARAMETERIVPROC gles3wGetTexParameteriv; -PFNGLGETUNIFORMFVPROC gles3wGetUniformfv; -PFNGLGETUNIFORMIVPROC gles3wGetUniformiv; -PFNGLGETUNIFORMLOCATIONPROC gles3wGetUniformLocation; -PFNGLGETVERTEXATTRIBFVPROC gles3wGetVertexAttribfv; -PFNGLGETVERTEXATTRIBIVPROC gles3wGetVertexAttribiv; -PFNGLGETVERTEXATTRIBPOINTERVPROC gles3wGetVertexAttribPointerv; -PFNGLHINTPROC gles3wHint; -PFNGLISBUFFERPROC gles3wIsBuffer; -PFNGLISENABLEDPROC gles3wIsEnabled; -PFNGLISFRAMEBUFFERPROC gles3wIsFramebuffer; -PFNGLISPROGRAMPROC gles3wIsProgram; -PFNGLISRENDERBUFFERPROC gles3wIsRenderbuffer; -PFNGLISSHADERPROC gles3wIsShader; -PFNGLISTEXTUREPROC gles3wIsTexture; -PFNGLLINEWIDTHPROC gles3wLineWidth; -PFNGLLINKPROGRAMPROC gles3wLinkProgram; -PFNGLPIXELSTOREIPROC gles3wPixelStorei; -PFNGLPOLYGONOFFSETPROC gles3wPolygonOffset; -PFNGLREADPIXELSPROC gles3wReadPixels; -PFNGLRELEASESHADERCOMPILERPROC gles3wReleaseShaderCompiler; -PFNGLRENDERBUFFERSTORAGEPROC gles3wRenderbufferStorage; -PFNGLSAMPLECOVERAGEPROC gles3wSampleCoverage; -PFNGLSCISSORPROC gles3wScissor; -PFNGLSHADERBINARYPROC gles3wShaderBinary; -PFNGLSHADERSOURCEPROC gles3wShaderSource; -PFNGLSTENCILFUNCPROC gles3wStencilFunc; -PFNGLSTENCILFUNCSEPARATEPROC gles3wStencilFuncSeparate; -PFNGLSTENCILMASKPROC gles3wStencilMask; -PFNGLSTENCILMASKSEPARATEPROC gles3wStencilMaskSeparate; -PFNGLSTENCILOPPROC gles3wStencilOp; -PFNGLSTENCILOPSEPARATEPROC gles3wStencilOpSeparate; -PFNGLTEXIMAGE2DPROC gles3wTexImage2D; -PFNGLTEXPARAMETERFPROC gles3wTexParameterf; -PFNGLTEXPARAMETERFVPROC gles3wTexParameterfv; -PFNGLTEXPARAMETERIPROC gles3wTexParameteri; -PFNGLTEXPARAMETERIVPROC gles3wTexParameteriv; -PFNGLTEXSUBIMAGE2DPROC gles3wTexSubImage2D; -PFNGLUNIFORM1FPROC gles3wUniform1f; -PFNGLUNIFORM1FVPROC gles3wUniform1fv; -PFNGLUNIFORM1IPROC gles3wUniform1i; -PFNGLUNIFORM1IVPROC gles3wUniform1iv; -PFNGLUNIFORM2FPROC gles3wUniform2f; -PFNGLUNIFORM2FVPROC gles3wUniform2fv; -PFNGLUNIFORM2IPROC gles3wUniform2i; -PFNGLUNIFORM2IVPROC gles3wUniform2iv; -PFNGLUNIFORM3FPROC gles3wUniform3f; -PFNGLUNIFORM3FVPROC gles3wUniform3fv; -PFNGLUNIFORM3IPROC gles3wUniform3i; -PFNGLUNIFORM3IVPROC gles3wUniform3iv; -PFNGLUNIFORM4FPROC gles3wUniform4f; -PFNGLUNIFORM4FVPROC gles3wUniform4fv; -PFNGLUNIFORM4IPROC gles3wUniform4i; -PFNGLUNIFORM4IVPROC gles3wUniform4iv; -PFNGLUNIFORMMATRIX2FVPROC gles3wUniformMatrix2fv; -PFNGLUNIFORMMATRIX3FVPROC gles3wUniformMatrix3fv; -PFNGLUNIFORMMATRIX4FVPROC gles3wUniformMatrix4fv; -PFNGLUSEPROGRAMPROC gles3wUseProgram; -PFNGLVALIDATEPROGRAMPROC gles3wValidateProgram; -PFNGLVERTEXATTRIB1FPROC gles3wVertexAttrib1f; -PFNGLVERTEXATTRIB1FVPROC gles3wVertexAttrib1fv; -PFNGLVERTEXATTRIB2FPROC gles3wVertexAttrib2f; -PFNGLVERTEXATTRIB2FVPROC gles3wVertexAttrib2fv; -PFNGLVERTEXATTRIB3FPROC gles3wVertexAttrib3f; -PFNGLVERTEXATTRIB3FVPROC gles3wVertexAttrib3fv; -PFNGLVERTEXATTRIB4FPROC gles3wVertexAttrib4f; -PFNGLVERTEXATTRIB4FVPROC gles3wVertexAttrib4fv; -PFNGLVERTEXATTRIBPOINTERPROC gles3wVertexAttribPointer; -PFNGLVIEWPORTPROC gles3wViewport; -PFNGLREADBUFFERPROC gles3wReadBuffer; -PFNGLDRAWRANGEELEMENTSPROC gles3wDrawRangeElements; -PFNGLTEXIMAGE3DPROC gles3wTexImage3D; -PFNGLTEXSUBIMAGE3DPROC gles3wTexSubImage3D; -PFNGLCOPYTEXSUBIMAGE3DPROC gles3wCopyTexSubImage3D; -PFNGLCOMPRESSEDTEXIMAGE3DPROC gles3wCompressedTexImage3D; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC gles3wCompressedTexSubImage3D; -PFNGLGENQUERIESPROC gles3wGenQueries; -PFNGLDELETEQUERIESPROC gles3wDeleteQueries; -PFNGLISQUERYPROC gles3wIsQuery; -PFNGLBEGINQUERYPROC gles3wBeginQuery; -PFNGLENDQUERYPROC gles3wEndQuery; -PFNGLGETQUERYIVPROC gles3wGetQueryiv; -PFNGLGETQUERYOBJECTUIVPROC gles3wGetQueryObjectuiv; -PFNGLUNMAPBUFFERPROC gles3wUnmapBuffer; -PFNGLGETBUFFERPOINTERVPROC gles3wGetBufferPointerv; -PFNGLDRAWBUFFERSPROC gles3wDrawBuffers; -PFNGLUNIFORMMATRIX2X3FVPROC gles3wUniformMatrix2x3fv; -PFNGLUNIFORMMATRIX3X2FVPROC gles3wUniformMatrix3x2fv; -PFNGLUNIFORMMATRIX2X4FVPROC gles3wUniformMatrix2x4fv; -PFNGLUNIFORMMATRIX4X2FVPROC gles3wUniformMatrix4x2fv; -PFNGLUNIFORMMATRIX3X4FVPROC gles3wUniformMatrix3x4fv; -PFNGLUNIFORMMATRIX4X3FVPROC gles3wUniformMatrix4x3fv; -PFNGLBLITFRAMEBUFFERPROC gles3wBlitFramebuffer; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC gles3wRenderbufferStorageMultisample; -PFNGLFRAMEBUFFERTEXTURELAYERPROC gles3wFramebufferTextureLayer; -PFNGLMAPBUFFERRANGEPROC gles3wMapBufferRange; -PFNGLFLUSHMAPPEDBUFFERRANGEPROC gles3wFlushMappedBufferRange; -PFNGLBINDVERTEXARRAYPROC gles3wBindVertexArray; -PFNGLDELETEVERTEXARRAYSPROC gles3wDeleteVertexArrays; -PFNGLGENVERTEXARRAYSPROC gles3wGenVertexArrays; -PFNGLISVERTEXARRAYPROC gles3wIsVertexArray; -PFNGLGETINTEGERI_VPROC gles3wGetIntegeri_v; -PFNGLBEGINTRANSFORMFEEDBACKPROC gles3wBeginTransformFeedback; -PFNGLENDTRANSFORMFEEDBACKPROC gles3wEndTransformFeedback; -PFNGLBINDBUFFERRANGEPROC gles3wBindBufferRange; -PFNGLBINDBUFFERBASEPROC gles3wBindBufferBase; -PFNGLTRANSFORMFEEDBACKVARYINGSPROC gles3wTransformFeedbackVaryings; -PFNGLGETTRANSFORMFEEDBACKVARYINGPROC gles3wGetTransformFeedbackVarying; -PFNGLVERTEXATTRIBIPOINTERPROC gles3wVertexAttribIPointer; -PFNGLGETVERTEXATTRIBIIVPROC gles3wGetVertexAttribIiv; -PFNGLGETVERTEXATTRIBIUIVPROC gles3wGetVertexAttribIuiv; -PFNGLVERTEXATTRIBI4IPROC gles3wVertexAttribI4i; -PFNGLVERTEXATTRIBI4UIPROC gles3wVertexAttribI4ui; -PFNGLVERTEXATTRIBI4IVPROC gles3wVertexAttribI4iv; -PFNGLVERTEXATTRIBI4UIVPROC gles3wVertexAttribI4uiv; -PFNGLGETUNIFORMUIVPROC gles3wGetUniformuiv; -PFNGLGETFRAGDATALOCATIONPROC gles3wGetFragDataLocation; -PFNGLUNIFORM1UIPROC gles3wUniform1ui; -PFNGLUNIFORM2UIPROC gles3wUniform2ui; -PFNGLUNIFORM3UIPROC gles3wUniform3ui; -PFNGLUNIFORM4UIPROC gles3wUniform4ui; -PFNGLUNIFORM1UIVPROC gles3wUniform1uiv; -PFNGLUNIFORM2UIVPROC gles3wUniform2uiv; -PFNGLUNIFORM3UIVPROC gles3wUniform3uiv; -PFNGLUNIFORM4UIVPROC gles3wUniform4uiv; -PFNGLCLEARBUFFERIVPROC gles3wClearBufferiv; -PFNGLCLEARBUFFERUIVPROC gles3wClearBufferuiv; -PFNGLCLEARBUFFERFVPROC gles3wClearBufferfv; -PFNGLCLEARBUFFERFIPROC gles3wClearBufferfi; -PFNGLGETSTRINGIPROC gles3wGetStringi; -PFNGLCOPYBUFFERSUBDATAPROC gles3wCopyBufferSubData; -PFNGLGETUNIFORMINDICESPROC gles3wGetUniformIndices; -PFNGLGETACTIVEUNIFORMSIVPROC gles3wGetActiveUniformsiv; -PFNGLGETUNIFORMBLOCKINDEXPROC gles3wGetUniformBlockIndex; -PFNGLGETACTIVEUNIFORMBLOCKIVPROC gles3wGetActiveUniformBlockiv; -PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC gles3wGetActiveUniformBlockName; -PFNGLUNIFORMBLOCKBINDINGPROC gles3wUniformBlockBinding; -PFNGLDRAWARRAYSINSTANCEDPROC gles3wDrawArraysInstanced; -PFNGLDRAWELEMENTSINSTANCEDPROC gles3wDrawElementsInstanced; -PFNGLFENCESYNCPROC gles3wFenceSync; -PFNGLISSYNCPROC gles3wIsSync; -PFNGLDELETESYNCPROC gles3wDeleteSync; -PFNGLCLIENTWAITSYNCPROC gles3wClientWaitSync; -PFNGLWAITSYNCPROC gles3wWaitSync; -PFNGLGETINTEGER64VPROC gles3wGetInteger64v; -PFNGLGETSYNCIVPROC gles3wGetSynciv; -PFNGLGETINTEGER64I_VPROC gles3wGetInteger64i_v; -PFNGLGETBUFFERPARAMETERI64VPROC gles3wGetBufferParameteri64v; -PFNGLGENSAMPLERSPROC gles3wGenSamplers; -PFNGLDELETESAMPLERSPROC gles3wDeleteSamplers; -PFNGLISSAMPLERPROC gles3wIsSampler; -PFNGLBINDSAMPLERPROC gles3wBindSampler; -PFNGLSAMPLERPARAMETERIPROC gles3wSamplerParameteri; -PFNGLSAMPLERPARAMETERIVPROC gles3wSamplerParameteriv; -PFNGLSAMPLERPARAMETERFPROC gles3wSamplerParameterf; -PFNGLSAMPLERPARAMETERFVPROC gles3wSamplerParameterfv; -PFNGLGETSAMPLERPARAMETERIVPROC gles3wGetSamplerParameteriv; -PFNGLGETSAMPLERPARAMETERFVPROC gles3wGetSamplerParameterfv; -PFNGLVERTEXATTRIBDIVISORPROC gles3wVertexAttribDivisor; -PFNGLBINDTRANSFORMFEEDBACKPROC gles3wBindTransformFeedback; -PFNGLDELETETRANSFORMFEEDBACKSPROC gles3wDeleteTransformFeedbacks; -PFNGLGENTRANSFORMFEEDBACKSPROC gles3wGenTransformFeedbacks; -PFNGLISTRANSFORMFEEDBACKPROC gles3wIsTransformFeedback; -PFNGLPAUSETRANSFORMFEEDBACKPROC gles3wPauseTransformFeedback; -PFNGLRESUMETRANSFORMFEEDBACKPROC gles3wResumeTransformFeedback; -PFNGLGETPROGRAMBINARYPROC gles3wGetProgramBinary; -PFNGLPROGRAMBINARYPROC gles3wProgramBinary; -PFNGLPROGRAMPARAMETERIPROC gles3wProgramParameteri; -PFNGLINVALIDATEFRAMEBUFFERPROC gles3wInvalidateFramebuffer; -PFNGLINVALIDATESUBFRAMEBUFFERPROC gles3wInvalidateSubFramebuffer; -PFNGLTEXSTORAGE2DPROC gles3wTexStorage2D; -PFNGLTEXSTORAGE3DPROC gles3wTexStorage3D; -PFNGLGETINTERNALFORMATIVPROC gles3wGetInternalformativ; -PFNGLUSEPROGRAMSTAGESEXTPROC gles3wUseProgramStagesEXT; -PFNGLACTIVESHADERPROGRAMEXTPROC gles3wActiveShaderProgramEXT; -PFNGLCREATESHADERPROGRAMVEXTPROC gles3wCreateShaderProgramvEXT; -PFNGLBINDPROGRAMPIPELINEEXTPROC gles3wBindProgramPipelineEXT; -PFNGLDELETEPROGRAMPIPELINESEXTPROC gles3wDeleteProgramPipelinesEXT; -PFNGLGENPROGRAMPIPELINESEXTPROC gles3wGenProgramPipelinesEXT; -PFNGLISPROGRAMPIPELINEEXTPROC gles3wIsProgramPipelineEXT; -PFNGLPROGRAMPARAMETERIEXTPROC gles3wProgramParameteriEXT; -PFNGLGETPROGRAMPIPELINEIVEXTPROC gles3wGetProgramPipelineivEXT; -PFNGLPROGRAMUNIFORM1IEXTPROC gles3wProgramUniform1iEXT; -PFNGLPROGRAMUNIFORM2IEXTPROC gles3wProgramUniform2iEXT; -PFNGLPROGRAMUNIFORM3IEXTPROC gles3wProgramUniform3iEXT; -PFNGLPROGRAMUNIFORM4IEXTPROC gles3wProgramUniform4iEXT; -PFNGLPROGRAMUNIFORM1FEXTPROC gles3wProgramUniform1fEXT; -PFNGLPROGRAMUNIFORM2FEXTPROC gles3wProgramUniform2fEXT; -PFNGLPROGRAMUNIFORM3FEXTPROC gles3wProgramUniform3fEXT; -PFNGLPROGRAMUNIFORM4FEXTPROC gles3wProgramUniform4fEXT; -PFNGLPROGRAMUNIFORM1IVEXTPROC gles3wProgramUniform1ivEXT; -PFNGLPROGRAMUNIFORM2IVEXTPROC gles3wProgramUniform2ivEXT; -PFNGLPROGRAMUNIFORM3IVEXTPROC gles3wProgramUniform3ivEXT; -PFNGLPROGRAMUNIFORM4IVEXTPROC gles3wProgramUniform4ivEXT; -PFNGLPROGRAMUNIFORM1FVEXTPROC gles3wProgramUniform1fvEXT; -PFNGLPROGRAMUNIFORM2FVEXTPROC gles3wProgramUniform2fvEXT; -PFNGLPROGRAMUNIFORM3FVEXTPROC gles3wProgramUniform3fvEXT; -PFNGLPROGRAMUNIFORM4FVEXTPROC gles3wProgramUniform4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC gles3wProgramUniformMatrix2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC gles3wProgramUniformMatrix3fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC gles3wProgramUniformMatrix4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC gles3wProgramUniformMatrix2x3fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC gles3wProgramUniformMatrix3x2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC gles3wProgramUniformMatrix2x4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC gles3wProgramUniformMatrix4x2fvEXT; -PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC gles3wProgramUniformMatrix3x4fvEXT; -PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC gles3wProgramUniformMatrix4x3fvEXT; -PFNGLVALIDATEPROGRAMPIPELINEEXTPROC gles3wValidateProgramPipelineEXT; -PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC gles3wGetProgramPipelineInfoLogEXT; -PFNGLLABELOBJECTEXTPROC gles3wLabelObjectEXT; -PFNGLGETOBJECTLABELEXTPROC gles3wGetObjectLabelEXT; -PFNGLINSERTEVENTMARKEREXTPROC gles3wInsertEventMarkerEXT; -PFNGLPUSHGROUPMARKEREXTPROC gles3wPushGroupMarkerEXT; -PFNGLPOPGROUPMARKEREXTPROC gles3wPopGroupMarkerEXT; - -PFNGLDEBUGMESSAGECONTROLKHRPROC gles3wDebugMessageControlKHR; -PFNGLDEBUGMESSAGECALLBACKKHRPROC gles3wDebugMessageCallbackKHR; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC gles3wFramebufferTexture2DMultisampleEXT; -PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC gles3wFramebufferTexture2DMultisampleIMG; - -static void load_procs(void) -{ - gles3wActiveTexture = (PFNGLACTIVETEXTUREPROC) get_proc("glActiveTexture"); - gles3wAttachShader = (PFNGLATTACHSHADERPROC) get_proc("glAttachShader"); - gles3wBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) get_proc("glBindAttribLocation"); - gles3wBindBuffer = (PFNGLBINDBUFFERPROC) get_proc("glBindBuffer"); - gles3wBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) get_proc("glBindFramebuffer"); - gles3wBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) get_proc("glBindRenderbuffer"); - gles3wBindTexture = (PFNGLBINDTEXTUREPROC) get_proc("glBindTexture"); - gles3wBlendColor = (PFNGLBLENDCOLORPROC) get_proc("glBlendColor"); - gles3wBlendEquation = (PFNGLBLENDEQUATIONPROC) get_proc("glBlendEquation"); - gles3wBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) get_proc("glBlendEquationSeparate"); - gles3wBlendFunc = (PFNGLBLENDFUNCPROC) get_proc("glBlendFunc"); - gles3wBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) get_proc("glBlendFuncSeparate"); - gles3wBufferData = (PFNGLBUFFERDATAPROC) get_proc("glBufferData"); - gles3wBufferSubData = (PFNGLBUFFERSUBDATAPROC) get_proc("glBufferSubData"); - gles3wCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) get_proc("glCheckFramebufferStatus"); - gles3wClear = (PFNGLCLEARPROC) get_proc("glClear"); - gles3wClearColor = (PFNGLCLEARCOLORPROC) get_proc("glClearColor"); - gles3wClearDepthf = (PFNGLCLEARDEPTHFPROC) get_proc("glClearDepthf"); - gles3wClearStencil = (PFNGLCLEARSTENCILPROC) get_proc("glClearStencil"); - gles3wColorMask = (PFNGLCOLORMASKPROC) get_proc("glColorMask"); - gles3wCompileShader = (PFNGLCOMPILESHADERPROC) get_proc("glCompileShader"); - gles3wCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) get_proc("glCompressedTexImage2D"); - gles3wCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) get_proc("glCompressedTexSubImage2D"); - gles3wCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) get_proc("glCopyTexImage2D"); - gles3wCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) get_proc("glCopyTexSubImage2D"); - gles3wCreateProgram = (PFNGLCREATEPROGRAMPROC) get_proc("glCreateProgram"); - gles3wCreateShader = (PFNGLCREATESHADERPROC) get_proc("glCreateShader"); - gles3wCullFace = (PFNGLCULLFACEPROC) get_proc("glCullFace"); - gles3wDeleteBuffers = (PFNGLDELETEBUFFERSPROC) get_proc("glDeleteBuffers"); - gles3wDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) get_proc("glDeleteFramebuffers"); - gles3wDeleteProgram = (PFNGLDELETEPROGRAMPROC) get_proc("glDeleteProgram"); - gles3wDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) get_proc("glDeleteRenderbuffers"); - gles3wDeleteShader = (PFNGLDELETESHADERPROC) get_proc("glDeleteShader"); - gles3wDeleteTextures = (PFNGLDELETETEXTURESPROC) get_proc("glDeleteTextures"); - gles3wDepthFunc = (PFNGLDEPTHFUNCPROC) get_proc("glDepthFunc"); - gles3wDepthMask = (PFNGLDEPTHMASKPROC) get_proc("glDepthMask"); - gles3wDepthRangef = (PFNGLDEPTHRANGEFPROC) get_proc("glDepthRangef"); - gles3wDetachShader = (PFNGLDETACHSHADERPROC) get_proc("glDetachShader"); - gles3wDisable = (PFNGLDISABLEPROC) get_proc("glDisable"); - gles3wDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) get_proc("glDisableVertexAttribArray"); - gles3wDrawArrays = (PFNGLDRAWARRAYSPROC) get_proc("glDrawArrays"); - gles3wDrawElements = (PFNGLDRAWELEMENTSPROC) get_proc("glDrawElements"); - gles3wEnable = (PFNGLENABLEPROC) get_proc("glEnable"); - gles3wEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) get_proc("glEnableVertexAttribArray"); - gles3wFinish = (PFNGLFINISHPROC) get_proc("glFinish"); - gles3wFlush = (PFNGLFLUSHPROC) get_proc("glFlush"); - gles3wFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) get_proc("glFramebufferRenderbuffer"); - gles3wFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) get_proc("glFramebufferTexture2D"); - gles3wFrontFace = (PFNGLFRONTFACEPROC) get_proc("glFrontFace"); - gles3wGenBuffers = (PFNGLGENBUFFERSPROC) get_proc("glGenBuffers"); - gles3wGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) get_proc("glGenerateMipmap"); - gles3wGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) get_proc("glGenFramebuffers"); - gles3wGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) get_proc("glGenRenderbuffers"); - gles3wGenTextures = (PFNGLGENTEXTURESPROC) get_proc("glGenTextures"); - gles3wGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) get_proc("glGetActiveAttrib"); - gles3wGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) get_proc("glGetActiveUniform"); - gles3wGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) get_proc("glGetAttachedShaders"); - gles3wGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) get_proc("glGetAttribLocation"); - gles3wGetBooleanv = (PFNGLGETBOOLEANVPROC) get_proc("glGetBooleanv"); - gles3wGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) get_proc("glGetBufferParameteriv"); - gles3wGetError = (PFNGLGETERRORPROC) get_proc("glGetError"); - gles3wGetFloatv = (PFNGLGETFLOATVPROC) get_proc("glGetFloatv"); - gles3wGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) get_proc("glGetFramebufferAttachmentParameteriv"); - gles3wGetIntegerv = (PFNGLGETINTEGERVPROC) get_proc("glGetIntegerv"); - gles3wGetProgramiv = (PFNGLGETPROGRAMIVPROC) get_proc("glGetProgramiv"); - gles3wGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) get_proc("glGetProgramInfoLog"); - gles3wGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) get_proc("glGetRenderbufferParameteriv"); - gles3wGetShaderiv = (PFNGLGETSHADERIVPROC) get_proc("glGetShaderiv"); - gles3wGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) get_proc("glGetShaderInfoLog"); - gles3wGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC) get_proc("glGetShaderPrecisionFormat"); - gles3wGetShaderSource = (PFNGLGETSHADERSOURCEPROC) get_proc("glGetShaderSource"); - gles3wGetString = (PFNGLGETSTRINGPROC) get_proc("glGetString"); - gles3wGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) get_proc("glGetTexParameterfv"); - gles3wGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) get_proc("glGetTexParameteriv"); - gles3wGetUniformfv = (PFNGLGETUNIFORMFVPROC) get_proc("glGetUniformfv"); - gles3wGetUniformiv = (PFNGLGETUNIFORMIVPROC) get_proc("glGetUniformiv"); - gles3wGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) get_proc("glGetUniformLocation"); - gles3wGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) get_proc("glGetVertexAttribfv"); - gles3wGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) get_proc("glGetVertexAttribiv"); - gles3wGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) get_proc("glGetVertexAttribPointerv"); - gles3wHint = (PFNGLHINTPROC) get_proc("glHint"); - gles3wIsBuffer = (PFNGLISBUFFERPROC) get_proc("glIsBuffer"); - gles3wIsEnabled = (PFNGLISENABLEDPROC) get_proc("glIsEnabled"); - gles3wIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) get_proc("glIsFramebuffer"); - gles3wIsProgram = (PFNGLISPROGRAMPROC) get_proc("glIsProgram"); - gles3wIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) get_proc("glIsRenderbuffer"); - gles3wIsShader = (PFNGLISSHADERPROC) get_proc("glIsShader"); - gles3wIsTexture = (PFNGLISTEXTUREPROC) get_proc("glIsTexture"); - gles3wLineWidth = (PFNGLLINEWIDTHPROC) get_proc("glLineWidth"); - gles3wLinkProgram = (PFNGLLINKPROGRAMPROC) get_proc("glLinkProgram"); - gles3wPixelStorei = (PFNGLPIXELSTOREIPROC) get_proc("glPixelStorei"); - gles3wPolygonOffset = (PFNGLPOLYGONOFFSETPROC) get_proc("glPolygonOffset"); - gles3wReadPixels = (PFNGLREADPIXELSPROC) get_proc("glReadPixels"); - gles3wReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC) get_proc("glReleaseShaderCompiler"); - gles3wRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) get_proc("glRenderbufferStorage"); - gles3wSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) get_proc("glSampleCoverage"); - gles3wScissor = (PFNGLSCISSORPROC) get_proc("glScissor"); - gles3wShaderBinary = (PFNGLSHADERBINARYPROC) get_proc("glShaderBinary"); - gles3wShaderSource = (PFNGLSHADERSOURCEPROC) get_proc("glShaderSource"); - gles3wStencilFunc = (PFNGLSTENCILFUNCPROC) get_proc("glStencilFunc"); - gles3wStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) get_proc("glStencilFuncSeparate"); - gles3wStencilMask = (PFNGLSTENCILMASKPROC) get_proc("glStencilMask"); - gles3wStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) get_proc("glStencilMaskSeparate"); - gles3wStencilOp = (PFNGLSTENCILOPPROC) get_proc("glStencilOp"); - gles3wStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) get_proc("glStencilOpSeparate"); - gles3wTexImage2D = (PFNGLTEXIMAGE2DPROC) get_proc("glTexImage2D"); - gles3wTexParameterf = (PFNGLTEXPARAMETERFPROC) get_proc("glTexParameterf"); - gles3wTexParameterfv = (PFNGLTEXPARAMETERFVPROC) get_proc("glTexParameterfv"); - gles3wTexParameteri = (PFNGLTEXPARAMETERIPROC) get_proc("glTexParameteri"); - gles3wTexParameteriv = (PFNGLTEXPARAMETERIVPROC) get_proc("glTexParameteriv"); - gles3wTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) get_proc("glTexSubImage2D"); - gles3wUniform1f = (PFNGLUNIFORM1FPROC) get_proc("glUniform1f"); - gles3wUniform1fv = (PFNGLUNIFORM1FVPROC) get_proc("glUniform1fv"); - gles3wUniform1i = (PFNGLUNIFORM1IPROC) get_proc("glUniform1i"); - gles3wUniform1iv = (PFNGLUNIFORM1IVPROC) get_proc("glUniform1iv"); - gles3wUniform2f = (PFNGLUNIFORM2FPROC) get_proc("glUniform2f"); - gles3wUniform2fv = (PFNGLUNIFORM2FVPROC) get_proc("glUniform2fv"); - gles3wUniform2i = (PFNGLUNIFORM2IPROC) get_proc("glUniform2i"); - gles3wUniform2iv = (PFNGLUNIFORM2IVPROC) get_proc("glUniform2iv"); - gles3wUniform3f = (PFNGLUNIFORM3FPROC) get_proc("glUniform3f"); - gles3wUniform3fv = (PFNGLUNIFORM3FVPROC) get_proc("glUniform3fv"); - gles3wUniform3i = (PFNGLUNIFORM3IPROC) get_proc("glUniform3i"); - gles3wUniform3iv = (PFNGLUNIFORM3IVPROC) get_proc("glUniform3iv"); - gles3wUniform4f = (PFNGLUNIFORM4FPROC) get_proc("glUniform4f"); - gles3wUniform4fv = (PFNGLUNIFORM4FVPROC) get_proc("glUniform4fv"); - gles3wUniform4i = (PFNGLUNIFORM4IPROC) get_proc("glUniform4i"); - gles3wUniform4iv = (PFNGLUNIFORM4IVPROC) get_proc("glUniform4iv"); - gles3wUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) get_proc("glUniformMatrix2fv"); - gles3wUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) get_proc("glUniformMatrix3fv"); - gles3wUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) get_proc("glUniformMatrix4fv"); - gles3wUseProgram = (PFNGLUSEPROGRAMPROC) get_proc("glUseProgram"); - gles3wValidateProgram = (PFNGLVALIDATEPROGRAMPROC) get_proc("glValidateProgram"); - gles3wVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) get_proc("glVertexAttrib1f"); - gles3wVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) get_proc("glVertexAttrib1fv"); - gles3wVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) get_proc("glVertexAttrib2f"); - gles3wVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) get_proc("glVertexAttrib2fv"); - gles3wVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) get_proc("glVertexAttrib3f"); - gles3wVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) get_proc("glVertexAttrib3fv"); - gles3wVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) get_proc("glVertexAttrib4f"); - gles3wVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) get_proc("glVertexAttrib4fv"); - gles3wVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) get_proc("glVertexAttribPointer"); - gles3wViewport = (PFNGLVIEWPORTPROC) get_proc("glViewport"); - gles3wReadBuffer = (PFNGLREADBUFFERPROC) get_proc("glReadBuffer"); - gles3wDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) get_proc("glDrawRangeElements"); - gles3wTexImage3D = (PFNGLTEXIMAGE3DPROC) get_proc("glTexImage3D"); - gles3wTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC) get_proc("glTexSubImage3D"); - gles3wCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC) get_proc("glCopyTexSubImage3D"); - gles3wCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC) get_proc("glCompressedTexImage3D"); - gles3wCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) get_proc("glCompressedTexSubImage3D"); - gles3wGenQueries = (PFNGLGENQUERIESPROC) get_proc("glGenQueries"); - gles3wDeleteQueries = (PFNGLDELETEQUERIESPROC) get_proc("glDeleteQueries"); - gles3wIsQuery = (PFNGLISQUERYPROC) get_proc("glIsQuery"); - gles3wBeginQuery = (PFNGLBEGINQUERYPROC) get_proc("glBeginQuery"); - gles3wEndQuery = (PFNGLENDQUERYPROC) get_proc("glEndQuery"); - gles3wGetQueryiv = (PFNGLGETQUERYIVPROC) get_proc("glGetQueryiv"); - gles3wGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) get_proc("glGetQueryObjectuiv"); - gles3wUnmapBuffer = (PFNGLUNMAPBUFFERPROC) get_proc("glUnmapBuffer"); - gles3wGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) get_proc("glGetBufferPointerv"); - gles3wDrawBuffers = (PFNGLDRAWBUFFERSPROC) get_proc("glDrawBuffers"); - gles3wUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) get_proc("glUniformMatrix2x3fv"); - gles3wUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC) get_proc("glUniformMatrix3x2fv"); - gles3wUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC) get_proc("glUniformMatrix2x4fv"); - gles3wUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC) get_proc("glUniformMatrix4x2fv"); - gles3wUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC) get_proc("glUniformMatrix3x4fv"); - gles3wUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC) get_proc("glUniformMatrix4x3fv"); - gles3wBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) get_proc("glBlitFramebuffer"); - gles3wRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) get_proc("glRenderbufferStorageMultisample"); - gles3wFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) get_proc("glFramebufferTextureLayer"); - gles3wMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) get_proc("glMapBufferRange"); - gles3wFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) get_proc("glFlushMappedBufferRange"); - gles3wBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) get_proc("glBindVertexArray"); - gles3wDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) get_proc("glDeleteVertexArrays"); - gles3wGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) get_proc("glGenVertexArrays"); - gles3wIsVertexArray = (PFNGLISVERTEXARRAYPROC) get_proc("glIsVertexArray"); - gles3wGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) get_proc("glGetIntegeri_v"); - gles3wBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) get_proc("glBeginTransformFeedback"); - gles3wEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) get_proc("glEndTransformFeedback"); - gles3wBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) get_proc("glBindBufferRange"); - gles3wBindBufferBase = (PFNGLBINDBUFFERBASEPROC) get_proc("glBindBufferBase"); - gles3wTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) get_proc("glTransformFeedbackVaryings"); - gles3wGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) get_proc("glGetTransformFeedbackVarying"); - gles3wVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) get_proc("glVertexAttribIPointer"); - gles3wGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC) get_proc("glGetVertexAttribIiv"); - gles3wGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC) get_proc("glGetVertexAttribIuiv"); - gles3wVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC) get_proc("glVertexAttribI4i"); - gles3wVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC) get_proc("glVertexAttribI4ui"); - gles3wVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC) get_proc("glVertexAttribI4iv"); - gles3wVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC) get_proc("glVertexAttribI4uiv"); - gles3wGetUniformuiv = (PFNGLGETUNIFORMUIVPROC) get_proc("glGetUniformuiv"); - gles3wGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC) get_proc("glGetFragDataLocation"); - gles3wUniform1ui = (PFNGLUNIFORM1UIPROC) get_proc("glUniform1ui"); - gles3wUniform2ui = (PFNGLUNIFORM2UIPROC) get_proc("glUniform2ui"); - gles3wUniform3ui = (PFNGLUNIFORM3UIPROC) get_proc("glUniform3ui"); - gles3wUniform4ui = (PFNGLUNIFORM4UIPROC) get_proc("glUniform4ui"); - gles3wUniform1uiv = (PFNGLUNIFORM1UIVPROC) get_proc("glUniform1uiv"); - gles3wUniform2uiv = (PFNGLUNIFORM2UIVPROC) get_proc("glUniform2uiv"); - gles3wUniform3uiv = (PFNGLUNIFORM3UIVPROC) get_proc("glUniform3uiv"); - gles3wUniform4uiv = (PFNGLUNIFORM4UIVPROC) get_proc("glUniform4uiv"); - gles3wClearBufferiv = (PFNGLCLEARBUFFERIVPROC) get_proc("glClearBufferiv"); - gles3wClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC) get_proc("glClearBufferuiv"); - gles3wClearBufferfv = (PFNGLCLEARBUFFERFVPROC) get_proc("glClearBufferfv"); - gles3wClearBufferfi = (PFNGLCLEARBUFFERFIPROC) get_proc("glClearBufferfi"); - gles3wGetStringi = (PFNGLGETSTRINGIPROC) get_proc("glGetStringi"); - gles3wCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC) get_proc("glCopyBufferSubData"); - gles3wGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC) get_proc("glGetUniformIndices"); - gles3wGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC) get_proc("glGetActiveUniformsiv"); - gles3wGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) get_proc("glGetUniformBlockIndex"); - gles3wGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC) get_proc("glGetActiveUniformBlockiv"); - gles3wGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) get_proc("glGetActiveUniformBlockName"); - gles3wUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) get_proc("glUniformBlockBinding"); - gles3wDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) get_proc("glDrawArraysInstanced"); - gles3wDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) get_proc("glDrawElementsInstanced"); - gles3wFenceSync = (PFNGLFENCESYNCPROC) get_proc("glFenceSync"); - gles3wIsSync = (PFNGLISSYNCPROC) get_proc("glIsSync"); - gles3wDeleteSync = (PFNGLDELETESYNCPROC) get_proc("glDeleteSync"); - gles3wClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) get_proc("glClientWaitSync"); - gles3wWaitSync = (PFNGLWAITSYNCPROC) get_proc("glWaitSync"); - gles3wGetInteger64v = (PFNGLGETINTEGER64VPROC) get_proc("glGetInteger64v"); - gles3wGetSynciv = (PFNGLGETSYNCIVPROC) get_proc("glGetSynciv"); - gles3wGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC) get_proc("glGetInteger64i_v"); - gles3wGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC) get_proc("glGetBufferParameteri64v"); - gles3wGenSamplers = (PFNGLGENSAMPLERSPROC) get_proc("glGenSamplers"); - gles3wDeleteSamplers = (PFNGLDELETESAMPLERSPROC) get_proc("glDeleteSamplers"); - gles3wIsSampler = (PFNGLISSAMPLERPROC) get_proc("glIsSampler"); - gles3wBindSampler = (PFNGLBINDSAMPLERPROC) get_proc("glBindSampler"); - gles3wSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC) get_proc("glSamplerParameteri"); - gles3wSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC) get_proc("glSamplerParameteriv"); - gles3wSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC) get_proc("glSamplerParameterf"); - gles3wSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC) get_proc("glSamplerParameterfv"); - gles3wGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC) get_proc("glGetSamplerParameteriv"); - gles3wGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC) get_proc("glGetSamplerParameterfv"); - gles3wVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) get_proc("glVertexAttribDivisor"); - gles3wBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC) get_proc("glBindTransformFeedback"); - gles3wDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC) get_proc("glDeleteTransformFeedbacks"); - gles3wGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC) get_proc("glGenTransformFeedbacks"); - gles3wIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC) get_proc("glIsTransformFeedback"); - gles3wPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC) get_proc("glPauseTransformFeedback"); - gles3wResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC) get_proc("glResumeTransformFeedback"); - gles3wGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC) get_proc("glGetProgramBinary"); - gles3wProgramBinary = (PFNGLPROGRAMBINARYPROC) get_proc("glProgramBinary"); - gles3wProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC) get_proc("glProgramParameteri"); - gles3wInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC) get_proc("glInvalidateFramebuffer"); - gles3wInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC) get_proc("glInvalidateSubFramebuffer"); - gles3wTexStorage2D = (PFNGLTEXSTORAGE2DPROC) get_proc("glTexStorage2D"); - gles3wTexStorage3D = (PFNGLTEXSTORAGE3DPROC) get_proc("glTexStorage3D"); - gles3wGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC) get_proc("glGetInternalformativ"); - gles3wLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC) get_proc("glLabelObjectEXT"); - gles3wGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC) get_proc("glGetObjectLabelEXT"); - gles3wInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC) get_proc("glInsertEventMarkerEXT"); - gles3wPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC) get_proc("glPushGroupMarkerEXT"); - gles3wPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC) get_proc("glPopGroupMarkerEXT"); - gles3wUseProgramStagesEXT = (PFNGLUSEPROGRAMSTAGESEXTPROC) get_proc("glUseProgramStagesEXT"); - gles3wActiveShaderProgramEXT = (PFNGLACTIVESHADERPROGRAMEXTPROC) get_proc("glActiveShaderProgramEXT"); - gles3wCreateShaderProgramvEXT = (PFNGLCREATESHADERPROGRAMVEXTPROC) get_proc("glCreateShaderProgramvEXT"); - gles3wBindProgramPipelineEXT = (PFNGLBINDPROGRAMPIPELINEEXTPROC) get_proc("glBindProgramPipelineEXT"); - gles3wDeleteProgramPipelinesEXT = (PFNGLDELETEPROGRAMPIPELINESEXTPROC) get_proc("glDeleteProgramPipelinesEXT"); - gles3wGenProgramPipelinesEXT = (PFNGLGENPROGRAMPIPELINESEXTPROC) get_proc("glGenProgramPipelinesEXT"); - gles3wIsProgramPipelineEXT = (PFNGLISPROGRAMPIPELINEEXTPROC) get_proc("glIsProgramPipelineEXT"); - gles3wProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC) get_proc("glProgramParameteriEXT"); - gles3wGetProgramPipelineivEXT = (PFNGLGETPROGRAMPIPELINEIVEXTPROC) get_proc("glGetProgramPipelineivEXT"); - gles3wProgramUniform1iEXT = (PFNGLPROGRAMUNIFORM1IEXTPROC) get_proc("glProgramUniform1iEXT"); - gles3wProgramUniform2iEXT = (PFNGLPROGRAMUNIFORM2IEXTPROC) get_proc("glProgramUniform2iEXT"); - gles3wProgramUniform3iEXT = (PFNGLPROGRAMUNIFORM3IEXTPROC) get_proc("glProgramUniform3iEXT"); - gles3wProgramUniform4iEXT = (PFNGLPROGRAMUNIFORM4IEXTPROC) get_proc("glProgramUniform4iEXT"); - gles3wProgramUniform1fEXT = (PFNGLPROGRAMUNIFORM1FEXTPROC) get_proc("glProgramUniform1fEXT"); - gles3wProgramUniform2fEXT = (PFNGLPROGRAMUNIFORM2FEXTPROC) get_proc("glProgramUniform2fEXT"); - gles3wProgramUniform3fEXT = (PFNGLPROGRAMUNIFORM3FEXTPROC) get_proc("glProgramUniform3fEXT"); - gles3wProgramUniform4fEXT = (PFNGLPROGRAMUNIFORM4FEXTPROC) get_proc("glProgramUniform4fEXT"); - gles3wProgramUniform1ivEXT = (PFNGLPROGRAMUNIFORM1IVEXTPROC) get_proc("glProgramUniform1ivEXT"); - gles3wProgramUniform2ivEXT = (PFNGLPROGRAMUNIFORM2IVEXTPROC) get_proc("glProgramUniform2ivEXT"); - gles3wProgramUniform3ivEXT = (PFNGLPROGRAMUNIFORM3IVEXTPROC) get_proc("glProgramUniform3ivEXT"); - gles3wProgramUniform4ivEXT = (PFNGLPROGRAMUNIFORM4IVEXTPROC) get_proc("glProgramUniform4ivEXT"); - gles3wProgramUniform1fvEXT = (PFNGLPROGRAMUNIFORM1FVEXTPROC) get_proc("glProgramUniform1fvEXT"); - gles3wProgramUniform2fvEXT = (PFNGLPROGRAMUNIFORM2FVEXTPROC) get_proc("glProgramUniform2fvEXT"); - gles3wProgramUniform3fvEXT = (PFNGLPROGRAMUNIFORM3FVEXTPROC) get_proc("glProgramUniform3fvEXT"); - gles3wProgramUniform4fvEXT = (PFNGLPROGRAMUNIFORM4FVEXTPROC) get_proc("glProgramUniform4fvEXT"); - gles3wProgramUniformMatrix2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) get_proc("glProgramUniformMatrix2fvEXT"); - gles3wProgramUniformMatrix3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) get_proc("glProgramUniformMatrix3fvEXT"); - gles3wProgramUniformMatrix4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) get_proc("glProgramUniformMatrix4fvEXT"); - gles3wProgramUniformMatrix2x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) get_proc("glProgramUniformMatrix2x3fvEXT"); - gles3wProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) get_proc("glProgramUniformMatrix3x2fvEXT"); - gles3wProgramUniformMatrix2x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) get_proc("glProgramUniformMatrix2x4fvEXT"); - gles3wProgramUniformMatrix4x2fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) get_proc("glProgramUniformMatrix4x2fvEXT"); - gles3wProgramUniformMatrix3x4fvEXT = (PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) get_proc("glProgramUniformMatrix3x4fvEXT"); - gles3wProgramUniformMatrix4x3fvEXT = (PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) get_proc("glProgramUniformMatrix4x3fvEXT"); - gles3wValidateProgramPipelineEXT = (PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) get_proc("glValidateProgramPipelineEXT"); - gles3wGetProgramPipelineInfoLogEXT = (PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) get_proc("glGetProgramPipelineInfoLogEXT"); - - gles3wDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC)get_proc("glDebugMessageControlKHR"); - gles3wDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)get_proc("glDebugMessageCallbackKHR"); - gles3wFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)get_proc("glFramebufferTexture2DMultisampleEXT"); - gles3wFramebufferTexture2DMultisampleIMG = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC)get_proc("glFramebufferTexture2DMultisampleIMG"); -} diff --git a/native/cocos/renderer/gfx-metal/CMakeLists.txt b/native/cocos/renderer/gfx-metal/CMakeLists.txt deleted file mode 100644 index ba33740d23..0000000000 --- a/native/cocos/renderer/gfx-metal/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -set(TARGET_NAME GFXMetal) - -message(STATUS "Target: ${TARGET_NAME}...") - -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_SRC_PATH}/base - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-metal -) - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) -file(GLOB_RECURSE SOURCE_OBJC_FILES *.m *.mm) -set(ALL_FILES ${HEADER_FILES} ${SOURCE_CPP_FILES} ${SOURCE_C_FILES} ${SOURCE_OBJC_FILES}) - -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) -endif() - -target_compile_definitions(${TARGET_NAME} PRIVATE CC_USE_METAL) -find_library(COREFOUNDATION_FRAMEWORK CoreFoundation) -find_library(FOUNDATION_FRAMEWORK Foundation) -find_library(METAL_LIBRARY Metal) -find_library(METALKIT_LIBRARY MetalKit) -set(glslang_libs_name glslang OGLCompiler OSDependent SPIRV glslang-default-resource-limits) -set(spirv-cross_libs_name spirv-cross-core spirv-cross-glsl spirv-cross-msl) -target_link_libraries(${TARGET_NAME} Core ${COREFOUNDATION_FRAMEWORK} ${FOUNDATION_FRAMEWORK} ${METAL_LIBRARY} ${METALKIT_LIBRARY} ${glslang_libs_name} ${spirv-cross_libs_name}) - -target_include_directories(${TARGET_NAME} PUBLIC ${COCOS_EXTERNAL_PATH}/mac/include) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXMetal) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXMetal_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/MTLStd.h" "${CMAKE_CURRENT_SOURCE_DIR}/MTLStd.cpp" ${SOURCE_CPP_FILES} ${SOURCE_OBJC_FILES} ${SOURCE_C_FILES}) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-metal/GFXMTL.h b/native/cocos/renderer/gfx-metal/GFXMTL.h index 5c543809fd..694fca2079 100644 --- a/native/cocos/renderer/gfx-metal/GFXMTL.h +++ b/native/cocos/renderer/gfx-metal/GFXMTL.h @@ -1,27 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "MTLStd.h" -#include "MTLDevice.h" \ No newline at end of file +#include "MTLDevice.h" diff --git a/native/cocos/renderer/gfx-metal/MTLBuffer.h b/native/cocos/renderer/gfx-metal/MTLBuffer.h index 29ab09caff..da3c18cf60 100644 --- a/native/cocos/renderer/gfx-metal/MTLBuffer.h +++ b/native/cocos/renderer/gfx-metal/MTLBuffer.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXBuffer.h" + #import #import #import @@ -31,33 +35,34 @@ namespace cc { namespace gfx { class CCMTLBuffer; -class CCMTLRenderCommandEncoder; +class CCMTLCommandEncoder; class CCMTLBuffer final : public Buffer { public: - explicit CCMTLBuffer(Device *device); + explicit CCMTLBuffer(); ~CCMTLBuffer() override = default; CCMTLBuffer(const CCMTLBuffer &) = delete; CCMTLBuffer(CCMTLBuffer &&) = delete; CCMTLBuffer &operator=(const CCMTLBuffer &) = default; CCMTLBuffer &operator=(CCMTLBuffer &&) = delete; - bool initialize(const BufferInfo &info) override; - bool initialize(const BufferViewInfo &info) override; - void destroy() override; - void resize(uint size) override; - void update(void *buffer, uint offset) override; + void update(const void *buffer, uint offset) override; - void encodeBuffer(CCMTLRenderCommandEncoder &encoder, uint offset, uint binding, ShaderStageFlags stages); + void encodeBuffer(CCMTLCommandEncoder &encoder, uint offset, uint binding, ShaderStageFlags stages); CC_INLINE id getMTLBuffer() const { return _mtlBuffer; } CC_INLINE MTLIndexType getIndexType() const { return _indexType; } CC_INLINE bool isDrawIndirectByIndex() const { return _isDrawIndirectByIndex; } CC_INLINE const DrawInfoList &getDrawInfos() const { return _drawInfos; } -private: +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doDestroy() override; + void doResize(uint size, uint count) override; + bool createMTLBuffer(uint size, MemoryUsage usage); - void updateMTLBuffer(void *buffer, uint offset, uint size); + void updateMTLBuffer(const void *buffer, uint offset, uint size); id _mtlBuffer = nullptr; MTLIndexType _indexType = MTLIndexTypeUInt16; @@ -66,8 +71,8 @@ private: uint _bufferViewOffset = 0; bool _isDrawIndirectByIndex = false; - std::vector _indexedPrimitivesIndirectArguments; - std::vector _primitiveIndirectArguments; + vector _indexedPrimitivesIndirectArguments; + vector _primitiveIndirectArguments; DrawInfoList _drawInfos; }; diff --git a/native/cocos/renderer/gfx-metal/MTLBuffer.mm b/native/cocos/renderer/gfx-metal/MTLBuffer.mm index 3bf8533bc1..b349b51483 100644 --- a/native/cocos/renderer/gfx-metal/MTLBuffer.mm +++ b/native/cocos/renderer/gfx-metal/MTLBuffer.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #import @@ -35,18 +37,12 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLBuffer::CCMTLBuffer(Device *device) : Buffer(device) { +CCMTLBuffer::CCMTLBuffer() : Buffer() { } -bool CCMTLBuffer::initialize(const BufferInfo &info) { - _usage = info.usage; - _memUsage = info.memUsage; - _size = info.size; - _stride = std::max(info.stride, 1U); - _count = _size / _stride; - _flags = info.flags; - _isIndirectDrawSupported = static_cast(_device)->isIndirectDrawSupported(); - if (_usage & BufferUsage::INDEX) { +void CCMTLBuffer::doInit(const BufferInfo &info) { + _isIndirectDrawSupported = CCMTLDevice::getInstance()->isIndirectDrawSupported(); + if (hasFlag(_usage, BufferUsage::INDEX)) { switch (_stride) { case 4: _indexType = MTLIndexTypeUInt32; break; case 2: _indexType = MTLIndexTypeUInt16; break; @@ -56,11 +52,11 @@ bool CCMTLBuffer::initialize(const BufferInfo &info) { } } - if (_usage & BufferUsageBit::VERTEX || - _usage & BufferUsageBit::UNIFORM || - _usage & BufferUsageBit::INDEX) { + if (hasFlag(_usage, BufferUsageBit::VERTEX) || + hasFlag(_usage, BufferUsageBit::UNIFORM) || + hasFlag(_usage, BufferUsageBit::INDEX)) { createMTLBuffer(_size, _memUsage); - } else if (_usage & BufferUsageBit::INDIRECT) { + } else if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { if (_isIndirectDrawSupported) { createMTLBuffer(_size, _memUsage); _primitiveIndirectArguments.resize(_count); @@ -69,47 +65,39 @@ bool CCMTLBuffer::initialize(const BufferInfo &info) { _drawInfos.resize(_count); } } - - return true; } -bool CCMTLBuffer::initialize(const BufferViewInfo &info) { +void CCMTLBuffer::doInit(const BufferViewInfo &info) { *this = *static_cast(info.buffer); _bufferViewOffset = info.offset; _isBufferView = true; - return true; } bool CCMTLBuffer::createMTLBuffer(uint size, MemoryUsage usage) { _mtlResourceOptions = mu::toMTLResourceOption(usage); if (_mtlBuffer) { - Device *device = _device; + Device *device = CCMTLDevice::getInstance(); id mtlBuffer = _mtlBuffer; - uint oldSize = [_mtlBuffer length]; std::function destroyFunc = [=]() { if (mtlBuffer) { [mtlBuffer release]; - device->getMemoryStatus().bufferSize -= oldSize; } }; //gpu object only CCMTLGPUGarbageCollectionPool::getInstance()->collect(destroyFunc); } - id mtlDevice = id(static_cast(_device)->getMTLDevice()); + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); _mtlBuffer = [mtlDevice newBufferWithLength:size options:_mtlResourceOptions]; if (_mtlBuffer == nil) { return false; } - - _device->getMemoryStatus().bufferSize += size; - return true; } -void CCMTLBuffer::destroy() { +void CCMTLBuffer::doDestroy() { if (_isBufferView) { return; } @@ -126,7 +114,7 @@ void CCMTLBuffer::destroy() { _drawInfos.clear(); } - Device *device = _device; + Device *device = CCMTLDevice::getInstance(); id mtlBuffer = _mtlBuffer; _mtlBuffer = nil; uint size = _size; @@ -134,33 +122,22 @@ void CCMTLBuffer::destroy() { std::function destroyFunc = [=]() { if (mtlBuffer) { [mtlBuffer release]; - device->getMemoryStatus().bufferSize -= size; } }; //gpu object only CCMTLGPUGarbageCollectionPool::getInstance()->collect(destroyFunc); } -void CCMTLBuffer::resize(uint size) { - if (_isBufferView) { - CC_LOG_WARNING("Cannot resize a buffer view."); - return; - } - - if (_size == size) { - return; - } - - if (_usage & BufferUsageBit::VERTEX || - _usage & BufferUsageBit::INDEX || - _usage & BufferUsageBit::UNIFORM) { +void CCMTLBuffer::doResize(uint size, uint count) { + if (hasFlag(_usage, BufferUsageBit::VERTEX) || + hasFlag(_usage, BufferUsageBit::INDEX) || + hasFlag(_usage, BufferUsageBit::UNIFORM)) { createMTLBuffer(size, _memUsage); } - const uint oldSize = _size; _size = size; - _count = _size / _stride; - if (_usage & BufferUsageBit::INDIRECT) { + _count = count; + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { if (_isIndirectDrawSupported) { createMTLBuffer(size, _memUsage); _primitiveIndirectArguments.resize(_count); @@ -171,12 +148,12 @@ void CCMTLBuffer::resize(uint size) { } } -void CCMTLBuffer::update(void *buffer, uint size) { +void CCMTLBuffer::update(const void *buffer, uint size) { if (_isBufferView) { CC_LOG_WARNING("Cannot update a buffer view."); return; } - + uint drawInfoCount = size / _stride; const auto *drawInfo = static_cast(buffer); if (drawInfoCount > 0) { @@ -187,7 +164,7 @@ void CCMTLBuffer::update(void *buffer, uint size) { } } - if (_usage & BufferUsageBit::INDIRECT) { + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { if (_isIndirectDrawSupported) { if (drawInfoCount > 0) { if (_isDrawIndirectByIndex) { @@ -225,9 +202,9 @@ void CCMTLBuffer::update(void *buffer, uint size) { } } -void CCMTLBuffer::updateMTLBuffer(void *buffer, uint /*offset*/, uint size) { +void CCMTLBuffer::updateMTLBuffer(const void *buffer, uint /*offset*/, uint size) { if (_mtlBuffer) { - CommandBuffer *cmdBuffer = _device->getCommandBuffer(); + CommandBuffer *cmdBuffer = CCMTLDevice::getInstance()->getCommandBuffer(); cmdBuffer->begin(); static_cast(cmdBuffer)->updateBuffer(this, buffer, size); #if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) @@ -238,17 +215,24 @@ void CCMTLBuffer::updateMTLBuffer(void *buffer, uint /*offset*/, uint size) { } } -void CCMTLBuffer::encodeBuffer(CCMTLRenderCommandEncoder &encoder, uint offset, uint binding, ShaderStageFlags stages) { +void CCMTLBuffer::encodeBuffer(CCMTLCommandEncoder &encoder, uint offset, uint binding, ShaderStageFlags stages) { if (_isBufferView) { offset += _bufferViewOffset; } - if (stages & ShaderStageFlagBit::VERTEX) { - encoder.setVertexBuffer(_mtlBuffer, offset, binding); + if (hasFlag(stages, ShaderStageFlagBit::VERTEX)) { + CCMTLRenderCommandEncoder* renderEncoder = static_cast(&encoder); + renderEncoder->setVertexBuffer(_mtlBuffer, offset, binding); } - if (stages & ShaderStageFlagBit::FRAGMENT) { - encoder.setFragmentBuffer(_mtlBuffer, offset, binding); + if (hasFlag(stages, ShaderStageFlagBit::FRAGMENT)) { + CCMTLRenderCommandEncoder* renderEncoder = static_cast(&encoder); + renderEncoder->setFragmentBuffer(_mtlBuffer, offset, binding); + } + + if(hasFlag(stages, ShaderStageFlagBit::COMPUTE)) { + CCMTLComputeCommandEncoder* computeEncoder = static_cast(&encoder); + computeEncoder->setBuffer(_mtlBuffer, offset, binding); } } diff --git a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h index cb0c906445..e79cf855a4 100644 --- a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h +++ b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.h @@ -1,30 +1,35 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXCommandBuffer.h" + #include "MTLGPUObjects.h" #include "MTLRenderCommandEncoder.h" +#include "MTLComputeCommandEncoder.h" #import #import @@ -38,21 +43,17 @@ class CCMTLRenderPass; class CCMTLFence; class CCMTLCommandBuffer final : public CommandBuffer { - friend class CCMTLQueue; - public: - explicit CCMTLCommandBuffer(Device *device); + explicit CCMTLCommandBuffer(); ~CCMTLCommandBuffer() override = default; CCMTLCommandBuffer(const CCMTLCommandBuffer &) = delete; CCMTLCommandBuffer(CCMTLCommandBuffer &&) = delete; CCMTLCommandBuffer &operator=(const CCMTLCommandBuffer &) = delete; CCMTLCommandBuffer &operator=(CCMTLCommandBuffer &&) = delete; - bool initialize(const CommandBufferInfo &info) override; - void destroy() override; - void begin(RenderPass *renderPass, uint subPass, Framebuffer *frameBuffer, int submitIndex) override; + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; void end() override; - void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; void endRenderPass() override; void bindPipelineState(PipelineState *pso) override; void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; @@ -65,14 +66,24 @@ public: void setDepthBound(float minBounds, float maxBounds) override; void setStencilWriteMask(StencilFace face, uint mask) override; void setStencilCompareMask(StencilFace face, int ref, uint mask) override; - void draw(InputAssembler *ia) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; void updateBuffer(Buffer *buff, const void *data, uint size) override; void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; - void execute(const CommandBuffer *const *cmdBuffs, uint32_t count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; + CC_INLINE bool isCommandBufferBegan() const { return _commandBufferBegan; } CC_INLINE id getMTLCommandBuffer() const { return _mtlCommandBuffer; } -private: +protected: + friend class CCMTLQueue; + + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; + void bindDescriptorSets(); static bool isRenderingEntireDrawable(const Rect &rect, const CCMTLRenderPass *renderPass); @@ -84,14 +95,15 @@ private: bool _indirectDrawSuppotred = false; bool _commandBufferBegan = false; + bool _isSecondary = false; + NSAutoreleasePool *_autoreleasePool = nullptr; CCMTLDevice *_mtlDevice = nullptr; -// id _currDrawable = nil; id _mtlCommandQueue = nil; id _mtlCommandBuffer = nil; - MTKView *_mtkView = nil; - CCMTLRenderCommandEncoder _commandEncoder; + CCMTLRenderCommandEncoder _renderEncoder; + CCMTLComputeCommandEncoder _computeEncoder; + id _parallelEncoder = nil; CCMTLInputAssembler *_inputAssembler = nullptr; - MTLIndexType _indexType = MTLIndexTypeUInt16; MTLPrimitiveType _mtlPrimitiveType = MTLPrimitiveType::MTLPrimitiveTypeTriangle; }; diff --git a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm index e19161fb5f..612650e8d5 100644 --- a/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm +++ b/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLBuffer.h" @@ -33,38 +35,62 @@ THE SOFTWARE. #include "MTLRenderPass.h" #include "MTLSampler.h" #include "MTLTexture.h" +#include namespace cc { namespace gfx { -CCMTLCommandBuffer::CCMTLCommandBuffer(Device *device) -: CommandBuffer(device), - _mtlDevice(static_cast(device)), - _mtlCommandQueue(id((static_cast(device))->getMTLCommandQueue())), - _mtkView(static_cast((static_cast(device)->getMTKView()))), - _indirectDrawSuppotred(static_cast(device)->isIndirectDrawSupported()) { - const auto setCount = device->bindingMappingInfo().bufferOffsets.size(); +CCMTLCommandBuffer::CCMTLCommandBuffer() +: CommandBuffer(), + _mtlDevice(CCMTLDevice::getInstance()) { + _mtlCommandQueue = id(_mtlDevice->getMTLCommandQueue()); + _indirectDrawSuppotred = _mtlDevice->isIndirectDrawSupported(); + + const auto setCount = _mtlDevice->bindingMappingInfo().bufferOffsets.size(); _GPUDescriptorSets.resize(setCount); _dynamicOffsets.resize(setCount); + _indirectDrawSuppotred = _mtlDevice->isIndirectDrawSupported(); } -bool CCMTLCommandBuffer::initialize(const CommandBufferInfo &info) { - _type = info.type; - _queue = info.queue; - return true; +void CCMTLCommandBuffer::doInit(const CommandBufferInfo &info) { } -void CCMTLCommandBuffer::destroy() { +void CCMTLCommandBuffer::doDestroy() { + if (_autoreleasePool) { + [_autoreleasePool release]; + _autoreleasePool = nullptr; + } } -void CCMTLCommandBuffer::begin(RenderPass * /*renderPass*/, uint /*subPass*/, Framebuffer * /*frameBuffer*/, int /*submitIndex*/) { +bool CCMTLCommandBuffer::isRenderingEntireDrawable(const Rect &rect, const CCMTLRenderPass *renderPass) { + const int num = renderPass->getColorRenderTargetNums(); + if (num == 0) { + return true; + } + const auto &renderTargetSize = renderPass->getRenderTargetSizes()[0]; + return rect.x == 0 && rect.y == 0 && rect.width == renderTargetSize.x && rect.height == renderTargetSize.y; +} + +void CCMTLCommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) { if (_commandBufferBegan) { return; } - _mtlCommandBuffer = [_mtlCommandQueue commandBuffer]; - [_mtlCommandBuffer retain]; - [_mtlCommandBuffer enqueue]; + _isSecondary = renderPass != nullptr && _mtlCommandBuffer; + if (!_isSecondary) { + // Only primary command buffer should request command buffer explicitly + _mtlCommandBuffer = [[_mtlCommandQueue commandBuffer] retain]; + [_mtlCommandBuffer enqueue]; + } + else { + // Secondary command buffer is likely to be recorded in a separated thread + if (_autoreleasePool) { + [_autoreleasePool drain]; + _autoreleasePool = nil; + } + _autoreleasePool = [[NSAutoreleasePool alloc] init]; + // CC_LOG_INFO("%d CB POOL: %p ALLOCED for %p", [NSThread currentThread], _autoreleasePool, this); + } _numTriangles = 0; _numDrawCalls = 0; _numInstances = 0; @@ -83,22 +109,32 @@ void CCMTLCommandBuffer::end() { } _commandBufferBegan = false; -} -bool CCMTLCommandBuffer::isRenderingEntireDrawable(const Rect &rect, const CCMTLRenderPass *renderPass) { - const int num = renderPass->getColorRenderTargetNums(); - if (num == 0) { - return true; + if (_isSecondary) { + // Secondary command buffer should end encoding here + _renderEncoder.endEncoding(); + + if (_autoreleasePool) { + // CC_LOG_INFO("%d CB POOL: %p RELEASED for %p", [NSThread currentThread], _autoreleasePool, this); + [_autoreleasePool drain]; + _autoreleasePool = nullptr; + } } - const auto &renderTargetSize = renderPass->getRenderTargetSizes()[0]; - return rect.x == 0 && rect.y == 0 && rect.width == renderTargetSize.x && rect.height == renderTargetSize.y; } -void CCMTLCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool /*fromSecondaryCB*/) { +void CCMTLCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) { + // Sub CommandBuffer shouldn't call begin render pass + if (_isSecondary) + { + return; + } + auto isOffscreen = static_cast(fbo)->isOffscreen(); if (!isOffscreen) { - static_cast(renderPass)->setColorAttachment(0, _mtkView.currentDrawable.texture, 0); - static_cast(renderPass)->setDepthStencilAttachment(_mtkView.depthStencilTexture, 0); + id drawable = (id)_mtlDevice->getCurrentDrawable(); + id dssTex = (id)_mtlDevice->getDSSTexture(); + static_cast(renderPass)->setColorAttachment(0, drawable.texture, 0); + static_cast(renderPass)->setDepthStencilAttachment(dssTex, 0); } MTLRenderPassDescriptor *mtlRenderPassDescriptor = static_cast(renderPass)->getMTLRenderPassDescriptor(); if (!isRenderingEntireDrawable(renderArea, static_cast(renderPass))) { @@ -118,28 +154,55 @@ void CCMTLCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fb mtlRenderPassDescriptor.stencilAttachment.clearStencil = stencil; } - _commandEncoder.initialize(_mtlCommandBuffer, mtlRenderPassDescriptor); - _commandEncoder.setViewport(renderArea); - _commandEncoder.setScissor(renderArea); + if (secondaryCBCount > 0) { + _parallelEncoder = [[_mtlCommandBuffer parallelRenderCommandEncoderWithDescriptor:mtlRenderPassDescriptor] retain]; + // Create command encoders from parallel encoder and assign to command buffers + for (uint i = 0u; i < secondaryCBCount; ++i) { + CCMTLCommandBuffer *cmdBuff = (CCMTLCommandBuffer *)secondaryCBs[i]; + cmdBuff->_renderEncoder.initialize(_parallelEncoder); + cmdBuff->_mtlCommandBuffer = _mtlCommandBuffer; + } + } + else { + _renderEncoder.initialize(_mtlCommandBuffer, mtlRenderPassDescriptor); + } + _renderEncoder.setViewport(renderArea); + _renderEncoder.setScissor(renderArea); } void CCMTLCommandBuffer::endRenderPass() { - _commandEncoder.endEncoding(); + if (_parallelEncoder) { + [_parallelEncoder endEncoding]; + [_parallelEncoder release]; + _parallelEncoder = nil; + } + else { + _renderEncoder.endEncoding(); + } } void CCMTLCommandBuffer::bindPipelineState(PipelineState *pso) { - _gpuPipelineState = static_cast(pso)->getGPUPipelineState(); - _mtlPrimitiveType = _gpuPipelineState->primitiveType; + PipelineBindPoint bindPoint = pso->getBindPoint(); + if (bindPoint == PipelineBindPoint::GRAPHICS) { + _gpuPipelineState = static_cast(pso)->getGPUPipelineState(); + _mtlPrimitiveType = _gpuPipelineState->primitiveType; - _commandEncoder.setCullMode(_gpuPipelineState->cullMode); - _commandEncoder.setFrontFacingWinding(_gpuPipelineState->winding); - _commandEncoder.setDepthClipMode(_gpuPipelineState->depthClipMode); - _commandEncoder.setTriangleFillMode(_gpuPipelineState->fillMode); - _commandEncoder.setRenderPipelineState(_gpuPipelineState->mtlRenderPipelineState); + _renderEncoder.setCullMode(_gpuPipelineState->cullMode); + _renderEncoder.setFrontFacingWinding(_gpuPipelineState->winding); + _renderEncoder.setDepthClipMode(_gpuPipelineState->depthClipMode); + _renderEncoder.setTriangleFillMode(_gpuPipelineState->fillMode); + _renderEncoder.setRenderPipelineState(_gpuPipelineState->mtlRenderPipelineState); - if (_gpuPipelineState->mtlDepthStencilState) { - _commandEncoder.setStencilFrontBackReferenceValue(_gpuPipelineState->stencilRefFront, _gpuPipelineState->stencilRefBack); - _commandEncoder.setDepthStencilState(_gpuPipelineState->mtlDepthStencilState); + if (_gpuPipelineState->mtlDepthStencilState) { + _renderEncoder.setStencilFrontBackReferenceValue(_gpuPipelineState->stencilRefFront, _gpuPipelineState->stencilRefBack); + _renderEncoder.setDepthStencilState(_gpuPipelineState->mtlDepthStencilState); + } + } else if (bindPoint == PipelineBindPoint::COMPUTE) { + if (!_computeEncoder.isInitialized()) { + _computeEncoder.initialize(_mtlCommandBuffer); + } + _gpuPipelineState = static_cast(pso)->getGPUPipelineState(); + _computeEncoder.setComputePipelineState(_gpuPipelineState->mtlComputePipelineState); } } @@ -168,11 +231,11 @@ void CCMTLCommandBuffer::bindInputAssembler(InputAssembler *ia) { } void CCMTLCommandBuffer::setViewport(const Viewport &vp) { - _commandEncoder.setViewport(vp); + _renderEncoder.setViewport(vp); } void CCMTLCommandBuffer::setScissor(const Rect &rect) { - _commandEncoder.setScissor(rect); + _renderEncoder.setScissor(rect); } void CCMTLCommandBuffer::setLineWidth(float /*width*/) { @@ -180,11 +243,11 @@ void CCMTLCommandBuffer::setLineWidth(float /*width*/) { } void CCMTLCommandBuffer::setDepthBias(float constant, float clamp, float slope) { - _commandEncoder.setDepthBias(constant, clamp, slope); + _renderEncoder.setDepthBias(constant, clamp, slope); } void CCMTLCommandBuffer::setBlendConstants(const Color &constants) { - _commandEncoder.setBlendColor(constants); + _renderEncoder.setBlendColor(constants); } void CCMTLCommandBuffer::setDepthBound(float /*minBounds*/, float /*maxBounds*/) { @@ -199,124 +262,119 @@ void CCMTLCommandBuffer::setStencilCompareMask(StencilFace /*face*/, int /*ref*/ CC_LOG_ERROR("Don't support change stencil compare mask here."); } -void CCMTLCommandBuffer::draw(InputAssembler *ia) { +void CCMTLCommandBuffer::nextSubpass() { +} + +void CCMTLCommandBuffer::draw(const DrawInfo &info) { if (_firstDirtyDescriptorSet < _GPUDescriptorSets.size()) { bindDescriptorSets(); } - const auto *indirectBuffer = static_cast(ia->getIndirectBuffer()); - const auto *indexBuffer = static_cast(ia->getIndexBuffer()); - auto mtlEncoder = _commandEncoder.getMTLEncoder(); + const auto *indirectBuffer = static_cast(_inputAssembler->getIndirectBuffer()); + const auto *indexBuffer = static_cast(_inputAssembler->getIndexBuffer()); + auto mtlEncoder = _renderEncoder.getMTLEncoder(); - if (_type == CommandBufferType::PRIMARY) { - if (indirectBuffer) { - const auto indirectMTLBuffer = indirectBuffer->getMTLBuffer(); + if (indirectBuffer) { + const auto indirectMTLBuffer = indirectBuffer->getMTLBuffer(); - if (_indirectDrawSuppotred) { - ++_numDrawCalls; - if (indirectBuffer->isDrawIndirectByIndex()) { - [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType - indexType:_indexType - indexBuffer:indexBuffer->getMTLBuffer() - indexBufferOffset:0 - indirectBuffer:indirectMTLBuffer - indirectBufferOffset:0]; - } else { - [mtlEncoder drawPrimitives:_mtlPrimitiveType - indirectBuffer:indirectMTLBuffer - indirectBufferOffset:0]; - } + if (_indirectDrawSuppotred) { + ++_numDrawCalls; + if (indirectBuffer->isDrawIndirectByIndex()) { + [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType + indexType:indexBuffer->getIndexType() + indexBuffer:indexBuffer->getMTLBuffer() + indexBufferOffset:0 + indirectBuffer:indirectMTLBuffer + indirectBufferOffset:0]; } else { - uint stride = indirectBuffer->getStride(); - uint offset = 0; - uint drawInfoCount = indirectBuffer->getCount(); - const auto &drawInfos = indirectBuffer->getDrawInfos(); - _numDrawCalls += drawInfoCount; + [mtlEncoder drawPrimitives:_mtlPrimitiveType + indirectBuffer:indirectMTLBuffer + indirectBufferOffset:0]; + } + } else { + uint stride = indirectBuffer->getStride(); + uint offset = 0; + uint drawInfoCount = indirectBuffer->getCount(); + const auto &drawInfos = indirectBuffer->getDrawInfos(); + _numDrawCalls += drawInfoCount; - for (uint i = 0; i < drawInfoCount; ++i) { - const auto &drawInfo = drawInfos[i]; - offset += drawInfo.firstIndex * stride; - if (indirectBuffer->isDrawIndirectByIndex()) { - if (drawInfo.instanceCount == 0) { - [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType - indexCount:drawInfo.indexCount - indexType:_indexType - indexBuffer:indexBuffer->getMTLBuffer() - indexBufferOffset:offset]; - } else { - [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType - indexCount:drawInfo.indexCount - indexType:_indexType - indexBuffer:indexBuffer->getMTLBuffer() - indexBufferOffset:offset - instanceCount:drawInfo.instanceCount]; - } + for (uint i = 0; i < drawInfoCount; ++i) { + const auto &drawInfo = drawInfos[i]; + offset += drawInfo.firstIndex * stride; + if (indirectBuffer->isDrawIndirectByIndex()) { + if (drawInfo.instanceCount == 0) { + [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType + indexCount:drawInfo.indexCount + indexType:indexBuffer->getIndexType() + indexBuffer:indexBuffer->getMTLBuffer() + indexBufferOffset:offset]; } else { - if (drawInfo.instanceCount == 0) { - [mtlEncoder drawPrimitives:_mtlPrimitiveType - vertexStart:drawInfo.firstIndex - vertexCount:drawInfo.vertexCount]; - } else { - [mtlEncoder drawPrimitives:_mtlPrimitiveType - vertexStart:drawInfo.firstIndex - vertexCount:drawInfo.vertexCount - instanceCount:drawInfo.instanceCount]; - } + [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType + indexCount:drawInfo.indexCount + indexType:indexBuffer->getIndexType() + indexBuffer:indexBuffer->getMTLBuffer() + indexBufferOffset:offset + instanceCount:drawInfo.instanceCount]; + } + } else { + if (drawInfo.instanceCount == 0) { + [mtlEncoder drawPrimitives:_mtlPrimitiveType + vertexStart:drawInfo.firstIndex + vertexCount:drawInfo.vertexCount]; + } else { + [mtlEncoder drawPrimitives:_mtlPrimitiveType + vertexStart:drawInfo.firstIndex + vertexCount:drawInfo.vertexCount + instanceCount:drawInfo.instanceCount]; } } } - } else { - DrawInfo drawInfo; - static_cast(ia)->extractDrawInfo(drawInfo); - if (drawInfo.indexCount > 0) { - uint offset = 0; - offset += drawInfo.firstIndex * indexBuffer->getStride(); - if (drawInfo.instanceCount == 0) { - [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType - indexCount:drawInfo.indexCount - indexType:_indexType - indexBuffer:indexBuffer->getMTLBuffer() - indexBufferOffset:offset]; - } else { - [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType - indexCount:drawInfo.indexCount - indexType:_indexType - indexBuffer:indexBuffer->getMTLBuffer() - indexBufferOffset:offset - instanceCount:drawInfo.instanceCount]; - } - } else if (drawInfo.vertexCount) { - if (drawInfo.instanceCount == 0) { - [mtlEncoder drawPrimitives:_mtlPrimitiveType - vertexStart:drawInfo.firstIndex - vertexCount:drawInfo.vertexCount]; - } else { - [mtlEncoder drawPrimitives:_mtlPrimitiveType - vertexStart:drawInfo.firstIndex - vertexCount:drawInfo.vertexCount - instanceCount:drawInfo.instanceCount]; - } + } + } else { + if (info.indexCount > 0) { + uint offset = 0; + offset += info.firstIndex * indexBuffer->getStride(); + if (info.instanceCount == 0) { + [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType + indexCount:info.indexCount + indexType:indexBuffer->getIndexType() + indexBuffer:indexBuffer->getMTLBuffer() + indexBufferOffset:offset]; + } else { + [mtlEncoder drawIndexedPrimitives:_mtlPrimitiveType + indexCount:info.indexCount + indexType:indexBuffer->getIndexType() + indexBuffer:indexBuffer->getMTLBuffer() + indexBufferOffset:offset + instanceCount:info.instanceCount]; } - _numInstances += drawInfo.instanceCount; - _numDrawCalls++; - if (_gpuPipelineState) { - uint indexCount = drawInfo.indexCount ? drawInfo.indexCount : drawInfo.vertexCount; - switch (_mtlPrimitiveType) { - case MTLPrimitiveTypeTriangle: - _numTriangles += indexCount / 3 * std::max(drawInfo.instanceCount, 1U); - break; - case MTLPrimitiveTypeTriangleStrip: - _numTriangles += (indexCount - 2) * std::max(drawInfo.instanceCount, 1U); - break; - default: break; - } + } else if (info.vertexCount) { + if (info.instanceCount == 0) { + [mtlEncoder drawPrimitives:_mtlPrimitiveType + vertexStart:info.firstIndex + vertexCount:info.vertexCount]; + } else { + [mtlEncoder drawPrimitives:_mtlPrimitiveType + vertexStart:info.firstIndex + vertexCount:info.vertexCount + instanceCount:info.instanceCount]; } } - } else if (_type == CommandBufferType::SECONDARY) { - CC_LOG_ERROR("CommandBufferType::SECONDARY not implemented."); - } else { - CC_LOG_ERROR("Command 'draw' must be recorded inside a render pass."); + _numInstances += info.instanceCount; + _numDrawCalls++; + if (_gpuPipelineState) { + uint indexCount = info.indexCount ? info.indexCount : info.vertexCount; + switch (_mtlPrimitiveType) { + case MTLPrimitiveTypeTriangle: + _numTriangles += indexCount / 3 * std::max(info.instanceCount, 1U); + break; + case MTLPrimitiveTypeTriangleStrip: + _numTriangles += (indexCount - 2) * std::max(info.instanceCount, 1U); + break; + default: break; + } + } } } @@ -358,7 +416,7 @@ void CCMTLCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Tex auto h = region.buffTexHeight > 0 ? region.buffTexHeight : region.texExtent.height; bufferSize[i] = w * h; stagingRegion.sourceBytesPerRow = mu::getBytesPerRow(convertedFormat, w); - stagingRegion.sourceBytesPerImage = FormatSize(convertedFormat, w, h, region.texExtent.depth); + stagingRegion.sourceBytesPerImage = formatSize(convertedFormat, w, h, region.texExtent.depth); stagingRegion.sourceSize = {w, h, region.texExtent.depth}; stagingRegion.destinationSlice = region.texSubres.baseArrayLayer; stagingRegion.destinationLevel = region.texSubres.mipLevel; @@ -392,13 +450,13 @@ void CCMTLCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Tex CC_FREE(convertedData); } } - if (texture->getFlags() & TextureFlags::GEN_MIPMAP && mu::pixelFormatIsColorRenderable(convertedFormat)) { + if (hasFlag(texture->getFlags(), TextureFlags::GEN_MIPMAP) && mu::pixelFormatIsColorRenderable(convertedFormat)) { [encoder generateMipmapsForTexture:dstTexture]; } [encoder endEncoding]; } -void CCMTLCommandBuffer::execute(const CommandBuffer *const *commandBuffs, uint32_t count) { +void CCMTLCommandBuffer::execute(CommandBuffer *const *commandBuffs, uint32_t count) { for (uint i = 0; i < count; ++i) { const auto *commandBuffer = static_cast(commandBuffs[i]); _numDrawCalls += commandBuffer->_numDrawCalls; @@ -412,7 +470,7 @@ void CCMTLCommandBuffer::bindDescriptorSets() { for (const auto &bindingInfo : _gpuPipelineState->vertexBufferBindingInfo) { auto index = std::get<0>(bindingInfo); auto stream = std::get<1>(bindingInfo); - static_cast(vertexBuffers[stream])->encodeBuffer(_commandEncoder, 0, index, ShaderStageFlagBit::VERTEX); + static_cast(vertexBuffers[stream])->encodeBuffer(_renderEncoder, 0, index, ShaderStageFlagBit::VERTEX); } const auto &dynamicOffsetIndices = _gpuPipelineState->gpuPipelineLayout->dynamicOffsetIndices; @@ -432,15 +490,22 @@ void CCMTLCommandBuffer::bindDescriptorSets() { auto dynamicOffsetIndex = (block.binding < dynamicOffset.size()) ? dynamicOffset[block.binding] : -1; if (gpuDescriptor.buffer) { uint offset = (dynamicOffsetIndex >= 0) ? _dynamicOffsets[block.set][dynamicOffsetIndex] : 0; - gpuDescriptor.buffer->encodeBuffer(_commandEncoder, - offset, - block.mappedBinding, - block.stages); + // compute pipeline and render pipeline mutually exlusive + if(_gpuPipelineState->mtlComputePipelineState) { + gpuDescriptor.buffer->encodeBuffer(_computeEncoder, + offset, + block.mappedBinding, + block.stages); + } else { + gpuDescriptor.buffer->encodeBuffer(_renderEncoder, + offset, + block.mappedBinding, + block.stages); + } } } const auto &samplers = _gpuPipelineState->gpuShader->samplers; - auto mtlEncoder = _commandEncoder.getMTLEncoder(); for (const auto &iter : samplers) { const auto &sampler = iter.second; @@ -453,17 +518,71 @@ void CCMTLCommandBuffer::bindDescriptorSets() { continue; } - if (sampler.stages & ShaderStageFlagBit::VERTEX) { - _commandEncoder.setVertexTexture(gpuDescriptor.texture->getMTLTexture(), sampler.textureBinding); - _commandEncoder.setVertexSampler(gpuDescriptor.sampler->getMTLSamplerState(), sampler.samplerBinding); + if (hasFlag(sampler.stages, ShaderStageFlagBit::VERTEX)) { + _renderEncoder.setVertexTexture(gpuDescriptor.texture->getMTLTexture(), sampler.textureBinding); + _renderEncoder.setVertexSampler(gpuDescriptor.sampler->getMTLSamplerState(), sampler.samplerBinding); } - if (sampler.stages & ShaderStageFlagBit::FRAGMENT) { - _commandEncoder.setFragmentTexture(gpuDescriptor.texture->getMTLTexture(), sampler.textureBinding); - _commandEncoder.setFragmentSampler(gpuDescriptor.sampler->getMTLSamplerState(), sampler.samplerBinding); + if (hasFlag(sampler.stages, ShaderStageFlagBit::FRAGMENT)) { + _renderEncoder.setFragmentTexture(gpuDescriptor.texture->getMTLTexture(), sampler.textureBinding); + _renderEncoder.setFragmentSampler(gpuDescriptor.sampler->getMTLSamplerState(), sampler.samplerBinding); + } + + if(hasFlag(sampler.stages, ShaderStageFlagBit::COMPUTE)) { + _computeEncoder.setTexture(gpuDescriptor.texture->getMTLTexture(), sampler.textureBinding); } } } +void CCMTLCommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { + if(srcTexture && regions) { + id encoder = [_mtlCommandBuffer blitCommandEncoder]; + id src = static_cast(srcTexture)->getMTLTexture(); + id dst = nil; + CCMTLDevice* device = CCMTLDevice::getInstance(); + if(!dstTexture) { + id currentDrawable = (id)device->getCurrentDrawable(); + dst = [currentDrawable texture]; + } else { + dst = static_cast(dstTexture)->getMTLTexture(); + } + + if([src pixelFormat] != device->preferredPixelFormat()) { + src = [src newTextureViewWithPixelFormat:(MTLPixelFormat)device->preferredPixelFormat()]; + } + + for (uint i = 0; i < count; ++i) { + [encoder copyFromTexture:src + sourceSlice:regions[i].srcSubres.baseArrayLayer + sourceLevel:regions[i].srcSubres.mipLevel + sourceOrigin:MTLOriginMake(regions[i].srcOffset.x, regions[i].srcOffset.y, regions[i].srcOffset.z) + sourceSize:MTLSizeMake(regions[i].srcExtent.width, regions[i].srcExtent.height, regions[i].srcExtent.depth) + toTexture:dst + destinationSlice:regions[i].dstSubres.baseArrayLayer + destinationLevel:regions[i].srcSubres.mipLevel + destinationOrigin:MTLOriginMake(regions[i].dstOffset.x, regions[i].dstOffset.y, regions[i].dstOffset.z)]; + } + [encoder endEncoding]; + } +} + +void CCMTLCommandBuffer::dispatch(const DispatchInfo &info) { + if(_firstDirtyDescriptorSet < _GPUDescriptorSets.size()) { + bindDescriptorSets(); + } + MTLSize groupsPerGrid = MTLSizeMake(info.groupCountX, info.groupCountY, info.groupCountZ); + if(info.indirectBuffer) { + _computeEncoder.dispatch(((CCMTLBuffer*)info.indirectBuffer)->getMTLBuffer(), info.indirectOffset, groupsPerGrid); + } + else { + _computeEncoder.dispatch(groupsPerGrid); + } + _computeEncoder.endEncoding(); +} + +void CCMTLCommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) { + // Metal tracks non-heap resources automatically, which means no need to add a barrier same encoder. +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLCommandEncoder.h b/native/cocos/renderer/gfx-metal/MTLCommandEncoder.h new file mode 100644 index 0000000000..47b63aca80 --- /dev/null +++ b/native/cocos/renderer/gfx-metal/MTLCommandEncoder.h @@ -0,0 +1,38 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +namespace cc { +namespace gfx { + +class CCMTLCommandEncoder { +public: + CCMTLCommandEncoder() = default; + virtual ~CCMTLCommandEncoder() = default; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLComputeCommandEncoder.h b/native/cocos/renderer/gfx-metal/MTLComputeCommandEncoder.h new file mode 100644 index 0000000000..5829d5a50d --- /dev/null +++ b/native/cocos/renderer/gfx-metal/MTLComputeCommandEncoder.h @@ -0,0 +1,106 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "MTLCommandEncoder.h" +#include "MTLStd.h" +#include "MTLUtils.h" +#include "base/Macros.h" +#include "math/Math.h" +#include +#include + +namespace cc { +namespace gfx { +class CCMTLComputeCommandEncoder final : public CCMTLCommandEncoder { +public: + CCMTLComputeCommandEncoder() = default; + ~CCMTLComputeCommandEncoder() = default; + CCMTLComputeCommandEncoder(const CCMTLComputeCommandEncoder &) = delete; + CCMTLComputeCommandEncoder(CCMTLComputeCommandEncoder &&) = delete; + CCMTLComputeCommandEncoder &operator=(const CCMTLComputeCommandEncoder &) = delete; + CCMTLComputeCommandEncoder &operator=(CCMTLComputeCommandEncoder &&) = delete; + + void initialize(id commandBuffer) { + _mtlEncoder = [[commandBuffer computeCommandEncoder] retain]; + _initialized = true; + } + + CC_INLINE const bool isInitialized() { + return _initialized; + } + + CC_INLINE void setComputePipelineState(id pipelineState) { + if(_pipelineState == pipelineState) + return; + [_mtlEncoder setComputePipelineState:pipelineState]; + _pipelineState = pipelineState; + } + + CC_INLINE void setBuffer(const id buffer, uint offset, uint index) { + [_mtlEncoder setBuffer:buffer offset:offset atIndex:index]; + } + + CC_INLINE void setTexture(const id texture, uint index) { + [_mtlEncoder setTexture:texture atIndex:index]; + _resourceSize = {texture.width, texture.height, texture.depth}; + } + + CC_INLINE void dispatch(MTLSize groupsPerGrid) { + // GLSL -> SPIRV -> MSL + // GLSL shader request to specify the compute thread size, + // no such limit in Metal and have to set compute thread size explicity + NSUInteger w = _pipelineState.threadExecutionWidth; + NSUInteger h = _pipelineState.maxTotalThreadsPerThreadgroup / w; + MTLSize threadsPerThreadgroup = MTLSizeMake(w, h, 1); + [_mtlEncoder dispatchThreadgroups:groupsPerGrid threadsPerThreadgroup:threadsPerThreadgroup]; + } + + CC_INLINE void dispatch(id indirectBuffer, NSUInteger offset, MTLSize groupsPerGrid) { + [_mtlEncoder dispatchThreadgroupsWithIndirectBuffer:indirectBuffer indirectBufferOffset:offset threadsPerThreadgroup:groupsPerGrid]; + } + + CC_INLINE void endEncoding() { + [_mtlEncoder endEncoding]; + [_mtlEncoder release]; + _mtlEncoder = nil; + _pipelineState = nil; + _initialized = false; + } + + CC_INLINE id const getMTLEncoder() { + return _mtlEncoder; + } + +private: + bool _initialized = false; + MTLSize _resourceSize; + id _mtlEncoder = nil; + id _pipelineState = nil; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLConfig.h b/native/cocos/renderer/gfx-metal/MTLConfig.h index f2ab0bb9c5..2161f691e2 100644 --- a/native/cocos/renderer/gfx-metal/MTLConfig.h +++ b/native/cocos/renderer/gfx-metal/MTLConfig.h @@ -1,26 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #define MAX_FRAMES_IN_FLIGHT 3 +#define MAX_COMMAND_BUFFER_COUNT 256 diff --git a/native/cocos/renderer/gfx-metal/MTLContext.h b/native/cocos/renderer/gfx-metal/MTLContext.h index 16df30e873..dac5e3120c 100644 --- a/native/cocos/renderer/gfx-metal/MTLContext.h +++ b/native/cocos/renderer/gfx-metal/MTLContext.h @@ -1,43 +1,49 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXContext.h" + namespace cc { namespace gfx { class CCMTLContext final : public Context { public: - explicit CCMTLContext(Device *device); + explicit CCMTLContext(); ~CCMTLContext() override = default; CCMTLContext(const CCMTLContext &)=delete; CCMTLContext(CCMTLContext &&)=delete; CCMTLContext &operator=(const CCMTLContext &)=delete; CCMTLContext &operator=(CCMTLContext &&)=delete; - bool initialize(const ContextInfo &info) override; - void destroy() override {} void present() override {} + +protected: + bool doInit(const ContextInfo &info) override; + void doDestroy() override {} }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-metal/MTLContext.mm b/native/cocos/renderer/gfx-metal/MTLContext.mm index 7c167b7e48..a86dfa81a7 100644 --- a/native/cocos/renderer/gfx-metal/MTLContext.mm +++ b/native/cocos/renderer/gfx-metal/MTLContext.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLContext.h" @@ -47,16 +49,19 @@ Format toFormat(MTLPixelFormat format) { } } -CCMTLContext::CCMTLContext(Device *device) -: Context(device) { +CCMTLContext::CCMTLContext() +: Context() { } -bool CCMTLContext::initialize(const ContextInfo &info) { +bool CCMTLContext::doInit(const ContextInfo &info) { _vsyncMode = info.vsyncMode; _windowHandle = info.windowHandle; - auto *view = (MTKView *)static_cast(_device)->getMTKView(); - _colorFmt = toFormat(view.colorPixelFormat); - _depthStencilFmt = toFormat(view.depthStencilPixelFormat); + + CCMTLDevice *device = CCMTLDevice::getInstance(); + CAMetalLayer *layer = (CAMetalLayer *)device->getMTLLayer(); + _colorFmt = toFormat(layer.pixelFormat); + id dssTex = (id)device->getDSSTexture(); + _depthStencilFmt = toFormat(dssTex.pixelFormat); return true; } diff --git a/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h b/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h index dc632a12f5..c6065d9c95 100644 --- a/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h +++ b/native/cocos/renderer/gfx-metal/MTLDescriptorSet.h @@ -1,47 +1,54 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once + +#include "gfx-base/GFXDescriptorSet.h" + namespace cc { namespace gfx { + class CCMTLGPUDescriptorSet; class CCMTLDescriptorSet final : public DescriptorSet { public: - explicit CCMTLDescriptorSet(Device *device); + explicit CCMTLDescriptorSet(); ~CCMTLDescriptorSet() override = default; CCMTLDescriptorSet(const CCMTLDescriptorSet &)=delete; CCMTLDescriptorSet(CCMTLDescriptorSet &&)=delete; CCMTLDescriptorSet &operator=(const CCMTLDescriptorSet &)=delete; CCMTLDescriptorSet &operator=(CCMTLDescriptorSet &&)=delete; - bool initialize(const DescriptorSetInfo &info) override; - void destroy() override; void update() override; CC_INLINE CCMTLGPUDescriptorSet *gpuDescriptorSet() const { return _gpuDescriptorSet; } -private: +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; + CCMTLGPUDescriptorSet *_gpuDescriptorSet = nullptr; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-metal/MTLDescriptorSet.mm b/native/cocos/renderer/gfx-metal/MTLDescriptorSet.mm index cec98d58e2..6f3c021074 100644 --- a/native/cocos/renderer/gfx-metal/MTLDescriptorSet.mm +++ b/native/cocos/renderer/gfx-metal/MTLDescriptorSet.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLBuffer.h" @@ -32,50 +34,38 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLDescriptorSet::CCMTLDescriptorSet(Device *device) : DescriptorSet(device) { +CCMTLDescriptorSet::CCMTLDescriptorSet() : DescriptorSet() { } -bool CCMTLDescriptorSet::initialize(const DescriptorSetInfo &info) { - _layout = info.layout; - +void CCMTLDescriptorSet::doInit(const DescriptorSetInfo &info) { const auto gpuDescriptorSetLayout = static_cast(_layout)->gpuDescriptorSetLayout(); const auto descriptorCount = gpuDescriptorSetLayout->descriptorCount; const auto bindingCount = gpuDescriptorSetLayout->bindings.size(); - _buffers.resize(descriptorCount); - _textures.resize(descriptorCount); - _samplers.resize(descriptorCount); - _gpuDescriptorSet = CC_NEW(CCMTLGPUDescriptorSet); _gpuDescriptorSet->descriptorIndices = &gpuDescriptorSetLayout->descriptorIndices; _gpuDescriptorSet->gpuDescriptors.resize(descriptorCount); - for (auto i = 0, k = 0; i < bindingCount; i++) { + for (auto i = 0u, k = 0u; i < bindingCount; i++) { const auto &binding = gpuDescriptorSetLayout->bindings[i]; - for (auto j = 0; j < binding.count; j++, k++) { + for (auto j = 0u; j < binding.count; j++, k++) { _gpuDescriptorSet->gpuDescriptors[k].type = binding.descriptorType; } } - - return true; } -void CCMTLDescriptorSet::destroy() { - _layout = nullptr; + +void CCMTLDescriptorSet::doDestroy() { CC_SAFE_DELETE(_gpuDescriptorSet); - // do remember to clear these or else it might not be properly updated when reused - _buffers.clear(); - _textures.clear(); - _samplers.clear(); } void CCMTLDescriptorSet::update() { if (_isDirty && _gpuDescriptorSet) { const auto &descriptors = _gpuDescriptorSet->gpuDescriptors; for (size_t i = 0; i < descriptors.size(); i++) { - if (static_cast(descriptors[i].type) & DESCRIPTOR_BUFFER_TYPE) { + if (hasAnyFlags(descriptors[i].type, DESCRIPTOR_BUFFER_TYPE)) { if (_buffers[i]) { _gpuDescriptorSet->gpuDescriptors[i].buffer = static_cast(_buffers[i]); } - } else if (static_cast(descriptors[i].type) & DESCRIPTOR_SAMPLER_TYPE) { + } else if (hasAnyFlags(descriptors[i].type, DESCRIPTOR_TEXTURE_TYPE)) { if (_textures[i]) { _gpuDescriptorSet->gpuDescriptors[i].texture = static_cast(_textures[i]); } diff --git a/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h b/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h index 5d1c4d88b3..3de5695e00 100644 --- a/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.h @@ -1,45 +1,51 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once + +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { + class CCMTLGPUDescriptorSetLayout; class CCMTLDescriptorSetLayout final : public DescriptorSetLayout { public: - explicit CCMTLDescriptorSetLayout(Device *device); + explicit CCMTLDescriptorSetLayout(); ~CCMTLDescriptorSetLayout() override = default; CCMTLDescriptorSetLayout(const CCMTLDescriptorSetLayout &)=delete; CCMTLDescriptorSetLayout(CCMTLDescriptorSetLayout &&)=delete; CCMTLDescriptorSetLayout &operator=(const CCMTLDescriptorSetLayout &)=delete; CCMTLDescriptorSetLayout &operator=(CCMTLDescriptorSetLayout &&)=delete; - bool initialize(const DescriptorSetLayoutInfo &info) override; - void destroy() override; - CC_INLINE CCMTLGPUDescriptorSetLayout *gpuDescriptorSetLayout() const { return _gpuDescriptorSetLayout; } -private: +protected: + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; + CCMTLGPUDescriptorSetLayout *_gpuDescriptorSetLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm b/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm index a5c165f497..db255d5520 100644 --- a/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm +++ b/native/cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDescriptorSetLayout.h" @@ -29,53 +31,29 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLDescriptorSetLayout::CCMTLDescriptorSetLayout(Device *device) : DescriptorSetLayout(device) { +CCMTLDescriptorSetLayout::CCMTLDescriptorSetLayout() : DescriptorSetLayout() { } -bool CCMTLDescriptorSetLayout::initialize(const DescriptorSetLayoutInfo &info) { - _bindings = info.bindings; - const auto bindingCount = _bindings.size(); - _descriptorCount = 0; - - if (bindingCount) { - uint maxBinding = 0; - vector flattenedIndices(bindingCount); - for (auto i = 0; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - flattenedIndices[i] = _descriptorCount; - _descriptorCount += binding.count; - if (binding.binding > maxBinding) maxBinding = binding.binding; - } - - _bindingIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - _descriptorIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - _bindingIndices[binding.binding] = i; - _descriptorIndices[binding.binding] = flattenedIndices[i]; - } - } - +void CCMTLDescriptorSetLayout::doInit(const DescriptorSetLayoutInfo &info) { _gpuDescriptorSetLayout = CC_NEW(CCMTLGPUDescriptorSetLayout); _gpuDescriptorSetLayout->descriptorCount = _descriptorCount; _gpuDescriptorSetLayout->descriptorIndices = _descriptorIndices; _gpuDescriptorSetLayout->bindingIndices = _bindingIndices; _gpuDescriptorSetLayout->bindings = _bindings; - for (size_t i = 0; i < bindingCount; i++) { + for (size_t i = 0; i < _bindings.size(); i++) { const auto binding = _bindings[i]; - if (static_cast(binding.descriptorType) & DESCRIPTOR_DYNAMIC_TYPE) { + if (hasAnyFlags(binding.descriptorType, DESCRIPTOR_DYNAMIC_TYPE)) { for (uint j = 0; j < binding.count; j++) { _gpuDescriptorSetLayout->dynamicBindings.push_back(binding.binding); } } } - return true; } -void CCMTLDescriptorSetLayout::destroy() { +void CCMTLDescriptorSetLayout::doDestroy() { CC_SAFE_DELETE(_gpuDescriptorSetLayout); } -} -} +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLDevice.h b/native/cocos/renderer/gfx-metal/MTLDevice.h index 24d0d887fe..a06a7b65f0 100644 --- a/native/cocos/renderer/gfx-metal/MTLDevice.h +++ b/native/cocos/renderer/gfx-metal/MTLDevice.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXDevice.h" #include "MTLConfig.h" namespace cc { @@ -33,8 +36,11 @@ class CCMTLSemaphore; class CCMTLDevice final : public Device { public: + static CCMTLDevice *getInstance(); + CCMTLDevice(); - ~CCMTLDevice() override = default; + ~CCMTLDevice() override; + CCMTLDevice(const CCMTLDevice &) = delete; CCMTLDevice(CCMTLDevice &&) = delete; CCMTLDevice &operator=(const CCMTLDevice &) = delete; @@ -45,7 +51,6 @@ public: using Device::createCommandBuffer; using Device::createDescriptorSet; using Device::createDescriptorSetLayout; - using Device::createFence; using Device::createFramebuffer; using Device::createInputAssembler; using Device::createPipelineLayout; @@ -55,26 +60,39 @@ public: using Device::createSampler; using Device::createShader; using Device::createTexture; + using Device::createGlobalBarrier; + using Device::createTextureBarrier; - bool initialize(const DeviceInfo &info) override; - void destroy() override; void resize(uint width, uint height) override; void acquire() override; void present() override; + void onPresentCompleted(); + void* getCurrentDrawable(); + void disposeCurrentDrawable(); + uint preferredPixelFormat(); + CC_INLINE void *getMTLCommandQueue() const { return _mtlCommandQueue; } - CC_INLINE void *getMTKView() const { return _mtkView; } + CC_INLINE void *getMTLLayer() const { return _mtlLayer; } CC_INLINE void *getMTLDevice() const { return _mtlDevice; } CC_INLINE uint getMaximumSamplerUnits() const { return _maxSamplerUnits; } + CC_INLINE uint getMaximumColorRenderTargets() const { return _caps.maxColorRenderTargets; } CC_INLINE uint getMaximumBufferBindingIndex() const { return _maxBufferBindingIndex; } + CC_INLINE bool isIndirectCommandBufferSupported() const { return _icbSuppored; } CC_INLINE bool isIndirectDrawSupported() const { return _indirectDrawSupported; } CC_INLINE CCMTLGPUStagingBufferPool *gpuStagingBufferPool() const { return _gpuStagingBufferPools[_currentFrameIndex]; } CC_INLINE bool isSamplerDescriptorCompareFunctionSupported() const { return _isSamplerDescriptorCompareFunctionSupported; } CC_INLINE uint currentFrameIndex() const { return _currentFrameIndex; } + CC_INLINE void *getDSSTexture() const { return _dssTex; } protected: - CommandBuffer *doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; - Fence *createFence() override; + static CCMTLDevice * _instance; + + friend class DeviceManager; + + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; + CommandBuffer *createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; Queue *createQueue() override; Buffer *createBuffer() override; Texture *createTexture() override; @@ -87,24 +105,29 @@ protected: DescriptorSetLayout *createDescriptorSetLayout() override; PipelineLayout *createPipelineLayout() override; PipelineState *createPipelineState() override; + GlobalBarrier *createGlobalBarrier() override; + TextureBarrier *createTextureBarrier() override; void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; -private: void onMemoryWarning(); -private: + void *_autoreleasePool = nullptr; void *_mtlCommandQueue = nullptr; - void *_mtkView = nullptr; void *_mtlDevice = nullptr; + void *_mtlLayer = nullptr; + void *_dssTex = nullptr; + void *_activeDrawable = nullptr; unsigned long _mtlFeatureSet = 0; uint _maxSamplerUnits = 0; uint _maxBufferBindingIndex = 0; + bool _icbSuppored = false; bool _indirectDrawSupported = false; bool _isSamplerDescriptorCompareFunctionSupported = false; CCMTLGPUStagingBufferPool *_gpuStagingBufferPools[MAX_FRAMES_IN_FLIGHT] = {nullptr}; - CCMTLSemaphore *_inFlightSemaphore = nullptr; + uint _currentBufferPoolId = 0; uint _currentFrameIndex = 0; - uint32_t _memoryAlarmListenerId = 0; + CCMTLSemaphore *_inFlightSemaphore = nullptr; + CC_UNUSED uint32_t _memoryAlarmListenerId = 0; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-metal/MTLDevice.mm b/native/cocos/renderer/gfx-metal/MTLDevice.mm index 6b610a1a30..eecdcf4c27 100644 --- a/native/cocos/renderer/gfx-metal/MTLDevice.mm +++ b/native/cocos/renderer/gfx-metal/MTLDevice.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLBuffer.h" @@ -30,7 +32,6 @@ THE SOFTWARE. #include "MTLDescriptorSet.h" #include "MTLDescriptorSetLayout.h" #include "MTLDevice.h" -#include "MTLFence.h" #include "MTLFramebuffer.h" #include "MTLInputAssembler.h" #include "MTLPipelineLayout.h" @@ -47,111 +48,135 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLDevice::CCMTLDevice() { - _clipSpaceMinZ = 0.0f; - _screenSpaceSignY = 1.0f; - _UVSpaceSignY = 1.0f; +CCMTLDevice *CCMTLDevice::_instance = nullptr; + +CCMTLDevice *CCMTLDevice::getInstance() { + return CCMTLDevice::_instance; } -bool CCMTLDevice::initialize(const DeviceInfo &info) { - _API = API::METAL; +CCMTLDevice::CCMTLDevice() { + _api = API::METAL; _deviceName = "Metal"; - _width = info.width; - _height = info.height; - _nativeWidth = info.nativeWidth; - _nativeHeight = info.nativeHeight; - _windowHandle = info.windowHandle; - _bindingMappingInfo = info.bindingMappingInfo; - if (!_bindingMappingInfo.bufferOffsets.size()) { - _bindingMappingInfo.bufferOffsets.push_back(0); - } - if (!_bindingMappingInfo.samplerOffsets.size()) { - _bindingMappingInfo.samplerOffsets.push_back(0); - } + _caps.clipSpaceMinZ = 0.0f; + _caps.screenSpaceSignY = -1.0f; + _caps.clipSpaceSignY = 1.0f; + CCMTLDevice::_instance = this; +} + +CCMTLDevice::~CCMTLDevice() { + CCMTLDevice::_instance = nullptr; +} + +bool CCMTLDevice::doInit(const DeviceInfo &info) { _inFlightSemaphore = CC_NEW(CCMTLSemaphore(MAX_FRAMES_IN_FLIGHT)); _currentFrameIndex = 0; - _mtkView = (MTKView *)_windowHandle; - id mtlDevice = ((MTKView *)_mtkView).device; +#if CC_PLATFORM == CC_PLATFORM_MAC_OSX + NSView *view = (NSView *)_windowHandle; +#else + UIView *view = (UIView *)_windowHandle; +#endif + +#ifdef CC_USE_METAL + CAMetalLayer *layer = static_cast(view.layer); +#else + CAMetalLayer *layer = static_cast(view); +#endif + _mtlLayer = layer; + layer.framebufferOnly = NO; + id mtlDevice = (id)layer.device; _mtlDevice = mtlDevice; - _mtlCommandQueue = [mtlDevice newCommandQueue]; + _mtlCommandQueue = [mtlDevice newCommandQueueWithMaxCommandBufferCount: MAX_COMMAND_BUFFER_COUNT]; _mtlFeatureSet = mu::highestSupportedFeatureSet(mtlDevice); const auto gpuFamily = mu::getGPUFamily(MTLFeatureSet(_mtlFeatureSet)); _indirectDrawSupported = mu::isIndirectDrawSupported(gpuFamily); - _maxVertexAttributes = mu::getMaxVertexAttributes(gpuFamily); - _maxTextureUnits = _maxVertexTextureUnits = mu::getMaxEntriesInTextureArgumentTable(gpuFamily); + _caps.maxVertexAttributes = mu::getMaxVertexAttributes(gpuFamily); + _caps.maxTextureUnits = _caps.maxVertexTextureUnits = mu::getMaxEntriesInTextureArgumentTable(gpuFamily); _maxSamplerUnits = mu::getMaxEntriesInSamplerStateArgumentTable(gpuFamily); - _maxTextureSize = mu::getMaxTexture2DWidthHeight(gpuFamily); - _maxCubeMapTextureSize = mu::getMaxCubeMapTextureWidthHeight(gpuFamily); + _caps.maxTextureSize = mu::getMaxTexture2DWidthHeight(gpuFamily); + _caps.maxCubeMapTextureSize = mu::getMaxCubeMapTextureWidthHeight(gpuFamily); + _caps.maxColorRenderTargets = mu::getMaxColorRenderTarget(gpuFamily); + _caps.uboOffsetAlignment = mu::getMinBufferOffsetAlignment(gpuFamily); + _caps.maxComputeWorkGroupInvocations = mu::getMaxThreadsPerGroup(gpuFamily); _maxBufferBindingIndex = mu::getMaxEntriesInBufferArgumentTable(gpuFamily); - _uboOffsetAlignment = mu::getMinBufferOffsetAlignment(gpuFamily); + _icbSuppored = mu::isIndirectCommandBufferSupported(MTLFeatureSet(_mtlFeatureSet)); _isSamplerDescriptorCompareFunctionSupported = mu::isSamplerDescriptorCompareFunctionSupported(gpuFamily); - MTKView *view = static_cast(_mtkView); - if (view.colorPixelFormat == MTLPixelFormatInvalid) view.colorPixelFormat = MTLPixelFormatBGRA8Unorm; - view.depthStencilPixelFormat = mu::getSupportedDepthStencilFormat(mtlDevice, gpuFamily, _depthBits); - _stencilBits = 8; + if (layer.pixelFormat == MTLPixelFormatInvalid) { + layer.pixelFormat = MTLPixelFormatBGRA8Unorm; + } + // Persistent depth stencil texture + MTLTextureDescriptor *dssDescriptor = [[MTLTextureDescriptor alloc] init]; + dssDescriptor.pixelFormat = mu::getSupportedDepthStencilFormat(mtlDevice, gpuFamily, _caps.depthBits); + dssDescriptor.width = info.nativeWidth; + dssDescriptor.height = info.nativeHeight; + dssDescriptor.storageMode = MTLStorageModePrivate; + dssDescriptor.usage = MTLTextureUsageRenderTarget; + _dssTex = [mtlDevice newTextureWithDescriptor:dssDescriptor]; + _caps.stencilBits = 8; - ContextInfo contextCreateInfo; - contextCreateInfo.windowHandle = _windowHandle; - contextCreateInfo.sharedCtx = info.sharedCtx; - _context = CC_NEW(CCMTLContext(this)); - if (!_context->initialize(contextCreateInfo)) { + ContextInfo ctxInfo; + ctxInfo.windowHandle = _windowHandle; + + _context = CC_NEW(CCMTLContext); + if (!_context->initialize(ctxInfo)) { destroy(); return false; } - QueueInfo queue_info; - queue_info.type = QueueType::GRAPHICS; - _queue = createQueue(queue_info); + QueueInfo queueInfo; + queueInfo.type = QueueType::GRAPHICS; + _queue = createQueue(queueInfo); CommandBufferInfo cmdBuffInfo; - cmdBuffInfo.type = CommandBufferType::PRIMARY; + cmdBuffInfo.type = CommandBufferType::PRIMARY; cmdBuffInfo.queue = _queue; - _cmdBuff = createCommandBuffer(cmdBuffInfo); + _cmdBuff = createCommandBuffer(cmdBuffInfo); for (int i = 0; i < MAX_FRAMES_IN_FLIGHT; ++i) { _gpuStagingBufferPools[i] = CC_NEW(CCMTLGPUStagingBufferPool(mtlDevice)); } - _features[static_cast(Feature::COLOR_FLOAT)] = mu::isColorBufferFloatSupported(gpuFamily); - _features[static_cast(Feature::COLOR_HALF_FLOAT)] = mu::isColorBufferHalfFloatSupported(gpuFamily); - _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = mu::isLinearTextureSupported(gpuFamily); - _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = mu::isLinearTextureSupported(gpuFamily); + _features[static_cast(Feature::COLOR_FLOAT)] = mu::isColorBufferFloatSupported(gpuFamily); + _features[static_cast(Feature::COLOR_HALF_FLOAT)] = mu::isColorBufferHalfFloatSupported(gpuFamily); + _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = mu::isLinearTextureSupported(gpuFamily); + _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = mu::isLinearTextureSupported(gpuFamily); String compressedFormats; if (mu::isPVRTCSuppported(gpuFamily)) { - _features[static_cast(Feature::FORMAT_PVRTC)] = true; + _features[static_cast(Feature::FORMAT_PVRTC)] = true; compressedFormats += "pvrtc "; } if (mu::isEAC_ETCCSuppported(gpuFamily)) { - _features[static_cast(Feature::FORMAT_ETC2)] = true; + _features[static_cast(Feature::FORMAT_ETC2)] = true; compressedFormats += "etc2 "; } if (mu::isASTCSuppported(gpuFamily)) { - _features[static_cast(Feature::FORMAT_ASTC)] = true; + _features[static_cast(Feature::FORMAT_ASTC)] = true; compressedFormats += "astc "; } if (mu::isBCSupported(gpuFamily)) { - _features[static_cast(Feature::FORMAT_ASTC)] = true; + _features[static_cast(Feature::FORMAT_ASTC)] = true; compressedFormats += "dxt "; } - _features[(int)Feature::TEXTURE_FLOAT] = true; - _features[(int)Feature::TEXTURE_HALF_FLOAT] = true; - _features[(int)Feature::FORMAT_R11G11B10F] = true; - _features[(int)Feature::MSAA] = true; - _features[(int)Feature::INSTANCED_ARRAYS] = true; - _features[(int)Feature::MULTIPLE_RENDER_TARGETS] = true; - _features[(uint)Feature::BLEND_MINMAX] = true; + _features[static_cast(Feature::TEXTURE_FLOAT)] = true; + _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; + _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; + _features[static_cast(Feature::MSAA)] = true; + _features[static_cast(Feature::INSTANCED_ARRAYS)] = true; + _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; + _features[static_cast(Feature::BLEND_MINMAX)] = true; + _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; _features[static_cast(Feature::DEPTH_BOUNDS)] = false; _features[static_cast(Feature::LINE_WIDTH)] = false; _features[static_cast(Feature::STENCIL_COMPARE_MASK)] = false; _features[static_cast(Feature::STENCIL_WRITE_MASK)] = false; _features[static_cast(Feature::MULTITHREADED_SUBMISSION)] = true; + _features[static_cast(Feature::COMPUTE_SHADER)] = true; _features[static_cast(Feature::FORMAT_RGB8)] = false; _features[static_cast(Feature::FORMAT_D16)] = mu::isDepthStencilFormatSupported(mtlDevice, Format::D16, gpuFamily); @@ -160,7 +185,7 @@ bool CCMTLDevice::initialize(const DeviceInfo &info) { _features[static_cast(Feature::FORMAT_D32F)] = mu::isDepthStencilFormatSupported(mtlDevice, Format::D32F, gpuFamily); _features[static_cast(Feature::FORMAT_D32FS8)] = mu::isDepthStencilFormatSupported(mtlDevice, Format::D32F_S8, gpuFamily); - _memoryAlarmListenerId = EventDispatcher::addCustomEventListener(EVENT_MEMORY_WARNING, std::bind(&CCMTLDevice::onMemoryWarning, this)); +// _memoryAlarmListenerId = EventDispatcher::addCustomEventListener(EVENT_MEMORY_WARNING, std::bind(&CCMTLDevice::onMemoryWarning, this)); CCMTLGPUGarbageCollectionPool::getInstance()->initialize(std::bind(&CCMTLDevice::currentFrameIndex, this)); @@ -169,10 +194,14 @@ bool CCMTLDevice::initialize(const DeviceInfo &info) { return true; } -void CCMTLDevice::destroy() { - if (_memoryAlarmListenerId != 0) { - EventDispatcher::removeCustomEventListener(EVENT_MEMORY_WARNING, _memoryAlarmListenerId); - _memoryAlarmListenerId = 0; +void CCMTLDevice::doDestroy() { +// if (_memoryAlarmListenerId != 0) { +// EventDispatcher::removeCustomEventListener(EVENT_MEMORY_WARNING, _memoryAlarmListenerId); +// _memoryAlarmListenerId = 0; +// } + if (_autoreleasePool) { + [(NSAutoreleasePool*)_autoreleasePool drain]; + _autoreleasePool = nullptr; } CCMTLGPUGarbageCollectionPool::getInstance()->flush(); @@ -197,11 +226,29 @@ void CCMTLDevice::destroy() { } } -void CCMTLDevice::resize(uint /*width*/, uint /*height*/) {} +void CCMTLDevice::resize(uint w, uint h) { + this->_width = w; + this->_height = h; + + [id(_dssTex) release]; + + MTLTextureDescriptor *dssDescriptor = [[MTLTextureDescriptor alloc] init]; + const auto gpuFamily = mu::getGPUFamily(MTLFeatureSet(_mtlFeatureSet)); + dssDescriptor.pixelFormat = mu::getSupportedDepthStencilFormat(id(this->_mtlDevice), gpuFamily, _caps.depthBits); + dssDescriptor.width = w; + dssDescriptor.height = h; + dssDescriptor.storageMode = MTLStorageModePrivate; + dssDescriptor.usage = MTLTextureUsageRenderTarget; + _dssTex = [id(this->_mtlDevice) newTextureWithDescriptor:dssDescriptor]; +} void CCMTLDevice::acquire() { _inFlightSemaphore->wait(); + if (!_autoreleasePool) { + _autoreleasePool = [[NSAutoreleasePool alloc] init]; +// CC_LOG_INFO("POOL: %p ALLOCED", _autoreleasePool); + } // Clear queue stats CCMTLQueue *queue = static_cast(_queue); queue->_numDrawCalls = 0; @@ -216,76 +263,100 @@ void CCMTLDevice::present() { _numTriangles = queue->_numTriangles; //hold this pointer before update _currentFrameIndex - CCMTLGPUStagingBufferPool *bufferPool = _gpuStagingBufferPools[_currentFrameIndex]; - uint triggeredFrameIndex = _currentFrameIndex; + _currentBufferPoolId = _currentFrameIndex; _currentFrameIndex = (_currentFrameIndex + 1) % MAX_FRAMES_IN_FLIGHT; - auto mtlCommandBuffer = static_cast(_cmdBuff)->getMTLCommandBuffer(); - auto mtkView = static_cast(_mtkView); - [mtlCommandBuffer presentDrawable:mtkView.currentDrawable]; - [mtlCommandBuffer addCompletedHandler:^(id commandBuffer) { - [commandBuffer release]; - bufferPool->reset(); - CCMTLGPUGarbageCollectionPool::getInstance()->clear(triggeredFrameIndex); - _inFlightSemaphore->signal(); - }]; - [mtlCommandBuffer commit]; + if (_autoreleasePool) { +// CC_LOG_INFO("POOL: %p RELEASED", _autoreleasePool); + [(NSAutoreleasePool*)_autoreleasePool drain]; + _autoreleasePool = nullptr; + } } -Fence *CCMTLDevice::createFence() { - return CC_NEW(CCMTLFence(this)); +void CCMTLDevice::onPresentCompleted() { + if (_currentBufferPoolId >= 0 && _currentBufferPoolId < MAX_FRAMES_IN_FLIGHT) { + CCMTLGPUStagingBufferPool *bufferPool = _gpuStagingBufferPools[_currentBufferPoolId]; + if (bufferPool) { + bufferPool->reset(); + CCMTLGPUGarbageCollectionPool::getInstance()->clear(_currentBufferPoolId); + } + } + _inFlightSemaphore->signal(); +} + +void *CCMTLDevice::getCurrentDrawable() { + if (!_activeDrawable) { + CAMetalLayer *layer = (CAMetalLayer*)getMTLLayer(); + _activeDrawable = [[layer nextDrawable] retain]; + } + return _activeDrawable; +} + +void CCMTLDevice::disposeCurrentDrawable() { + if (_activeDrawable) { + [(id)_activeDrawable release]; + _activeDrawable = nil; + } } Queue *CCMTLDevice::createQueue() { - return CC_NEW(CCMTLQueue(this)); + return CC_NEW(CCMTLQueue); } -CommandBuffer *CCMTLDevice::doCreateCommandBuffer(const CommandBufferInfo &info, bool /*hasAgent*/) { - return CC_NEW(CCMTLCommandBuffer(this)); +CommandBuffer *CCMTLDevice::createCommandBuffer(const CommandBufferInfo &info, bool /*hasAgent*/) { + return CC_NEW(CCMTLCommandBuffer); } Buffer *CCMTLDevice::createBuffer() { - return CC_NEW(CCMTLBuffer(this)); + return CC_NEW(CCMTLBuffer); } Texture *CCMTLDevice::createTexture() { - return CC_NEW(CCMTLTexture(this)); + return CC_NEW(CCMTLTexture); } Sampler *CCMTLDevice::createSampler() { - return CC_NEW(CCMTLSampler(this)); + return CC_NEW(CCMTLSampler); } Shader *CCMTLDevice::createShader() { - return CC_NEW(CCMTLShader(this)); + return CC_NEW(CCMTLShader); } InputAssembler *CCMTLDevice::createInputAssembler() { - return CC_NEW(CCMTLInputAssembler(this)); + return CC_NEW(CCMTLInputAssembler); } RenderPass *CCMTLDevice::createRenderPass() { - return CC_NEW(CCMTLRenderPass(this)); + return CC_NEW(CCMTLRenderPass); } Framebuffer *CCMTLDevice::createFramebuffer() { - return CC_NEW(CCMTLFramebuffer(this)); + return CC_NEW(CCMTLFramebuffer); } DescriptorSet *CCMTLDevice::createDescriptorSet() { - return CC_NEW(CCMTLDescriptorSet(this)); + return CC_NEW(CCMTLDescriptorSet); } DescriptorSetLayout *CCMTLDevice::createDescriptorSetLayout() { - return CC_NEW(CCMTLDescriptorSetLayout(this)); + return CC_NEW(CCMTLDescriptorSetLayout); } PipelineLayout *CCMTLDevice::createPipelineLayout() { - return CC_NEW(CCMTLPipelineLayout(this)); + return CC_NEW(CCMTLPipelineLayout); } PipelineState *CCMTLDevice::createPipelineState() { - return CC_NEW(CCMTLPipelineState(this)); + return CC_NEW(CCMTLPipelineState); +} + +GlobalBarrier *CCMTLDevice::createGlobalBarrier() { + return CC_NEW(GlobalBarrier); +} + +TextureBarrier *CCMTLDevice::createTextureBarrier() { + return CC_NEW(TextureBarrier); } void CCMTLDevice::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { @@ -304,5 +375,9 @@ void CCMTLDevice::onMemoryWarning() { } } +uint CCMTLDevice::preferredPixelFormat() { + return static_cast([((CAMetalLayer*)_mtlLayer) pixelFormat]); +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLFence.h b/native/cocos/renderer/gfx-metal/MTLFence.h deleted file mode 100644 index 8dfd7d1132..0000000000 --- a/native/cocos/renderer/gfx-metal/MTLFence.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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. -****************************************************************************/ -#pragma once -namespace cc { -namespace gfx { - -class CCMTLFence : public Fence { -public: - CCMTLFence(Device *device); - ~CCMTLFence() override = default; - - bool initialize(const FenceInfo &info) override; - void destroy() override; - void wait() override; - void reset() override; - -private: -}; - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLFence.mm b/native/cocos/renderer/gfx-metal/MTLFence.mm deleted file mode 100644 index 9560bb02b4..0000000000 --- a/native/cocos/renderer/gfx-metal/MTLFence.mm +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "MTLStd.h" - -#include "MTLFence.h" - -namespace cc { -namespace gfx { - -CCMTLFence::CCMTLFence(Device *device) -: Fence(device) { -} - -bool CCMTLFence::initialize(const FenceInfo &info) { - return true; -} - -void CCMTLFence::destroy() { -} - -void CCMTLFence::wait() { -} - -void CCMTLFence::reset() { -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLFramebuffer.h b/native/cocos/renderer/gfx-metal/MTLFramebuffer.h index ff532c9214..764ef627fb 100644 --- a/native/cocos/renderer/gfx-metal/MTLFramebuffer.h +++ b/native/cocos/renderer/gfx-metal/MTLFramebuffer.h @@ -1,46 +1,50 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXFramebuffer.h" + namespace cc { namespace gfx { class CCMTLFramebuffer final : public Framebuffer { public: - explicit CCMTLFramebuffer(Device *device); + explicit CCMTLFramebuffer(); ~CCMTLFramebuffer() override = default; CCMTLFramebuffer(const CCMTLFramebuffer &)=delete; CCMTLFramebuffer(CCMTLFramebuffer &&)=delete; CCMTLFramebuffer &operator=(const CCMTLFramebuffer &)=delete; CCMTLFramebuffer &operator=(CCMTLFramebuffer &&)=delete; - bool initialize(const FramebufferInfo &info) override; - void destroy() override; - CC_INLINE bool isOffscreen() const { return _isOffscreen; } -private: +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; + bool _isOffscreen = false; }; diff --git a/native/cocos/renderer/gfx-metal/MTLFramebuffer.mm b/native/cocos/renderer/gfx-metal/MTLFramebuffer.mm index 75a7b152e0..1f6bae0631 100644 --- a/native/cocos/renderer/gfx-metal/MTLFramebuffer.mm +++ b/native/cocos/renderer/gfx-metal/MTLFramebuffer.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLFramebuffer.h" @@ -30,13 +32,9 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLFramebuffer::CCMTLFramebuffer(Device *device) : Framebuffer(device) {} - -bool CCMTLFramebuffer::initialize(const FramebufferInfo &info) { - _renderPass = info.renderPass; - _colorTextures = info.colorTextures; - _depthStencilTexture = info.depthStencilTexture; +CCMTLFramebuffer::CCMTLFramebuffer() : Framebuffer() {} +void CCMTLFramebuffer::doInit(const FramebufferInfo &info) { auto *mtlRenderPass = static_cast(_renderPass); size_t slot = 0; size_t levelCount = info.colorMipmapLevels.size(); @@ -62,11 +60,9 @@ bool CCMTLFramebuffer::initialize(const FramebufferInfo &info) { } _isOffscreen = (attachmentIndices != 0); - - return true; } -void CCMTLFramebuffer::destroy() { +void CCMTLFramebuffer::doDestroy() { } } // namespace gfx diff --git a/native/cocos/renderer/gfx-metal/MTLGPUObjects.h b/native/cocos/renderer/gfx-metal/MTLGPUObjects.h index f4c356ed12..b1d2727358 100644 --- a/native/cocos/renderer/gfx-metal/MTLGPUObjects.h +++ b/native/cocos/renderer/gfx-metal/MTLGPUObjects.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include @@ -56,9 +58,9 @@ public: struct CCMTLGPUUniformBlock { String name; - uint set = GFX_INVALID_BINDING; - uint binding = GFX_INVALID_BINDING; - uint mappedBinding = GFX_INVALID_BINDING; + uint set = INVALID_BINDING; + uint binding = INVALID_BINDING; + uint mappedBinding = INVALID_BINDING; ShaderStageFlags stages = ShaderStageFlagBit::NONE; size_t size = 0; uint count = 0; @@ -66,10 +68,10 @@ struct CCMTLGPUUniformBlock { struct CCMTLGPUSamplerBlock { String name; - uint set = GFX_INVALID_BINDING; - uint binding = GFX_INVALID_BINDING; - uint textureBinding = GFX_INVALID_BINDING; - uint samplerBinding = GFX_INVALID_BINDING; + uint set = INVALID_BINDING; + uint binding = INVALID_BINDING; + uint textureBinding = INVALID_BINDING; + uint samplerBinding = INVALID_BINDING; ShaderStageFlags stages = ShaderStageFlagBit::NONE; Type type = Type::UNKNOWN; uint count = 0; @@ -89,6 +91,7 @@ struct CCMTLGPUPipelineState { MTLPrimitiveType primitiveType; id mtlRenderPipelineState = nil; id mtlDepthStencilState = nil; + id mtlComputePipelineState = nil; uint stencilRefFront = 0; uint stencilRefBack = 0; vector> vertexBufferBindingInfo; @@ -216,7 +219,7 @@ public: } } -private: +protected: struct Buffer { id mtlBuffer = nil; vector> dynamicDataBuffers{MAX_FRAMES_IN_FLIGHT}; @@ -280,7 +283,7 @@ public: } } -private: +protected: //avoid cross-reference with CCMTLDevice std::function _getFrameIndex; std::queue _releaseQueue[MAX_FRAMES_IN_FLIGHT]; diff --git a/native/cocos/renderer/gfx-metal/MTLInputAssembler.h b/native/cocos/renderer/gfx-metal/MTLInputAssembler.h index 69a3be936b..6aca7d4f42 100644 --- a/native/cocos/renderer/gfx-metal/MTLInputAssembler.h +++ b/native/cocos/renderer/gfx-metal/MTLInputAssembler.h @@ -1,48 +1,52 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXInputAssembler.h" + namespace cc { namespace gfx { class CCMTLGPUInputAssembler; class CCMTLInputAssembler final : public InputAssembler { - friend class CCMTLQueue; - public: - explicit CCMTLInputAssembler(Device *device); + explicit CCMTLInputAssembler(); ~CCMTLInputAssembler() override = default; CCMTLInputAssembler(const CCMTLInputAssembler &)=delete; CCMTLInputAssembler(CCMTLInputAssembler &&)=delete; CCMTLInputAssembler &operator=(const CCMTLInputAssembler &)=delete; CCMTLInputAssembler &operator=(CCMTLInputAssembler &&)=delete; - bool initialize(const InputAssemblerInfo &info) override; - void destroy() override; +protected: + friend class CCMTLQueue; + + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; -private: CCMTLGPUInputAssembler *_GPUInputAssembler = nullptr; }; diff --git a/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm b/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm index 28180414e4..efb5e9058a 100644 --- a/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm +++ b/native/cocos/renderer/gfx-metal/MTLInputAssembler.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLBuffer.h" @@ -30,26 +32,12 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLInputAssembler::CCMTLInputAssembler(Device *device) : InputAssembler(device) {} - -bool CCMTLInputAssembler::initialize(const InputAssemblerInfo &info) { - _attributes = info.attributes; - _vertexBuffers = info.vertexBuffers; - _indexBuffer = info.indexBuffer; - _indirectBuffer = info.indirectBuffer; - - if (_indexBuffer) { - _indexCount = _indexBuffer->getCount(); - _firstIndex = 0; - } else if (_vertexBuffers.size()) { - _vertexCount = _vertexBuffers[0]->getCount(); - _firstVertex = 0; - _vertexOffset = 0; - } +CCMTLInputAssembler::CCMTLInputAssembler() : InputAssembler() {} +void CCMTLInputAssembler::doInit(const InputAssemblerInfo &info) { _GPUInputAssembler = CC_NEW(CCMTLGPUInputAssembler); if (!_GPUInputAssembler) { - return false; + return; } if (info.indexBuffer) { @@ -61,13 +49,9 @@ bool CCMTLInputAssembler::initialize(const InputAssemblerInfo &info) { for (const auto &vertexBuffer : info.vertexBuffers) _GPUInputAssembler->mtlVertexBufers.push_back(static_cast(vertexBuffer)->getMTLBuffer()); - - _attributesHash = computeAttributesHash(); - - return true; } -void CCMTLInputAssembler::destroy() { +void CCMTLInputAssembler::doDestroy() { CC_SAFE_DELETE(_GPUInputAssembler); } diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h b/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h index 3a02b7aee8..7992b511b1 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h +++ b/native/cocos/renderer/gfx-metal/MTLPipelineLayout.h @@ -1,42 +1,48 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once + +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { + class CCMTLGPUPipelineLayout; class CCMTLPipelineLayout final : public PipelineLayout { public: - CCMTLPipelineLayout(Device *device); + CCMTLPipelineLayout(); virtual ~CCMTLPipelineLayout() = default; - virtual bool initialize(const PipelineLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE CCMTLGPUPipelineLayout *gpuPipelineLayout() const { return _gpuPipelineLayout; } -private: +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; + CCMTLGPUPipelineLayout *_gpuPipelineLayout = nullptr; }; } // namespace gfx diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineLayout.mm b/native/cocos/renderer/gfx-metal/MTLPipelineLayout.mm index cbf91a3b54..2e39baf658 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineLayout.mm +++ b/native/cocos/renderer/gfx-metal/MTLPipelineLayout.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDescriptorSetLayout.h" @@ -29,11 +31,10 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLPipelineLayout::CCMTLPipelineLayout(Device *device) : PipelineLayout(device) { +CCMTLPipelineLayout::CCMTLPipelineLayout() : PipelineLayout() { } -bool CCMTLPipelineLayout::initialize(const PipelineLayoutInfo &info) { - _setLayouts = info.setLayouts; +void CCMTLPipelineLayout::doInit(const PipelineLayoutInfo &info) { const auto setCount = _setLayouts.size(); _gpuPipelineLayout = CC_NEW(CCMTLGPUPipelineLayout); _gpuPipelineLayout->dynamicOffsetIndices.resize(setCount); @@ -52,11 +53,9 @@ bool CCMTLPipelineLayout::initialize(const PipelineLayoutInfo &info) { } _gpuPipelineLayout->setLayouts.emplace_back(gpuDescriptorSetLayout); } - - return true; } -void CCMTLPipelineLayout::destroy() { +void CCMTLPipelineLayout::doDestroy() { CC_SAFE_DELETE(_gpuPipelineLayout); } diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineState.h b/native/cocos/renderer/gfx-metal/MTLPipelineState.h index 163378d205..ff4cf89ada 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineState.h +++ b/native/cocos/renderer/gfx-metal/MTLPipelineState.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXPipelineState.h" + #include "MTLGPUObjects.h" #import @@ -33,21 +37,22 @@ namespace gfx { class CCMTLPipelineState final : public PipelineState { public: - explicit CCMTLPipelineState(Device *device); + explicit CCMTLPipelineState(); ~CCMTLPipelineState() override = default; CCMTLPipelineState(const CCMTLPipelineState &)=delete; CCMTLPipelineState(CCMTLPipelineState &&)=delete; CCMTLPipelineState &operator=(const CCMTLPipelineState &)=delete; CCMTLPipelineState &operator=(CCMTLPipelineState &&)=delete; - bool initialize(const PipelineStateInfo &info) override; - void destroy() override; - CC_INLINE CCMTLGPUPipelineState *getGPUPipelineState() const { return _GPUPipelineState; } -private: +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; + bool createMTLDepthStencilState(); bool createGPUPipelineState(); + bool createMTLComputePipelineState(); bool createMTLRenderPipelineState(); void setVertexDescriptor(MTLRenderPipelineDescriptor *); void setMTLFunctions(MTLRenderPipelineDescriptor *); @@ -55,9 +60,9 @@ private: void setBlendStates(MTLRenderPipelineDescriptor *); bool createMTLRenderPipeline(MTLRenderPipelineDescriptor *); -private: id _mtlRenderPipelineState = nil; id _mtlDepthStencilState = nil; + id _mtlComputePipeline = nil; CCMTLGPUPipelineState *_GPUPipelineState = nullptr; }; diff --git a/native/cocos/renderer/gfx-metal/MTLPipelineState.mm b/native/cocos/renderer/gfx-metal/MTLPipelineState.mm index 326fe7360b..475d9c4413 100644 --- a/native/cocos/renderer/gfx-metal/MTLPipelineState.mm +++ b/native/cocos/renderer/gfx-metal/MTLPipelineState.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDevice.h" @@ -34,30 +36,18 @@ THE SOFTWARE. #import #import +#import namespace cc { namespace gfx { -CCMTLPipelineState::CCMTLPipelineState(Device *device) : PipelineState(device) {} +CCMTLPipelineState::CCMTLPipelineState() : PipelineState() {} -bool CCMTLPipelineState::initialize(const PipelineStateInfo &info) { - _primitive = info.primitive; - _shader = info.shader; - _inputState = info.inputState; - _rasterizerState = info.rasterizerState; - _depthStencilState = info.depthStencilState; - _blendState = info.blendState; - _dynamicStates = info.dynamicStates; - _renderPass = info.renderPass; - _pipelineLayout = info.pipelineLayout; - - if (!createGPUPipelineState()) { - return false; - } - return true; +void CCMTLPipelineState::doInit(const PipelineStateInfo &info) { + createGPUPipelineState(); } -void CCMTLPipelineState::destroy() { +void CCMTLPipelineState::doDestroy() { CC_SAFE_DELETE(_GPUPipelineState); id renderPipelineState = _mtlRenderPipelineState; @@ -82,24 +72,52 @@ bool CCMTLPipelineState::createGPUPipelineState() { CC_LOG_ERROR("CCMTLPipelineState: CC_NEW CCMTLGPUPipelineState failed."); return false; } + + if(_bindPoint == PipelineBindPoint::GRAPHICS) { + if (!createMTLRenderPipelineState()) { + return false; + } + // Application can run with wrong depth/stencil state. + if (!createMTLDepthStencilState()) { + return false; + } - if (!createMTLRenderPipelineState()) return false; + _GPUPipelineState->mtlDepthStencilState = _mtlDepthStencilState; + _GPUPipelineState->mtlRenderPipelineState = _mtlRenderPipelineState; + _GPUPipelineState->cullMode = mu::toMTLCullMode(_rasterizerState.cullMode); + _GPUPipelineState->fillMode = mu::toMTLTriangleFillMode(_rasterizerState.polygonMode); + _GPUPipelineState->depthClipMode = mu::toMTLDepthClipMode(_rasterizerState.isDepthClip != 0); + _GPUPipelineState->winding = mu::toMTLWinding(_rasterizerState.isFrontFaceCCW != 0); + _GPUPipelineState->stencilRefFront = _depthStencilState.stencilRefFront; + _GPUPipelineState->stencilRefBack = _depthStencilState.stencilRefBack; + _GPUPipelineState->primitiveType = mu::toMTLPrimitiveType(_primitive); + if (_pipelineLayout) + _GPUPipelineState->gpuPipelineLayout = static_cast(_pipelineLayout)->gpuPipelineLayout(); + _GPUPipelineState->gpuShader = static_cast(_shader)->gpuShader(); + } + else if (_bindPoint == PipelineBindPoint::COMPUTE) { + if (!createMTLComputePipelineState()) { + return false; + } + _GPUPipelineState->mtlComputePipelineState = _mtlComputePipeline; + _GPUPipelineState->gpuShader = static_cast(_shader)->gpuShader(); + if (_pipelineLayout) + _GPUPipelineState->gpuPipelineLayout = static_cast(_pipelineLayout)->gpuPipelineLayout(); + } + + return true; +} - // Application can run with wrong depth/stencil state. - if (!createMTLDepthStencilState()) return false; - - _GPUPipelineState->mtlDepthStencilState = _mtlDepthStencilState; - _GPUPipelineState->mtlRenderPipelineState = _mtlRenderPipelineState; - _GPUPipelineState->cullMode = mu::toMTLCullMode(_rasterizerState.cullMode); - _GPUPipelineState->fillMode = mu::toMTLTriangleFillMode(_rasterizerState.polygonMode); - _GPUPipelineState->depthClipMode = mu::toMTLDepthClipMode(_rasterizerState.isDepthClip != 0); - _GPUPipelineState->winding = mu::toMTLWinding(_rasterizerState.isFrontFaceCCW != 0); - _GPUPipelineState->stencilRefFront = _depthStencilState.stencilRefFront; - _GPUPipelineState->stencilRefBack = _depthStencilState.stencilRefBack; - _GPUPipelineState->primitiveType = mu::toMTLPrimitiveType(_primitive); - if (_pipelineLayout) - _GPUPipelineState->gpuPipelineLayout = static_cast(_pipelineLayout)->gpuPipelineLayout(); - _GPUPipelineState->gpuShader = static_cast(_shader)->gpuShader(); +bool CCMTLPipelineState::createMTLComputePipelineState() { + //create with function + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); + NSError* err; + _mtlComputePipeline = [mtlDevice newComputePipelineStateWithFunction:((CCMTLShader *)_shader)->getComputeMTLFunction() + error:&err]; + if (!_mtlComputePipeline) { + CC_LOG_ERROR("Create compute pipeline failed: %s", [err.localizedDescription UTF8String]); + return false; + } return true; } @@ -139,7 +157,7 @@ bool CCMTLPipelineState::createMTLDepthStencilState() { descriptor.backFaceStencil = nil; } - id mtlDevice = id(static_cast(_device)->getMTLDevice()); + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); _mtlDepthStencilState = [mtlDevice newDepthStencilStateWithDescriptor:descriptor]; [descriptor release]; @@ -172,7 +190,7 @@ void CCMTLPipelineState::setVertexDescriptor(MTLRenderPipelineDescriptor *descri vector> layouts; unordered_map> map; - vector streamOffsets(_device->getMaxVertexAttributes(), 0u); + vector streamOffsets(CCMTLDevice::getInstance()->getCapabilities().maxVertexAttributes, 0u); vector activeAttribIdx(activeAttributes.size(), false); for (const auto &inputAttrib : _inputState.attributes) { auto bufferIndex = static_cast(_shader)->getAvailableBufferBindingIndex(ShaderStageFlagBit::VERTEX, inputAttrib.stream); @@ -271,7 +289,7 @@ void CCMTLPipelineState::setBlendStates(MTLRenderPipelineDescriptor *descriptor) } bool CCMTLPipelineState::createMTLRenderPipeline(MTLRenderPipelineDescriptor *descriptor) { - id mtlDevice = id(((CCMTLDevice *)_device)->getMTLDevice()); + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); NSError *nsError = nil; _mtlRenderPipelineState = [mtlDevice newRenderPipelineStateWithDescriptor:descriptor error:&nsError]; if (!_mtlRenderPipelineState) { diff --git a/native/cocos/renderer/gfx-metal/MTLQueue.h b/native/cocos/renderer/gfx-metal/MTLQueue.h index e4ebc1ba6e..8934c1b2b1 100644 --- a/native/cocos/renderer/gfx-metal/MTLQueue.h +++ b/native/cocos/renderer/gfx-metal/MTLQueue.h @@ -1,46 +1,52 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXQueue.h" + namespace cc { namespace gfx { + class CCMTLQueue final : public Queue { friend class CCMTLDevice; public: - explicit CCMTLQueue(Device *device); + explicit CCMTLQueue(); ~CCMTLQueue() override = default; CCMTLQueue(const CCMTLQueue &)=delete; CCMTLQueue(CCMTLQueue &&)=delete; CCMTLQueue &operator=(const CCMTLQueue &)=delete; CCMTLQueue &operator=(CCMTLQueue &&)=delete; - bool initialize(const QueueInfo &info) override; - void destroy() override; - void submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) override; + void submit(CommandBuffer *const *cmdBuffs, uint count) override; + +protected: + void doInit(const QueueInfo &info) override; + void doDestroy() override; -private: uint _numDrawCalls = 0; uint _numInstances = 0; uint _numTriangles = 0; diff --git a/native/cocos/renderer/gfx-metal/MTLQueue.mm b/native/cocos/renderer/gfx-metal/MTLQueue.mm index 4994860c7d..830cd88f41 100644 --- a/native/cocos/renderer/gfx-metal/MTLQueue.mm +++ b/native/cocos/renderer/gfx-metal/MTLQueue.mm @@ -1,52 +1,72 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLQueue.h" +#include "MTLDevice.h" +#include "MTLCommandBuffer.h" namespace cc { namespace gfx { -CCMTLQueue::CCMTLQueue(Device *device) -: Queue(device) { +CCMTLQueue::CCMTLQueue() +: Queue() { } -bool CCMTLQueue::initialize(const QueueInfo &info) { - _type = info.type; - - return true; +void CCMTLQueue::doInit(const QueueInfo &info) { } -void CCMTLQueue::destroy() { +void CCMTLQueue::doDestroy() { } -void CCMTLQueue::submit(const CommandBuffer *const *cmdBuffs, uint count, Fence */*fence*/) { +void CCMTLQueue::submit(CommandBuffer *const *cmdBuffs, uint count) { for (uint i = 0u; i < count; ++i) { - const auto *cmdBuffer = cmdBuffs[i]; + CCMTLCommandBuffer *cmdBuffer = (CCMTLCommandBuffer *)cmdBuffs[i]; _numDrawCalls += cmdBuffer->getNumDrawCalls(); _numInstances += cmdBuffer->getNumInstances(); _numTriangles += cmdBuffer->getNumTris(); + id mtlCmdBuffer = cmdBuffer->getMTLCommandBuffer(); + + if (i < count-1) { + [mtlCmdBuffer addCompletedHandler:^(id commandBuffer) { + [commandBuffer release]; + }]; + } + else { + // Must do present before commit last command buffer. + CCMTLDevice* device = (CCMTLDevice*)CCMTLDevice::getInstance(); + id currDrawable = (id)device->getCurrentDrawable(); + [mtlCmdBuffer presentDrawable:currDrawable]; + [mtlCmdBuffer addCompletedHandler:^(id commandBuffer) { + [commandBuffer release]; + device->onPresentCompleted(); + }]; + device->disposeCurrentDrawable(); + } + [mtlCmdBuffer commit]; } } diff --git a/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h b/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h index 7c90ae3c15..4445333bf7 100644 --- a/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h +++ b/native/cocos/renderer/gfx-metal/MTLRenderCommandEncoder.h @@ -1,32 +1,35 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "MTLStd.h" #include "MTLUtils.h" #include "base/Macros.h" #include "math/Math.h" +#include "MTLCommandEncoder.h" #import #import #import @@ -37,7 +40,7 @@ namespace gfx { struct Color; -class CCMTLRenderCommandEncoder final { +class CCMTLRenderCommandEncoder final : public CCMTLCommandEncoder { struct BufferBinding final { id buffer; uint offset = 0; @@ -51,10 +54,16 @@ public: CCMTLRenderCommandEncoder &operator=(const CCMTLRenderCommandEncoder &) = delete; CCMTLRenderCommandEncoder &operator=(CCMTLRenderCommandEncoder &&) = delete; - CC_INLINE void initialize(id commandBuffer, MTLRenderPassDescriptor *descriptor) { - _mtlEncoder = [commandBuffer renderCommandEncoderWithDescriptor:descriptor]; - [_mtlEncoder retain]; + void initialize(id commandBuffer, MTLRenderPassDescriptor *descriptor) { + _mtlEncoder = [[commandBuffer renderCommandEncoderWithDescriptor:descriptor] retain]; + clearStates(); + } + void initialize(id parallelEncoder) { + _mtlEncoder = [[parallelEncoder renderCommandEncoder] retain]; + clearStates(); + } + CC_INLINE void clearStates() { _isViewportSet = false; _isScissorRectSet = false; _isCullModeSet = false; @@ -266,7 +275,7 @@ public: return _mtlEncoder; } -private: +protected: bool _isViewportSet = false; bool _isScissorRectSet = false; bool _isCullModeSet = false; @@ -285,7 +294,7 @@ private: float _slope = 0.f; MTLCullMode _cullMode = MTLCullModeNone; MTLWinding _frontFacingWinding = MTLWindingClockwise; - MTLDepthClipMode _depthClipMode = MTLDepthClipModeClip; + CC_UNUSED MTLDepthClipMode _depthClipMode = MTLDepthClipModeClip; MTLTriangleFillMode _triangleFillMode = MTLTriangleFillModeFill; Viewport _viewport; Rect _scissorRect; diff --git a/native/cocos/renderer/gfx-metal/MTLRenderPass.h b/native/cocos/renderer/gfx-metal/MTLRenderPass.h index d874da7d45..82cf9488b1 100644 --- a/native/cocos/renderer/gfx-metal/MTLRenderPass.h +++ b/native/cocos/renderer/gfx-metal/MTLRenderPass.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXRenderPass.h" + #import #import #import @@ -33,12 +37,9 @@ namespace gfx { class CCMTLRenderPass final : public RenderPass { public: - explicit CCMTLRenderPass(Device *device); + explicit CCMTLRenderPass(); ~CCMTLRenderPass() override = default; - bool initialize(const RenderPassInfo &info) override; - void destroy() override; - void setColorAttachment(size_t slot, id texture, int level); void setDepthStencilAttachment(id texture, int level); @@ -46,7 +47,10 @@ public: CC_INLINE uint getColorRenderTargetNums() const { return _colorRenderTargetNums; } CC_INLINE const vector &getRenderTargetSizes() const { return _renderTargetSizes; } -private: +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; + MTLRenderPassDescriptor *_mtlRenderPassDescriptor = nil; uint _colorRenderTargetNums = 0; vector _renderTargetSizes; diff --git a/native/cocos/renderer/gfx-metal/MTLRenderPass.mm b/native/cocos/renderer/gfx-metal/MTLRenderPass.mm index d7ed354e76..4e4a6b9b38 100644 --- a/native/cocos/renderer/gfx-metal/MTLRenderPass.mm +++ b/native/cocos/renderer/gfx-metal/MTLRenderPass.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDevice.h" @@ -30,13 +32,10 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLRenderPass::CCMTLRenderPass(Device *device) : RenderPass(device) {} +CCMTLRenderPass::CCMTLRenderPass() : RenderPass() {} -bool CCMTLRenderPass::initialize(const RenderPassInfo &info) { - _colorAttachments = info.colorAttachments; - _depthStencilAttachment = info.depthStencilAttachment; +void CCMTLRenderPass::doInit(const RenderPassInfo &info) { _renderTargetSizes.resize(_colorAttachments.size()); - _mtlRenderPassDescriptor = [[MTLRenderPassDescriptor alloc] init]; uint i = 0; @@ -51,13 +50,9 @@ bool CCMTLRenderPass::initialize(const RenderPassInfo &info) { _mtlRenderPassDescriptor.depthAttachment.storeAction = mu::toMTLStoreAction(_depthStencilAttachment.depthStoreOp); _mtlRenderPassDescriptor.stencilAttachment.loadAction = mu::toMTLLoadAction(_depthStencilAttachment.stencilLoadOp); _mtlRenderPassDescriptor.stencilAttachment.storeAction = mu::toMTLStoreAction(_depthStencilAttachment.stencilStoreOp); - - _hash = computeHash(); - - return true; } -void CCMTLRenderPass::destroy() { +void CCMTLRenderPass::doDestroy() { if (_mtlRenderPassDescriptor) { [_mtlRenderPassDescriptor release]; _mtlRenderPassDescriptor = nil; diff --git a/native/cocos/renderer/gfx-metal/MTLSampler.h b/native/cocos/renderer/gfx-metal/MTLSampler.h index 14fd79248b..bb7f87cf9a 100644 --- a/native/cocos/renderer/gfx-metal/MTLSampler.h +++ b/native/cocos/renderer/gfx-metal/MTLSampler.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXSampler.h" + #import namespace cc { @@ -30,19 +34,19 @@ namespace gfx { class CCMTLSampler final : public Sampler { public: - explicit CCMTLSampler(Device *device); + explicit CCMTLSampler(); ~CCMTLSampler() override = default; CCMTLSampler(const CCMTLSampler &)=delete; CCMTLSampler(CCMTLSampler &&)=delete; CCMTLSampler &operator=(const CCMTLSampler &)=delete; CCMTLSampler &operator=(CCMTLSampler &&)=delete; - bool initialize(const SamplerInfo &info) override; - void destroy() override; - CC_INLINE id getMTLSamplerState() const { return _mtlSamplerState; } -private: +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; + id _mtlSamplerState = nil; }; diff --git a/native/cocos/renderer/gfx-metal/MTLSampler.mm b/native/cocos/renderer/gfx-metal/MTLSampler.mm index 4fd386a5a0..7b887b6c6e 100644 --- a/native/cocos/renderer/gfx-metal/MTLSampler.mm +++ b/native/cocos/renderer/gfx-metal/MTLSampler.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDevice.h" @@ -32,22 +34,9 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLSampler::CCMTLSampler(Device *device) : Sampler(device) {} - -bool CCMTLSampler::initialize(const SamplerInfo &info) { - _minFilter = info.minFilter; - _magFilter = info.magFilter; - _mipFilter = info.mipFilter; - _addressU = info.addressU; - _addressV = info.addressV; - _addressW = info.addressW; - _maxAnisotropy = info.maxAnisotropy; - _cmpFunc = info.cmpFunc; - _borderColor = info.borderColor; - _minLOD = info.minLOD; - _maxLOD = info.maxLOD; - _mipLODBias = info.mipLODBias; +CCMTLSampler::CCMTLSampler() : Sampler() {} +void CCMTLSampler::doInit(const SamplerInfo &info) { MTLSamplerDescriptor *descriptor = [[MTLSamplerDescriptor alloc] init]; #if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) descriptor.borderColor = (MTLSamplerBorderColor)mu::toMTLSamplerBorderColor(_borderColor); @@ -59,21 +48,17 @@ bool CCMTLSampler::initialize(const SamplerInfo &info) { descriptor.magFilter = mu::toMTLSamplerMinMagFilter(_magFilter); descriptor.mipFilter = mu::toMTLSamplerMipFilter(_mipFilter); descriptor.maxAnisotropy = _maxAnisotropy == 0 ? 1 : _maxAnisotropy; - descriptor.lodMinClamp = _minLOD; - descriptor.lodMaxClamp = _maxLOD; - if (static_cast(_device)->isSamplerDescriptorCompareFunctionSupported()) { + if (CCMTLDevice::getInstance()->isSamplerDescriptorCompareFunctionSupported()) { descriptor.compareFunction = mu::toMTLCompareFunction(_cmpFunc); } - id mtlDevice = id(static_cast(_device)->getMTLDevice()); + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); _mtlSamplerState = [mtlDevice newSamplerStateWithDescriptor:descriptor]; [descriptor release]; - - return _mtlSamplerState != nil; } -void CCMTLSampler::destroy() { +void CCMTLSampler::doDestroy() { id samplerState = _mtlSamplerState; _mtlSamplerState = nil; diff --git a/native/cocos/renderer/gfx-metal/MTLSemaphore.h b/native/cocos/renderer/gfx-metal/MTLSemaphore.h index 6ffb21b2e2..8222071342 100644 --- a/native/cocos/renderer/gfx-metal/MTLSemaphore.h +++ b/native/cocos/renderer/gfx-metal/MTLSemaphore.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include @@ -38,11 +40,11 @@ public: CCMTLSemaphore(CCMTLSemaphore &&) = delete; CCMTLSemaphore &operator=(const CCMTLSemaphore &) = delete; CCMTLSemaphore &operator=(CCMTLSemaphore &&) = delete; - + void signal() const { dispatch_semaphore_signal(_semaphore); } - + void wait() const { dispatch_semaphore_wait(_semaphore, DISPATCH_TIME_FOREVER); } @@ -53,7 +55,7 @@ public: } } -private: +protected: dispatch_semaphore_t _semaphore = nullptr; uint _semaphoreCount = 0; }; diff --git a/native/cocos/renderer/gfx-metal/MTLShader.h b/native/cocos/renderer/gfx-metal/MTLShader.h index f1650231e5..6ea374baa8 100644 --- a/native/cocos/renderer/gfx-metal/MTLShader.h +++ b/native/cocos/renderer/gfx-metal/MTLShader.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXShader.h" + #import namespace cc { @@ -30,18 +34,16 @@ namespace gfx { class CCMTLGPUShader; class CCMTLShader final : public Shader { public: - explicit CCMTLShader(Device *device); + explicit CCMTLShader(); ~CCMTLShader() override = default; CCMTLShader(const CCMTLShader &)=delete; CCMTLShader(CCMTLShader &&)=delete; CCMTLShader &operator=(const CCMTLShader &)=delete; CCMTLShader &operator=(CCMTLShader &&)=delete; - bool initialize(const ShaderInfo &info) override; - void destroy() override; - CC_INLINE id getVertMTLFunction() const { return _vertexMTLFunction; } CC_INLINE id getFragmentMTLFunction() const { return _fragmentMTLFunction; } + CC_INLINE id getComputeMTLFunction() const { return _computeMTLFunction; } CC_INLINE const unordered_map &getFragmentSamplerBindings() const { return _mtlFragmentSamplerBindings; } CC_INLINE const CCMTLGPUShader *gpuShader() const { return _gpuShader; } @@ -52,15 +54,20 @@ public: CC_INLINE const String &getVertMtlSahder() const { return _vertMtlShader; } CC_INLINE const String &getFragGlslShader() const { return _fragGlslShader; } CC_INLINE const String &getFragMtlSahder() const { return _fragMtlShader; } + CC_INLINE const String &getcompGlslShader() const { return _cmptGlslShader; } + CC_INLINE const String &getcompMtlSahder() const { return _cmptMtlShader; } #endif -private: +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; + bool createMTLFunction(const ShaderStage &); void setAvailableBufferBindingIndex(); -private: id _vertexMTLFunction = nil; id _fragmentMTLFunction = nil; + id _computeMTLFunction = nil; unordered_map _mtlFragmentSamplerBindings; vector _availableVertexBufferBindingIndex; vector _availableFragmentBufferBindingIndex; @@ -73,6 +80,8 @@ private: String _vertMtlShader; String _fragGlslShader; String _fragMtlShader; + String _cmptGlslShader; + String _cmptMtlShader; #endif }; diff --git a/native/cocos/renderer/gfx-metal/MTLShader.mm b/native/cocos/renderer/gfx-metal/MTLShader.mm index 0e38500b8f..ed6d62235c 100644 --- a/native/cocos/renderer/gfx-metal/MTLShader.mm +++ b/native/cocos/renderer/gfx-metal/MTLShader.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDevice.h" @@ -31,35 +33,30 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLShader::CCMTLShader(Device *device) : Shader(device) {} - -bool CCMTLShader::initialize(const ShaderInfo &info) { - _name = info.name; - _stages = info.stages; - _attributes = info.attributes; - _blocks = info.blocks; - _samplers = info.samplers; +CCMTLShader::CCMTLShader() : Shader() {} +void CCMTLShader::doInit(const ShaderInfo &info) { _gpuShader = CC_NEW(CCMTLGPUShader); for (const auto &stage : _stages) { if (!createMTLFunction(stage)) { destroy(); - return false; + return; } } setAvailableBufferBindingIndex(); CC_LOG_INFO("%s compile succeed.", _name.c_str()); - return true; } -void CCMTLShader::destroy() { +void CCMTLShader::doDestroy() { id vertFunc = _vertexMTLFunction; - _vertexMTLFunction = nil; + _vertexMTLFunction = nil; id fragFunc = _fragmentMTLFunction; - _fragmentMTLFunction = nil; + _fragmentMTLFunction = nil; + id cmptFunc = _computeMTLFunction; + _computeMTLFunction = nil; CC_SAFE_DELETE(_gpuShader); @@ -70,44 +67,70 @@ void CCMTLShader::destroy() { if (fragFunc) { [fragFunc release]; } + if (cmptFunc) { + [cmptFunc release]; + } }; CCMTLGPUGarbageCollectionPool::getInstance()->collect(destroyFunc); } bool CCMTLShader::createMTLFunction(const ShaderStage &stage) { - bool isVertexShader = stage.stage == ShaderStageFlagBit::VERTEX; - id mtlDevice = id(static_cast(_device)->getMTLDevice()); + bool isVertexShader = false; + bool isFragmentShader = false; + bool isComputeShader = false; + + if (stage.stage == ShaderStageFlagBit::VERTEX) { + isVertexShader = true; + } else if (stage.stage == ShaderStageFlagBit::FRAGMENT) { + isFragmentShader = true; + } else if (stage.stage == ShaderStageFlagBit::COMPUTE) { + isComputeShader = true; + } + + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); + auto mtlShader = mu::compileGLSLShader2Msl(stage.source, stage.stage, - _device, + CCMTLDevice::getInstance(), _gpuShader); - NSString *shader = [NSString stringWithUTF8String:mtlShader.c_str()]; - NSError *error = nil; + NSString * shader = [NSString stringWithUTF8String:mtlShader.c_str()]; + NSError * error = nil; id library = [mtlDevice newLibraryWithSource:shader options:nil error:&error]; if (!library) { - CC_LOG_ERROR("Can not compile %s shader: %s", isVertexShader ? "vertex" : "fragment", - [error.localizedFailureReason UTF8String]); + CC_LOG_ERROR("Can not compile %s shader: %s", isVertexShader ? "vertex" : isFragmentShader ? "fragment" + : "compute", + [[error localizedDescription] UTF8String]); CC_LOG_ERROR("%s", stage.source.c_str()); return false; } - if (stage.stage == ShaderStageFlagBit::VERTEX) { + if (isVertexShader) { _vertexMTLFunction = [library newFunctionWithName:@"main0"]; if (!_vertexMTLFunction) { [library release]; CC_LOG_ERROR("Can not create vertex function: main0"); return false; } - } else { + } else if (isFragmentShader) { _fragmentMTLFunction = [library newFunctionWithName:@"main0"]; if (!_fragmentMTLFunction) { [library release]; CC_LOG_ERROR("Can not create fragment function: main0"); return false; } + } else if (isComputeShader) { + _computeMTLFunction = [library newFunctionWithName:@"main0"]; + if (!_computeMTLFunction) { + [library release]; + CC_LOG_ERROR("Can not create compute function: main0"); + return false; + } + } else { + CC_LOG_ERROR("Shader type not supported yet!"); + return false; } [library release]; @@ -115,21 +138,24 @@ bool CCMTLShader::createMTLFunction(const ShaderStage &stage) { #ifdef DEBUG_SHADER if (isVertexShader) { _vertGlslShader = stage.source; - _vertMtlShader = mtlShader; - } else { + _vertMtlShader = mtlShader; + } else if (isFragmenShader) { _fragGlslShader = stage.source; - _fragMtlShader = mtlShader; + _fragMtlShader = mtlShader; + } else if (isComputeShader) { + _cmptGlslShader = stage.source; + _cmptMtlShader = mtlShader; } #endif return true; } uint CCMTLShader::getAvailableBufferBindingIndex(ShaderStageFlagBit stage, uint stream) { - if (stage & ShaderStageFlagBit::VERTEX) { + if (hasFlag(stage, ShaderStageFlagBit::VERTEX)) { return _availableVertexBufferBindingIndex.at(stream); } - if (stage & ShaderStageFlagBit::FRAGMENT) { + if (hasFlag(stage, ShaderStageFlagBit::FRAGMENT)) { return _availableFragmentBufferBindingIndex.at(stream); } @@ -138,27 +164,27 @@ uint CCMTLShader::getAvailableBufferBindingIndex(ShaderStageFlagBit stage, uint } void CCMTLShader::setAvailableBufferBindingIndex() { - uint usedVertexBufferBindingIndexes = 0; + uint usedVertexBufferBindingIndexes = 0; uint usedFragmentBufferBindingIndexes = 0; - uint vertexBindingCount = 0; - uint fragmentBindingCount = 0; + uint vertexBindingCount = 0; + uint fragmentBindingCount = 0; for (const auto &block : _gpuShader->blocks) { - if (block.second.stages & ShaderStageFlagBit::VERTEX) { + if (hasFlag(block.second.stages, ShaderStageFlagBit::VERTEX)) { vertexBindingCount++; usedVertexBufferBindingIndexes |= 1 << block.second.mappedBinding; } - if (block.second.stages & ShaderStageFlagBit::FRAGMENT) { + if (hasFlag(block.second.stages, ShaderStageFlagBit::FRAGMENT)) { fragmentBindingCount++; usedFragmentBufferBindingIndexes |= 1 << block.second.mappedBinding; } } - auto maxBufferBindingIndex = static_cast(_device)->getMaximumBufferBindingIndex(); + auto maxBufferBindingIndex = CCMTLDevice::getInstance()->getMaximumBufferBindingIndex(); _availableVertexBufferBindingIndex.resize(maxBufferBindingIndex - vertexBindingCount); _availableFragmentBufferBindingIndex.resize(maxBufferBindingIndex - fragmentBindingCount); - uint availableVertexBufferBit = ~usedVertexBufferBindingIndexes; + uint availableVertexBufferBit = ~usedVertexBufferBindingIndexes; uint availableFragmentBufferBit = ~usedFragmentBufferBindingIndexes; - int theBit = maxBufferBindingIndex - 1; + int theBit = maxBufferBindingIndex - 1; uint i = 0, j = 0; for (; theBit >= 0; theBit--) { if ((availableVertexBufferBit & (1 << theBit))) { diff --git a/native/cocos/renderer/gfx-metal/MTLStd.cpp b/native/cocos/renderer/gfx-metal/MTLStd.cpp index 27fcd56474..aaf694197e 100644 --- a/native/cocos/renderer/gfx-metal/MTLStd.cpp +++ b/native/cocos/renderer/gfx-metal/MTLStd.cpp @@ -1,24 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" diff --git a/native/cocos/renderer/gfx-metal/MTLStd.h b/native/cocos/renderer/gfx-metal/MTLStd.h index efef6e62c4..4c4a92a5a1 100644 --- a/native/cocos/renderer/gfx-metal/MTLStd.h +++ b/native/cocos/renderer/gfx-metal/MTLStd.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include +#include "base/CoreStd.h" diff --git a/native/cocos/renderer/gfx-metal/MTLTexture.h b/native/cocos/renderer/gfx-metal/MTLTexture.h index 32872c0dc9..060bedb34c 100644 --- a/native/cocos/renderer/gfx-metal/MTLTexture.h +++ b/native/cocos/renderer/gfx-metal/MTLTexture.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once +#include "gfx-base/GFXTexture.h" + #import namespace cc { @@ -30,27 +34,26 @@ namespace gfx { class CCMTLTexture final : public Texture { public: - explicit CCMTLTexture(Device *device); + explicit CCMTLTexture(); ~CCMTLTexture() override = default; CCMTLTexture(const CCMTLTexture &) = delete; CCMTLTexture(CCMTLTexture &&) = delete; CCMTLTexture &operator=(const CCMTLTexture &) = delete; CCMTLTexture &operator=(CCMTLTexture &&) = delete; - bool initialize(const TextureInfo &info) override; - bool initialize(const TextureViewInfo &info) override; - void destroy() override; - void resize(uint width, uint height) override; - CC_INLINE id getMTLTexture() const { return _mtlTexture; } CC_INLINE Format getConvertedFormat() const { return _convertedFormat; } CC_INLINE bool isArray() const { return _isArray; } CC_INLINE bool isPVRTC() const { return _isPVRTC; } -private: +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; + bool createMTLTexture(); -private: id _mtlTexture = nil; Format _convertedFormat = Format::UNKNOWN; bool _isArray = false; diff --git a/native/cocos/renderer/gfx-metal/MTLTexture.mm b/native/cocos/renderer/gfx-metal/MTLTexture.mm index 79d2c4fe44..b51afb0873 100644 --- a/native/cocos/renderer/gfx-metal/MTLTexture.mm +++ b/native/cocos/renderer/gfx-metal/MTLTexture.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLDevice.h" @@ -31,20 +33,9 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCMTLTexture::CCMTLTexture(Device *device) : Texture(device) {} +CCMTLTexture::CCMTLTexture() : Texture() {} -bool CCMTLTexture::initialize(const TextureInfo &info) { - _type = info.type; - _usage = info.usage; - _format = info.format; - _width = info.width; - _height = info.height; - _depth = info.depth; - _layerCount = info.layerCount; - _levelCount = info.levelCount; - _samples = info.samples; - _flags = info.flags; - _size = FormatSize(_format, _width, _height, _depth); +void CCMTLTexture::doInit(const TextureInfo &info) { _isArray = _type == TextureType::TEX1D_ARRAY || _type == TextureType::TEX2D_ARRAY; if (_format == Format::PVRTC_RGB2 || _format == Format::PVRTC_RGBA2 || @@ -55,77 +46,13 @@ bool CCMTLTexture::initialize(const TextureInfo &info) { _isPVRTC = true; } -#if CC_DEBUG > 0 - switch (_format) { // device feature validation - case Format::D16: - if (_device->hasFeature(Feature::FORMAT_D16)) break; - CC_LOG_ERROR("D16 texture format is not supported on this backend"); - return false; - case Format::D16S8: - if (_device->hasFeature(Feature::FORMAT_D16S8)) break; - CC_LOG_WARNING("D16S8 texture format is not supported on this backend"); - return false; - case Format::D24: - if (_device->hasFeature(Feature::FORMAT_D24)) break; - CC_LOG_WARNING("D24 texture format is not supported on this backend"); - return false; - case Format::D24S8: - if (_device->hasFeature(Feature::FORMAT_D24S8)) break; - CC_LOG_WARNING("D24S8 texture format is not supported on this backend"); - return false; - case Format::D32F: - if (_device->hasFeature(Feature::FORMAT_D32F)) break; - CC_LOG_WARNING("D32F texture format is not supported on this backend"); - return false; - case Format::D32F_S8: - if (_device->hasFeature(Feature::FORMAT_D32FS8)) break; - CC_LOG_WARNING("D32FS8 texture format is not supported on this backend"); - return false; - case Format::RGB8: - if (_device->hasFeature(Feature::FORMAT_RGB8)) break; - CC_LOG_WARNING("RGB8 texture format is not supported on this backend"); - return false; - default: - break; - } -#endif - - if (_flags & TextureFlags::BAKUP_BUFFER) { - _buffer = (uint8_t *)CC_MALLOC(_size); - if (!_buffer) { - CC_LOG_ERROR("CCMTLTexture: CC_MALLOC backup buffer failed."); - return false; - } - _device->getMemoryStatus().textureSize += _size; - } - if (!createMTLTexture()) { CC_LOG_ERROR("CCMTLTexture: create MTLTexture failed."); - return false; + return; } - - _device->getMemoryStatus().textureSize += _size; - return true; } -bool CCMTLTexture::initialize(const TextureViewInfo &info) { - _isTextureView = true; - - if (!info.texture) { - return false; - } - - _type = info.type; - _usage = info.texture->getUsage(); - _format = info.format; - _width = info.texture->getWidth(); - _height = info.texture->getHeight(); - _depth = info.texture->getDepth(); - _layerCount = info.texture->getLayerCount(); - _levelCount = info.texture->getLevelCount(); - _samples = info.texture->getSamples(); - _flags = info.texture->getFlags(); - _size = info.texture->getSize(); +void CCMTLTexture::doInit(const TextureViewInfo &info) { _isArray = _type == TextureType::TEX1D_ARRAY || _type == TextureType::TEX2D_ARRAY; if (_format == Format::PVRTC_RGB2 || _format == Format::PVRTC_RGBA2 || @@ -141,11 +68,6 @@ bool CCMTLTexture::initialize(const TextureViewInfo &info) { textureType:mtlTextureType levels:NSMakeRange(info.baseLevel, info.levelCount) slices:NSMakeRange(info.baseLayer, info.layerCount)]; - if (!_mtlTexture) { - return false; - } - - return true; } bool CCMTLTexture::createMTLTexture() { @@ -186,50 +108,37 @@ bool CCMTLTexture::createMTLTexture() { descriptor.textureType = mu::toMTLTextureType(_type); descriptor.sampleCount = mu::toMTLSampleCount(_samples); descriptor.mipmapLevelCount = _levelCount; - descriptor.arrayLength = _flags & TextureFlagBit::CUBEMAP ? 1 : _layerCount; - if (_usage & TextureUsage::COLOR_ATTACHMENT || - _usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT || - _usage & TextureUsage::INPUT_ATTACHMENT || - _usage & TextureUsage::TRANSIENT_ATTACHMENT) { + descriptor.arrayLength = _type == TextureType::CUBE ? 1 : _layerCount; + if (hasFlag(_usage, TextureUsage::COLOR_ATTACHMENT) || + hasFlag(_usage, TextureUsage::DEPTH_STENCIL_ATTACHMENT) || + hasFlag(_usage, TextureUsage::INPUT_ATTACHMENT)) { descriptor.resourceOptions = MTLResourceStorageModePrivate; } - id mtlDevice = id(static_cast(_device)->getMTLDevice()); + id mtlDevice = id(CCMTLDevice::getInstance()->getMTLDevice()); _mtlTexture = [mtlDevice newTextureWithDescriptor:descriptor]; return _mtlTexture != nil; } -void CCMTLTexture::destroy() { +void CCMTLTexture::doDestroy() { if (_isTextureView) { return; } - if (_buffer) { - CC_FREE(_buffer); - _device->getMemoryStatus().textureSize -= _size; - _buffer = nullptr; - } - - Device *device = _device; id mtlTexure = _mtlTexture; _mtlTexture = nil; - uint size = _size; std::function destroyFunc = [=]() { if (mtlTexure) { [mtlTexure release]; - device->getMemoryStatus().textureSize -= size; } }; //gpu object only CCMTLGPUGarbageCollectionPool::getInstance()->collect(destroyFunc); } -void CCMTLTexture::resize(uint width, uint height) { - if (_width == width && _height == height) - return; - +void CCMTLTexture::doResize(uint width, uint height, uint size) { auto oldSize = _size; auto oldWidth = _width; auto oldHeight = _height; @@ -237,7 +146,7 @@ void CCMTLTexture::resize(uint width, uint height) { _width = width; _height = height; - _size = FormatSize(_format, _width, _height, _depth); + _size = size; if (!createMTLTexture()) { _width = oldWidth; _height = oldHeight; @@ -248,32 +157,15 @@ void CCMTLTexture::resize(uint width, uint height) { } if (oldMTLTexture) { - Device *device = _device; std::function destroyFunc = [=]() { if (oldMTLTexture) { [oldMTLTexture release]; - device->getMemoryStatus().bufferSize -= oldSize; } }; //gpu object only CCMTLGPUGarbageCollectionPool::getInstance()->collect(destroyFunc); } - - _device->getMemoryStatus().textureSize -= oldSize; - if (_flags & TextureFlags::BAKUP_BUFFER) { - const uint8_t *oldBuffer = _buffer; - uint8_t *buffer = (uint8_t *)CC_MALLOC(_size); - if (!buffer) { - CC_LOG_ERROR("CCMTLTexture: CC_MALLOC backup buffer failed when try to resize the texture."); - return; - } - CC_FREE(oldBuffer); - _buffer = buffer; - _device->getMemoryStatus().textureSize -= oldSize; - _device->getMemoryStatus().textureSize += _size; - } - - _device->getMemoryStatus().textureSize += _size; } + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-metal/MTLUtils.h b/native/cocos/renderer/gfx-metal/MTLUtils.h index 9a6fb818b0..5282401f73 100644 --- a/native/cocos/renderer/gfx-metal/MTLUtils.h +++ b/native/cocos/renderer/gfx-metal/MTLUtils.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #import @@ -30,6 +32,7 @@ THE SOFTWARE. #import #import #include +#include "gfx-base/GFXDef.h" namespace cc { namespace gfx { @@ -76,6 +79,7 @@ uint getMaxTexture2DWidthHeight(uint family); uint getMaxCubeMapTextureWidthHeight(uint family); uint getMaxColorRenderTarget(uint family); uint getMinBufferOffsetAlignment(uint family); +uint getMaxThreadsPerGroup(uint family); bool isPVRTCSuppported(uint family); bool isEAC_ETCCSuppported(uint family); bool isASTCSuppported(uint family); diff --git a/native/cocos/renderer/gfx-metal/MTLUtils.mm b/native/cocos/renderer/gfx-metal/MTLUtils.mm index 8b3e5c22ba..542bb3e24a 100644 --- a/native/cocos/renderer/gfx-metal/MTLUtils.mm +++ b/native/cocos/renderer/gfx-metal/MTLUtils.mm @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2019-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "MTLStd.h" #include "MTLUtils.h" @@ -321,34 +323,34 @@ GPUFamily getMacGPUFamily(MTLFeatureSet featureSet) { bool isASTCFormat(Format format) { switch (format) { - case Format::ASTC_RGBA_4x4: - case Format::ASTC_SRGBA_4x4: - case Format::ASTC_RGBA_5x4: - case Format::ASTC_SRGBA_5x4: - case Format::ASTC_RGBA_5x5: - case Format::ASTC_SRGBA_5x5: - case Format::ASTC_RGBA_6x5: - case Format::ASTC_SRGBA_6x5: - case Format::ASTC_RGBA_6x6: - case Format::ASTC_SRGBA_6x6: - case Format::ASTC_RGBA_8x5: - case Format::ASTC_SRGBA_8x5: - case Format::ASTC_RGBA_8x6: - case Format::ASTC_SRGBA_8x6: - case Format::ASTC_RGBA_8x8: - case Format::ASTC_SRGBA_8x8: - case Format::ASTC_RGBA_10x5: - case Format::ASTC_SRGBA_10x5: - case Format::ASTC_RGBA_10x6: - case Format::ASTC_SRGBA_10x6: - case Format::ASTC_RGBA_10x8: - case Format::ASTC_SRGBA_10x8: - case Format::ASTC_RGBA_10x10: - case Format::ASTC_SRGBA_10x10: - case Format::ASTC_RGBA_12x10: - case Format::ASTC_SRGBA_12x10: - case Format::ASTC_RGBA_12x12: - case Format::ASTC_SRGBA_12x12: + case Format::ASTC_RGBA_4X4: + case Format::ASTC_SRGBA_4X4: + case Format::ASTC_RGBA_5X4: + case Format::ASTC_SRGBA_5X4: + case Format::ASTC_RGBA_5X5: + case Format::ASTC_SRGBA_5X5: + case Format::ASTC_RGBA_6X5: + case Format::ASTC_SRGBA_6X5: + case Format::ASTC_RGBA_6X6: + case Format::ASTC_SRGBA_6X6: + case Format::ASTC_RGBA_8X5: + case Format::ASTC_SRGBA_8X5: + case Format::ASTC_RGBA_8X6: + case Format::ASTC_SRGBA_8X6: + case Format::ASTC_RGBA_8X8: + case Format::ASTC_SRGBA_8X8: + case Format::ASTC_RGBA_10X5: + case Format::ASTC_SRGBA_10X5: + case Format::ASTC_RGBA_10X6: + case Format::ASTC_SRGBA_10X6: + case Format::ASTC_RGBA_10X8: + case Format::ASTC_SRGBA_10X8: + case Format::ASTC_RGBA_10X10: + case Format::ASTC_SRGBA_10X10: + case Format::ASTC_RGBA_12X10: + case Format::ASTC_SRGBA_12X10: + case Format::ASTC_RGBA_12X12: + case Format::ASTC_SRGBA_12X12: return true; default: return false; @@ -420,7 +422,7 @@ CCMTLGPUPipelineState *getClearRenderPassPipelineState(CCMTLDevice *device, Rend MTLResourceOptions mu::toMTLResourceOption(MemoryUsage usage) { if (usage & MemoryUsage::HOST && usage & MemoryUsage::DEVICE) return MTLResourceStorageModeShared; - else if (usage & MemoryUsage::DEVICE) + else if (hasFlag(usage, MemoryUsage::DEVICE)) return MTLResourceStorageModePrivate; else #if (CC_PLATFORM == CC_PLATFORM_MAC_IOS) @@ -588,35 +590,35 @@ MTLPixelFormat mu::toMTLPixelFormat(Format format) { case Format::BC3: return MTLPixelFormatBC3_RGBA; case Format::BC3_SRGB: return MTLPixelFormatBC3_RGBA_sRGB; #else - case Format::ASTC_RGBA_4x4: return MTLPixelFormatASTC_4x4_LDR; - case Format::ASTC_RGBA_5x4: return MTLPixelFormatASTC_5x4_LDR; - case Format::ASTC_RGBA_5x5: return MTLPixelFormatASTC_5x5_LDR; - case Format::ASTC_RGBA_6x5: return MTLPixelFormatASTC_6x5_LDR; - case Format::ASTC_RGBA_6x6: return MTLPixelFormatASTC_6x6_LDR; - case Format::ASTC_RGBA_8x5: return MTLPixelFormatASTC_8x5_LDR; - case Format::ASTC_RGBA_8x6: return MTLPixelFormatASTC_8x6_LDR; - case Format::ASTC_RGBA_8x8: return MTLPixelFormatASTC_8x8_LDR; - case Format::ASTC_RGBA_10x5: return MTLPixelFormatASTC_10x5_LDR; - case Format::ASTC_RGBA_10x6: return MTLPixelFormatASTC_10x6_LDR; - case Format::ASTC_RGBA_10x8: return MTLPixelFormatASTC_10x8_LDR; - case Format::ASTC_RGBA_10x10: return MTLPixelFormatASTC_10x10_LDR; - case Format::ASTC_RGBA_12x10: return MTLPixelFormatASTC_12x10_LDR; - case Format::ASTC_RGBA_12x12: return MTLPixelFormatASTC_12x12_LDR; + case Format::ASTC_RGBA_4X4: return MTLPixelFormatASTC_4x4_LDR; + case Format::ASTC_RGBA_5X4: return MTLPixelFormatASTC_5x4_LDR; + case Format::ASTC_RGBA_5X5: return MTLPixelFormatASTC_5x5_LDR; + case Format::ASTC_RGBA_6X5: return MTLPixelFormatASTC_6x5_LDR; + case Format::ASTC_RGBA_6X6: return MTLPixelFormatASTC_6x6_LDR; + case Format::ASTC_RGBA_8X5: return MTLPixelFormatASTC_8x5_LDR; + case Format::ASTC_RGBA_8X6: return MTLPixelFormatASTC_8x6_LDR; + case Format::ASTC_RGBA_8X8: return MTLPixelFormatASTC_8x8_LDR; + case Format::ASTC_RGBA_10X5: return MTLPixelFormatASTC_10x5_LDR; + case Format::ASTC_RGBA_10X6: return MTLPixelFormatASTC_10x6_LDR; + case Format::ASTC_RGBA_10X8: return MTLPixelFormatASTC_10x8_LDR; + case Format::ASTC_RGBA_10X10: return MTLPixelFormatASTC_10x10_LDR; + case Format::ASTC_RGBA_12X10: return MTLPixelFormatASTC_12x10_LDR; + case Format::ASTC_RGBA_12X12: return MTLPixelFormatASTC_12x12_LDR; - case Format::ASTC_SRGBA_4x4: return MTLPixelFormatASTC_4x4_sRGB; - case Format::ASTC_SRGBA_5x4: return MTLPixelFormatASTC_5x4_sRGB; - case Format::ASTC_SRGBA_5x5: return MTLPixelFormatASTC_5x5_sRGB; - case Format::ASTC_SRGBA_6x5: return MTLPixelFormatASTC_6x5_sRGB; - case Format::ASTC_SRGBA_6x6: return MTLPixelFormatASTC_6x6_sRGB; - case Format::ASTC_SRGBA_8x5: return MTLPixelFormatASTC_8x5_sRGB; - case Format::ASTC_SRGBA_8x6: return MTLPixelFormatASTC_8x6_sRGB; - case Format::ASTC_SRGBA_8x8: return MTLPixelFormatASTC_8x8_sRGB; - case Format::ASTC_SRGBA_10x5: return MTLPixelFormatASTC_10x5_sRGB; - case Format::ASTC_SRGBA_10x6: return MTLPixelFormatASTC_10x6_sRGB; - case Format::ASTC_SRGBA_10x8: return MTLPixelFormatASTC_10x8_sRGB; - case Format::ASTC_SRGBA_10x10: return MTLPixelFormatASTC_10x10_sRGB; - case Format::ASTC_SRGBA_12x10: return MTLPixelFormatASTC_12x10_sRGB; - case Format::ASTC_SRGBA_12x12: return MTLPixelFormatASTC_12x12_sRGB; + case Format::ASTC_SRGBA_4X4: return MTLPixelFormatASTC_4x4_sRGB; + case Format::ASTC_SRGBA_5X4: return MTLPixelFormatASTC_5x4_sRGB; + case Format::ASTC_SRGBA_5X5: return MTLPixelFormatASTC_5x5_sRGB; + case Format::ASTC_SRGBA_6X5: return MTLPixelFormatASTC_6x5_sRGB; + case Format::ASTC_SRGBA_6X6: return MTLPixelFormatASTC_6x6_sRGB; + case Format::ASTC_SRGBA_8X5: return MTLPixelFormatASTC_8x5_sRGB; + case Format::ASTC_SRGBA_8X6: return MTLPixelFormatASTC_8x6_sRGB; + case Format::ASTC_SRGBA_8X8: return MTLPixelFormatASTC_8x8_sRGB; + case Format::ASTC_SRGBA_10X5: return MTLPixelFormatASTC_10x5_sRGB; + case Format::ASTC_SRGBA_10X6: return MTLPixelFormatASTC_10x6_sRGB; + case Format::ASTC_SRGBA_10X8: return MTLPixelFormatASTC_10x8_sRGB; + case Format::ASTC_SRGBA_10X10: return MTLPixelFormatASTC_10x10_sRGB; + case Format::ASTC_SRGBA_12X10: return MTLPixelFormatASTC_12x10_sRGB; + case Format::ASTC_SRGBA_12X12: return MTLPixelFormatASTC_12x12_sRGB; case Format::ETC2_RGB8: return MTLPixelFormatETC2_RGB8; case Format::ETC2_SRGB8: return MTLPixelFormatETC2_RGB8_sRGB; @@ -788,18 +790,17 @@ MTLTextureUsage mu::toMTLTextureUsage(TextureUsage usage) { return MTLTextureUsageUnknown; MTLTextureUsage ret = MTLTextureUsageUnknown; - if (usage & TextureUsage::TRANSFER_SRC) - ret |= MTLTextureUsageShaderRead; - if (usage & TextureUsage::TRANSFER_DST) + if (hasFlag(usage, TextureUsage::TRANSFER_SRC)) + ret |= MTLTextureUsageShaderRead | MTLTextureUsagePixelFormatView; + if (hasFlag(usage, TextureUsage::TRANSFER_DST)) ret |= MTLTextureUsageShaderWrite; - if (usage & TextureUsage::SAMPLED) + if (hasFlag(usage, TextureUsage::SAMPLED)) ret |= MTLTextureUsageShaderRead; - if (usage & TextureUsage::STORAGE) + if (hasFlag(usage, TextureUsage::STORAGE)) ret |= MTLTextureUsageShaderWrite; - if (usage & TextureUsage::COLOR_ATTACHMENT || - usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT || - usage & TextureUsage::TRANSIENT_ATTACHMENT || - usage & TextureUsage::INPUT_ATTACHMENT) { + if (hasFlag(usage, TextureUsage::COLOR_ATTACHMENT) || + hasFlag(usage, TextureUsage::DEPTH_STENCIL_ATTACHMENT) || + hasFlag(usage, TextureUsage::INPUT_ATTACHMENT)) { ret |= MTLTextureUsageRenderTarget; } @@ -879,7 +880,7 @@ String mu::compileGLSLShader2Msl(const String &src, Device *device, CCMTLGPUShader *gpuShader) { #if CC_USE_METAL - String shaderSource("#version 310 es\n"); + String shaderSource("#version 460\n"); shaderSource.append(src); const auto &spv = GLSL2SPIRV(shaderType, shaderSource); if (spv.size() == 0) @@ -895,6 +896,7 @@ String mu::compileGLSLShader2Msl(const String &src, spirv_cross::ShaderResources resources = msl.get_shader_resources(active); msl.set_enabled_interface_variables(std::move(active)); + // TODO: bindings from shader just kind of validation, cannot be directly input // Get all uniform buffers in the shader. uint maxBufferBindingIndex = static_cast(device)->getMaximumBufferBindingIndex(); const auto &bufferBindingOffset = device->bindingMappingInfo().bufferOffsets; @@ -921,6 +923,29 @@ String mu::compileGLSLShader2Msl(const String &src, } } + for (const auto &ubo : resources.storage_buffers) { + auto set = msl.get_decoration(ubo.id, spv::DecorationDescriptorSet); + auto binding = msl.get_decoration(ubo.id, spv::DecorationBinding); + auto size = msl.get_declared_struct_size(msl.get_type(ubo.base_type_id)); + + if (binding >= maxBufferBindingIndex) { + CC_LOG_ERROR("Implementation limits: %s binding at %d, should not use more than %d entries in the buffer argument table", ubo.name.c_str(), binding, maxBufferBindingIndex); + } + auto mappedBinding = binding + bufferBindingOffset[set]; + newBinding.desc_set = set; + newBinding.binding = binding; + newBinding.msl_buffer = mappedBinding; + newBinding.msl_texture = 0; + newBinding.msl_sampler = 0; + msl.add_msl_resource_binding(newBinding); + + if (gpuShader->blocks.find(mappedBinding) == gpuShader->blocks.end()) + gpuShader->blocks[mappedBinding] = {ubo.name, set, binding, mappedBinding, shaderType, size}; + else { + gpuShader->blocks[mappedBinding].stages |= shaderType; + } + } + //TODO: coulsonwang, need to set sampler binding explicitly if (resources.sampled_images.size() > static_cast(device)->getMaximumSamplerUnits()) { CC_LOG_ERROR("Implementation limits: Should not use more than %d entries in the sampler state argument table", static_cast(device)->getMaximumSamplerUnits()); @@ -933,7 +958,7 @@ String mu::compileGLSLShader2Msl(const String &src, for (const auto &sampler : resources.sampled_images) { auto set = msl.get_decoration(sampler.id, spv::DecorationDescriptorSet); auto binding = msl.get_decoration(sampler.id, spv::DecorationBinding); - int size = 1, s = -1; + int size = 1; const spirv_cross::SPIRType &type = msl.get_type(sampler.type_id); if (type.array_size_literal[0]) { size = type.array[0]; @@ -957,7 +982,6 @@ String mu::compileGLSLShader2Msl(const String &src, samplerIndex++; } } - // Set some options. spirv_cross::CompilerMSL::Options options; // options.set_msl_version(2, 0); @@ -1153,6 +1177,21 @@ uint mu::getMaxCubeMapTextureWidthHeight(uint family) { } } +uint mu::getMaxThreadsPerGroup(uint family) { + switch (static_cast(family)) { + case GPUFamily::Apple1: + case GPUFamily::Apple2: + case GPUFamily::Apple3: + return 512; + case GPUFamily::Apple4: + case GPUFamily::Apple5: + case GPUFamily::Apple6: + case GPUFamily::Mac1: + case GPUFamily::Mac2: + return 1024; + } +} + uint mu::getMaxColorRenderTarget(uint family) { switch (static_cast(family)) { case GPUFamily::Apple1: @@ -1385,34 +1424,34 @@ const uint8_t *const mu::convertData(const uint8_t *source, uint length, Format uint mu::getBlockSize(Format format) { switch (format) { - case Format::ASTC_RGBA_4x4: - case Format::ASTC_SRGBA_4x4: - case Format::ASTC_RGBA_5x4: - case Format::ASTC_SRGBA_5x4: - case Format::ASTC_RGBA_5x5: - case Format::ASTC_SRGBA_5x5: - case Format::ASTC_RGBA_6x5: - case Format::ASTC_SRGBA_6x5: - case Format::ASTC_RGBA_6x6: - case Format::ASTC_SRGBA_6x6: - case Format::ASTC_RGBA_8x5: - case Format::ASTC_SRGBA_8x5: - case Format::ASTC_RGBA_8x6: - case Format::ASTC_SRGBA_8x6: - case Format::ASTC_RGBA_8x8: - case Format::ASTC_SRGBA_8x8: - case Format::ASTC_RGBA_10x5: - case Format::ASTC_SRGBA_10x5: - case Format::ASTC_RGBA_10x6: - case Format::ASTC_SRGBA_10x6: - case Format::ASTC_RGBA_10x8: - case Format::ASTC_SRGBA_10x8: - case Format::ASTC_RGBA_10x10: - case Format::ASTC_SRGBA_10x10: - case Format::ASTC_RGBA_12x10: - case Format::ASTC_SRGBA_12x10: - case Format::ASTC_RGBA_12x12: - case Format::ASTC_SRGBA_12x12: + case Format::ASTC_RGBA_4X4: + case Format::ASTC_SRGBA_4X4: + case Format::ASTC_RGBA_5X4: + case Format::ASTC_SRGBA_5X4: + case Format::ASTC_RGBA_5X5: + case Format::ASTC_SRGBA_5X5: + case Format::ASTC_RGBA_6X5: + case Format::ASTC_SRGBA_6X5: + case Format::ASTC_RGBA_6X6: + case Format::ASTC_SRGBA_6X6: + case Format::ASTC_RGBA_8X5: + case Format::ASTC_SRGBA_8X5: + case Format::ASTC_RGBA_8X6: + case Format::ASTC_SRGBA_8X6: + case Format::ASTC_RGBA_8X8: + case Format::ASTC_SRGBA_8X8: + case Format::ASTC_RGBA_10X5: + case Format::ASTC_SRGBA_10X5: + case Format::ASTC_RGBA_10X6: + case Format::ASTC_SRGBA_10X6: + case Format::ASTC_RGBA_10X8: + case Format::ASTC_SRGBA_10X8: + case Format::ASTC_RGBA_10X10: + case Format::ASTC_SRGBA_10X10: + case Format::ASTC_RGBA_12X10: + case Format::ASTC_SRGBA_12X10: + case Format::ASTC_RGBA_12X12: + case Format::ASTC_SRGBA_12X12: return 16u; case Format::PVRTC_RGB2: case Format::PVRTC_RGBA2: @@ -1441,44 +1480,44 @@ uint mu::getBytesPerRow(Format format, uint width) { uint blockSize = getBlockSize(format); uint widthInBlock = 1u; switch (format) { - case Format::ASTC_RGBA_4x4: - case Format::ASTC_SRGBA_4x4: + case Format::ASTC_RGBA_4X4: + case Format::ASTC_SRGBA_4X4: widthInBlock = (width + 3) / 4; break; - case Format::ASTC_RGBA_5x4: - case Format::ASTC_SRGBA_5x4: - case Format::ASTC_RGBA_5x5: - case Format::ASTC_SRGBA_5x5: + case Format::ASTC_RGBA_5X4: + case Format::ASTC_SRGBA_5X4: + case Format::ASTC_RGBA_5X5: + case Format::ASTC_SRGBA_5X5: widthInBlock = (width + 4) / 5; break; - case Format::ASTC_RGBA_6x5: - case Format::ASTC_SRGBA_6x5: - case Format::ASTC_RGBA_6x6: - case Format::ASTC_SRGBA_6x6: + case Format::ASTC_RGBA_6X5: + case Format::ASTC_SRGBA_6X5: + case Format::ASTC_RGBA_6X6: + case Format::ASTC_SRGBA_6X6: widthInBlock = (width + 5) / 6; break; - case Format::ASTC_RGBA_8x5: - case Format::ASTC_SRGBA_8x5: - case Format::ASTC_RGBA_8x6: - case Format::ASTC_SRGBA_8x6: - case Format::ASTC_RGBA_8x8: - case Format::ASTC_SRGBA_8x8: + case Format::ASTC_RGBA_8X5: + case Format::ASTC_SRGBA_8X5: + case Format::ASTC_RGBA_8X6: + case Format::ASTC_SRGBA_8X6: + case Format::ASTC_RGBA_8X8: + case Format::ASTC_SRGBA_8X8: widthInBlock = (width + 7) / 8; break; - case Format::ASTC_RGBA_10x5: - case Format::ASTC_SRGBA_10x5: - case Format::ASTC_RGBA_10x6: - case Format::ASTC_SRGBA_10x6: - case Format::ASTC_RGBA_10x8: - case Format::ASTC_SRGBA_10x8: - case Format::ASTC_RGBA_10x10: - case Format::ASTC_SRGBA_10x10: + case Format::ASTC_RGBA_10X5: + case Format::ASTC_SRGBA_10X5: + case Format::ASTC_RGBA_10X6: + case Format::ASTC_SRGBA_10X6: + case Format::ASTC_RGBA_10X8: + case Format::ASTC_SRGBA_10X8: + case Format::ASTC_RGBA_10X10: + case Format::ASTC_SRGBA_10X10: widthInBlock = (width + 9) / 10; break; - case Format::ASTC_RGBA_12x10: - case Format::ASTC_SRGBA_12x10: - case Format::ASTC_RGBA_12x12: - case Format::ASTC_SRGBA_12x12: + case Format::ASTC_RGBA_12X10: + case Format::ASTC_SRGBA_12X10: + case Format::ASTC_RGBA_12X12: + case Format::ASTC_SRGBA_12X12: widthInBlock = (width + 11) / 12; break; case Format::PVRTC_RGB2: @@ -1520,7 +1559,7 @@ bool mu::pixelFormatIsColorRenderable(Format format) { #endif BOOL is422Format = (pixelFormat == MTLPixelFormatGBGR422 || pixelFormat == MTLPixelFormatBGRG422); - return !isCompressedFormat && !is422Format && (pixelFormat != MTLPixelFormatInvalid); + return !isCompressedFormat && !is422Format && !(pixelFormat == MTLPixelFormatInvalid); } //CompareFunction of MTLSamplerDescriptor is only supported on MTLFeatureSet_iOS_GPUFamily3_v1 and later diff --git a/native/cocos/renderer/gfx-validator/BufferValidator.cpp b/native/cocos/renderer/gfx-validator/BufferValidator.cpp new file mode 100644 index 0000000000..055fd8aa8d --- /dev/null +++ b/native/cocos/renderer/gfx-validator/BufferValidator.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferValidator.h" +#include "DeviceValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +BufferValidator::~BufferValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void BufferValidator::doInit(const BufferInfo &info) { + CCASSERT(info.usage != BufferUsageBit::NONE, "invalid source buffer"); + CCASSERT(info.memUsage != MemoryUsageBit::NONE, "invalid source buffer"); + // CCASSERT(info.size, "zero-sized buffer?"); // be more lenient on this for now + + if (hasFlag(info.usage, BufferUsageBit::VERTEX) && !info.stride) { + CCASSERT(false, "invalid stride for vertex buffer"); + } + + /////////// execute /////////// + + _actor->initialize(info); +} + +void BufferValidator::doInit(const BufferViewInfo &info) { + CCASSERT(info.buffer, "invalid source buffer"); + CCASSERT(info.offset + info.range <= info.buffer->getSize(), "invalid range"); + + /////////// execute /////////// + + BufferViewInfo actorInfo = info; + actorInfo.buffer = static_cast(info.buffer)->getActor(); + + _actor->initialize(actorInfo); +} + +void BufferValidator::doResize(uint size, uint /*count*/) { + CCASSERT(!_isBufferView, "cannot resize through buffer views"); + CCASSERT(size, "invalid size"); + + /////////// execute /////////// + + _actor->resize(size); +} + +void BufferValidator::doDestroy() { + _actor->destroy(); +} + +void BufferValidator::update(const void *buffer, uint size) { + CCASSERT(!_isBufferView, "cannot update through buffer views"); + CCASSERT(size && size <= _size, "invalid size"); + CCASSERT(buffer, "invalid buffer data"); + + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { + const auto * drawInfo = static_cast(buffer); + const size_t drawInfoCount = size / sizeof(DrawInfo); + const bool isIndexed = drawInfoCount > 0 && drawInfo->indexCount > 0; + for (size_t i = 1U; i < drawInfoCount; ++i) { + if ((++drawInfo)->indexCount > 0 != isIndexed) { + CCASSERT(false, "inconsistent indirect draw infos on using index buffer"); + } + } + } + + if (DeviceValidator::getInstance()->isRecording()) { + _buffer.resize(_size); + memcpy(_buffer.data(), buffer, size); + } + + updateRedundencyCheck(); + + /////////// execute /////////// + + _actor->update(buffer, size); +} + +void BufferValidator::updateRedundencyCheck() { + uint cur = DeviceValidator::getInstance()->currentFrame(); + + if (cur == _lastUpdateFrame) { + CC_LOG_WARNING(utils::getStacktraceJS().c_str()); + CC_LOG_WARNING("performance warning: buffer updated more than once per frame"); + } + + _lastUpdateFrame = cur; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/BufferValidator.h b/native/cocos/renderer/gfx-validator/BufferValidator.h new file mode 100644 index 0000000000..84e0802bcd --- /dev/null +++ b/native/cocos/renderer/gfx-validator/BufferValidator.h @@ -0,0 +1,55 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXBuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL BufferValidator final : public Agent { +public: + using Agent::Agent; + ~BufferValidator() override; + + void update(const void *buffer, uint size) override; + + void updateRedundencyCheck(); + +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doResize(uint size, uint count) override; + void doDestroy() override; + + vector _buffer; + + uint _lastUpdateFrame = 0U; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/CommandBufferValidator.cpp b/native/cocos/renderer/gfx-validator/CommandBufferValidator.cpp new file mode 100644 index 0000000000..e43491d8ed --- /dev/null +++ b/native/cocos/renderer/gfx-validator/CommandBufferValidator.cpp @@ -0,0 +1,264 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/job-system/JobSystem.h" +#include "base/threading/MessageQueue.h" + +#include "BufferValidator.h" +#include "CommandBufferValidator.h" +#include "DescriptorSetValidator.h" +#include "DeviceValidator.h" +#include "FramebufferValidator.h" +#include "InputAssemblerValidator.h" +#include "PipelineStateValidator.h" +#include "QueueValidator.h" +#include "RenderPassValidator.h" +#include "TextureValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +CommandBufferValidator::~CommandBufferValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void CommandBufferValidator::doInit(const CommandBufferInfo &info) { + + /////////// execute /////////// + + CommandBufferInfo actorInfo = info; + actorInfo.queue = static_cast(info.queue)->getActor(); + + _actor->initialize(actorInfo); +} + +void CommandBufferValidator::doDestroy() { + _actor->destroy(); +} + +void CommandBufferValidator::begin(RenderPass *renderPass, uint subpass, Framebuffer *framebuffer) { + CCASSERT(!_insideRenderPass, "Already inside an render pass?"); + CCASSERT(_type != CommandBufferType::PRIMARY || !renderPass, "Primary command buffer cannot inherit render passes"); + + // secondary command buffers enter the render pass right here + _insideRenderPass = !!renderPass; + + /////////// execute /////////// + + RenderPass * renderPassActor = renderPass ? static_cast(renderPass)->getActor() : nullptr; + Framebuffer *framebufferActor = framebuffer ? static_cast(framebuffer)->getActor() : nullptr; + + _actor->begin(renderPassActor, subpass, framebufferActor); +} + +void CommandBufferValidator::end() { + CCASSERT(_type != CommandBufferType::PRIMARY || !_insideRenderPass, "Still inside an render pass?"); + _insideRenderPass = false; + + /////////// execute /////////// + + _actor->end(); +} + +void CommandBufferValidator::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) { + CCASSERT(renderPass, "invalid render pass"); + CCASSERT(fbo, "invalid framebuffer"); + + CCASSERT(_type == CommandBufferType::PRIMARY, "Command 'endRenderPass' must be recorded in primary command buffers."); + CCASSERT(!_insideRenderPass, "Already inside an render pass?"); + _insideRenderPass = true; + + static vector secondaryCBActors; + secondaryCBActors.resize(secondaryCBCount); + + /////////// execute /////////// + + RenderPass * renderPassActor = renderPass ? static_cast(renderPass)->getActor() : nullptr; + Framebuffer *framebufferActor = fbo ? static_cast(fbo)->getActor() : nullptr; + + CommandBuffer **actorSecondaryCBs = nullptr; + if (secondaryCBCount) { + actorSecondaryCBs = secondaryCBActors.data(); + for (uint i = 0; i < secondaryCBCount; ++i) { + actorSecondaryCBs[i] = static_cast(secondaryCBs[i])->getActor(); + } + } + + _actor->beginRenderPass(renderPassActor, framebufferActor, renderArea, colors, depth, stencil, actorSecondaryCBs, secondaryCBCount); +} + +void CommandBufferValidator::endRenderPass() { + CCASSERT(_type == CommandBufferType::PRIMARY, "Command 'endRenderPass' must be recorded in primary command buffers."); + CCASSERT(_insideRenderPass, "No render pass to end?"); + _insideRenderPass = false; + + /////////// execute /////////// + + _actor->endRenderPass(); +} + +void CommandBufferValidator::execute(CommandBuffer *const *cmdBuffs, uint32_t count) { + if (!count) return; // be more lenient on this for now + CCASSERT(_type == CommandBufferType::PRIMARY, "Command 'execute' must be recorded in primary command buffers."); + + /////////// execute /////////// + + static vector cmdBuffActors; + cmdBuffActors.resize(count); + + for (uint i = 0U; i < count; ++i) { + cmdBuffActors[i] = static_cast(cmdBuffs[i])->getActor(); + } + + _actor->execute(cmdBuffActors.data(), count); +} + +void CommandBufferValidator::bindPipelineState(PipelineState *pso) { + _actor->bindPipelineState(static_cast(pso)->getActor()); +} + +void CommandBufferValidator::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) { + _actor->bindDescriptorSet(set, static_cast(descriptorSet)->getActor(), dynamicOffsetCount, dynamicOffsets); +} + +void CommandBufferValidator::bindInputAssembler(InputAssembler *ia) { + _actor->bindInputAssembler(static_cast(ia)->getActor()); +} + +void CommandBufferValidator::setViewport(const Viewport &vp) { + _actor->setViewport(vp); +} + +void CommandBufferValidator::setScissor(const Rect &rect) { + _actor->setScissor(rect); +} + +void CommandBufferValidator::setLineWidth(float width) { + _actor->setLineWidth(width); +} + +void CommandBufferValidator::setDepthBias(float constant, float clamp, float slope) { + _actor->setDepthBias(constant, clamp, slope); +} + +void CommandBufferValidator::setBlendConstants(const Color &constants) { + _actor->setBlendConstants(constants); +} + +void CommandBufferValidator::setDepthBound(float minBounds, float maxBounds) { + _actor->setDepthBound(minBounds, maxBounds); +} + +void CommandBufferValidator::setStencilWriteMask(StencilFace face, uint mask) { + _actor->setStencilWriteMask(face, mask); +} + +void CommandBufferValidator::setStencilCompareMask(StencilFace face, int ref, uint mask) { + _actor->setStencilCompareMask(face, ref, mask); +} + +void CommandBufferValidator::nextSubpass() { + _actor->nextSubpass(); +} + +void CommandBufferValidator::draw(const DrawInfo &info) { + CCASSERT(_insideRenderPass, "Command 'draw' must be recorded inside render passes."); + + /////////// execute /////////// + + _actor->draw(info); +} + +void CommandBufferValidator::updateBuffer(Buffer *buff, const void *data, uint size) { + CCASSERT(_type == CommandBufferType::PRIMARY, "Command 'updateBuffer' must be recorded in primary command buffers."); + CCASSERT(!_insideRenderPass, "Command 'updateBuffer' must be recorded outside render passes."); + + auto *bufferValidator = static_cast(buff); + bufferValidator->updateRedundencyCheck(); + + /////////// execute /////////// + + _actor->updateBuffer(bufferValidator->getActor(), data, size); +} + +void CommandBufferValidator::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { + CCASSERT(_type == CommandBufferType::PRIMARY, "Command 'copyBuffersToTexture' must be recorded in primary command buffers."); + CCASSERT(!_insideRenderPass, "Command 'copyBuffersToTexture' must be recorded outside render passes."); + + auto *textureValidator = static_cast(texture); + textureValidator->updateRedundencyCheck(); + + /////////// execute /////////// + + _actor->copyBuffersToTexture(buffers, textureValidator->getActor(), regions, count); +} + +void CommandBufferValidator::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { + CCASSERT(!_insideRenderPass, "Command 'blitTexture' must be recorded outside render passes."); + + /////////// execute /////////// + + Texture *actorSrcTexture = nullptr; + Texture *actorDstTexture = nullptr; + if (srcTexture) actorSrcTexture = static_cast(srcTexture)->getActor(); + if (dstTexture) actorDstTexture = static_cast(dstTexture)->getActor(); + + _actor->blitTexture(actorSrcTexture, actorDstTexture, regions, count, filter); +} + +void CommandBufferValidator::dispatch(const DispatchInfo &info) { + CCASSERT(!_insideRenderPass, "Command 'dispatch' must be recorded outside render passes."); + + /////////// execute /////////// + + DispatchInfo actorInfo = info; + if (info.indirectBuffer) actorInfo.indirectBuffer = static_cast(info.indirectBuffer)->getActor(); + + _actor->dispatch(info); +} + +void CommandBufferValidator::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) { + + /////////// execute /////////// + + static vector textureActors; + textureActors.resize(textureBarrierCount); + + Texture **actorTextures = nullptr; + if (textureBarrierCount) { + actorTextures = textureActors.data(); + for (uint i = 0U; i < textureBarrierCount; ++i) { + actorTextures[i] = textures[i] ? static_cast(textures[i])->getActor() : nullptr; + } + } + + _actor->pipelineBarrier(barrier, textureBarriers, actorTextures, textureBarrierCount); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/CommandBufferValidator.h b/native/cocos/renderer/gfx-validator/CommandBufferValidator.h new file mode 100644 index 0000000000..eeabb7cf3d --- /dev/null +++ b/native/cocos/renderer/gfx-validator/CommandBufferValidator.h @@ -0,0 +1,77 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXCommandBuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL CommandBufferValidator final : public Agent { +public: + using Agent::Agent; + ~CommandBufferValidator() override; + + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void bindPipelineState(PipelineState *pso) override; + void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; + void bindInputAssembler(InputAssembler *ia) override; + void setViewport(const Viewport &vp) override; + void setScissor(const Rect &rect) override; + void setLineWidth(float width) override; + void setDepthBias(float constant, float clamp, float slope) override; + void setBlendConstants(const Color &constants) override; + void setDepthBound(float minBounds, float maxBounds) override; + void setStencilWriteMask(StencilFace face, uint mask) override; + void setStencilCompareMask(StencilFace face, int ref, uint mask) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buff, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint32_t count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; + + uint getNumDrawCalls() const override { return _actor->getNumDrawCalls(); } + uint getNumInstances() const override { return _actor->getNumInstances(); } + uint getNumTris() const override { return _actor->getNumTris(); } + +protected: + friend class DeviceValidator; + + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; + + bool _insideRenderPass{false}; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.cpp b/native/cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.cpp new file mode 100644 index 0000000000..91270b62a3 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceValidator.h" +#include "DescriptorSetLayoutValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +DescriptorSetLayoutValidator::~DescriptorSetLayoutValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void DescriptorSetLayoutValidator::doInit(const DescriptorSetLayoutInfo &info) { + for (const DescriptorSetLayoutBinding &binding : info.bindings) { + CCASSERT(binding.binding != INVALID_BINDING, "Invalid binding"); + CCASSERT(binding.descriptorType != DescriptorType::UNKNOWN, "Invalid binding type"); + CCASSERT(binding.count, "Invalid binding count"); + CCASSERT(binding.stageFlags != ShaderStageFlagBit::NONE, "Invalid binding stage flags"); + for (const Sampler *sampler : binding.immutableSamplers) { + CCASSERT(sampler, "Invalid immutable sampler"); + } + } + + /////////// execute /////////// + + _actor->initialize(info); +} + +void DescriptorSetLayoutValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.h b/native/cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.h new file mode 100644 index 0000000000..7eaccdabe0 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXDescriptorSetLayout.h" + +namespace cc { +namespace gfx { + +class CC_DLL DescriptorSetLayoutValidator final : public Agent { +public: + using Agent::Agent; + ~DescriptorSetLayoutValidator() override; + +protected: + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/DescriptorSetValidator.cpp b/native/cocos/renderer/gfx-validator/DescriptorSetValidator.cpp new file mode 100644 index 0000000000..1d724407a1 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/DescriptorSetValidator.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferValidator.h" +#include "DescriptorSetLayoutValidator.h" +#include "DescriptorSetValidator.h" +#include "DeviceValidator.h" +#include "SamplerValidator.h" +#include "TextureValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +DescriptorSetValidator::~DescriptorSetValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void DescriptorSetValidator::doInit(const DescriptorSetInfo &info) { + CCASSERT(info.layout, "Invalid set layout"); + + /////////// execute /////////// + + DescriptorSetInfo actorInfo; + actorInfo.layout = static_cast(info.layout)->getActor(); + + _actor->initialize(actorInfo); +} + +void DescriptorSetValidator::doDestroy() { + _actor->destroy(); +} + +void DescriptorSetValidator::update() { + _isDirty = false; + + _actor->update(); +} + +void DescriptorSetValidator::bindBuffer(uint binding, Buffer *buffer, uint index) { + const vector & bindingIndices = _layout->getBindingIndices(); + const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); + CCASSERT(binding < bindingIndices.size() && bindingIndices[binding] < bindings.size(), "Illegal binding"); + + const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; + CCASSERT(hasAnyFlags(info.descriptorType, DESCRIPTOR_BUFFER_TYPE), "Setting binding is not DESCRIPTOR_BUFFER_TYPE"); + + /////////// execute /////////// + + DescriptorSet::bindBuffer(binding, buffer, index); + + _actor->bindBuffer(binding, static_cast(buffer)->getActor(), index); +} + +void DescriptorSetValidator::bindTexture(uint binding, Texture *texture, uint index) { + const vector & bindingIndices = _layout->getBindingIndices(); + const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); + CCASSERT(binding < bindingIndices.size() && bindingIndices[binding] < bindings.size(), "Illegal binding"); + + const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; + CCASSERT(hasAnyFlags(info.descriptorType, DESCRIPTOR_TEXTURE_TYPE), "Setting binding is not DESCRIPTOR_TEXTURE_TYPE"); + + /////////// execute /////////// + + DescriptorSet::bindTexture(binding, texture, index); + + _actor->bindTexture(binding, static_cast(texture)->getActor(), index); +} + +void DescriptorSetValidator::bindSampler(uint binding, Sampler *sampler, uint index) { + const vector & bindingIndices = _layout->getBindingIndices(); + const DescriptorSetLayoutBindingList &bindings = _layout->getBindings(); + CCASSERT(binding < bindingIndices.size() && bindingIndices[binding] < bindings.size(), "Illegal binding"); + + const DescriptorSetLayoutBinding &info = bindings[bindingIndices[binding]]; + CCASSERT(hasAnyFlags(info.descriptorType, DESCRIPTOR_TEXTURE_TYPE), "Setting binding is not DESCRIPTOR_TEXTURE_TYPE"); + + /////////// execute /////////// + + DescriptorSet::bindSampler(binding, sampler, index); + + _actor->bindSampler(binding, static_cast(sampler)->getActor(), index); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/DescriptorSetValidator.h b/native/cocos/renderer/gfx-validator/DescriptorSetValidator.h new file mode 100644 index 0000000000..f933e9ecc0 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/DescriptorSetValidator.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXDescriptorSet.h" + +namespace cc { +namespace gfx { + +class CC_DLL DescriptorSetValidator final : public Agent { +public: + using Agent::Agent; + ~DescriptorSetValidator() override; + + void update() override; + + void bindBuffer(uint binding, Buffer *buffer, uint index) override; + void bindTexture(uint binding, Texture *texture, uint index) override; + void bindSampler(uint binding, Sampler *sampler, uint index) override; + +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/DeviceValidator.cpp b/native/cocos/renderer/gfx-validator/DeviceValidator.cpp new file mode 100644 index 0000000000..2d641070fe --- /dev/null +++ b/native/cocos/renderer/gfx-validator/DeviceValidator.cpp @@ -0,0 +1,256 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "BufferValidator.h" +#include "CommandBufferValidator.h" +#include "DescriptorSetLayoutValidator.h" +#include "DescriptorSetValidator.h" +#include "DeviceValidator.h" +#include "FramebufferValidator.h" +#include "InputAssemblerValidator.h" +#include "PipelineLayoutValidator.h" +#include "PipelineStateValidator.h" +#include "QueueValidator.h" +#include "RenderPassValidator.h" +#include "SamplerValidator.h" +#include "ShaderValidator.h" +#include "TextureValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +DeviceValidator *DeviceValidator::instance = nullptr; + +DeviceValidator *DeviceValidator::getInstance() { + return DeviceValidator::instance; +} + +DeviceValidator::DeviceValidator(Device *device) : Agent(device) { + DeviceValidator::instance = this; +} + +DeviceValidator::~DeviceValidator() { + CC_SAFE_DELETE(_actor); + DeviceValidator::instance = nullptr; +} + +bool DeviceValidator::doInit(const DeviceInfo &info) { + if (!_actor->initialize(info)) { + return false; + } + + _context = _actor->getContext(); + _api = _actor->getGfxAPI(); + _deviceName = _actor->getDeviceName(); + _queue = CC_NEW(QueueValidator(_actor->getQueue())); + _cmdBuff = CC_NEW(CommandBufferValidator(_actor->getCommandBuffer())); + static_cast(_cmdBuff)->_queue = _queue; + _renderer = _actor->getRenderer(); + _vendor = _actor->getVendor(); + _caps = _actor->_caps; + memcpy(_features, _actor->_features, static_cast(Feature::COUNT) * sizeof(bool)); + + DeviceResourceTracker::push(_cmdBuff); + DeviceResourceTracker::push(_queue); + + CC_LOG_INFO("Device validator enabled."); + + return true; +} + +void DeviceValidator::doDestroy() { + if (_cmdBuff) { + static_cast(_cmdBuff)->_actor = nullptr; + CC_DELETE(_cmdBuff); + _cmdBuff = nullptr; + } + if (_queue) { + static_cast(_queue)->_actor = nullptr; + CC_DELETE(_queue); + _queue = nullptr; + } + + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + DeviceResourceTracker::checkEmpty(); + + _actor->destroy(); +} + +void DeviceValidator::resize(uint width, uint height) { + _actor->resize(width, height); +} + +void DeviceValidator::acquire() { + _actor->acquire(); +} + +void DeviceValidator::present() { + _actor->present(); + ++_currentFrame; +} + +void DeviceValidator::setMultithreaded(bool multithreaded) { + _actor->setMultithreaded(multithreaded); +} + +CommandBuffer *DeviceValidator::createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) { + CommandBuffer *actor = _actor->createCommandBuffer(info, hasAgent); + CommandBuffer *result = CC_NEW(CommandBufferValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +Queue *DeviceValidator::createQueue() { + Queue *actor = _actor->createQueue(); + Queue *result = CC_NEW(QueueValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +Buffer *DeviceValidator::createBuffer() { + Buffer *actor = _actor->createBuffer(); + Buffer *result = CC_NEW(BufferValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +Texture *DeviceValidator::createTexture() { + Texture *actor = _actor->createTexture(); + Texture *result = CC_NEW(TextureValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +Sampler *DeviceValidator::createSampler() { + Sampler *actor = _actor->createSampler(); + Sampler *result = CC_NEW(SamplerValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +Shader *DeviceValidator::createShader() { + Shader *actor = _actor->createShader(); + Shader *result = CC_NEW(ShaderValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +InputAssembler *DeviceValidator::createInputAssembler() { + InputAssembler *actor = _actor->createInputAssembler(); + InputAssembler *result = CC_NEW(InputAssemblerValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +RenderPass *DeviceValidator::createRenderPass() { + RenderPass *actor = _actor->createRenderPass(); + RenderPass *result = CC_NEW(RenderPassValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +Framebuffer *DeviceValidator::createFramebuffer() { + Framebuffer *actor = _actor->createFramebuffer(); + Framebuffer *result = CC_NEW(FramebufferValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +DescriptorSet *DeviceValidator::createDescriptorSet() { + DescriptorSet *actor = _actor->createDescriptorSet(); + DescriptorSet *result = CC_NEW(DescriptorSetValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +DescriptorSetLayout *DeviceValidator::createDescriptorSetLayout() { + DescriptorSetLayout *actor = _actor->createDescriptorSetLayout(); + DescriptorSetLayout *result = CC_NEW(DescriptorSetLayoutValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +PipelineLayout *DeviceValidator::createPipelineLayout() { + PipelineLayout *actor = _actor->createPipelineLayout(); + PipelineLayout *result = CC_NEW(PipelineLayoutValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +PipelineState *DeviceValidator::createPipelineState() { + PipelineState *actor = _actor->createPipelineState(); + PipelineState *result = CC_NEW(PipelineStateValidator(actor)); + DeviceResourceTracker::push(result); + return result; +} + +GlobalBarrier *DeviceValidator::createGlobalBarrier() { + GlobalBarrier *actor = _actor->createGlobalBarrier(); + return actor; +} + +TextureBarrier *DeviceValidator::createTextureBarrier() { + TextureBarrier *actor = _actor->createTextureBarrier(); + return actor; +} + +void DeviceValidator::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { + auto *textureValidator = static_cast(dst); + textureValidator->updateRedundencyCheck(); + + _actor->copyBuffersToTexture(buffers, textureValidator->getActor(), regions, count); +} + +void DeviceValidator::flushCommands(CommandBuffer *const *cmdBuffs, uint count) { + if (!count) return; + + /////////// execute /////////// + + static vector cmdBuffActors; + cmdBuffActors.resize(count); + + for (uint i = 0U; i < count; ++i) { + cmdBuffActors[i] = static_cast(cmdBuffs[i])->getActor(); + } + + _actor->flushCommands(cmdBuffActors.data(), count); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/DeviceValidator.h b/native/cocos/renderer/gfx-validator/DeviceValidator.h new file mode 100644 index 0000000000..cd0ae37aac --- /dev/null +++ b/native/cocos/renderer/gfx-validator/DeviceValidator.h @@ -0,0 +1,115 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXDevice.h" + +namespace cc { +namespace gfx { + +class CC_DLL DeviceValidator final : public Agent { +public: + static DeviceValidator *getInstance(); + + ~DeviceValidator() override; + + using Device::copyBuffersToTexture; + using Device::createBuffer; + using Device::createCommandBuffer; + using Device::createDescriptorSet; + using Device::createDescriptorSetLayout; + using Device::createFramebuffer; + using Device::createGlobalBarrier; + using Device::createInputAssembler; + using Device::createPipelineLayout; + using Device::createPipelineState; + using Device::createQueue; + using Device::createRenderPass; + using Device::createSampler; + using Device::createShader; + using Device::createTexture; + using Device::createTextureBarrier; + + void resize(uint width, uint height) override; + void acquire() override; + void present() override; + + CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; + Queue * createQueue() override; + Buffer * createBuffer() override; + Texture * createTexture() override; + Sampler * createSampler() override; + Shader * createShader() override; + InputAssembler * createInputAssembler() override; + RenderPass * createRenderPass() override; + Framebuffer * createFramebuffer() override; + DescriptorSet * createDescriptorSet() override; + DescriptorSetLayout *createDescriptorSetLayout() override; + PipelineLayout * createPipelineLayout() override; + PipelineState * createPipelineState() override; + GlobalBarrier * createGlobalBarrier() override; + TextureBarrier * createTextureBarrier() override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; + + void flushCommands(CommandBuffer *const *cmdBuffs, uint count) override; + void setMultithreaded(bool multithreaded) override; + SurfaceTransform getSurfaceTransform() const override { return _actor->getSurfaceTransform(); } + uint getWidth() const override { return _actor->getWidth(); } + uint getHeight() const override { return _actor->getHeight(); } + uint getNativeWidth() const override { return _actor->getNativeWidth(); } + uint getNativeHeight() const override { return _actor->getNativeHeight(); } + MemoryStatus & getMemoryStatus() override { return _actor->getMemoryStatus(); } + uint getNumDrawCalls() const override { return _actor->getNumDrawCalls(); } + uint getNumInstances() const override { return _actor->getNumInstances(); } + uint getNumTris() const override { return _actor->getNumTris(); } + + inline void enableRecording(bool recording) { _recording = recording; } + inline bool isRecording() const { return _recording; } + inline uint currentFrame() const { return _currentFrame; } + +protected: + static DeviceValidator *instance; + + friend class DeviceManager; + + explicit DeviceValidator(Device *device); + + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; + + void releaseSurface(uintptr_t windowHandle) override { _actor->releaseSurface(windowHandle); } + void acquireSurface(uintptr_t windowHandle) override { _actor->acquireSurface(windowHandle); } + + void bindRenderContext(bool bound) override { _actor->bindRenderContext(bound); } + void bindDeviceContext(bool bound) override { _actor->bindDeviceContext(bound); } + + bool _recording{false}; + uint _currentFrame{1U}; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/FramebufferValidator.cpp b/native/cocos/renderer/gfx-validator/FramebufferValidator.cpp new file mode 100644 index 0000000000..29be912237 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/FramebufferValidator.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceValidator.h" +#include "FramebufferValidator.h" +#include "RenderPassValidator.h" +#include "TextureValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +FramebufferValidator::~FramebufferValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void FramebufferValidator::doInit(const FramebufferInfo &info) { + FramebufferInfo actorInfo = info; + for (uint i = 0u; i < info.colorTextures.size(); ++i) { + if (info.colorTextures[i]) { + actorInfo.colorTextures[i] = static_cast(info.colorTextures[i])->getActor(); + } + } + if (info.depthStencilTexture) { + actorInfo.depthStencilTexture = static_cast(info.depthStencilTexture)->getActor(); + } + actorInfo.renderPass = static_cast(info.renderPass)->getActor(); + + _actor->initialize(actorInfo); +} + +void FramebufferValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/FramebufferValidator.h b/native/cocos/renderer/gfx-validator/FramebufferValidator.h new file mode 100644 index 0000000000..59449cb941 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/FramebufferValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXFramebuffer.h" + +namespace cc { +namespace gfx { + +class CC_DLL FramebufferValidator final : public Agent { +public: + using Agent::Agent; + ~FramebufferValidator() override; + +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/InputAssemblerValidator.cpp b/native/cocos/renderer/gfx-validator/InputAssemblerValidator.cpp new file mode 100644 index 0000000000..e2033bc741 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/InputAssemblerValidator.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "BufferValidator.h" +#include "DeviceValidator.h" +#include "InputAssemblerValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +InputAssemblerValidator::~InputAssemblerValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void InputAssemblerValidator::doInit(const InputAssemblerInfo &info) { + InputAssemblerInfo actorInfo = info; + for (uint i = 0u; i < actorInfo.vertexBuffers.size(); ++i) { + actorInfo.vertexBuffers[i] = static_cast(actorInfo.vertexBuffers[i])->getActor(); + } + if (actorInfo.indexBuffer) { + actorInfo.indexBuffer = static_cast(actorInfo.indexBuffer)->getActor(); + } + if (actorInfo.indirectBuffer) { + actorInfo.indirectBuffer = static_cast(actorInfo.indirectBuffer)->getActor(); + } + + _actor->initialize(actorInfo); +} + +void InputAssemblerValidator::doDestroy() { + _actor->destroy(); +} + +void InputAssemblerValidator::setVertexCount(uint count) { + _vertexCount = count; + + _actor->setVertexCount(count); +} + +void InputAssemblerValidator::setFirstVertex(uint first) { + _firstVertex = first; + + _actor->setFirstVertex(first); +} + +void InputAssemblerValidator::setIndexCount(uint count) { + _indexCount = count; + + _actor->setIndexCount(count); +} + +void InputAssemblerValidator::setFirstIndex(uint first) { + _firstIndex = first; + + _actor->setFirstIndex(first); +} + +void InputAssemblerValidator::setVertexOffset(uint offset) { + _vertexOffset = offset; + + _actor->setVertexOffset(offset); +} + +void InputAssemblerValidator::setInstanceCount(uint count) { + _instanceCount = count; + + _actor->setInstanceCount(count); +} + +void InputAssemblerValidator::setFirstInstance(uint first) { + _firstInstance = first; + + _actor->setFirstInstance(first); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/InputAssemblerValidator.h b/native/cocos/renderer/gfx-validator/InputAssemblerValidator.h new file mode 100644 index 0000000000..fea97e458d --- /dev/null +++ b/native/cocos/renderer/gfx-validator/InputAssemblerValidator.h @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXInputAssembler.h" + +namespace cc { +namespace gfx { + +class CC_DLL InputAssemblerValidator final : public Agent { +public: + using Agent::Agent; + ~InputAssemblerValidator() override; + + void setVertexCount(uint count) override; + void setFirstVertex(uint first) override; + void setIndexCount(uint count) override; + void setFirstIndex(uint first) override; + void setVertexOffset(uint offset) override; + void setInstanceCount(uint count) override; + void setFirstInstance(uint first) override; + +protected: + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/PipelineLayoutValidator.cpp b/native/cocos/renderer/gfx-validator/PipelineLayoutValidator.cpp new file mode 100644 index 0000000000..960fb67126 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/PipelineLayoutValidator.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DescriptorSetLayoutValidator.h" +#include "DeviceValidator.h" +#include "PipelineLayoutValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +PipelineLayoutValidator::~PipelineLayoutValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void PipelineLayoutValidator::doInit(const PipelineLayoutInfo &info) { + PipelineLayoutInfo actorInfo; + actorInfo.setLayouts.resize(info.setLayouts.size()); + for (uint i = 0u; i < info.setLayouts.size(); i++) { + CCASSERT(info.setLayouts[i], "invalid descriptor set layout"); + actorInfo.setLayouts[i] = static_cast(info.setLayouts[i])->getActor(); + } + + _actor->initialize(actorInfo); +} + +void PipelineLayoutValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/PipelineLayoutValidator.h b/native/cocos/renderer/gfx-validator/PipelineLayoutValidator.h new file mode 100644 index 0000000000..39343074ad --- /dev/null +++ b/native/cocos/renderer/gfx-validator/PipelineLayoutValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXPipelineLayout.h" + +namespace cc { +namespace gfx { + +class CC_DLL PipelineLayoutValidator final : public Agent { +public: + using Agent::Agent; + ~PipelineLayoutValidator() override; + +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp b/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp new file mode 100644 index 0000000000..20b43293d3 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceValidator.h" +#include "PipelineLayoutValidator.h" +#include "PipelineStateValidator.h" +#include "RenderPassValidator.h" +#include "ShaderValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +PipelineStateValidator::~PipelineStateValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void PipelineStateValidator::doInit(const PipelineStateInfo &info) { + PipelineStateInfo actorInfo = info; + actorInfo.shader = static_cast(info.shader)->getActor(); + actorInfo.pipelineLayout = static_cast(info.pipelineLayout)->getActor(); + if (info.renderPass) actorInfo.renderPass = static_cast(info.renderPass)->getActor(); + + _actor->initialize(actorInfo); +} + +void PipelineStateValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/PipelineStateValidator.h b/native/cocos/renderer/gfx-validator/PipelineStateValidator.h new file mode 100644 index 0000000000..96b266f525 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/PipelineStateValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXPipelineState.h" + +namespace cc { +namespace gfx { + +class CC_DLL PipelineStateValidator final : public Agent { +public: + using Agent::Agent; + ~PipelineStateValidator() override; + +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/QueueValidator.cpp b/native/cocos/renderer/gfx-validator/QueueValidator.cpp new file mode 100644 index 0000000000..cd7f33d7b1 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/QueueValidator.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "CommandBufferValidator.h" +#include "DeviceValidator.h" +#include "QueueValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +QueueValidator::~QueueValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void QueueValidator::doInit(const QueueInfo &info) { + _actor->initialize(info); +} + +void QueueValidator::doDestroy() { + _actor->destroy(); +} + +void QueueValidator::submit(CommandBuffer *const *cmdBuffs, uint count) { + if (!count) return; + + static vector cmdBuffActors; + cmdBuffActors.resize(count); + + for (uint i = 0u; i < count; ++i) { + cmdBuffActors[i] = static_cast(cmdBuffs[i])->getActor(); + } + + _actor->submit(cmdBuffActors.data(), count); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/QueueValidator.h b/native/cocos/renderer/gfx-validator/QueueValidator.h new file mode 100644 index 0000000000..87f0fd0734 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/QueueValidator.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXQueue.h" +#include "base/Agent.h" + +namespace cc { +namespace gfx { + +class CC_DLL QueueValidator final : public Agent { +public: + using Agent::Agent; + using Queue::submit; + + ~QueueValidator() override; + + void submit(CommandBuffer *const *cmdBuffs, uint count) override; + +protected: + friend class DeviceValidator; + + void doInit(const QueueInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/RenderPassValidator.cpp b/native/cocos/renderer/gfx-validator/RenderPassValidator.cpp new file mode 100644 index 0000000000..8c092bc3fe --- /dev/null +++ b/native/cocos/renderer/gfx-validator/RenderPassValidator.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceValidator.h" +#include "RenderPassValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +RenderPassValidator::~RenderPassValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void RenderPassValidator::doInit(const RenderPassInfo &info) { + _actor->initialize(info); +} + +void RenderPassValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/RenderPassValidator.h b/native/cocos/renderer/gfx-validator/RenderPassValidator.h new file mode 100644 index 0000000000..089051b5f3 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/RenderPassValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "gfx-base/GFXRenderPass.h" +#include "base/Agent.h" + +namespace cc { +namespace gfx { + +class CC_DLL RenderPassValidator final : public Agent { +public: + using Agent::Agent; + ~RenderPassValidator() override; + +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/SamplerValidator.cpp b/native/cocos/renderer/gfx-validator/SamplerValidator.cpp new file mode 100644 index 0000000000..32edf35dbf --- /dev/null +++ b/native/cocos/renderer/gfx-validator/SamplerValidator.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DescriptorSetLayoutValidator.h" +#include "DeviceValidator.h" +#include "SamplerValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +SamplerValidator::~SamplerValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void SamplerValidator::doInit(const SamplerInfo &info) { + _actor->initialize(info); +} + +void SamplerValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/SamplerValidator.h b/native/cocos/renderer/gfx-validator/SamplerValidator.h new file mode 100644 index 0000000000..9a7c8dd11a --- /dev/null +++ b/native/cocos/renderer/gfx-validator/SamplerValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXSampler.h" + +namespace cc { +namespace gfx { + +class CC_DLL SamplerValidator final : public Agent { +public: + using Agent::Agent; + ~SamplerValidator() override; + +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/ShaderValidator.cpp b/native/cocos/renderer/gfx-validator/ShaderValidator.cpp new file mode 100644 index 0000000000..9862a644b7 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/ShaderValidator.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" +#include "base/threading/MessageQueue.h" + +#include "DeviceValidator.h" +#include "ShaderValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +ShaderValidator::~ShaderValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void ShaderValidator::doInit(const ShaderInfo &info) { + _actor->initialize(info); +} + +void ShaderValidator::doDestroy() { + _actor->destroy(); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/ShaderValidator.h b/native/cocos/renderer/gfx-validator/ShaderValidator.h new file mode 100644 index 0000000000..834c93d80b --- /dev/null +++ b/native/cocos/renderer/gfx-validator/ShaderValidator.h @@ -0,0 +1,45 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXShader.h" + +namespace cc { +namespace gfx { + +class CC_DLL ShaderValidator final : public Agent { +public: + using Agent::Agent; + ~ShaderValidator() override; + +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/TextureValidator.cpp b/native/cocos/renderer/gfx-validator/TextureValidator.cpp new file mode 100644 index 0000000000..e1c39bcebb --- /dev/null +++ b/native/cocos/renderer/gfx-validator/TextureValidator.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "base/CoreStd.h" + +#include "DeviceValidator.h" +#include "TextureValidator.h" +#include "ValidationUtils.h" + +namespace cc { +namespace gfx { + +namespace { +unordered_map featureCheckMap{ + {Format::D16, Feature::FORMAT_D16}, + {Format::D16S8, Feature::FORMAT_D16S8}, + {Format::D24, Feature::FORMAT_D24}, + {Format::D24S8, Feature::FORMAT_D24S8}, + {Format::D32F, Feature::FORMAT_D32F}, + {Format::D32F_S8, Feature::FORMAT_D32FS8}, + {Format::RGB8, Feature::FORMAT_RGB8}, +}; +} // namespace + +TextureValidator::~TextureValidator() { + DeviceResourceTracker::erase(this); + CC_SAFE_DELETE(_actor); +} + +void TextureValidator::doInit(const TextureInfo &info) { + CCASSERT(!featureCheckMap.count(_format) || DeviceValidator::getInstance()->hasFeature(featureCheckMap[_format]), "unsupported format"); + + // Potentially inefficient + static const TextureUsageBit INEFFICIENT_MASK{TextureUsageBit::INPUT_ATTACHMENT | TextureUsageBit::SAMPLED}; + CCASSERT((info.usage & INEFFICIENT_MASK) != INEFFICIENT_MASK, "Both SAMPLED and INPUT_ATTACHMENT are specified?"); + + _actor->initialize(info); +} + +void TextureValidator::doInit(const TextureViewInfo &info) { + TextureViewInfo actorInfo = info; + actorInfo.texture = static_cast(info.texture)->getActor(); + + _actor->initialize(actorInfo); +} + +void TextureValidator::doDestroy() { + _actor->destroy(); +} + +void TextureValidator::doResize(uint width, uint height, uint /*size*/) { + CCASSERT(!_isTextureView, "Cannot resize texture views"); + + _actor->resize(width, height); +} + +void TextureValidator::updateRedundencyCheck() { + uint cur = DeviceValidator::getInstance()->currentFrame(); + + if (cur == _lastUpdateFrame) { + CC_LOG_WARNING(utils::getStacktraceJS().c_str()); + CC_LOG_WARNING("performance warning: texture updated more than once per frame"); + } + + _lastUpdateFrame = cur; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/TextureValidator.h b/native/cocos/renderer/gfx-validator/TextureValidator.h new file mode 100644 index 0000000000..4ebd66a5e8 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/TextureValidator.h @@ -0,0 +1,51 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/Agent.h" +#include "gfx-base/GFXTexture.h" + +namespace cc { +namespace gfx { + +class CC_DLL TextureValidator final : public Agent { +public: + using Agent::Agent; + ~TextureValidator() override; + + void updateRedundencyCheck(); + +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; + + uint _lastUpdateFrame = 0u; +}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/ValidationUtils.cpp b/native/cocos/renderer/gfx-validator/ValidationUtils.cpp new file mode 100644 index 0000000000..cd316f1a9a --- /dev/null +++ b/native/cocos/renderer/gfx-validator/ValidationUtils.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "ValidationUtils.h" + +#include "bindings/jswrapper/SeApi.h" + +namespace cc { + +namespace utils { + +String getStacktraceJS() { + return se::ScriptEngine::getInstance()->getCurrentStackTrace(); +} + +} // namespace utils + +namespace gfx { + +} // namespace gfx + +} // namespace cc diff --git a/native/cocos/renderer/gfx-validator/ValidationUtils.h b/native/cocos/renderer/gfx-validator/ValidationUtils.h new file mode 100644 index 0000000000..ed3a0e2517 --- /dev/null +++ b/native/cocos/renderer/gfx-validator/ValidationUtils.h @@ -0,0 +1,130 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "base/CoreStd.h" +#include "base/Utils.h" + +namespace cc { + +namespace utils { +String getStacktraceJS(); +} // namespace utils + +namespace gfx { + +class GFXObject; +class CommandBuffer; +class Queue; +class Buffer; +class Texture; +class Sampler; +class Shader; +class InputAssembler; +class RenderPass; +class Framebuffer; +class DescriptorSet; +class DescriptorSetLayout; +class PipelineLayout; +class PipelineState; + +////////////////////////////////////////////////////////////////////////// + +template +struct record_stacktrace : std::false_type {}; + +template ::value>> +class DeviceResourceTracker { +public: + template ::value>> + static std::enable_if_t::value, void> push(T *resource); + + template ::value>> + static std::enable_if_t::value, void> push(T *resource); + + static void erase(Resource *resource); + static void checkEmpty(); + +private: + struct ResourceRecord { + Resource *resource = nullptr; + String initStack; + }; + + static vector _resources; +}; + +template +vector::ResourceRecord> DeviceResourceTracker::_resources; + +template +template +std::enable_if_t::value, void> +DeviceResourceTracker::push(T *resource) { + _resources.emplace_back(ResourceRecord{resource, utils::getStacktrace(6, 10)}); +} + +template +template +std::enable_if_t::value, void> +DeviceResourceTracker::push(T *resource) { + _resources.emplace_back(ResourceRecord{resource, {}}); +} + +template +void DeviceResourceTracker::erase(Resource *resource) { + CCASSERT(!_resources.empty(), "Deleted twice?"); + + _resources.erase(std::remove_if(_resources.begin(), _resources.end(), + [resource](const auto &record) { return record.resource == resource; })); +} + +template +void DeviceResourceTracker::checkEmpty() { + // If this assertion is hit, it means you have leaked gfx resources. + // You can debug this by uncomment the `record_stacktrace` template specialization for the relevant type + // and look up the resource initialization stacktrace in `_resources[i].initStack`. + // Note: capturing stacktrace is a painfully time-consuming process, + // so better to uncomment the exact type of resource that is leaking rather than toggle them all at once. + CCASSERT(_resources.empty(), "Resource leaked"); +} + +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; +//template <> struct record_stacktrace : std::true_type {}; + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/CMakeLists.txt b/native/cocos/renderer/gfx-vulkan/CMakeLists.txt deleted file mode 100644 index 2cd72ff087..0000000000 --- a/native/cocos/renderer/gfx-vulkan/CMakeLists.txt +++ /dev/null @@ -1,83 +0,0 @@ -set(TARGET_NAME GFXVulkan) - -message(STATUS "Target: ${TARGET_NAME}...") -# --------------------------------------------------------------------- -# set include files - -set(INCLUDE_FILES - ${GFX_EXTERNAL_PATH}/khronos - ${GFX_EXTERNAL_PATH}/boost - ${GFX_EXTERNAL_PATH}/tbb/include - ${GFX_EXTERNAL_PATH}/concurrentqueue - ${COCOS_EXTERNAL_PATH}/win32/include/glslang - ${COCOS_SRC_PATH}/renderer/core - ${COCOS_SRC_PATH}/renderer/gfx-vulkan -) - -add_definitions("-DVK_NO_PROTOTYPES") - -if(WIN32) - add_definitions("-DVK_USE_PLATFORM_WIN32_KHR") - add_definitions("-DNOMINMAX") -elseif(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - add_definitions("-DVK_USE_PLATFORM_METAL_EXT") -elseif(COCOS_PLATFORM_ANDROID) - add_definitions("-DVK_USE_PLATFORM_ANDROID_KHR") -else() - add_definitions("-DVK_USE_PLATFORM_XLIB_KHR") -endif() - -include_directories( ${INCLUDE_FILES} ) - -# --------------------------------------------------------------------- - -file(GLOB_RECURSE HEADER_FILES *.h) -file(GLOB_RECURSE SOURCE_CPP_FILES *.cpp *.cc) -file(GLOB_RECURSE SOURCE_C_FILES *.c) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - file(GLOB_RECURSE SOURCE_MM_FILES *.m *.mm) -endif() - -set(ALL_FILES - ${HEADER_FILES} - ${SOURCE_CPP_FILES} - ${SOURCE_C_FILES} - ${CC_BASE_HEADERS} - ${CC_BASE_SOURCES} - ${COCOS_SRC_PATH}/base/StringUtil.h - ${COCOS_SRC_PATH}/base/StringUtil.cpp - ) - -if(COCOS_PLATFORM_IOS OR COCOS_PLATFORM_OSX) - set(ALL_FILES ${ALL_FILES} ${SOURCE_MM_FILES}) -endif() - -add_definitions("-DCC_VK_EXPORTS") -if(WIN32) - add_definitions("-DGLEW_BUILD") -endif() -if(COCOS_UNICODE) - add_definitions("-DUNICODE -D_UNICODE") -endif() - -if (COCOS_STATIC) - add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${ALL_FILES}) - set(TBB_LIBRARIES tbb_static tbbmalloc_static tbbmalloc_proxy_static) -else() - add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${ALL_FILES}) - set(TBB_LIBRARIES tbb tbbmalloc tbbmalloc_proxy) -endif() - -target_link_libraries(${TARGET_NAME} Core glslang OGLCompiler OSDependent SPIRV glslang-default-resource-limits ${TBB_LIBRARIES}) - -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME CCGFXVulkan) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME_DEBUG CCGFXVulkan_d) - -use_precompiled_header("${CMAKE_CURRENT_SOURCE_DIR}/VKStd.h" "${CMAKE_CURRENT_SOURCE_DIR}/VKStd.cpp" SOURCE_CPP_FILES) - -message(STATUS "${TARGET_NAME} configuration completed.") - -target_compile_definitions(${TARGET_NAME} PUBLIC - $<$:CC_DEBUG=1> -) diff --git a/native/cocos/renderer/gfx-vulkan/GFXVulkan.h b/native/cocos/renderer/gfx-vulkan/GFXVulkan.h index 633969e412..902bf7163a 100644 --- a/native/cocos/renderer/gfx-vulkan/GFXVulkan.h +++ b/native/cocos/renderer/gfx-vulkan/GFXVulkan.h @@ -1,31 +1,30 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_VK_H_ -#define CC_GFXVULKAN_VK_H_ + +#pragma once #include "VKStd.h" #include "VKDevice.h" - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKBuffer.cpp b/native/cocos/renderer/gfx-vulkan/VKBuffer.cpp index ac9a3a3a65..8fee1c9936 100644 --- a/native/cocos/renderer/gfx-vulkan/VKBuffer.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKBuffer.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKBuffer.h" @@ -31,21 +33,13 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKBuffer::CCVKBuffer(Device *device) -: Buffer(device) { -} +CCVKBuffer::CCVKBuffer() = default; CCVKBuffer::~CCVKBuffer() { + destroy(); } -bool CCVKBuffer::initialize(const BufferInfo &info) { - _usage = info.usage; - _memUsage = info.memUsage; - _size = info.size; - _stride = std::max(info.stride, 1u); - _count = _size / _stride; - _flags = info.flags; - +void CCVKBuffer::doInit(const BufferInfo & /*info*/) { _gpuBuffer = CC_NEW(CCVKGPUBuffer); _gpuBuffer->usage = _usage; _gpuBuffer->memUsage = _memUsage; @@ -53,115 +47,68 @@ bool CCVKBuffer::initialize(const BufferInfo &info) { _gpuBuffer->stride = _stride; _gpuBuffer->count = _count; - if (_usage & BufferUsageBit::INDIRECT) { + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { const size_t drawInfoCount = _size / sizeof(DrawInfo); _gpuBuffer->indexedIndirectCmds.resize(drawInfoCount); _gpuBuffer->indirectCmds.resize(drawInfoCount); } - CCVKCmdFuncCreateBuffer((CCVKDevice *)_device, _gpuBuffer); - _device->getMemoryStatus().bufferSize += _size; + cmdFuncCCVKCreateBuffer(CCVKDevice::getInstance(), _gpuBuffer); _gpuBufferView = CC_NEW(CCVKGPUBufferView); createBufferView(); - - return true; } -bool CCVKBuffer::initialize(const BufferViewInfo &info) { - _isBufferView = true; - - CCVKBuffer *buffer = (CCVKBuffer *)info.buffer; - - _usage = buffer->_usage; - _memUsage = buffer->_memUsage; - _size = _stride = info.range; - _count = 1u; - _flags = buffer->_flags; - _offset = info.offset; - - _gpuBuffer = ((CCVKBuffer *)info.buffer)->gpuBuffer(); +void CCVKBuffer::doInit(const BufferViewInfo &info) { + auto *buffer = static_cast(info.buffer); + _gpuBuffer = buffer->gpuBuffer(); _gpuBufferView = CC_NEW(CCVKGPUBufferView); createBufferView(); - - return true; } void CCVKBuffer::createBufferView() { _gpuBufferView->gpuBuffer = _gpuBuffer; _gpuBufferView->offset = _offset; _gpuBufferView->range = _size; - ((CCVKDevice *)_device)->gpuDescriptorHub()->update(_gpuBufferView); + CCVKDevice::getInstance()->gpuDescriptorHub()->update(_gpuBufferView); } -void CCVKBuffer::destroy() { +void CCVKBuffer::doDestroy() { if (_gpuBufferView) { - ((CCVKDevice *)_device)->gpuDescriptorHub()->disengage(_gpuBufferView); + CCVKDevice::getInstance()->gpuDescriptorHub()->disengage(_gpuBufferView); CC_DELETE(_gpuBufferView); _gpuBufferView = nullptr; } if (_gpuBuffer) { if (!_isBufferView) { - ((CCVKDevice *)_device)->gpuBufferHub()->erase(_gpuBuffer); - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuBuffer); - _device->getMemoryStatus().bufferSize -= _size; + CCVKDevice::getInstance()->gpuBufferHub()->erase(_gpuBuffer); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuBuffer); + CCVKDevice::getInstance()->gpuBarrierManager()->cancel(_gpuBuffer); CC_DELETE(_gpuBuffer); } _gpuBuffer = nullptr; } } -void CCVKBuffer::resize(uint size) { - CCASSERT(!_isBufferView, "Cannot resize buffer views"); +void CCVKBuffer::doResize(uint size, uint count) { + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuBuffer); - if (_size != size) { - const uint oldSize = _size; - _size = size; - _count = _size / _stride; + _gpuBuffer->size = size; + _gpuBuffer->count = count; + cmdFuncCCVKCreateBuffer(CCVKDevice::getInstance(), _gpuBuffer); - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuBuffer); + createBufferView(); - _gpuBuffer->size = _size; - _gpuBuffer->count = _count; - CCVKCmdFuncCreateBuffer((CCVKDevice *)_device, _gpuBuffer); - - createBufferView(); - - MemoryStatus &status = _device->getMemoryStatus(); - status.bufferSize -= oldSize; - status.bufferSize += _size; - - if (_usage & BufferUsageBit::INDIRECT) { - const size_t drawInfoCount = _size / sizeof(DrawInfo); - _gpuBuffer->indexedIndirectCmds.resize(drawInfoCount); - _gpuBuffer->indirectCmds.resize(drawInfoCount); - } + if (hasFlag(_usage, BufferUsageBit::INDIRECT)) { + const size_t drawInfoCount = _size / sizeof(DrawInfo); + _gpuBuffer->indexedIndirectCmds.resize(drawInfoCount); + _gpuBuffer->indirectCmds.resize(drawInfoCount); } } -void CCVKBuffer::update(void *buffer, uint size) { - CCASSERT(!_isBufferView, "Cannot update through buffer views"); - if (!size) return; - -#if CC_DEBUG > 0 - if (_usage & BufferUsageBit::INDIRECT) { - DrawInfo *drawInfo = static_cast(buffer); - const size_t drawInfoCount = size / sizeof(DrawInfo); - const bool isIndexed = drawInfoCount > 0 && drawInfo->indexCount > 0; - for (size_t i = 1u; i < drawInfoCount; i++) { - if ((++drawInfo)->indexCount > 0 != isIndexed) { - CC_LOG_WARNING("Inconsistent indirect draw infos on using index buffer"); - return; - } - } - } -#endif - - CommandBuffer *cmdBuff = _device->getCommandBuffer(); - cmdBuff->begin(); - const CCVKGPUCommandBuffer *gpuCommandBuffer = ((CCVKCommandBuffer *)cmdBuff)->gpuCommandBuffer(); - CCVKCmdFuncUpdateBuffer((CCVKDevice *)_device, _gpuBuffer, buffer, size, gpuCommandBuffer); +void CCVKBuffer::update(const void *buffer, uint size) { + cmdFuncCCVKUpdateBuffer(CCVKDevice::getInstance(), _gpuBuffer, buffer, size, nullptr); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-vulkan/VKBuffer.h b/native/cocos/renderer/gfx-vulkan/VKBuffer.h index 70b3275618..5cf4b659b2 100644 --- a/native/cocos/renderer/gfx-vulkan/VKBuffer.h +++ b/native/cocos/renderer/gfx-vulkan/VKBuffer.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_BUFFER_H_ -#define CC_GFXVULKAN_BUFFER_H_ + +#pragma once + +#include "VKStd.h" +#include "gfx-base/GFXBuffer.h" namespace cc { namespace gfx { @@ -32,20 +36,20 @@ class CCVKGPUBufferView; class CC_VULKAN_API CCVKBuffer final : public Buffer { public: - CCVKBuffer(Device *device); - ~CCVKBuffer(); + CCVKBuffer(); + ~CCVKBuffer() override; -public: - bool initialize(const BufferInfo &info); - bool initialize(const BufferViewInfo &info); - void destroy(); - void resize(uint size); - void update(void *buffer, uint offset); + void update(const void *buffer, uint size) override; CC_INLINE CCVKGPUBuffer *gpuBuffer() const { return _gpuBuffer; } CC_INLINE CCVKGPUBufferView *gpuBufferView() const { return _gpuBufferView; } -private: +protected: + void doInit(const BufferInfo &info) override; + void doInit(const BufferViewInfo &info) override; + void doDestroy() override; + void doResize(uint size, uint count) override; + void createBufferView(); CCVKGPUBuffer *_gpuBuffer = nullptr; @@ -54,5 +58,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp index 349b879372..fb4ad4f603 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKBuffer.h" @@ -30,56 +32,49 @@ THE SOFTWARE. #include "VKDescriptorSet.h" #include "VKDevice.h" #include "VKFramebuffer.h" +#include "VKGlobalBarrier.h" #include "VKInputAssembler.h" #include "VKPipelineState.h" #include "VKQueue.h" #include "VKRenderPass.h" #include "VKTexture.h" +#include "VKTextureBarrier.h" namespace cc { namespace gfx { -CCVKCommandBuffer::CCVKCommandBuffer(Device *device) -: CommandBuffer(device) { -} - CCVKCommandBuffer::~CCVKCommandBuffer() { + destroy(); } -bool CCVKCommandBuffer::initialize(const CommandBufferInfo &info) { - _type = info.type; - _queue = info.queue; +void CCVKCommandBuffer::doInit(const CommandBufferInfo & /*info*/) { + _gpuCommandBuffer = CC_NEW(CCVKGPUCommandBuffer); + _gpuCommandBuffer->level = mapVkCommandBufferLevel(_type); + _gpuCommandBuffer->queueFamilyIndex = static_cast(_queue)->gpuQueue()->queueFamilyIndex; - _gpuCommandBuffer = CC_NEW(CCVKGPUCommandBuffer); - _gpuCommandBuffer->level = MapVkCommandBufferLevel(_type); - _gpuCommandBuffer->queueFamilyIndex = ((CCVKQueue *)_queue)->gpuQueue()->queueFamilyIndex; - - size_t setCount = ((CCVKDevice *)_device)->bindingMappingInfo().bufferOffsets.size(); + size_t setCount = CCVKDevice::getInstance()->bindingMappingInfo().bufferOffsets.size(); _curGPUDescriptorSets.resize(setCount); _curVkDescriptorSets.resize(setCount); _curDynamicOffsetPtrs.resize(setCount); _curDynamicOffsetCounts.resize(setCount); - - return true; } -void CCVKCommandBuffer::destroy() { +void CCVKCommandBuffer::doDestroy() { if (_gpuCommandBuffer) { - ((CCVKDevice *)_device)->gpuDevice()->getCommandBufferPool(std::this_thread::get_id())->yield(_gpuCommandBuffer); CC_DELETE(_gpuCommandBuffer); _gpuCommandBuffer = nullptr; } } -void CCVKCommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) { +void CCVKCommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) { if (_gpuCommandBuffer->began) return; - ((CCVKDevice *)_device)->gpuDevice()->getCommandBufferPool(std::this_thread::get_id())->request(_gpuCommandBuffer); + CCVKDevice::getInstance()->gpuDevice()->getCommandBufferPool()->request(_gpuCommandBuffer); _curGPUPipelineState = nullptr; _curGPUInputAssember = nullptr; _curGPUDescriptorSets.assign(_curGPUDescriptorSets.size(), nullptr); - _curDynamicOffsetCounts.assign(_curDynamicOffsetCounts.size(), 0u); + _curDynamicOffsetCounts.assign(_curDynamicOffsetCounts.size(), 0U); _firstDirtyDescriptorSet = UINT_MAX; _numDrawCalls = 0; @@ -90,19 +85,16 @@ void CCVKCommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; VkCommandBufferInheritanceInfo inheritanceInfo{VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO}; - if (_type == CommandBufferType::SECONDARY) { - if (!renderPass) { - CC_LOG_ERROR("RenderPass has to be specified when beginning secondary command buffers."); - return; - } - inheritanceInfo.renderPass = ((CCVKRenderPass *)renderPass)->gpuRenderPass()->vkRenderPass; - inheritanceInfo.subpass = subpass; + if (renderPass) { + inheritanceInfo.renderPass = static_cast(renderPass)->gpuRenderPass()->vkRenderPass; + inheritanceInfo.subpass = subpass; if (frameBuffer) { - CCVKGPUFramebuffer *gpuFBO = ((CCVKFramebuffer *)frameBuffer)->gpuFBO(); - if (gpuFBO->isOffscreen) + CCVKGPUFramebuffer *gpuFBO = static_cast(frameBuffer)->gpuFBO(); + if (gpuFBO->isOffscreen) { inheritanceInfo.framebuffer = gpuFBO->vkFramebuffer; - else + } else { inheritanceInfo.framebuffer = gpuFBO->swapchain->vkSwapchainFramebufferListMap[gpuFBO][gpuFBO->swapchain->curImageIndex]; + } } beginInfo.pInheritanceInfo = &inheritanceInfo; beginInfo.flags |= VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT; @@ -117,54 +109,59 @@ void CCVKCommandBuffer::begin(RenderPass *renderPass, uint subpass, Framebuffer void CCVKCommandBuffer::end() { if (!_gpuCommandBuffer->began) return; - _curGPUFBO = nullptr; + _curGPUFBO = nullptr; _curGPUInputAssember = nullptr; - _curViewport.width = _curViewport.height = _curScissor.width = _curScissor.height = 0u; + _curViewport.width = _curViewport.height = _curScissor.width = _curScissor.height = 0U; VK_CHECK(vkEndCommandBuffer(_gpuCommandBuffer->vkCommandBuffer)); _gpuCommandBuffer->began = false; _pendingQueue.push(_gpuCommandBuffer->vkCommandBuffer); - ((CCVKDevice *)_device)->gpuDevice()->getCommandBufferPool(std::this_thread::get_id())->yield(_gpuCommandBuffer); + CCVKDevice::getInstance()->gpuDevice()->getCommandBufferPool()->yield(_gpuCommandBuffer); } -void CCVKCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) { - // guard against RAW hazards - VkMemoryBarrier barrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; - barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barrier.dstAccessMask = VK_ACCESS_UNIFORM_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT; +void CCVKCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, + float depth, int stencil, CommandBuffer *const * /*secondaryCBs*/, uint secondaryCBCount) { +#if BARRIER_DEDUCTION_LEVEL >= BARRIER_DEDUCTION_LEVEL_BASIC + // guard against RAW hazard + VkMemoryBarrier vkBarrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; + vkBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkBarrier.dstAccessMask = VK_ACCESS_UNIFORM_READ_BIT; vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - 0, 1, &barrier, 0, nullptr, 0, nullptr); + VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + 0, 1, &vkBarrier, 0, nullptr, 0, nullptr); +#endif - _curGPUFBO = ((CCVKFramebuffer *)fbo)->gpuFBO(); - CCVKGPURenderPass *gpuRenderPass = ((CCVKRenderPass *)renderPass)->gpuRenderPass(); - VkFramebuffer framebuffer = _curGPUFBO->vkFramebuffer; + _curGPUFBO = static_cast(fbo)->gpuFBO(); + CCVKGPURenderPass *gpuRenderPass = static_cast(renderPass)->gpuRenderPass(); + VkFramebuffer framebuffer = _curGPUFBO->vkFramebuffer; if (!_curGPUFBO->isOffscreen) { framebuffer = _curGPUFBO->swapchain->vkSwapchainFramebufferListMap[_curGPUFBO][_curGPUFBO->swapchain->curImageIndex]; } - vector &clearValues = gpuRenderPass->clearValues; - size_t attachmentCount = clearValues.size(); + vector &clearValues = gpuRenderPass->clearValues; + size_t attachmentCount = clearValues.size(); if (attachmentCount) { - for (size_t i = 0u; i < attachmentCount - 1; i++) { + for (size_t i = 0U; i < attachmentCount - 1; ++i) { clearValues[i].color = {{colors[i].x, colors[i].y, colors[i].z, colors[i].w}}; } - clearValues[attachmentCount - 1].depthStencil = {depth, (uint)stencil}; + clearValues[attachmentCount - 1].depthStencil = {depth, static_cast(stencil)}; } VkRenderPassBeginInfo passBeginInfo{VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO}; - passBeginInfo.renderPass = gpuRenderPass->vkRenderPass; - passBeginInfo.framebuffer = framebuffer; + passBeginInfo.renderPass = gpuRenderPass->vkRenderPass; + passBeginInfo.framebuffer = framebuffer; passBeginInfo.clearValueCount = clearValues.size(); - passBeginInfo.pClearValues = clearValues.data(); - passBeginInfo.renderArea = {{(int)renderArea.x, (int)renderArea.y}, {renderArea.width, renderArea.height}}; + passBeginInfo.pClearValues = clearValues.data(); + passBeginInfo.renderArea = {{renderArea.x, renderArea.y}, {renderArea.width, renderArea.height}}; vkCmdBeginRenderPass(_gpuCommandBuffer->vkCommandBuffer, &passBeginInfo, - fromSecondaryCB ? VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS : VK_SUBPASS_CONTENTS_INLINE); + secondaryCBCount ? VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS : VK_SUBPASS_CONTENTS_INLINE); - if (!fromSecondaryCB) { - VkViewport viewport{(float)renderArea.x, (float)renderArea.y, (float)renderArea.width, (float)renderArea.height, 0.f, 1.f}; + _secondaryRP = secondaryCBCount; + + if (!secondaryCBCount) { + VkViewport viewport{static_cast(renderArea.x), static_cast(renderArea.y), static_cast(renderArea.width), static_cast(renderArea.height), 0.F, 1.F}; vkCmdSetViewport(_gpuCommandBuffer->vkCommandBuffer, 0, 1, &viewport); vkCmdSetScissor(_gpuCommandBuffer->vkCommandBuffer, 0, 1, &passBeginInfo.renderArea); } @@ -173,20 +170,38 @@ void CCVKCommandBuffer::beginRenderPass(RenderPass *renderPass, Framebuffer *fbo void CCVKCommandBuffer::endRenderPass() { vkCmdEndRenderPass(_gpuCommandBuffer->vkCommandBuffer); - // guard against WAR hazard - vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, - VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, - 0, 0, nullptr, 0, nullptr, 0, nullptr); - + size_t colorAttachmentCount = _curGPUFBO->gpuRenderPass->colorAttachments.size(); + for (size_t i = 0U; i < colorAttachmentCount; ++i) { + if (_curGPUFBO->gpuColorViews[i]) { + _curGPUFBO->gpuColorViews[i]->gpuTexture->currentAccessTypes = _curGPUFBO->gpuRenderPass->endAccesses[i]; + } else { + _curGPUFBO->swapchain->swapchainImageAccessTypes[_curGPUFBO->swapchain->curImageIndex] = _curGPUFBO->gpuRenderPass->endAccesses[i]; + } + } + + if (_curGPUFBO->gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN) { + if (_curGPUFBO->gpuDepthStencilView) { + _curGPUFBO->gpuDepthStencilView->gpuTexture->currentAccessTypes = _curGPUFBO->gpuRenderPass->endAccesses[colorAttachmentCount]; + } else { + _curGPUFBO->swapchain->depthStencilImageAccessTypes[_curGPUFBO->swapchain->curImageIndex] = _curGPUFBO->gpuRenderPass->endAccesses[colorAttachmentCount]; + } + } + _curGPUFBO = nullptr; + +#if BARRIER_DEDUCTION_LEVEL >= BARRIER_DEDUCTION_LEVEL_BASIC + // guard against WAR hazard + vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, + VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 0, nullptr); +#endif } void CCVKCommandBuffer::bindPipelineState(PipelineState *pso) { - CCVKGPUPipelineState *gpuPipelineState = ((CCVKPipelineState *)pso)->gpuPipelineState(); + CCVKGPUPipelineState *gpuPipelineState = static_cast(pso)->gpuPipelineState(); if (_curGPUPipelineState != gpuPipelineState) { - vkCmdBindPipeline(_gpuCommandBuffer->vkCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, gpuPipelineState->vkPipeline); + vkCmdBindPipeline(_gpuCommandBuffer->vkCommandBuffer, VK_PIPELINE_BIND_POINTS[static_cast(gpuPipelineState->bindPoint)], gpuPipelineState->vkPipeline); _curGPUPipelineState = gpuPipelineState; } } @@ -194,21 +209,21 @@ void CCVKCommandBuffer::bindPipelineState(PipelineState *pso) { void CCVKCommandBuffer::bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) { CCASSERT(_curGPUDescriptorSets.size() > set, "Invalid set index"); - CCVKGPUDescriptorSet *gpuDescriptorSet = ((CCVKDescriptorSet *)descriptorSet)->gpuDescriptorSet(); + CCVKGPUDescriptorSet *gpuDescriptorSet = static_cast(descriptorSet)->gpuDescriptorSet(); if (_curGPUDescriptorSets[set] != gpuDescriptorSet) { _curGPUDescriptorSets[set] = gpuDescriptorSet; if (set < _firstDirtyDescriptorSet) _firstDirtyDescriptorSet = set; } if (dynamicOffsetCount) { - _curDynamicOffsetPtrs[set] = dynamicOffsets; + _curDynamicOffsetPtrs[set] = dynamicOffsets; _curDynamicOffsetCounts[set] = dynamicOffsetCount; if (set < _firstDirtyDescriptorSet) _firstDirtyDescriptorSet = set; } } void CCVKCommandBuffer::bindInputAssembler(InputAssembler *ia) { - CCVKGPUInputAssembler *gpuInputAssembler = ((CCVKInputAssembler *)ia)->gpuInputAssembler(); + CCVKGPUInputAssembler *gpuInputAssembler = static_cast(ia)->gpuInputAssembler(); if (_curGPUInputAssember != gpuInputAssembler) { // buffers may be rebuilt(e.g. resize event) without IA's acknowledge @@ -218,8 +233,8 @@ void CCVKCommandBuffer::bindInputAssembler(InputAssembler *ia) { gpuInputAssembler->vertexBufferOffsets.resize(vbCount); } - for (size_t i = 0u; i < vbCount; i++) { - gpuInputAssembler->vertexBuffers[i] = gpuInputAssembler->gpuVertexBuffers[i]->vkBuffer; + for (size_t i = 0U; i < vbCount; ++i) { + gpuInputAssembler->vertexBuffers[i] = gpuInputAssembler->gpuVertexBuffers[i]->vkBuffer; gpuInputAssembler->vertexBufferOffsets[i] = gpuInputAssembler->gpuVertexBuffers[i]->startOffset; } @@ -238,7 +253,7 @@ void CCVKCommandBuffer::setViewport(const Viewport &vp) { if (_curViewport != vp) { _curViewport = vp; - VkViewport viewport{(float)vp.left, (float)vp.top, (float)vp.width, (float)vp.height, vp.minDepth, vp.maxDepth}; + VkViewport viewport{static_cast(vp.left), static_cast(vp.top), static_cast(vp.width), static_cast(vp.height), vp.minDepth, vp.maxDepth}; vkCmdSetViewport(_gpuCommandBuffer->vkCommandBuffer, 0, 1, &viewport); } } @@ -247,7 +262,7 @@ void CCVKCommandBuffer::setScissor(const Rect &rect) { if (_curScissor != rect) { _curScissor = rect; - VkRect2D scissor = {{(int)rect.x, (int)rect.y}, {rect.width, rect.height}}; + VkRect2D scissor = {{rect.x, rect.y}, {rect.width, rect.height}}; vkCmdSetScissor(_gpuCommandBuffer->vkCommandBuffer, 0, 1, &scissor); } } @@ -264,8 +279,8 @@ void CCVKCommandBuffer::setDepthBias(float constant, float clamp, float slope) { math::IsNotEqualF(_curDepthBias.clamp, clamp) || math::IsNotEqualF(_curDepthBias.slope, slope)) { _curDepthBias.constant = constant; - _curDepthBias.clamp = clamp; - _curDepthBias.slope = slope; + _curDepthBias.clamp = clamp; + _curDepthBias.slope = slope; vkCmdSetDepthBias(_gpuCommandBuffer->vkCommandBuffer, constant, clamp, slope); } } @@ -295,7 +310,7 @@ void CCVKCommandBuffer::setDepthBound(float minBounds, float maxBounds) { void CCVKCommandBuffer::setStencilWriteMask(StencilFace face, uint mask) { if ((_curStencilWriteMask.face != face) || (_curStencilWriteMask.write_mask != mask)) { - _curStencilWriteMask.face = face; + _curStencilWriteMask.face = face; _curStencilWriteMask.write_mask = mask; vkCmdSetStencilWriteMask(_gpuCommandBuffer->vkCommandBuffer, face == StencilFace::FRONT ? VK_STENCIL_FACE_FRONT_BIT : VK_STENCIL_FACE_BACK_BIT, mask); @@ -306,8 +321,8 @@ void CCVKCommandBuffer::setStencilCompareMask(StencilFace face, int reference, u if ((_curStencilCompareMask.face != face) || (_curStencilCompareMask.reference != reference) || (_curStencilCompareMask.compareMask != mask)) { - _curStencilCompareMask.face = face; - _curStencilCompareMask.reference = reference; + _curStencilCompareMask.face = face; + _curStencilCompareMask.reference = reference; _curStencilCompareMask.compareMask = mask; VkStencilFaceFlagBits vkFace = (face == StencilFace::FRONT ? VK_STENCIL_FACE_FRONT_BIT : VK_STENCIL_FACE_BACK_BIT); @@ -316,20 +331,21 @@ void CCVKCommandBuffer::setStencilCompareMask(StencilFace face, int reference, u } } -void CCVKCommandBuffer::draw(InputAssembler *ia) { +void CCVKCommandBuffer::nextSubpass() { + vkCmdNextSubpass(_gpuCommandBuffer->vkCommandBuffer, _secondaryRP ? VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS : VK_SUBPASS_CONTENTS_INLINE); +} + +void CCVKCommandBuffer::draw(const DrawInfo &info) { if (_firstDirtyDescriptorSet < _curGPUDescriptorSets.size()) { - bindDescriptorSets(); + bindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS); } - CCVKGPUInputAssembler *gpuInputAssembler = ((CCVKInputAssembler *)ia)->gpuInputAssembler(); - CCVKGPUBuffer *gpuIndirectBuffer = gpuInputAssembler->gpuIndirectBuffer; - - DrawInfo drawInfo; + CCVKGPUBuffer *gpuIndirectBuffer = _curGPUInputAssember->gpuIndirectBuffer; if (gpuIndirectBuffer) { - uint drawInfoCount = gpuIndirectBuffer->count; - CCVKGPUDevice *gpuDevice = static_cast(_device)->gpuDevice(); - VkDeviceSize offset = gpuIndirectBuffer->startOffset + gpuDevice->curBackBufferIndex * gpuIndirectBuffer->instanceSize; + uint drawInfoCount = gpuIndirectBuffer->count; + CCVKGPUDevice *gpuDevice = CCVKDevice::getInstance()->gpuDevice(); + VkDeviceSize offset = gpuIndirectBuffer->startOffset + gpuDevice->curBackBufferIndex * gpuIndirectBuffer->instanceSize; if (gpuDevice->useMultiDrawIndirect) { if (gpuIndirectBuffer->isDrawIndirectByIndex) { vkCmdDrawIndexedIndirect(_gpuCommandBuffer->vkCommandBuffer, @@ -345,9 +361,8 @@ void CCVKCommandBuffer::draw(InputAssembler *ia) { sizeof(VkDrawIndirectCommand)); } } else { - // If multi draw is not available, we must issue separate draw commands if (gpuIndirectBuffer->isDrawIndirectByIndex) { - for (VkDeviceSize j = 0u; j < drawInfoCount; j++) { + for (VkDeviceSize j = 0U; j < drawInfoCount; ++j) { vkCmdDrawIndexedIndirect(_gpuCommandBuffer->vkCommandBuffer, gpuIndirectBuffer->vkBuffer, offset + j * sizeof(VkDrawIndexedIndirectCommand), @@ -355,7 +370,7 @@ void CCVKCommandBuffer::draw(InputAssembler *ia) { sizeof(VkDrawIndexedIndirectCommand)); } } else { - for (VkDeviceSize j = 0u; j < drawInfoCount; j++) { + for (VkDeviceSize j = 0U; j < drawInfoCount; ++j) { vkCmdDrawIndirect(_gpuCommandBuffer->vkCommandBuffer, gpuIndirectBuffer->vkBuffer, offset + j * sizeof(VkDrawIndirectCommand), @@ -365,22 +380,21 @@ void CCVKCommandBuffer::draw(InputAssembler *ia) { } } } else { - ((CCVKInputAssembler *)ia)->extractDrawInfo(drawInfo); - uint instanceCount = std::max(drawInfo.instanceCount, 1u); - bool hasIndexBuffer = gpuInputAssembler->gpuIndexBuffer && drawInfo.indexCount > 0; + uint instanceCount = std::max(info.instanceCount, 1U); + bool hasIndexBuffer = _curGPUInputAssember->gpuIndexBuffer && info.indexCount > 0; if (hasIndexBuffer) { - vkCmdDrawIndexed(_gpuCommandBuffer->vkCommandBuffer, drawInfo.indexCount, instanceCount, - drawInfo.firstIndex, drawInfo.vertexOffset, drawInfo.firstInstance); + vkCmdDrawIndexed(_gpuCommandBuffer->vkCommandBuffer, info.indexCount, instanceCount, + info.firstIndex, info.vertexOffset, info.firstInstance); } else { - vkCmdDraw(_gpuCommandBuffer->vkCommandBuffer, drawInfo.vertexCount, instanceCount, - drawInfo.firstVertex, drawInfo.firstInstance); + vkCmdDraw(_gpuCommandBuffer->vkCommandBuffer, info.vertexCount, instanceCount, + info.firstVertex, info.firstInstance); } ++_numDrawCalls; - _numInstances += drawInfo.instanceCount; + _numInstances += info.instanceCount; if (_curGPUPipelineState) { - uint indexCount = hasIndexBuffer ? drawInfo.indexCount : drawInfo.vertexCount; + uint indexCount = hasIndexBuffer ? info.indexCount : info.vertexCount; switch (_curGPUPipelineState->primitive) { case PrimitiveMode::TRIANGLE_LIST: _numTriangles += indexCount / 3 * instanceCount; @@ -395,13 +409,13 @@ void CCVKCommandBuffer::draw(InputAssembler *ia) { } } -void CCVKCommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint count) { +void CCVKCommandBuffer::execute(CommandBuffer *const *cmdBuffs, uint count) { if (!count) return; _vkCommandBuffers.resize(count); - uint validCount = 0u; - for (uint i = 0u; i < count; ++i) { - CCVKCommandBuffer *cmdBuff = (CCVKCommandBuffer *)cmdBuffs[i]; + uint validCount = 0U; + for (uint i = 0U; i < count; ++i) { + auto *cmdBuff = static_cast(cmdBuffs[i]); if (!cmdBuff->_pendingQueue.empty()) { _vkCommandBuffers[validCount++] = cmdBuff->_pendingQueue.front(); cmdBuff->_pendingQueue.pop(); @@ -418,25 +432,86 @@ void CCVKCommandBuffer::execute(const CommandBuffer *const *cmdBuffs, uint count } void CCVKCommandBuffer::updateBuffer(Buffer *buffer, const void *data, uint size) { - CCVKCmdFuncUpdateBuffer((CCVKDevice *)_device, ((CCVKBuffer *)buffer)->gpuBuffer(), data, size, _gpuCommandBuffer); + CCVKGPUBuffer *gpuBuffer = static_cast(buffer)->gpuBuffer(); + cmdFuncCCVKUpdateBuffer(CCVKDevice::getInstance(), gpuBuffer, data, size, _gpuCommandBuffer); } void CCVKCommandBuffer::copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) { - CCVKCmdFuncCopyBuffersToTexture((CCVKDevice *)_device, buffers, ((CCVKTexture *)texture)->gpuTexture(), regions, count, _gpuCommandBuffer); + cmdFuncCCVKCopyBuffersToTexture(CCVKDevice::getInstance(), buffers, static_cast(texture)->gpuTexture(), regions, count, _gpuCommandBuffer); } -void CCVKCommandBuffer::bindDescriptorSets() { - CCVKDevice *device = (CCVKDevice *)_device; - CCVKGPUDevice *gpuDevice = device->gpuDevice(); - CCVKGPUPipelineLayout *pipelineLayout = _curGPUPipelineState->gpuPipelineLayout; - vector &dynamicOffsetOffsets = pipelineLayout->dynamicOffsetOffsets; - uint descriptorSetCount = pipelineLayout->setLayouts.size(); +void CCVKCommandBuffer::blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) { + VkImageAspectFlags srcAspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + VkImageAspectFlags dstAspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + VkImage srcImage = VK_NULL_HANDLE; + VkImage dstImage = VK_NULL_HANDLE; + VkImageLayout srcImageLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + VkImageLayout dstImageLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + CCVKGPUSwapchain * swapchain = CCVKDevice::getInstance()->gpuSwapchain(); + + if (srcTexture) { + CCVKGPUTexture *gpuTextureSrc = static_cast(srcTexture)->gpuTexture(); + srcAspectMask = gpuTextureSrc->aspectMask; + srcImage = gpuTextureSrc->vkImage; + } else { + srcAspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + srcImage = swapchain->swapchainImages[swapchain->curImageIndex]; + } + + if (dstTexture) { + CCVKGPUTexture *gpuTextureDst = static_cast(dstTexture)->gpuTexture(); + dstAspectMask = gpuTextureDst->aspectMask; + dstImage = gpuTextureDst->vkImage; + } else { + dstAspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + dstImage = swapchain->swapchainImages[swapchain->curImageIndex]; + } + + _blitRegions.resize(count); + for (uint i = 0U; i < count; ++i) { + const TextureBlit ®ion = regions[i]; + _blitRegions[i].srcSubresource.aspectMask = srcAspectMask; + _blitRegions[i].srcSubresource.mipLevel = region.srcSubres.mipLevel; + _blitRegions[i].srcSubresource.baseArrayLayer = region.srcSubres.baseArrayLayer; + _blitRegions[i].srcSubresource.layerCount = region.srcSubres.layerCount; + _blitRegions[i].srcOffsets[0].x = region.srcOffset.x; + _blitRegions[i].srcOffsets[0].y = region.srcOffset.y; + _blitRegions[i].srcOffsets[0].z = region.srcOffset.z; + _blitRegions[i].srcOffsets[1].x = region.srcExtent.width; + _blitRegions[i].srcOffsets[1].y = region.srcExtent.height; + _blitRegions[i].srcOffsets[1].z = region.srcExtent.depth; + + _blitRegions[i].dstSubresource.aspectMask = dstAspectMask; + _blitRegions[i].dstSubresource.mipLevel = region.dstSubres.mipLevel; + _blitRegions[i].dstSubresource.baseArrayLayer = region.dstSubres.baseArrayLayer; + _blitRegions[i].dstSubresource.layerCount = region.dstSubres.layerCount; + _blitRegions[i].dstOffsets[0].x = region.dstOffset.x; + _blitRegions[i].dstOffsets[0].y = region.dstOffset.y; + _blitRegions[i].dstOffsets[0].z = region.dstOffset.z; + _blitRegions[i].dstOffsets[1].x = region.dstExtent.width; + _blitRegions[i].dstOffsets[1].y = region.dstExtent.height; + _blitRegions[i].dstOffsets[1].z = region.dstExtent.depth; + } + + vkCmdBlitImage(_gpuCommandBuffer->vkCommandBuffer, + srcImage, srcImageLayout, + dstImage, dstImageLayout, + count, _blitRegions.data(), VK_FILTERS[static_cast(filter)]); +} + +void CCVKCommandBuffer::bindDescriptorSets(VkPipelineBindPoint bindPoint) { + CCVKDevice * device = CCVKDevice::getInstance(); + CCVKGPUDevice * gpuDevice = device->gpuDevice(); + CCVKGPUPipelineLayout *pipelineLayout = _curGPUPipelineState->gpuPipelineLayout; + vector & dynamicOffsetOffsets = pipelineLayout->dynamicOffsetOffsets; + uint descriptorSetCount = pipelineLayout->setLayouts.size(); _curDynamicOffsets.resize(pipelineLayout->dynamicOffsetCount); uint dirtyDescriptorSetCount = descriptorSetCount - _firstDirtyDescriptorSet; for (uint i = _firstDirtyDescriptorSet; i < descriptorSetCount; ++i) { if (_curGPUDescriptorSets[i]) { - _curVkDescriptorSets[i] = _curGPUDescriptorSets[i]->instances[gpuDevice->curBackBufferIndex].vkDescriptorSet; + const CCVKGPUDescriptorSet::Instance &instance = _curGPUDescriptorSets[i]->instances[gpuDevice->curBackBufferIndex]; + _curVkDescriptorSets[i] = instance.vkDescriptorSet; } else { _curVkDescriptorSets[i] = pipelineLayout->setLayouts[i]->defaultDescriptorSet; } @@ -447,10 +522,10 @@ void CCVKCommandBuffer::bindDescriptorSets() { } uint dynamicOffsetStartIndex = dynamicOffsetOffsets[_firstDirtyDescriptorSet]; - uint dynamicOffsetEndIndex = dynamicOffsetOffsets[_firstDirtyDescriptorSet + dirtyDescriptorSetCount]; - uint dynamicOffsetCount = dynamicOffsetEndIndex - dynamicOffsetStartIndex; + uint dynamicOffsetEndIndex = dynamicOffsetOffsets[_firstDirtyDescriptorSet + dirtyDescriptorSetCount]; + uint dynamicOffsetCount = dynamicOffsetEndIndex - dynamicOffsetStartIndex; vkCmdBindDescriptorSets(_gpuCommandBuffer->vkCommandBuffer, - VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout->vkPipelineLayout, + bindPoint, pipelineLayout->vkPipelineLayout, _firstDirtyDescriptorSet, dirtyDescriptorSetCount, &_curVkDescriptorSets[_firstDirtyDescriptorSet], dynamicOffsetCount, _curDynamicOffsets.data() + dynamicOffsetStartIndex); @@ -458,5 +533,63 @@ void CCVKCommandBuffer::bindDescriptorSets() { _firstDirtyDescriptorSet = UINT_MAX; } +void CCVKCommandBuffer::dispatch(const DispatchInfo &info) { + if (_firstDirtyDescriptorSet < _curGPUDescriptorSets.size()) { + bindDescriptorSets(VK_PIPELINE_BIND_POINT_COMPUTE); + } + + if (info.indirectBuffer) { + auto *indirectBuffer = static_cast(info.indirectBuffer); + vkCmdDispatchIndirect(_gpuCommandBuffer->vkCommandBuffer, indirectBuffer->gpuBuffer()->vkBuffer, + indirectBuffer->gpuBuffer()->startOffset + indirectBuffer->gpuBufferView()->offset + info.indirectOffset); + } else { + vkCmdDispatch(_gpuCommandBuffer->vkCommandBuffer, info.groupCountX, info.groupCountY, info.groupCountZ); + } +} + +void CCVKCommandBuffer::pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) { + VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + VkMemoryBarrier const * pMemoryBarrier = nullptr; + uint memoryBarrierCount = 0U; + VkImageMemoryBarrier const *pImageMemoryBarriers = nullptr; + + if (barrier) { + const auto *gpuBarrier = static_cast(barrier)->gpuBarrier(); + srcStageMask |= gpuBarrier->srcStageMask; + dstStageMask |= gpuBarrier->dstStageMask; + pMemoryBarrier = &gpuBarrier->vkBarrier; + memoryBarrierCount = 1U; + } + + if (textureBarrierCount > 0) { + _imageMemoryBarriers.resize(textureBarrierCount); + pImageMemoryBarriers = _imageMemoryBarriers.data(); + + for (uint i = 0U; i < textureBarrierCount; ++i) { + const auto *gpuBarrier = static_cast(textureBarriers[i])->gpuBarrier(); + _imageMemoryBarriers[i] = gpuBarrier->vkBarrier; + + if (textures[i]) { + auto *gpuTexture = static_cast(textures[i])->gpuTexture(); + _imageMemoryBarriers[i].image = gpuTexture->vkImage; + _imageMemoryBarriers[i].subresourceRange.aspectMask = gpuTexture->aspectMask; + gpuTexture->currentAccessTypes.assign(gpuBarrier->barrier.pNextAccesses, gpuBarrier->barrier.pNextAccesses + gpuBarrier->barrier.nextAccessCount); + } else { + CCVKGPUSwapchain *swapchain = CCVKDevice::getInstance()->gpuSwapchain(); + _imageMemoryBarriers[i].image = swapchain->swapchainImages[swapchain->curImageIndex]; + _imageMemoryBarriers[i].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + swapchain->swapchainImageAccessTypes[swapchain->curImageIndex].assign(gpuBarrier->barrier.pNextAccesses, gpuBarrier->barrier.pNextAccesses + gpuBarrier->barrier.nextAccessCount); + } + + srcStageMask |= gpuBarrier->srcStageMask; + dstStageMask |= gpuBarrier->dstStageMask; + } + } + + vkCmdPipelineBarrier(_gpuCommandBuffer->vkCommandBuffer, srcStageMask, dstStageMask, 0, memoryBarrierCount, pMemoryBarrier, + 0, nullptr, textureBarrierCount, pImageMemoryBarriers); +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h index ee09aef269..d3e27dfa20 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h +++ b/native/cocos/renderer/gfx-vulkan/VKCommandBuffer.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_COMMAND_BUFFER_H_ -#define CC_GFXVULKAN_COMMAND_BUFFER_H_ + +#pragma once + +#include "gfx-base/GFXCommandBuffer.h" #include "VKCommands.h" @@ -31,39 +34,42 @@ namespace gfx { class CC_VULKAN_API CCVKCommandBuffer final : public CommandBuffer { public: - CCVKCommandBuffer(Device *device); - ~CCVKCommandBuffer(); + CCVKCommandBuffer() = default; + ~CCVKCommandBuffer() override; - friend class CCVKQueue; - -public: - virtual bool initialize(const CommandBufferInfo &info) override; - virtual void destroy() override; - - virtual void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer, int submitIndex) override; - virtual void end() override; - virtual void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, bool fromSecondaryCB) override; - virtual void endRenderPass() override; - virtual void bindPipelineState(PipelineState *pso) override; - virtual void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; - virtual void bindInputAssembler(InputAssembler *ia) override; - virtual void setViewport(const Viewport &vp) override; - virtual void setScissor(const Rect &rect) override; - virtual void setLineWidth(float width) override; - virtual void setDepthBias(float constant, float clamp, float slope) override; - virtual void setBlendConstants(const Color &constants) override; - virtual void setDepthBound(float minBounds, float maxBounds) override; - virtual void setStencilWriteMask(StencilFace face, uint mask) override; - virtual void setStencilCompareMask(StencilFace face, int reference, uint mask) override; - virtual void draw(InputAssembler *ia) override; - virtual void updateBuffer(Buffer *buffer, const void *data, uint size) override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; - virtual void execute(const CommandBuffer *const *cmdBuffs, uint count) override; + void begin(RenderPass *renderPass, uint subpass, Framebuffer *frameBuffer) override; + void end() override; + void beginRenderPass(RenderPass *renderPass, Framebuffer *fbo, const Rect &renderArea, const Color *colors, float depth, int stencil, CommandBuffer *const *secondaryCBs, uint secondaryCBCount) override; + void endRenderPass() override; + void bindPipelineState(PipelineState *pso) override; + void bindDescriptorSet(uint set, DescriptorSet *descriptorSet, uint dynamicOffsetCount, const uint *dynamicOffsets) override; + void bindInputAssembler(InputAssembler *ia) override; + void setViewport(const Viewport &vp) override; + void setScissor(const Rect &rect) override; + void setLineWidth(float width) override; + void setDepthBias(float constant, float clamp, float slope) override; + void setBlendConstants(const Color &constants) override; + void setDepthBound(float minBounds, float maxBounds) override; + void setStencilWriteMask(StencilFace face, uint mask) override; + void setStencilCompareMask(StencilFace face, int reference, uint mask) override; + void nextSubpass() override; + void draw(const DrawInfo &info) override; + void updateBuffer(Buffer *buffer, const void *data, uint size) override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *texture, const BufferTextureCopy *regions, uint count) override; + void blitTexture(Texture *srcTexture, Texture *dstTexture, const TextureBlit *regions, uint count, Filter filter) override; + void execute(CommandBuffer *const *cmdBuffs, uint count) override; + void dispatch(const DispatchInfo &info) override; + void pipelineBarrier(const GlobalBarrier *barrier, const TextureBarrier *const *textureBarriers, const Texture *const *textures, uint textureBarrierCount) override; CCVKGPUCommandBuffer *gpuCommandBuffer() const { return _gpuCommandBuffer; } -private: - void bindDescriptorSets(); +protected: + friend class CCVKQueue; + + void doInit(const CommandBufferInfo &info) override; + void doDestroy() override; + + void bindDescriptorSets(VkPipelineBindPoint bindPoint); CCVKGPUCommandBuffer *_gpuCommandBuffer = nullptr; @@ -78,20 +84,24 @@ private: CCVKGPUInputAssembler *_curGPUInputAssember = nullptr; CCVKGPUFramebuffer *_curGPUFBO = nullptr; + bool _secondaryRP = false; + Viewport _curViewport; Rect _curScissor; - float _curLineWidth = 1.0f; + float _curLineWidth = 1.0F; CCVKDepthBias _curDepthBias; Color _curBlendConstants; CCVKDepthBounds _curDepthBounds; CCVKStencilWriteMask _curStencilWriteMask; CCVKStencilCompareMask _curStencilCompareMask; - + + // temp storage + vector _blitRegions; + vector _imageMemoryBarriers; vector _vkCommandBuffers; + queue _pendingQueue; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp index 0e0eea6ac6..fe95bacf05 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKBuffer.h" @@ -32,32 +34,39 @@ THE SOFTWARE. #include -#define BUFFER_OFFSET(idx) (static_cast(0) + (idx)) - namespace cc { namespace gfx { -CCVKGPUCommandBufferPool *CCVKGPUDevice::getCommandBufferPool(std::thread::id threadID) { - if (!commandBufferPools.count(threadID)) { - //std::scoped_lock guard(mutex); - commandBufferPools[threadID] = CC_NEW(CCVKGPUCommandBufferPool(this)); - } - return commandBufferPools[threadID]; +namespace { +constexpr bool ENABLE_LAZY_ALLOCATION = true; } -void insertVkDynamicStates(vector &out, const vector &dynamicStates) { +CCVKGPUCommandBufferPool *CCVKGPUDevice::getCommandBufferPool() { + std::thread::id threadID = std::this_thread::get_id(); + if (!_commandBufferPools.count(threadID)) { + //std::scoped_lock guard(mutex); + _commandBufferPools[threadID] = CC_NEW(CCVKGPUCommandBufferPool(this)); + } + return _commandBufferPools[threadID]; +} + +CCVKGPUDescriptorSetPool *CCVKGPUDevice::getDescriptorSetPool(uint layoutID) { + return &_descriptorSetPools[layoutID]; +} + +void insertVkDynamicStates(vector *out, const vector &dynamicStates) { for (DynamicStateFlagBit dynamicState : dynamicStates) { switch (dynamicState) { - case DynamicStateFlagBit::VIEWPORT: break; // we make this dynamic by default - case DynamicStateFlagBit::SCISSOR: break; // we make this dynamic by default - case DynamicStateFlagBit::LINE_WIDTH: out.push_back(VK_DYNAMIC_STATE_LINE_WIDTH); break; - case DynamicStateFlagBit::DEPTH_BIAS: out.push_back(VK_DYNAMIC_STATE_DEPTH_BIAS); break; - case DynamicStateFlagBit::BLEND_CONSTANTS: out.push_back(VK_DYNAMIC_STATE_BLEND_CONSTANTS); break; - case DynamicStateFlagBit::DEPTH_BOUNDS: out.push_back(VK_DYNAMIC_STATE_DEPTH_BOUNDS); break; - case DynamicStateFlagBit::STENCIL_WRITE_MASK: out.push_back(VK_DYNAMIC_STATE_STENCIL_WRITE_MASK); break; + case DynamicStateFlagBit::VIEWPORT: + case DynamicStateFlagBit::SCISSOR: break; // we make this dynamic by default + case DynamicStateFlagBit::LINE_WIDTH: out->push_back(VK_DYNAMIC_STATE_LINE_WIDTH); break; + case DynamicStateFlagBit::DEPTH_BIAS: out->push_back(VK_DYNAMIC_STATE_DEPTH_BIAS); break; + case DynamicStateFlagBit::BLEND_CONSTANTS: out->push_back(VK_DYNAMIC_STATE_BLEND_CONSTANTS); break; + case DynamicStateFlagBit::DEPTH_BOUNDS: out->push_back(VK_DYNAMIC_STATE_DEPTH_BOUNDS); break; + case DynamicStateFlagBit::STENCIL_WRITE_MASK: out->push_back(VK_DYNAMIC_STATE_STENCIL_WRITE_MASK); break; case DynamicStateFlagBit::STENCIL_COMPARE_MASK: - out.push_back(VK_DYNAMIC_STATE_STENCIL_REFERENCE); - out.push_back(VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK); + out->push_back(VK_DYNAMIC_STATE_STENCIL_REFERENCE); + out->push_back(VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK); break; default: { CCASSERT(false, "Unsupported DynamicStateFlagBit, convert to VkDynamicState failed."); @@ -67,24 +76,24 @@ void insertVkDynamicStates(vector &out, const vectortype) { case QueueType::GRAPHICS: - queueType = VK_QUEUE_GRAPHICS_BIT; + queueType = VK_QUEUE_GRAPHICS_BIT; needPresentable = VK_TRUE; break; case QueueType::COMPUTE: queueType = VK_QUEUE_COMPUTE_BIT; break; case QueueType::TRANSFER: queueType = VK_QUEUE_TRANSFER_BIT; break; } - const CCVKGPUContext *context = ((CCVKContext *)device->getContext())->gpuContext(); + const CCVKGPUContext *context = device->gpuContext(); size_t queueCount = context->queueFamilyProperties.size(); - for (size_t i = 0u; i < queueCount; ++i) { - const VkQueueFamilyProperties &properties = context->queueFamilyProperties[i]; - const VkBool32 isPresentable = context->queueFamilyPresentables[i]; + for (size_t i = 0U; i < queueCount; ++i) { + const VkQueueFamilyProperties &properties = context->queueFamilyProperties[i]; + const VkBool32 isPresentable = context->queueFamilyPresentables[i]; if (properties.queueCount > 0 && (properties.queueFlags & queueType) && (!needPresentable || isPresentable)) { vkGetDeviceQueue(device->gpuDevice()->vkDevice, i, 0, &gpuQueue->vkQueue); gpuQueue->queueFamilyIndex = i; @@ -93,99 +102,114 @@ void CCVKCmdFuncGetDeviceQueue(CCVKDevice *device, CCVKGPUQueue *gpuQueue) { } } -void CCVKCmdFuncCreateTexture(CCVKDevice *device, CCVKGPUTexture *gpuTexture) { +void cmdFuncCCVKCreateTexture(CCVKDevice *device, CCVKGPUTexture *gpuTexture) { if (!gpuTexture->size) return; - VkFormat format = MapVkFormat(gpuTexture->format); - VkFormatFeatureFlags features = MapVkFormatFeatureFlags(gpuTexture->usage); - VkFormatProperties formatProperties; + gpuTexture->aspectMask = mapVkImageAspectFlags(gpuTexture->format); + + VkFormat format = mapVkFormat(gpuTexture->format); + VkFormatFeatureFlags features = mapVkFormatFeatureFlags(gpuTexture->usage); + VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(device->gpuContext()->physicalDevice, format, &formatProperties); if (!(formatProperties.optimalTilingFeatures & features)) { - const char *formatName = GFX_FORMAT_INFOS[(uint)gpuTexture->format].name.c_str(); - CC_LOG_ERROR("CCVKCmdFuncCreateTexture: The specified usage for %s is not supported on this platform", formatName); + const char *formatName = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].name.c_str(); + CC_LOG_ERROR("cmdFuncCCVKCreateTexture: The specified usage for %s is not supported on this platform", formatName); return; } - VkImageUsageFlags usageFlags = MapVkImageUsageFlagBits(gpuTexture->usage); - if (gpuTexture->flags & TextureFlags::GEN_MIPMAP) { + VkImageUsageFlags usageFlags = mapVkImageUsageFlagBits(gpuTexture->usage); + if (hasFlag(gpuTexture->flags, TextureFlags::GEN_MIPMAP)) { usageFlags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } VkImageCreateInfo createInfo{VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO}; - createInfo.flags = MapVkImageCreateFlags(gpuTexture->type); - createInfo.imageType = MapVkImageType(gpuTexture->type); - createInfo.format = format; - createInfo.extent = {gpuTexture->width, gpuTexture->height, gpuTexture->depth}; - createInfo.mipLevels = gpuTexture->mipLevels; - createInfo.arrayLayers = gpuTexture->arrayLayers; - createInfo.samples = MapVkSampleCount(gpuTexture->samples); - createInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - createInfo.usage = usageFlags; + createInfo.flags = mapVkImageCreateFlags(gpuTexture->type); + createInfo.imageType = mapVkImageType(gpuTexture->type); + createInfo.format = format; + createInfo.extent = {gpuTexture->width, gpuTexture->height, gpuTexture->depth}; + createInfo.mipLevels = gpuTexture->mipLevels; + createInfo.arrayLayers = gpuTexture->arrayLayers; + createInfo.samples = mapVkSampleCount(gpuTexture->samples); + createInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + createInfo.usage = usageFlags; createInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; VmaAllocationCreateInfo allocInfo{}; allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; VmaAllocationInfo res; + + TextureUsage transientUsages = gpuTexture->usage & TEXTURE_USAGE_TRANSIENT; + if (ENABLE_LAZY_ALLOCATION && transientUsages != TextureUsage::NONE && transientUsages == gpuTexture->usage) { + createInfo.usage = usageFlags | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; + allocInfo.usage = VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED; + VkResult result = vmaCreateImage(device->gpuDevice()->memoryAllocator, &createInfo, &allocInfo, &gpuTexture->vkImage, &gpuTexture->vmaAllocation, &res); + if (!result) { + CC_LOG_INFO("Created memoryless texture: %s-%dx%d", + GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].name.c_str(), + gpuTexture->width, gpuTexture->height); + return; + } + + // feature not present, fallback + createInfo.usage = usageFlags; + allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; + } + VK_CHECK(vmaCreateImage(device->gpuDevice()->memoryAllocator, &createInfo, &allocInfo, &gpuTexture->vkImage, &gpuTexture->vmaAllocation, &res)); //CC_LOG_DEBUG("Allocated texture: %llu %llx %llx %llu %x", res.size, gpuTexture->vkImage, res.deviceMemory, res.offset, res.pMappedData); - - gpuTexture->layout = MapVkImageLayout(gpuTexture->usage, gpuTexture->format); - gpuTexture->accessMask = MapVkAccessFlags(gpuTexture->usage, gpuTexture->format); - gpuTexture->aspectMask = MapVkImageAspectFlags(gpuTexture->format); - gpuTexture->targetStage = MapVkPipelineStageFlags(gpuTexture->usage); } -void CCVKCmdFuncCreateTextureView(CCVKDevice *device, CCVKGPUTextureView *gpuTextureView) { +void cmdFuncCCVKCreateTextureView(CCVKDevice *device, CCVKGPUTextureView *gpuTextureView) { if (!gpuTextureView->gpuTexture || !gpuTextureView->gpuTexture->vkImage) return; VkImageViewCreateInfo createInfo{VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO}; - createInfo.image = gpuTextureView->gpuTexture->vkImage; - createInfo.viewType = MapVkImageViewType(gpuTextureView->type); - createInfo.format = MapVkFormat(gpuTextureView->format); - createInfo.subresourceRange.aspectMask = GFX_FORMAT_INFOS[(uint)gpuTextureView->format].hasDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT; - createInfo.subresourceRange.baseMipLevel = gpuTextureView->baseLevel; - createInfo.subresourceRange.levelCount = gpuTextureView->levelCount; + createInfo.image = gpuTextureView->gpuTexture->vkImage; + createInfo.viewType = mapVkImageViewType(gpuTextureView->type); + createInfo.format = mapVkFormat(gpuTextureView->format); + createInfo.subresourceRange.aspectMask = GFX_FORMAT_INFOS[static_cast(gpuTextureView->format)].hasDepth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT; + createInfo.subresourceRange.baseMipLevel = gpuTextureView->baseLevel; + createInfo.subresourceRange.levelCount = gpuTextureView->levelCount; createInfo.subresourceRange.baseArrayLayer = gpuTextureView->baseLayer; - createInfo.subresourceRange.layerCount = gpuTextureView->layerCount; + createInfo.subresourceRange.layerCount = gpuTextureView->layerCount; VK_CHECK(vkCreateImageView(device->gpuDevice()->vkDevice, &createInfo, nullptr, &gpuTextureView->vkImageView)); device->gpuDescriptorHub()->update(gpuTextureView); } -void CCVKCmdFuncCreateSampler(CCVKDevice *device, CCVKGPUSampler *gpuSampler) { +void cmdFuncCCVKCreateSampler(CCVKDevice *device, CCVKGPUSampler *gpuSampler) { VkSamplerCreateInfo createInfo{VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO}; - CCVKGPUContext *context = device->gpuContext(); + CCVKGPUContext * context = device->gpuContext(); - createInfo.magFilter = VK_FILTERS[(uint)gpuSampler->magFilter]; - createInfo.minFilter = VK_FILTERS[(uint)gpuSampler->minFilter]; - createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODES[(uint)gpuSampler->mipFilter]; - createInfo.addressModeU = VK_SAMPLER_ADDRESS_MODES[(uint)gpuSampler->addressU]; - createInfo.addressModeV = VK_SAMPLER_ADDRESS_MODES[(uint)gpuSampler->addressV]; - createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODES[(uint)gpuSampler->addressW]; - createInfo.mipLodBias = gpuSampler->mipLODBias; + createInfo.magFilter = VK_FILTERS[static_cast(gpuSampler->magFilter)]; + createInfo.minFilter = VK_FILTERS[static_cast(gpuSampler->minFilter)]; + createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODES[static_cast(gpuSampler->mipFilter)]; + createInfo.addressModeU = VK_SAMPLER_ADDRESS_MODES[static_cast(gpuSampler->addressU)]; + createInfo.addressModeV = VK_SAMPLER_ADDRESS_MODES[static_cast(gpuSampler->addressV)]; + createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODES[static_cast(gpuSampler->addressW)]; + createInfo.mipLodBias = gpuSampler->mipLODBias; createInfo.anisotropyEnable = gpuSampler->maxAnisotropy && context->physicalDeviceFeatures.samplerAnisotropy; - createInfo.maxAnisotropy = std::min(context->physicalDeviceProperties.limits.maxSamplerAnisotropy, (float)gpuSampler->maxAnisotropy); - createInfo.compareEnable = VK_TRUE; - createInfo.compareOp = VK_CMP_FUNCS[(uint)gpuSampler->cmpFunc]; - createInfo.minLod = (float)gpuSampler->minLOD; - createInfo.maxLod = (float)gpuSampler->maxLOD; + createInfo.maxAnisotropy = std::min(context->physicalDeviceProperties.limits.maxSamplerAnisotropy, static_cast(gpuSampler->maxAnisotropy)); + createInfo.compareEnable = gpuSampler->cmpFunc != ComparisonFunc::ALWAYS; + createInfo.compareOp = VK_CMP_FUNCS[static_cast(gpuSampler->cmpFunc)]; + createInfo.minLod = 0.0; // UNASSIGNED-BestPractices-vkCreateSampler-lod-clamping + createInfo.maxLod = VK_LOD_CLAMP_NONE; // UNASSIGNED-BestPractices-vkCreateSampler-lod-clamping //createInfo.borderColor; // TODO VK_CHECK(vkCreateSampler(device->gpuDevice()->vkDevice, &createInfo, nullptr, &gpuSampler->vkSampler)); } -void CCVKCmdFuncCreateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer) { +void cmdFuncCCVKCreateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer) { if (!gpuBuffer->size) { return; } - gpuBuffer->instanceSize = 0u; + gpuBuffer->instanceSize = 0U; VkBufferCreateInfo bufferInfo{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; - bufferInfo.size = gpuBuffer->size; - bufferInfo.usage = MapVkBufferUsageFlagBits(gpuBuffer->usage); + bufferInfo.size = gpuBuffer->size; + bufferInfo.usage = mapVkBufferUsageFlagBits(gpuBuffer->usage); VmaAllocationCreateInfo allocInfo{}; @@ -197,13 +221,13 @@ void CCVKCmdFuncCreateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer) { bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; } else if (gpuBuffer->memUsage == (MemoryUsage::HOST | MemoryUsage::DEVICE)) { - /* * - gpuBuffer->instanceSize = roundUp(gpuBuffer->size, device->getUboOffsetAlignment()); + /* + gpuBuffer->instanceSize = roundUp(gpuBuffer->size, device->getCapabilities().uboOffsetAlignment); bufferInfo.size = gpuBuffer->instanceSize * device->gpuDevice()->backBufferCount; allocInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT; - /* */ + bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; + */ bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; - /* */ allocInfo.usage = VMA_MEMORY_USAGE_CPU_TO_GPU; } @@ -211,141 +235,280 @@ void CCVKCmdFuncCreateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer) { VK_CHECK(vmaCreateBuffer(device->gpuDevice()->memoryAllocator, &bufferInfo, &allocInfo, &gpuBuffer->vkBuffer, &gpuBuffer->vmaAllocation, &res)); //CC_LOG_DEBUG("Allocated buffer: %llu, %llx %llx %llu %x", res.size, gpuBuffer->vkBuffer, res.deviceMemory, res.offset, res.pMappedData); - gpuBuffer->mappedData = (uint8_t *)res.pMappedData; + gpuBuffer->mappedData = reinterpret_cast(res.pMappedData); gpuBuffer->startOffset = 0; // we are creating one VkBuffer each for now - gpuBuffer->accessMask = MapVkAccessFlags(gpuBuffer->usage); - gpuBuffer->targetStage = MapVkPipelineStageFlags(gpuBuffer->usage); + // add special access types directly from usage + if (hasFlag(gpuBuffer->usage, BufferUsageBit::VERTEX)) gpuBuffer->renderAccessTypes.push_back(THSVS_ACCESS_VERTEX_BUFFER); + if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDEX)) gpuBuffer->renderAccessTypes.push_back(THSVS_ACCESS_INDEX_BUFFER); + if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) gpuBuffer->renderAccessTypes.push_back(THSVS_ACCESS_INDIRECT_BUFFER); } -void CCVKCmdFuncCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRenderPass) { +void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRenderPass) { + static vector attachmentDescriptions; + static vector subpassDescriptions; + static vector attachmentReferences; + static vector subpassDependencies; + static vector accessTypeCaches; + const size_t colorAttachmentCount = gpuRenderPass->colorAttachments.size(); - const size_t hasDepth = gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN ? 1 : 0; - vector attachmentDescriptions(colorAttachmentCount + hasDepth); + const size_t hasDepth = gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN ? 1 : 0; + attachmentDescriptions.resize(colorAttachmentCount + hasDepth); gpuRenderPass->clearValues.resize(colorAttachmentCount + hasDepth); - for (size_t i = 0u; i < colorAttachmentCount; i++) { + gpuRenderPass->beginAccesses.resize(colorAttachmentCount + hasDepth); + gpuRenderPass->endAccesses.resize(colorAttachmentCount + hasDepth); + + // not using static storage so they can be captured in lambdas + vector beginAccessInfos(colorAttachmentCount + hasDepth); + vector endAccessInfos(colorAttachmentCount + hasDepth); + + for (size_t i = 0U; i < colorAttachmentCount; ++i) { const ColorAttachment &attachment = gpuRenderPass->colorAttachments[i]; - const VkImageLayout beginLayout = MapVkImageLayout(attachment.beginLayout); - const VkImageLayout endLayout = MapVkImageLayout(attachment.endLayout); - const VkAccessFlags beginAccessMask = MapVkAccessFlags(attachment.beginLayout); - const VkAccessFlags endAccessMask = MapVkAccessFlags(attachment.endLayout); - attachmentDescriptions[i].format = MapVkFormat(attachment.format); - attachmentDescriptions[i].samples = MapVkSampleCount(attachment.sampleCount); - attachmentDescriptions[i].loadOp = MapVkLoadOp(attachment.loadOp); - attachmentDescriptions[i].storeOp = MapVkStoreOp(attachment.storeOp); - attachmentDescriptions[i].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + + vector &beginAccesses = gpuRenderPass->beginAccesses[i]; + vector &endAccesses = gpuRenderPass->endAccesses[i]; + CCVKAccessInfo & beginAccessInfo = beginAccessInfos[i]; + CCVKAccessInfo & endAccessInfo = endAccessInfos[i]; + + for (AccessType type : attachment.beginAccesses) { + beginAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + } + for (AccessType type : attachment.endAccesses) { + endAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + } + thsvsGetAccessInfo(beginAccesses.size(), beginAccesses.data(), &beginAccessInfo.stageMask, &beginAccessInfo.accessMask, &beginAccessInfo.imageLayout, &beginAccessInfo.hasWriteAccess); + thsvsGetAccessInfo(endAccesses.size(), endAccesses.data(), &endAccessInfo.stageMask, &endAccessInfo.accessMask, &endAccessInfo.imageLayout, &endAccessInfo.hasWriteAccess); + + attachmentDescriptions[i].format = mapVkFormat(attachment.format); + attachmentDescriptions[i].samples = mapVkSampleCount(attachment.sampleCount); + attachmentDescriptions[i].loadOp = mapVkLoadOp(attachment.loadOp); + attachmentDescriptions[i].storeOp = mapVkStoreOp(attachment.storeOp); + attachmentDescriptions[i].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachmentDescriptions[i].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - attachmentDescriptions[i].initialLayout = beginLayout; - attachmentDescriptions[i].finalLayout = endLayout; + attachmentDescriptions[i].initialLayout = beginAccessInfo.imageLayout; + attachmentDescriptions[i].finalLayout = endAccessInfo.imageLayout; } if (hasDepth) { const DepthStencilAttachment &depthStencilAttachment = gpuRenderPass->depthStencilAttachment; - const VkImageLayout beginLayout = MapVkImageLayout(depthStencilAttachment.beginLayout); - const VkImageLayout endLayout = MapVkImageLayout(depthStencilAttachment.endLayout); - const VkAccessFlags beginAccessMask = MapVkAccessFlags(depthStencilAttachment.beginLayout); - const VkAccessFlags endAccessMask = MapVkAccessFlags(depthStencilAttachment.endLayout); - const bool hasStencil = GFX_FORMAT_INFOS[(uint)depthStencilAttachment.format].hasStencil; - const VkImageAspectFlags aspectMask = hasStencil ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; - attachmentDescriptions[colorAttachmentCount].format = MapVkFormat(depthStencilAttachment.format); - attachmentDescriptions[colorAttachmentCount].samples = MapVkSampleCount(depthStencilAttachment.sampleCount); - attachmentDescriptions[colorAttachmentCount].loadOp = MapVkLoadOp(depthStencilAttachment.depthLoadOp); - attachmentDescriptions[colorAttachmentCount].storeOp = MapVkStoreOp(depthStencilAttachment.depthStoreOp); - attachmentDescriptions[colorAttachmentCount].stencilLoadOp = MapVkLoadOp(depthStencilAttachment.stencilLoadOp); - attachmentDescriptions[colorAttachmentCount].stencilStoreOp = MapVkStoreOp(depthStencilAttachment.stencilStoreOp); - attachmentDescriptions[colorAttachmentCount].initialLayout = beginLayout; - attachmentDescriptions[colorAttachmentCount].finalLayout = endLayout; + + vector &beginAccesses = gpuRenderPass->beginAccesses[colorAttachmentCount]; + vector &endAccesses = gpuRenderPass->endAccesses[colorAttachmentCount]; + CCVKAccessInfo & beginAccessInfo = beginAccessInfos[colorAttachmentCount]; + CCVKAccessInfo & endAccessInfo = endAccessInfos[colorAttachmentCount]; + + for (AccessType type : depthStencilAttachment.beginAccesses) { + beginAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + } + for (AccessType type : depthStencilAttachment.endAccesses) { + endAccesses.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + } + thsvsGetAccessInfo(beginAccesses.size(), beginAccesses.data(), &beginAccessInfo.stageMask, &beginAccessInfo.accessMask, &beginAccessInfo.imageLayout, &beginAccessInfo.hasWriteAccess); + thsvsGetAccessInfo(endAccesses.size(), endAccesses.data(), &endAccessInfo.stageMask, &endAccessInfo.accessMask, &endAccessInfo.imageLayout, &endAccessInfo.hasWriteAccess); + + attachmentDescriptions[colorAttachmentCount].format = mapVkFormat(depthStencilAttachment.format); + attachmentDescriptions[colorAttachmentCount].samples = mapVkSampleCount(depthStencilAttachment.sampleCount); + attachmentDescriptions[colorAttachmentCount].loadOp = mapVkLoadOp(depthStencilAttachment.depthLoadOp); + attachmentDescriptions[colorAttachmentCount].storeOp = mapVkStoreOp(depthStencilAttachment.depthStoreOp); + attachmentDescriptions[colorAttachmentCount].stencilLoadOp = mapVkLoadOp(depthStencilAttachment.stencilLoadOp); + attachmentDescriptions[colorAttachmentCount].stencilStoreOp = mapVkStoreOp(depthStencilAttachment.stencilStoreOp); + attachmentDescriptions[colorAttachmentCount].initialLayout = beginAccessInfo.imageLayout; + attachmentDescriptions[colorAttachmentCount].finalLayout = endAccessInfo.imageLayout; } - const size_t subpassCount = gpuRenderPass->subPasses.size(); - vector subpassDescriptions(1); - vector attachmentReferences; - vector subpassDependencies; + size_t subpassCount = gpuRenderPass->subpasses.size(); + attachmentReferences.clear(); if (subpassCount) { // pass on user-specified subpasses - subpassDescriptions.resize(subpassCount); - for (size_t i = 0u; i < subpassCount; i++) { - const SubPassInfo &subPassInfo = gpuRenderPass->subPasses[i]; - subpassDescriptions[i].pipelineBindPoint = MapVkPipelineBindPoint(subPassInfo.bindPoint); - // TODO + for (auto &subpassInfo : gpuRenderPass->subpasses) { + for (uint input : subpassInfo.inputs) { + attachmentReferences.push_back({input, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}); + } + for (uint color : subpassInfo.colors) { + attachmentReferences.push_back({color, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}); + } + for (uint resolve : subpassInfo.resolves) { + attachmentReferences.push_back({resolve, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}); + } + if (hasDepth && subpassInfo.depthStencil == INVALID_BINDING) { + subpassInfo.depthStencil = static_cast(colorAttachmentCount); + } + attachmentReferences.push_back({subpassInfo.depthStencil, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}); + } + + uint offset{0U}; + subpassDescriptions.resize(subpassCount, {}); + for (uint i = 0U; i < gpuRenderPass->subpasses.size(); ++i) { + const SubpassInfo subpassInfo = gpuRenderPass->subpasses[i]; + + VkSubpassDescription &desc = subpassDescriptions[i]; + desc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; + + if (!subpassInfo.inputs.empty()) { + desc.inputAttachmentCount = subpassInfo.inputs.size(); + desc.pInputAttachments = attachmentReferences.data() + offset; + offset += subpassInfo.inputs.size(); + } + + if (!subpassInfo.colors.empty()) { + desc.colorAttachmentCount = subpassInfo.colors.size(); + desc.pColorAttachments = attachmentReferences.data() + offset; + offset += subpassInfo.colors.size(); + if (!subpassInfo.resolves.empty()) { + desc.pResolveAttachments = attachmentReferences.data() + offset; + offset += subpassInfo.resolves.size(); + } + } + + if (!subpassInfo.preserves.empty()) { + desc.preserveAttachmentCount = subpassInfo.preserves.size(); + desc.pPreserveAttachments = subpassInfo.preserves.data(); + } + + if (subpassInfo.depthStencil != INVALID_BINDING) { + desc.pDepthStencilAttachment = attachmentReferences.data() + offset++; + } } } else { // generate a default subpass from attachment info - for (size_t i = 0u; i < colorAttachmentCount; i++) { - attachmentReferences.push_back({(uint32_t)i, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}); + subpassCount = 1U; + subpassDescriptions.resize(subpassCount, {}); + for (size_t i = 0U; i < colorAttachmentCount; ++i) { + attachmentReferences.push_back({static_cast(i), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}); } - attachmentReferences.push_back({(uint32_t)colorAttachmentCount, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}); + attachmentReferences.push_back({static_cast(colorAttachmentCount), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}); + subpassDescriptions[0].pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpassDescriptions[0].colorAttachmentCount = attachmentReferences.size() - 1; - subpassDescriptions[0].pColorAttachments = attachmentReferences.data(); + subpassDescriptions[0].pColorAttachments = attachmentReferences.data(); if (hasDepth) subpassDescriptions[0].pDepthStencilAttachment = &attachmentReferences.back(); + } - subpassDependencies.emplace_back(VkSubpassDependency{ - VK_SUBPASS_EXTERNAL, - 0, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT, - VK_DEPENDENCY_BY_REGION_BIT, - }); - subpassDependencies.emplace_back(VkSubpassDependency{ - 0, - VK_SUBPASS_EXTERNAL, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, - VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_SHADER_READ_BIT, - VK_DEPENDENCY_BY_REGION_BIT, - }); - if (hasDepth) { - subpassDependencies.emplace_back(VkSubpassDependency{ - VK_SUBPASS_EXTERNAL, - 0, - VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, - VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, - VK_DEPENDENCY_BY_REGION_BIT, - }); - subpassDependencies.emplace_back(VkSubpassDependency{ - 0, - VK_SUBPASS_EXTERNAL, - VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, - VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, - VK_DEPENDENCY_BY_REGION_BIT, - }); + size_t dependencyCount = gpuRenderPass->dependencies.size(); + accessTypeCaches.clear(); + subpassDependencies.clear(); + + if (dependencyCount) { + for (const auto &dependency : gpuRenderPass->dependencies) { + for (AccessType type : dependency.srcAccesses) { + accessTypeCaches.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + } + for (AccessType type : dependency.dstAccesses) { + accessTypeCaches.push_back(THSVS_ACCESS_TYPES[static_cast(type)]); + } + } + + uint offset{0U}; + VkImageLayout imageLayout{VK_IMAGE_LAYOUT_UNDEFINED}; + bool hasWriteAccess{false}; + + for (uint i = 0U; i < dependencyCount; ++i) { + const SubpassDependency &dependency = gpuRenderPass->dependencies[i]; + VkSubpassDependency & vkDependency = subpassDependencies.emplace_back(); + vkDependency.srcSubpass = dependency.srcSubpass; + vkDependency.dstSubpass = dependency.dstSubpass; + vkDependency.dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT; + + thsvsGetAccessInfo( + dependency.srcAccesses.size(), + accessTypeCaches.data() + offset, + &vkDependency.srcStageMask, + &vkDependency.srcAccessMask, + &imageLayout, &hasWriteAccess); + + offset += dependency.srcAccesses.size(); + + thsvsGetAccessInfo( + dependency.dstAccesses.size(), + accessTypeCaches.data() + offset, + &vkDependency.dstStageMask, + &vkDependency.dstAccessMask, + &imageLayout, &hasWriteAccess); + + offset += dependency.dstAccesses.size(); + } + } else { + // explicitly declare external dependencies if needed + + // wait for resources to become available by the specified access types + VkSubpassDependency beginDependency{VK_SUBPASS_EXTERNAL, 0, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}; + auto beginDependencyCheck = [&beginDependency, &beginAccessInfos](const VkAttachmentReference &ref, VkPipelineStageFlags dstStage, + VkPipelineStageFlags dstAccessRead, VkAccessFlags dstAccessWrite) { + const VkAttachmentDescription &desc = attachmentDescriptions[ref.attachment]; + const CCVKAccessInfo & info = beginAccessInfos[ref.attachment]; + if (desc.loadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE) return; + if (desc.initialLayout != ref.layout || info.hasWriteAccess || desc.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) { + beginDependency.srcStageMask |= info.stageMask; + beginDependency.dstStageMask |= dstStage; + if (desc.initialLayout != ref.layout || info.hasWriteAccess) { + beginDependency.srcAccessMask |= info.hasWriteAccess ? info.accessMask : 0; + beginDependency.dstAccessMask |= (desc.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR ? dstAccessWrite : dstAccessRead); + } + } + }; + VkSubpassDescription &firstSubpass = subpassDescriptions[0]; + for (size_t j = 0U; j < firstSubpass.colorAttachmentCount; ++j) { + beginDependencyCheck(firstSubpass.pColorAttachments[j], VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT); + } + if (firstSubpass.pDepthStencilAttachment) { + beginDependencyCheck(*firstSubpass.pDepthStencilAttachment, VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT); + } + if (beginDependency.srcStageMask != VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT) { + subpassDependencies.push_back(beginDependency); + } + + // make rendering result visible for the specified access types + VkSubpassDependency endDependency{static_cast(subpassCount) - 1, VK_SUBPASS_EXTERNAL, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT}; + auto endDependencyCheck = [&endDependency, &endAccessInfos](const VkAttachmentReference &ref, VkPipelineStageFlags srcStage, VkAccessFlags srcAccess) { + const VkAttachmentDescription &desc = attachmentDescriptions[ref.attachment]; + if (desc.storeOp == VK_ATTACHMENT_STORE_OP_STORE) { + const CCVKAccessInfo &info = endAccessInfos[ref.attachment]; + endDependency.srcStageMask |= srcStage; + endDependency.srcAccessMask |= srcAccess; + endDependency.dstStageMask |= info.stageMask; + endDependency.dstAccessMask |= info.accessMask; + } + }; + VkSubpassDescription &lastSubpass = subpassDescriptions[subpassCount - 1]; + for (size_t j = 0U; j < lastSubpass.colorAttachmentCount; ++j) { + endDependencyCheck(lastSubpass.pColorAttachments[j], VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT); + } + if (lastSubpass.pDepthStencilAttachment) { + endDependencyCheck(*lastSubpass.pDepthStencilAttachment, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT); + } + if (endDependency.dstAccessMask) { + subpassDependencies.push_back(endDependency); } } VkRenderPassCreateInfo renderPassCreateInfo{VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO}; renderPassCreateInfo.attachmentCount = attachmentDescriptions.size(); - renderPassCreateInfo.pAttachments = attachmentDescriptions.data(); - renderPassCreateInfo.subpassCount = subpassDescriptions.size(); - renderPassCreateInfo.pSubpasses = subpassDescriptions.data(); + renderPassCreateInfo.pAttachments = attachmentDescriptions.data(); + renderPassCreateInfo.subpassCount = subpassDescriptions.size(); + renderPassCreateInfo.pSubpasses = subpassDescriptions.data(); renderPassCreateInfo.dependencyCount = subpassDependencies.size(); - renderPassCreateInfo.pDependencies = subpassDependencies.data(); + renderPassCreateInfo.pDependencies = subpassDependencies.data(); VK_CHECK(vkCreateRenderPass(device->gpuDevice()->vkDevice, &renderPassCreateInfo, nullptr, &gpuRenderPass->vkRenderPass)); } -void CCVKCmdFuncCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFramebuffer) { - size_t colorViewCount = gpuFramebuffer->gpuColorViews.size(); - bool depthSpecified = gpuFramebuffer->gpuDepthStencilView; - bool hasDepth = gpuFramebuffer->gpuRenderPass->depthStencilAttachment.format == device->getDepthStencilFormat(); +void cmdFuncCCVKCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFramebuffer) { + size_t colorViewCount = gpuFramebuffer->gpuColorViews.size(); + bool depthSpecified = gpuFramebuffer->gpuDepthStencilView; + bool hasDepth = gpuFramebuffer->gpuRenderPass->depthStencilAttachment.format != Format::UNKNOWN; vector attachments(colorViewCount + (depthSpecified || hasDepth ? 1 : 0)); - uint swapchainImageIndices = 0; - CCVKGPUTexture *gpuTexture = nullptr; - for (size_t i = 0u; i < colorViewCount; i++) { + uint swapchainImageIndices = 0; + CCVKGPUTexture * gpuTexture = nullptr; + for (size_t i = 0U; i < colorViewCount; ++i) { CCVKGPUTextureView *texView = gpuFramebuffer->gpuColorViews[i]; if (texView) { - gpuTexture = gpuFramebuffer->gpuColorViews[i]->gpuTexture; + gpuTexture = gpuFramebuffer->gpuColorViews[i]->gpuTexture; attachments[i] = gpuFramebuffer->gpuColorViews[i]->vkImageView; } else { swapchainImageIndices |= (1 << i); } } if (depthSpecified) { - gpuTexture = gpuFramebuffer->gpuDepthStencilView->gpuTexture; + gpuTexture = gpuFramebuffer->gpuDepthStencilView->gpuTexture; attachments[colorViewCount] = gpuFramebuffer->gpuDepthStencilView->vkImageView; } else if (hasDepth) { swapchainImageIndices |= (1 << colorViewCount); @@ -354,21 +517,21 @@ void CCVKCmdFuncCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFra if (gpuFramebuffer->isOffscreen) { VkFramebufferCreateInfo createInfo{VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO}; - createInfo.renderPass = gpuFramebuffer->gpuRenderPass->vkRenderPass; + createInfo.renderPass = gpuFramebuffer->gpuRenderPass->vkRenderPass; createInfo.attachmentCount = attachments.size(); - createInfo.pAttachments = attachments.data(); - createInfo.width = gpuTexture ? gpuTexture->width : 1; - createInfo.height = gpuTexture ? gpuTexture->height : 1; - createInfo.layers = 1; + createInfo.pAttachments = attachments.data(); + createInfo.width = gpuTexture ? gpuTexture->width : 1; + createInfo.height = gpuTexture ? gpuTexture->height : 1; + createInfo.layers = 1; VK_CHECK(vkCreateFramebuffer(device->gpuDevice()->vkDevice, &createInfo, nullptr, &gpuFramebuffer->vkFramebuffer)); } else { // swapchain-related framebuffers need special treatments: rebuild is needed // whenever a user-specified attachment or swapchain itself is changed - gpuFramebuffer->swapchain = device->gpuSwapchain(); - FramebufferListMap &fboListMap = gpuFramebuffer->swapchain->vkSwapchainFramebufferListMap; - FramebufferListMapIter fboListMapIter = fboListMap.find(gpuFramebuffer); - if (fboListMapIter != fboListMap.end() && fboListMapIter->second.size()) { + gpuFramebuffer->swapchain = device->gpuSwapchain(); + FramebufferListMap &fboListMap = gpuFramebuffer->swapchain->vkSwapchainFramebufferListMap; + auto fboListMapIter = fboListMap.find(gpuFramebuffer); + if (fboListMapIter != fboListMap.end() && !fboListMapIter->second.empty()) { return; } size_t swapchainImageCount = gpuFramebuffer->swapchain->vkSwapchainImageViews.size(); @@ -378,14 +541,14 @@ void CCVKCmdFuncCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFra fboListMap.emplace(std::piecewise_construct, std::forward_as_tuple(gpuFramebuffer), std::forward_as_tuple(swapchainImageCount)); } VkFramebufferCreateInfo createInfo{VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO}; - createInfo.renderPass = gpuFramebuffer->gpuRenderPass->vkRenderPass; + createInfo.renderPass = gpuFramebuffer->gpuRenderPass->vkRenderPass; createInfo.attachmentCount = attachments.size(); - createInfo.pAttachments = attachments.data(); - createInfo.width = device->getWidth(); - createInfo.height = device->getHeight(); - createInfo.layers = 1; - for (size_t i = 0u; i < swapchainImageCount; i++) { - for (size_t j = 0u; j < colorViewCount; j++) { + createInfo.pAttachments = attachments.data(); + createInfo.width = device->getWidth(); + createInfo.height = device->getHeight(); + createInfo.layers = 1; + for (size_t i = 0U; i < swapchainImageCount; ++i) { + for (size_t j = 0U; j < colorViewCount; ++j) { if (swapchainImageIndices & (1 << j)) { attachments[j] = gpuFramebuffer->swapchain->vkSwapchainImageViews[i]; } @@ -398,179 +561,202 @@ void CCVKCmdFuncCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFra } } -void CCVKCmdFuncCreateShader(CCVKDevice *device, CCVKGPUShader *gpuShader) { +void cmdFuncCCVKCreateShader(CCVKDevice *device, CCVKGPUShader *gpuShader) { for (CCVKGPUShaderStage &stage : gpuShader->gpuStages) { - vector spirv = GLSL2SPIRV(stage.type, "#version 450\n" + stage.source, ((CCVKContext *)device->getContext())->minorVersion()); + vector spirv = GLSL2SPIRV(stage.type, "#version 450\n" + stage.source, device->gpuDevice()->minorVersion); VkShaderModuleCreateInfo createInfo{VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO}; createInfo.codeSize = spirv.size() * sizeof(unsigned int); - createInfo.pCode = spirv.data(); + createInfo.pCode = spirv.data(); VK_CHECK(vkCreateShaderModule(device->gpuDevice()->vkDevice, &createInfo, nullptr, &stage.vkShader)); } CC_LOG_INFO("Shader '%s' compilation succeeded.", gpuShader->name.c_str()); } -void CCVKCmdFuncCreateDescriptorSetLayout(CCVKDevice *device, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout) { - CCVKGPUDevice *gpuDevice = device->gpuDevice(); - size_t bindingCount = gpuDescriptorSetLayout->bindings.size(); +void cmdFuncCCVKCreateDescriptorSetLayout(CCVKDevice *device, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout) { + CCVKGPUDevice *gpuDevice = device->gpuDevice(); + size_t bindingCount = gpuDescriptorSetLayout->bindings.size(); gpuDescriptorSetLayout->vkBindings.resize(bindingCount); - for (size_t i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = gpuDescriptorSetLayout->bindings[i]; - VkDescriptorSetLayoutBinding &vkBinding = gpuDescriptorSetLayout->vkBindings[i]; - vkBinding.stageFlags = MapVkShaderStageFlags(binding.stageFlags); - vkBinding.descriptorType = MapVkDescriptorType(binding.descriptorType); - vkBinding.binding = binding.binding; - vkBinding.descriptorCount = binding.count; + for (size_t i = 0U; i < bindingCount; ++i) { + const DescriptorSetLayoutBinding &binding = gpuDescriptorSetLayout->bindings[i]; + VkDescriptorSetLayoutBinding & vkBinding = gpuDescriptorSetLayout->vkBindings[i]; + vkBinding.stageFlags = mapVkShaderStageFlags(binding.stageFlags); + vkBinding.descriptorType = mapVkDescriptorType(binding.descriptorType); + vkBinding.binding = binding.binding; + vkBinding.descriptorCount = binding.count; } VkDescriptorSetLayoutCreateInfo setCreateInfo{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO}; setCreateInfo.bindingCount = bindingCount; - setCreateInfo.pBindings = gpuDescriptorSetLayout->vkBindings.data(); + setCreateInfo.pBindings = gpuDescriptorSetLayout->vkBindings.data(); VK_CHECK(vkCreateDescriptorSetLayout(gpuDevice->vkDevice, &setCreateInfo, nullptr, &gpuDescriptorSetLayout->vkDescriptorSetLayout)); - gpuDescriptorSetLayout->pool.link(gpuDevice, gpuDescriptorSetLayout->maxSetsPerPool, gpuDescriptorSetLayout->vkBindings, gpuDescriptorSetLayout->vkDescriptorSetLayout); + CCVKGPUDescriptorSetPool *pool = gpuDevice->getDescriptorSetPool(gpuDescriptorSetLayout->id); + pool->link(gpuDevice, gpuDescriptorSetLayout->maxSetsPerPool, gpuDescriptorSetLayout->vkBindings, gpuDescriptorSetLayout->vkDescriptorSetLayout); - gpuDescriptorSetLayout->defaultDescriptorSet = gpuDescriptorSetLayout->pool.request(0); + gpuDescriptorSetLayout->defaultDescriptorSet = pool->request(0); - if (gpuDevice->useDescriptorUpdateTemplate) { + if (gpuDevice->useDescriptorUpdateTemplate && bindingCount) { const vector &bindings = gpuDescriptorSetLayout->vkBindings; - uint bindingCount = bindings.size(); - if (!bindingCount) return; vector entries(bindingCount); - for (size_t j = 0u, k = 0u; j < bindingCount; j++) { + for (size_t j = 0U, k = 0U; j < bindingCount; ++j) { const VkDescriptorSetLayoutBinding &binding = bindings[j]; if (binding.descriptorType != VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT) { - entries[j].dstBinding = binding.binding; + entries[j].dstBinding = binding.binding; entries[j].dstArrayElement = 0; entries[j].descriptorCount = binding.descriptorCount; - entries[j].descriptorType = binding.descriptorType; - entries[j].offset = sizeof(CCVKDescriptorInfo) * k; - entries[j].stride = sizeof(CCVKDescriptorInfo); + entries[j].descriptorType = binding.descriptorType; + entries[j].offset = sizeof(CCVKDescriptorInfo) * k; + entries[j].stride = sizeof(CCVKDescriptorInfo); k += binding.descriptorCount; - } // TODO: inline UBOs + } // TODO(YunHsiao): inline UBOs } VkDescriptorUpdateTemplateCreateInfo createInfo = {VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO}; - createInfo.descriptorUpdateEntryCount = bindingCount; - createInfo.pDescriptorUpdateEntries = entries.data(); - createInfo.templateType = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET; - createInfo.descriptorSetLayout = gpuDescriptorSetLayout->vkDescriptorSetLayout; - VK_CHECK(vkCreateDescriptorUpdateTemplateKHR(gpuDevice->vkDevice, &createInfo, nullptr, &gpuDescriptorSetLayout->vkDescriptorUpdateTemplate)); + createInfo.descriptorUpdateEntryCount = bindingCount; + createInfo.pDescriptorUpdateEntries = entries.data(); + createInfo.templateType = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET; + createInfo.descriptorSetLayout = gpuDescriptorSetLayout->vkDescriptorSetLayout; + if (gpuDevice->minorVersion > 0) { + VK_CHECK(vkCreateDescriptorUpdateTemplate(gpuDevice->vkDevice, &createInfo, nullptr, &gpuDescriptorSetLayout->vkDescriptorUpdateTemplate)); + } else { + VK_CHECK(vkCreateDescriptorUpdateTemplateKHR(gpuDevice->vkDevice, &createInfo, nullptr, &gpuDescriptorSetLayout->vkDescriptorUpdateTemplate)); + } } } -void CCVKCmdFuncCreatePipelineLayout(CCVKDevice *device, CCVKGPUPipelineLayout *gpuPipelineLayout) { - CCVKGPUDevice *gpuDevice = device->gpuDevice(); - size_t layoutCount = gpuPipelineLayout->setLayouts.size(); +void cmdFuncCCVKCreatePipelineLayout(CCVKDevice *device, CCVKGPUPipelineLayout *gpuPipelineLayout) { + CCVKGPUDevice *gpuDevice = device->gpuDevice(); + size_t layoutCount = gpuPipelineLayout->setLayouts.size(); vector descriptorSetLayouts(layoutCount); - for (uint i = 0; i < layoutCount; i++) { + for (uint i = 0; i < layoutCount; ++i) { descriptorSetLayouts[i] = gpuPipelineLayout->setLayouts[i]->vkDescriptorSetLayout; } VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO}; pipelineLayoutCreateInfo.setLayoutCount = layoutCount; - pipelineLayoutCreateInfo.pSetLayouts = descriptorSetLayouts.data(); + pipelineLayoutCreateInfo.pSetLayouts = descriptorSetLayouts.data(); VK_CHECK(vkCreatePipelineLayout(gpuDevice->vkDevice, &pipelineLayoutCreateInfo, nullptr, &gpuPipelineLayout->vkPipelineLayout)); } -void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gpuPipelineState) { +void cmdFuncCCVKCreateComputePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gpuPipelineState) { + VkComputePipelineCreateInfo createInfo{VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO}; + + ///////////////////// Shader Stage ///////////////////// + + const CCVKGPUShaderStageList & stages = gpuPipelineState->gpuShader->gpuStages; + VkPipelineShaderStageCreateInfo stageInfo{VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO}; + stageInfo.stage = mapVkShaderStageFlagBits(stages[0].type); + stageInfo.module = stages[0].vkShader; + stageInfo.pName = "main"; + + createInfo.stage = stageInfo; + createInfo.layout = gpuPipelineState->gpuPipelineLayout->vkPipelineLayout; + + ///////////////////// Creation ///////////////////// + + VK_CHECK(vkCreateComputePipelines(device->gpuDevice()->vkDevice, device->gpuDevice()->vkPipelineCache, + 1, &createInfo, nullptr, &gpuPipelineState->vkPipeline)); +} + +void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineState *gpuPipelineState) { VkGraphicsPipelineCreateInfo createInfo{VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO}; ///////////////////// Shader Stage ///////////////////// - const CCVKGPUShaderStageList &stages = gpuPipelineState->gpuShader->gpuStages; - const size_t stageCount = stages.size(); + const CCVKGPUShaderStageList & stages = gpuPipelineState->gpuShader->gpuStages; + const size_t stageCount = stages.size(); vector stageInfos(stageCount, {VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO}); - for (size_t i = 0u; i < stageCount; i++) { - stageInfos[i].stage = MapVkShaderStageFlagBits(stages[i].type); + for (size_t i = 0U; i < stageCount; ++i) { + stageInfos[i].stage = mapVkShaderStageFlagBits(stages[i].type); stageInfos[i].module = stages[i].vkShader; - stageInfos[i].pName = "main"; + stageInfos[i].pName = "main"; } createInfo.stageCount = stageCount; - createInfo.pStages = stageInfos.data(); + createInfo.pStages = stageInfos.data(); ///////////////////// Input State ///////////////////// - const AttributeList &attributes = gpuPipelineState->inputState.attributes; - const size_t attributeCount = attributes.size(); - size_t bindingCount = 1u; - for (size_t i = 0u; i < attributeCount; i++) { + const AttributeList &attributes = gpuPipelineState->inputState.attributes; + const size_t attributeCount = attributes.size(); + size_t bindingCount = 1U; + for (size_t i = 0U; i < attributeCount; ++i) { const Attribute &attr = attributes[i]; - bindingCount = std::max((size_t)bindingCount, (size_t)(attr.stream + 1)); + bindingCount = std::max(bindingCount, static_cast(attr.stream + 1)); } vector bindingDescriptions(bindingCount); - for (size_t i = 0u; i < bindingCount; i++) { - bindingDescriptions[i].binding = i; - bindingDescriptions[i].stride = 0; + for (size_t i = 0U; i < bindingCount; ++i) { + bindingDescriptions[i].binding = i; + bindingDescriptions[i].stride = 0; bindingDescriptions[i].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; } - for (size_t i = 0u; i < attributeCount; i++) { + for (size_t i = 0U; i < attributeCount; ++i) { const Attribute &attr = attributes[i]; - bindingDescriptions[attr.stream].stride += GFX_FORMAT_INFOS[(uint)attr.format].size; + bindingDescriptions[attr.stream].stride += GFX_FORMAT_INFOS[static_cast(attr.format)].size; if (attr.isInstanced) { bindingDescriptions[attr.stream].inputRate = VK_VERTEX_INPUT_RATE_INSTANCE; } } - const AttributeList &shaderAttrs = gpuPipelineState->gpuShader->attributes; - const size_t shaderAttrCount = shaderAttrs.size(); + const AttributeList & shaderAttrs = gpuPipelineState->gpuShader->attributes; + const size_t shaderAttrCount = shaderAttrs.size(); vector attributeDescriptions(shaderAttrCount); - vector offsets(bindingCount, 0); + vector offsets(bindingCount, 0); - for (size_t i = 0; i < shaderAttrCount; i++) { + for (size_t i = 0; i < shaderAttrCount; ++i) { bool attributeFound = false; offsets.assign(bindingCount, 0); for (const Attribute &attr : attributes) { if (shaderAttrs[i].name == attr.name) { attributeDescriptions[i].location = shaderAttrs[i].location; - attributeDescriptions[i].binding = attr.stream; - attributeDescriptions[i].format = MapVkFormat(attr.format); - attributeDescriptions[i].offset = offsets[attr.stream]; - attributeFound = true; + attributeDescriptions[i].binding = attr.stream; + attributeDescriptions[i].format = mapVkFormat(attr.format); + attributeDescriptions[i].offset = offsets[attr.stream]; + attributeFound = true; break; } - offsets[attr.stream] += GFX_FORMAT_INFOS[(uint)attr.format].size; + offsets[attr.stream] += GFX_FORMAT_INFOS[static_cast(attr.format)].size; } if (!attributeFound) { // handle absent attribute attributeDescriptions[i].location = shaderAttrs[i].location; - attributeDescriptions[i].binding = 0; - attributeDescriptions[i].format = MapVkFormat(shaderAttrs[i].format); - attributeDescriptions[i].offset = 0; // reuse the first attribute as dummy data + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].format = mapVkFormat(shaderAttrs[i].format); + attributeDescriptions[i].offset = 0; // reuse the first attribute as dummy data } } VkPipelineVertexInputStateCreateInfo vertexInput{VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO}; - vertexInput.vertexBindingDescriptionCount = bindingCount; - vertexInput.pVertexBindingDescriptions = bindingDescriptions.data(); + vertexInput.vertexBindingDescriptionCount = bindingCount; + vertexInput.pVertexBindingDescriptions = bindingDescriptions.data(); vertexInput.vertexAttributeDescriptionCount = shaderAttrCount; - vertexInput.pVertexAttributeDescriptions = attributeDescriptions.data(); - createInfo.pVertexInputState = &vertexInput; + vertexInput.pVertexAttributeDescriptions = attributeDescriptions.data(); + createInfo.pVertexInputState = &vertexInput; ///////////////////// Input Asembly State ///////////////////// VkPipelineInputAssemblyStateCreateInfo inputAssembly{VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO}; - inputAssembly.topology = VK_PRIMITIVE_MODES[(uint)gpuPipelineState->primitive]; + inputAssembly.topology = VK_PRIMITIVE_MODES[static_cast(gpuPipelineState->primitive)]; createInfo.pInputAssemblyState = &inputAssembly; ///////////////////// Dynamic State ///////////////////// vector dynamicStates{VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR}; - insertVkDynamicStates(dynamicStates, gpuPipelineState->dynamicStates); + insertVkDynamicStates(&dynamicStates, gpuPipelineState->dynamicStates); VkPipelineDynamicStateCreateInfo dynamicState{VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO}; dynamicState.dynamicStateCount = dynamicStates.size(); - dynamicState.pDynamicStates = dynamicStates.data(); - createInfo.pDynamicState = &dynamicState; + dynamicState.pDynamicStates = dynamicStates.data(); + createInfo.pDynamicState = &dynamicState; ///////////////////// Viewport State ///////////////////// VkPipelineViewportStateCreateInfo viewportState{VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO}; viewportState.viewportCount = 1; // dynamic by default - viewportState.scissorCount = 1; // dynamic by default - createInfo.pViewportState = &viewportState; + viewportState.scissorCount = 1; // dynamic by default + createInfo.pViewportState = &viewportState; ///////////////////// Rasterization State ///////////////////// @@ -578,20 +764,20 @@ void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gp //rasterizationState.depthClampEnable; rasterizationState.rasterizerDiscardEnable = gpuPipelineState->rs.isDiscard; - rasterizationState.polygonMode = VK_POLYGON_MODES[(uint)gpuPipelineState->rs.polygonMode]; - rasterizationState.cullMode = VK_CULL_MODES[(uint)gpuPipelineState->rs.cullMode]; - rasterizationState.frontFace = gpuPipelineState->rs.isFrontFaceCCW ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE; - rasterizationState.depthBiasEnable = gpuPipelineState->rs.depthBiasEnabled; + rasterizationState.polygonMode = VK_POLYGON_MODES[static_cast(gpuPipelineState->rs.polygonMode)]; + rasterizationState.cullMode = VK_CULL_MODES[static_cast(gpuPipelineState->rs.cullMode)]; + rasterizationState.frontFace = gpuPipelineState->rs.isFrontFaceCCW ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE; + rasterizationState.depthBiasEnable = gpuPipelineState->rs.depthBiasEnabled; rasterizationState.depthBiasConstantFactor = gpuPipelineState->rs.depthBias; - rasterizationState.depthBiasClamp = gpuPipelineState->rs.depthBiasClamp; - rasterizationState.depthBiasSlopeFactor = gpuPipelineState->rs.depthBiasSlop; - rasterizationState.lineWidth = gpuPipelineState->rs.lineWidth; - createInfo.pRasterizationState = &rasterizationState; + rasterizationState.depthBiasClamp = gpuPipelineState->rs.depthBiasClamp; + rasterizationState.depthBiasSlopeFactor = gpuPipelineState->rs.depthBiasSlop; + rasterizationState.lineWidth = gpuPipelineState->rs.lineWidth; + createInfo.pRasterizationState = &rasterizationState; ///////////////////// Multisample State ///////////////////// VkPipelineMultisampleStateCreateInfo multisampleState{VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO}; - multisampleState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; + multisampleState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; multisampleState.alphaToCoverageEnable = gpuPipelineState->bs.isA2C; //multisampleState.sampleShadingEnable; //multisampleState.minSampleShading; @@ -602,24 +788,25 @@ void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gp ///////////////////// Depth Stencil State ///////////////////// VkPipelineDepthStencilStateCreateInfo depthStencilState = {VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO}; - depthStencilState.depthTestEnable = gpuPipelineState->dss.depthTest; - depthStencilState.depthWriteEnable = gpuPipelineState->dss.depthWrite; - depthStencilState.depthCompareOp = VK_CMP_FUNCS[(uint)gpuPipelineState->dss.depthFunc]; - depthStencilState.stencilTestEnable = gpuPipelineState->dss.stencilTestFront; + depthStencilState.depthTestEnable = gpuPipelineState->dss.depthTest; + depthStencilState.depthWriteEnable = gpuPipelineState->dss.depthWrite; + depthStencilState.depthCompareOp = VK_CMP_FUNCS[static_cast(gpuPipelineState->dss.depthFunc)]; + depthStencilState.stencilTestEnable = gpuPipelineState->dss.stencilTestFront; + depthStencilState.front = { - VK_STENCIL_OPS[(uint)gpuPipelineState->dss.stencilFailOpFront], - VK_STENCIL_OPS[(uint)gpuPipelineState->dss.stencilPassOpFront], - VK_STENCIL_OPS[(uint)gpuPipelineState->dss.stencilZFailOpFront], - VK_CMP_FUNCS[(uint)gpuPipelineState->dss.stencilFuncFront], + VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilFailOpFront)], + VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilPassOpFront)], + VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilZFailOpFront)], + VK_CMP_FUNCS[static_cast(gpuPipelineState->dss.stencilFuncFront)], gpuPipelineState->dss.stencilReadMaskFront, gpuPipelineState->dss.stencilWriteMaskFront, gpuPipelineState->dss.stencilRefFront, }; depthStencilState.back = { - VK_STENCIL_OPS[(uint)gpuPipelineState->dss.stencilFailOpBack], - VK_STENCIL_OPS[(uint)gpuPipelineState->dss.stencilPassOpBack], - VK_STENCIL_OPS[(uint)gpuPipelineState->dss.stencilZFailOpBack], - VK_CMP_FUNCS[(uint)gpuPipelineState->dss.stencilFuncBack], + VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilFailOpBack)], + VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilPassOpBack)], + VK_STENCIL_OPS[static_cast(gpuPipelineState->dss.stencilZFailOpBack)], + VK_CMP_FUNCS[static_cast(gpuPipelineState->dss.stencilFuncBack)], gpuPipelineState->dss.stencilReadMaskBack, gpuPipelineState->dss.stencilWriteMaskBack, gpuPipelineState->dss.stencilRefBack, @@ -631,36 +818,37 @@ void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gp ///////////////////// Blend State ///////////////////// - size_t blendTargetCount = gpuPipelineState->bs.targets.size(); + size_t blendTargetCount = gpuPipelineState->bs.targets.size(); vector blendTargets(blendTargetCount); - for (size_t i = 0u; i < blendTargetCount; i++) { - BlendTarget &target = gpuPipelineState->bs.targets[i]; - blendTargets[i].blendEnable = target.blend; - blendTargets[i].srcColorBlendFactor = VK_BLEND_FACTORS[(uint)target.blendSrc]; - blendTargets[i].dstColorBlendFactor = VK_BLEND_FACTORS[(uint)target.blendDst]; - blendTargets[i].colorBlendOp = VK_BLEND_OPS[(uint)target.blendEq]; - blendTargets[i].srcAlphaBlendFactor = VK_BLEND_FACTORS[(uint)target.blendSrcAlpha]; - blendTargets[i].dstAlphaBlendFactor = VK_BLEND_FACTORS[(uint)target.blendDstAlpha]; - blendTargets[i].alphaBlendOp = VK_BLEND_OPS[(uint)target.blendAlphaEq]; - blendTargets[i].colorWriteMask = MapVkColorComponentFlags(target.blendColorMask); + for (size_t i = 0U; i < blendTargetCount; ++i) { + BlendTarget &target = gpuPipelineState->bs.targets[i]; + blendTargets[i].blendEnable = target.blend; + blendTargets[i].srcColorBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendSrc)]; + blendTargets[i].dstColorBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendDst)]; + blendTargets[i].colorBlendOp = VK_BLEND_OPS[static_cast(target.blendEq)]; + blendTargets[i].srcAlphaBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendSrcAlpha)]; + blendTargets[i].dstAlphaBlendFactor = VK_BLEND_FACTORS[static_cast(target.blendDstAlpha)]; + blendTargets[i].alphaBlendOp = VK_BLEND_OPS[static_cast(target.blendAlphaEq)]; + blendTargets[i].colorWriteMask = mapVkColorComponentFlags(target.blendColorMask); } Color &blendColor = gpuPipelineState->bs.blendColor; VkPipelineColorBlendStateCreateInfo colorBlendState{VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO}; //colorBlendState.logicOpEnable; //colorBlendState.logicOp; - colorBlendState.attachmentCount = blendTargetCount; - colorBlendState.pAttachments = blendTargets.data(); + colorBlendState.attachmentCount = blendTargetCount; + colorBlendState.pAttachments = blendTargets.data(); colorBlendState.blendConstants[0] = blendColor.x; colorBlendState.blendConstants[1] = blendColor.y; colorBlendState.blendConstants[2] = blendColor.z; colorBlendState.blendConstants[3] = blendColor.w; - createInfo.pColorBlendState = &colorBlendState; + createInfo.pColorBlendState = &colorBlendState; ///////////////////// References ///////////////////// - createInfo.layout = gpuPipelineState->gpuPipelineLayout->vkPipelineLayout; + createInfo.layout = gpuPipelineState->gpuPipelineLayout->vkPipelineLayout; createInfo.renderPass = gpuPipelineState->gpuRenderPass->vkRenderPass; + createInfo.subpass = gpuPipelineState->subpass; ///////////////////// Creation ///////////////////// @@ -668,43 +856,38 @@ void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gp 1, &createInfo, nullptr, &gpuPipelineState->vkPipeline)); } -void CCVKCmdFuncCreateFence(CCVKDevice *device, CCVKGPUFence *gpuFence) { - VkFenceCreateInfo createInfo{VK_STRUCTURE_TYPE_FENCE_CREATE_INFO}; - VK_CHECK(vkCreateFence(device->gpuDevice()->vkDevice, &createInfo, nullptr, &gpuFence->vkFence)); -} - -void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const void *buffer, uint size, const CCVKGPUCommandBuffer *cmdBuffer) { +void cmdFuncCCVKUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const void *buffer, uint size, const CCVKGPUCommandBuffer *cmdBuffer) { if (!gpuBuffer) return; const void *dataToUpload = nullptr; - size_t sizeToUpload = 0u; + size_t sizeToUpload = 0U; - if (gpuBuffer->usage & BufferUsageBit::INDIRECT) { - size_t drawInfoCount = size / sizeof(DrawInfo); - const DrawInfo *drawInfo = static_cast(buffer); + if (hasFlag(gpuBuffer->usage, BufferUsageBit::INDIRECT)) { + size_t drawInfoCount = size / sizeof(DrawInfo); + const auto *drawInfo = static_cast(buffer); if (drawInfoCount > 0) { if (drawInfo->indexCount) { - for (size_t i = 0; i < drawInfoCount; i++) { - gpuBuffer->indexedIndirectCmds[i].indexCount = drawInfo->indexCount; - gpuBuffer->indexedIndirectCmds[i].instanceCount = std::max(drawInfo->instanceCount, 1u); - gpuBuffer->indexedIndirectCmds[i].firstIndex = drawInfo->firstIndex; - gpuBuffer->indexedIndirectCmds[i].vertexOffset = drawInfo->vertexOffset; + for (size_t i = 0; i < drawInfoCount; ++i) { + gpuBuffer->indexedIndirectCmds[i].indexCount = drawInfo->indexCount; + gpuBuffer->indexedIndirectCmds[i].instanceCount = std::max(drawInfo->instanceCount, 1U); + gpuBuffer->indexedIndirectCmds[i].firstIndex = drawInfo->firstIndex; + gpuBuffer->indexedIndirectCmds[i].vertexOffset = drawInfo->vertexOffset; gpuBuffer->indexedIndirectCmds[i].firstInstance = drawInfo->firstInstance; drawInfo++; } - dataToUpload = gpuBuffer->indexedIndirectCmds.data(); - sizeToUpload = drawInfoCount * sizeof(VkDrawIndexedIndirectCommand); + dataToUpload = gpuBuffer->indexedIndirectCmds.data(); + sizeToUpload = drawInfoCount * sizeof(VkDrawIndexedIndirectCommand); gpuBuffer->isDrawIndirectByIndex = true; } else { - for (size_t i = 0; i < drawInfoCount; i++) { - gpuBuffer->indirectCmds[i].vertexCount = drawInfo->vertexCount; + for (size_t i = 0; i < drawInfoCount; ++i) { + gpuBuffer->indirectCmds[i].vertexCount = drawInfo->vertexCount; gpuBuffer->indirectCmds[i].instanceCount = drawInfo->instanceCount; - gpuBuffer->indirectCmds[i].firstVertex = drawInfo->firstVertex; + gpuBuffer->indirectCmds[i].firstVertex = drawInfo->firstVertex; gpuBuffer->indirectCmds[i].firstInstance = drawInfo->firstInstance; drawInfo++; } - dataToUpload = gpuBuffer->indirectCmds.data(); - sizeToUpload = drawInfoCount * sizeof(VkDrawIndirectCommand); + dataToUpload = gpuBuffer->indirectCmds.data(); + sizeToUpload = drawInfoCount * sizeof(VkDrawIndirectCommand); gpuBuffer->isDrawIndirectByIndex = false; } } @@ -714,7 +897,7 @@ void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const } // back buffer instances update command - if (gpuBuffer->instanceSize) { + if (!cmdBuffer && gpuBuffer->instanceSize) { device->gpuBufferHub()->record(gpuBuffer, dataToUpload, sizeToUpload); return; } @@ -725,26 +908,20 @@ void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const memcpy(stagingBuffer.mappedData, dataToUpload, sizeToUpload); VkBufferCopy region{stagingBuffer.startOffset, gpuBuffer->startOffset, sizeToUpload}; - auto upload = [&stagingBuffer, &gpuBuffer, ®ion](const CCVKGPUCommandBuffer *cmdBuffer) { - // handle multiple writes - if (cmdBuffer->recordedBuffers.count(gpuBuffer->vkBuffer)) { - VkBufferMemoryBarrier barrier{VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER}; - barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barrier.buffer = gpuBuffer->vkBuffer; - barrier.offset = region.dstOffset; - barrier.size = region.size; - vkCmdPipelineBarrier(cmdBuffer->vkCommandBuffer, + auto upload = [&stagingBuffer, &gpuBuffer, ®ion](const CCVKGPUCommandBuffer *gpuCommandBuffer) { +#if BARRIER_DEDUCTION_LEVEL >= BARRIER_DEDUCTION_LEVEL_BASIC + if (gpuBuffer->transferAccess) { + // guard against WAW hazard + VkMemoryBarrier vkBarrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; + vkBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkBarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkCmdPipelineBarrier(gpuCommandBuffer->vkCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, - 0, 0, nullptr, 1, &barrier, 0, nullptr); - } else { - cmdBuffer->recordedBuffers.insert(gpuBuffer->vkBuffer); + 0, 1, &vkBarrier, 0, nullptr, 0, nullptr); } - - vkCmdCopyBuffer(cmdBuffer->vkCommandBuffer, stagingBuffer.vkBuffer, gpuBuffer->vkBuffer, 1, ®ion); +#endif + vkCmdCopyBuffer(gpuCommandBuffer->vkCommandBuffer, stagingBuffer.vkBuffer, gpuBuffer->vkBuffer, 1, ®ion); }; if (cmdBuffer) { @@ -752,168 +929,160 @@ void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const } else { device->gpuTransportHub()->checkIn(upload); } + + gpuBuffer->transferAccess = THSVS_ACCESS_TRANSFER_WRITE; + device->gpuBarrierManager()->checkIn(gpuBuffer); } -void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *buffers, CCVKGPUTexture *gpuTexture, - const BufferTextureCopy *regions, uint count, const CCVKGPUCommandBuffer *cmdBuff) { - VkImageMemoryBarrier barriers[2]{}; - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].image = gpuTexture->vkImage; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; - barriers[0].subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; - barriers[0].subresourceRange.aspectMask = gpuTexture->aspectMask; - barriers[0].srcAccessMask = gpuTexture->accessMask; - barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barriers[0].oldLayout = gpuTexture->currentLayout; - barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - vkCmdPipelineBarrier(cmdBuff->vkCommandBuffer, gpuTexture->targetStage, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 1, barriers); +void cmdFuncCCVKCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *buffers, CCVKGPUTexture *gpuTexture, + const BufferTextureCopy *regions, uint count, const CCVKGPUCommandBuffer *gpuCommandBuffer) { + vector &curTypes = gpuTexture->currentAccessTypes; - uint totalSize = 0u; + ThsvsImageBarrier barrier{}; + barrier.image = gpuTexture->vkImage; + barrier.discardContents = false; + barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; + barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + barrier.subresourceRange.aspectMask = gpuTexture->aspectMask; + barrier.prevAccessCount = curTypes.size(); + barrier.pPrevAccesses = curTypes.data(); + barrier.nextAccessCount = 1; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_WRITE)]; + + if (gpuTexture->transferAccess != THSVS_ACCESS_TRANSFER_WRITE) { + cmdFuncCCVKImageMemoryBarrier(gpuCommandBuffer, barrier); + } else { + // guard against WAW hazard + VkMemoryBarrier vkBarrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; + vkBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkBarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkCmdPipelineBarrier(gpuCommandBuffer->vkCommandBuffer, + VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, + 0, 1, &vkBarrier, 0, nullptr, 0, nullptr); + } + + uint totalSize = 0U; vector regionSizes(count); - for (size_t i = 0u; i < count; ++i) { + for (size_t i = 0U; i < count; ++i) { const BufferTextureCopy ®ion = regions[i]; - uint w = region.buffStride > 0 ? region.buffStride : region.texExtent.width; - uint h = region.buffTexHeight > 0 ? region.buffTexHeight : region.texExtent.height; - totalSize += regionSizes[i] = FormatSize(gpuTexture->format, w, h, region.texExtent.depth); + uint w = region.buffStride > 0 ? region.buffStride : region.texExtent.width; + uint h = region.buffTexHeight > 0 ? region.buffTexHeight : region.texExtent.height; + totalSize += regionSizes[i] = formatSize(gpuTexture->format, w, h, region.texExtent.depth); } CCVKGPUBuffer stagingBuffer; stagingBuffer.size = totalSize; - uint texelSize = GFX_FORMAT_INFOS[(uint)gpuTexture->format].size; + uint texelSize = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].size; device->gpuStagingBufferPool()->alloc(&stagingBuffer, texelSize); vector stagingRegions(count); - VkDeviceSize offset = 0; - for (size_t i = 0u; i < count; ++i) { - const BufferTextureCopy ®ion = regions[i]; - VkBufferImageCopy &stagingRegion = stagingRegions[i]; - stagingRegion.bufferOffset = stagingBuffer.startOffset + offset; - stagingRegion.bufferRowLength = region.buffStride; - stagingRegion.bufferImageHeight = region.buffTexHeight; - stagingRegion.imageSubresource = {gpuTexture->aspectMask, region.texSubres.mipLevel, region.texSubres.baseArrayLayer, region.texSubres.layerCount}; - stagingRegion.imageOffset = {region.texOffset.x, region.texOffset.y, region.texOffset.z}; - stagingRegion.imageExtent = {region.texExtent.width, region.texExtent.height, region.texExtent.depth}; + VkDeviceSize offset = 0; + for (size_t i = 0U; i < count; ++i) { + const BufferTextureCopy ®ion = regions[i]; + VkBufferImageCopy & stagingRegion = stagingRegions[i]; + stagingRegion.bufferOffset = stagingBuffer.startOffset + offset; + stagingRegion.bufferRowLength = region.buffStride; + stagingRegion.bufferImageHeight = region.buffTexHeight; + stagingRegion.imageSubresource = {gpuTexture->aspectMask, region.texSubres.mipLevel, region.texSubres.baseArrayLayer, region.texSubres.layerCount}; + stagingRegion.imageOffset = {region.texOffset.x, region.texOffset.y, region.texOffset.z}; + stagingRegion.imageExtent = {region.texExtent.width, region.texExtent.height, region.texExtent.depth}; memcpy(stagingBuffer.mappedData + offset, buffers[i], regionSizes[i]); offset += regionSizes[i]; } - vkCmdCopyBufferToImage(cmdBuff->vkCommandBuffer, stagingBuffer.vkBuffer, gpuTexture->vkImage, + vkCmdCopyBufferToImage(gpuCommandBuffer->vkCommandBuffer, stagingBuffer.vkBuffer, gpuTexture->vkImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, stagingRegions.size(), stagingRegions.data()); - bool layoutReady = false; - if (gpuTexture->flags & TextureFlags::GEN_MIPMAP) { + if (hasFlag(gpuTexture->flags, TextureFlags::GEN_MIPMAP)) { VkFormatProperties formatProperties; - vkGetPhysicalDeviceFormatProperties(device->gpuContext()->physicalDevice, MapVkFormat(gpuTexture->format), &formatProperties); + vkGetPhysicalDeviceFormatProperties(device->gpuContext()->physicalDevice, mapVkFormat(gpuTexture->format), &formatProperties); VkFormatFeatureFlags mipmapFeatures = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; if (formatProperties.optimalTilingFeatures & mipmapFeatures) { - const int32_t width = gpuTexture->width; + const int32_t width = gpuTexture->width; const int32_t height = gpuTexture->height; VkImageBlit blitInfo{}; - blitInfo.srcSubresource.aspectMask = gpuTexture->aspectMask; - blitInfo.srcSubresource.layerCount = gpuTexture->arrayLayers; - blitInfo.dstSubresource.aspectMask = gpuTexture->aspectMask; - blitInfo.dstSubresource.layerCount = gpuTexture->arrayLayers; - blitInfo.srcOffsets[1] = {width, height, 1}; - blitInfo.dstOffsets[1] = {std::max(width >> 1, 1), std::max(height >> 1, 1), 1}; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + blitInfo.srcSubresource.aspectMask = gpuTexture->aspectMask; + blitInfo.srcSubresource.layerCount = gpuTexture->arrayLayers; + blitInfo.dstSubresource.aspectMask = gpuTexture->aspectMask; + blitInfo.dstSubresource.layerCount = gpuTexture->arrayLayers; + blitInfo.srcOffsets[1] = {width, height, 1}; + blitInfo.dstOffsets[1] = {std::max(width >> 1, 1), std::max(height >> 1, 1), 1}; + barrier.subresourceRange.levelCount = 1; + barrier.prevAccessCount = 1; + barrier.pPrevAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_WRITE)]; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_READ)]; - for (uint i = 1u; i < gpuTexture->mipLevels; i++) { - barriers[0].subresourceRange.baseMipLevel = i - 1; - vkCmdPipelineBarrier(cmdBuff->vkCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 1, barriers); + for (uint i = 1U; i < gpuTexture->mipLevels; ++i) { + barrier.subresourceRange.baseMipLevel = i - 1; + cmdFuncCCVKImageMemoryBarrier(gpuCommandBuffer, barrier); blitInfo.srcSubresource.mipLevel = i - 1; blitInfo.dstSubresource.mipLevel = i; - vkCmdBlitImage(cmdBuff->vkCommandBuffer, gpuTexture->vkImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + vkCmdBlitImage(gpuCommandBuffer->vkCommandBuffer, gpuTexture->vkImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, gpuTexture->vkImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blitInfo, VK_FILTER_LINEAR); const int32_t w = blitInfo.srcOffsets[1].x = blitInfo.dstOffsets[1].x; const int32_t h = blitInfo.srcOffsets[1].y = blitInfo.dstOffsets[1].y; - blitInfo.dstOffsets[1].x = std::max(w >> 1, 1); - blitInfo.dstOffsets[1].y = std::max(h >> 1, 1); + blitInfo.dstOffsets[1].x = std::max(w >> 1, 1); + blitInfo.dstOffsets[1].y = std::max(h >> 1, 1); } - barriers[0].subresourceRange.baseMipLevel = gpuTexture->mipLevels - 1; - barriers[0].dstAccessMask = gpuTexture->accessMask; - barriers[0].newLayout = gpuTexture->layout; + barrier.subresourceRange.baseMipLevel = 0; + barrier.subresourceRange.levelCount = gpuTexture->mipLevels - 1; + barrier.pPrevAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_READ)]; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::TRANSFER_WRITE)]; - barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[1].image = gpuTexture->vkImage; - barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].subresourceRange.aspectMask = gpuTexture->aspectMask; - barriers[1].subresourceRange.baseMipLevel = 0; - barriers[1].subresourceRange.levelCount = gpuTexture->mipLevels - 1; - barriers[1].subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; - barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - barriers[1].dstAccessMask = gpuTexture->accessMask; - barriers[1].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; - barriers[1].newLayout = gpuTexture->layout; - - vkCmdPipelineBarrier(cmdBuff->vkCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, gpuTexture->targetStage, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 2, barriers); - layoutReady = true; + cmdFuncCCVKImageMemoryBarrier(gpuCommandBuffer, barrier); } else { - const char *formatName = GFX_FORMAT_INFOS[(uint)gpuTexture->format].name.c_str(); - CC_LOG_WARNING("CCVKCmdFuncCopyBuffersToTexture: generate mipmap for %s is not supported on this platform", formatName); + const char *formatName = GFX_FORMAT_INFOS[static_cast(gpuTexture->format)].name.c_str(); + CC_LOG_WARNING("cmdFuncCCVKCopyBuffersToTexture: generate mipmap for %s is not supported on this platform", formatName); } } - if (!layoutReady) { - barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barriers[0].dstAccessMask = gpuTexture->accessMask; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[0].newLayout = gpuTexture->layout; - vkCmdPipelineBarrier(cmdBuff->vkCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, gpuTexture->targetStage, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 1, barriers); - } - - gpuTexture->currentLayout = gpuTexture->layout; + curTypes.assign({THSVS_ACCESS_TRANSFER_WRITE}); + gpuTexture->transferAccess = THSVS_ACCESS_TRANSFER_WRITE; + device->gpuBarrierManager()->checkIn(gpuTexture); } -void CCVKCmdFuncDestroyRenderPass(CCVKGPUDevice *gpuDevice, CCVKGPURenderPass *gpuRenderPass) { +void cmdFuncCCVKDestroyRenderPass(CCVKGPUDevice *gpuDevice, CCVKGPURenderPass *gpuRenderPass) { if (gpuRenderPass->vkRenderPass != VK_NULL_HANDLE) { vkDestroyRenderPass(gpuDevice->vkDevice, gpuRenderPass->vkRenderPass, nullptr); gpuRenderPass->vkRenderPass = VK_NULL_HANDLE; } } -void CCVKCmdFuncDestroySampler(CCVKGPUDevice *gpuDevice, CCVKGPUSampler *gpuSampler) { +void cmdFuncCCVKDestroySampler(CCVKGPUDevice *gpuDevice, CCVKGPUSampler *gpuSampler) { if (gpuSampler->vkSampler != VK_NULL_HANDLE) { vkDestroySampler(gpuDevice->vkDevice, gpuSampler->vkSampler, nullptr); gpuSampler->vkSampler = VK_NULL_HANDLE; } } -void CCVKCmdFuncDestroyShader(CCVKGPUDevice *gpuDevice, CCVKGPUShader *gpuShader) { +void cmdFuncCCVKDestroyShader(CCVKGPUDevice *gpuDevice, CCVKGPUShader *gpuShader) { for (CCVKGPUShaderStage &stage : gpuShader->gpuStages) { vkDestroyShaderModule(gpuDevice->vkDevice, stage.vkShader, nullptr); stage.vkShader = VK_NULL_HANDLE; } } -void CCVKCmdFuncDestroyFramebuffer(CCVKGPUDevice *gpuDevice, CCVKGPUFramebuffer *gpuFramebuffer) { +void cmdFuncCCVKDestroyFramebuffer(CCVKGPUDevice *gpuDevice, CCVKGPUFramebuffer *gpuFramebuffer) { if (gpuFramebuffer->isOffscreen) { if (gpuFramebuffer->vkFramebuffer != VK_NULL_HANDLE) { vkDestroyFramebuffer(gpuDevice->vkDevice, gpuFramebuffer->vkFramebuffer, nullptr); gpuFramebuffer->vkFramebuffer = VK_NULL_HANDLE; } } else { - FramebufferListMap &fboListMap = gpuFramebuffer->swapchain->vkSwapchainFramebufferListMap; - FramebufferListMapIter fboListMapIter = fboListMap.find(gpuFramebuffer); + FramebufferListMap &fboListMap = gpuFramebuffer->swapchain->vkSwapchainFramebufferListMap; + auto fboListMapIter = fboListMap.find(gpuFramebuffer); if (fboListMapIter != fboListMap.end()) { - for (size_t i = 0u; i < fboListMapIter->second.size(); i++) { - vkDestroyFramebuffer(gpuDevice->vkDevice, fboListMapIter->second[i], nullptr); + for (auto &i : fboListMapIter->second) { + vkDestroyFramebuffer(gpuDevice->vkDevice, i, nullptr); } fboListMapIter->second.clear(); fboListMap.erase(fboListMapIter); @@ -921,14 +1090,18 @@ void CCVKCmdFuncDestroyFramebuffer(CCVKGPUDevice *gpuDevice, CCVKGPUFramebuffer } } -void CCVKCmdFuncDestroyDescriptorSetLayout(CCVKGPUDevice *gpuDevice, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout) { +void cmdFuncCCVKDestroyDescriptorSetLayout(CCVKGPUDevice *gpuDevice, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout) { if (gpuDescriptorSetLayout->defaultDescriptorSet != VK_NULL_HANDLE) { - gpuDescriptorSetLayout->pool.yield(gpuDescriptorSetLayout->defaultDescriptorSet, 0); + gpuDevice->getDescriptorSetPool(gpuDescriptorSetLayout->id)->yield(gpuDescriptorSetLayout->defaultDescriptorSet, 0); gpuDescriptorSetLayout->defaultDescriptorSet = VK_NULL_HANDLE; } if (gpuDescriptorSetLayout->vkDescriptorUpdateTemplate != VK_NULL_HANDLE) { - vkDestroyDescriptorUpdateTemplateKHR(gpuDevice->vkDevice, gpuDescriptorSetLayout->vkDescriptorUpdateTemplate, nullptr); + if (gpuDevice->minorVersion > 0) { + vkDestroyDescriptorUpdateTemplate(gpuDevice->vkDevice, gpuDescriptorSetLayout->vkDescriptorUpdateTemplate, nullptr); + } else { + vkDestroyDescriptorUpdateTemplateKHR(gpuDevice->vkDevice, gpuDescriptorSetLayout->vkDescriptorUpdateTemplate, nullptr); + } gpuDescriptorSetLayout->vkDescriptorUpdateTemplate = VK_NULL_HANDLE; } @@ -938,42 +1111,47 @@ void CCVKCmdFuncDestroyDescriptorSetLayout(CCVKGPUDevice *gpuDevice, CCVKGPUDesc } } -void CCVKCmdFuncDestroyPipelineLayout(CCVKGPUDevice *gpuDevice, CCVKGPUPipelineLayout *gpuPipelineLayout) { +void cmdFuncCCVKDestroyPipelineLayout(CCVKGPUDevice *gpuDevice, CCVKGPUPipelineLayout *gpuPipelineLayout) { if (gpuPipelineLayout->vkPipelineLayout != VK_NULL_HANDLE) { vkDestroyPipelineLayout(gpuDevice->vkDevice, gpuPipelineLayout->vkPipelineLayout, nullptr); gpuPipelineLayout->vkPipelineLayout = VK_NULL_HANDLE; } } -void CCVKCmdFuncDestroyPipelineState(CCVKGPUDevice *gpuDevice, CCVKGPUPipelineState *gpuPipelineState) { +void cmdFuncCCVKDestroyPipelineState(CCVKGPUDevice *gpuDevice, CCVKGPUPipelineState *gpuPipelineState) { if (gpuPipelineState->vkPipeline != VK_NULL_HANDLE) { vkDestroyPipeline(gpuDevice->vkDevice, gpuPipelineState->vkPipeline, nullptr); gpuPipelineState->vkPipeline = VK_NULL_HANDLE; } } -void CCVKCmdFuncDestroyFence(CCVKGPUDevice *gpuDevice, CCVKGPUFence *gpuFence) { - if (gpuFence->vkFence) { - vkDestroyFence(gpuDevice->vkDevice, gpuFence->vkFence, nullptr); - gpuFence->vkFence = VK_NULL_HANDLE; - } +void cmdFuncCCVKImageMemoryBarrier(const CCVKGPUCommandBuffer *gpuCommandBuffer, const ThsvsImageBarrier &imageBarrier) { + VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + VkImageMemoryBarrier vkBarrier; + thsvsGetVulkanImageMemoryBarrier(imageBarrier, &tempSrcStageMask, &tempDstStageMask, &vkBarrier); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + vkCmdPipelineBarrier(gpuCommandBuffer->vkCommandBuffer, srcStageMask, dstStageMask, 0, 0, nullptr, 0, nullptr, 1, &vkBarrier); } void CCVKGPURecycleBin::clear() { - for (uint i = 0u; i < _count; i++) { + for (uint i = 0U; i < _count; ++i) { Resource &res = _resources[i]; switch (res.type) { case RecycledType::BUFFER: if (res.buffer.vkBuffer) { vmaDestroyBuffer(_device->memoryAllocator, res.buffer.vkBuffer, res.buffer.vmaAllocation); - res.buffer.vkBuffer = VK_NULL_HANDLE; + res.buffer.vkBuffer = VK_NULL_HANDLE; res.buffer.vmaAllocation = VK_NULL_HANDLE; } break; case RecycledType::TEXTURE: if (res.image.vkImage) { vmaDestroyImage(_device->memoryAllocator, res.image.vkImage, res.image.vmaAllocation); - res.image.vkImage = VK_NULL_HANDLE; + res.image.vkImage = VK_NULL_HANDLE; res.image.vmaAllocation = VK_NULL_HANDLE; } break; @@ -985,60 +1163,53 @@ void CCVKGPURecycleBin::clear() { break; case RecycledType::RENDER_PASS: if (res.gpuRenderPass) { - CCVKCmdFuncDestroyRenderPass(_device, res.gpuRenderPass); + cmdFuncCCVKDestroyRenderPass(_device, res.gpuRenderPass); CC_DELETE(res.gpuRenderPass); res.gpuRenderPass = nullptr; } break; case RecycledType::FRAMEBUFFER: if (res.gpuFramebuffer) { - CCVKCmdFuncDestroyFramebuffer(_device, res.gpuFramebuffer); + cmdFuncCCVKDestroyFramebuffer(_device, res.gpuFramebuffer); CC_DELETE(res.gpuFramebuffer); res.gpuFramebuffer = nullptr; } break; case RecycledType::SAMPLER: if (res.gpuSampler) { - CCVKCmdFuncDestroySampler(_device, res.gpuSampler); + cmdFuncCCVKDestroySampler(_device, res.gpuSampler); CC_DELETE(res.gpuSampler); res.gpuSampler = nullptr; } break; case RecycledType::SHADER: if (res.gpuShader) { - CCVKCmdFuncDestroyShader(_device, res.gpuShader); + cmdFuncCCVKDestroyShader(_device, res.gpuShader); CC_DELETE(res.gpuShader); res.gpuShader = nullptr; } break; case RecycledType::DESCRIPTOR_SET_LAYOUT: if (res.gpuDescriptorSetLayout) { - CCVKCmdFuncDestroyDescriptorSetLayout(_device, res.gpuDescriptorSetLayout); + cmdFuncCCVKDestroyDescriptorSetLayout(_device, res.gpuDescriptorSetLayout); CC_DELETE(res.gpuDescriptorSetLayout); res.gpuDescriptorSetLayout = nullptr; } break; case RecycledType::PIPELINE_LAYOUT: if (res.gpuPipelineLayout) { - CCVKCmdFuncDestroyPipelineLayout(_device, res.gpuPipelineLayout); + cmdFuncCCVKDestroyPipelineLayout(_device, res.gpuPipelineLayout); CC_DELETE(res.gpuPipelineLayout); res.gpuPipelineLayout = nullptr; } break; case RecycledType::PIPELINE_STATE: if (res.gpuPipelineState) { - CCVKCmdFuncDestroyPipelineState(_device, res.gpuPipelineState); + cmdFuncCCVKDestroyPipelineState(_device, res.gpuPipelineState); CC_DELETE(res.gpuPipelineState); res.gpuPipelineState = nullptr; } break; - case RecycledType::FENCE: - if (res.gpuFence) { - CCVKCmdFuncDestroyFence(_device, res.gpuFence); - CC_DELETE(res.gpuFence); - res.gpuFence = nullptr; - } - break; default: break; } res.type = RecycledType::UNKNOWN; @@ -1046,5 +1217,88 @@ void CCVKGPURecycleBin::clear() { _count = 0; } +void CCVKGPUBarrierManager::update(CCVKGPUTransportHub *transportHub) { + if (_buffersToBeChecked.empty() && _texturesToBeChecked.empty()) return; + + static vector prevAccesses; + static vector nextAccesses; + static vector vkImageBarriers; + VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + vkImageBarriers.clear(); + prevAccesses.clear(); + nextAccesses.clear(); + + for (CCVKGPUBuffer *gpuBuffer : _buffersToBeChecked) { + vector &render = gpuBuffer->renderAccessTypes; + if (gpuBuffer->transferAccess == THSVS_ACCESS_NONE) continue; + if (std::find(prevAccesses.begin(), prevAccesses.end(), gpuBuffer->transferAccess) == prevAccesses.end()) { + prevAccesses.push_back(gpuBuffer->transferAccess); + } + nextAccesses.insert(nextAccesses.end(), render.begin(), render.end()); + gpuBuffer->transferAccess = THSVS_ACCESS_NONE; + } + + VkMemoryBarrier vkBarrier; + VkMemoryBarrier *pVkBarrier = nullptr; + if (!prevAccesses.empty()) { + ThsvsGlobalBarrier globalBarrier{}; + globalBarrier.prevAccessCount = prevAccesses.size(); + globalBarrier.pPrevAccesses = prevAccesses.data(); + globalBarrier.nextAccessCount = nextAccesses.size(); + globalBarrier.pNextAccesses = nextAccesses.data(); + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + thsvsGetVulkanMemoryBarrier(globalBarrier, &tempSrcStageMask, &tempDstStageMask, &vkBarrier); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + pVkBarrier = &vkBarrier; + } + + ThsvsImageBarrier imageBarrier{}; + imageBarrier.discardContents = false; + imageBarrier.prevLayout = THSVS_IMAGE_LAYOUT_OPTIMAL; + imageBarrier.nextLayout = THSVS_IMAGE_LAYOUT_OPTIMAL; + imageBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + imageBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + imageBarrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; + imageBarrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + imageBarrier.prevAccessCount = 1; + + for (CCVKGPUTexture *gpuTexture : _texturesToBeChecked) { + vector &render = gpuTexture->renderAccessTypes; + if (gpuTexture->transferAccess == THSVS_ACCESS_NONE || render.empty()) continue; + vector ¤t = gpuTexture->currentAccessTypes; + imageBarrier.pPrevAccesses = &gpuTexture->transferAccess; + imageBarrier.nextAccessCount = render.size(); + imageBarrier.pNextAccesses = render.data(); + imageBarrier.image = gpuTexture->vkImage; + imageBarrier.subresourceRange.aspectMask = gpuTexture->aspectMask; + + vkImageBarriers.emplace_back(); + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + thsvsGetVulkanImageMemoryBarrier(imageBarrier, &tempSrcStageMask, &tempDstStageMask, &vkImageBarriers.back()); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + + // don't override any other access changes since this barrier always happens first + if (current.size() == 1 && current[0] == gpuTexture->transferAccess) { + current = render; + } + gpuTexture->transferAccess = THSVS_ACCESS_NONE; + } + + if (pVkBarrier || !vkImageBarriers.empty()) { + transportHub->checkIn([&](CCVKGPUCommandBuffer *gpuCommandBuffer) { + vkCmdPipelineBarrier(gpuCommandBuffer->vkCommandBuffer, srcStageMask, dstStageMask, 0, + pVkBarrier ? 1 : 0, pVkBarrier, 0, nullptr, vkImageBarriers.size(), vkImageBarriers.data()); + }); + } + + _buffersToBeChecked.clear(); + _texturesToBeChecked.clear(); +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKCommands.h b/native/cocos/renderer/gfx-vulkan/VKCommands.h index 8782aa7826..5af3458b16 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommands.h +++ b/native/cocos/renderer/gfx-vulkan/VKCommands.h @@ -1,28 +1,29 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_COMMANDS_H_ -#define CC_GFXVULKAN_COMMANDS_H_ + +#pragma once #include "VKGPUObjects.h" @@ -32,14 +33,14 @@ namespace gfx { class CCVKDevice; struct CCVKDepthBias { - float constant = 0.0f; - float clamp = 0.0f; - float slope = 0.0f; + float constant = 0.0F; + float clamp = 0.0F; + float slope = 0.0F; }; struct CCVKDepthBounds { - float minBounds = 0.0f; - float maxBounds = 0.0f; + float minBounds = 0.0F; + float maxBounds = 0.0F; }; struct CCVKStencilWriteMask { @@ -53,33 +54,33 @@ struct CCVKStencilCompareMask { uint32_t compareMask = 0; }; -CC_VULKAN_API void CCVKCmdFuncGetDeviceQueue(CCVKDevice *device, CCVKGPUQueue *gpuQueue); +CC_VULKAN_API void cmdFuncCCVKGetDeviceQueue(CCVKDevice *device, CCVKGPUQueue *gpuQueue); -CC_VULKAN_API void CCVKCmdFuncCreateTexture(CCVKDevice *device, CCVKGPUTexture *gpuTexture); -CC_VULKAN_API void CCVKCmdFuncCreateTextureView(CCVKDevice *device, CCVKGPUTextureView *gpuTextureView); -CC_VULKAN_API void CCVKCmdFuncCreateSampler(CCVKDevice *device, CCVKGPUSampler *gpuSampler); -CC_VULKAN_API void CCVKCmdFuncCreateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer); -CC_VULKAN_API void CCVKCmdFuncCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRenderPass); -CC_VULKAN_API void CCVKCmdFuncCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFramebuffer); -CC_VULKAN_API void CCVKCmdFuncCreateShader(CCVKDevice *device, CCVKGPUShader *gpuShader); -CC_VULKAN_API void CCVKCmdFuncCreateDescriptorSetLayout(CCVKDevice *device, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout); -CC_VULKAN_API void CCVKCmdFuncCreatePipelineLayout(CCVKDevice *device, CCVKGPUPipelineLayout *gpuPipelineLayout); -CC_VULKAN_API void CCVKCmdFuncCreatePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gpuPipelineState); -CC_VULKAN_API void CCVKCmdFuncCreateFence(CCVKDevice *device, CCVKGPUFence *gpuFence); +CC_VULKAN_API void cmdFuncCCVKCreateTexture(CCVKDevice *device, CCVKGPUTexture *gpuTexture); +CC_VULKAN_API void cmdFuncCCVKCreateTextureView(CCVKDevice *device, CCVKGPUTextureView *gpuTextureView); +CC_VULKAN_API void cmdFuncCCVKCreateSampler(CCVKDevice *device, CCVKGPUSampler *gpuSampler); +CC_VULKAN_API void cmdFuncCCVKCreateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer); +CC_VULKAN_API void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRenderPass); +CC_VULKAN_API void cmdFuncCCVKCreateFramebuffer(CCVKDevice *device, CCVKGPUFramebuffer *gpuFramebuffer); +CC_VULKAN_API void cmdFuncCCVKCreateShader(CCVKDevice *device, CCVKGPUShader *gpuShader); +CC_VULKAN_API void cmdFuncCCVKCreateDescriptorSetLayout(CCVKDevice *device, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout); +CC_VULKAN_API void cmdFuncCCVKCreatePipelineLayout(CCVKDevice *device, CCVKGPUPipelineLayout *gpuPipelineLayout); +CC_VULKAN_API void cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice *device, CCVKGPUPipelineState *gpuPipelineState); +CC_VULKAN_API void cmdFuncCCVKCreateComputePipelineState(CCVKDevice *device, CCVKGPUPipelineState *gpuPipelineState); -CC_VULKAN_API void CCVKCmdFuncUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const void *buffer, uint size, const CCVKGPUCommandBuffer *cmdBuffer = nullptr); -CC_VULKAN_API void CCVKCmdFuncCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *buffers, CCVKGPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count, const CCVKGPUCommandBuffer *cmdBuff); +CC_VULKAN_API void cmdFuncCCVKUpdateBuffer(CCVKDevice *device, CCVKGPUBuffer *gpuBuffer, const void *buffer, uint size, const CCVKGPUCommandBuffer *cmdBuffer = nullptr); +CC_VULKAN_API void cmdFuncCCVKCopyBuffersToTexture(CCVKDevice *device, const uint8_t *const *buffers, CCVKGPUTexture *gpuTexture, const BufferTextureCopy *regions, uint count, const CCVKGPUCommandBuffer *gpuCommandBuffer); -CC_VULKAN_API void CCVKCmdFuncDestroyRenderPass(CCVKGPUDevice *device, CCVKGPURenderPass *gpuRenderPass); -CC_VULKAN_API void CCVKCmdFuncDestroySampler(CCVKGPUDevice *device, CCVKGPUSampler *gpuSampler); -CC_VULKAN_API void CCVKCmdFuncDestroyShader(CCVKGPUDevice *device, CCVKGPUShader *gpuShader); -CC_VULKAN_API void CCVKCmdFuncDestroyFramebuffer(CCVKGPUDevice *device, CCVKGPUFramebuffer *gpuFramebuffer); -CC_VULKAN_API void CCVKCmdFuncDestroyDescriptorSetLayout(CCVKGPUDevice *device, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout); -CC_VULKAN_API void CCVKCmdFuncDestroyPipelineLayout(CCVKGPUDevice *device, CCVKGPUPipelineLayout *gpuPipelineLayout); -CC_VULKAN_API void CCVKCmdFuncDestroyPipelineState(CCVKGPUDevice *device, CCVKGPUPipelineState *gpuPipelineState); -CC_VULKAN_API void CCVKCmdFuncDestroyFence(CCVKGPUDevice *device, CCVKGPUFence *gpuFence); +CC_VULKAN_API void cmdFuncCCVKDestroyRenderPass(CCVKGPUDevice *device, CCVKGPURenderPass *gpuRenderPass); +CC_VULKAN_API void cmdFuncCCVKDestroySampler(CCVKGPUDevice *device, CCVKGPUSampler *gpuSampler); +CC_VULKAN_API void cmdFuncCCVKDestroyShader(CCVKGPUDevice *device, CCVKGPUShader *gpuShader); +CC_VULKAN_API void cmdFuncCCVKDestroyFramebuffer(CCVKGPUDevice *device, CCVKGPUFramebuffer *gpuFramebuffer); +CC_VULKAN_API void cmdFuncCCVKDestroyDescriptorSetLayout(CCVKGPUDevice *device, CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout); +CC_VULKAN_API void cmdFuncCCVKDestroyPipelineLayout(CCVKGPUDevice *device, CCVKGPUPipelineLayout *gpuPipelineLayout); +CC_VULKAN_API void cmdFuncCCVKDestroyPipelineState(CCVKGPUDevice *device, CCVKGPUPipelineState *gpuPipelineState); + +CC_VULKAN_API void cmdFuncCCVKImageMemoryBarrier(const CCVKGPUCommandBuffer *gpuCommandBuffer, const ThsvsImageBarrier &imageBarrier); +CC_VULKAN_API void cmdFuncCCVKGlobalMemoryBarrier(const CCVKGPUCommandBuffer *gpuCommandBuffer, const ThsvsGlobalBarrier &globalBarrier); } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKContext.cpp b/native/cocos/renderer/gfx-vulkan/VKContext.cpp index c10f52a58c..9e1c66d80c 100644 --- a/native/cocos/renderer/gfx-vulkan/VKContext.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKContext.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKContext.h" @@ -32,87 +34,73 @@ THE SOFTWARE. #include "VKUtils.h" -#include "cocos/bindings/event/CustomEventTypes.h" -#include "cocos/bindings/event/EventDispatcher.h" - namespace cc { namespace gfx { namespace { -constexpr uint FORCE_MINOR_VERSION = 0; // 0 for default version, otherwise minorVersion = (FORCE_MINOR_VERSION - 1) -constexpr uint DISABLE_VALIDATION_ASSERTIONS = 1; // 0 for default behavior, otherwise assertions will be disabled +constexpr uint FORCE_MINOR_VERSION = 0; // 0 for default version, otherwise minorVersion = (FORCE_MINOR_VERSION - 1) +constexpr uint DISABLE_VALIDATION_ASSERTIONS = 1; // 0 for default behavior, otherwise assertions will be disabled #define FORCE_ENABLE_VALIDATION 0 #define FORCE_DISABLE_VALIDATION 1 #if CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION || FORCE_ENABLE_VALIDATION -VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageType, +VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *callbackData, - void *userData) { - // GPU-assisted validation might throw this due to driver reasons which is safe to ignore - if (strstr(callbackData->pMessage, "Failure to instrument shader")) { - return VK_FALSE; - } - - // Log debug messge - if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { - CC_LOG_WARNING("%s: %s", callbackData->pMessageIdName, callbackData->pMessage); - } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { + void * userData) { + if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { CC_LOG_ERROR("%s: %s", callbackData->pMessageIdName, callbackData->pMessage); CCASSERT(DISABLE_VALIDATION_ASSERTIONS, "Validation Error"); return VK_FALSE; + } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { + CC_LOG_WARNING("%s: %s", callbackData->pMessageIdName, callbackData->pMessage); + return VK_FALSE; + } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) { + //CC_LOG_INFO("%s: %s", callbackData->pMessageIdName, callbackData->pMessage); + return VK_FALSE; + } else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) { + //CC_LOG_DEBUG("%s: %s", callbackData->pMessageIdName, callbackData->pMessage); + return VK_FALSE; } + CC_LOG_ERROR("%s: %s", callbackData->pMessageIdName, callbackData->pMessage); return VK_FALSE; } -VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallback(VkDebugReportFlagsEXT flags, +VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT type, - uint64_t object, - size_t location, - int32_t messageCode, - const char *layerPrefix, - const char *message, - void *userData) { - // GPU-assisted validation might throw this due to driver reasons which is safe to ignore - if (strstr(message, "Failure to instrument shader")) { - return VK_FALSE; - } - - // These are thrown randomly when missing proper vulkan drivers - // at which time we should try to shut down the backend gracefully instead of freezing at assertions - if (strstr(message, "setupLoaderTermPhysDevs") || strstr(message, "setupLoaderTrampPhysDevs")) { - return VK_FALSE; - } - + uint64_t object, + size_t location, + int32_t messageCode, + const char * layerPrefix, + const char * message, + void * userData) { if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) { - CC_LOG_ERROR("VError: %s: %s", layerPrefix, message); + CC_LOG_ERROR("%s: %s", layerPrefix, message); CCASSERT(DISABLE_VALIDATION_ASSERTIONS, "Validation Error"); - } else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { - CC_LOG_ERROR("VWarning: %s: %s", layerPrefix, message); - } else if (flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) { - CC_LOG_INFO("VPerfWarning: %s: %s", layerPrefix, message); - } else { - CC_LOG_INFO("VInfo: %s: %s", layerPrefix, message); + return VK_FALSE; + } else if (flags & (VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)) { + CC_LOG_WARNING("%s: %s", layerPrefix, message); + return VK_FALSE; + } else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) { + //CC_LOG_INFO("%s: %s", layerPrefix, message); + return VK_FALSE; + } else if (flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) { + //CC_LOG_DEBUG("%s: %s", layerPrefix, message); + return VK_FALSE; } + CC_LOG_ERROR("%s: %s", layerPrefix, message); return VK_FALSE; } #endif } // namespace -CCVKContext::CCVKContext(Device *device) -: Context(device) { -} +CCVKContext::CCVKContext() = default; -CCVKContext::~CCVKContext() { -} - -bool CCVKContext::initialize(const ContextInfo &info) { - - _vsyncMode = info.vsyncMode; - _windowHandle = info.windowHandle; +CCVKContext::~CCVKContext() = default; +bool CCVKContext::doInit(const ContextInfo &info) { if (!info.sharedCtx) { _isPrimaryContex = true; @@ -124,7 +112,6 @@ bool CCVKContext::initialize(const ContextInfo &info) { }; vector requestedExtensions{ VK_KHR_SURFACE_EXTENSION_NAME, - VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, }; ///////////////////// Instance Creation ///////////////////// @@ -133,6 +120,19 @@ bool CCVKContext::initialize(const ContextInfo &info) { return false; } + uint apiVersion = VK_API_VERSION_1_0; + if (vkEnumerateInstanceVersion) { + vkEnumerateInstanceVersion(&apiVersion); + if (FORCE_MINOR_VERSION) { + apiVersion = VK_MAKE_VERSION(1, FORCE_MINOR_VERSION - 1, 0); + } + } + + uint minorVersion = VK_VERSION_MINOR(apiVersion); + if (minorVersion < 1) { + requestedExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); + } + uint availableLayerCount; VK_CHECK(vkEnumerateInstanceLayerProperties(&availableLayerCount, nullptr)); vector supportedLayers(availableLayerCount); @@ -214,52 +214,39 @@ bool CCVKContext::initialize(const ContextInfo &info) { } } - uint apiVersion = VK_API_VERSION_1_0; - if (vkEnumerateInstanceVersion) { - vkEnumerateInstanceVersion(&apiVersion); - if (FORCE_MINOR_VERSION) { - apiVersion = VK_MAKE_VERSION(1, FORCE_MINOR_VERSION - 1, 0); - } - } - VkApplicationInfo app{VK_STRUCTURE_TYPE_APPLICATION_INFO}; app.pEngineName = "Cocos Creator"; - app.apiVersion = apiVersion; + app.apiVersion = apiVersion; VkInstanceCreateInfo instanceInfo{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; - instanceInfo.pApplicationInfo = &app; - instanceInfo.enabledExtensionCount = toUint(_extensions.size()); + instanceInfo.pApplicationInfo = &app; + instanceInfo.enabledExtensionCount = utils::toUint(_extensions.size()); instanceInfo.ppEnabledExtensionNames = _extensions.data(); - instanceInfo.enabledLayerCount = toUint(_layers.size()); - instanceInfo.ppEnabledLayerNames = _layers.data(); + instanceInfo.enabledLayerCount = utils::toUint(_layers.size()); + instanceInfo.ppEnabledLayerNames = _layers.data(); #if CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION || FORCE_ENABLE_VALIDATION VkDebugUtilsMessengerCreateInfoEXT debugUtilsCreateInfo{VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT}; VkDebugReportCallbackCreateInfoEXT debugReportCreateInfo{VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT}; if (debugUtils) { - debugUtilsCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; - debugUtilsCreateInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT; + debugUtilsCreateInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT; + debugUtilsCreateInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT; debugUtilsCreateInfo.pfnUserCallback = debugUtilsMessengerCallback; instanceInfo.pNext = &debugUtilsCreateInfo; } else { - debugReportCreateInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT; + debugReportCreateInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | + VK_DEBUG_REPORT_WARNING_BIT_EXT | + VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT | + VK_DEBUG_REPORT_INFORMATION_BIT_EXT | + VK_DEBUG_REPORT_DEBUG_BIT_EXT; debugReportCreateInfo.pfnCallback = debugReportCallback; instanceInfo.pNext = &debugReportCreateInfo; } - - VkValidationFeaturesEXT features = {VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT}; - VkValidationFeatureEnableEXT enables[] = {VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT}; - features.enabledValidationFeatureCount = 1; - features.pEnabledValidationFeatures = enables; - if (_minorVersion >= 1 && isLayerSupported("VK_LAYER_KHRONOS_validation", supportedLayers)) { - if (debugUtils) { - debugUtilsCreateInfo.pNext = &features; - } else { - debugReportCreateInfo.pNext = &features; - } - } #endif // Create the Vulkan instance @@ -277,67 +264,33 @@ bool CCVKContext::initialize(const ContextInfo &info) { } else { VK_CHECK(vkCreateDebugReportCallbackEXT(_gpuContext->vkInstance, &debugReportCreateInfo, nullptr, &_gpuContext->vkDebugReport)); } + _validationEnabled = true; #endif ///////////////////// Surface Creation ///////////////////// - CCVKDevice* device = (CCVKDevice*)_device; - #if defined(VK_USE_PLATFORM_ANDROID_KHR) VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo{VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR}; - surfaceCreateInfo.window = (ANativeWindow *)_windowHandle; + surfaceCreateInfo.window = reinterpret_cast(_windowHandle); VK_CHECK(vkCreateAndroidSurfaceKHR(_gpuContext->vkInstance, &surfaceCreateInfo, nullptr, &_gpuContext->vkSurface)); - - EventDispatcher::addCustomEventListener(EVENT_DESTROY_WINDOW, [=](const CustomEvent &) -> void { - if (_gpuContext && _gpuContext->vkSurface != VK_NULL_HANDLE) { - - CCVKQueue *queue = (CCVKQueue *)device->getQueue(); - - uint fenceCount = device->gpuFencePool()->size(); - if (fenceCount) { - VK_CHECK(vkWaitForFences(device->gpuDevice()->vkDevice, fenceCount, - device->gpuFencePool()->data(), VK_TRUE, DEFAULT_TIMEOUT)); - } - - device->destroySwapchain(); - device->_swapchainReady = false; - - vkDestroySurfaceKHR(_gpuContext->vkInstance, _gpuContext->vkSurface, nullptr); - _gpuContext->vkSurface = VK_NULL_HANDLE; - } - }); - - EventDispatcher::addCustomEventListener(EVENT_RECREATE_WINDOW, [=](const CustomEvent &event) -> void { - _windowHandle = (uintptr_t)event.args->ptrVal; - - if (_gpuContext && _gpuContext->vkSurface == VK_NULL_HANDLE) { - VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo{ - VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR}; - surfaceCreateInfo.window = (ANativeWindow *) _windowHandle; - VK_CHECK(vkCreateAndroidSurfaceKHR(_gpuContext->vkInstance, &surfaceCreateInfo, - nullptr, &_gpuContext->vkSurface)); - - device->checkSwapchainStatus(); - } - }); #elif defined(VK_USE_PLATFORM_WIN32_KHR) VkWin32SurfaceCreateInfoKHR surfaceCreateInfo{VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR}; - surfaceCreateInfo.hinstance = (HINSTANCE)GetModuleHandle(0); - surfaceCreateInfo.hwnd = (HWND)_windowHandle; + surfaceCreateInfo.hinstance = static_cast(GetModuleHandle(0)); + surfaceCreateInfo.hwnd = reinterpret_cast(_windowHandle); VK_CHECK(vkCreateWin32SurfaceKHR(_gpuContext->vkInstance, &surfaceCreateInfo, nullptr, &_gpuContext->vkSurface)); #elif defined(VK_USE_PLATFORM_METAL_EXT) VkMetalSurfaceCreateInfoEXT surfaceCreateInfo{VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT}; - surfaceCreateInfo.pLayer = (CAMetalLayer *)_windowHandle; + surfaceCreateInfo.pLayer = reinterpret_cast(_windowHandle); VK_CHECK(vkCreateMetalSurfaceEXT(_gpuContext->vkInstance, &surfaceCreateInfo, nullptr, &_gpuContext->vkSurface)); #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) VkWaylandSurfaceCreateInfoKHR surfaceCreateInfo{VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR}; surfaceCreateInfo.display = nullptr; // TODO - surfaceCreateInfo.surface = (wl_surface *)_windowHandle; + surfaceCreateInfo.surface = reinterpret_cast(_windowHandle); VK_CHECK(vkCreateWaylandSurfaceKHR(_gpuContext->vkInstance, &surfaceCreateInfo, nullptr, &_gpuContext->vkSurface)); #elif defined(VK_USE_PLATFORM_XCB_KHR) VkXcbSurfaceCreateInfoKHR surfaceCreateInfo{VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR}; surfaceCreateInfo.connection = nullptr; // TODO - surfaceCreateInfo.window = (xcb_window_t)_windowHandle; + surfaceCreateInfo.window = static_cast(_windowHandle); VK_CHECK(vkCreateXcbSurfaceKHR(_gpuContext->vkInstance, &surfaceCreateInfo, nullptr, &_gpuContext->vkSurface)); #else #pragma error Platform not supported @@ -359,12 +312,12 @@ bool CCVKContext::initialize(const ContextInfo &info) { vector physicalDeviceProperties(physicalDeviceCount); uint deviceIndex; - for (deviceIndex = 0u; deviceIndex < physicalDeviceCount; ++deviceIndex) { + for (deviceIndex = 0U; deviceIndex < physicalDeviceCount; ++deviceIndex) { VkPhysicalDeviceProperties &properties = physicalDeviceProperties[deviceIndex]; vkGetPhysicalDeviceProperties(physicalDeviceHandles[deviceIndex], &properties); } - for (deviceIndex = 0u; deviceIndex < physicalDeviceCount; ++deviceIndex) { + for (deviceIndex = 0U; deviceIndex < physicalDeviceCount; ++deviceIndex) { VkPhysicalDeviceProperties &properties = physicalDeviceProperties[deviceIndex]; if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) { break; @@ -375,16 +328,23 @@ bool CCVKContext::initialize(const ContextInfo &info) { deviceIndex = 0; } - _gpuContext->physicalDevice = physicalDeviceHandles[deviceIndex]; + _gpuContext->physicalDevice = physicalDeviceHandles[deviceIndex]; _gpuContext->physicalDeviceProperties = physicalDeviceProperties[deviceIndex]; vkGetPhysicalDeviceFeatures(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceFeatures); - if (_minorVersion >= 1 || checkExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { - vkGetPhysicalDeviceProperties2KHR(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceProperties2); + _majorVersion = VK_VERSION_MAJOR(_gpuContext->physicalDeviceProperties.apiVersion); + _minorVersion = VK_VERSION_MINOR(_gpuContext->physicalDeviceProperties.apiVersion); - _gpuContext->physicalDeviceFeatures2.pNext = &_gpuContext->physicalDeviceVulkan11Features; + if (_minorVersion >= 1 || checkExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { + _gpuContext->physicalDeviceFeatures2.pNext = &_gpuContext->physicalDeviceVulkan11Features; _gpuContext->physicalDeviceVulkan11Features.pNext = &_gpuContext->physicalDeviceVulkan12Features; - vkGetPhysicalDeviceFeatures2KHR(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceFeatures2); + if (_minorVersion >= 1) { + vkGetPhysicalDeviceProperties2(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceProperties2); + vkGetPhysicalDeviceFeatures2(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceFeatures2); + } else { + vkGetPhysicalDeviceProperties2KHR(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceProperties2); + vkGetPhysicalDeviceFeatures2KHR(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceFeatures2); + } } vkGetPhysicalDeviceMemoryProperties(_gpuContext->physicalDevice, &_gpuContext->physicalDeviceMemoryProperties); @@ -398,42 +358,39 @@ bool CCVKContext::initialize(const ContextInfo &info) { _gpuContext->vkSurface, &_gpuContext->queueFamilyPresentables[propertyIndex]); } - _majorVersion = VK_VERSION_MAJOR(_gpuContext->physicalDeviceProperties.apiVersion); - _minorVersion = VK_VERSION_MINOR(_gpuContext->physicalDeviceProperties.apiVersion); - ///////////////////// Swapchain Preperation ///////////////////// - _colorFmt = Format::BGRA8; + _colorFmt = Format::BGRA8; _depthStencilFmt = Format::D24S8; VkSurfaceCapabilitiesKHR surfaceCapabilities{}; vkGetPhysicalDeviceSurfaceCapabilitiesKHR(_gpuContext->physicalDevice, _gpuContext->vkSurface, &surfaceCapabilities); - uint surfaceFormatCount = 0u; + uint surfaceFormatCount = 0U; VK_CHECK(vkGetPhysicalDeviceSurfaceFormatsKHR(_gpuContext->physicalDevice, _gpuContext->vkSurface, &surfaceFormatCount, nullptr)); vector surfaceFormats(surfaceFormatCount); VK_CHECK(vkGetPhysicalDeviceSurfaceFormatsKHR(_gpuContext->physicalDevice, _gpuContext->vkSurface, &surfaceFormatCount, surfaceFormats.data())); - uint presentModeCount = 0u; + uint presentModeCount = 0U; VK_CHECK(vkGetPhysicalDeviceSurfacePresentModesKHR(_gpuContext->physicalDevice, _gpuContext->vkSurface, &presentModeCount, nullptr)); vector presentModes(presentModeCount); VK_CHECK(vkGetPhysicalDeviceSurfacePresentModesKHR(_gpuContext->physicalDevice, _gpuContext->vkSurface, &presentModeCount, presentModes.data())); - VkFormat colorFormat = VK_FORMAT_B8G8R8A8_UNORM; - VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + VkFormat colorFormat = VK_FORMAT_B8G8R8A8_UNORM; + VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; // If the surface format list only includes one entry with VK_FORMAT_UNDEFINED, // there is no preferered format, so we assume VK_FORMAT_B8G8R8A8_UNORM if ((surfaceFormatCount == 1) && (surfaceFormats[0].format == VK_FORMAT_UNDEFINED)) { colorFormat = VK_FORMAT_B8G8R8A8_UNORM; - colorSpace = surfaceFormats[0].colorSpace; + colorSpace = surfaceFormats[0].colorSpace; } else { // iterate over the list of available surface format and // check for the presence of VK_FORMAT_B8G8R8A8_UNORM bool imageFormatFound = false; for (VkSurfaceFormatKHR &surfaceFormat : surfaceFormats) { if (surfaceFormat.format == VK_FORMAT_B8G8R8A8_UNORM) { - colorFormat = surfaceFormat.format; - colorSpace = surfaceFormat.colorSpace; + colorFormat = surfaceFormat.format; + colorSpace = surfaceFormat.colorSpace; imageFormatFound = true; break; } @@ -443,7 +400,7 @@ bool CCVKContext::initialize(const ContextInfo &info) { // select the first available color format if (!imageFormatFound) { colorFormat = surfaceFormats[0].format; - colorSpace = surfaceFormats[0].colorSpace; + colorSpace = surfaceFormats[0].colorSpace; switch (colorFormat) { case VK_FORMAT_R8G8B8A8_UNORM: _colorFmt = Format::RGBA8; break; case VK_FORMAT_R8G8B8A8_SRGB: _colorFmt = Format::SRGB8_A8; break; @@ -481,7 +438,7 @@ bool CCVKContext::initialize(const ContextInfo &info) { case VsyncMode::ON: presentModePriorityList.insert(presentModePriorityList.end(), {VK_PRESENT_MODE_FIFO_KHR}); break; case VsyncMode::RELAXED: presentModePriorityList.insert(presentModePriorityList.end(), {VK_PRESENT_MODE_FIFO_RELAXED_KHR, VK_PRESENT_MODE_FIFO_KHR}); break; case VsyncMode::MAILBOX: presentModePriorityList.insert(presentModePriorityList.end(), {VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR}); break; - case VsyncMode::HALF: presentModePriorityList.insert(presentModePriorityList.end(), {VK_PRESENT_MODE_FIFO_KHR}); break; // TODO + case VsyncMode::HALF: presentModePriorityList.insert(presentModePriorityList.end(), {VK_PRESENT_MODE_FIFO_KHR}); break; // no easy fallback } VkPresentModeKHR swapchainPresentMode = VK_PRESENT_MODE_FIFO_KHR; @@ -493,13 +450,13 @@ bool CCVKContext::initialize(const ContextInfo &info) { } // Determine the number of images - uint desiredNumberOfSwapchainImages = std::max(3u, surfaceCapabilities.minImageCount + 1); + uint desiredNumberOfSwapchainImages = std::max(3U, surfaceCapabilities.minImageCount + 1); if ((surfaceCapabilities.maxImageCount > 0) && (desiredNumberOfSwapchainImages > surfaceCapabilities.maxImageCount)) { desiredNumberOfSwapchainImages = surfaceCapabilities.maxImageCount; } - VkExtent2D imageExtent = {1u, 1u}; + VkExtent2D imageExtent = {1U, 1U}; VkSurfaceTransformFlagBitsKHR preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; // Find a supported composite alpha format (not all devices support alpha opaque) @@ -528,31 +485,31 @@ bool CCVKContext::initialize(const ContextInfo &info) { imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; } - _gpuContext->swapchainCreateInfo.surface = _gpuContext->vkSurface; - _gpuContext->swapchainCreateInfo.minImageCount = desiredNumberOfSwapchainImages; - _gpuContext->swapchainCreateInfo.imageFormat = colorFormat; - _gpuContext->swapchainCreateInfo.imageColorSpace = colorSpace; - _gpuContext->swapchainCreateInfo.imageExtent = imageExtent; - _gpuContext->swapchainCreateInfo.imageUsage = imageUsage; + _gpuContext->swapchainCreateInfo.surface = _gpuContext->vkSurface; + _gpuContext->swapchainCreateInfo.minImageCount = desiredNumberOfSwapchainImages; + _gpuContext->swapchainCreateInfo.imageFormat = colorFormat; + _gpuContext->swapchainCreateInfo.imageColorSpace = colorSpace; + _gpuContext->swapchainCreateInfo.imageExtent = imageExtent; + _gpuContext->swapchainCreateInfo.imageUsage = imageUsage; _gpuContext->swapchainCreateInfo.imageArrayLayers = 1; - _gpuContext->swapchainCreateInfo.preTransform = preTransform; - _gpuContext->swapchainCreateInfo.compositeAlpha = compositeAlpha; - _gpuContext->swapchainCreateInfo.presentMode = swapchainPresentMode; - _gpuContext->swapchainCreateInfo.clipped = VK_TRUE; // Setting clipped to VK_TRUE allows the implementation to discard rendering outside of the surface area + _gpuContext->swapchainCreateInfo.preTransform = preTransform; + _gpuContext->swapchainCreateInfo.compositeAlpha = compositeAlpha; + _gpuContext->swapchainCreateInfo.presentMode = swapchainPresentMode; + _gpuContext->swapchainCreateInfo.clipped = VK_TRUE; // Setting clipped to VK_TRUE allows the implementation to discard rendering outside of the surface area } else { - CCVKContext *sharedCtx = (CCVKContext *)info.sharedCtx; - _majorVersion = sharedCtx->majorVersion(); - _minorVersion = sharedCtx->minorVersion(); - _layers = sharedCtx->getLayers(); - _extensions = sharedCtx->getExtensions(); - _gpuContext = sharedCtx->gpuContext(); + auto *sharedCtx = static_cast(info.sharedCtx); + _majorVersion = sharedCtx->majorVersion(); + _minorVersion = sharedCtx->minorVersion(); + _layers = sharedCtx->getLayers(); + _extensions = sharedCtx->getExtensions(); + _gpuContext = sharedCtx->gpuContext(); } return true; } -void CCVKContext::destroy() { +void CCVKContext::doDestroy() { if (_gpuContext) { if (_gpuContext->vkSurface != VK_NULL_HANDLE) { vkDestroySurfaceKHR(_gpuContext->vkInstance, _gpuContext->vkSurface, nullptr); @@ -580,5 +537,39 @@ void CCVKContext::destroy() { } } +void CCVKContext::releaseSurface(uintptr_t /*windowHandle*/) { +#if (CC_PLATFORM == CC_PLATFORM_ANDROID) + if (_gpuContext && _gpuContext->vkSurface == VK_NULL_HANDLE) return; + + CCVKDevice *device = CCVKDevice::getInstance(); + + uint fenceCount = device->gpuFencePool()->size(); + if (fenceCount) { + VK_CHECK(vkWaitForFences(device->gpuDevice()->vkDevice, fenceCount, + device->gpuFencePool()->data(), VK_TRUE, DEFAULT_TIMEOUT)); + } + + device->destroySwapchain(); + device->_swapchainReady = false; + + vkDestroySurfaceKHR(_gpuContext->vkInstance, _gpuContext->vkSurface, nullptr); + _gpuContext->vkSurface = VK_NULL_HANDLE; +#endif +} + +void CCVKContext::acquireSurface(uintptr_t windowHandle) { +#if (CC_PLATFORM == CC_PLATFORM_ANDROID) + _windowHandle = windowHandle; + if (_gpuContext && _gpuContext->vkSurface != VK_NULL_HANDLE) return; + + VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo{VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR}; + surfaceCreateInfo.window = reinterpret_cast(_windowHandle); + VK_CHECK(vkCreateAndroidSurfaceKHR(_gpuContext->vkInstance, &surfaceCreateInfo, + nullptr, &_gpuContext->vkSurface)); + + CCVKDevice::getInstance()->checkSwapchainStatus(); +#endif +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKContext.h b/native/cocos/renderer/gfx-vulkan/VKContext.h index c65ad72488..6b016a96e3 100644 --- a/native/cocos/renderer/gfx-vulkan/VKContext.h +++ b/native/cocos/renderer/gfx-vulkan/VKContext.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_CONTEXT_H_ -#define CC_GFXVULKAN_CONTEXT_H_ + +#pragma once + +#include "VKStd.h" +#include "gfx-base/GFXContext.h" namespace cc { namespace gfx { @@ -35,37 +39,41 @@ class CCVKGPUSemaphorePool; class CC_VULKAN_API CCVKContext final : public Context { public: - CCVKContext(Device *device); - ~CCVKContext(); + CCVKContext(); + ~CCVKContext() override; -public: - bool initialize(const ContextInfo &info); - void destroy(); - void present() {} + void present() override {} - CC_INLINE bool checkExtension(const String &extension) const { - return std::find_if(_extensions.begin(), _extensions.end(), - [extension](const char *device_extension) { - return std::strcmp(device_extension, extension.c_str()) == 0; - }) != _extensions.end(); + inline bool checkExtension(const String &extension) const { + return std::any_of(_extensions.begin(), _extensions.end(), [&extension](auto &ext) { + return std::strcmp(ext, extension.c_str()) == 0; + }); } - CC_INLINE int majorVersion() const { return _majorVersion; } - CC_INLINE int minorVersion() const { return _minorVersion; } - CC_INLINE CCVKGPUContext *gpuContext() { return _gpuContext; } - CC_INLINE const vector &getLayers() const { return _layers; } - CC_INLINE const vector &getExtensions() const { return _extensions; } + inline int majorVersion() const { return _majorVersion; } + inline int minorVersion() const { return _minorVersion; } + inline CCVKGPUContext * gpuContext() { return _gpuContext; } + inline const vector &getLayers() const { return _layers; } + inline const vector &getExtensions() const { return _extensions; } -private: - CCVKGPUContext *_gpuContext = nullptr; - bool _isPrimaryContex = false; - int _majorVersion = 0; - int _minorVersion = 0; + inline bool validationEnabled() const { return _validationEnabled; } + + void releaseSurface(uintptr_t windowHandle); + void acquireSurface(uintptr_t windowHandle); + +protected: + bool doInit(const ContextInfo &info) override; + void doDestroy() override; + + CCVKGPUContext * _gpuContext = nullptr; + bool _isPrimaryContex = false; + int _majorVersion = 0; + int _minorVersion = 0; vector _layers; vector _extensions; + + bool _validationEnabled = false; }; } // namespace gfx } // namespace cc - -#endif // CC_GFXVULKAN_CONTEXT_H_ diff --git a/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.cpp b/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.cpp index 201868c5be..347503127d 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.cpp @@ -1,34 +1,36 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKBuffer.h" #include "VKCommands.h" #include "VKDescriptorSet.h" #include "VKDescriptorSetLayout.h" -#include "VKPipelineLayout.h" #include "VKDevice.h" +#include "VKPipelineLayout.h" #include "VKSampler.h" #include "VKShader.h" #include "VKTexture.h" @@ -36,57 +38,79 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKDescriptorSet::CCVKDescriptorSet(Device *device) -: DescriptorSet(device) { -} +CCVKDescriptorSet::CCVKDescriptorSet() = default; CCVKDescriptorSet::~CCVKDescriptorSet() { + destroy(); } -bool CCVKDescriptorSet::initialize(const DescriptorSetInfo &info) { - - _layout = info.layout; - - CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout = ((CCVKDescriptorSetLayout *)_layout)->gpuDescriptorSetLayout(); - const uint bindingCount = gpuDescriptorSetLayout->bindings.size(); - const uint descriptorCount = gpuDescriptorSetLayout->descriptorCount; - - _buffers.resize(descriptorCount); - _textures.resize(descriptorCount); - _samplers.resize(descriptorCount); +void CCVKDescriptorSet::doInit(const DescriptorSetInfo & /*info*/) { + CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout = static_cast(_layout)->gpuDescriptorSetLayout(); + const uint bindingCount = gpuDescriptorSetLayout->bindings.size(); + const uint descriptorCount = gpuDescriptorSetLayout->descriptorCount; _gpuDescriptorSet = CC_NEW(CCVKGPUDescriptorSet); _gpuDescriptorSet->gpuDescriptors.resize(descriptorCount, {}); + _gpuDescriptorSet->layoutID = gpuDescriptorSetLayout->id; - for (size_t i = 0u, k = 0u; i < bindingCount; ++i) { + for (size_t i = 0U, k = 0U; i < bindingCount; ++i) { const DescriptorSetLayoutBinding &binding = gpuDescriptorSetLayout->bindings[i]; for (uint j = 0; j < binding.count; ++j, ++k) { - _gpuDescriptorSet->gpuDescriptors[k].type = binding.descriptorType; + CCVKGPUDescriptor &gpuDescriptor = _gpuDescriptorSet->gpuDescriptors[k]; + gpuDescriptor.type = binding.descriptorType; + switch (binding.descriptorType) { + case DescriptorType::UNIFORM_BUFFER: + case DescriptorType::DYNAMIC_UNIFORM_BUFFER: + if (hasFlag(binding.stageFlags, ShaderStageFlags::COMPUTE)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_COMPUTE_SHADER_READ_UNIFORM_BUFFER); + if (hasFlag(binding.stageFlags, ShaderStageFlags::VERTEX)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_VERTEX_SHADER_READ_UNIFORM_BUFFER); + if (hasFlag(binding.stageFlags, ShaderStageFlags::FRAGMENT)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_FRAGMENT_SHADER_READ_UNIFORM_BUFFER); + break; + case DescriptorType::STORAGE_BUFFER: + case DescriptorType::DYNAMIC_STORAGE_BUFFER: + case DescriptorType::STORAGE_IMAGE: + // here we don't handle write accesses, which should be handled manually + if (hasFlag(binding.stageFlags, ShaderStageFlags::COMPUTE)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_COMPUTE_SHADER_READ_OTHER); + if (hasFlag(binding.stageFlags, ShaderStageFlags::VERTEX)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_VERTEX_SHADER_READ_OTHER); + if (hasFlag(binding.stageFlags, ShaderStageFlags::FRAGMENT)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_FRAGMENT_SHADER_READ_OTHER); + break; + case DescriptorType::SAMPLER_TEXTURE: + case DescriptorType::TEXTURE: + if (hasFlag(binding.stageFlags, ShaderStageFlags::COMPUTE)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_COMPUTE_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER); + if (hasFlag(binding.stageFlags, ShaderStageFlags::VERTEX)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_VERTEX_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER); + if (hasFlag(binding.stageFlags, ShaderStageFlags::FRAGMENT)) gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_FRAGMENT_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER); + break; + case DescriptorType::INPUT_ATTACHMENT: + gpuDescriptor.accessTypes.push_back(THSVS_ACCESS_FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT); + break; + case DescriptorType::SAMPLER: + default: + break; + } } } - CCVKGPUDevice *gpuDevice = ((CCVKDevice *)_device)->gpuDevice(); - if (gpuDevice->useDescriptorUpdateTemplate) { - _gpuDescriptorSet->pUpdateTemplate = &gpuDescriptorSetLayout->vkDescriptorUpdateTemplate; - } + CCVKGPUDevice *gpuDevice = CCVKDevice::getInstance()->gpuDevice(); + _gpuDescriptorSet->gpuLayout = gpuDescriptorSetLayout; _gpuDescriptorSet->instances.resize(gpuDevice->backBufferCount); - for (size_t t = 0u; t < gpuDevice->backBufferCount; ++t) { - CCVKGPUDescriptorSet::DescriptorSetInstance &instance = _gpuDescriptorSet->instances[t]; - instance.vkDescriptorSet = gpuDescriptorSetLayout->pool.request(t); + for (size_t t = 0U; t < gpuDevice->backBufferCount; ++t) { + CCVKGPUDescriptorSet::Instance &instance = _gpuDescriptorSet->instances[t]; + instance.vkDescriptorSet = gpuDevice->getDescriptorSetPool(_gpuDescriptorSet->layoutID)->request(t); instance.descriptorInfos.resize(descriptorCount, {}); - for (size_t i = 0u, k = 0u; i < bindingCount; ++i) { + for (size_t i = 0U, k = 0U; i < bindingCount; ++i) { const DescriptorSetLayoutBinding &binding = gpuDescriptorSetLayout->bindings[i]; for (uint j = 0; j < binding.count; ++j, ++k) { - if ((uint)binding.descriptorType & DESCRIPTOR_BUFFER_TYPE) { + if (hasAnyFlags(binding.descriptorType, DESCRIPTOR_BUFFER_TYPE)) { instance.descriptorInfos[k].buffer.buffer = gpuDevice->defaultBuffer.vkBuffer; instance.descriptorInfos[k].buffer.offset = gpuDevice->defaultBuffer.startOffset; - instance.descriptorInfos[k].buffer.range = gpuDevice->defaultBuffer.size; - } else if ((uint)binding.descriptorType & DESCRIPTOR_SAMPLER_TYPE) { - instance.descriptorInfos[k].image.sampler = gpuDevice->defaultSampler.vkSampler; - instance.descriptorInfos[k].image.imageView = gpuDevice->defaultTextureView.vkImageView; - instance.descriptorInfos[k].image.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + instance.descriptorInfos[k].buffer.range = gpuDevice->defaultBuffer.size; + } else if (hasAnyFlags(binding.descriptorType, DESCRIPTOR_TEXTURE_TYPE)) { + instance.descriptorInfos[k].image.sampler = gpuDevice->defaultSampler.vkSampler; + instance.descriptorInfos[k].image.imageView = gpuDevice->defaultTextureView.vkImageView; + instance.descriptorInfos[k].image.imageLayout = binding.descriptorType == DescriptorType::STORAGE_IMAGE + ? VK_IMAGE_LAYOUT_GENERAL + : VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; } } } @@ -95,14 +119,14 @@ bool CCVKDescriptorSet::initialize(const DescriptorSetInfo &info) { vector &entries = instance.descriptorUpdateEntries; entries.resize(descriptorCount, {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET}); - for (size_t i = 0u, j = 0u; i < descriptorCount; i++) { + for (size_t i = 0U, j = 0U; i < bindingCount; i++) { const VkDescriptorSetLayoutBinding &descriptor = gpuDescriptorSetLayout->vkBindings[i]; - for (size_t k = 0u; k < descriptor.descriptorCount; k++, j++) { - entries[j].dstSet = instance.vkDescriptorSet; - entries[j].dstBinding = descriptor.binding; + for (size_t k = 0U; k < descriptor.descriptorCount; k++, j++) { + entries[j].dstSet = instance.vkDescriptorSet; + entries[j].dstBinding = descriptor.binding; entries[j].dstArrayElement = k; entries[j].descriptorCount = 1; // better not to assume that the descriptor infos would be contiguous - entries[j].descriptorType = descriptor.descriptorType; + entries[j].descriptorType = descriptor.descriptorType; switch (entries[j].descriptorType) { case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: @@ -127,19 +151,17 @@ bool CCVKDescriptorSet::initialize(const DescriptorSetInfo &info) { } } } - - return true; } -void CCVKDescriptorSet::destroy() { +void CCVKDescriptorSet::doDestroy() { if (_gpuDescriptorSet) { - CCVKGPUDescriptorHub *descriptorHub = ((CCVKDevice *)_device)->gpuDescriptorHub(); - CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout = ((CCVKDescriptorSetLayout *)_layout)->gpuDescriptorSetLayout(); + CCVKGPUDevice * gpuDevice = CCVKDevice::getInstance()->gpuDevice(); + CCVKGPUDescriptorHub *descriptorHub = CCVKDevice::getInstance()->gpuDescriptorHub(); - for (size_t t = 0u; t < _gpuDescriptorSet->instances.size(); ++t) { - CCVKGPUDescriptorSet::DescriptorSetInstance &instance = _gpuDescriptorSet->instances[t]; + for (size_t t = 0U; t < _gpuDescriptorSet->instances.size(); ++t) { + CCVKGPUDescriptorSet::Instance &instance = _gpuDescriptorSet->instances[t]; - for (uint i = 0u; i < _gpuDescriptorSet->gpuDescriptors.size(); i++) { + for (uint i = 0U; i < _gpuDescriptorSet->gpuDescriptors.size(); i++) { CCVKGPUDescriptor &binding = _gpuDescriptorSet->gpuDescriptors[i]; CCVKDescriptorInfo &descriptorInfo = instance.descriptorInfos[i]; @@ -154,36 +176,32 @@ void CCVKDescriptorSet::destroy() { } } - if (gpuDescriptorSetLayout && instance.vkDescriptorSet) { - gpuDescriptorSetLayout->pool.yield(instance.vkDescriptorSet, t); + if (instance.vkDescriptorSet) { + gpuDevice->getDescriptorSetPool(_gpuDescriptorSet->layoutID)->yield(instance.vkDescriptorSet, t); } } - ((CCVKDevice *)_device)->gpuDescriptorSetHub()->erase(_gpuDescriptorSet); + CCVKDevice::getInstance()->gpuDescriptorSetHub()->erase(_gpuDescriptorSet); CC_DELETE(_gpuDescriptorSet); _gpuDescriptorSet = nullptr; } - - // do remember to clear these or else it might not be properly updated when reused - _buffers.clear(); - _textures.clear(); - _samplers.clear(); } void CCVKDescriptorSet::update() { if (_isDirty && _gpuDescriptorSet) { - CCVKGPUDescriptorHub *descriptorHub = ((CCVKDevice *)_device)->gpuDescriptorHub(); - uint descriptorCount = _gpuDescriptorSet->gpuDescriptors.size(); + CCVKGPUDescriptorHub * descriptorHub = CCVKDevice::getInstance()->gpuDescriptorHub(); + CCVKGPUBarrierManager *layoutMgr = CCVKDevice::getInstance()->gpuBarrierManager(); + uint descriptorCount = _gpuDescriptorSet->gpuDescriptors.size(); - for (size_t i = 0u; i < descriptorCount; i++) { + for (size_t i = 0U; i < descriptorCount; i++) { CCVKGPUDescriptor &binding = _gpuDescriptorSet->gpuDescriptors[i]; - if ((uint)binding.type & DESCRIPTOR_BUFFER_TYPE) { + if (hasAnyFlags(binding.type, DESCRIPTOR_BUFFER_TYPE)) { if (_buffers[i]) { - CCVKGPUBufferView *bufferView = ((CCVKBuffer *)_buffers[i])->gpuBufferView(); + CCVKGPUBufferView *bufferView = static_cast(_buffers[i])->gpuBufferView(); if (binding.gpuBufferView != bufferView) { - for (size_t t = 0u; t < _gpuDescriptorSet->instances.size(); ++t) { + for (size_t t = 0U; t < _gpuDescriptorSet->instances.size(); ++t) { CCVKDescriptorInfo &descriptorInfo = _gpuDescriptorSet->instances[t].descriptorInfos[i]; if (binding.gpuBufferView) { @@ -197,28 +215,29 @@ void CCVKDescriptorSet::update() { binding.gpuBufferView = bufferView; } } - } else if ((uint)binding.type & DESCRIPTOR_SAMPLER_TYPE) { + } else if (hasAnyFlags(binding.type, DESCRIPTOR_TEXTURE_TYPE)) { if (_textures[i]) { - CCVKGPUTextureView *textureView = ((CCVKTexture *)_textures[i])->gpuTextureView(); + CCVKGPUTextureView *textureView = static_cast(_textures[i])->gpuTextureView(); if (binding.gpuTextureView != textureView) { - for (size_t t = 0u; t < _gpuDescriptorSet->instances.size(); ++t) { - CCVKDescriptorInfo &descriptorInfo = _gpuDescriptorSet->instances[t].descriptorInfos[i]; + for (auto &instance : _gpuDescriptorSet->instances) { + CCVKDescriptorInfo &descriptorInfo = instance.descriptorInfos[i]; if (binding.gpuTextureView) { descriptorHub->disengage(binding.gpuTextureView, &descriptorInfo.image); } if (textureView) { descriptorHub->connect(_gpuDescriptorSet, textureView, &descriptorInfo.image); descriptorHub->update(textureView, &descriptorInfo.image); + layoutMgr->checkIn(textureView->gpuTexture, binding.accessTypes.data(), binding.accessTypes.size()); } } binding.gpuTextureView = textureView; } } if (_samplers[i]) { - CCVKGPUSampler *sampler = ((CCVKSampler *)_samplers[i])->gpuSampler(); + CCVKGPUSampler *sampler = static_cast(_samplers[i])->gpuSampler(); if (binding.gpuSampler != sampler) { - for (size_t t = 0u; t < _gpuDescriptorSet->instances.size(); ++t) { - CCVKDescriptorInfo &descriptorInfo = _gpuDescriptorSet->instances[t].descriptorInfos[i]; + for (auto &instance : _gpuDescriptorSet->instances) { + CCVKDescriptorInfo &descriptorInfo = instance.descriptorInfos[i]; if (binding.gpuSampler) { descriptorHub->disengage(binding.gpuSampler, &descriptorInfo.image); } @@ -232,7 +251,7 @@ void CCVKDescriptorSet::update() { } } } - ((CCVKDevice *)_device)->gpuDescriptorSetHub()->record(_gpuDescriptorSet); + CCVKDevice::getInstance()->gpuDescriptorSetHub()->record(_gpuDescriptorSet); _isDirty = false; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h b/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h index 9b6de4d99e..fb4cbbd506 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h +++ b/native/cocos/renderer/gfx-vulkan/VKDescriptorSet.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_BINDING_LAYOUT_H_ -#define CC_GFXVULKAN_BINDING_LAYOUT_H_ + +#pragma once + +#include "gfx-base/GFXDescriptorSet.h" namespace cc { namespace gfx { @@ -31,21 +34,19 @@ class CCVKGPUDescriptorSet; class CC_VULKAN_API CCVKDescriptorSet final : public DescriptorSet { public: - CCVKDescriptorSet(Device *device); + CCVKDescriptorSet(); ~CCVKDescriptorSet(); -public: - virtual bool initialize(const DescriptorSetInfo &info) override; - virtual void destroy() override; - virtual void update() override; + void update() override; CC_INLINE CCVKGPUDescriptorSet *gpuDescriptorSet() const { return _gpuDescriptorSet; } -private: +protected: + void doInit(const DescriptorSetInfo &info) override; + void doDestroy() override; + CCVKGPUDescriptorSet *_gpuDescriptorSet = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.cpp b/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.cpp index 001147b979..e5a7271f96 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.cpp @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" +#include "gfx-base/GFXDef.h" + #include "VKCommands.h" #include "VKDescriptorSetLayout.h" #include "VKDevice.h" @@ -30,61 +34,34 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKDescriptorSetLayout::CCVKDescriptorSetLayout(Device *device) -: DescriptorSetLayout(device) { -} +CCVKDescriptorSetLayout::CCVKDescriptorSetLayout() = default; CCVKDescriptorSetLayout::~CCVKDescriptorSetLayout() { + destroy(); } -bool CCVKDescriptorSetLayout::initialize(const DescriptorSetLayoutInfo &info) { - - _bindings = info.bindings; - uint bindingCount = _bindings.size(); - _descriptorCount = 0u; - - if (bindingCount) { - uint maxBinding = 0u; - vector flattenedIndices(bindingCount); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - flattenedIndices[i] = _descriptorCount; - _descriptorCount += binding.count; - if (binding.binding > maxBinding) maxBinding = binding.binding; - } - - _bindingIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - _descriptorIndices.resize(maxBinding + 1, GFX_INVALID_BINDING); - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - _bindingIndices[binding.binding] = i; - _descriptorIndices[binding.binding] = flattenedIndices[i]; - } - } - - _gpuDescriptorSetLayout = CC_NEW(CCVKGPUDescriptorSetLayout); - _gpuDescriptorSetLayout->descriptorCount = _descriptorCount; - _gpuDescriptorSetLayout->bindingIndices = _bindingIndices; +void CCVKDescriptorSetLayout::doInit(const DescriptorSetLayoutInfo& /*info*/) { + _gpuDescriptorSetLayout = CC_NEW(CCVKGPUDescriptorSetLayout); + _gpuDescriptorSetLayout->id = generateID(); + _gpuDescriptorSetLayout->descriptorCount = _descriptorCount; + _gpuDescriptorSetLayout->bindingIndices = _bindingIndices; _gpuDescriptorSetLayout->descriptorIndices = _descriptorIndices; - _gpuDescriptorSetLayout->bindings = _bindings; + _gpuDescriptorSetLayout->bindings = _bindings; - for (uint i = 0u; i < bindingCount; i++) { - const DescriptorSetLayoutBinding &binding = _bindings[i]; - if ((uint)binding.descriptorType & DESCRIPTOR_DYNAMIC_TYPE) { - for (uint j = 0u; j < binding.count; j++) { + for (auto& binding : _bindings) { + if (hasAnyFlags(binding.descriptorType, DESCRIPTOR_DYNAMIC_TYPE)) { + for (uint j = 0U; j < binding.count; j++) { _gpuDescriptorSetLayout->dynamicBindings.push_back(binding.binding); } } } - CCVKCmdFuncCreateDescriptorSetLayout((CCVKDevice *)_device, _gpuDescriptorSetLayout); - - return true; + cmdFuncCCVKCreateDescriptorSetLayout(CCVKDevice::getInstance(), _gpuDescriptorSetLayout); } -void CCVKDescriptorSetLayout::destroy() { +void CCVKDescriptorSetLayout::doDestroy() { if (_gpuDescriptorSetLayout) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuDescriptorSetLayout); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuDescriptorSetLayout); _gpuDescriptorSetLayout = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h b/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h index 8dd82ea8fb..14704eb8cb 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h +++ b/native/cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_DESCRIPTOR_SET_LAYOUT_H_ #define CC_GFXVULKAN_DESCRIPTOR_SET_LAYOUT_H_ +#include "gfx-base/GFXDescriptorSetLayout.h" + namespace cc { namespace gfx { @@ -31,16 +35,20 @@ class CCVKGPUDescriptorSetLayout; class CC_VULKAN_API CCVKDescriptorSetLayout final : public DescriptorSetLayout { public: - CCVKDescriptorSetLayout(Device *device); + CCVKDescriptorSetLayout(); ~CCVKDescriptorSetLayout(); -public: - virtual bool initialize(const DescriptorSetLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout() const { return _gpuDescriptorSetLayout; } -private: +protected: + static uint generateID() noexcept { + static uint _idGen = 10000; + return _idGen++; + } + + void doInit(const DescriptorSetLayoutInfo &info) override; + void doDestroy() override; + CCVKGPUDescriptorSetLayout *_gpuDescriptorSetLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-vulkan/VKDevice.cpp b/native/cocos/renderer/gfx-vulkan/VKDevice.cpp index b329bb63fa..15c5aadd22 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDevice.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKDevice.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "VKStd.h" #include "VKBuffer.h" @@ -6,8 +31,8 @@ #include "VKDescriptorSet.h" #include "VKDescriptorSetLayout.h" #include "VKDevice.h" -#include "VKFence.h" #include "VKFramebuffer.h" +#include "VKGlobalBarrier.h" #include "VKInputAssembler.h" #include "VKPipelineLayout.h" #include "VKPipelineState.h" @@ -16,11 +41,17 @@ #include "VKSampler.h" #include "VKShader.h" #include "VKTexture.h" +#include "VKTextureBarrier.h" #include "VKUtils.h" CC_DISABLE_WARNINGS() #define VMA_IMPLEMENTATION #include "vk_mem_alloc.h" +#define THSVS_ERROR_CHECK_MIXED_IMAGE_LAYOUT +#define THSVS_ERROR_CHECK_COULD_USE_GLOBAL_BARRIER +#define THSVS_ERROR_CHECK_POTENTIAL_HAZARD +#define THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_IMPLEMENTATION +#include "thsvs_simpler_vulkan_synchronization.h" CC_ENABLE_WARNINGS() namespace cc { @@ -28,86 +59,82 @@ namespace gfx { //#define DISABLE_PRE_TRANSFORM +CCVKDevice *CCVKDevice::instance = nullptr; + +CCVKDevice *CCVKDevice::getInstance() { + return CCVKDevice::instance; +} + CCVKDevice::CCVKDevice() { - _clipSpaceMinZ = 0.0f; - _screenSpaceSignY = -1.0f; - _UVSpaceSignY = 1.0f; + _api = API::VULKAN; + _deviceName = "Vulkan"; + + _caps.clipSpaceMinZ = 0.0F; + _caps.screenSpaceSignY = -1.0F; + _caps.clipSpaceSignY = -1.0F; + CCVKDevice::instance = this; } CCVKDevice::~CCVKDevice() { + CCVKDevice::instance = nullptr; } CCVKGPUContext *CCVKDevice::gpuContext() const { - return ((CCVKContext *)_context)->gpuContext(); + return static_cast(_context)->gpuContext(); } -bool CCVKDevice::initialize(const DeviceInfo &info) { - _API = API::VULKAN; - _deviceName = "Vulkan"; - _width = info.width; - _height = info.height; - _nativeWidth = info.nativeWidth; - _nativeHeight = info.nativeHeight; - _windowHandle = info.windowHandle; +bool CCVKDevice::doInit(const DeviceInfo & /*info*/) { + ContextInfo ctxInfo; + ctxInfo.windowHandle = _windowHandle; - _bindingMappingInfo = info.bindingMappingInfo; - if (!_bindingMappingInfo.bufferOffsets.size()) { - _bindingMappingInfo.bufferOffsets.push_back(0); - } - if (!_bindingMappingInfo.samplerOffsets.size()) { - _bindingMappingInfo.samplerOffsets.push_back(0); - } - - ContextInfo contextCreateInfo; - contextCreateInfo.windowHandle = _windowHandle; - contextCreateInfo.sharedCtx = info.sharedCtx; - - _context = CC_NEW(CCVKContext(this)); - if (!_context->initialize(contextCreateInfo)) { + _context = CC_NEW(CCVKContext); + if (!_context->initialize(ctxInfo)) { destroy(); return false; } - const CCVKContext *context = (CCVKContext *)_context; - const CCVKGPUContext *gpuContext = ((CCVKContext *)_context)->gpuContext(); + + auto * context = static_cast(_context); + const CCVKGPUContext * gpuContext = context->gpuContext(); const VkPhysicalDeviceFeatures2 &deviceFeatures2 = gpuContext->physicalDeviceFeatures2; - const VkPhysicalDeviceFeatures &deviceFeatures = deviceFeatures2.features; + const VkPhysicalDeviceFeatures & deviceFeatures = deviceFeatures2.features; //const VkPhysicalDeviceVulkan11Features &deviceVulkan11Features = gpuContext->physicalDeviceVulkan11Features; //const VkPhysicalDeviceVulkan12Features &deviceVulkan12Features = gpuContext->physicalDeviceVulkan12Features; + ///////////////////// Device Creation ///////////////////// + + _gpuDevice = CC_NEW(CCVKGPUDevice); + _gpuDevice->minorVersion = context->minorVersion(); + // only enable the absolute essentials for now - vector requestedValidationLayers{}; - -#if CC_DEBUG > 0 - requestedValidationLayers.push_back("VK_LAYER_KHRONOS_validation"); -#endif - + vector requestedLayers{}; vector requestedExtensions{ VK_KHR_SWAPCHAIN_EXTENSION_NAME, - VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, - VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, - VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, }; - VkPhysicalDeviceFeatures2 requestedFeatures2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; + if (_gpuDevice->minorVersion < 1) { + requestedExtensions.push_back(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME); + requestedExtensions.push_back(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME); + requestedExtensions.push_back(VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); + } + + VkPhysicalDeviceFeatures2 requestedFeatures2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; VkPhysicalDeviceVulkan11Features requestedVulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; VkPhysicalDeviceVulkan12Features requestedVulkan12Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; // features should be enabled like this: requestedFeatures2.features.textureCompressionASTC_LDR = deviceFeatures.textureCompressionASTC_LDR; - requestedFeatures2.features.textureCompressionBC = deviceFeatures.textureCompressionBC; - requestedFeatures2.features.textureCompressionETC2 = deviceFeatures.textureCompressionETC2; - requestedFeatures2.features.samplerAnisotropy = deviceFeatures.samplerAnisotropy; - requestedFeatures2.features.depthBounds = deviceFeatures.depthBounds; - requestedFeatures2.features.multiDrawIndirect = deviceFeatures.multiDrawIndirect; + requestedFeatures2.features.textureCompressionBC = deviceFeatures.textureCompressionBC; + requestedFeatures2.features.textureCompressionETC2 = deviceFeatures.textureCompressionETC2; + requestedFeatures2.features.samplerAnisotropy = deviceFeatures.samplerAnisotropy; + requestedFeatures2.features.depthBounds = deviceFeatures.depthBounds; + requestedFeatures2.features.multiDrawIndirect = deviceFeatures.multiDrawIndirect; -#if CC_DEBUG > 0 - // GPU-assisted validation - requestedFeatures2.features.shaderInt64 = deviceFeatures.shaderInt64; - requestedFeatures2.features.fragmentStoresAndAtomics = deviceFeatures.fragmentStoresAndAtomics; - requestedFeatures2.features.vertexPipelineStoresAndAtomics = deviceFeatures.vertexPipelineStoresAndAtomics; -#endif - - ///////////////////// Device Creation ///////////////////// - - _gpuDevice = CC_NEW(CCVKGPUDevice); + if (context->validationEnabled()) { + requestedLayers.push_back("VK_LAYER_KHRONOS_validation"); + // GPU-assisted validation + requestedFeatures2.features.shaderInt64 = deviceFeatures.shaderInt64; + requestedFeatures2.features.fragmentStoresAndAtomics = deviceFeatures.fragmentStoresAndAtomics; + requestedFeatures2.features.vertexPipelineStoresAndAtomics = deviceFeatures.vertexPipelineStoresAndAtomics; + requestedExtensions.push_back(VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME); + } // check extensions uint availableLayerCount; @@ -121,7 +148,7 @@ bool CCVKDevice::initialize(const DeviceInfo &info) { VK_CHECK(vkEnumerateDeviceExtensionProperties(gpuContext->physicalDevice, nullptr, &availableExtensionCount, _gpuDevice->extensions.data())); // just filter out the unsupported layers & extensions - for (const char *layer : requestedValidationLayers) { + for (const char *layer : requestedLayers) { if (isLayerSupported(layer, _gpuDevice->layers)) { _layers.push_back(layer); } @@ -133,37 +160,37 @@ bool CCVKDevice::initialize(const DeviceInfo &info) { } // prepare the device queues - uint queueFamilyPropertiesCount = toUint(gpuContext->queueFamilyProperties.size()); + uint queueFamilyPropertiesCount = utils::toUint(gpuContext->queueFamilyProperties.size()); vector queueCreateInfos(queueFamilyPropertiesCount, {VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO}); - vector> queuePriorities(queueFamilyPropertiesCount); + vector> queuePriorities(queueFamilyPropertiesCount); - for (uint queueFamilyIndex = 0u; queueFamilyIndex < queueFamilyPropertiesCount; ++queueFamilyIndex) { + for (uint queueFamilyIndex = 0U; queueFamilyIndex < queueFamilyPropertiesCount; ++queueFamilyIndex) { const VkQueueFamilyProperties &queueFamilyProperty = gpuContext->queueFamilyProperties[queueFamilyIndex]; - queuePriorities[queueFamilyIndex].resize(queueFamilyProperty.queueCount, 1.0f); + queuePriorities[queueFamilyIndex].resize(queueFamilyProperty.queueCount, 1.0F); VkDeviceQueueCreateInfo &queueCreateInfo = queueCreateInfos[queueFamilyIndex]; queueCreateInfo.queueFamilyIndex = queueFamilyIndex; - queueCreateInfo.queueCount = queueFamilyProperty.queueCount; + queueCreateInfo.queueCount = queueFamilyProperty.queueCount; queueCreateInfo.pQueuePriorities = queuePriorities[queueFamilyIndex].data(); } VkDeviceCreateInfo deviceCreateInfo{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO}; - deviceCreateInfo.queueCreateInfoCount = toUint(queueCreateInfos.size()); - deviceCreateInfo.pQueueCreateInfos = queueCreateInfos.data(); - deviceCreateInfo.enabledLayerCount = toUint(_layers.size()); - deviceCreateInfo.ppEnabledLayerNames = _layers.data(); - deviceCreateInfo.enabledExtensionCount = toUint(_extensions.size()); + deviceCreateInfo.queueCreateInfoCount = utils::toUint(queueCreateInfos.size()); + deviceCreateInfo.pQueueCreateInfos = queueCreateInfos.data(); + deviceCreateInfo.enabledLayerCount = utils::toUint(_layers.size()); + deviceCreateInfo.ppEnabledLayerNames = _layers.data(); + deviceCreateInfo.enabledExtensionCount = utils::toUint(_extensions.size()); deviceCreateInfo.ppEnabledExtensionNames = _extensions.data(); - if (context->minorVersion() < 1 && + if (_gpuDevice->minorVersion < 1 && !context->checkExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { deviceCreateInfo.pEnabledFeatures = &requestedFeatures2.features; } else { deviceCreateInfo.pNext = &requestedFeatures2; - if (context->minorVersion() >= 2) { - requestedFeatures2.pNext = &requestedVulkan11Features; + if (_gpuDevice->minorVersion >= 2) { + requestedFeatures2.pNext = &requestedVulkan11Features; requestedVulkan11Features.pNext = &requestedVulkan12Features; } } @@ -172,172 +199,201 @@ bool CCVKDevice::initialize(const DeviceInfo &info) { ///////////////////// Gather Device Properties ///////////////////// - _features[(uint)Feature::COLOR_FLOAT] = true; - _features[(uint)Feature::COLOR_HALF_FLOAT] = true; - _features[(uint)Feature::TEXTURE_FLOAT] = true; - _features[(uint)Feature::TEXTURE_HALF_FLOAT] = true; - _features[(uint)Feature::TEXTURE_FLOAT_LINEAR] = true; - _features[(uint)Feature::TEXTURE_HALF_FLOAT_LINEAR] = true; - _features[(uint)Feature::FORMAT_R11G11B10F] = true; - _features[(uint)Feature::MSAA] = true; - _features[(uint)Feature::ELEMENT_INDEX_UINT] = true; - _features[(uint)Feature::INSTANCED_ARRAYS] = true; - _features[(uint)Feature::MULTIPLE_RENDER_TARGETS] = true; - _features[(uint)Feature::BLEND_MINMAX] = true; - _features[(uint)Feature::DEPTH_BOUNDS] = deviceFeatures.depthBounds; - _features[(uint)Feature::LINE_WIDTH] = true; - _features[(uint)Feature::STENCIL_COMPARE_MASK] = true; - _features[(uint)Feature::STENCIL_WRITE_MASK] = true; - _features[(uint)Feature::MULTITHREADED_SUBMISSION] = true; + _features[static_cast(Feature::COLOR_FLOAT)] = true; + _features[static_cast(Feature::COLOR_HALF_FLOAT)] = true; + _features[static_cast(Feature::TEXTURE_FLOAT)] = true; + _features[static_cast(Feature::TEXTURE_HALF_FLOAT)] = true; + _features[static_cast(Feature::TEXTURE_FLOAT_LINEAR)] = true; + _features[static_cast(Feature::TEXTURE_HALF_FLOAT_LINEAR)] = true; + _features[static_cast(Feature::FORMAT_R11G11B10F)] = true; + _features[static_cast(Feature::MSAA)] = true; + _features[static_cast(Feature::ELEMENT_INDEX_UINT)] = true; + _features[static_cast(Feature::INSTANCED_ARRAYS)] = true; + _features[static_cast(Feature::MULTIPLE_RENDER_TARGETS)] = true; + _features[static_cast(Feature::BLEND_MINMAX)] = true; + _features[static_cast(Feature::DEPTH_BOUNDS)] = deviceFeatures.depthBounds; + _features[static_cast(Feature::LINE_WIDTH)] = true; + _features[static_cast(Feature::STENCIL_COMPARE_MASK)] = true; + _features[static_cast(Feature::STENCIL_WRITE_MASK)] = true; + _features[static_cast(Feature::MULTITHREADED_SUBMISSION)] = true; + _features[static_cast(Feature::COMPUTE_SHADER)] = true; - _gpuDevice->useMultiDrawIndirect = deviceFeatures.multiDrawIndirect; - _gpuDevice->useDescriptorUpdateTemplate = checkExtension(VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); + _gpuDevice->useMultiDrawIndirect = deviceFeatures.multiDrawIndirect; + _gpuDevice->useDescriptorUpdateTemplate = _gpuDevice->minorVersion > 0 || checkExtension(VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME); VkFormatFeatureFlags requiredFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; - VkFormatProperties formatProperties; + VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_R8G8B8_UNORM, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_RGB8] = true; + _features[static_cast(Feature::FORMAT_RGB8)] = true; } requiredFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_D16_UNORM, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_D16] = true; + _features[static_cast(Feature::FORMAT_D16)] = true; } vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_X8_D24_UNORM_PACK32, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_D24] = true; + _features[static_cast(Feature::FORMAT_D24)] = true; } vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_D32_SFLOAT, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_D32F] = true; + _features[static_cast(Feature::FORMAT_D32F)] = true; } vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_D16_UNORM_S8_UINT, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_D16S8] = true; + _features[static_cast(Feature::FORMAT_D16S8)] = true; } vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_D24_UNORM_S8_UINT, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_D24S8] = true; + _features[static_cast(Feature::FORMAT_D24S8)] = true; } vkGetPhysicalDeviceFormatProperties(gpuContext->physicalDevice, VK_FORMAT_D32_SFLOAT_S8_UINT, &formatProperties); if (formatProperties.optimalTilingFeatures & requiredFeatures) { - _features[(uint)Feature::FORMAT_D32FS8] = true; + _features[static_cast(Feature::FORMAT_D32FS8)] = true; } String compressedFmts; if (deviceFeatures.textureCompressionETC2) { - _features[(uint)Feature::FORMAT_ETC2] = true; + _features[static_cast(Feature::FORMAT_ETC2)] = true; compressedFmts += "etc2 "; } if (deviceFeatures.textureCompressionASTC_LDR) { - _features[(uint)Feature::FORMAT_ASTC] = true; + _features[static_cast(Feature::FORMAT_ASTC)] = true; compressedFmts += "astc "; } const VkPhysicalDeviceLimits &limits = gpuContext->physicalDeviceProperties.limits; - _maxVertexAttributes = limits.maxVertexInputAttributes; - _maxVertexUniformVectors = limits.maxPerStageDescriptorUniformBuffers; - _maxFragmentUniformVectors = limits.maxPerStageDescriptorUniformBuffers; - _maxUniformBufferBindings = limits.maxDescriptorSetUniformBuffers; - _maxUniformBlockSize = limits.maxUniformBufferRange; - _maxTextureUnits = limits.maxDescriptorSetSampledImages; - _maxVertexTextureUnits = limits.maxPerStageDescriptorSampledImages; - _maxTextureSize = limits.maxImageDimension2D; - _maxCubeMapTextureSize = limits.maxImageDimensionCube; - _uboOffsetAlignment = (uint)limits.minUniformBufferOffsetAlignment; - MapDepthStencilBits(_context->getDepthStencilFormat(), _depthBits, _stencilBits); + _caps.maxVertexAttributes = limits.maxVertexInputAttributes; + _caps.maxVertexUniformVectors = limits.maxPerStageDescriptorUniformBuffers; + _caps.maxFragmentUniformVectors = limits.maxPerStageDescriptorUniformBuffers; + _caps.maxUniformBufferBindings = limits.maxDescriptorSetUniformBuffers; + _caps.maxUniformBlockSize = limits.maxUniformBufferRange; + _caps.maxShaderStorageBlockSize = limits.maxStorageBufferRange; + _caps.maxShaderStorageBufferBindings = limits.maxDescriptorSetStorageBuffers; + _caps.maxTextureUnits = limits.maxDescriptorSetSampledImages; + _caps.maxVertexTextureUnits = limits.maxPerStageDescriptorSampledImages; + _caps.maxTextureSize = limits.maxImageDimension2D; + _caps.maxCubeMapTextureSize = limits.maxImageDimensionCube; + _caps.uboOffsetAlignment = static_cast(limits.minUniformBufferOffsetAlignment); + mapDepthStencilBits(_context->getDepthStencilFormat(), &_caps.depthBits, &_caps.stencilBits); + // compute shaders + _caps.maxComputeSharedMemorySize = limits.maxComputeSharedMemorySize; + _caps.maxComputeWorkGroupInvocations = limits.maxComputeWorkGroupInvocations; + _caps.maxComputeWorkGroupCount = {limits.maxComputeWorkGroupCount[0], limits.maxComputeWorkGroupCount[1], limits.maxComputeWorkGroupCount[2]}; + _caps.maxComputeWorkGroupSize = {limits.maxComputeWorkGroupSize[0], limits.maxComputeWorkGroupSize[1], limits.maxComputeWorkGroupSize[2]}; +#if defined(VK_USE_PLATFORM_ANDROID_KHR) + _caps.maxComputeWorkGroupInvocations = 64; // UNASSIGNED-BestPractices-vkCreateComputePipelines-compute-work-group-size +#endif // defined(VK_USE_PLATFORM_ANDROID_KHR) ///////////////////// Resource Initialization ///////////////////// + QueueInfo queueInfo; + queueInfo.type = QueueType::GRAPHICS; + _queue = createQueue(queueInfo); + + CommandBufferInfo cmdBuffInfo; + cmdBuffInfo.type = CommandBufferType::PRIMARY; + cmdBuffInfo.queue = _queue; + _cmdBuff = createCommandBuffer(cmdBuffInfo); + VmaVulkanFunctions vmaVulkanFunc{}; - vmaVulkanFunc.vkAllocateMemory = vkAllocateMemory; - vmaVulkanFunc.vkBindBufferMemory = vkBindBufferMemory; - vmaVulkanFunc.vkBindImageMemory = vkBindImageMemory; - vmaVulkanFunc.vkCreateBuffer = vkCreateBuffer; - vmaVulkanFunc.vkCreateImage = vkCreateImage; - vmaVulkanFunc.vkDestroyBuffer = vkDestroyBuffer; - vmaVulkanFunc.vkDestroyImage = vkDestroyImage; - vmaVulkanFunc.vkFlushMappedMemoryRanges = vkFlushMappedMemoryRanges; - vmaVulkanFunc.vkFreeMemory = vkFreeMemory; - vmaVulkanFunc.vkGetBufferMemoryRequirements = vkGetBufferMemoryRequirements; - vmaVulkanFunc.vkGetImageMemoryRequirements = vkGetImageMemoryRequirements; + vmaVulkanFunc.vkAllocateMemory = vkAllocateMemory; + vmaVulkanFunc.vkBindBufferMemory = vkBindBufferMemory; + vmaVulkanFunc.vkBindImageMemory = vkBindImageMemory; + vmaVulkanFunc.vkCreateBuffer = vkCreateBuffer; + vmaVulkanFunc.vkCreateImage = vkCreateImage; + vmaVulkanFunc.vkDestroyBuffer = vkDestroyBuffer; + vmaVulkanFunc.vkDestroyImage = vkDestroyImage; + vmaVulkanFunc.vkFlushMappedMemoryRanges = vkFlushMappedMemoryRanges; + vmaVulkanFunc.vkFreeMemory = vkFreeMemory; + vmaVulkanFunc.vkGetBufferMemoryRequirements = vkGetBufferMemoryRequirements; + vmaVulkanFunc.vkGetImageMemoryRequirements = vkGetImageMemoryRequirements; vmaVulkanFunc.vkGetPhysicalDeviceMemoryProperties = vkGetPhysicalDeviceMemoryProperties; - vmaVulkanFunc.vkGetPhysicalDeviceProperties = vkGetPhysicalDeviceProperties; - vmaVulkanFunc.vkInvalidateMappedMemoryRanges = vkInvalidateMappedMemoryRanges; - vmaVulkanFunc.vkMapMemory = vkMapMemory; - vmaVulkanFunc.vkUnmapMemory = vkUnmapMemory; + vmaVulkanFunc.vkGetPhysicalDeviceProperties = vkGetPhysicalDeviceProperties; + vmaVulkanFunc.vkInvalidateMappedMemoryRanges = vkInvalidateMappedMemoryRanges; + vmaVulkanFunc.vkMapMemory = vkMapMemory; + vmaVulkanFunc.vkUnmapMemory = vkUnmapMemory; VmaAllocatorCreateInfo allocatorInfo{}; allocatorInfo.physicalDevice = gpuContext->physicalDevice; - allocatorInfo.device = _gpuDevice->vkDevice; - allocatorInfo.instance = gpuContext->vkInstance; + allocatorInfo.device = _gpuDevice->vkDevice; + allocatorInfo.instance = gpuContext->vkInstance; - if (checkExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) && - checkExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME)) { + if (_gpuDevice->minorVersion > 0) { + allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT; + vmaVulkanFunc.vkGetBufferMemoryRequirements2KHR = vkGetBufferMemoryRequirements2; + vmaVulkanFunc.vkGetImageMemoryRequirements2KHR = vkGetImageMemoryRequirements2; + } else if (checkExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) && + checkExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME)) { allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT; vmaVulkanFunc.vkGetBufferMemoryRequirements2KHR = vkGetBufferMemoryRequirements2KHR; - vmaVulkanFunc.vkGetImageMemoryRequirements2KHR = vkGetImageMemoryRequirements2KHR; + vmaVulkanFunc.vkGetImageMemoryRequirements2KHR = vkGetImageMemoryRequirements2KHR; } allocatorInfo.pVulkanFunctions = &vmaVulkanFunc; VK_CHECK(vmaCreateAllocator(&allocatorInfo, &_gpuDevice->memoryAllocator)); - QueueInfo queueInfo; - queueInfo.type = QueueType::GRAPHICS; - _queue = createQueue(queueInfo); - uint backBufferCount = gpuContext->swapchainCreateInfo.minImageCount; - for (uint i = 0u; i < backBufferCount; i++) { + for (uint i = 0U; i < backBufferCount; i++) { _gpuFencePools.push_back(CC_NEW(CCVKGPUFencePool(_gpuDevice))); _gpuRecycleBins.push_back(CC_NEW(CCVKGPURecycleBin(_gpuDevice))); _gpuStagingBufferPools.push_back(CC_NEW(CCVKGPUStagingBufferPool(_gpuDevice))); } - _gpuBufferHub = CC_NEW(CCVKGPUBufferHub(_gpuDevice)); - _gpuTransportHub = CC_NEW(CCVKGPUTransportHub(_gpuDevice)); - _gpuTransportHub->link(((CCVKQueue *)_queue)->gpuQueue()); - _gpuDescriptorHub = CC_NEW(CCVKGPUDescriptorHub(_gpuDevice)); - _gpuSemaphorePool = CC_NEW(CCVKGPUSemaphorePool(_gpuDevice)); + _gpuBufferHub = CC_NEW(CCVKGPUBufferHub(_gpuDevice)); + _gpuTransportHub = CC_NEW(CCVKGPUTransportHub(_gpuDevice, static_cast(_queue)->gpuQueue())); + _gpuDescriptorHub = CC_NEW(CCVKGPUDescriptorHub(_gpuDevice)); + _gpuSemaphorePool = CC_NEW(CCVKGPUSemaphorePool(_gpuDevice)); + _gpuBarrierManager = CC_NEW(CCVKGPUBarrierManager(_gpuDevice)); _gpuDescriptorSetHub = CC_NEW(CCVKGPUDescriptorSetHub(_gpuDevice)); _gpuDescriptorHub->link(_gpuDescriptorSetHub); - CommandBufferInfo cmdBuffInfo; - cmdBuffInfo.type = CommandBufferType::PRIMARY; - cmdBuffInfo.queue = _queue; - _cmdBuff = createCommandBuffer(cmdBuffInfo); - - CCVKCmdFuncCreateSampler(this, &_gpuDevice->defaultSampler); + cmdFuncCCVKCreateSampler(this, &_gpuDevice->defaultSampler); _gpuDevice->defaultTexture.format = Format::RGBA8; - _gpuDevice->defaultTexture.usage = TextureUsageBit::SAMPLED; - _gpuDevice->defaultTexture.width = _gpuDevice->defaultTexture.height = 1u; - _gpuDevice->defaultTexture.size = FormatSize(Format::RGBA8, 1u, 1u, 1u); - CCVKCmdFuncCreateTexture(this, &_gpuDevice->defaultTexture); + _gpuDevice->defaultTexture.usage = TextureUsageBit::SAMPLED; + _gpuDevice->defaultTexture.width = _gpuDevice->defaultTexture.height = 1U; + _gpuDevice->defaultTexture.size = formatSize(Format::RGBA8, 1U, 1U, 1U); + cmdFuncCCVKCreateTexture(this, &_gpuDevice->defaultTexture); _gpuDevice->defaultTextureView.gpuTexture = &_gpuDevice->defaultTexture; - _gpuDevice->defaultTextureView.format = Format::RGBA8; - CCVKCmdFuncCreateTextureView(this, &_gpuDevice->defaultTextureView); + _gpuDevice->defaultTextureView.format = Format::RGBA8; + cmdFuncCCVKCreateTextureView(this, &_gpuDevice->defaultTextureView); - _gpuDevice->defaultBuffer.usage = BufferUsage::UNIFORM; + ThsvsImageBarrier barrier{}; + barrier.nextAccessCount = 1; + barrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::VERTEX_SHADER_READ_TEXTURE)]; + barrier.image = _gpuDevice->defaultTexture.vkImage; + barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; + barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + gpuTransportHub()->checkIn( + [&barrier](const CCVKGPUCommandBuffer *gpuCommandBuffer) { + cmdFuncCCVKImageMemoryBarrier(gpuCommandBuffer, barrier); + }); + + _gpuDevice->defaultBuffer.usage = BufferUsage::UNIFORM; _gpuDevice->defaultBuffer.memUsage = MemoryUsage::HOST | MemoryUsage::DEVICE; - _gpuDevice->defaultBuffer.size = _gpuDevice->defaultBuffer.stride = 16u; - _gpuDevice->defaultBuffer.count = 1u; - CCVKCmdFuncCreateBuffer(this, &_gpuDevice->defaultBuffer); + _gpuDevice->defaultBuffer.size = _gpuDevice->defaultBuffer.stride = 16U; + _gpuDevice->defaultBuffer.count = 1U; + cmdFuncCCVKCreateBuffer(this, &_gpuDevice->defaultBuffer); VkPipelineCacheCreateInfo pipelineCacheInfo{VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO}; VK_CHECK(vkCreatePipelineCache(_gpuDevice->vkDevice, &pipelineCacheInfo, nullptr, &_gpuDevice->vkPipelineCache)); - for (uint i = 0u; i < gpuContext->swapchainCreateInfo.minImageCount; i++) { + for (uint i = 0U; i < gpuContext->swapchainCreateInfo.minImageCount; i++) { TextureInfo depthStencilTexInfo; - depthStencilTexInfo.type = TextureType::TEX2D; - depthStencilTexInfo.usage = TextureUsageBit::DEPTH_STENCIL_ATTACHMENT | TextureUsageBit::SAMPLED; + depthStencilTexInfo.type = TextureType::TEX2D; + depthStencilTexInfo.usage = TextureUsageBit::DEPTH_STENCIL_ATTACHMENT; depthStencilTexInfo.format = _context->getDepthStencilFormat(); - depthStencilTexInfo.width = _width; + depthStencilTexInfo.width = _width; depthStencilTexInfo.height = _height; - CCVKTexture *texture = (CCVKTexture *)createTexture(depthStencilTexInfo); + auto *texture = static_cast(createTexture(depthStencilTexInfo)); _depthStencilTextures.push_back(texture); } @@ -346,11 +402,14 @@ bool CCVKDevice::initialize(const DeviceInfo &info) { ///////////////////// Print Debug Info ///////////////////// - String instanceLayers, instanceExtensions, deviceLayers, deviceExtensions; - for (const char *layer : ((CCVKContext *)_context)->getLayers()) { + String instanceLayers; + String instanceExtensions; + String deviceLayers; + String deviceExtensions; + for (const char *layer : static_cast(_context)->getLayers()) { instanceLayers += layer + String(" "); } - for (const char *extension : ((CCVKContext *)_context)->getExtensions()) { + for (const char *extension : static_cast(_context)->getExtensions()) { instanceExtensions += extension + String(" "); } for (const char *layer : _layers) { @@ -361,9 +420,9 @@ bool CCVKDevice::initialize(const DeviceInfo &info) { } uint32_t apiVersion = gpuContext->physicalDeviceProperties.apiVersion; - _renderer = gpuContext->physicalDeviceProperties.deviceName; - _vendor = MapVendorName(gpuContext->physicalDeviceProperties.vendorID); - _version = StringUtil::Format("%d.%d.%d", VK_VERSION_MAJOR(apiVersion), + _renderer = gpuContext->physicalDeviceProperties.deviceName; + _vendor = mapVendorName(gpuContext->physicalDeviceProperties.vendorID); + _version = StringUtil::format("%d.%d.%d", VK_VERSION_MAJOR(apiVersion), VK_VERSION_MINOR(apiVersion), VK_VERSION_PATCH(apiVersion)); CC_LOG_INFO("Vulkan device initialized."); @@ -382,32 +441,33 @@ bool CCVKDevice::initialize(const DeviceInfo &info) { return true; } -void CCVKDevice::destroy() { +void CCVKDevice::doDestroy() { if (_gpuDevice && _gpuDevice->vkDevice) { VK_CHECK(vkDeviceWaitIdle(_gpuDevice->vkDevice)); } for (CCVKTexture *texture : _depthStencilTextures) { - CC_SAFE_DESTROY(texture); + CC_SAFE_DESTROY(texture) } _depthStencilTextures.clear(); - CC_SAFE_DESTROY(_queue); - CC_SAFE_DESTROY(_cmdBuff); + CC_SAFE_DESTROY(_queue) + CC_SAFE_DESTROY(_cmdBuff) - CC_SAFE_DELETE(_gpuBufferHub); - CC_SAFE_DELETE(_gpuTransportHub); - CC_SAFE_DELETE(_gpuSemaphorePool); - CC_SAFE_DELETE(_gpuDescriptorHub); - CC_SAFE_DELETE(_gpuDescriptorSetHub); + CC_SAFE_DELETE(_gpuBufferHub) + CC_SAFE_DELETE(_gpuTransportHub) + CC_SAFE_DELETE(_gpuSemaphorePool) + CC_SAFE_DELETE(_gpuDescriptorHub) + CC_SAFE_DELETE(_gpuBarrierManager) + CC_SAFE_DELETE(_gpuDescriptorSetHub) - uint backBufferCount = ((CCVKContext *)_context)->gpuContext()->swapchainCreateInfo.minImageCount; - for (uint i = 0u; i < backBufferCount; i++) { + uint backBufferCount = static_cast(_context)->gpuContext()->swapchainCreateInfo.minImageCount; + for (uint i = 0U; i < backBufferCount; i++) { _gpuRecycleBins[i]->clear(); - CC_SAFE_DELETE(_gpuStagingBufferPools[i]); - CC_SAFE_DELETE(_gpuRecycleBins[i]); - CC_SAFE_DELETE(_gpuFencePools[i]); + CC_SAFE_DELETE(_gpuStagingBufferPools[i]) + CC_SAFE_DELETE(_gpuRecycleBins[i]) + CC_SAFE_DELETE(_gpuFencePools[i]) } _gpuStagingBufferPools.clear(); _gpuRecycleBins.clear(); @@ -427,7 +487,7 @@ void CCVKDevice::destroy() { if (_gpuDevice->defaultBuffer.vkBuffer) { vmaDestroyBuffer(_gpuDevice->memoryAllocator, _gpuDevice->defaultBuffer.vkBuffer, _gpuDevice->defaultBuffer.vmaAllocation); - _gpuDevice->defaultBuffer.vkBuffer = VK_NULL_HANDLE; + _gpuDevice->defaultBuffer.vkBuffer = VK_NULL_HANDLE; _gpuDevice->defaultBuffer.vmaAllocation = VK_NULL_HANDLE; } if (_gpuDevice->defaultTextureView.vkImageView) { @@ -436,10 +496,10 @@ void CCVKDevice::destroy() { } if (_gpuDevice->defaultTexture.vkImage) { vmaDestroyImage(_gpuDevice->memoryAllocator, _gpuDevice->defaultTexture.vkImage, _gpuDevice->defaultTexture.vmaAllocation); - _gpuDevice->defaultTexture.vkImage = VK_NULL_HANDLE; + _gpuDevice->defaultTexture.vkImage = VK_NULL_HANDLE; _gpuDevice->defaultTexture.vmaAllocation = VK_NULL_HANDLE; } - CCVKCmdFuncDestroySampler(_gpuDevice, &_gpuDevice->defaultSampler); + cmdFuncCCVKDestroySampler(_gpuDevice, &_gpuDevice->defaultSampler); if (_gpuDevice->memoryAllocator != VK_NULL_HANDLE) { VmaStats stats; @@ -450,11 +510,12 @@ void CCVKDevice::destroy() { _gpuDevice->memoryAllocator = VK_NULL_HANDLE; } - for (CCVKGPUDevice::CommandBufferPools::iterator it = _gpuDevice->commandBufferPools.begin(); - it != _gpuDevice->commandBufferPools.end(); ++it) { - CC_SAFE_DELETE(it->second); + for (CCVKGPUDevice::CommandBufferPools::iterator it = _gpuDevice->_commandBufferPools.begin(); + it != _gpuDevice->_commandBufferPools.end(); ++it) { + CC_SAFE_DELETE(it->second) } - _gpuDevice->commandBufferPools.clear(); + _gpuDevice->_commandBufferPools.clear(); + _gpuDevice->_descriptorSetPools.clear(); if (_gpuDevice->vkDevice != VK_NULL_HANDLE) { vkDestroyDevice(_gpuDevice->vkDevice, nullptr); @@ -465,39 +526,41 @@ void CCVKDevice::destroy() { _gpuDevice = nullptr; } - CC_SAFE_DESTROY(_context); + CC_SAFE_DESTROY(_context) } -// op-op since we maintain surface size internally +// no-op since we maintain surface size internally void CCVKDevice::resize(uint width, uint height) {} void CCVKDevice::acquire() { - CCVKQueue *queue = (CCVKQueue *)_queue; + auto *queue = static_cast(_queue); if (!checkSwapchainStatus()) return; - queue->_numDrawCalls = 0; - queue->_numInstances = 0; - queue->_numTriangles = 0; - queue->gpuQueue()->nextWaitSemaphore = VK_NULL_HANDLE; + queue->_numDrawCalls = 0; + queue->_numInstances = 0; + queue->_numTriangles = 0; + queue->gpuQueue()->nextWaitSemaphore = VK_NULL_HANDLE; queue->gpuQueue()->nextSignalSemaphore = VK_NULL_HANDLE; - _gpuBufferHub->flush(); + _gpuBufferHub->flush(gpuTransportHub()); _gpuDescriptorSetHub->flush(); _gpuSemaphorePool->reset(); VkSemaphore acquireSemaphore = _gpuSemaphorePool->alloc(); - VK_CHECK(vkAcquireNextImageKHR(_gpuDevice->vkDevice, _gpuSwapchain->vkSwapchain, ~0ull, + VK_CHECK(vkAcquireNextImageKHR(_gpuDevice->vkDevice, _gpuSwapchain->vkSwapchain, ~0ULL, acquireSemaphore, VK_NULL_HANDLE, &_gpuSwapchain->curImageIndex)); - assert(_gpuDevice->curBackBufferIndex == _gpuSwapchain->curImageIndex); +#if !defined(VK_USE_PLATFORM_METAL_EXT) + assert(_gpuDevice->curBackBufferIndex == _gpuSwapchain->curImageIndex); // MoltenVK seems to be not consistent +#endif // defined(VK_USE_PLATFORM_METAL_EXT) - queue->gpuQueue()->nextWaitSemaphore = acquireSemaphore; + queue->gpuQueue()->nextWaitSemaphore = acquireSemaphore; queue->gpuQueue()->nextSignalSemaphore = _gpuSemaphorePool->alloc(); } void CCVKDevice::present() { - CCVKQueue *queue = (CCVKQueue *)_queue; + auto *queue = static_cast(_queue); _numDrawCalls = queue->_numDrawCalls; _numInstances = queue->_numInstances; _numTriangles = queue->_numTriangles; @@ -505,10 +568,10 @@ void CCVKDevice::present() { if (queue->gpuQueue()->nextWaitSemaphore) { // don't present if not acquired VkPresentInfoKHR presentInfo{VK_STRUCTURE_TYPE_PRESENT_INFO_KHR}; presentInfo.waitSemaphoreCount = 1; - presentInfo.pWaitSemaphores = &queue->gpuQueue()->nextWaitSemaphore; - presentInfo.swapchainCount = 1; - presentInfo.pSwapchains = &_gpuSwapchain->vkSwapchain; - presentInfo.pImageIndices = &_gpuSwapchain->curImageIndex; + presentInfo.pWaitSemaphores = &queue->gpuQueue()->nextWaitSemaphore; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = &_gpuSwapchain->vkSwapchain; + presentInfo.pImageIndices = &_gpuSwapchain->curImageIndex; VkResult res = vkQueuePresentKHR(queue->gpuQueue()->vkQueue, &presentInfo); #ifndef DISABLE_PRE_TRANSFORM @@ -529,79 +592,83 @@ void CCVKDevice::present() { } } -CCVKGPUFencePool *CCVKDevice::gpuFencePool() { return _gpuFencePools[_gpuDevice->curBackBufferIndex]; } -CCVKGPURecycleBin *CCVKDevice::gpuRecycleBin() { return _gpuRecycleBins[_gpuDevice->curBackBufferIndex]; } +CCVKGPUFencePool * CCVKDevice::gpuFencePool() { return _gpuFencePools[_gpuDevice->curBackBufferIndex]; } +CCVKGPURecycleBin * CCVKDevice::gpuRecycleBin() { return _gpuRecycleBins[_gpuDevice->curBackBufferIndex]; } CCVKGPUStagingBufferPool *CCVKDevice::gpuStagingBufferPool() { return _gpuStagingBufferPools[_gpuDevice->curBackBufferIndex]; } -CommandBuffer *CCVKDevice::doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) { - return CC_NEW(CCVKCommandBuffer(this)); -} - -Fence *CCVKDevice::createFence() { - return CC_NEW(CCVKFence(this)); +CommandBuffer *CCVKDevice::createCommandBuffer(const CommandBufferInfo & /*info*/, bool /*hasAgent*/) { + return CC_NEW(CCVKCommandBuffer); } Queue *CCVKDevice::createQueue() { - return CC_NEW(CCVKQueue(this)); + return CC_NEW(CCVKQueue); } Buffer *CCVKDevice::createBuffer() { - return CC_NEW(CCVKBuffer(this)); + return CC_NEW(CCVKBuffer); } Texture *CCVKDevice::createTexture() { - return CC_NEW(CCVKTexture(this)); + return CC_NEW(CCVKTexture); } Sampler *CCVKDevice::createSampler() { - return CC_NEW(CCVKSampler(this)); + return CC_NEW(CCVKSampler); } Shader *CCVKDevice::createShader() { - return CC_NEW(CCVKShader(this)); + return CC_NEW(CCVKShader); } InputAssembler *CCVKDevice::createInputAssembler() { - return CC_NEW(CCVKInputAssembler(this)); + return CC_NEW(CCVKInputAssembler); } RenderPass *CCVKDevice::createRenderPass() { - return CC_NEW(CCVKRenderPass(this)); + return CC_NEW(CCVKRenderPass); } Framebuffer *CCVKDevice::createFramebuffer() { - return CC_NEW(CCVKFramebuffer(this)); + return CC_NEW(CCVKFramebuffer); } DescriptorSet *CCVKDevice::createDescriptorSet() { - return CC_NEW(CCVKDescriptorSet(this)); + return CC_NEW(CCVKDescriptorSet); } DescriptorSetLayout *CCVKDevice::createDescriptorSetLayout() { - return CC_NEW(CCVKDescriptorSetLayout(this)); + return CC_NEW(CCVKDescriptorSetLayout); } PipelineLayout *CCVKDevice::createPipelineLayout() { - return CC_NEW(CCVKPipelineLayout(this)); + return CC_NEW(CCVKPipelineLayout); } PipelineState *CCVKDevice::createPipelineState() { - return CC_NEW(CCVKPipelineState(this)); + return CC_NEW(CCVKPipelineState); +} + +GlobalBarrier *CCVKDevice::createGlobalBarrier() { + return CC_NEW(CCVKGlobalBarrier); +} + +TextureBarrier *CCVKDevice::createTextureBarrier() { + return CC_NEW(CCVKTextureBarrier); } void CCVKDevice::copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) { - _cmdBuff->begin(); - const CCVKGPUCommandBuffer *gpuCommandBuffer = ((CCVKCommandBuffer *)_cmdBuff)->gpuCommandBuffer(); - CCVKCmdFuncCopyBuffersToTexture(this, buffers, ((CCVKTexture *)dst)->gpuTexture(), regions, count, gpuCommandBuffer); + gpuTransportHub()->checkIn([this, buffers, dst, regions, count](CCVKGPUCommandBuffer *gpuCommandBuffer) { + cmdFuncCCVKCopyBuffersToTexture(this, buffers, static_cast(dst)->gpuTexture(), regions, count, gpuCommandBuffer); + }); } bool CCVKDevice::checkSwapchainStatus() { - CCVKGPUContext *context = ((CCVKContext *)_context)->gpuContext(); + CCVKGPUContext *context = static_cast(_context)->gpuContext(); VkSurfaceCapabilitiesKHR surfaceCapabilities; VK_CHECK(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(context->physicalDevice, context->vkSurface, &surfaceCapabilities)); - uint newWidth = surfaceCapabilities.currentExtent.width; + uint newWidth = surfaceCapabilities.currentExtent.width; uint newHeight = surfaceCapabilities.currentExtent.height; VkSurfaceTransformFlagBitsKHR preTransform = surfaceCapabilities.currentTransform; @@ -611,7 +678,7 @@ bool CCVKDevice::checkSwapchainStatus() { if (preTransform & TRANSFORMS_THAT_REQUIRE_FLIPPING) { newHeight = surfaceCapabilities.currentExtent.width; - newWidth = surfaceCapabilities.currentExtent.height; + newWidth = surfaceCapabilities.currentExtent.height; } if (context->swapchainCreateInfo.preTransform == preTransform && @@ -620,8 +687,8 @@ bool CCVKDevice::checkSwapchainStatus() { return true; } - if (newWidth == (uint)-1) { - context->swapchainCreateInfo.imageExtent.width = _width; + if (newWidth == static_cast(-1)) { + context->swapchainCreateInfo.imageExtent.width = _width; context->swapchainCreateInfo.imageExtent.height = _height; } else { _nativeWidth = _width = context->swapchainCreateInfo.imageExtent.width = newWidth; @@ -632,9 +699,9 @@ bool CCVKDevice::checkSwapchainStatus() { return _swapchainReady = false; } - _transform = MapSurfaceTransform(preTransform); + _transform = mapSurfaceTransform(preTransform); context->swapchainCreateInfo.preTransform = preTransform; - context->swapchainCreateInfo.surface = context->vkSurface; + context->swapchainCreateInfo.surface = context->vkSurface; context->swapchainCreateInfo.oldSwapchain = _gpuSwapchain->vkSwapchain; CC_LOG_INFO("Resizing surface: %dx%d, surface rotation: %d degrees", newWidth, newHeight, (uint)_transform * 90); @@ -642,11 +709,13 @@ bool CCVKDevice::checkSwapchainStatus() { VkSwapchainKHR vkSwapchain = VK_NULL_HANDLE; VK_CHECK(vkCreateSwapchainKHR(_gpuDevice->vkDevice, &context->swapchainCreateInfo, nullptr, &vkSwapchain)); + VK_CHECK(vkDeviceWaitIdle(_gpuDevice->vkDevice)); + destroySwapchain(); - _gpuDevice->curBackBufferIndex = 0u; - _gpuSwapchain->curImageIndex = 0; - _gpuSwapchain->vkSwapchain = vkSwapchain; + _gpuDevice->curBackBufferIndex = 0U; + _gpuSwapchain->curImageIndex = 0; + _gpuSwapchain->vkSwapchain = vkSwapchain; uint imageCount; VK_CHECK(vkGetSwapchainImagesKHR(_gpuDevice->vkDevice, _gpuSwapchain->vkSwapchain, &imageCount, nullptr)); @@ -655,15 +724,15 @@ bool CCVKDevice::checkSwapchainStatus() { assert(imageCount == context->swapchainCreateInfo.minImageCount); // assert if swapchain image count assumption is broken _gpuSwapchain->vkSwapchainImageViews.resize(imageCount); - for (uint i = 0u; i < imageCount; i++) { + for (uint i = 0U; i < imageCount; i++) { _depthStencilTextures[i]->resize(_width, _height); - _gpuSwapchain->depthStencilImages.push_back(((CCVKTexture *)_depthStencilTextures[i])->gpuTexture()->vkImage); - _gpuSwapchain->depthStencilImageViews.push_back(((CCVKTexture *)_depthStencilTextures[i])->gpuTextureView()->vkImageView); + _gpuSwapchain->depthStencilImages.push_back(static_cast(_depthStencilTextures[i])->gpuTexture()->vkImage); + _gpuSwapchain->depthStencilImageViews.push_back(static_cast(_depthStencilTextures[i])->gpuTextureView()->vkImageView); VkImageViewCreateInfo imageViewCreateInfo{VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO}; - imageViewCreateInfo.image = _gpuSwapchain->swapchainImages[i]; - imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; - imageViewCreateInfo.format = context->swapchainCreateInfo.imageFormat; + imageViewCreateInfo.image = _gpuSwapchain->swapchainImages[i]; + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; + imageViewCreateInfo.format = context->swapchainCreateInfo.imageFormat; imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; imageViewCreateInfo.subresourceRange.levelCount = 1; imageViewCreateInfo.subresourceRange.layerCount = 1; @@ -671,43 +740,45 @@ bool CCVKDevice::checkSwapchainStatus() { VK_CHECK(vkCreateImageView(_gpuDevice->vkDevice, &imageViewCreateInfo, nullptr, &_gpuSwapchain->vkSwapchainImageViews[i])); } - bool hasStencil = GFX_FORMAT_INFOS[(uint)_context->getDepthStencilFormat()].hasStencil; - vector barriers(imageCount * 2, {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}); - for (uint i = 0u; i < imageCount; i++) { - barriers[i].image = _gpuSwapchain->swapchainImages[i]; - barriers[i].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[i].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[i].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[i].subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; - barriers[i].subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; - barriers[i].srcAccessMask = 0; - barriers[i].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - barriers[i].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - barriers[i].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + bool hasStencil = GFX_FORMAT_INFOS[static_cast(_context->getDepthStencilFormat())].hasStencil; + vector barriers(imageCount * 2, VkImageMemoryBarrier{}); + VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + ThsvsImageBarrier tempBarrier{}; + tempBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + tempBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + tempBarrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; + tempBarrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + for (uint i = 0U; i < imageCount; i++) { + tempBarrier.nextAccessCount = 1; + tempBarrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::COLOR_ATTACHMENT_WRITE)]; + tempBarrier.image = _gpuSwapchain->swapchainImages[i]; + tempBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + thsvsGetVulkanImageMemoryBarrier(tempBarrier, &tempSrcStageMask, &tempDstStageMask, &barriers[i]); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; - barriers[imageCount + i].image = _gpuSwapchain->depthStencilImages[i]; - barriers[imageCount + i].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[imageCount + i].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[imageCount + i].subresourceRange.aspectMask = hasStencil ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; - barriers[imageCount + i].subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; - barriers[imageCount + i].subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; - barriers[imageCount + i].srcAccessMask = 0; - barriers[imageCount + i].dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; - barriers[imageCount + i].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - barriers[imageCount + i].newLayout = hasStencil ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL; + tempBarrier.nextAccessCount = 1; + tempBarrier.pNextAccesses = &THSVS_ACCESS_TYPES[static_cast(AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE)]; + tempBarrier.image = _gpuSwapchain->depthStencilImages[i]; + tempBarrier.subresourceRange.aspectMask = hasStencil ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT; + thsvsGetVulkanImageMemoryBarrier(tempBarrier, &tempSrcStageMask, &tempDstStageMask, &barriers[imageCount + i]); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; } gpuTransportHub()->checkIn( - [&](const CCVKGPUCommandBuffer *cmdBuff) { - vkCmdPipelineBarrier(cmdBuff->vkCommandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, imageCount, barriers.data()); - vkCmdPipelineBarrier(cmdBuff->vkCommandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT, - VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, imageCount, barriers.data() + imageCount); + [&](const CCVKGPUCommandBuffer *gpuCommandBuffer) { + vkCmdPipelineBarrier(gpuCommandBuffer->vkCommandBuffer, srcStageMask, dstStageMask, 0, 0, nullptr, 0, nullptr, imageCount, barriers.data()); }, true); // submit immediately - for (FramebufferListMapIter it = _gpuSwapchain->vkSwapchainFramebufferListMap.begin(); - it != _gpuSwapchain->vkSwapchainFramebufferListMap.end(); it++) { - CCVKCmdFuncCreateFramebuffer(this, it->first); + _gpuSwapchain->swapchainImageAccessTypes.assign(imageCount, {THSVS_ACCESS_PRESENT}); + _gpuSwapchain->depthStencilImageAccessTypes.assign(imageCount, {THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ}); + + for (auto &it : _gpuSwapchain->vkSwapchainFramebufferListMap) { + cmdFuncCCVKCreateFramebuffer(this, it.first); } return _swapchainReady = true; @@ -715,12 +786,14 @@ bool CCVKDevice::checkSwapchainStatus() { void CCVKDevice::destroySwapchain() { if (_gpuSwapchain->vkSwapchain != VK_NULL_HANDLE) { + _gpuSwapchain->swapchainImageAccessTypes.clear(); + _gpuSwapchain->depthStencilImageAccessTypes.clear(); + _gpuSwapchain->depthStencilImageViews.clear(); _gpuSwapchain->depthStencilImages.clear(); - for (FramebufferListMapIter it = _gpuSwapchain->vkSwapchainFramebufferListMap.begin(); - it != _gpuSwapchain->vkSwapchainFramebufferListMap.end(); it++) { - FramebufferList &list = it->second; + for (auto &it : _gpuSwapchain->vkSwapchainFramebufferListMap) { + FramebufferList &list = it.second; for (VkFramebuffer framebuffer : list) { vkDestroyFramebuffer(_gpuDevice->vkDevice, framebuffer, nullptr); } @@ -738,5 +811,13 @@ void CCVKDevice::destroySwapchain() { } } +void CCVKDevice::releaseSurface(uintptr_t windowHandle) { + static_cast(_context)->releaseSurface(windowHandle); +} + +void CCVKDevice::acquireSurface(uintptr_t windowHandle) { + static_cast(_context)->acquireSurface(windowHandle); +} + } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKDevice.h b/native/cocos/renderer/gfx-vulkan/VKDevice.h index 997d32acf1..334b6a24e6 100644 --- a/native/cocos/renderer/gfx-vulkan/VKDevice.h +++ b/native/cocos/renderer/gfx-vulkan/VKDevice.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_DEVICE_H_ -#define CC_GFXVULKAN_DEVICE_H_ + +#pragma once + +#include "VKStd.h" +#include "gfx-base/GFXDevice.h" namespace cc { namespace gfx { @@ -37,6 +41,7 @@ class CCVKGPUBufferHub; class CCVKGPUTransportHub; class CCVKGPUDescriptorHub; class CCVKGPUSemaphorePool; +class CCVKGPUBarrierManager; class CCVKGPUDescriptorSetHub; class CCVKGPUFencePool; @@ -45,8 +50,9 @@ class CCVKGPUStagingBufferPool; class CC_VULKAN_API CCVKDevice final : public Device { public: - CCVKDevice(); - ~CCVKDevice(); + static CCVKDevice *getInstance(); + + ~CCVKDevice() override; friend class CCVKContext; using Device::copyBuffersToTexture; @@ -54,8 +60,8 @@ public: using Device::createCommandBuffer; using Device::createDescriptorSet; using Device::createDescriptorSetLayout; - using Device::createFence; using Device::createFramebuffer; + using Device::createGlobalBarrier; using Device::createInputAssembler; using Device::createPipelineLayout; using Device::createPipelineState; @@ -64,66 +70,79 @@ public: using Device::createSampler; using Device::createShader; using Device::createTexture; + using Device::createTextureBarrier; - virtual bool initialize(const DeviceInfo &info) override; - virtual void destroy() override; - virtual void resize(uint width, uint height) override; - virtual void acquire() override; - virtual void present() override; - CC_INLINE bool checkExtension(const String &extension) const { - return std::find_if(_extensions.begin(), _extensions.end(), - [extension](const char *device_extension) { - return std::strcmp(device_extension, extension.c_str()) == 0; - }) != _extensions.end(); + void resize(uint width, uint height) override; + void acquire() override; + void present() override; + + inline bool checkExtension(const String &extension) const { + return std::any_of(_extensions.begin(), _extensions.end(), [&extension](auto &ext) { + return std::strcmp(ext, extension.c_str()) == 0; + }); } - CCVKGPUContext *gpuContext() const; - CC_INLINE CCVKGPUDevice *gpuDevice() const { return _gpuDevice; } - CC_INLINE CCVKGPUSwapchain *gpuSwapchain() { return _gpuSwapchain; } + CCVKGPUContext * gpuContext() const; + inline CCVKGPUDevice * gpuDevice() const { return _gpuDevice; } + inline CCVKGPUSwapchain *gpuSwapchain() { return _gpuSwapchain; } - CC_INLINE CCVKGPUBufferHub *gpuBufferHub() { return _gpuBufferHub; } - CC_INLINE CCVKGPUTransportHub *gpuTransportHub() { return _gpuTransportHub; } - CC_INLINE CCVKGPUDescriptorHub *gpuDescriptorHub() { return _gpuDescriptorHub; } - CC_INLINE CCVKGPUSemaphorePool *gpuSemaphorePool() { return _gpuSemaphorePool; } - CC_INLINE CCVKGPUDescriptorSetHub *gpuDescriptorSetHub() { return _gpuDescriptorSetHub; } + inline CCVKGPUBufferHub * gpuBufferHub() { return _gpuBufferHub; } + inline CCVKGPUTransportHub * gpuTransportHub() { return _gpuTransportHub; } + inline CCVKGPUDescriptorHub * gpuDescriptorHub() { return _gpuDescriptorHub; } + inline CCVKGPUSemaphorePool * gpuSemaphorePool() { return _gpuSemaphorePool; } + inline CCVKGPUBarrierManager * gpuBarrierManager() { return _gpuBarrierManager; } + inline CCVKGPUDescriptorSetHub *gpuDescriptorSetHub() { return _gpuDescriptorSetHub; } - CCVKGPUFencePool *gpuFencePool(); - CCVKGPURecycleBin *gpuRecycleBin(); + CCVKGPUFencePool * gpuFencePool(); + CCVKGPURecycleBin * gpuRecycleBin(); CCVKGPUStagingBufferPool *gpuStagingBufferPool(); -private: - virtual CommandBuffer *doCreateCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; - virtual Fence *createFence() override; - virtual Queue *createQueue() override; - virtual Buffer *createBuffer() override; - virtual Texture *createTexture() override; - virtual Sampler *createSampler() override; - virtual Shader *createShader() override; - virtual InputAssembler *createInputAssembler() override; - virtual RenderPass *createRenderPass() override; - virtual Framebuffer *createFramebuffer() override; - virtual DescriptorSet *createDescriptorSet() override; - virtual DescriptorSetLayout *createDescriptorSetLayout() override; - virtual PipelineLayout *createPipelineLayout() override; - virtual PipelineState *createPipelineState() override; - virtual void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; +protected: + static CCVKDevice *instance; + + friend class DeviceManager; + + CCVKDevice(); + + bool doInit(const DeviceInfo &info) override; + void doDestroy() override; + CommandBuffer * createCommandBuffer(const CommandBufferInfo &info, bool hasAgent) override; + Queue * createQueue() override; + Buffer * createBuffer() override; + Texture * createTexture() override; + Sampler * createSampler() override; + Shader * createShader() override; + InputAssembler * createInputAssembler() override; + RenderPass * createRenderPass() override; + Framebuffer * createFramebuffer() override; + DescriptorSet * createDescriptorSet() override; + DescriptorSetLayout *createDescriptorSetLayout() override; + PipelineLayout * createPipelineLayout() override; + PipelineState * createPipelineState() override; + GlobalBarrier * createGlobalBarrier() override; + TextureBarrier * createTextureBarrier() override; + void copyBuffersToTexture(const uint8_t *const *buffers, Texture *dst, const BufferTextureCopy *regions, uint count) override; void destroySwapchain(); bool checkSwapchainStatus(); - CCVKGPUDevice *_gpuDevice = nullptr; - CCVKGPUSwapchain *_gpuSwapchain = nullptr; + void releaseSurface(uintptr_t windowHandle) override; + void acquireSurface(uintptr_t windowHandle) override; + + CCVKGPUDevice * _gpuDevice = nullptr; + CCVKGPUSwapchain * _gpuSwapchain = nullptr; vector _depthStencilTextures; - vector _gpuFencePools; - vector _gpuRecycleBins; + vector _gpuFencePools; + vector _gpuRecycleBins; vector _gpuStagingBufferPools; - CCVKGPUBufferHub *_gpuBufferHub = nullptr; - CCVKGPUTransportHub *_gpuTransportHub = nullptr; - CCVKGPUDescriptorHub *_gpuDescriptorHub = nullptr; - CCVKGPUSemaphorePool *_gpuSemaphorePool = nullptr; + CCVKGPUBufferHub * _gpuBufferHub = nullptr; + CCVKGPUTransportHub * _gpuTransportHub = nullptr; + CCVKGPUDescriptorHub * _gpuDescriptorHub = nullptr; + CCVKGPUSemaphorePool * _gpuSemaphorePool = nullptr; CCVKGPUDescriptorSetHub *_gpuDescriptorSetHub = nullptr; + CCVKGPUBarrierManager * _gpuBarrierManager = nullptr; vector _layers; vector _extensions; @@ -133,5 +152,3 @@ private: } // namespace gfx } // namespace cc - -#endif // CC_GFXVULKAN_DEVICE_H_ diff --git a/native/cocos/renderer/gfx-vulkan/VKFence.cpp b/native/cocos/renderer/gfx-vulkan/VKFence.cpp deleted file mode 100644 index c2917fdb87..0000000000 --- a/native/cocos/renderer/gfx-vulkan/VKFence.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 "VKStd.h" - -#include "VKDevice.h" -#include "VKFence.h" -#include "VKCommands.h" - -namespace cc { -namespace gfx { - -CCVKFence::CCVKFence(Device *device) -: Fence(device) { -} - -CCVKFence::~CCVKFence() { -} - -bool CCVKFence::initialize(const FenceInfo &info) { - _gpuFence = CC_NEW(CCVKGPUFence); - if (!_gpuFence) { - CC_LOG_ERROR("CCVKFence: CC_NEW CCVKGPUFence failed."); - return false; - } - - CCVKCmdFuncCreateFence((CCVKDevice *)_device, _gpuFence); - - return true; -} - -void CCVKFence::destroy() { - if (_gpuFence) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuFence); - _gpuFence = nullptr; - } -} - -// TODO: move these two to device -void CCVKFence::wait() { - VK_CHECK(vkWaitForFences(((CCVKDevice *)_device)->gpuDevice()->vkDevice, 1, &_gpuFence->vkFence, VK_TRUE, DEFAULT_TIMEOUT)); -} - -void CCVKFence::reset() { - VK_CHECK(vkResetFences(((CCVKDevice *)_device)->gpuDevice()->vkDevice, 1, &_gpuFence->vkFence)); -} - -} // namespace gfx -} // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKFence.h b/native/cocos/renderer/gfx-vulkan/VKFence.h deleted file mode 100644 index 503f099bff..0000000000 --- a/native/cocos/renderer/gfx-vulkan/VKFence.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 CC_GFXVULKAN_FENCE_H_ -#define CC_GFXVULKAN_FENCE_H_ - -namespace cc { -namespace gfx { - -class CCVKGPUFence; - -class CC_VULKAN_API CCVKFence final : public Fence { -public: - CCVKFence(Device *device); - virtual ~CCVKFence() override; - -public: - virtual bool initialize(const FenceInfo &info) override; - virtual void destroy() override; - virtual void wait() override; - virtual void reset() override; - - CC_INLINE CCVKGPUFence *gpuFence() { return _gpuFence; } - -private: - CCVKGPUFence *_gpuFence = nullptr; -}; - -} // namespace gfx -} // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKFramebuffer.cpp b/native/cocos/renderer/gfx-vulkan/VKFramebuffer.cpp index ad9d995f90..470d673eee 100644 --- a/native/cocos/renderer/gfx-vulkan/VKFramebuffer.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKFramebuffer.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommands.h" @@ -32,41 +34,34 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKFramebuffer::CCVKFramebuffer(Device *device) -: Framebuffer(device) { -} +CCVKFramebuffer::CCVKFramebuffer() = default; CCVKFramebuffer::~CCVKFramebuffer() { + destroy(); } -bool CCVKFramebuffer::initialize(const FramebufferInfo &info) { - _renderPass = info.renderPass; - _colorTextures = info.colorTextures; - _depthStencilTexture = info.depthStencilTexture; - - _gpuFBO = CC_NEW(CCVKGPUFramebuffer); - _gpuFBO->gpuRenderPass = ((CCVKRenderPass *)_renderPass)->gpuRenderPass(); +void CCVKFramebuffer::doInit(const FramebufferInfo & /*info*/) { + _gpuFBO = CC_NEW(CCVKGPUFramebuffer); + _gpuFBO->gpuRenderPass = static_cast(_renderPass)->gpuRenderPass(); _gpuFBO->gpuColorViews.resize(_colorTextures.size()); for (size_t i = 0; i < _colorTextures.size(); ++i) { - CCVKTexture *colorTex = (CCVKTexture *)_colorTextures[i]; + auto *colorTex = static_cast(_colorTextures[i]); if (colorTex) { _gpuFBO->gpuColorViews[i] = colorTex->gpuTextureView(); } } if (_depthStencilTexture) { - _gpuFBO->gpuDepthStencilView = ((CCVKTexture *)_depthStencilTexture)->gpuTextureView(); + _gpuFBO->gpuDepthStencilView = static_cast(_depthStencilTexture)->gpuTextureView(); } - CCVKCmdFuncCreateFramebuffer((CCVKDevice *)_device, _gpuFBO); - - return true; + cmdFuncCCVKCreateFramebuffer(CCVKDevice::getInstance(), _gpuFBO); } -void CCVKFramebuffer::destroy() { +void CCVKFramebuffer::doDestroy() { if (_gpuFBO) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuFBO); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuFBO); _gpuFBO = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h b/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h index 92e13ac58f..8dca815263 100644 --- a/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h +++ b/native/cocos/renderer/gfx-vulkan/VKFramebuffer.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_FRAMEBUFFER_H_ -#define CC_GFXVULKAN_FRAMEBUFFER_H_ + +#pragma once + +#include "gfx-base/GFXFramebuffer.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class CCVKGPUFramebuffer; class CC_VULKAN_API CCVKFramebuffer final : public Framebuffer { public: - CCVKFramebuffer(Device *device); - ~CCVKFramebuffer(); - -public: - bool initialize(const FramebufferInfo &info); - void destroy(); + CCVKFramebuffer(); + ~CCVKFramebuffer() override; CC_INLINE CCVKGPUFramebuffer *gpuFBO() const { return _gpuFBO; } -private: +protected: + void doInit(const FramebufferInfo &info) override; + void doDestroy() override; + CCVKGPUFramebuffer *_gpuFBO = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h b/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h index e56bccb956..625b6d4297 100644 --- a/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h +++ b/native/cocos/renderer/gfx-vulkan/VKGPUObjects.h @@ -1,117 +1,142 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_GPU_OBJECTS_H_ -#define CC_GFXVULKAN_GPU_OBJECTS_H_ +#pragma once + +#include +#include + +#include "base/CachedArray.h" + +#include "VKStd.h" #include "VKUtils.h" +#define TBB_USE_EXCEPTIONS 0 // no-rtti for now +#include "tbb/concurrent_unordered_map.h" + namespace cc { namespace gfx { class CCVKGPUContext final : public Object { public: - VkInstance vkInstance = VK_NULL_HANDLE; + VkInstance vkInstance = VK_NULL_HANDLE; VkDebugUtilsMessengerEXT vkDebugUtilsMessenger = VK_NULL_HANDLE; - VkDebugReportCallbackEXT vkDebugReport = VK_NULL_HANDLE; + VkDebugReportCallbackEXT vkDebugReport = VK_NULL_HANDLE; - VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; - VkPhysicalDeviceFeatures physicalDeviceFeatures{}; - VkPhysicalDeviceFeatures2 physicalDeviceFeatures2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; + VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; + VkPhysicalDeviceFeatures physicalDeviceFeatures{}; + VkPhysicalDeviceFeatures2 physicalDeviceFeatures2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; VkPhysicalDeviceVulkan11Features physicalDeviceVulkan11Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; VkPhysicalDeviceVulkan12Features physicalDeviceVulkan12Features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; - VkPhysicalDeviceProperties physicalDeviceProperties{}; - VkPhysicalDeviceProperties2 physicalDeviceProperties2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; + VkPhysicalDeviceProperties physicalDeviceProperties{}; + VkPhysicalDeviceProperties2 physicalDeviceProperties2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; VkPhysicalDeviceMemoryProperties physicalDeviceMemoryProperties{}; - vector queueFamilyProperties; - vector queueFamilyPresentables; + vector queueFamilyProperties; + vector queueFamilyPresentables; VkSurfaceKHR vkSurface = VK_NULL_HANDLE; VkSwapchainCreateInfoKHR swapchainCreateInfo{VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR}; }; + +struct CCVKAccessInfo { + VkPipelineStageFlags stageMask; + VkAccessFlags accessMask; + VkImageLayout imageLayout; + bool hasWriteAccess; +}; + class CCVKGPURenderPass final : public Object { public: - ColorAttachmentList colorAttachments; + ColorAttachmentList colorAttachments; DepthStencilAttachment depthStencilAttachment; - SubPassInfoList subPasses; + SubpassInfoList subpasses; + SubpassDependencyList dependencies; + + // per attachment + vector> beginAccesses; + vector> endAccesses; + VkRenderPass vkRenderPass; + + // helper storage vector clearValues; }; class CCVKGPUTexture final : public Object { public: - TextureType type = TextureType::TEX2D; - Format format = Format::UNKNOWN; - TextureUsage usage = TextureUsageBit::NONE; - uint width = 0u; - uint height = 0u; - uint depth = 1u; - uint size = 0u; - uint arrayLayers = 1u; - uint mipLevels = 1u; - SampleCount samples = SampleCount::X1; - TextureFlags flags = TextureFlagBit::NONE; - bool isPowerOf2 = false; + TextureType type = TextureType::TEX2D; + Format format = Format::UNKNOWN; + TextureUsage usage = TextureUsageBit::NONE; + uint width = 0U; + uint height = 0U; + uint depth = 1U; + uint size = 0U; + uint arrayLayers = 1U; + uint mipLevels = 1U; + SampleCount samples = SampleCount::X1; + TextureFlags flags = TextureFlagBit::NONE; + VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - VkImage vkImage = VK_NULL_HANDLE; + VkImage vkImage = VK_NULL_HANDLE; VmaAllocation vmaAllocation = VK_NULL_HANDLE; - VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED; - VkImageLayout currentLayout = VK_IMAGE_LAYOUT_UNDEFINED; - VkAccessFlags accessMask = VK_ACCESS_SHADER_READ_BIT; - VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - VkPipelineStageFlags targetStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; + + vector currentAccessTypes; + + // for barrier manager + vector renderAccessTypes; // gathered from descriptor sets + ThsvsAccessType transferAccess = THSVS_ACCESS_NONE; }; class CCVKGPUTextureView final : public Object { public: CCVKGPUTexture *gpuTexture = nullptr; - TextureType type = TextureType::TEX2D; - Format format = Format::UNKNOWN; - uint baseLevel = 0u; - uint levelCount = 1u; - uint baseLayer = 0u; - uint layerCount = 1u; + TextureType type = TextureType::TEX2D; + Format format = Format::UNKNOWN; + uint baseLevel = 0U; + uint levelCount = 1U; + uint baseLayer = 0U; + uint layerCount = 1U; // descriptor infos VkImageView vkImageView = VK_NULL_HANDLE; }; -typedef vector CCVKGPUTextureViewList; +using CCVKGPUTextureViewList = vector; class CCVKGPUSampler final : public Object { public: - Filter minFilter = Filter::LINEAR; - Filter magFilter = Filter::LINEAR; - Filter mipFilter = Filter::NONE; - Address addressU = Address::WRAP; - Address addressV = Address::WRAP; - Address addressW = Address::WRAP; - uint maxAnisotropy = 16u; - ComparisonFunc cmpFunc = ComparisonFunc::NEVER; - Color borderColor; - uint minLOD = 0u; - uint maxLOD = 1000u; - float mipLODBias = 0.0f; + Filter minFilter = Filter::LINEAR; + Filter magFilter = Filter::LINEAR; + Filter mipFilter = Filter::NONE; + Address addressU = Address::WRAP; + Address addressV = Address::WRAP; + Address addressW = Address::WRAP; + uint maxAnisotropy = 0U; + ComparisonFunc cmpFunc = ComparisonFunc::NEVER; + Color borderColor; + float mipLODBias = 0.0F; // descriptor infos VkSampler vkSampler; @@ -119,145 +144,151 @@ public: class CCVKGPUBuffer final : public Object { public: - BufferUsage usage = BufferUsage::NONE; + BufferUsage usage = BufferUsage::NONE; MemoryUsage memUsage = MemoryUsage::NONE; - uint stride = 0u; - uint count = 0u; - void *buffer = nullptr; + uint stride = 0U; + uint count = 0U; + void * buffer = nullptr; - bool isDrawIndirectByIndex = false; - vector indirectCmds; + bool isDrawIndirectByIndex = false; + vector indirectCmds; vector indexedIndirectCmds; - VkAccessFlags accessMask = VK_ACCESS_SHADER_READ_BIT; - VkPipelineStageFlags targetStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; - - uint8_t *mappedData = nullptr; + uint8_t * mappedData = nullptr; VmaAllocation vmaAllocation = VK_NULL_HANDLE; // descriptor infos - VkBuffer vkBuffer = VK_NULL_HANDLE; - VkDeviceSize startOffset = 0u; - VkDeviceSize size = 0u; + VkBuffer vkBuffer = VK_NULL_HANDLE; + VkDeviceSize startOffset = 0U; + VkDeviceSize size = 0U; - VkDeviceSize instanceSize = 0u; // per-back-buffer instance + VkDeviceSize instanceSize = 0U; // per-back-buffer instance + + // for barrier manager + vector renderAccessTypes; // gathered from descriptor sets + ThsvsAccessType transferAccess = THSVS_ACCESS_NONE; }; -typedef vector CCVKGPUBufferList; +using CCVKGPUBufferList = vector; class CCVKGPUBufferView final : public Object { public: CCVKGPUBuffer *gpuBuffer = nullptr; - uint offset = 0u; - uint range = 0u; + uint offset = 0U; + uint range = 0U; }; class CCVKGPUSwapchain; class CCVKGPUFramebuffer final : public Object { public: - CCVKGPURenderPass *gpuRenderPass = nullptr; + CCVKGPURenderPass * gpuRenderPass = nullptr; CCVKGPUTextureViewList gpuColorViews; - CCVKGPUTextureView *gpuDepthStencilView = nullptr; - VkFramebuffer vkFramebuffer = VK_NULL_HANDLE; - CCVKGPUSwapchain *swapchain = nullptr; - bool isOffscreen = true; + CCVKGPUTextureView * gpuDepthStencilView = nullptr; + VkFramebuffer vkFramebuffer = VK_NULL_HANDLE; + CCVKGPUSwapchain * swapchain = nullptr; + bool isOffscreen = true; }; -typedef vector FramebufferList; -typedef unordered_map FramebufferListMap; -typedef FramebufferListMap::iterator FramebufferListMapIter; +using FramebufferList = vector; +using FramebufferListMap = unordered_map; +using FramebufferListMapIter = FramebufferListMap::iterator; class CCVKGPUSwapchain final : public Object { public: - uint curImageIndex = 0u; - VkSwapchainKHR vkSwapchain = VK_NULL_HANDLE; - vector vkSwapchainImageViews; - FramebufferListMap vkSwapchainFramebufferListMap; + uint curImageIndex = 0U; + VkSwapchainKHR vkSwapchain = VK_NULL_HANDLE; + vector vkSwapchainImageViews; + FramebufferListMap vkSwapchainFramebufferListMap; + vector> swapchainImageAccessTypes; + vector> depthStencilImageAccessTypes; // external references - vector swapchainImages; - vector depthStencilImages; + vector swapchainImages; + vector depthStencilImages; vector depthStencilImageViews; }; class CCVKGPUCommandBuffer final : public Object { public: - VkCommandBuffer vkCommandBuffer = VK_NULL_HANDLE; - VkCommandBufferLevel level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; - uint queueFamilyIndex = 0u; - bool began = false; - + VkCommandBuffer vkCommandBuffer = VK_NULL_HANDLE; + VkCommandBufferLevel level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + uint queueFamilyIndex = 0U; + bool began = false; mutable unordered_set recordedBuffers; }; class CCVKGPUQueue final : public Object { public: - QueueType type = QueueType::GRAPHICS; - VkQueue vkQueue = VK_NULL_HANDLE; - uint queueFamilyIndex = 0u; - VkSemaphore nextWaitSemaphore = VK_NULL_HANDLE; - VkSemaphore nextSignalSemaphore = VK_NULL_HANDLE; - VkPipelineStageFlags submitStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + QueueType type = QueueType::GRAPHICS; + VkQueue vkQueue = VK_NULL_HANDLE; + uint queueFamilyIndex = 0U; + VkSemaphore nextWaitSemaphore = VK_NULL_HANDLE; + VkSemaphore nextSignalSemaphore = VK_NULL_HANDLE; + VkPipelineStageFlags submitStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; CachedArray commandBuffers; }; struct CCVKGPUShaderStage { CCVKGPUShaderStage(ShaderStageFlagBit t, String s) - : type(t), source(s) { + : type(t), + source(std::move(s)) { } - ShaderStageFlagBit type; - String source; - VkShaderModule vkShader = VK_NULL_HANDLE; + ShaderStageFlagBit type = ShaderStageFlagBit::NONE; + String source; + VkShaderModule vkShader = VK_NULL_HANDLE; }; -typedef vector CCVKGPUShaderStageList; +using CCVKGPUShaderStageList = vector; class CCVKGPUShader final : public Object { public: - String name; - AttributeList attributes; - UniformBlockList blocks; - UniformSamplerList samplers; + String name; + AttributeList attributes; + UniformBlockList blocks; + UniformSamplerList samplers; CCVKGPUShaderStageList gpuStages; }; class CCVKGPUInputAssembler final : public Object { public: - AttributeList attributes; - CCVKGPUBufferList gpuVertexBuffers; - CCVKGPUBuffer *gpuIndexBuffer = nullptr; - CCVKGPUBuffer *gpuIndirectBuffer = nullptr; - vector vertexBuffers; + AttributeList attributes; + CCVKGPUBufferList gpuVertexBuffers; + CCVKGPUBuffer * gpuIndexBuffer = nullptr; + CCVKGPUBuffer * gpuIndirectBuffer = nullptr; + vector vertexBuffers; vector vertexBufferOffsets; }; union CCVKDescriptorInfo { - VkDescriptorImageInfo image; + VkDescriptorImageInfo image; VkDescriptorBufferInfo buffer; - VkBufferView texelBufferView; + VkBufferView texelBufferView; }; struct CCVKGPUDescriptor { - DescriptorType type = DescriptorType::UNKNOWN; - CCVKGPUBufferView *gpuBufferView = nullptr; - CCVKGPUTextureView *gpuTextureView = nullptr; - CCVKGPUSampler *gpuSampler = nullptr; + DescriptorType type = DescriptorType::UNKNOWN; + vector accessTypes; + CCVKGPUBufferView * gpuBufferView = nullptr; + CCVKGPUTextureView * gpuTextureView = nullptr; + CCVKGPUSampler * gpuSampler = nullptr; }; -typedef vector CCVKGPUDescriptorList; +using CCVKGPUDescriptorList = vector; +class CCVKGPUDescriptorSetLayout; class CCVKGPUDescriptorSet final : public Object { public: CCVKGPUDescriptorList gpuDescriptors; // references - VkDescriptorUpdateTemplate *pUpdateTemplate = nullptr; + CCVKGPUDescriptorSetLayout *gpuLayout = nullptr; - struct DescriptorSetInstance { - VkDescriptorSet vkDescriptorSet = VK_NULL_HANDLE; - vector descriptorInfos; + struct Instance { + VkDescriptorSet vkDescriptorSet = VK_NULL_HANDLE; + vector descriptorInfos; vector descriptorUpdateEntries; }; - vector instances; // per swapchain image + vector instances; // per swapchain image + + uint layoutID = 0U; }; -class CCVKGPUDescriptorSetLayout; -typedef vector CCVKGPUDescriptorSetLayoutList; +using CCVKGPUDescriptorSetLayoutList = vector; class CCVKGPUPipelineLayout final : public Object { public: @@ -267,62 +298,86 @@ public: // helper storage vector dynamicOffsetOffsets; - uint dynamicOffsetCount; + uint dynamicOffsetCount; }; class CCVKGPUPipelineState final : public Object { public: - PrimitiveMode primitive = PrimitiveMode::TRIANGLE_LIST; - CCVKGPUShader *gpuShader = nullptr; + PipelineBindPoint bindPoint = PipelineBindPoint::GRAPHICS; + PrimitiveMode primitive = PrimitiveMode::TRIANGLE_LIST; + CCVKGPUShader * gpuShader = nullptr; CCVKGPUPipelineLayout *gpuPipelineLayout = nullptr; - InputState inputState; - RasterizerState rs; - DepthStencilState dss; - BlendState bs; - DynamicStateList dynamicStates; - CCVKGPURenderPass *gpuRenderPass = nullptr; - VkPipeline vkPipeline = VK_NULL_HANDLE; + InputState inputState; + RasterizerState rs; + DepthStencilState dss; + BlendState bs; + DynamicStateList dynamicStates; + CCVKGPURenderPass * gpuRenderPass = nullptr; + uint subpass = 0U; + VkPipeline vkPipeline = VK_NULL_HANDLE; }; -class CCVKGPUFence final : public Object { +class CCVKGPUGlobalBarrier final : public Object { public: - VkFence vkFence; + VkPipelineStageFlags srcStageMask = 0U; + VkPipelineStageFlags dstStageMask = 0U; + VkMemoryBarrier vkBarrier{}; + + vector accessTypes; + ThsvsGlobalBarrier barrier{}; +}; + +class CCVKGPUTextureBarrier final : public Object { +public: + VkPipelineStageFlags srcStageMask = 0U; + VkPipelineStageFlags dstStageMask = 0U; + VkImageMemoryBarrier vkBarrier{}; + + vector accessTypes; + ThsvsImageBarrier barrier{}; }; class CCVKGPUCommandBufferPool; +class CCVKGPUDescriptorSetPool; class CCVKGPUDevice final : public Object { public: - VkDevice vkDevice = VK_NULL_HANDLE; - vector layers; + VkDevice vkDevice = VK_NULL_HANDLE; + vector layers; vector extensions; - VmaAllocator memoryAllocator = VK_NULL_HANDLE; - VkPipelineCache vkPipelineCache = VK_NULL_HANDLE; + VmaAllocator memoryAllocator = VK_NULL_HANDLE; + VkPipelineCache vkPipelineCache = VK_NULL_HANDLE; + uint minorVersion = 0U; - uint curBackBufferIndex = 0u; - uint backBufferCount = 3u; + uint curBackBufferIndex = 0U; + uint backBufferCount = 3U; bool useDescriptorUpdateTemplate = false; - bool useMultiDrawIndirect = false; + bool useMultiDrawIndirect = false; // for default backup usages - CCVKGPUSampler defaultSampler; - CCVKGPUTexture defaultTexture; + CCVKGPUSampler defaultSampler; + CCVKGPUTexture defaultTexture; CCVKGPUTextureView defaultTextureView; - CCVKGPUBuffer defaultBuffer; + CCVKGPUBuffer defaultBuffer; CCVKGPUSwapchain *swapchain = nullptr; // reference - /* * + CCVKGPUCommandBufferPool *getCommandBufferPool(); + CCVKGPUDescriptorSetPool *getDescriptorSetPool(uint layoutID); + +private: + friend class CCVKDevice; + using CommandBufferPools = tbb::concurrent_unordered_map< std::thread::id, CCVKGPUCommandBufferPool *, std::hash>; - /* */ + /* using CommandBufferPools = unordered_map; std::mutex mutex; - /* */ + */ - CommandBufferPools commandBufferPools; + CommandBufferPools _commandBufferPools; - CCVKGPUCommandBufferPool *getCommandBufferPool(std::thread::id threadID); + unordered_map _descriptorSetPools; }; /** @@ -330,11 +385,11 @@ public: */ class CCVKGPUFencePool final : public Object { public: - CCVKGPUFencePool(CCVKGPUDevice *device) + explicit CCVKGPUFencePool(CCVKGPUDevice *device) : _device(device) { } - ~CCVKGPUFencePool() { + ~CCVKGPUFencePool() override { for (VkFence fence : _fences) { vkDestroyFence(_device->vkDevice, fence, nullptr); } @@ -347,7 +402,7 @@ public: return _fences[_count++]; } - VkFence fence = VK_NULL_HANDLE; + VkFence fence = VK_NULL_HANDLE; VkFenceCreateInfo createInfo{VK_STRUCTURE_TYPE_FENCE_CREATE_INFO}; VK_CHECK(vkCreateFence(_device->vkDevice, &createInfo, nullptr, &fence)); _fences.push_back(fence); @@ -367,13 +422,13 @@ public: return _fences.data(); } - uint size() { + uint size() const { return _count; } private: - CCVKGPUDevice *_device = nullptr; - uint _count = 0u; + CCVKGPUDevice * _device = nullptr; + uint _count = 0U; vector _fences; }; @@ -382,11 +437,11 @@ private: */ class CCVKGPUSemaphorePool final : public Object { public: - CCVKGPUSemaphorePool(CCVKGPUDevice *device) + explicit CCVKGPUSemaphorePool(CCVKGPUDevice *device) : _device(device) { } - ~CCVKGPUSemaphorePool() { + ~CCVKGPUSemaphorePool() override { for (VkSemaphore semaphore : _semaphores) { vkDestroySemaphore(_device->vkDevice, semaphore, nullptr); } @@ -399,7 +454,7 @@ public: return _semaphores[_count++]; } - VkSemaphore semaphore = VK_NULL_HANDLE; + VkSemaphore semaphore = VK_NULL_HANDLE; VkSemaphoreCreateInfo createInfo{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; VK_CHECK(vkCreateSemaphore(_device->vkDevice, &createInfo, nullptr, &semaphore)); _semaphores.push_back(semaphore); @@ -412,13 +467,13 @@ public: _count = 0; } - uint size() { + uint size() const { return _count; } private: - CCVKGPUDevice *_device; - uint _count = 0u; + CCVKGPUDevice * _device; + uint _count = 0U; vector _semaphores; }; @@ -427,20 +482,19 @@ private: */ class CCVKGPUDescriptorSetPool final : public Object { public: - ~CCVKGPUDescriptorSetPool() { + ~CCVKGPUDescriptorSetPool() override { for (vector &market : _fleaMarkets) { for (VkDescriptorSet set : market) { for (DescriptorSetPool &pool : _pools) { if (pool.activeSets.count(set)) { pool.activeSets.erase(set); - pool.freeSets.push_back(set); break; } } } } - uint leakedSetCount = 0u; + uint leakedSetCount = 0U; for (DescriptorSetPool &pool : _pools) { leakedSetCount += pool.activeSets.size(); vkDestroyDescriptorPool(_device->vkDevice, pool.vkPool, nullptr); @@ -450,26 +504,25 @@ public: _pools.clear(); } - void link(CCVKGPUDevice *device, uint maxSetsPerPool, vector &bindings, VkDescriptorSetLayout setLayout) { - _device = device; + void link(CCVKGPUDevice *device, uint maxSetsPerPool, const vector &bindings, VkDescriptorSetLayout setLayout) { + _device = device; _maxSetsPerPool = maxSetsPerPool; - _setLayouts.insert(_setLayouts.begin(), _maxSetsPerPool, setLayout); + _setLayouts.insert(_setLayouts.cbegin(), _maxSetsPerPool, setLayout); _fleaMarkets.resize(device->backBufferCount); unordered_map typeMap; - for (size_t i = 0u; i < bindings.size(); i++) { - VkDescriptorSetLayoutBinding &vkBinding = bindings[i]; + for (const auto &vkBinding : bindings) { typeMap[vkBinding.descriptorType] += maxSetsPerPool * vkBinding.descriptorCount; } // minimal reserve for empty set layouts - if (!bindings.size()) { + if (bindings.empty()) { typeMap[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER] = 1; } _poolSizes.clear(); - for (unordered_map::iterator it = typeMap.begin(); it != typeMap.end(); it++) { - _poolSizes.push_back({it->first, it->second}); + for (auto &it : typeMap) { + _poolSizes.push_back({it.first, it.second}); } } @@ -483,9 +536,9 @@ public: } size_t size = _pools.size(); - uint idx = 0u; + uint idx = 0U; for (; idx < size; idx++) { - if (_pools[idx].freeSets.size()) { + if (!_pools[idx].freeSets.empty()) { output = _pools[idx].freeSets.back(); _pools[idx].freeSets.pop_back(); _pools[idx].activeSets.insert(output); @@ -495,19 +548,19 @@ public: if (idx >= size) { VkDescriptorPoolCreateInfo createInfo{VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO}; - createInfo.maxSets = _maxSetsPerPool; - createInfo.poolSizeCount = _poolSizes.size(); - createInfo.pPoolSizes = _poolSizes.data(); + createInfo.maxSets = _maxSetsPerPool; + createInfo.poolSizeCount = utils::toUint(_poolSizes.size()); + createInfo.pPoolSizes = _poolSizes.data(); - VkDescriptorPool descriptorPool; + VkDescriptorPool descriptorPool = VK_NULL_HANDLE; VK_CHECK(vkCreateDescriptorPool(_device->vkDevice, &createInfo, nullptr, &descriptorPool)); _pools.push_back({descriptorPool}); _pools[idx].freeSets.resize(_maxSetsPerPool); VkDescriptorSetAllocateInfo info{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO}; - info.pSetLayouts = _setLayouts.data(); + info.pSetLayouts = _setLayouts.data(); info.descriptorSetCount = _maxSetsPerPool; - info.descriptorPool = descriptorPool; + info.descriptorPool = descriptorPool; VK_CHECK(vkAllocateDescriptorSets(_device->vkDevice, &info, _pools[idx].freeSets.data())); } @@ -533,49 +586,49 @@ private: CCVKGPUDevice *_device = nullptr; struct DescriptorSetPool { - VkDescriptorPool vkPool = VK_NULL_HANDLE; + VkDescriptorPool vkPool = VK_NULL_HANDLE; unordered_set activeSets; - vector freeSets; + vector freeSets; }; vector _pools; vector> _fleaMarkets; // per back buffer - vector _poolSizes; + vector _poolSizes; vector _setLayouts; - uint _maxSetsPerPool = 0u; + uint _maxSetsPerPool = 0U; }; class CCVKGPUDescriptorSetLayout final : public Object { public: DescriptorSetLayoutBindingList bindings; - vector dynamicBindings; + vector dynamicBindings; vector vkBindings; - VkDescriptorSetLayout vkDescriptorSetLayout = VK_NULL_HANDLE; - VkDescriptorUpdateTemplate vkDescriptorUpdateTemplate = VK_NULL_HANDLE; - VkDescriptorSet defaultDescriptorSet = VK_NULL_HANDLE; + VkDescriptorSetLayout vkDescriptorSetLayout = VK_NULL_HANDLE; + VkDescriptorUpdateTemplate vkDescriptorUpdateTemplate = VK_NULL_HANDLE; + VkDescriptorSet defaultDescriptorSet = VK_NULL_HANDLE; vector bindingIndices; vector descriptorIndices; - uint descriptorCount = 0u; + uint descriptorCount = 0U; - uint maxSetsPerPool = 10u; - CCVKGPUDescriptorSetPool pool; + uint id = 0U; + uint maxSetsPerPool = 10U; }; /** - * Command buffer pool based on VkCommandPools, always try to resue previous allocations first. + * Command buffer pool based on VkCommandPools, always try to reuse previous allocations first. */ class CCVKGPUCommandBufferPool final : public Object { public: - CCVKGPUCommandBufferPool(CCVKGPUDevice *device) + explicit CCVKGPUCommandBufferPool(CCVKGPUDevice *device) : _device(device) { } - ~CCVKGPUCommandBufferPool() { - for (unordered_map::iterator it = _pools.begin(); it != _pools.end(); it++) { - CommandBufferPool &pool = it->second; + ~CCVKGPUCommandBufferPool() override { + for (auto &it : _pools) { + CommandBufferPool &pool = it.second; if (pool.vkCommandPool != VK_NULL_HANDLE) { vkDestroyCommandPool(_device->vkDevice, pool.vkCommandPool, nullptr); pool.vkCommandPool = VK_NULL_HANDLE; @@ -589,7 +642,7 @@ public: uint getHash(uint queueFamilyIndex) { return (queueFamilyIndex << 10) | _device->curBackBufferIndex; } - uint getBackBufferIndex(uint hash) { + static uint getBackBufferIndex(uint hash) { return hash & ((1 << 10) - 1); } @@ -604,7 +657,7 @@ public: if (!_pools.count(hash)) { VkCommandPoolCreateInfo createInfo{VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO}; createInfo.queueFamilyIndex = gpuCommandBuffer->queueFamilyIndex; - createInfo.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; + createInfo.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; VK_CHECK(vkCreateCommandPool(_device->vkDevice, &createInfo, nullptr, &_pools[hash].vkCommandPool)); } CommandBufferPool &pool = _pools[hash]; @@ -614,9 +667,9 @@ public: gpuCommandBuffer->vkCommandBuffer = availableList.pop(); } else { VkCommandBufferAllocateInfo allocateInfo{VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO}; - allocateInfo.commandPool = pool.vkCommandPool; + allocateInfo.commandPool = pool.vkCommandPool; allocateInfo.commandBufferCount = 1; - allocateInfo.level = gpuCommandBuffer->level; + allocateInfo.level = gpuCommandBuffer->level; VK_CHECK(vkAllocateCommandBuffers(_device->vkDevice, &allocateInfo, &gpuCommandBuffer->vkCommandBuffer)); } } @@ -633,12 +686,14 @@ public: } void reset() { - for (unordered_map::iterator it = _pools.begin(); it != _pools.end(); it++) { - if (getBackBufferIndex(it->first) != _device->curBackBufferIndex) continue; - CommandBufferPool &pool = it->second; + for (auto &it : _pools) { + if (getBackBufferIndex(it.first) != _device->curBackBufferIndex) { + continue; + } + CommandBufferPool &pool = it.second; bool needsReset = false; - for (uint i = 0u; i < 2u; i++) { + for (uint i = 0U; i < 2U; ++i) { CachedArray &usedList = pool.usedCommandBuffers[i]; if (usedList.size()) { pool.commandBuffers[i].concat(usedList); @@ -654,13 +709,13 @@ public: private: struct CommandBufferPool { - VkCommandPool vkCommandPool = VK_NULL_HANDLE; + VkCommandPool vkCommandPool = VK_NULL_HANDLE; CachedArray commandBuffers[2]; CachedArray usedCommandBuffers[2]; }; - CCVKGPUDevice *_device = nullptr; - uint _lastBackBufferIndex = 0u; + CCVKGPUDevice *_device = nullptr; + uint _lastBackBufferIndex = 0U; unordered_map _pools; }; @@ -668,29 +723,29 @@ private: /** * Staging buffer pool, based on multiple fix-sized VkBuffer blocks. */ -constexpr size_t chunkSize = 32 * 1024 * 1024; // 32M per block by default +constexpr size_t CHUNK_SIZE = 32 * 1024 * 1024; // 32M per block by default class CCVKGPUStagingBufferPool final : public Object { public: - CCVKGPUStagingBufferPool(CCVKGPUDevice *device) + explicit CCVKGPUStagingBufferPool(CCVKGPUDevice *device) : _device(device) { } - ~CCVKGPUStagingBufferPool() { + ~CCVKGPUStagingBufferPool() override { for (Buffer &buffer : _pool) { vmaDestroyBuffer(_device->memoryAllocator, buffer.vkBuffer, buffer.vmaAllocation); } _pool.clear(); } - void alloc(CCVKGPUBuffer *gpuBuffer) { alloc(gpuBuffer, 1u); } + void alloc(CCVKGPUBuffer *gpuBuffer) { alloc(gpuBuffer, 1U); } void alloc(CCVKGPUBuffer *gpuBuffer, uint alignment) { - size_t bufferCount = _pool.size(); - Buffer *buffer = nullptr; - VkDeviceSize offset = 0u; - for (size_t idx = 0u; idx < bufferCount; idx++) { + size_t bufferCount = _pool.size(); + Buffer * buffer = nullptr; + VkDeviceSize offset = 0U; + for (size_t idx = 0U; idx < bufferCount; idx++) { Buffer *cur = &_pool[idx]; - offset = roundUp(cur->curOffset, alignment); - if (chunkSize - offset >= gpuBuffer->size) { + offset = roundUp(cur->curOffset, alignment); + if (CHUNK_SIZE - offset >= gpuBuffer->size) { buffer = cur; break; } @@ -699,35 +754,35 @@ public: _pool.resize(bufferCount + 1); buffer = &_pool.back(); VkBufferCreateInfo bufferInfo{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; - bufferInfo.size = chunkSize; + bufferInfo.size = CHUNK_SIZE; bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; VmaAllocationCreateInfo allocInfo{}; allocInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT; allocInfo.usage = VMA_MEMORY_USAGE_CPU_ONLY; VmaAllocationInfo res; VK_CHECK(vmaCreateBuffer(_device->memoryAllocator, &bufferInfo, &allocInfo, &buffer->vkBuffer, &buffer->vmaAllocation, &res)); - buffer->mappedData = (uint8_t *)res.pMappedData; - offset = 0u; + buffer->mappedData = reinterpret_cast(res.pMappedData); + offset = 0U; } - gpuBuffer->vkBuffer = buffer->vkBuffer; + gpuBuffer->vkBuffer = buffer->vkBuffer; gpuBuffer->startOffset = offset; - gpuBuffer->mappedData = buffer->mappedData + offset; - buffer->curOffset = offset + gpuBuffer->size; + gpuBuffer->mappedData = buffer->mappedData + offset; + buffer->curOffset = offset + gpuBuffer->size; } void reset() { for (Buffer &buffer : _pool) { - buffer.curOffset = 0u; + buffer.curOffset = 0U; } } private: struct Buffer { - VkBuffer vkBuffer = VK_NULL_HANDLE; - uint8_t *mappedData = nullptr; + VkBuffer vkBuffer = VK_NULL_HANDLE; + uint8_t * mappedData = nullptr; VmaAllocation vmaAllocation = VK_NULL_HANDLE; - VkDeviceSize curOffset = 0u; + VkDeviceSize curOffset = 0U; }; CCVKGPUDevice *_device = nullptr; @@ -739,14 +794,19 @@ private: */ class CCVKGPUDescriptorSetHub final : public Object { public: - CCVKGPUDescriptorSetHub(CCVKGPUDevice *device) + explicit CCVKGPUDescriptorSetHub(CCVKGPUDevice *device) : _device(device) { _setsToBeUpdated.resize(device->backBufferCount); + if (device->minorVersion > 0) { + _updateFn = vkUpdateDescriptorSetWithTemplate; + } else { + _updateFn = vkUpdateDescriptorSetWithTemplateKHR; + } } void record(const CCVKGPUDescriptorSet *gpuDescriptorSet) { update(gpuDescriptorSet); - for (uint i = 0u; i < _device->backBufferCount; ++i) { + for (uint i = 0U; i < _device->backBufferCount; ++i) { if (i == _device->curBackBufferIndex) { _setsToBeUpdated[i].erase(gpuDescriptorSet); } else { @@ -756,7 +816,7 @@ public: } void erase(CCVKGPUDescriptorSet *gpuDescriptorSet) { - for (uint i = 0u; i < _device->backBufferCount; ++i) { + for (uint i = 0U; i < _device->backBufferCount; ++i) { if (_setsToBeUpdated[i].count(gpuDescriptorSet)) { _setsToBeUpdated[i].erase(gpuDescriptorSet); } @@ -765,30 +825,29 @@ public: void flush() { DescriptorSetList &sets = _setsToBeUpdated[_device->curBackBufferIndex]; - for (DescriptorSetList::iterator it = sets.begin(); it != sets.end(); ++it) { - update(*it); + for (const auto *set : sets) { + update(set); } sets.clear(); } private: void update(const CCVKGPUDescriptorSet *gpuDescriptorSet) { - const CCVKGPUDescriptorSet::DescriptorSetInstance &instance = gpuDescriptorSet->instances[_device->curBackBufferIndex]; - if (gpuDescriptorSet->pUpdateTemplate) { - if (*gpuDescriptorSet->pUpdateTemplate) { // skip empty descriptor sets - vkUpdateDescriptorSetWithTemplateKHR(_device->vkDevice, - instance.vkDescriptorSet, - *gpuDescriptorSet->pUpdateTemplate, instance.descriptorInfos.data()); - } + const CCVKGPUDescriptorSet::Instance &instance = gpuDescriptorSet->instances[_device->curBackBufferIndex]; + if (gpuDescriptorSet->gpuLayout->vkDescriptorUpdateTemplate) { + _updateFn(_device->vkDevice, instance.vkDescriptorSet, + gpuDescriptorSet->gpuLayout->vkDescriptorUpdateTemplate, instance.descriptorInfos.data()); } else { const vector &entries = instance.descriptorUpdateEntries; - vkUpdateDescriptorSets(_device->vkDevice, entries.size(), entries.data(), 0, nullptr); + vkUpdateDescriptorSets(_device->vkDevice, utils::toUint(entries.size()), entries.data(), 0, nullptr); } } - CCVKGPUDevice *_device = nullptr; using DescriptorSetList = unordered_set; - vector _setsToBeUpdated; + + CCVKGPUDevice * _device = nullptr; + vector _setsToBeUpdated; + PFN_vkUpdateDescriptorSetWithTemplate _updateFn = nullptr; }; /** @@ -797,7 +856,7 @@ private: */ class CCVKGPUDescriptorHub final : public Object { public: - CCVKGPUDescriptorHub(CCVKGPUDevice *device) { + explicit CCVKGPUDescriptorHub(CCVKGPUDevice * /*device*/) { } void link(CCVKGPUDescriptorSetHub *descriptorSetHub) { @@ -807,7 +866,7 @@ public: void connect(const CCVKGPUDescriptorSet *set, const CCVKGPUBufferView *buffer, VkDescriptorBufferInfo *descriptor, uint instanceIdx) { _buffers[buffer].sets.insert(set); _buffers[buffer].descriptors.push(descriptor); - _bufferInstaceIndices[descriptor] = instanceIdx; + _bufferInstanceIndices[descriptor] = instanceIdx; } void connect(const CCVKGPUDescriptorSet *set, const CCVKGPUTextureView *texture, VkDescriptorImageInfo *descriptor) { _textures[texture].sets.insert(set); @@ -821,10 +880,10 @@ public: auto it = _buffers.find(buffer); if (it == _buffers.end()) return; auto &info = it->second; - for (uint i = 0u; i < info.descriptors.size(); i++) { - _doUpdate(buffer, info.descriptors[i]); + for (uint i = 0U; i < info.descriptors.size(); i++) { + doUpdate(buffer, info.descriptors[i]); } - for (auto set : info.sets) { + for (const auto *set : info.sets) { _descriptorSetHub->record(set); } } @@ -832,9 +891,9 @@ public: auto it = _buffers.find(buffer); if (it == _buffers.end()) return; auto &descriptors = it->second.descriptors; - for (uint i = 0u; i < descriptors.size(); i++) { + for (uint i = 0U; i < descriptors.size(); i++) { if (descriptors[i] == descriptor) { - _doUpdate(buffer, descriptor); + doUpdate(buffer, descriptor); break; } } @@ -843,10 +902,10 @@ public: auto it = _textures.find(texture); if (it == _textures.end()) return; auto &info = it->second; - for (uint i = 0u; i < info.descriptors.size(); i++) { - _doUpdate(texture, info.descriptors[i]); + for (uint i = 0U; i < info.descriptors.size(); i++) { + doUpdate(texture, info.descriptors[i]); } - for (auto set : info.sets) { + for (const auto *set : info.sets) { _descriptorSetHub->record(set); } } @@ -854,9 +913,9 @@ public: auto it = _textures.find(texture); if (it == _textures.end()) return; auto &descriptors = it->second.descriptors; - for (uint i = 0u; i < descriptors.size(); i++) { + for (uint i = 0U; i < descriptors.size(); i++) { if (descriptors[i] == descriptor) { - _doUpdate(texture, descriptor); + doUpdate(texture, descriptor); break; } } @@ -865,9 +924,9 @@ public: auto it = _samplers.find(sampler); if (it == _samplers.end()) return; auto &descriptors = it->second; - for (uint i = 0u; i < descriptors.size(); i++) { + for (uint i = 0U; i < descriptors.size(); ++i) { if (descriptors[i] == descriptor) { - _doUpdate(sampler, descriptor); + doUpdate(sampler, descriptor); break; } } @@ -877,7 +936,7 @@ public: auto it = _buffers.find(buffer); if (it == _buffers.end()) return; for (uint i = 0; i < it->second.descriptors.size(); ++i) { - _bufferInstaceIndices.erase(it->second.descriptors[i]); + _bufferInstanceIndices.erase(it->second.descriptors[i]); } _buffers.erase(it); } @@ -886,7 +945,7 @@ public: if (it == _buffers.end()) return; auto &descriptors = it->second.descriptors; descriptors.fastRemove(descriptors.indexOf(descriptor)); - _bufferInstaceIndices.erase(descriptor); + _bufferInstanceIndices.erase(descriptor); } void disengage(const CCVKGPUTextureView *texture) { auto it = _textures.find(texture); @@ -912,107 +971,56 @@ public: } private: - void _doUpdate(const CCVKGPUBufferView *buffer, VkDescriptorBufferInfo *descriptor) { - VkDeviceSize instanceOffset = _bufferInstaceIndices[descriptor] * buffer->gpuBuffer->instanceSize; - descriptor->buffer = buffer->gpuBuffer->vkBuffer; - descriptor->offset = buffer->gpuBuffer->startOffset + instanceOffset + buffer->offset; - descriptor->range = buffer->range; + void doUpdate(const CCVKGPUBufferView *buffer, VkDescriptorBufferInfo *descriptor) { + VkDeviceSize instanceOffset = _bufferInstanceIndices[descriptor] * buffer->gpuBuffer->instanceSize; + descriptor->buffer = buffer->gpuBuffer->vkBuffer; + descriptor->offset = buffer->gpuBuffer->startOffset + instanceOffset + buffer->offset; + descriptor->range = buffer->range; } - void _doUpdate(const CCVKGPUTextureView *texture, VkDescriptorImageInfo *descriptor) { + static void doUpdate(const CCVKGPUTextureView *texture, VkDescriptorImageInfo *descriptor) { descriptor->imageView = texture->vkImageView; } - void _doUpdate(const CCVKGPUSampler *sampler, VkDescriptorImageInfo *descriptor) { + static void doUpdate(const CCVKGPUSampler *sampler, VkDescriptorImageInfo *descriptor) { descriptor->sampler = sampler->vkSampler; } template struct DescriptorInfo { unordered_set sets; - CachedArray descriptors; + CachedArray descriptors; }; - unordered_map _bufferInstaceIndices; + unordered_map _bufferInstanceIndices; unordered_map> _buffers; unordered_map> _textures; - unordered_map> _samplers; + unordered_map> _samplers; CCVKGPUDescriptorSetHub *_descriptorSetHub = nullptr; }; -/** - * Manages buffer update events, across all back buffer instances. - */ -class CCVKGPUBufferHub final : public Object { -public: - CCVKGPUBufferHub(CCVKGPUDevice *device) - : _device(device) { - _buffersToBeUpdated.resize(device->backBufferCount); - } - - void record(CCVKGPUBuffer *gpuBuffer, const void *src, size_t size) { - src = update(gpuBuffer, src, size); // copy from self afterwards - for (uint i = 0u; i < _device->backBufferCount; ++i) { - if (i == _device->curBackBufferIndex) { - _buffersToBeUpdated[i].erase(gpuBuffer); - } else { - _buffersToBeUpdated[i][gpuBuffer] = {src, size}; - } - } - } - - void erase(CCVKGPUBuffer *gpuBuffer) { - for (uint i = 0u; i < _device->backBufferCount; ++i) { - if (_buffersToBeUpdated[i].count(gpuBuffer)) { - _buffersToBeUpdated[i].erase(gpuBuffer); - } - } - } - - void flush() { - unordered_map &buffers = _buffersToBeUpdated[_device->curBackBufferIndex]; - for (unordered_map::iterator it = buffers.begin(); it != buffers.end(); ++it) { - update(it->first, it->second.src, it->second.size); - } - buffers.clear(); - } - -private: - struct BufferUpdate { - const void *src = nullptr; - size_t size = 0u; - }; - uint8_t *update(CCVKGPUBuffer *gpuBuffer, const void *src, size_t size) { - uint8_t *dst = gpuBuffer->mappedData + _device->curBackBufferIndex * gpuBuffer->instanceSize; - memcpy(dst, src, size); - return dst; - } - - CCVKGPUDevice *_device = nullptr; - vector> _buffersToBeUpdated; -}; - /** * Recycle bin for GPU resources, clears after vkDeviceWaitIdle every frame. * All the destroy events will be postponed to that time. */ class CCVKGPURecycleBin final : public Object { public: - CCVKGPURecycleBin(CCVKGPUDevice *device) + explicit CCVKGPURecycleBin(CCVKGPUDevice *device) : _device(device) { _resources.resize(16); } -#define DEFINE_RECYCLE_BIN_COLLECT_FN(_type, typeValue, expr) \ - void collect(_type *gpuRes) { \ - if (_resources.size() <= _count) { \ - _resources.resize(_count * 2); \ - } \ - Resource &res = _resources[_count++]; \ - res.type = typeValue; \ - expr; \ +#define DEFINE_RECYCLE_BIN_COLLECT_FN(_type, typeValue, expr) \ + void collect(_type *gpuRes) { /* NOLINT(bugprone-macro-parentheses) N/A */ \ + if (_resources.size() <= _count) { \ + _resources.resize(_count * 2); \ + } \ + Resource &res = _resources[_count++]; \ + res.type = typeValue; \ + expr; \ } + DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUBuffer, RecycledType::BUFFER, (res.buffer = {gpuRes->vkBuffer, gpuRes->vmaAllocation})) DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUTexture, RecycledType::TEXTURE, (res.image = {gpuRes->vkImage, gpuRes->vmaAllocation})) DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUTextureView, RecycledType::TEXTURE_VIEW, res.vkImageView = gpuRes->vkImageView) @@ -1023,7 +1031,6 @@ public: DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUDescriptorSetLayout, RecycledType::DESCRIPTOR_SET_LAYOUT, res.gpuDescriptorSetLayout = gpuRes) DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUPipelineLayout, RecycledType::PIPELINE_LAYOUT, res.gpuPipelineLayout = gpuRes) DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUPipelineState, RecycledType::PIPELINE_STATE, res.gpuPipelineState = gpuRes) - DEFINE_RECYCLE_BIN_COLLECT_FN(CCVKGPUFence, RecycledType::FENCE, res.gpuFence = gpuRes) void clear(); @@ -1040,39 +1047,36 @@ private: DESCRIPTOR_SET_LAYOUT, PIPELINE_LAYOUT, PIPELINE_STATE, - FENCE, }; struct Buffer { - VkBuffer vkBuffer; + VkBuffer vkBuffer; VmaAllocation vmaAllocation; }; struct Image { - VkImage vkImage; + VkImage vkImage; VmaAllocation vmaAllocation; }; struct Resource { RecycledType type = RecycledType::UNKNOWN; - bool isView = false; union { // resizable resources, cannot take over directly // or descriptor sets won't work - Buffer buffer; - Image image; + Buffer buffer; + Image image; VkImageView vkImageView; - CCVKGPURenderPass *gpuRenderPass; - CCVKGPUFramebuffer *gpuFramebuffer; - CCVKGPUSampler *gpuSampler; - CCVKGPUShader *gpuShader; + CCVKGPURenderPass * gpuRenderPass; + CCVKGPUFramebuffer * gpuFramebuffer; + CCVKGPUSampler * gpuSampler; + CCVKGPUShader * gpuShader; CCVKGPUDescriptorSetLayout *gpuDescriptorSetLayout; - CCVKGPUPipelineLayout *gpuPipelineLayout; - CCVKGPUPipelineState *gpuPipelineState; - CCVKGPUFence *gpuFence; + CCVKGPUPipelineLayout * gpuPipelineLayout; + CCVKGPUPipelineState * gpuPipelineState; }; }; - CCVKGPUDevice *_device = nullptr; + CCVKGPUDevice * _device = nullptr; vector _resources; - uint _count = 0u; + uint _count = 0U; }; /** @@ -1082,11 +1086,17 @@ private: //#define ASYNC_BUFFER_UPDATE class CCVKGPUTransportHub final : public Object { public: - CCVKGPUTransportHub(CCVKGPUDevice *device) - : _device(device) { + CCVKGPUTransportHub(CCVKGPUDevice *device, CCVKGPUQueue *queue) + : _device(device), + _queue(queue) { + _cmdBuff.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + _cmdBuff.queueFamilyIndex = _queue->queueFamilyIndex; + + VkFenceCreateInfo createInfo{VK_STRUCTURE_TYPE_FENCE_CREATE_INFO}; + VK_CHECK(vkCreateFence(_device->vkDevice, &createInfo, nullptr, &_fence)); } - ~CCVKGPUTransportHub() { + ~CCVKGPUTransportHub() override { if (_fence) { vkDestroyFence(_device->vkDevice, _fence, nullptr); _fence = VK_NULL_HANDLE; @@ -1096,20 +1106,20 @@ public: void link(CCVKGPUQueue *queue) { _queue = queue; - _cmdBuff.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + _cmdBuff.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; _cmdBuff.queueFamilyIndex = _queue->queueFamilyIndex; VkFenceCreateInfo createInfo{VK_STRUCTURE_TYPE_FENCE_CREATE_INFO}; VK_CHECK(vkCreateFence(_device->vkDevice, &createInfo, nullptr, &_fence)); } - bool empty() { + bool empty() const { return !_cmdBuff.vkCommandBuffer; } template void checkIn(const TFunc &record, bool immediateSubmission = false) { - CCVKGPUCommandBufferPool *commandBufferPool = _device->getCommandBufferPool(std::this_thread::get_id()); + CCVKGPUCommandBufferPool *commandBufferPool = _device->getCommandBufferPool(); if (!_cmdBuff.vkCommandBuffer) { commandBufferPool->request(&_cmdBuff); @@ -1124,7 +1134,7 @@ public: VK_CHECK(vkEndCommandBuffer(_cmdBuff.vkCommandBuffer)); VkSubmitInfo submitInfo{VK_STRUCTURE_TYPE_SUBMIT_INFO}; submitInfo.commandBufferCount = 1; - submitInfo.pCommandBuffers = &_cmdBuff.vkCommandBuffer; + submitInfo.pCommandBuffers = &_cmdBuff.vkCommandBuffer; VK_CHECK(vkQueueSubmit(_queue->vkQueue, 1, &submitInfo, _fence)); VK_CHECK(vkWaitForFences(_device->vkDevice, 1, &_fence, VK_TRUE, DEFAULT_TIMEOUT)); vkResetFences(_device->vkDevice, 1, &_fence); @@ -1133,26 +1143,110 @@ public: } } - void depart() { - if (_cmdBuff.vkCommandBuffer) { - CCVKGPUCommandBufferPool *commandBufferPool = _device->getCommandBufferPool(std::this_thread::get_id()); - - VK_CHECK(vkEndCommandBuffer(_cmdBuff.vkCommandBuffer)); - _queue->commandBuffers.push(_cmdBuff.vkCommandBuffer); - commandBufferPool->yield(&_cmdBuff); - _cmdBuff.vkCommandBuffer = VK_NULL_HANDLE; + VkCommandBuffer packageForFlight() { + VkCommandBuffer vkCommandBuffer = _cmdBuff.vkCommandBuffer; + if (vkCommandBuffer) { + VK_CHECK(vkEndCommandBuffer(vkCommandBuffer)); + _device->getCommandBufferPool()->yield(&_cmdBuff); } + return vkCommandBuffer; } private: CCVKGPUDevice *_device = nullptr; - CCVKGPUQueue *_queue = nullptr; + CCVKGPUQueue * _queue = nullptr; CCVKGPUCommandBuffer _cmdBuff; - VkFence _fence = VK_NULL_HANDLE; + VkFence _fence = VK_NULL_HANDLE; +}; + +class CCVKGPUBarrierManager final : public Object { +public: + explicit CCVKGPUBarrierManager(CCVKGPUDevice *device) + : _device(device) {} + + void checkIn(CCVKGPUBuffer *gpuBuffer) { + _buffersToBeChecked.insert(gpuBuffer); + } + + void checkIn(CCVKGPUTexture *gpuTexture, const ThsvsAccessType *newTypes = nullptr, uint newTypeCount = 0) { + vector &target = gpuTexture->renderAccessTypes; + for (uint i = 0U; i < newTypeCount; ++i) { + if (std::find(target.begin(), target.end(), newTypes[i]) == target.end()) { + target.push_back(newTypes[i]); + } + } + _texturesToBeChecked.insert(gpuTexture); + } + + void update(CCVKGPUTransportHub *transportHub); + + CC_INLINE void cancel(CCVKGPUBuffer *gpuBuffer) { _buffersToBeChecked.erase(gpuBuffer); } + CC_INLINE void cancel(CCVKGPUTexture *gpuTexture) { _texturesToBeChecked.erase(gpuTexture); } + +private: + unordered_set _buffersToBeChecked; + unordered_set _texturesToBeChecked; + CCVKGPUDevice * _device = nullptr; +}; + +/** + * Manages buffer update events, across all back buffer instances. + */ +class CCVKGPUBufferHub final : public Object { +public: + explicit CCVKGPUBufferHub(CCVKGPUDevice *device) + : _device(device) { + _buffersToBeUpdated.resize(device->backBufferCount); + } + + void record(CCVKGPUBuffer *gpuBuffer, const void *src, size_t size) { + uint backBufferIndex = _device->curBackBufferIndex; + uint8_t *dst = gpuBuffer->mappedData + backBufferIndex * gpuBuffer->instanceSize; + memcpy(dst, src, size); + for (uint i = 0U; i < _device->backBufferCount; ++i) { + if (i == backBufferIndex) { + _buffersToBeUpdated[i].erase(gpuBuffer); + } else { + _buffersToBeUpdated[i][gpuBuffer] = {backBufferIndex, size}; + } + } + } + + void erase(CCVKGPUBuffer *gpuBuffer) { + for (uint i = 0U; i < _device->backBufferCount; ++i) { + if (_buffersToBeUpdated[i].count(gpuBuffer)) { + _buffersToBeUpdated[i].erase(gpuBuffer); + } + } + } + + void flush(CCVKGPUTransportHub *transportHub) { + auto &buffers = _buffersToBeUpdated[_device->curBackBufferIndex]; + if (buffers.empty()) return; + + transportHub->checkIn([&](const CCVKGPUCommandBuffer *gpuCommandBuffer) { + VkBufferCopy region; + for (auto &buffer : buffers) { + region.srcOffset = buffer.first->startOffset + buffer.second.srcIndex * buffer.first->instanceSize; + region.dstOffset = buffer.first->startOffset + _device->curBackBufferIndex * buffer.first->instanceSize; + region.size = buffer.second.size; + vkCmdCopyBuffer(gpuCommandBuffer->vkCommandBuffer, buffer.first->vkBuffer, buffer.first->vkBuffer, 1, ®ion); + } + }); + buffers.clear(); + } + +private: + struct BufferUpdate { + uint srcIndex = 0U; + size_t size = 0U; + }; + + vector> _buffersToBeUpdated; + + CCVKGPUDevice *_device = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.cpp b/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.cpp new file mode 100644 index 0000000000..575e5d5dc6 --- /dev/null +++ b/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "VKStd.h" + +#include "VKCommands.h" +#include "VKGlobalBarrier.h" + +namespace cc { +namespace gfx { + +CCVKGlobalBarrier::CCVKGlobalBarrier() = default; + +CCVKGlobalBarrier::~CCVKGlobalBarrier() { + CC_SAFE_DELETE(_gpuBarrier); +} + +void CCVKGlobalBarrier::doInit(const GlobalBarrierInfo &info) { + _gpuBarrier = CC_NEW(CCVKGPUGlobalBarrier); + _gpuBarrier->accessTypes.resize(info.prevAccesses.size() + info.nextAccesses.size()); + + uint index = 0U; + for (AccessType type : info.prevAccesses) { + _gpuBarrier->accessTypes[index++] = THSVS_ACCESS_TYPES[static_cast(type)]; + } + for (AccessType type : info.nextAccesses) { + _gpuBarrier->accessTypes[index++] = THSVS_ACCESS_TYPES[static_cast(type)]; + } + + _gpuBarrier->barrier.prevAccessCount = info.prevAccesses.size(); + _gpuBarrier->barrier.pPrevAccesses = _gpuBarrier->accessTypes.data(); + _gpuBarrier->barrier.nextAccessCount = info.nextAccesses.size(); + _gpuBarrier->barrier.pNextAccesses = _gpuBarrier->accessTypes.data() + info.prevAccesses.size(); + + thsvsGetVulkanMemoryBarrier(_gpuBarrier->barrier, &_gpuBarrier->srcStageMask, &_gpuBarrier->dstStageMask, &_gpuBarrier->vkBarrier); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h b/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h new file mode 100644 index 0000000000..ee9cf2ecc3 --- /dev/null +++ b/native/cocos/renderer/gfx-vulkan/VKGlobalBarrier.h @@ -0,0 +1,52 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_GFXVULKAN_GLOBAL_BARRIER_H_ +#define CC_GFXVULKAN_GLOBAL_BARRIER_H_ + +#include "gfx-base/GFXGlobalBarrier.h" + +namespace cc { +namespace gfx { + +class CCVKGPUGlobalBarrier; + +class CC_DLL CCVKGlobalBarrier : public GlobalBarrier { +public: + CCVKGlobalBarrier(); + ~CCVKGlobalBarrier(); + + CC_INLINE const CCVKGPUGlobalBarrier *gpuBarrier() const { return _gpuBarrier; } + +protected: + void doInit(const GlobalBarrierInfo &info) override; + + CCVKGPUGlobalBarrier *_gpuBarrier = nullptr; +}; + +} // namespace gfx +} // namespace cc + +#endif // CC_GFXVULKAN_GLOBAL_BARRIER_H_ diff --git a/native/cocos/renderer/gfx-vulkan/VKInputAssembler.cpp b/native/cocos/renderer/gfx-vulkan/VKInputAssembler.cpp index cac6e4ff6f..dfb3045550 100644 --- a/native/cocos/renderer/gfx-vulkan/VKInputAssembler.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKInputAssembler.cpp @@ -1,65 +1,53 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKBuffer.h" -#include "VKDevice.h" #include "VKCommands.h" +#include "VKDevice.h" #include "VKInputAssembler.h" namespace cc { namespace gfx { -CCVKInputAssembler::CCVKInputAssembler(Device *device) -: InputAssembler(device) { -} +CCVKInputAssembler::CCVKInputAssembler() = default; CCVKInputAssembler::~CCVKInputAssembler() { + destroy(); } -bool CCVKInputAssembler::initialize(const InputAssemblerInfo &info) { - _attributes = info.attributes; - _vertexBuffers = info.vertexBuffers; - _indexBuffer = info.indexBuffer; - _indirectBuffer = info.indirectBuffer; +void CCVKInputAssembler::doInit(const InputAssemblerInfo &info) { size_t vbCount = _vertexBuffers.size(); - if (_indexBuffer) { - _indexCount = _indexBuffer->getCount(); - _firstIndex = 0; - } else if (_vertexBuffers.size()) { - _vertexCount = _vertexBuffers[0]->getCount(); - _firstVertex = 0; - _vertexOffset = 0; - } - - _gpuInputAssembler = CC_NEW(CCVKGPUInputAssembler); + _gpuInputAssembler = CC_NEW(CCVKGPUInputAssembler); _gpuInputAssembler->attributes = _attributes; _gpuInputAssembler->gpuVertexBuffers.resize(vbCount); - for (size_t i = 0u; i < vbCount; ++i) { - CCVKBuffer *vb = (CCVKBuffer *)_vertexBuffers[i]; + for (size_t i = 0U; i < vbCount; ++i) { + auto *vb = static_cast(_vertexBuffers[i]); _gpuInputAssembler->gpuVertexBuffers[i] = vb->gpuBuffer(); } @@ -74,17 +62,13 @@ bool CCVKInputAssembler::initialize(const InputAssemblerInfo &info) { _gpuInputAssembler->vertexBuffers.resize(vbCount); _gpuInputAssembler->vertexBufferOffsets.resize(vbCount); - for (size_t i = 0u; i < vbCount; i++) { - _gpuInputAssembler->vertexBuffers[i] = _gpuInputAssembler->gpuVertexBuffers[i]->vkBuffer; + for (size_t i = 0U; i < vbCount; i++) { + _gpuInputAssembler->vertexBuffers[i] = _gpuInputAssembler->gpuVertexBuffers[i]->vkBuffer; _gpuInputAssembler->vertexBufferOffsets[i] = _gpuInputAssembler->gpuVertexBuffers[i]->startOffset; } - - _attributesHash = computeAttributesHash(); - - return true; } -void CCVKInputAssembler::destroy() { +void CCVKInputAssembler::doDestroy() { if (_gpuInputAssembler) { _gpuInputAssembler->vertexBuffers.clear(); _gpuInputAssembler->vertexBufferOffsets.clear(); diff --git a/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h b/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h index 232e78531e..ddb2498516 100644 --- a/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h +++ b/native/cocos/renderer/gfx-vulkan/VKInputAssembler.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_INPUT_ASSEMBLER_H_ -#define CC_GFXVULKAN_INPUT_ASSEMBLER_H_ + +#pragma once + +#include "gfx-base/GFXInputAssembler.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class CCVKGPUInputAssembler; class CC_VULKAN_API CCVKInputAssembler final : public InputAssembler { public: - CCVKInputAssembler(Device *device); + CCVKInputAssembler(); ~CCVKInputAssembler(); -public: - bool initialize(const InputAssemblerInfo &info); - void destroy(); - CC_INLINE CCVKGPUInputAssembler *gpuInputAssembler() const { return _gpuInputAssembler; } -private: +protected: + void doInit(const InputAssemblerInfo &info) override; + void doDestroy() override; + CCVKGPUInputAssembler *_gpuInputAssembler = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp b/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp index 75643d8eca..c5a12aa904 100644 --- a/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommands.h" @@ -31,24 +33,18 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKPipelineLayout::CCVKPipelineLayout(Device *device) -: PipelineLayout(device) { -} +CCVKPipelineLayout::CCVKPipelineLayout() = default; CCVKPipelineLayout::~CCVKPipelineLayout() { + destroy(); } -bool CCVKPipelineLayout::initialize(const PipelineLayoutInfo &info) { - - _setLayouts = info.setLayouts; - +void CCVKPipelineLayout::doInit(const PipelineLayoutInfo & /*info*/) { _gpuPipelineLayout = CC_NEW(CCVKGPUPipelineLayout); - int offset = 0u; - for (uint i = 0u; i < _setLayouts.size(); i++) { - DescriptorSetLayout *setLayout = _setLayouts[i]; - CCASSERT(setLayout != nullptr, "SetLayout should not be nullptr."); - CCVKGPUDescriptorSetLayout *gpuSetLayout = ((CCVKDescriptorSetLayout *)setLayout)->gpuDescriptorSetLayout(); + int offset = 0U; + for (auto *setLayout : _setLayouts) { + CCVKGPUDescriptorSetLayout *gpuSetLayout = static_cast(setLayout)->gpuDescriptorSetLayout(); size_t dynamicCount = gpuSetLayout->dynamicBindings.size(); _gpuPipelineLayout->dynamicOffsetOffsets.push_back(offset); _gpuPipelineLayout->setLayouts.push_back(gpuSetLayout); @@ -57,15 +53,12 @@ bool CCVKPipelineLayout::initialize(const PipelineLayoutInfo &info) { _gpuPipelineLayout->dynamicOffsetOffsets.push_back(offset); _gpuPipelineLayout->dynamicOffsetCount = offset; - CCVKCmdFuncCreatePipelineLayout((CCVKDevice *)_device, _gpuPipelineLayout); - - return true; + cmdFuncCCVKCreatePipelineLayout(CCVKDevice::getInstance(), _gpuPipelineLayout); } -void CCVKPipelineLayout::destroy() { - +void CCVKPipelineLayout::doDestroy() { if (_gpuPipelineLayout) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuPipelineLayout); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuPipelineLayout); _gpuPipelineLayout = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h b/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h index e0565cbd3d..2162d8e7a5 100644 --- a/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h +++ b/native/cocos/renderer/gfx-vulkan/VKPipelineLayout.h @@ -1,29 +1,33 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_PIPELINE_LAYOUT_H_ #define CC_GFXVULKAN_PIPELINE_LAYOUT_H_ +#include "gfx-base/GFXPipelineLayout.h" + namespace cc { namespace gfx { @@ -31,16 +35,15 @@ class CCVKGPUPipelineLayout; class CC_VULKAN_API CCVKPipelineLayout final : public PipelineLayout { public: - CCVKPipelineLayout(Device *device); + CCVKPipelineLayout(); ~CCVKPipelineLayout(); -public: - virtual bool initialize(const PipelineLayoutInfo &info) override; - virtual void destroy() override; - CC_INLINE CCVKGPUPipelineLayout *gpuPipelineLayout() const { return _gpuPipelineLayout; } -private: +protected: + void doInit(const PipelineLayoutInfo &info) override; + void doDestroy() override; + CCVKGPUPipelineLayout *_gpuPipelineLayout = nullptr; }; diff --git a/native/cocos/renderer/gfx-vulkan/VKPipelineState.cpp b/native/cocos/renderer/gfx-vulkan/VKPipelineState.cpp index 22438d041b..d47b63d607 100644 --- a/native/cocos/renderer/gfx-vulkan/VKPipelineState.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKPipelineState.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommands.h" @@ -33,48 +35,41 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKPipelineState::CCVKPipelineState(Device *device) -: PipelineState(device) { -} +CCVKPipelineState::CCVKPipelineState() = default; CCVKPipelineState::~CCVKPipelineState() { + destroy(); } -bool CCVKPipelineState::initialize(const PipelineStateInfo &info) { - _primitive = info.primitive; - _shader = info.shader; - _inputState = info.inputState; - _rasterizerState = info.rasterizerState; - _depthStencilState = info.depthStencilState; - _blendState = info.blendState; - _dynamicStates = info.dynamicStates; - _renderPass = info.renderPass; - _pipelineLayout = info.pipelineLayout; - - _gpuPipelineState = CC_NEW(CCVKGPUPipelineState); - _gpuPipelineState->primitive = _primitive; - _gpuPipelineState->gpuShader = ((CCVKShader *)_shader)->gpuShader(); - _gpuPipelineState->inputState = _inputState; - _gpuPipelineState->rs = _rasterizerState; - _gpuPipelineState->dss = _depthStencilState; - _gpuPipelineState->bs = _blendState; - _gpuPipelineState->gpuRenderPass = ((CCVKRenderPass *)_renderPass)->gpuRenderPass(); - _gpuPipelineState->gpuPipelineLayout = ((CCVKPipelineLayout *)_pipelineLayout)->gpuPipelineLayout(); +void CCVKPipelineState::doInit(const PipelineStateInfo & /*info*/) { + _gpuPipelineState = CC_NEW(CCVKGPUPipelineState); + _gpuPipelineState->bindPoint = _bindPoint; + _gpuPipelineState->primitive = _primitive; + _gpuPipelineState->gpuShader = static_cast(_shader)->gpuShader(); + _gpuPipelineState->inputState = _inputState; + _gpuPipelineState->rs = _rasterizerState; + _gpuPipelineState->dss = _depthStencilState; + _gpuPipelineState->bs = _blendState; + _gpuPipelineState->subpass = _subpass; + _gpuPipelineState->gpuPipelineLayout = static_cast(_pipelineLayout)->gpuPipelineLayout(); + if (_renderPass) _gpuPipelineState->gpuRenderPass = static_cast(_renderPass)->gpuRenderPass(); for (uint i = 0; i < 31; i++) { - if ((uint)_dynamicStates & (1 << i)) { - _gpuPipelineState->dynamicStates.push_back((DynamicStateFlagBit)(1 << i)); + if (static_cast(_dynamicStates) & (1 << i)) { + _gpuPipelineState->dynamicStates.push_back(static_cast(1 << i)); } } - CCVKCmdFuncCreatePipelineState((CCVKDevice *)_device, _gpuPipelineState); - - return true; + if (_bindPoint == PipelineBindPoint::GRAPHICS) { + cmdFuncCCVKCreateGraphicsPipelineState(CCVKDevice::getInstance(), _gpuPipelineState); + } else { + cmdFuncCCVKCreateComputePipelineState(CCVKDevice::getInstance(), _gpuPipelineState); + } } -void CCVKPipelineState::destroy() { +void CCVKPipelineState::doDestroy() { if (_gpuPipelineState) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuPipelineState); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuPipelineState); _gpuPipelineState = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKPipelineState.h b/native/cocos/renderer/gfx-vulkan/VKPipelineState.h index d2c93ac694..9b5a8529c4 100644 --- a/native/cocos/renderer/gfx-vulkan/VKPipelineState.h +++ b/native/cocos/renderer/gfx-vulkan/VKPipelineState.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_PIPELINE_STATE_H_ -#define CC_GFXVULKAN_PIPELINE_STATE_H_ + +#pragma once + +#include "gfx-base/GFXPipelineState.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class CCVKGPUPipelineState; class CC_VULKAN_API CCVKPipelineState final : public PipelineState { public: - CCVKPipelineState(Device *device); + CCVKPipelineState(); ~CCVKPipelineState(); -public: - bool initialize(const PipelineStateInfo &info); - void destroy(); - CC_INLINE CCVKGPUPipelineState *gpuPipelineState() const { return _gpuPipelineState; } -private: +protected: + void doInit(const PipelineStateInfo &info) override; + void doDestroy() override; + CCVKGPUPipelineState *_gpuPipelineState = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKQueue.cpp b/native/cocos/renderer/gfx-vulkan/VKQueue.cpp index 6c61c7f41b..cb57c34e2e 100644 --- a/native/cocos/renderer/gfx-vulkan/VKQueue.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKQueue.cpp @@ -1,56 +1,51 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommandBuffer.h" #include "VKCommands.h" #include "VKDevice.h" -#include "VKFence.h" #include "VKQueue.h" namespace cc { namespace gfx { -CCVKQueue::CCVKQueue(Device *device) -: Queue(device) { -} +CCVKQueue::CCVKQueue() = default; CCVKQueue::~CCVKQueue() { + destroy(); } -bool CCVKQueue::initialize(const QueueInfo &info) { - _type = info.type; - _isAsync = true; - - _gpuQueue = CC_NEW(CCVKGPUQueue); +void CCVKQueue::doInit(const QueueInfo & /*info*/) { + _gpuQueue = CC_NEW(CCVKGPUQueue); _gpuQueue->type = _type; - CCVKCmdFuncGetDeviceQueue((CCVKDevice *)_device, _gpuQueue); - - return true; + cmdFuncCCVKGetDeviceQueue(CCVKDevice::getInstance(), _gpuQueue); } -void CCVKQueue::destroy() { +void CCVKQueue::doDestroy() { if (_gpuQueue) { _gpuQueue->vkQueue = VK_NULL_HANDLE; CC_DELETE(_gpuQueue); @@ -58,13 +53,20 @@ void CCVKQueue::destroy() { } } -void CCVKQueue::submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence) { - CCVKDevice *device = (CCVKDevice *)_device; +void CCVKQueue::submit(CommandBuffer *const *cmdBuffs, uint count) { + CCVKDevice *device = CCVKDevice::getInstance(); _gpuQueue->commandBuffers.clear(); - device->gpuTransportHub()->depart(); - for (uint i = 0u; i < count; ++i) { - CCVKCommandBuffer *cmdBuff = (CCVKCommandBuffer *)cmdBuffs[i]; +#if BARRIER_DEDUCTION_LEVEL >= BARRIER_DEDUCTION_LEVEL_BASIC + device->gpuBarrierManager()->update(device->gpuTransportHub()); +#endif + + if (!device->gpuTransportHub()->empty()) { + _gpuQueue->commandBuffers.push(device->gpuTransportHub()->packageForFlight()); + } + + for (uint i = 0U; i < count; ++i) { + auto *cmdBuff = static_cast(cmdBuffs[i]); if (!cmdBuff->_pendingQueue.empty()) { _gpuQueue->commandBuffers.push(cmdBuff->_pendingQueue.front()); cmdBuff->_pendingQueue.pop(); @@ -76,18 +78,18 @@ void CCVKQueue::submit(const CommandBuffer *const *cmdBuffs, uint count, Fence * } VkSubmitInfo submitInfo{VK_STRUCTURE_TYPE_SUBMIT_INFO}; - submitInfo.waitSemaphoreCount = _gpuQueue->nextWaitSemaphore ? 1 : 0; - submitInfo.pWaitSemaphores = &_gpuQueue->nextWaitSemaphore; - submitInfo.pWaitDstStageMask = &_gpuQueue->submitStageMask; - submitInfo.commandBufferCount = _gpuQueue->commandBuffers.size(); - submitInfo.pCommandBuffers = &_gpuQueue->commandBuffers[0]; + submitInfo.waitSemaphoreCount = _gpuQueue->nextWaitSemaphore ? 1 : 0; + submitInfo.pWaitSemaphores = &_gpuQueue->nextWaitSemaphore; + submitInfo.pWaitDstStageMask = &_gpuQueue->submitStageMask; + submitInfo.commandBufferCount = _gpuQueue->commandBuffers.size(); + submitInfo.pCommandBuffers = &_gpuQueue->commandBuffers[0]; submitInfo.signalSemaphoreCount = _gpuQueue->nextSignalSemaphore ? 1 : 0; - submitInfo.pSignalSemaphores = &_gpuQueue->nextSignalSemaphore; + submitInfo.pSignalSemaphores = &_gpuQueue->nextSignalSemaphore; - VkFence vkFence = fence ? ((CCVKFence *)fence)->gpuFence()->vkFence : device->gpuFencePool()->alloc(); + VkFence vkFence = device->gpuFencePool()->alloc(); VK_CHECK(vkQueueSubmit(_gpuQueue->vkQueue, 1, &submitInfo, vkFence)); - _gpuQueue->nextWaitSemaphore = _gpuQueue->nextSignalSemaphore; + _gpuQueue->nextWaitSemaphore = _gpuQueue->nextSignalSemaphore; _gpuQueue->nextSignalSemaphore = device->gpuSemaphorePool()->alloc(); } diff --git a/native/cocos/renderer/gfx-vulkan/VKQueue.h b/native/cocos/renderer/gfx-vulkan/VKQueue.h index e850a8ca4c..3bba692b89 100644 --- a/native/cocos/renderer/gfx-vulkan/VKQueue.h +++ b/native/cocos/renderer/gfx-vulkan/VKQueue.h @@ -1,28 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_QUEUE_H_ -#define CC_GFXVULKAN_QUEUE_H_ + +#pragma once + +#include "VKStd.h" +#include "gfx-base/GFXQueue.h" namespace cc { namespace gfx { @@ -31,20 +35,21 @@ class CCVKGPUQueue; class CC_VULKAN_API CCVKQueue final : public Queue { public: - CCVKQueue(Device *device); - ~CCVKQueue(); + CCVKQueue(); + ~CCVKQueue() override; - friend class CCVKDevice; - -public: - bool initialize(const QueueInfo &info); - void destroy(); - void submit(const CommandBuffer *const *cmdBuffs, uint count, Fence *fence); + void submit(CommandBuffer *const *cmdBuffs, uint count) override; CC_INLINE CCVKGPUQueue *gpuQueue() const { return _gpuQueue; } -private: - CCVKGPUQueue *_gpuQueue; +protected: + friend class CCVKDevice; + + void doInit(const QueueInfo &info) override; + void doDestroy() override; + + CCVKGPUQueue *_gpuQueue = nullptr; + uint _numDrawCalls = 0; uint _numInstances = 0; uint _numTriangles = 0; @@ -52,5 +57,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKRenderPass.cpp b/native/cocos/renderer/gfx-vulkan/VKRenderPass.cpp index 5c533c9da0..62829c922b 100644 --- a/native/cocos/renderer/gfx-vulkan/VKRenderPass.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKRenderPass.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommands.h" @@ -30,32 +32,24 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKRenderPass::CCVKRenderPass(Device *device) -: RenderPass(device) { -} +CCVKRenderPass::CCVKRenderPass() = default; CCVKRenderPass::~CCVKRenderPass() { + destroy(); } -bool CCVKRenderPass::initialize(const RenderPassInfo &info) { - _colorAttachments = info.colorAttachments; - _depthStencilAttachment = info.depthStencilAttachment; - _subPasses = info.subPasses; - - _gpuRenderPass = CC_NEW(CCVKGPURenderPass); - _gpuRenderPass->colorAttachments = _colorAttachments; +void CCVKRenderPass::doInit(const RenderPassInfo& /*info*/) { + _gpuRenderPass = CC_NEW(CCVKGPURenderPass); + _gpuRenderPass->colorAttachments = _colorAttachments; _gpuRenderPass->depthStencilAttachment = _depthStencilAttachment; - _gpuRenderPass->subPasses = _subPasses; - CCVKCmdFuncCreateRenderPass((CCVKDevice *)_device, _gpuRenderPass); - - _hash = computeHash(); - - return true; + _gpuRenderPass->subpasses = _subpasses; + _gpuRenderPass->dependencies = _dependencies; + cmdFuncCCVKCreateRenderPass(CCVKDevice::getInstance(), _gpuRenderPass); } -void CCVKRenderPass::destroy() { +void CCVKRenderPass::doDestroy() { if (_gpuRenderPass) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuRenderPass); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuRenderPass); _gpuRenderPass = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKRenderPass.h b/native/cocos/renderer/gfx-vulkan/VKRenderPass.h index f739bf3d9d..1574c5384b 100644 --- a/native/cocos/renderer/gfx-vulkan/VKRenderPass.h +++ b/native/cocos/renderer/gfx-vulkan/VKRenderPass.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_RENDER_PASS_H_ -#define CC_GFXVULKAN_RENDER_PASS_H_ + +#pragma once + +#include "gfx-base/GFXRenderPass.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class CCVKGPURenderPass; class CC_VULKAN_API CCVKRenderPass final : public RenderPass { public: - CCVKRenderPass(Device *device); + CCVKRenderPass(); ~CCVKRenderPass(); -public: - bool initialize(const RenderPassInfo &info); - void destroy(); - CC_INLINE CCVKGPURenderPass *gpuRenderPass() const { return _gpuRenderPass; } -private: +protected: + void doInit(const RenderPassInfo &info) override; + void doDestroy() override; + CCVKGPURenderPass *_gpuRenderPass = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKSPIRV.h b/native/cocos/renderer/gfx-vulkan/VKSPIRV.h index 0163e3e18d..923a4a777a 100644 --- a/native/cocos/renderer/gfx-vulkan/VKSPIRV.h +++ b/native/cocos/renderer/gfx-vulkan/VKSPIRV.h @@ -1,30 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_SPIRV_H_ -#define CC_GFXVULKAN_SPIRV_H_ -#include "SPIRV/GlslangToSpv.h" +#pragma once + +#include "glslang/SPIRV/GlslangToSpv.h" #include "glslang/Public/ShaderLang.h" #include "StandAlone/ResourceLimits.h" @@ -117,5 +118,3 @@ const vector GLSL2SPIRV(ShaderStageFlagBit type, const String &sou } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKSampler.cpp b/native/cocos/renderer/gfx-vulkan/VKSampler.cpp index 702cf0fa76..d314afd3c6 100644 --- a/native/cocos/renderer/gfx-vulkan/VKSampler.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKSampler.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommands.h" @@ -30,27 +32,13 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKSampler::CCVKSampler(Device *device) -: Sampler(device) { -} +CCVKSampler::CCVKSampler() = default; CCVKSampler::~CCVKSampler() { + destroy(); } -bool CCVKSampler::initialize(const SamplerInfo &info) { - _minFilter = info.minFilter; - _magFilter = info.magFilter; - _mipFilter = info.mipFilter; - _addressU = info.addressU; - _addressV = info.addressV; - _addressW = info.addressW; - _maxAnisotropy = info.maxAnisotropy; - _cmpFunc = info.cmpFunc; - _borderColor = info.borderColor; - _minLOD = info.minLOD; - _maxLOD = info.maxLOD; - _mipLODBias = info.mipLODBias; - +void CCVKSampler::doInit(const SamplerInfo & /*info*/) { _gpuSampler = CC_NEW(CCVKGPUSampler); _gpuSampler->minFilter = _minFilter; _gpuSampler->magFilter = _magFilter; @@ -61,19 +49,15 @@ bool CCVKSampler::initialize(const SamplerInfo &info) { _gpuSampler->maxAnisotropy = _maxAnisotropy; _gpuSampler->cmpFunc = _cmpFunc; _gpuSampler->borderColor = _borderColor; - _gpuSampler->minLOD = _minLOD; - _gpuSampler->maxLOD = _maxLOD; _gpuSampler->mipLODBias = _mipLODBias; - CCVKCmdFuncCreateSampler((CCVKDevice *)_device, _gpuSampler); - - return true; + cmdFuncCCVKCreateSampler(CCVKDevice::getInstance(), _gpuSampler); } -void CCVKSampler::destroy() { +void CCVKSampler::doDestroy() { if (_gpuSampler) { - ((CCVKDevice *)_device)->gpuDescriptorHub()->disengage(_gpuSampler); - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuSampler); + CCVKDevice::getInstance()->gpuDescriptorHub()->disengage(_gpuSampler); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuSampler); _gpuSampler = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKSampler.h b/native/cocos/renderer/gfx-vulkan/VKSampler.h index e76f1e1ed6..0dd10b9124 100644 --- a/native/cocos/renderer/gfx-vulkan/VKSampler.h +++ b/native/cocos/renderer/gfx-vulkan/VKSampler.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_SAMPLER_H_ -#define CC_GFXVULKAN_SAMPLER_H_ + +#pragma once + +#include "gfx-base/GFXSampler.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class CCVKGPUSampler; class CC_VULKAN_API CCVKSampler final : public Sampler { public: - CCVKSampler(Device *device); + CCVKSampler(); ~CCVKSampler(); -public: - bool initialize(const SamplerInfo &info); - void destroy(); - CC_INLINE CCVKGPUSampler *gpuSampler() const { return _gpuSampler; } -private: +protected: + void doInit(const SamplerInfo &info) override; + void doDestroy() override; + CCVKGPUSampler *_gpuSampler = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKShader.cpp b/native/cocos/renderer/gfx-vulkan/VKShader.cpp index d43d0eca97..6272727634 100644 --- a/native/cocos/renderer/gfx-vulkan/VKShader.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKShader.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" #include "VKCommands.h" @@ -30,20 +32,13 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKShader::CCVKShader(Device *device) -: Shader(device) { -} +CCVKShader::CCVKShader() = default; CCVKShader::~CCVKShader() { + destroy(); } -bool CCVKShader::initialize(const ShaderInfo &info) { - _name = info.name; - _stages = info.stages; - _attributes = info.attributes; - _blocks = info.blocks; - _samplers = info.samplers; - +void CCVKShader::doInit(const ShaderInfo & /*info*/) { _gpuShader = CC_NEW(CCVKGPUShader); _gpuShader->name = _name; _gpuShader->attributes = _attributes; @@ -53,14 +48,12 @@ bool CCVKShader::initialize(const ShaderInfo &info) { _gpuShader->gpuStages.push_back({stage.stage, stage.source}); } - CCVKCmdFuncCreateShader((CCVKDevice *)_device, _gpuShader); - - return true; + cmdFuncCCVKCreateShader(CCVKDevice::getInstance(), _gpuShader); } -void CCVKShader::destroy() { +void CCVKShader::doDestroy() { if (_gpuShader) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuShader); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuShader); _gpuShader = nullptr; } } diff --git a/native/cocos/renderer/gfx-vulkan/VKShader.h b/native/cocos/renderer/gfx-vulkan/VKShader.h index e6107f92b9..144598e628 100644 --- a/native/cocos/renderer/gfx-vulkan/VKShader.h +++ b/native/cocos/renderer/gfx-vulkan/VKShader.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_SHADER_H_ -#define CC_GFXVULKAN_SHADER_H_ + +#pragma once + +#include "gfx-base/GFXShader.h" namespace cc { namespace gfx { @@ -31,20 +34,17 @@ class CCVKGPUShader; class CC_VULKAN_API CCVKShader final : public Shader { public: - CCVKShader(Device *device); + CCVKShader(); ~CCVKShader(); -public: - bool initialize(const ShaderInfo &info); - void destroy(); - CC_INLINE CCVKGPUShader *gpuShader() const { return _gpuShader; } -private: +protected: + void doInit(const ShaderInfo &info) override; + void doDestroy() override; + CCVKGPUShader *_gpuShader = nullptr; }; } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKStd.cpp b/native/cocos/renderer/gfx-vulkan/VKStd.cpp index 0a24f32f40..1fd9a74a38 100644 --- a/native/cocos/renderer/gfx-vulkan/VKStd.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKStd.cpp @@ -1,24 +1,26 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" diff --git a/native/cocos/renderer/gfx-vulkan/VKStd.h b/native/cocos/renderer/gfx-vulkan/VKStd.h index 0d3135fc2f..d65dd00963 100644 --- a/native/cocos/renderer/gfx-vulkan/VKStd.h +++ b/native/cocos/renderer/gfx-vulkan/VKStd.h @@ -1,30 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __CC_GFXVULKAN_VK_STD_H__ -#define __CC_GFXVULKAN_VK_STD_H__ -#include +#pragma once + +#include "base/CoreStd.h" #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #if defined(CC_STATIC) @@ -46,12 +47,10 @@ THE SOFTWARE. VkResult err = x; \ if (err) { \ CC_LOG_ERROR("%s returned Vulkan error: %d", #x, err); \ - CCASSERT(0, "Vulkan Error"); \ + CCASSERT(false, "Vulkan Error"); \ } \ } while (0) #else #define VK_CHECK(x) x #endif - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKTexture.cpp b/native/cocos/renderer/gfx-vulkan/VKTexture.cpp index d82afe2772..0d4c4e036a 100644 --- a/native/cocos/renderer/gfx-vulkan/VKTexture.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKTexture.cpp @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "VKStd.h" +#include "VKCommandBuffer.h" #include "VKCommands.h" #include "VKDevice.h" #include "VKTexture.h" @@ -30,185 +33,78 @@ THE SOFTWARE. namespace cc { namespace gfx { -CCVKTexture::CCVKTexture(Device *device) -: Texture(device) { -} +CCVKTexture::CCVKTexture() = default; CCVKTexture::~CCVKTexture() { + destroy(); } -bool CCVKTexture::initialize(const TextureInfo &info) { - _type = info.type; - _usage = info.usage; - _format = info.format; - _width = info.width; - _height = info.height; - _depth = info.depth; - _layerCount = info.layerCount; - _levelCount = info.levelCount; - _samples = info.samples; - _flags = info.flags; - _size = FormatSize(_format, _width, _height, _depth); - -#if CC_DEBUG > 0 - switch (_format) { // device feature validation - case Format::D16: - if (_device->hasFeature(Feature::FORMAT_D16)) break; - CC_LOG_ERROR("D16 texture format is not supported on this backend"); - return false; - case Format::D16S8: - if (_device->hasFeature(Feature::FORMAT_D16S8)) break; - CC_LOG_WARNING("D16S8 texture format is not supported on this backend"); - return false; - case Format::D24: - if (_device->hasFeature(Feature::FORMAT_D24)) break; - CC_LOG_WARNING("D24 texture format is not supported on this backend"); - return false; - case Format::D24S8: - if (_device->hasFeature(Feature::FORMAT_D24S8)) break; - CC_LOG_WARNING("D24S8 texture format is not supported on this backend"); - return false; - case Format::D32F: - if (_device->hasFeature(Feature::FORMAT_D32F)) break; - CC_LOG_WARNING("D32F texture format is not supported on this backend"); - return false; - case Format::D32F_S8: - if (_device->hasFeature(Feature::FORMAT_D32FS8)) break; - CC_LOG_WARNING("D32FS8 texture format is not supported on this backend"); - return false; - case Format::RGB8: - if (_device->hasFeature(Feature::FORMAT_RGB8)) break; - CC_LOG_WARNING("RGB8 texture format is not supported on this backend"); - return false; - default: break; - } -#endif - - if (_flags & TextureFlags::BAKUP_BUFFER) { - _buffer = (uint8_t *)CC_MALLOC(_size); - _device->getMemoryStatus().textureSize += _size; - } - - _gpuTexture = CC_NEW(CCVKGPUTexture); - _gpuTexture->type = _type; - _gpuTexture->format = _format; - _gpuTexture->usage = _usage; - _gpuTexture->width = _width; - _gpuTexture->height = _height; - _gpuTexture->depth = _depth; - _gpuTexture->size = _size; +void CCVKTexture::doInit(const TextureInfo & /*info*/) { + _gpuTexture = CC_NEW(CCVKGPUTexture); + _gpuTexture->type = _type; + _gpuTexture->format = _format; + _gpuTexture->usage = _usage; + _gpuTexture->width = _width; + _gpuTexture->height = _height; + _gpuTexture->depth = _depth; + _gpuTexture->size = _size; _gpuTexture->arrayLayers = _layerCount; - _gpuTexture->mipLevels = _levelCount; - _gpuTexture->samples = _samples; - _gpuTexture->flags = _flags; - _gpuTexture->isPowerOf2 = math::IsPowerOfTwo(_width) && math::IsPowerOfTwo(_height); + _gpuTexture->mipLevels = _levelCount; + _gpuTexture->samples = _samples; + _gpuTexture->flags = _flags; - CCVKCmdFuncCreateTexture((CCVKDevice *)_device, _gpuTexture); - _device->getMemoryStatus().textureSize += _size; + cmdFuncCCVKCreateTexture(CCVKDevice::getInstance(), _gpuTexture); _gpuTextureView = CC_NEW(CCVKGPUTextureView); createTextureView(); - - return true; } -bool CCVKTexture::initialize(const TextureViewInfo &info) { - _isTextureView = true; - - if (!info.texture) { - return false; - } - - _type = info.texture->getType(); - _format = info.format; - _baseLayer = info.baseLayer; - _layerCount = info.layerCount; - _baseLevel = info.baseLevel; - _levelCount = info.levelCount; - _usage = info.texture->getUsage(); - _width = info.texture->getWidth(); - _height = info.texture->getHeight(); - _depth = info.texture->getDepth(); - _samples = info.texture->getSamples(); - _flags = info.texture->getFlags(); - _size = FormatSize(_format, _width, _height, _depth); - - _gpuTexture = ((CCVKTexture *)info.texture)->gpuTexture(); +void CCVKTexture::doInit(const TextureViewInfo &info) { + _gpuTexture = static_cast(info.texture)->gpuTexture(); _gpuTextureView = CC_NEW(CCVKGPUTextureView); createTextureView(); - - return true; } void CCVKTexture::createTextureView() { _gpuTextureView->gpuTexture = _gpuTexture; - _gpuTextureView->type = _type; - _gpuTextureView->format = _format; - _gpuTextureView->baseLevel = _baseLevel; + _gpuTextureView->type = _type; + _gpuTextureView->format = _format; + _gpuTextureView->baseLevel = _baseLevel; _gpuTextureView->levelCount = _levelCount; - _gpuTextureView->baseLayer = _baseLayer; + _gpuTextureView->baseLayer = _baseLayer; _gpuTextureView->layerCount = _layerCount; - CCVKCmdFuncCreateTextureView((CCVKDevice *)_device, _gpuTextureView); + cmdFuncCCVKCreateTextureView(CCVKDevice::getInstance(), _gpuTextureView); } -void CCVKTexture::destroy() { +void CCVKTexture::doDestroy() { if (_gpuTextureView) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuTextureView); - ((CCVKDevice *)_device)->gpuDescriptorHub()->disengage(_gpuTextureView); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuTextureView); + CCVKDevice::getInstance()->gpuDescriptorHub()->disengage(_gpuTextureView); CC_DELETE(_gpuTextureView); _gpuTextureView = nullptr; } if (_gpuTexture) { if (!_isTextureView) { - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuTexture); - _device->getMemoryStatus().textureSize -= _size; + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuTexture); + CCVKDevice::getInstance()->gpuBarrierManager()->cancel(_gpuTexture); CC_DELETE(_gpuTexture); } _gpuTexture = nullptr; } - - if (_buffer) { - CC_FREE(_buffer); - _device->getMemoryStatus().textureSize -= _size; - _buffer = nullptr; - } } -void CCVKTexture::resize(uint width, uint height) { - CCASSERT(!_isTextureView, "Cannot resize texture views"); - - if (_width != width || _height != height) { - uint size = FormatSize(_format, width, height, _depth); - const uint old_size = _size; - _width = width; - _height = height; - _size = size; +void CCVKTexture::doResize(uint width, uint height, uint size) { + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuTextureView); + CCVKDevice::getInstance()->gpuRecycleBin()->collect(_gpuTexture); - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuTextureView); - ((CCVKDevice *)_device)->gpuRecycleBin()->collect(_gpuTexture); + _gpuTexture->width = width; + _gpuTexture->height = height; + _gpuTexture->size = size; + cmdFuncCCVKCreateTexture(CCVKDevice::getInstance(), _gpuTexture); - MemoryStatus &status = _device->getMemoryStatus(); - _gpuTexture->width = _width; - _gpuTexture->height = _height; - _gpuTexture->size = _size; - - CCVKCmdFuncCreateTexture((CCVKDevice *)_device, _gpuTexture); - status.bufferSize -= old_size; - status.bufferSize += _size; - - CCVKCmdFuncCreateTextureView((CCVKDevice *)_device, _gpuTextureView); - - if (_buffer) { - const uint8_t *old_buff = _buffer; - _buffer = (uint8_t *)CC_MALLOC(_size); - memcpy(_buffer, old_buff, old_size); - CC_FREE(_buffer); - status.bufferSize -= old_size; - status.bufferSize += _size; - } - } + cmdFuncCCVKCreateTextureView(CCVKDevice::getInstance(), _gpuTextureView); } } // namespace gfx diff --git a/native/cocos/renderer/gfx-vulkan/VKTexture.h b/native/cocos/renderer/gfx-vulkan/VKTexture.h index cc5f7171e0..b5d47ab000 100644 --- a/native/cocos/renderer/gfx-vulkan/VKTexture.h +++ b/native/cocos/renderer/gfx-vulkan/VKTexture.h @@ -1,28 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_TEXTURE_H_ -#define CC_GFXVULKAN_TEXTURE_H_ + +#pragma once + +#include "gfx-base/GFXTexture.h" namespace cc { namespace gfx { @@ -32,19 +35,18 @@ class CCVKGPUTextureView; class CC_VULKAN_API CCVKTexture final : public Texture { public: - CCVKTexture(Device *device); + CCVKTexture(); ~CCVKTexture(); -public: - bool initialize(const TextureInfo &info); - bool initialize(const TextureViewInfo &info); - void destroy(); - void resize(uint width, uint height); - CC_INLINE CCVKGPUTexture *gpuTexture() const { return _gpuTexture; } CC_INLINE CCVKGPUTextureView *gpuTextureView() const { return _gpuTextureView; } -private: +protected: + void doInit(const TextureInfo &info) override; + void doInit(const TextureViewInfo &info) override; + void doDestroy() override; + void doResize(uint width, uint height, uint size) override; + void createTextureView(); CCVKGPUTexture *_gpuTexture = nullptr; @@ -53,5 +55,3 @@ private: } // namespace gfx } // namespace cc - -#endif diff --git a/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.cpp b/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.cpp new file mode 100644 index 0000000000..bd8aa92de0 --- /dev/null +++ b/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "VKStd.h" + +#include "VKGPUObjects.h" +#include "VKQueue.h" +#include "VKTextureBarrier.h" + +namespace cc { +namespace gfx { + +CCVKTextureBarrier::CCVKTextureBarrier() = default; + +CCVKTextureBarrier::~CCVKTextureBarrier() { + CC_SAFE_DELETE(_gpuBarrier); +} + +void CCVKTextureBarrier::doInit(const TextureBarrierInfo &info) { + _gpuBarrier = CC_NEW(CCVKGPUTextureBarrier); + _gpuBarrier->accessTypes.resize(info.prevAccesses.size() + info.nextAccesses.size()); + + uint index = 0U; + for (AccessType type : info.prevAccesses) { + _gpuBarrier->accessTypes[index++] = THSVS_ACCESS_TYPES[static_cast(type)]; + } + for (AccessType type : info.nextAccesses) { + _gpuBarrier->accessTypes[index++] = THSVS_ACCESS_TYPES[static_cast(type)]; + } + + _gpuBarrier->barrier.prevAccessCount = info.prevAccesses.size(); + _gpuBarrier->barrier.pPrevAccesses = _gpuBarrier->accessTypes.data(); + _gpuBarrier->barrier.nextAccessCount = info.nextAccesses.size(); + _gpuBarrier->barrier.pNextAccesses = _gpuBarrier->accessTypes.data() + info.prevAccesses.size(); + + _gpuBarrier->barrier.prevLayout = _gpuBarrier->barrier.nextLayout = THSVS_IMAGE_LAYOUT_OPTIMAL; + _gpuBarrier->barrier.discardContents = info.discardContents; + _gpuBarrier->barrier.subresourceRange.baseMipLevel = 0U; + _gpuBarrier->barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; + _gpuBarrier->barrier.subresourceRange.baseArrayLayer = 0U; + _gpuBarrier->barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + _gpuBarrier->barrier.srcQueueFamilyIndex = info.srcQueue + ? static_cast(info.srcQueue)->gpuQueue()->queueFamilyIndex + : VK_QUEUE_FAMILY_IGNORED; + _gpuBarrier->barrier.dstQueueFamilyIndex = info.dstQueue + ? static_cast(info.dstQueue)->gpuQueue()->queueFamilyIndex + : VK_QUEUE_FAMILY_IGNORED; + + thsvsGetVulkanImageMemoryBarrier(_gpuBarrier->barrier, &_gpuBarrier->srcStageMask, &_gpuBarrier->dstStageMask, &_gpuBarrier->vkBarrier); +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h b/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h new file mode 100644 index 0000000000..7e1fcb75e4 --- /dev/null +++ b/native/cocos/renderer/gfx-vulkan/VKTextureBarrier.h @@ -0,0 +1,52 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 CC_GFXVULKAN_TEXTURE_BARRIER_H_ +#define CC_GFXVULKAN_TEXTURE_BARRIER_H_ + +#include "gfx-base/GFXTextureBarrier.h" + +namespace cc { +namespace gfx { + +class CCVKGPUTextureBarrier; + +class CC_DLL CCVKTextureBarrier : public TextureBarrier { +public: + CCVKTextureBarrier(); + ~CCVKTextureBarrier(); + + CC_INLINE const CCVKGPUTextureBarrier *gpuBarrier() const { return _gpuBarrier; } + +protected: + void doInit(const TextureBarrierInfo &info) override; + + CCVKGPUTextureBarrier *_gpuBarrier = nullptr; +}; + +} // namespace gfx +} // namespace cc + +#endif // CC_GFXVULKAN_TEXTURE_BARRIER_H_ diff --git a/native/cocos/renderer/gfx-vulkan/VKUtils.cpp b/native/cocos/renderer/gfx-vulkan/VKUtils.cpp new file mode 100644 index 0000000000..54be8ae427 --- /dev/null +++ b/native/cocos/renderer/gfx-vulkan/VKUtils.cpp @@ -0,0 +1,600 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "VKUtils.h" + +namespace cc { +namespace gfx { + +VkFormat mapVkFormat(Format format) { + switch (format) { + case Format::R8: return VK_FORMAT_R8_UNORM; + case Format::R8SN: return VK_FORMAT_R8_SNORM; + case Format::R8UI: return VK_FORMAT_R8_UINT; + case Format::R8I: return VK_FORMAT_R8_SINT; + case Format::RG8: return VK_FORMAT_R8G8_UNORM; + case Format::RG8SN: return VK_FORMAT_R8G8_SNORM; + case Format::RG8UI: return VK_FORMAT_R8G8_UINT; + case Format::RG8I: return VK_FORMAT_R8G8_SINT; + case Format::RGB8: return VK_FORMAT_R8G8B8_UNORM; + case Format::RGB8SN: return VK_FORMAT_R8G8B8_SNORM; + case Format::RGB8UI: return VK_FORMAT_R8G8B8_UINT; + case Format::RGB8I: return VK_FORMAT_R8G8B8_SINT; + case Format::RGBA8: return VK_FORMAT_R8G8B8A8_UNORM; + case Format::BGRA8: return VK_FORMAT_B8G8R8A8_UNORM; + case Format::SRGB8_A8: return VK_FORMAT_R8G8B8A8_SRGB; + case Format::RGBA8SN: return VK_FORMAT_R8G8B8A8_SNORM; + case Format::RGBA8UI: return VK_FORMAT_R8G8B8A8_UINT; + case Format::RGBA8I: return VK_FORMAT_R8G8B8A8_SINT; + case Format::R16I: return VK_FORMAT_R16_SINT; + case Format::R16UI: return VK_FORMAT_R16_UINT; + case Format::R16F: return VK_FORMAT_R16_SFLOAT; + case Format::RG16I: return VK_FORMAT_R16G16_SINT; + case Format::RG16UI: return VK_FORMAT_R16G16_UINT; + case Format::RG16F: return VK_FORMAT_R16G16_SFLOAT; + case Format::RGB16I: return VK_FORMAT_R16G16B16_SINT; + case Format::RGB16UI: return VK_FORMAT_R16G16B16_UINT; + case Format::RGB16F: return VK_FORMAT_R16G16B16_SFLOAT; + case Format::RGBA16I: return VK_FORMAT_R16G16B16A16_SINT; + case Format::RGBA16UI: return VK_FORMAT_R16G16B16A16_UINT; + case Format::RGBA16F: return VK_FORMAT_R16G16B16A16_SFLOAT; + case Format::R32I: return VK_FORMAT_R32_SINT; + case Format::R32UI: return VK_FORMAT_R32_UINT; + case Format::R32F: return VK_FORMAT_R32_SFLOAT; + case Format::RG32I: return VK_FORMAT_R32G32_SINT; + case Format::RG32UI: return VK_FORMAT_R32G32_UINT; + case Format::RG32F: return VK_FORMAT_R32G32_SFLOAT; + case Format::RGB32I: return VK_FORMAT_R32G32B32_SINT; + case Format::RGB32UI: return VK_FORMAT_R32G32B32_UINT; + case Format::RGB32F: return VK_FORMAT_R32G32B32_SFLOAT; + case Format::RGBA32I: return VK_FORMAT_R32G32B32A32_SINT; + case Format::RGBA32UI: return VK_FORMAT_R32G32B32A32_UINT; + case Format::RGBA32F: return VK_FORMAT_R32G32B32A32_SFLOAT; + + case Format::R5G6B5: return VK_FORMAT_R5G6B5_UNORM_PACK16; + case Format::R11G11B10F: return VK_FORMAT_B10G11R11_UFLOAT_PACK32; + case Format::RGB5A1: return VK_FORMAT_R5G5B5A1_UNORM_PACK16; + case Format::RGBA4: return VK_FORMAT_R4G4B4A4_UNORM_PACK16; + case Format::RGB10A2: return VK_FORMAT_A2B10G10R10_UNORM_PACK32; + case Format::RGB10A2UI: return VK_FORMAT_A2B10G10R10_UINT_PACK32; + case Format::RGB9E5: return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; + case Format::D16: return VK_FORMAT_D16_UNORM; + case Format::D16S8: return VK_FORMAT_D16_UNORM_S8_UINT; + case Format::D24: return VK_FORMAT_X8_D24_UNORM_PACK32; + case Format::D24S8: return VK_FORMAT_D24_UNORM_S8_UINT; + case Format::D32F: return VK_FORMAT_D32_SFLOAT; + case Format::D32F_S8: return VK_FORMAT_D32_SFLOAT_S8_UINT; + + case Format::BC1: return VK_FORMAT_BC1_RGB_UNORM_BLOCK; + case Format::BC1_ALPHA: return VK_FORMAT_BC1_RGBA_UNORM_BLOCK; + case Format::BC1_SRGB: return VK_FORMAT_BC1_RGB_SRGB_BLOCK; + case Format::BC1_SRGB_ALPHA: return VK_FORMAT_BC1_RGBA_SRGB_BLOCK; + case Format::BC2: return VK_FORMAT_BC2_UNORM_BLOCK; + case Format::BC2_SRGB: return VK_FORMAT_BC2_SRGB_BLOCK; + case Format::BC3: return VK_FORMAT_BC3_UNORM_BLOCK; + case Format::BC3_SRGB: return VK_FORMAT_BC3_SRGB_BLOCK; + case Format::BC4: return VK_FORMAT_BC4_UNORM_BLOCK; + case Format::BC4_SNORM: return VK_FORMAT_BC4_SNORM_BLOCK; + case Format::BC5: return VK_FORMAT_BC5_UNORM_BLOCK; + case Format::BC5_SNORM: return VK_FORMAT_BC5_SNORM_BLOCK; + case Format::BC6H_UF16: return VK_FORMAT_BC6H_UFLOAT_BLOCK; + case Format::BC6H_SF16: return VK_FORMAT_BC6H_SFLOAT_BLOCK; + case Format::BC7: return VK_FORMAT_BC7_UNORM_BLOCK; + case Format::BC7_SRGB: return VK_FORMAT_BC7_SRGB_BLOCK; + + case Format::ETC2_RGB8: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; + case Format::ETC2_SRGB8: return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; + case Format::ETC2_RGB8_A1: return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; + case Format::ETC2_SRGB8_A1: return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; + case Format::ETC2_RGBA8: return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; + case Format::ETC2_SRGB8_A8: return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; + case Format::EAC_R11: return VK_FORMAT_EAC_R11_UNORM_BLOCK; + case Format::EAC_R11SN: return VK_FORMAT_EAC_R11_SNORM_BLOCK; + case Format::EAC_RG11: return VK_FORMAT_EAC_R11G11_UNORM_BLOCK; + case Format::EAC_RG11SN: return VK_FORMAT_EAC_R11G11_SNORM_BLOCK; + + case Format::PVRTC_RGB2: + case Format::PVRTC_RGBA2: return VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG; + case Format::PVRTC_RGB4: + case Format::PVRTC_RGBA4: return VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG; + case Format::PVRTC2_2BPP: return VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG; + case Format::PVRTC2_4BPP: return VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG; + + case Format::ASTC_RGBA_4X4: return VK_FORMAT_ASTC_4x4_UNORM_BLOCK; + case Format::ASTC_RGBA_5X4: return VK_FORMAT_ASTC_5x4_UNORM_BLOCK; + case Format::ASTC_RGBA_5X5: return VK_FORMAT_ASTC_5x5_UNORM_BLOCK; + case Format::ASTC_RGBA_6X5: return VK_FORMAT_ASTC_6x5_UNORM_BLOCK; + case Format::ASTC_RGBA_6X6: return VK_FORMAT_ASTC_6x6_UNORM_BLOCK; + case Format::ASTC_RGBA_8X5: return VK_FORMAT_ASTC_8x5_UNORM_BLOCK; + case Format::ASTC_RGBA_8X6: return VK_FORMAT_ASTC_8x6_UNORM_BLOCK; + case Format::ASTC_RGBA_8X8: return VK_FORMAT_ASTC_8x8_UNORM_BLOCK; + case Format::ASTC_RGBA_10X5: return VK_FORMAT_ASTC_10x5_UNORM_BLOCK; + case Format::ASTC_RGBA_10X6: return VK_FORMAT_ASTC_10x6_UNORM_BLOCK; + case Format::ASTC_RGBA_10X8: return VK_FORMAT_ASTC_10x8_UNORM_BLOCK; + case Format::ASTC_RGBA_10X10: return VK_FORMAT_ASTC_10x10_UNORM_BLOCK; + case Format::ASTC_RGBA_12X10: return VK_FORMAT_ASTC_12x10_UNORM_BLOCK; + case Format::ASTC_RGBA_12X12: return VK_FORMAT_ASTC_12x12_UNORM_BLOCK; + + case Format::ASTC_SRGBA_4X4: return VK_FORMAT_ASTC_4x4_SRGB_BLOCK; + case Format::ASTC_SRGBA_5X4: return VK_FORMAT_ASTC_5x4_SRGB_BLOCK; + case Format::ASTC_SRGBA_5X5: return VK_FORMAT_ASTC_5x5_SRGB_BLOCK; + case Format::ASTC_SRGBA_6X5: return VK_FORMAT_ASTC_6x5_SRGB_BLOCK; + case Format::ASTC_SRGBA_6X6: return VK_FORMAT_ASTC_6x6_SRGB_BLOCK; + case Format::ASTC_SRGBA_8X5: return VK_FORMAT_ASTC_8x5_SRGB_BLOCK; + case Format::ASTC_SRGBA_8X6: return VK_FORMAT_ASTC_8x6_SRGB_BLOCK; + case Format::ASTC_SRGBA_8X8: return VK_FORMAT_ASTC_8x8_SRGB_BLOCK; + case Format::ASTC_SRGBA_10X5: return VK_FORMAT_ASTC_10x5_SRGB_BLOCK; + case Format::ASTC_SRGBA_10X6: return VK_FORMAT_ASTC_10x6_SRGB_BLOCK; + case Format::ASTC_SRGBA_10X8: return VK_FORMAT_ASTC_10x8_SRGB_BLOCK; + case Format::ASTC_SRGBA_10X10: return VK_FORMAT_ASTC_10x10_SRGB_BLOCK; + case Format::ASTC_SRGBA_12X10: return VK_FORMAT_ASTC_12x10_SRGB_BLOCK; + case Format::ASTC_SRGBA_12X12: return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; + + default: { + CCASSERT(false, "Unsupported Format, convert to VkFormat failed."); + return VK_FORMAT_B8G8R8A8_UNORM; + } + } +} + +VkAttachmentLoadOp mapVkLoadOp(LoadOp loadOp) { + switch (loadOp) { + case LoadOp::CLEAR: return VK_ATTACHMENT_LOAD_OP_CLEAR; + case LoadOp::LOAD: return VK_ATTACHMENT_LOAD_OP_LOAD; + case LoadOp::DISCARD: return VK_ATTACHMENT_LOAD_OP_DONT_CARE; + default: { + CCASSERT(false, "Unsupported LoadOp, convert to VkLoadOp failed."); + return VK_ATTACHMENT_LOAD_OP_LOAD; + } + } +} + +VkAttachmentStoreOp mapVkStoreOp(StoreOp storeOp) { + switch (storeOp) { + case StoreOp::STORE: return VK_ATTACHMENT_STORE_OP_STORE; + case StoreOp::DISCARD: return VK_ATTACHMENT_STORE_OP_DONT_CARE; + default: { + CCASSERT(false, "Unsupported StoreOp, convert to VkStoreOp failed."); + return VK_ATTACHMENT_STORE_OP_STORE; + } + } +} + +VkBufferUsageFlagBits mapVkBufferUsageFlagBits(BufferUsage usage) { + uint flags = 0U; + if (hasFlag(usage, BufferUsage::TRANSFER_SRC)) flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + if (hasFlag(usage, BufferUsage::TRANSFER_DST)) flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; + if (hasFlag(usage, BufferUsage::INDEX)) flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT; + if (hasFlag(usage, BufferUsage::VERTEX)) flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; + if (hasFlag(usage, BufferUsage::UNIFORM)) flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; + if (hasFlag(usage, BufferUsage::STORAGE)) flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; + if (hasFlag(usage, BufferUsage::INDIRECT)) flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; + return static_cast(flags); +} + +VkImageType mapVkImageType(TextureType type) { + switch (type) { + case TextureType::TEX1D: + case TextureType::TEX1D_ARRAY: return VK_IMAGE_TYPE_1D; + case TextureType::CUBE: + case TextureType::TEX2D: + case TextureType::TEX2D_ARRAY: return VK_IMAGE_TYPE_2D; + case TextureType::TEX3D: return VK_IMAGE_TYPE_3D; + default: { + CCASSERT(false, "Unsupported TextureType, convert to VkImageType failed."); + return VK_IMAGE_TYPE_2D; + } + } +} + +VkSampleCountFlagBits mapVkSampleCount(SampleCount count) { + switch (count) { + case SampleCount::X1: return VK_SAMPLE_COUNT_1_BIT; + case SampleCount::X2: return VK_SAMPLE_COUNT_2_BIT; + case SampleCount::X4: return VK_SAMPLE_COUNT_4_BIT; + case SampleCount::X8: return VK_SAMPLE_COUNT_8_BIT; + case SampleCount::X16: return VK_SAMPLE_COUNT_16_BIT; + case SampleCount::X32: return VK_SAMPLE_COUNT_32_BIT; + default: { + CCASSERT(false, "Unsupported TextureType, convert to VkImageType failed."); + return VK_SAMPLE_COUNT_1_BIT; + } + } +} + +VkFormatFeatureFlags mapVkFormatFeatureFlags(TextureUsage usage) { + uint flags = 0U; + if (hasFlag(usage, TextureUsage::TRANSFER_SRC)) flags |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT; + if (hasFlag(usage, TextureUsage::TRANSFER_DST)) flags |= VK_FORMAT_FEATURE_TRANSFER_DST_BIT; + if (hasFlag(usage, TextureUsage::SAMPLED)) flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + if (hasFlag(usage, TextureUsage::STORAGE)) flags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; + if (hasFlag(usage, TextureUsage::COLOR_ATTACHMENT)) flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + if (hasFlag(usage, TextureUsage::DEPTH_STENCIL_ATTACHMENT)) flags |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + if (hasFlag(usage, TextureUsage::INPUT_ATTACHMENT)) flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + return static_cast(flags); +} + +VkImageUsageFlagBits mapVkImageUsageFlagBits(TextureUsage usage) { + uint flags = 0U; + if (hasFlag(usage, TextureUsage::TRANSFER_SRC)) flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + if (hasFlag(usage, TextureUsage::TRANSFER_DST)) flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; + if (hasFlag(usage, TextureUsage::SAMPLED)) flags |= VK_IMAGE_USAGE_SAMPLED_BIT; + if (hasFlag(usage, TextureUsage::STORAGE)) flags |= VK_IMAGE_USAGE_STORAGE_BIT; + if (hasFlag(usage, TextureUsage::COLOR_ATTACHMENT)) flags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + if (hasFlag(usage, TextureUsage::DEPTH_STENCIL_ATTACHMENT)) flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + if (hasFlag(usage, TextureUsage::INPUT_ATTACHMENT)) flags |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT; + return static_cast(flags); +} + +VkImageAspectFlags mapVkImageAspectFlags(Format format) { + VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + const FormatInfo & info = GFX_FORMAT_INFOS[static_cast(format)]; + if (info.hasDepth) aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; + if (info.hasStencil) aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; + return aspectMask; +} + +VkImageCreateFlags mapVkImageCreateFlags(TextureType type) { + uint res = 0U; + switch (type) { + case TextureType::CUBE: res |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; break; + case TextureType::TEX2D_ARRAY: res |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; break; + default: break; + } + return static_cast(res); +} + +VkImageViewType mapVkImageViewType(TextureType viewType) { + switch (viewType) { + case TextureType::TEX1D: return VK_IMAGE_VIEW_TYPE_1D; + case TextureType::TEX1D_ARRAY: return VK_IMAGE_VIEW_TYPE_1D_ARRAY; + case TextureType::TEX2D: return VK_IMAGE_VIEW_TYPE_2D; + case TextureType::TEX2D_ARRAY: return VK_IMAGE_VIEW_TYPE_2D_ARRAY; + case TextureType::TEX3D: return VK_IMAGE_VIEW_TYPE_3D; + case TextureType::CUBE: return VK_IMAGE_VIEW_TYPE_CUBE; + default: { + CCASSERT(false, "Unsupported TextureViewType, convert to VkImageViewType failed."); + return VK_IMAGE_VIEW_TYPE_2D; + } + } +} + +VkCommandBufferLevel mapVkCommandBufferLevel(CommandBufferType type) { + switch (type) { + case CommandBufferType::PRIMARY: return VK_COMMAND_BUFFER_LEVEL_PRIMARY; + case CommandBufferType::SECONDARY: return VK_COMMAND_BUFFER_LEVEL_SECONDARY; + default: { + CCASSERT(false, "Unsupported CommandBufferType, convert to VkCommandBufferLevel failed."); + return VK_COMMAND_BUFFER_LEVEL_SECONDARY; + } + } +} + +VkDescriptorType mapVkDescriptorType(DescriptorType type) { + switch (type) { + case DescriptorType::DYNAMIC_UNIFORM_BUFFER: return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; + case DescriptorType::UNIFORM_BUFFER: return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; + case DescriptorType::DYNAMIC_STORAGE_BUFFER: return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; + case DescriptorType::STORAGE_BUFFER: return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + case DescriptorType::SAMPLER_TEXTURE: return VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + case DescriptorType::SAMPLER: return VK_DESCRIPTOR_TYPE_SAMPLER; + case DescriptorType::TEXTURE: return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; + case DescriptorType::STORAGE_IMAGE: return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + case DescriptorType::INPUT_ATTACHMENT: return VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT; + default: { + CCASSERT(false, "Unsupported DescriptorType, convert to VkDescriptorType failed."); + return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + } + } +} + +VkColorComponentFlags mapVkColorComponentFlags(ColorMask colorMask) { + uint flags = 0U; + if (hasFlag(colorMask, ColorMask::R)) flags |= VK_COLOR_COMPONENT_R_BIT; + if (hasFlag(colorMask, ColorMask::G)) flags |= VK_COLOR_COMPONENT_G_BIT; + if (hasFlag(colorMask, ColorMask::B)) flags |= VK_COLOR_COMPONENT_B_BIT; + if (hasFlag(colorMask, ColorMask::A)) flags |= VK_COLOR_COMPONENT_A_BIT; + return static_cast(flags); +} + +VkShaderStageFlagBits mapVkShaderStageFlagBits(ShaderStageFlagBit stage) { + switch (stage) { + case ShaderStageFlagBit::VERTEX: return VK_SHADER_STAGE_VERTEX_BIT; + case ShaderStageFlagBit::CONTROL: return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; + case ShaderStageFlagBit::EVALUATION: return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; + case ShaderStageFlagBit::GEOMETRY: return VK_SHADER_STAGE_GEOMETRY_BIT; + case ShaderStageFlagBit::FRAGMENT: return VK_SHADER_STAGE_FRAGMENT_BIT; + case ShaderStageFlagBit::COMPUTE: return VK_SHADER_STAGE_COMPUTE_BIT; + default: { + CCASSERT(false, "Unsupported ShaderStageFlagBit, convert to VkShaderStageFlagBits failed."); + return VK_SHADER_STAGE_VERTEX_BIT; + } + } +} + +VkShaderStageFlags mapVkShaderStageFlags(ShaderStageFlagBit stages) { + uint flags = 0U; + if (hasFlag(stages, ShaderStageFlagBit::VERTEX)) flags |= VK_SHADER_STAGE_VERTEX_BIT; + if (hasFlag(stages, ShaderStageFlagBit::CONTROL)) flags |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; + if (hasFlag(stages, ShaderStageFlagBit::EVALUATION)) flags |= VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; + if (hasFlag(stages, ShaderStageFlagBit::GEOMETRY)) flags |= VK_SHADER_STAGE_GEOMETRY_BIT; + if (hasFlag(stages, ShaderStageFlagBit::FRAGMENT)) flags |= VK_SHADER_STAGE_FRAGMENT_BIT; + if (hasFlag(stages, ShaderStageFlagBit::COMPUTE)) flags |= VK_SHADER_STAGE_COMPUTE_BIT; + return static_cast(flags); +} + +SurfaceTransform mapSurfaceTransform(VkSurfaceTransformFlagBitsKHR transform) { + if (transform & VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR) return SurfaceTransform::ROTATE_90; + if (transform & VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR) return SurfaceTransform::ROTATE_180; + if (transform & VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR) return SurfaceTransform::ROTATE_270; + return SurfaceTransform::IDENTITY; +} + +String mapVendorName(uint32_t vendorID) { + switch (vendorID) { + case 0x1002: return "Advanced Micro Devices, Inc."; + case 0x1010: return "Imagination Technologies"; + case 0x106b: return "Apple Inc."; + case 0x10DE: return "Nvidia Corporation"; + case 0x13B5: return "Arm Limited"; + case 0x5143: return "Qualcomm Incorporated"; + case 0x8086: return "Intel Corporation"; + } + return StringUtil::format("Unknown VendorID %d", vendorID); +} + +void mapDepthStencilBits(Format format, uint *pDepthBits, uint *pStencilBits) { + switch (format) { + case Format::D16: + *pDepthBits = 16; + *pStencilBits = 0; + break; + case Format::D16S8: + *pDepthBits = 16; + *pStencilBits = 8; + break; + case Format::D24: + *pDepthBits = 24; + *pStencilBits = 0; + break; + case Format::D24S8: + *pDepthBits = 24; + *pStencilBits = 8; + break; + case Format::D32F: + *pDepthBits = 32; + *pStencilBits = 0; + break; + case Format::D32F_S8: + *pDepthBits = 32; + *pStencilBits = 8; + break; + default: break; + } +} + +const VkSurfaceTransformFlagsKHR TRANSFORMS_THAT_REQUIRE_FLIPPING = + VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR | + VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR; + +const VkPrimitiveTopology VK_PRIMITIVE_MODES[] = { + VK_PRIMITIVE_TOPOLOGY_POINT_LIST, // POINT_LIST + VK_PRIMITIVE_TOPOLOGY_LINE_LIST, // LINE_LIST + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, // LINE_STRIP + static_cast(0), // LINE_LOOP + VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, // LINE_LIST_ADJACENCY + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY, // LINE_STRIP_ADJACENCY + static_cast(0), // ISO_LINE_LIST + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // TRIANGLE_LIST + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, // TRIANGLE_STRIP + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, // TRIANGLE_FAN + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY, // TRIANGLE_LIST_ADJACENCY + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY, // TRIANGLE_STRIP_ADJACENCY, + static_cast(0), // TRIANGLE_PATCH_ADJACENCY, + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, // QUAD_PATCH_LIST, +}; + +const VkCullModeFlags VK_CULL_MODES[] = { + VK_CULL_MODE_NONE, + VK_CULL_MODE_FRONT_BIT, + VK_CULL_MODE_BACK_BIT, +}; + +const VkPolygonMode VK_POLYGON_MODES[] = { + VK_POLYGON_MODE_FILL, + VK_POLYGON_MODE_LINE, + VK_POLYGON_MODE_POINT, +}; + +const VkCompareOp VK_CMP_FUNCS[] = { + VK_COMPARE_OP_NEVER, + VK_COMPARE_OP_LESS, + VK_COMPARE_OP_EQUAL, + VK_COMPARE_OP_LESS_OR_EQUAL, + VK_COMPARE_OP_GREATER, + VK_COMPARE_OP_NOT_EQUAL, + VK_COMPARE_OP_GREATER_OR_EQUAL, + VK_COMPARE_OP_ALWAYS, +}; + +const VkStencilOp VK_STENCIL_OPS[] = { + VK_STENCIL_OP_ZERO, + VK_STENCIL_OP_KEEP, + VK_STENCIL_OP_REPLACE, + VK_STENCIL_OP_INCREMENT_AND_CLAMP, + VK_STENCIL_OP_DECREMENT_AND_CLAMP, + VK_STENCIL_OP_INVERT, + VK_STENCIL_OP_INCREMENT_AND_WRAP, + VK_STENCIL_OP_DECREMENT_AND_WRAP, +}; + +const VkBlendOp VK_BLEND_OPS[] = { + VK_BLEND_OP_ADD, + VK_BLEND_OP_SUBTRACT, + VK_BLEND_OP_REVERSE_SUBTRACT, + VK_BLEND_OP_MIN, + VK_BLEND_OP_MAX, +}; + +const VkBlendFactor VK_BLEND_FACTORS[] = { + VK_BLEND_FACTOR_ZERO, + VK_BLEND_FACTOR_ONE, + VK_BLEND_FACTOR_SRC_ALPHA, + VK_BLEND_FACTOR_DST_ALPHA, + VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, + VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA, + VK_BLEND_FACTOR_SRC_COLOR, + VK_BLEND_FACTOR_DST_COLOR, + VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR, + VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR, + VK_BLEND_FACTOR_SRC_ALPHA_SATURATE, + VK_BLEND_FACTOR_CONSTANT_COLOR, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR, + VK_BLEND_FACTOR_CONSTANT_ALPHA, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA, +}; + +const VkFilter VK_FILTERS[] = { + static_cast(0), // NONE + VK_FILTER_NEAREST, // POINT + VK_FILTER_LINEAR, // LINEAR + static_cast(0), // ANISOTROPIC +}; + +const VkSamplerMipmapMode VK_SAMPLER_MIPMAP_MODES[] = { + static_cast(0), // NONE + VK_SAMPLER_MIPMAP_MODE_NEAREST, // POINT + VK_SAMPLER_MIPMAP_MODE_LINEAR, // LINEAR + VK_SAMPLER_MIPMAP_MODE_LINEAR, // ANISOTROPIC +}; + +const VkSamplerAddressMode VK_SAMPLER_ADDRESS_MODES[] = { + VK_SAMPLER_ADDRESS_MODE_REPEAT, // WRAP + VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT, // MIRROR + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // CLAMP + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, // BORDER +}; + +const VkPipelineBindPoint VK_PIPELINE_BIND_POINTS[] = { + VK_PIPELINE_BIND_POINT_GRAPHICS, + VK_PIPELINE_BIND_POINT_COMPUTE, + VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, +}; + +const ThsvsAccessType THSVS_ACCESS_TYPES[] = { + THSVS_ACCESS_NONE, // NONE + THSVS_ACCESS_INDIRECT_BUFFER, // INDIRECT_BUFFER + THSVS_ACCESS_INDEX_BUFFER, // INDEX_BUFFER + THSVS_ACCESS_VERTEX_BUFFER, // VERTEX_BUFFER + THSVS_ACCESS_VERTEX_SHADER_READ_UNIFORM_BUFFER, // VERTEX_SHADER_READ_UNIFORM_BUFFER + THSVS_ACCESS_VERTEX_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // VERTEX_SHADER_READ_TEXTURE + THSVS_ACCESS_VERTEX_SHADER_READ_OTHER, // VERTEX_SHADER_READ_OTHER + THSVS_ACCESS_FRAGMENT_SHADER_READ_UNIFORM_BUFFER, // FRAGMENT_SHADER_READ_UNIFORM_BUFFER + THSVS_ACCESS_FRAGMENT_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // FRAGMENT_SHADER_READ_TEXTURE + THSVS_ACCESS_FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT, // FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT + THSVS_ACCESS_FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT, // FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT + THSVS_ACCESS_FRAGMENT_SHADER_READ_OTHER, // FRAGMENT_SHADER_READ_OTHER + THSVS_ACCESS_COLOR_ATTACHMENT_READ, // COLOR_ATTACHMENT_READ + THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ, // DEPTH_STENCIL_ATTACHMENT_READ + THSVS_ACCESS_COMPUTE_SHADER_READ_UNIFORM_BUFFER, // COMPUTE_SHADER_READ_UNIFORM_BUFFER + THSVS_ACCESS_COMPUTE_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // COMPUTE_SHADER_READ_TEXTURE + THSVS_ACCESS_COMPUTE_SHADER_READ_OTHER, // COMPUTE_SHADER_READ_OTHER + THSVS_ACCESS_TRANSFER_READ, // TRANSFER_READ + THSVS_ACCESS_HOST_READ, // HOST_READ + THSVS_ACCESS_PRESENT, // PRESENT + THSVS_ACCESS_VERTEX_SHADER_WRITE, // VERTEX_SHADER_WRITE + THSVS_ACCESS_FRAGMENT_SHADER_WRITE, // FRAGMENT_SHADER_WRITE + THSVS_ACCESS_COLOR_ATTACHMENT_WRITE, // COLOR_ATTACHMENT_WRITE + THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE, // DEPTH_STENCIL_ATTACHMENT_WRITE + THSVS_ACCESS_COMPUTE_SHADER_WRITE, // COMPUTE_SHADER_WRITE + THSVS_ACCESS_TRANSFER_WRITE, // TRANSFER_WRITE + THSVS_ACCESS_HOST_PREINITIALIZED, // HOST_PREINITIALIZED + THSVS_ACCESS_HOST_WRITE, // HOST_WRITE +}; + +const VkImageLayout VK_IMAGE_LAYOUTS[] = { + VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_GENERAL, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_IMAGE_LAYOUT_PREINITIALIZED, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, +}; + +const VkAccessFlags FULL_ACCESS_FLAGS = + VK_ACCESS_INDIRECT_COMMAND_READ_BIT | + VK_ACCESS_INDEX_READ_BIT | + VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | + VK_ACCESS_UNIFORM_READ_BIT | + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | + VK_ACCESS_SHADER_READ_BIT | + VK_ACCESS_SHADER_WRITE_BIT | + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | + VK_ACCESS_TRANSFER_READ_BIT | + VK_ACCESS_TRANSFER_WRITE_BIT | + VK_ACCESS_HOST_READ_BIT | + VK_ACCESS_HOST_WRITE_BIT; + +void fullPipelineBarrier(VkCommandBuffer cmdBuff) { +#if CC_DEBUG > 0 + VkMemoryBarrier memoryBarrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; + memoryBarrier.srcAccessMask = FULL_ACCESS_FLAGS; + memoryBarrier.dstAccessMask = FULL_ACCESS_FLAGS; + vkCmdPipelineBarrier(cmdBuff, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + 0, 1, &memoryBarrier, 0, nullptr, 0, nullptr); +#endif +} + +VkDeviceSize roundUp(VkDeviceSize numToRound, uint multiple) { + return ((numToRound + multiple - 1) / multiple) * multiple; +} + +bool isLayerSupported(const char *required, const vector &available) { + for (const VkLayerProperties &availableLayer : available) { + if (strcmp(availableLayer.layerName, required) == 0) { + return true; + } + } + return false; +} + +bool isExtensionSupported(const char *required, const vector &available) { + for (const VkExtensionProperties &availableExtension : available) { + if (strcmp(availableExtension.extensionName, required) == 0) { + return true; + } + } + return false; +} + +} // namespace gfx +} // namespace cc diff --git a/native/cocos/renderer/gfx-vulkan/VKUtils.h b/native/cocos/renderer/gfx-vulkan/VKUtils.h index 917ac3ab70..a63bc45b43 100644 --- a/native/cocos/renderer/gfx-vulkan/VKUtils.h +++ b/native/cocos/renderer/gfx-vulkan/VKUtils.h @@ -1,734 +1,95 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 CC_GFXVULKAN_UTILS_H_ -#define CC_GFXVULKAN_UTILS_H_ + +#pragma once #define WIN32_LEAN_AND_MEAN +#include "base/Utils.h" +#include "base/Macros.h" +#include "base/StringUtil.h" +#include "gfx-base/GFXDef.h" + #include "vk_mem_alloc.h" #include "volk.h" +#include "thsvs_simpler_vulkan_synchronization.h" + #define DEFAULT_TIMEOUT 1000000000 // 1 second +#define BARRIER_DEDUCTION_LEVEL_NONE 0 +#define BARRIER_DEDUCTION_LEVEL_BASIC 1 +#define BARRIER_DEDUCTION_LEVEL_FULL 2 + +#ifndef BARRIER_DEDUCTION_LEVEL + #define BARRIER_DEDUCTION_LEVEL BARRIER_DEDUCTION_LEVEL_BASIC +#endif + namespace cc { namespace gfx { -namespace { -VkFormat MapVkFormat(Format format) { - switch (format) { - case Format::R8: return VK_FORMAT_R8_UNORM; - case Format::R8SN: return VK_FORMAT_R8_SNORM; - case Format::R8UI: return VK_FORMAT_R8_UINT; - case Format::R8I: return VK_FORMAT_R8_SINT; - case Format::RG8: return VK_FORMAT_R8G8_UNORM; - case Format::RG8SN: return VK_FORMAT_R8G8_SNORM; - case Format::RG8UI: return VK_FORMAT_R8G8_UINT; - case Format::RG8I: return VK_FORMAT_R8G8_SINT; - case Format::RGB8: return VK_FORMAT_R8G8B8_UNORM; - case Format::RGB8SN: return VK_FORMAT_R8G8B8_SNORM; - case Format::RGB8UI: return VK_FORMAT_R8G8B8_UINT; - case Format::RGB8I: return VK_FORMAT_R8G8B8_SINT; - case Format::RGBA8: return VK_FORMAT_R8G8B8A8_UNORM; - case Format::BGRA8: return VK_FORMAT_B8G8R8A8_UNORM; - case Format::SRGB8_A8: return VK_FORMAT_R8G8B8A8_SRGB; - case Format::RGBA8SN: return VK_FORMAT_R8G8B8A8_SNORM; - case Format::RGBA8UI: return VK_FORMAT_R8G8B8A8_UINT; - case Format::RGBA8I: return VK_FORMAT_R8G8B8A8_SINT; - case Format::R16I: return VK_FORMAT_R16_SINT; - case Format::R16UI: return VK_FORMAT_R16_UINT; - case Format::R16F: return VK_FORMAT_R16_SFLOAT; - case Format::RG16I: return VK_FORMAT_R16G16_SINT; - case Format::RG16UI: return VK_FORMAT_R16G16_UINT; - case Format::RG16F: return VK_FORMAT_R16G16_SFLOAT; - case Format::RGB16I: return VK_FORMAT_R16G16B16_SINT; - case Format::RGB16UI: return VK_FORMAT_R16G16B16_UINT; - case Format::RGB16F: return VK_FORMAT_R16G16B16_SFLOAT; - case Format::RGBA16I: return VK_FORMAT_R16G16B16A16_SINT; - case Format::RGBA16UI: return VK_FORMAT_R16G16B16A16_UINT; - case Format::RGBA16F: return VK_FORMAT_R16G16B16A16_SFLOAT; - case Format::R32I: return VK_FORMAT_R32_SINT; - case Format::R32UI: return VK_FORMAT_R32_UINT; - case Format::R32F: return VK_FORMAT_R32_SFLOAT; - case Format::RG32I: return VK_FORMAT_R32G32_SINT; - case Format::RG32UI: return VK_FORMAT_R32G32_UINT; - case Format::RG32F: return VK_FORMAT_R32G32_SFLOAT; - case Format::RGB32I: return VK_FORMAT_R32G32B32_SINT; - case Format::RGB32UI: return VK_FORMAT_R32G32B32_UINT; - case Format::RGB32F: return VK_FORMAT_R32G32B32_SFLOAT; - case Format::RGBA32I: return VK_FORMAT_R32G32B32A32_SINT; - case Format::RGBA32UI: return VK_FORMAT_R32G32B32A32_UINT; - case Format::RGBA32F: return VK_FORMAT_R32G32B32A32_SFLOAT; +extern VkFormat mapVkFormat(Format format); +extern VkAttachmentLoadOp mapVkLoadOp(LoadOp loadOp); +extern VkAttachmentStoreOp mapVkStoreOp(StoreOp storeOp); +extern VkBufferUsageFlagBits mapVkBufferUsageFlagBits(BufferUsage usage); +extern VkImageType mapVkImageType(TextureType type); +extern VkSampleCountFlagBits mapVkSampleCount(SampleCount count); +extern VkFormatFeatureFlags mapVkFormatFeatureFlags(TextureUsage usage); +extern VkImageUsageFlagBits mapVkImageUsageFlagBits(TextureUsage usage); +extern VkImageAspectFlags mapVkImageAspectFlags(Format format); +extern VkImageCreateFlags mapVkImageCreateFlags(TextureType type); +extern VkImageViewType mapVkImageViewType(TextureType viewType); +extern VkCommandBufferLevel mapVkCommandBufferLevel(CommandBufferType type); +extern VkDescriptorType mapVkDescriptorType(DescriptorType type); +extern VkColorComponentFlags mapVkColorComponentFlags(ColorMask colorMask); +extern VkShaderStageFlagBits mapVkShaderStageFlagBits(ShaderStageFlagBit stage); +extern VkShaderStageFlags mapVkShaderStageFlags(ShaderStageFlagBit stages); +extern SurfaceTransform mapSurfaceTransform(VkSurfaceTransformFlagBitsKHR transform); +extern String mapVendorName(uint32_t vendorID); +extern void mapDepthStencilBits(Format format, uint *pDepthBits, uint *pStencilBits); - case Format::R5G6B5: return VK_FORMAT_R5G6B5_UNORM_PACK16; - case Format::R11G11B10F: return VK_FORMAT_B10G11R11_UFLOAT_PACK32; - case Format::RGB5A1: return VK_FORMAT_R5G5B5A1_UNORM_PACK16; - case Format::RGBA4: return VK_FORMAT_R4G4B4A4_UNORM_PACK16; - case Format::RGB10A2: return VK_FORMAT_A2B10G10R10_UNORM_PACK32; - case Format::RGB10A2UI: return VK_FORMAT_A2B10G10R10_UINT_PACK32; - case Format::RGB9E5: return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; - case Format::D16: return VK_FORMAT_D16_UNORM; - case Format::D16S8: return VK_FORMAT_D16_UNORM_S8_UINT; - case Format::D24: return VK_FORMAT_X8_D24_UNORM_PACK32; - case Format::D24S8: return VK_FORMAT_D24_UNORM_S8_UINT; - case Format::D32F: return VK_FORMAT_D32_SFLOAT; - case Format::D32F_S8: return VK_FORMAT_D32_SFLOAT_S8_UINT; +extern void fullPipelineBarrier(VkCommandBuffer cmdBuff); +extern VkDeviceSize roundUp(VkDeviceSize numToRound, uint multiple); +extern bool isLayerSupported(const char *required, const vector &available); +extern bool isExtensionSupported(const char *required, const vector &available); - case Format::BC1: return VK_FORMAT_BC1_RGB_UNORM_BLOCK; - case Format::BC1_ALPHA: return VK_FORMAT_BC1_RGBA_UNORM_BLOCK; - case Format::BC1_SRGB: return VK_FORMAT_BC1_RGB_SRGB_BLOCK; - case Format::BC1_SRGB_ALPHA: return VK_FORMAT_BC1_RGBA_SRGB_BLOCK; - case Format::BC2: return VK_FORMAT_BC2_UNORM_BLOCK; - case Format::BC2_SRGB: return VK_FORMAT_BC2_SRGB_BLOCK; - case Format::BC3: return VK_FORMAT_BC3_UNORM_BLOCK; - case Format::BC3_SRGB: return VK_FORMAT_BC3_SRGB_BLOCK; - case Format::BC4: return VK_FORMAT_BC4_UNORM_BLOCK; - case Format::BC4_SNORM: return VK_FORMAT_BC4_SNORM_BLOCK; - case Format::BC5: return VK_FORMAT_BC5_UNORM_BLOCK; - case Format::BC5_SNORM: return VK_FORMAT_BC5_SNORM_BLOCK; - case Format::BC6H_UF16: return VK_FORMAT_BC6H_UFLOAT_BLOCK; - case Format::BC6H_SF16: return VK_FORMAT_BC6H_SFLOAT_BLOCK; - case Format::BC7: return VK_FORMAT_BC7_UNORM_BLOCK; - case Format::BC7_SRGB: return VK_FORMAT_BC7_SRGB_BLOCK; - - case Format::ETC2_RGB8: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; - case Format::ETC2_SRGB8: return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; - case Format::ETC2_RGB8_A1: return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; - case Format::ETC2_SRGB8_A1: return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; - case Format::ETC2_RGBA8: return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; - case Format::ETC2_SRGB8_A8: return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; - case Format::EAC_R11: return VK_FORMAT_EAC_R11_UNORM_BLOCK; - case Format::EAC_R11SN: return VK_FORMAT_EAC_R11_SNORM_BLOCK; - case Format::EAC_RG11: return VK_FORMAT_EAC_R11G11_UNORM_BLOCK; - case Format::EAC_RG11SN: return VK_FORMAT_EAC_R11G11_SNORM_BLOCK; - - case Format::PVRTC_RGB2: return VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG; - case Format::PVRTC_RGBA2: return VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG; - case Format::PVRTC_RGB4: return VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG; - case Format::PVRTC_RGBA4: return VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG; - case Format::PVRTC2_2BPP: return VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG; - case Format::PVRTC2_4BPP: return VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG; - - case Format::ASTC_RGBA_4x4: return VK_FORMAT_ASTC_4x4_UNORM_BLOCK; - case Format::ASTC_RGBA_5x4: return VK_FORMAT_ASTC_5x4_UNORM_BLOCK; - case Format::ASTC_RGBA_5x5: return VK_FORMAT_ASTC_5x5_UNORM_BLOCK; - case Format::ASTC_RGBA_6x5: return VK_FORMAT_ASTC_6x5_UNORM_BLOCK; - case Format::ASTC_RGBA_6x6: return VK_FORMAT_ASTC_6x6_UNORM_BLOCK; - case Format::ASTC_RGBA_8x5: return VK_FORMAT_ASTC_8x5_UNORM_BLOCK; - case Format::ASTC_RGBA_8x6: return VK_FORMAT_ASTC_8x6_UNORM_BLOCK; - case Format::ASTC_RGBA_8x8: return VK_FORMAT_ASTC_8x8_UNORM_BLOCK; - case Format::ASTC_RGBA_10x5: return VK_FORMAT_ASTC_10x5_UNORM_BLOCK; - case Format::ASTC_RGBA_10x6: return VK_FORMAT_ASTC_10x6_UNORM_BLOCK; - case Format::ASTC_RGBA_10x8: return VK_FORMAT_ASTC_10x8_UNORM_BLOCK; - case Format::ASTC_RGBA_10x10: return VK_FORMAT_ASTC_10x10_UNORM_BLOCK; - case Format::ASTC_RGBA_12x10: return VK_FORMAT_ASTC_12x10_UNORM_BLOCK; - case Format::ASTC_RGBA_12x12: return VK_FORMAT_ASTC_12x12_UNORM_BLOCK; - - case Format::ASTC_SRGBA_4x4: return VK_FORMAT_ASTC_4x4_SRGB_BLOCK; - case Format::ASTC_SRGBA_5x4: return VK_FORMAT_ASTC_5x4_SRGB_BLOCK; - case Format::ASTC_SRGBA_5x5: return VK_FORMAT_ASTC_5x5_SRGB_BLOCK; - case Format::ASTC_SRGBA_6x5: return VK_FORMAT_ASTC_6x5_SRGB_BLOCK; - case Format::ASTC_SRGBA_6x6: return VK_FORMAT_ASTC_6x6_SRGB_BLOCK; - case Format::ASTC_SRGBA_8x5: return VK_FORMAT_ASTC_8x5_SRGB_BLOCK; - case Format::ASTC_SRGBA_8x6: return VK_FORMAT_ASTC_8x6_SRGB_BLOCK; - case Format::ASTC_SRGBA_8x8: return VK_FORMAT_ASTC_8x8_SRGB_BLOCK; - case Format::ASTC_SRGBA_10x5: return VK_FORMAT_ASTC_10x5_SRGB_BLOCK; - case Format::ASTC_SRGBA_10x6: return VK_FORMAT_ASTC_10x6_SRGB_BLOCK; - case Format::ASTC_SRGBA_10x8: return VK_FORMAT_ASTC_10x8_SRGB_BLOCK; - case Format::ASTC_SRGBA_10x10: return VK_FORMAT_ASTC_10x10_SRGB_BLOCK; - case Format::ASTC_SRGBA_12x10: return VK_FORMAT_ASTC_12x10_SRGB_BLOCK; - case Format::ASTC_SRGBA_12x12: return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; - - default: { - CCASSERT(false, "Unsupported Format, convert to VkFormat failed."); - return VK_FORMAT_B8G8R8A8_UNORM; - } - } -} - -VkSampleCountFlagBits MapVkSampleCount(uint sampleCount) { - if (sampleCount == 1) - return VK_SAMPLE_COUNT_1_BIT; - else if (sampleCount == 2) - return VK_SAMPLE_COUNT_2_BIT; - else if (sampleCount == 4) - return VK_SAMPLE_COUNT_4_BIT; - else if (sampleCount == 8) - return VK_SAMPLE_COUNT_8_BIT; - else if (sampleCount == 16) - return VK_SAMPLE_COUNT_16_BIT; - else if (sampleCount == 32) - return VK_SAMPLE_COUNT_32_BIT; - else if (sampleCount == 64) - return VK_SAMPLE_COUNT_64_BIT; - else - return VK_SAMPLE_COUNT_1_BIT; -} - -VkAttachmentLoadOp MapVkLoadOp(LoadOp loadOp) { - switch (loadOp) { - case LoadOp::CLEAR: return VK_ATTACHMENT_LOAD_OP_CLEAR; - case LoadOp::LOAD: return VK_ATTACHMENT_LOAD_OP_LOAD; - case LoadOp::DISCARD: return VK_ATTACHMENT_LOAD_OP_DONT_CARE; - default: { - CCASSERT(false, "Unsupported LoadOp, convert to VkLoadOp failed."); - return VK_ATTACHMENT_LOAD_OP_LOAD; - } - } -} - -VkAttachmentStoreOp MapVkStoreOp(StoreOp storeOp) { - switch (storeOp) { - case StoreOp::STORE: return VK_ATTACHMENT_STORE_OP_STORE; - case StoreOp::DISCARD: return VK_ATTACHMENT_STORE_OP_DONT_CARE; - default: { - CCASSERT(false, "Unsupported StoreOp, convert to VkStoreOp failed."); - return VK_ATTACHMENT_STORE_OP_STORE; - } - } -} - -VkImageLayout MapVkImageLayout(TextureLayout layout) { - switch (layout) { - case TextureLayout::UNDEFINED: return VK_IMAGE_LAYOUT_UNDEFINED; - case TextureLayout::GENERAL: return VK_IMAGE_LAYOUT_GENERAL; - case TextureLayout::COLOR_ATTACHMENT_OPTIMAL: return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - case TextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL: return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; - case TextureLayout::DEPTH_STENCIL_READONLY_OPTIMAL: return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL; - case TextureLayout::SHADER_READONLY_OPTIMAL: return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - case TextureLayout::TRANSFER_SRC_OPTIMAL: return VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; - case TextureLayout::TRANSFER_DST_OPTIMAL: return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - case TextureLayout::PREINITIALIZED: return VK_IMAGE_LAYOUT_PREINITIALIZED; - case TextureLayout::PRESENT_SRC: return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - default: { - CCASSERT(false, "Unsupported TextureLayout, convert to VkImageLayout failed."); - return VK_IMAGE_LAYOUT_GENERAL; - } - } -} - -VkAccessFlags MapVkAccessFlags(TextureLayout layout) { - switch (layout) { - case TextureLayout::UNDEFINED: return 0; - case TextureLayout::GENERAL: return 0; - case TextureLayout::COLOR_ATTACHMENT_OPTIMAL: return VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - case TextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL: return VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; - case TextureLayout::DEPTH_STENCIL_READONLY_OPTIMAL: return VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; - case TextureLayout::SHADER_READONLY_OPTIMAL: return VK_ACCESS_SHADER_READ_BIT; - case TextureLayout::TRANSFER_SRC_OPTIMAL: return VK_ACCESS_TRANSFER_READ_BIT; - case TextureLayout::TRANSFER_DST_OPTIMAL: return VK_ACCESS_TRANSFER_WRITE_BIT; - case TextureLayout::PREINITIALIZED: return 0; - case TextureLayout::PRESENT_SRC: return 0; - default: { - CCASSERT(false, "Unsupported TextureLayout, convert to VkImageLayout failed."); - return 0; - } - } -} - -VkAccessFlags MapVkAccessFlags(TextureUsage usage, Format format) { - if (usage & TextureUsage::COLOR_ATTACHMENT) return VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - if (usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT) return VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; - if (usage & TextureUsage::INPUT_ATTACHMENT) return VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; - if (usage & TextureUsage::SAMPLED) { - if (GFX_FORMAT_INFOS[(uint)format].hasDepth) - return VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; - else - return VK_ACCESS_SHADER_READ_BIT; - } - if (usage & TextureUsage::TRANSFER_SRC) return VK_ACCESS_TRANSFER_READ_BIT; - if (usage & TextureUsage::TRANSFER_DST) return VK_ACCESS_TRANSFER_WRITE_BIT; - return VK_ACCESS_SHADER_READ_BIT; -} - -VkAccessFlags MapVkAccessFlags(BufferUsage usage) { - if (usage & BufferUsage::VERTEX) return VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT; - if (usage & BufferUsage::INDEX) return VK_ACCESS_INDEX_READ_BIT; - if (usage & BufferUsage::UNIFORM) return VK_ACCESS_UNIFORM_READ_BIT; - if (usage & BufferUsage::INDIRECT) return VK_ACCESS_INDIRECT_COMMAND_READ_BIT; - if (usage & BufferUsage::STORAGE) return VK_ACCESS_SHADER_READ_BIT; - if (usage & BufferUsage::TRANSFER_SRC) return VK_ACCESS_TRANSFER_READ_BIT; - if (usage & BufferUsage::TRANSFER_DST) return VK_ACCESS_TRANSFER_WRITE_BIT; - return VK_ACCESS_UNIFORM_READ_BIT; -} - -VkPipelineStageFlags MapVkPipelineStageFlags(BufferUsage usage) { - if (usage & BufferUsage::VERTEX) return VK_PIPELINE_STAGE_VERTEX_INPUT_BIT; - if (usage & BufferUsage::INDEX) return VK_PIPELINE_STAGE_VERTEX_INPUT_BIT; - if (usage & BufferUsage::UNIFORM) return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT; - if (usage & BufferUsage::INDIRECT) return VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT; - if (usage & BufferUsage::STORAGE) return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT; - if (usage & BufferUsage::TRANSFER_SRC) return VK_PIPELINE_STAGE_TRANSFER_BIT; - if (usage & BufferUsage::TRANSFER_DST) return VK_PIPELINE_STAGE_TRANSFER_BIT; - return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT; -} - -VkPipelineBindPoint MapVkPipelineBindPoint(PipelineBindPoint bindPoint) { - switch (bindPoint) { - case PipelineBindPoint::GRAPHICS: return VK_PIPELINE_BIND_POINT_GRAPHICS; - case PipelineBindPoint::COMPUTE: return VK_PIPELINE_BIND_POINT_COMPUTE; - case PipelineBindPoint::RAY_TRACING: return VK_PIPELINE_BIND_POINT_RAY_TRACING_NV; - default: { - CCASSERT(false, "Unsupported PipelineBindPoint, convert to VkPipelineBindPoint failed."); - return VK_PIPELINE_BIND_POINT_GRAPHICS; - } - } -} - -VkBufferUsageFlagBits MapVkBufferUsageFlagBits(BufferUsage usage) { - uint flags = 0u; - if (usage & BufferUsage::TRANSFER_SRC) flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; - if (usage & BufferUsage::TRANSFER_DST) flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; - if (usage & BufferUsage::INDEX) flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT; - if (usage & BufferUsage::VERTEX) flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; - if (usage & BufferUsage::UNIFORM) flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; - if (usage & BufferUsage::STORAGE) flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; - if (usage & BufferUsage::INDIRECT) flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; - return (VkBufferUsageFlagBits)flags; -} - -VkImageType MapVkImageType(TextureType type) { - switch (type) { - case TextureType::TEX1D: - case TextureType::TEX1D_ARRAY: return VK_IMAGE_TYPE_1D; - case TextureType::CUBE: - case TextureType::TEX2D: - case TextureType::TEX2D_ARRAY: return VK_IMAGE_TYPE_2D; - case TextureType::TEX3D: return VK_IMAGE_TYPE_3D; - default: { - CCASSERT(false, "Unsupported TextureType, convert to VkImageType failed."); - return VK_IMAGE_TYPE_2D; - } - } -} - -VkSampleCountFlagBits MapVkSampleCount(SampleCount count) { - switch (count) { - case SampleCount::X1: return VK_SAMPLE_COUNT_1_BIT; - case SampleCount::X2: return VK_SAMPLE_COUNT_2_BIT; - case SampleCount::X4: return VK_SAMPLE_COUNT_4_BIT; - case SampleCount::X8: return VK_SAMPLE_COUNT_8_BIT; - case SampleCount::X16: return VK_SAMPLE_COUNT_16_BIT; - case SampleCount::X32: return VK_SAMPLE_COUNT_32_BIT; - default: { - CCASSERT(false, "Unsupported TextureType, convert to VkImageType failed."); - return VK_SAMPLE_COUNT_1_BIT; - } - } -} - -VkFormatFeatureFlags MapVkFormatFeatureFlags(TextureUsage usage) { - uint flags = 0u; - if (usage & TextureUsage::TRANSFER_SRC) flags |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT; - if (usage & TextureUsage::TRANSFER_DST) flags |= VK_FORMAT_FEATURE_TRANSFER_DST_BIT; - if (usage & TextureUsage::SAMPLED) flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; - if (usage & TextureUsage::STORAGE) flags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; - if (usage & TextureUsage::COLOR_ATTACHMENT) flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; - if (usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT) flags |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; - if (usage & TextureUsage::TRANSIENT_ATTACHMENT) flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; - if (usage & TextureUsage::INPUT_ATTACHMENT) flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; - return (VkFormatFeatureFlags)flags; -} - -VkImageUsageFlagBits MapVkImageUsageFlagBits(TextureUsage usage) { - uint flags = 0u; - if (usage & TextureUsage::TRANSFER_SRC) flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; - if (usage & TextureUsage::TRANSFER_DST) flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; - if (usage & TextureUsage::SAMPLED) flags |= VK_IMAGE_USAGE_SAMPLED_BIT; - if (usage & TextureUsage::STORAGE) flags |= VK_IMAGE_USAGE_STORAGE_BIT; - if (usage & TextureUsage::COLOR_ATTACHMENT) flags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; - if (usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT) flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; - if (usage & TextureUsage::TRANSIENT_ATTACHMENT) flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; - if (usage & TextureUsage::INPUT_ATTACHMENT) flags |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT; - return (VkImageUsageFlagBits)flags; -} - -VkImageLayout MapVkImageLayout(TextureUsage usage, Format format) { - const FormatInfo &info = GFX_FORMAT_INFOS[(uint)format]; - if (usage & TextureUsage::SAMPLED) { - if (info.hasDepth && info.hasStencil) - return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL; - else if (info.hasDepth) - return VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL; - else - return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - } - if (usage & TextureUsage::COLOR_ATTACHMENT) return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - if (usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT) { - if (info.hasStencil) - return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; - else - return VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL; - } - if (usage & TextureUsage::TRANSFER_SRC) return VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; - if (usage & TextureUsage::TRANSFER_DST) return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - return VK_IMAGE_LAYOUT_UNDEFINED; -} - -VkImageAspectFlags MapVkImageAspectFlags(Format format) { - VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - const FormatInfo &info = GFX_FORMAT_INFOS[(uint)format]; - if (info.hasDepth) { - aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; - } - if (info.hasStencil) { - aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; - } - return aspectMask; -} - -VkPipelineStageFlags MapVkPipelineStageFlags(TextureUsage usage) { - if (usage & TextureUsage::COLOR_ATTACHMENT) return VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; - if (usage & TextureUsage::DEPTH_STENCIL_ATTACHMENT) return VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT; - if (usage & TextureUsage::SAMPLED) return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; - if (usage & TextureUsage::TRANSFER_SRC) return VK_PIPELINE_STAGE_TRANSFER_BIT; - if (usage & TextureUsage::TRANSFER_DST) return VK_PIPELINE_STAGE_TRANSFER_BIT; - return VK_PIPELINE_STAGE_VERTEX_SHADER_BIT; -} - -uint selectMemoryType(const VkPhysicalDeviceMemoryProperties &memoryProperties, uint memoryTypeBits, VkMemoryPropertyFlags flags) { - for (uint i = 0u; i < memoryProperties.memoryTypeCount; ++i) - if ((memoryTypeBits & (1 << i)) != 0 && (memoryProperties.memoryTypes[i].propertyFlags & flags) == flags) - return i; - - CCASSERT(false, "No compatible memory type found."); - return ~0u; -} - -VkImageCreateFlags MapVkImageCreateFlags(TextureType type) { - uint res = 0u; - switch (type) { - case TextureType::CUBE: res |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; break; - case TextureType::TEX2D_ARRAY: res |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; break; - default: break; - } - return (VkImageCreateFlags)res; -} - -VkImageViewType MapVkImageViewType(TextureType viewType) { - switch (viewType) { - case TextureType::TEX1D: return VK_IMAGE_VIEW_TYPE_1D; - case TextureType::TEX1D_ARRAY: return VK_IMAGE_VIEW_TYPE_1D_ARRAY; - case TextureType::TEX2D: return VK_IMAGE_VIEW_TYPE_2D; - case TextureType::TEX2D_ARRAY: return VK_IMAGE_VIEW_TYPE_2D_ARRAY; - case TextureType::TEX3D: return VK_IMAGE_VIEW_TYPE_3D; - case TextureType::CUBE: return VK_IMAGE_VIEW_TYPE_CUBE; - default: { - CCASSERT(false, "Unsupported TextureViewType, convert to VkImageViewType failed."); - return VK_IMAGE_VIEW_TYPE_2D; - } - } -} - -VkCommandBufferLevel MapVkCommandBufferLevel(CommandBufferType type) { - switch (type) { - case CommandBufferType::PRIMARY: return VK_COMMAND_BUFFER_LEVEL_PRIMARY; - case CommandBufferType::SECONDARY: return VK_COMMAND_BUFFER_LEVEL_SECONDARY; - default: { - CCASSERT(false, "Unsupported CommandBufferType, convert to VkCommandBufferLevel failed."); - return VK_COMMAND_BUFFER_LEVEL_SECONDARY; - } - } -} - -VkDescriptorType MapVkDescriptorType(DescriptorType type) { - switch (type) { - case DescriptorType::DYNAMIC_UNIFORM_BUFFER: return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; - case DescriptorType::UNIFORM_BUFFER: return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; - case DescriptorType::DYNAMIC_STORAGE_BUFFER: return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; - case DescriptorType::STORAGE_BUFFER: return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; - case DescriptorType::SAMPLER: return VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; - default: { - CCASSERT(false, "Unsupported DescriptorType, convert to VkDescriptorType failed."); - return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; - } - } -} - -VkColorComponentFlags MapVkColorComponentFlags(ColorMask colorMask) { - uint flags = 0u; - if (colorMask & ColorMask::R) flags |= VK_COLOR_COMPONENT_R_BIT; - if (colorMask & ColorMask::G) flags |= VK_COLOR_COMPONENT_G_BIT; - if (colorMask & ColorMask::B) flags |= VK_COLOR_COMPONENT_B_BIT; - if (colorMask & ColorMask::A) flags |= VK_COLOR_COMPONENT_A_BIT; - if (colorMask & ColorMask::ALL) flags |= VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; - return (VkColorComponentFlags)flags; -} - -VkShaderStageFlagBits MapVkShaderStageFlagBits(ShaderStageFlagBit stage) { - switch (stage) { - case ShaderStageFlagBit::VERTEX: return VK_SHADER_STAGE_VERTEX_BIT; - case ShaderStageFlagBit::CONTROL: return VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; - case ShaderStageFlagBit::EVALUATION: return VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; - case ShaderStageFlagBit::GEOMETRY: return VK_SHADER_STAGE_GEOMETRY_BIT; - case ShaderStageFlagBit::FRAGMENT: return VK_SHADER_STAGE_FRAGMENT_BIT; - case ShaderStageFlagBit::COMPUTE: return VK_SHADER_STAGE_COMPUTE_BIT; - default: { - CCASSERT(false, "Unsupported ShaderStageFlagBit, convert to VkShaderStageFlagBits failed."); - return VK_SHADER_STAGE_VERTEX_BIT; - } - } -} - -VkShaderStageFlags MapVkShaderStageFlags(ShaderStageFlagBit stages) { - uint flags = 0u; - if (stages & ShaderStageFlagBit::VERTEX) flags |= VK_SHADER_STAGE_VERTEX_BIT; - if (stages & ShaderStageFlagBit::CONTROL) flags |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; - if (stages & ShaderStageFlagBit::EVALUATION) flags |= VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; - if (stages & ShaderStageFlagBit::GEOMETRY) flags |= VK_SHADER_STAGE_GEOMETRY_BIT; - if (stages & ShaderStageFlagBit::FRAGMENT) flags |= VK_SHADER_STAGE_FRAGMENT_BIT; - if (stages & ShaderStageFlagBit::COMPUTE) flags |= VK_SHADER_STAGE_COMPUTE_BIT; - return (VkShaderStageFlags)flags; -} - -SurfaceTransform MapSurfaceTransform(VkSurfaceTransformFlagBitsKHR transform) { - if (transform & VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR) return SurfaceTransform::ROTATE_90; - if (transform & VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR) return SurfaceTransform::ROTATE_180; - if (transform & VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR) return SurfaceTransform::ROTATE_270; - return SurfaceTransform::IDENTITY; -} - -String MapVendorName(uint32_t vendorID) { - switch (vendorID) { - case 0x1002: return "Advanced Micro Devices, Inc."; - case 0x1010: return "Imagination Technologies"; - case 0x106b: return "Apple Inc."; - case 0x10DE: return "Nvidia Corporation"; - case 0x13B5: return "Arm Limited"; - case 0x5143: return "Qualcomm Incorporated"; - case 0x8086: return "Intel Corporation"; - } - return StringUtil::Format("Unknown VendorID %d", vendorID); -} - -void MapDepthStencilBits(Format format, uint &depthBits, uint &stencilBits) { - switch (format) { - case Format::D16: - depthBits = 16; - stencilBits = 0; - break; - case Format::D16S8: - depthBits = 16; - stencilBits = 8; - break; - case Format::D24: - depthBits = 24; - stencilBits = 0; - break; - case Format::D24S8: - depthBits = 24; - stencilBits = 8; - break; - case Format::D32F: - depthBits = 32; - stencilBits = 0; - break; - case Format::D32F_S8: - depthBits = 32; - stencilBits = 8; - break; - default: break; - } -} - -const VkSurfaceTransformFlagsKHR TRANSFORMS_THAT_REQUIRE_FLIPPING = - VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR | - VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR; - -const VkPrimitiveTopology VK_PRIMITIVE_MODES[] = { - VK_PRIMITIVE_TOPOLOGY_POINT_LIST, // POINT_LIST - VK_PRIMITIVE_TOPOLOGY_LINE_LIST, // LINE_LIST - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, // LINE_STRIP - (VkPrimitiveTopology)0, // LINE_LOOP - VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, // LINE_LIST_ADJACENCY - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY, // LINE_STRIP_ADJACENCY - (VkPrimitiveTopology)0, // ISO_LINE_LIST - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, // TRIANGLE_LIST - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, // TRIANGLE_STRIP - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, // TRIANGLE_FAN - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY, // TRIANGLE_LIST_ADJACENCY - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY, // TRIANGLE_STRIP_ADJACENCY, - (VkPrimitiveTopology)0, // TRIANGLE_PATCH_ADJACENCY, - VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, // QUAD_PATCH_LIST, -}; - -const VkCullModeFlags VK_CULL_MODES[] = { - VK_CULL_MODE_NONE, - VK_CULL_MODE_FRONT_BIT, - VK_CULL_MODE_BACK_BIT, -}; - -const VkPolygonMode VK_POLYGON_MODES[] = { - VK_POLYGON_MODE_FILL, - VK_POLYGON_MODE_LINE, - VK_POLYGON_MODE_POINT, -}; - -const VkCompareOp VK_CMP_FUNCS[] = { - VK_COMPARE_OP_NEVER, - VK_COMPARE_OP_LESS, - VK_COMPARE_OP_EQUAL, - VK_COMPARE_OP_LESS_OR_EQUAL, - VK_COMPARE_OP_GREATER, - VK_COMPARE_OP_NOT_EQUAL, - VK_COMPARE_OP_GREATER_OR_EQUAL, - VK_COMPARE_OP_ALWAYS, -}; - -const VkStencilOp VK_STENCIL_OPS[] = { - VK_STENCIL_OP_ZERO, - VK_STENCIL_OP_KEEP, - VK_STENCIL_OP_REPLACE, - VK_STENCIL_OP_INCREMENT_AND_CLAMP, - VK_STENCIL_OP_DECREMENT_AND_CLAMP, - VK_STENCIL_OP_INVERT, - VK_STENCIL_OP_INCREMENT_AND_WRAP, - VK_STENCIL_OP_DECREMENT_AND_WRAP, -}; - -const VkBlendOp VK_BLEND_OPS[] = { - VK_BLEND_OP_ADD, - VK_BLEND_OP_SUBTRACT, - VK_BLEND_OP_REVERSE_SUBTRACT, - VK_BLEND_OP_MIN, - VK_BLEND_OP_MAX, -}; - -const VkBlendFactor VK_BLEND_FACTORS[] = { - VK_BLEND_FACTOR_ZERO, - VK_BLEND_FACTOR_ONE, - VK_BLEND_FACTOR_SRC_ALPHA, - VK_BLEND_FACTOR_DST_ALPHA, - VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, - VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA, - VK_BLEND_FACTOR_SRC_COLOR, - VK_BLEND_FACTOR_DST_COLOR, - VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR, - VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR, - VK_BLEND_FACTOR_SRC_ALPHA_SATURATE, - VK_BLEND_FACTOR_CONSTANT_COLOR, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR, - VK_BLEND_FACTOR_CONSTANT_ALPHA, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA, -}; - -const VkFilter VK_FILTERS[] = { - (VkFilter)0, // NONE - VK_FILTER_NEAREST, // POINT - VK_FILTER_LINEAR, // LINEAR - (VkFilter)0, // ANISOTROPIC -}; - -const VkSamplerMipmapMode VK_SAMPLER_MIPMAP_MODES[] = { - (VkSamplerMipmapMode)0, // NONE - VK_SAMPLER_MIPMAP_MODE_NEAREST, // POINT - VK_SAMPLER_MIPMAP_MODE_LINEAR, // LINEAR - VK_SAMPLER_MIPMAP_MODE_LINEAR, // ANISOTROPIC -}; - -const VkSamplerAddressMode VK_SAMPLER_ADDRESS_MODES[] = { - VK_SAMPLER_ADDRESS_MODE_REPEAT, // WRAP - VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT, // MIRROR - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // CLAMP - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, // BORDER -}; - -const VkAccessFlags FULL_ACCESS_FLAGS = VK_ACCESS_INDIRECT_COMMAND_READ_BIT | - VK_ACCESS_INDEX_READ_BIT | - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | - VK_ACCESS_UNIFORM_READ_BIT | - VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | - VK_ACCESS_SHADER_READ_BIT | - VK_ACCESS_SHADER_WRITE_BIT | - VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | - VK_ACCESS_TRANSFER_READ_BIT | - VK_ACCESS_TRANSFER_WRITE_BIT | - VK_ACCESS_HOST_READ_BIT | - VK_ACCESS_HOST_WRITE_BIT; - -void fullPipelineBarrier(VkCommandBuffer cmdBuff) { -#if CC_DEBUG > 0 - VkMemoryBarrier memoryBarrier{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; - memoryBarrier.srcAccessMask = FULL_ACCESS_FLAGS; - memoryBarrier.dstAccessMask = FULL_ACCESS_FLAGS; - vkCmdPipelineBarrier(cmdBuff, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, - 0, 1, &memoryBarrier, 0, nullptr, 0, nullptr); -#endif -} - -template -char (*countofHelper(T (&_Array)[Size]))[Size]; - -#define COUNTOF(array) (sizeof(*countofHelper(array)) + 0) - -template -uint toUint(T value) { - static_assert(std::is_arithmetic::value, "T must be numeric"); - - if (static_cast(value) > static_cast(std::numeric_limits::max())) { - throw std::runtime_error("to_u32() failed, value is too big to be converted to uint"); - } - - return static_cast(value); -} - -CC_INLINE VkDeviceSize roundUp(VkDeviceSize numToRound, uint multiple) { - return ((numToRound + multiple - 1) / multiple) * multiple; -} - -uint nextPowerOf2(uint v) { - v--; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - return ++v; -} - -bool isLayerSupported(const char *required, const vector &available) { - for (const VkLayerProperties &availableLayer : available) { - if (strcmp(availableLayer.layerName, required) == 0) { - return true; - } - } - return false; -} - -bool isExtensionSupported(const char *required, const vector &available) { - for (const VkExtensionProperties &availableExtension : available) { - if (strcmp(availableExtension.extensionName, required) == 0) { - return true; - } - } - return false; -} -} // namespace +extern const VkSurfaceTransformFlagsKHR TRANSFORMS_THAT_REQUIRE_FLIPPING; +extern const VkPrimitiveTopology VK_PRIMITIVE_MODES[]; +extern const VkCullModeFlags VK_CULL_MODES[]; +extern const VkPolygonMode VK_POLYGON_MODES[]; +extern const VkCompareOp VK_CMP_FUNCS[]; +extern const VkStencilOp VK_STENCIL_OPS[]; +extern const VkBlendOp VK_BLEND_OPS[]; +extern const VkBlendFactor VK_BLEND_FACTORS[]; +extern const VkFilter VK_FILTERS[]; +extern const VkSamplerMipmapMode VK_SAMPLER_MIPMAP_MODES[]; +extern const VkSamplerAddressMode VK_SAMPLER_ADDRESS_MODES[]; +extern const VkPipelineBindPoint VK_PIPELINE_BIND_POINTS[]; +extern const ThsvsAccessType THSVS_ACCESS_TYPES[]; +extern const VkImageLayout VK_IMAGE_LAYOUTS[]; +extern const VkAccessFlags FULL_ACCESS_FLAGS; } // namespace gfx } // namespace cc - -#endif // CC_GFXVULKAN_UTILS_H_ diff --git a/native/cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h b/native/cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h new file mode 100644 index 0000000000..d63b2c2dd9 --- /dev/null +++ b/native/cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h @@ -0,0 +1,1391 @@ +// Copyright (c) 2017-2019 Tobias Hector + +// 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. + +//// Simpler Vulkan Synchronization //// +/* +In an effort to make Vulkan synchronization more accessible, I created this +stb-inspired single-header library in order to somewhat simplify the core +synchronization mechanisms in Vulkan - pipeline barriers and events. + +Rather than the complex maze of enums and bit flags in Vulkan - many +combinations of which are invalid or nonsensical - this library collapses +this to a much shorter list of 40 distinct usage types, and a couple of +options for handling image layouts. + +Use of other synchronization mechanisms such as semaphores, fences and render +passes are not addressed in this API at present. + +USAGE + + #define the symbol THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_IMPLEMENTATION in + *one* C/C++ file before the #include of this file; the implementation + will be generated in that file. + +VERSION + + alpha.8 + + Alpha.8 adds a host preinitialization state for linear images, as well as a number of new access sets for extensions released since the last update. + + +VERSION HISTORY + + alpha.7 + + Alpha.7 incorporates a number of fixes from @gwihlidal, and fixes + handling of pipeline stages in the presence of multiple access types or + barriers in light of other recent changes. + + alpha.6 + + Alpha.6 fixes a typo (VK_ACCESS_TYPE_MEMORY_READ|WRITE_BIT should have been VK_ACCESS_MEMORY_READ|WRITE_BIT), and sets the pipeline stage src and dst flag bits to VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT and VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT during initialization, not 0 as per alpha.5 + + alpha.5 + + Alpha.5 now correctly zeroes out the pipeline stage flags before trying to incrementally set bits on them... common theme here, whoops. + + alpha.4 + + Alpha.4 now correctly zeroes out the access types before trying to incrementally set bits on them (!) + + alpha.3 + + Alpha.3 changes the following: + + Uniform and vertex buffer access in one enum, matching D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER: + - THSVS_ACCESS_ANY_SHADER_READ_UNIFORM_BUFFER_OR_VERTEX_BUFFER + + Color read *and* write access, matching D3D12_RESOURCE_STATE_RENDER_TARGET: + - THSVS_ACCESS_COLOR_ATTACHMENT_READ_WRITE + + Also the "THSVS_ACCESS_*_SHADER_READ_SAMPLED_IMAGE" enums have been renamed to the form "THSVS_ACCESS_*_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER" + + alpha.2 + + Alpha.2 adds four new resource states for "ANY SHADER ACCESS": + - THSVS_ACCESS_ANY_SHADER_READ_UNIFORM_BUFFER + - THSVS_ACCESS_ANY_SHADER_READ_SAMPLED_IMAGE + - THSVS_ACCESS_ANY_SHADER_READ_OTHER + - THSVS_ACCESS_ANY_SHADER_WRITE + + alpha.1 + + Alpha.1 adds three new resource states: + - THSVS_ACCESS_GENERAL (Any access on the device) + - THSVS_ACCESS_DEPTH_ATTACHMENT_WRITE_STENCIL_READ_ONLY (Write access to only the depth aspect of a depth/stencil attachment) + - THSVS_ACCESS_STENCIL_ATTACHMENT_WRITE_DEPTH_READ_ONLY (Write access to only the stencil aspect of a depth/stencil attachment) + + It also fixes a couple of typos, and adds clarification as to when extensions need to be enabled to use a feature. + + alpha.0 + + This is the very first public release of this library; future revisions + of this API may change the API in an incompatible manner as feedback is + received. + Once the version becomes stable, incompatible changes will only be made + to major revisions of the API - minor revisions will only contain + bug fixes or minor additions. + +MEMORY ALLOCATION + + The thsvsCmdPipelineBarrier and thWaitEvents commands allocate temporary + storage for the Vulkan barrier equivalents in order to pass them to the + respective Vulkan commands. + + These use the `THSVS_TEMP_ALLOC(size)` and `THSVS_TEMP_FREE(x)` macros, + which are by default set to alloca(size) and ((void)(x)), respectively. + If you don't want to use stack space or would rather use your own + allocation strategy, these can be overridden by defining these macros + in before #include-ing the header file with + THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_IMPLEMENTATION defined. + + I'd rather avoid the need for these allocations in what are likely to be + high-traffic commands, but currently just want to ship something - may + revisit this at a future date based on feedback. + +EXPRESSIVENESS COMPARED TO RAW VULKAN + + Despite the fact that this API is fairly simple, it expresses 99% of + what you'd actually ever want to do in practice. + Adding the missing expressiveness would result in increased complexity + which didn't seem worth the trade off - however I would consider adding + something for them in future if it becomes an issue. + + Here's a list of known things you can't express: + + * Execution only dependencies cannot be expressed. + These are occasionally useful in conjunction with semaphores, or when + trying to be clever with scheduling - but their usage is both limited + and fairly tricky to get right anyway. + * Depth/Stencil Input Attachments can be read in a shader using either + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL or + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL - this library + *always* uses VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL. + It's possible (though highly unlikely) when aliasing images that this + results in unnecessary transitions. + +ERROR CHECKS + + By default, as with the Vulkan API, this library does NOT check for + errors. + However, a number of optional error checks (THSVS_ERROR_CHECK_*) can be + enabled by uncommenting the relevant #defines. + Currently, error checks simply assert at the point a failure is detected + and do not output an error message. + I certainly do not claim they capture *all* possible errors, but they + capture what should be some of the more common ones. + Use of the Vulkan Validation Layers in tandem with this library is + strongly recommended: + https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers + +ISSUES + + This header was clean of warnings using -Wall as of time of publishing + on both gcc 4.8.4 and clang 3.5, using the c99 standard. + + There's a potential pitfall in thsvsCmdPipelineBarrier and thsvsCmdWaitEvents + where alloca is used for temporary allocations. See MEMORY ALLOCATION + for more information. + + Testing of this library is so far extremely limited with no immediate + plans to add to that - so there's bound to be some amount of bugs. + Please raise these issues on the repo issue tracker, or provide a fix + via a pull request yourself if you're so inclined. +*/ + +#ifndef THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_H +#define THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_H 1 + +#include + +/* +ThsvsAccessType defines all potential resource usages in the Vulkan API. +*/ +typedef enum ThsvsAccessType { + THSVS_ACCESS_NONE, // No access. Useful primarily for initialization + +// Read access + // Requires VK_NV_device_generated_commands to be enabled + THSVS_ACCESS_COMMAND_BUFFER_READ_NV, // Command buffer read operation as defined by NV_device_generated_commands + THSVS_ACCESS_INDIRECT_BUFFER, // Read as an indirect buffer for drawing or dispatch + THSVS_ACCESS_INDEX_BUFFER, // Read as an index buffer for drawing + THSVS_ACCESS_VERTEX_BUFFER, // Read as a vertex buffer for drawing + THSVS_ACCESS_VERTEX_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a vertex shader + THSVS_ACCESS_VERTEX_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // Read as a sampled image/uniform texel buffer in a vertex shader + THSVS_ACCESS_VERTEX_SHADER_READ_OTHER, // Read as any other resource in a vertex shader + THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a tessellation control shader + THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // Read as a sampled image/uniform texel buffer in a tessellation control shader + THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_READ_OTHER, // Read as any other resource in a tessellation control shader + THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a tessellation evaluation shader + THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // Read as a sampled image/uniform texel buffer in a tessellation evaluation shader + THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_READ_OTHER, // Read as any other resource in a tessellation evaluation shader + THSVS_ACCESS_GEOMETRY_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a geometry shader + THSVS_ACCESS_GEOMETRY_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER,// Read as a sampled image/uniform texel buffer in a geometry shader + THSVS_ACCESS_GEOMETRY_SHADER_READ_OTHER, // Read as any other resource in a geometry shader + THSVS_ACCESS_TASK_SHADER_READ_UNIFORM_BUFFER_NV, // Read as a uniform buffer in a task shader + THSVS_ACCESS_TASK_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER_NV, // Read as a sampled image/uniform texel buffer in a task shader + THSVS_ACCESS_TASK_SHADER_READ_OTHER_NV, // Read as any other resource in a task shader + THSVS_ACCESS_MESH_SHADER_READ_UNIFORM_BUFFER_NV, // Read as a uniform buffer in a mesh shader + THSVS_ACCESS_MESH_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER_NV, // Read as a sampled image/uniform texel buffer in a mesh shader + THSVS_ACCESS_MESH_SHADER_READ_OTHER_NV, // Read as any other resource in a mesh shader + THSVS_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_EXT, // Read as a transform feedback counter buffer + THSVS_ACCESS_FRAGMENT_DENSITY_MAP_READ_EXT, // Read as a fragment density map image + THSVS_ACCESS_SHADING_RATE_READ_NV, // Read as a shading rate image + THSVS_ACCESS_FRAGMENT_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a fragment shader + THSVS_ACCESS_FRAGMENT_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER,// Read as a sampled image/uniform texel buffer in a fragment shader + THSVS_ACCESS_FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT, // Read as an input attachment with a color format in a fragment shader + THSVS_ACCESS_FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT, // Read as an input attachment with a depth/stencil format in a fragment shader + THSVS_ACCESS_FRAGMENT_SHADER_READ_OTHER, // Read as any other resource in a fragment shader + THSVS_ACCESS_COLOR_ATTACHMENT_READ, // Read by standard blending/logic operations or subpass load operations + THSVS_ACCESS_COLOR_ATTACHMENT_ADVANCED_BLENDING_EXT, // Read by advanced blending, standard blending, logic operations, or subpass load operations + THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ, // Read by depth/stencil tests or subpass load operations + THSVS_ACCESS_COMPUTE_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in a compute shader + THSVS_ACCESS_COMPUTE_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // Read as a sampled image/uniform texel buffer in a compute shader + THSVS_ACCESS_COMPUTE_SHADER_READ_OTHER, // Read as any other resource in a compute shader + THSVS_ACCESS_ANY_SHADER_READ_UNIFORM_BUFFER, // Read as a uniform buffer in any shader + THSVS_ACCESS_ANY_SHADER_READ_UNIFORM_BUFFER_OR_VERTEX_BUFFER, // Read as a uniform buffer in any shader, or a vertex buffer + THSVS_ACCESS_ANY_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER, // Read as a sampled image in any shader + THSVS_ACCESS_ANY_SHADER_READ_OTHER, // Read as any other resource (excluding attachments) in any shader + THSVS_ACCESS_TRANSFER_READ, // Read as the source of a transfer operation + THSVS_ACCESS_HOST_READ, // Read on the host + + // Requires VK_KHR_swapchain to be enabled + THSVS_ACCESS_PRESENT, // Read by the presentation engine (i.e. vkQueuePresentKHR) + + // Requires VK_EXT_conditional_rendering to be enabled + THSVS_ACCESS_CONDITIONAL_RENDERING_READ_EXT, // Read by conditional rendering + + // Requires VK_NV_ray_tracing to be enabled + THSVS_ACCESS_RAY_TRACING_SHADER_ACCELERATION_STRUCTURE_READ_NV, // Read by a ray tracing shader as an acceleration structure + THSVS_ACCESS_ACCELERATION_STRUCTURE_BUILD_READ_NV, // Read as an acceleration structure during a build + + // Read accesses end + THSVS_END_OF_READ_ACCESS, + +// Write access + // Requires VK_NV_device_generated_commands to be enabled + THSVS_ACCESS_COMMAND_BUFFER_WRITE_NV, // Command buffer write operation + THSVS_ACCESS_VERTEX_SHADER_WRITE, // Written as any resource in a vertex shader + THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_WRITE, // Written as any resource in a tessellation control shader + THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_WRITE, // Written as any resource in a tessellation evaluation shader + THSVS_ACCESS_GEOMETRY_SHADER_WRITE, // Written as any resource in a geometry shader + + // Requires VK_NV_mesh_shading to be enabled + THSVS_ACCESS_TASK_SHADER_WRITE_NV, // Written as any resource in a task shader + THSVS_ACCESS_MESH_SHADER_WRITE_NV, // Written as any resource in a mesh shader + + // Requires VK_EXT_transform_feedback to be enabled + THSVS_ACCESS_TRANSFORM_FEEDBACK_WRITE_EXT, // Written as a transform feedback buffer + THSVS_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_EXT, // Written as a transform feedback counter buffer + + THSVS_ACCESS_FRAGMENT_SHADER_WRITE, // Written as any resource in a fragment shader + THSVS_ACCESS_COLOR_ATTACHMENT_WRITE, // Written as a color attachment during rendering, or via a subpass store op + THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE, // Written as a depth/stencil attachment during rendering, or via a subpass store op + + // Requires VK_KHR_maintenance2 to be enabled + THSVS_ACCESS_DEPTH_ATTACHMENT_WRITE_STENCIL_READ_ONLY, // Written as a depth aspect of a depth/stencil attachment during rendering, whilst the stencil aspect is read-only + THSVS_ACCESS_STENCIL_ATTACHMENT_WRITE_DEPTH_READ_ONLY, // Written as a stencil aspect of a depth/stencil attachment during rendering, whilst the depth aspect is read-only + + THSVS_ACCESS_COMPUTE_SHADER_WRITE, // Written as any resource in a compute shader + THSVS_ACCESS_ANY_SHADER_WRITE, // Written as any resource in any shader + THSVS_ACCESS_TRANSFER_WRITE, // Written as the destination of a transfer operation + THSVS_ACCESS_HOST_PREINITIALIZED, // Data pre-filled by host before device access starts + THSVS_ACCESS_HOST_WRITE, // Written on the host + + // Requires VK_NV_ray_tracing to be enabled + THSVS_ACCESS_ACCELERATION_STRUCTURE_BUILD_WRITE_NV, // Written as an acceleration structure during a build + + THSVS_ACCESS_COLOR_ATTACHMENT_READ_WRITE, // Read or written as a color attachment during rendering +// General access + THSVS_ACCESS_GENERAL, // Covers any access - useful for debug, generally avoid for performance reasons + +// Number of access types + THSVS_NUM_ACCESS_TYPES +} ThsvsAccessType; + +/* +ThsvsImageLayout defines a handful of layout options for images. +Rather than a list of all possible image layouts, this reduced list is +correlated with the access types to map to the correct Vulkan layouts. +THSVS_IMAGE_LAYOUT_OPTIMAL is usually preferred. +*/ +typedef enum ThsvsImageLayout { + THSVS_IMAGE_LAYOUT_OPTIMAL, // Choose the most optimal layout for each usage. Performs layout transitions as appropriate for the access. + THSVS_IMAGE_LAYOUT_GENERAL, // Layout accessible by all Vulkan access types on a device - no layout transitions except for presentation + + // Requires VK_KHR_shared_presentable_image to be enabled. Can only be used for shared presentable images (i.e. single-buffered swap chains). + THSVS_IMAGE_LAYOUT_GENERAL_AND_PRESENTATION // As GENERAL, but also allows presentation engines to access it - no layout transitions +} ThsvsImageLayout; + +/* +Global barriers define a set of accesses on multiple resources at once. +If a buffer or image doesn't require a queue ownership transfer, or an image +doesn't require a layout transition (e.g. you're using one of the GENERAL +layouts) then a global barrier should be preferred. +Simply define the previous and next access types of resources affected. +*/ +typedef struct ThsvsGlobalBarrier { + uint32_t prevAccessCount; + const ThsvsAccessType* pPrevAccesses; + uint32_t nextAccessCount; + const ThsvsAccessType* pNextAccesses; +} ThsvsGlobalBarrier; + +/* +Buffer barriers should only be used when a queue family ownership transfer +is required - prefer global barriers at all other times. + +Access types are defined in the same way as for a global memory barrier, but +they only affect the buffer range identified by buffer, offset and size, +rather than all resources. +srcQueueFamilyIndex and dstQueueFamilyIndex will be passed unmodified into a +VkBufferMemoryBarrier. + +A buffer barrier defining a queue ownership transfer needs to be executed +twice - once by a queue in the source queue family, and then once again by a +queue in the destination queue family, with a semaphore guaranteeing +execution order between them. +*/ +typedef struct ThsvsBufferBarrier { + uint32_t prevAccessCount; + const ThsvsAccessType* pPrevAccesses; + uint32_t nextAccessCount; + const ThsvsAccessType* pNextAccesses; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} ThsvsBufferBarrier; + +/* +Image barriers should only be used when a queue family ownership transfer +or an image layout transition is required - prefer global barriers at all +other times. +In general it is better to use image barriers with THSVS_IMAGE_LAYOUT_OPTIMAL +than it is to use global barriers with images using either of the +THSVS_IMAGE_LAYOUT_GENERAL* layouts. + +Access types are defined in the same way as for a global memory barrier, but +they only affect the image subresource range identified by image and +subresourceRange, rather than all resources. +srcQueueFamilyIndex, dstQueueFamilyIndex, image, and subresourceRange will +be passed unmodified into a VkImageMemoryBarrier. + +An image barrier defining a queue ownership transfer needs to be executed +twice - once by a queue in the source queue family, and then once again by a +queue in the destination queue family, with a semaphore guaranteeing +execution order between them. + +If discardContents is set to true, the contents of the image become +undefined after the barrier is executed, which can result in a performance +boost over attempting to preserve the contents. +This is particularly useful for transient images where the contents are +going to be immediately overwritten. A good example of when to use this is +when an application re-uses a presented image after vkAcquireNextImageKHR. +*/ +typedef struct ThsvsImageBarrier { + uint32_t prevAccessCount; + const ThsvsAccessType* pPrevAccesses; + uint32_t nextAccessCount; + const ThsvsAccessType* pNextAccesses; + ThsvsImageLayout prevLayout; + ThsvsImageLayout nextLayout; + VkBool32 discardContents; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} ThsvsImageBarrier; + +/* +Mapping function that translates a set of accesses into the corresponding +pipeline stages, VkAccessFlags, and image layout. +*/ +void thsvsGetAccessInfo( + uint32_t accessCount, + const ThsvsAccessType* pAccesses, + VkPipelineStageFlags* pStageMask, + VkAccessFlags* pAccessMask, + VkImageLayout* pImageLayout, + bool* pHasWriteAccess); + +/* +Mapping function that translates a global barrier into a set of source and +destination pipeline stages, and a VkMemoryBarrier, that can be used with +Vulkan's synchronization methods. +*/ +void thsvsGetVulkanMemoryBarrier( + const ThsvsGlobalBarrier& thBarrier, + VkPipelineStageFlags* pSrcStages, + VkPipelineStageFlags* pDstStages, + VkMemoryBarrier* pVkBarrier); + +/* +Mapping function that translates a buffer barrier into a set of source and +destination pipeline stages, and a VkBufferMemoryBarrier, that can be used +with Vulkan's synchronization methods. +*/ +void thsvsGetVulkanBufferMemoryBarrier( + const ThsvsBufferBarrier& thBarrier, + VkPipelineStageFlags* pSrcStages, + VkPipelineStageFlags* pDstStages, + VkBufferMemoryBarrier* pVkBarrier); + +/* +Mapping function that translates an image barrier into a set of source and +destination pipeline stages, and a VkBufferMemoryBarrier, that can be used +with Vulkan's synchronization methods. +*/ +void thsvsGetVulkanImageMemoryBarrier( + const ThsvsImageBarrier& thBarrier, + VkPipelineStageFlags* pSrcStages, + VkPipelineStageFlags* pDstStages, + VkImageMemoryBarrier* pVkBarrier); + +/* +Simplified wrapper around vkCmdPipelineBarrier. + +The mapping functions defined above are used to translate the passed in +barrier definitions into a set of pipeline stages and native Vulkan memory +barriers to be passed to vkCmdPipelineBarrier. + +commandBuffer is passed unmodified to vkCmdPipelineBarrier. +*/ +void thsvsCmdPipelineBarrier( + VkCommandBuffer commandBuffer, + const ThsvsGlobalBarrier* pGlobalBarrier, + uint32_t bufferBarrierCount, + const ThsvsBufferBarrier* pBufferBarriers, + uint32_t imageBarrierCount, + const ThsvsImageBarrier* pImageBarriers); + +/* +Wrapper around vkCmdSetEvent. + +Sets an event when the accesses defined by pPrevAccesses are completed. + +commandBuffer and event are passed unmodified to vkCmdSetEvent. +*/ +void thsvsCmdSetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + uint32_t prevAccessCount, + const ThsvsAccessType* pPrevAccesses); + +/* +Wrapper around vkCmdResetEvent. + +Resets an event when the accesses defined by pPrevAccesses are completed. + +commandBuffer and event are passed unmodified to vkCmdResetEvent. +*/ +void thsvsCmdResetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + uint32_t prevAccessCount, + const ThsvsAccessType* pPrevAccesses); + +/* +Simplified wrapper around vkCmdWaitEvents. + +The mapping functions defined above are used to translate the passed in +barrier definitions into a set of pipeline stages and native Vulkan memory +barriers to be passed to vkCmdPipelineBarrier. + +commandBuffer, eventCount, and pEvents are passed unmodified to +vkCmdWaitEvents. +*/ +void thsvsCmdWaitEvents( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + const ThsvsGlobalBarrier* pGlobalBarrier, + uint32_t bufferBarrierCount, + const ThsvsBufferBarrier* pBufferBarriers, + uint32_t imageBarrierCount, + const ThsvsImageBarrier* pImageBarriers); + +#endif // THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_H + +#ifdef THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_IMPLEMENTATION + +#include + +//// Optional Error Checking //// +/* +Checks for barriers defining multiple usages that have different layouts +*/ +// #define THSVS_ERROR_CHECK_MIXED_IMAGE_LAYOUT + +/* +Checks if an image/buffer barrier is used when a global barrier would suffice +*/ +// #define THSVS_ERROR_CHECK_COULD_USE_GLOBAL_BARRIER + +/* +Checks if a write access is listed alongside any other access - if so it +points to a potential data hazard that you need to synchronize separately. +In some cases it may simply be over-synchronization however, but it's usually +worth checking. +*/ +// #define THSVS_ERROR_CHECK_POTENTIAL_HAZARD + +/* +Checks if a variety of table lookups (like the access map) are within +a valid range. +*/ +// #define THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + +//// Temporary Memory Allocation //// +/* +Override these if you can't afford the stack space or just want to use a +custom temporary allocator. +These are currently used exclusively to allocate Vulkan memory barriers in +the API, one for each Buffer or Image barrier passed into the pipeline and +event functions. +May consider other allocation strategies in future. +*/ + +// Alloca inclusion code below copied from +// https://github.com/nothings/stb/blob/master/stb_vorbis.c + +// find definition of alloca if it's not in stdlib.h: +#if defined(_MSC_VER) || defined(__MINGW32__) + #include +#endif +#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) + #include +#endif + +#if defined(THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE) || \ + defined(THSVS_ERROR_CHECK_COULD_USE_GLOBAL_BARRIER) || \ + defined(THSVS_ERROR_CHECK_MIXED_IMAGE_LAYOUT) || \ + defined(THSVS_ERROR_CHECK_POTENTIAL_HAZARD) + #include +#endif + +#if !defined(THSVS_TEMP_ALLOC) +#define THSVS_TEMP_ALLOC(size) (alloca(size)) +#endif + +#if !defined(THSVS_TEMP_FREE) +#define THSVS_TEMP_FREE(x) ((void)(x)) +#endif + +typedef struct ThsvsVkAccessInfo { + VkPipelineStageFlags stageMask; + VkAccessFlags accessMask; + VkImageLayout imageLayout; +} ThsvsVkAccessInfo; + +const ThsvsVkAccessInfo ThsvsAccessMap[THSVS_NUM_ACCESS_TYPES] = { + // THSVS_ACCESS_NONE + { 0, + 0, + VK_IMAGE_LAYOUT_UNDEFINED}, + +// Read Access + // THSVS_ACCESS_COMMAND_BUFFER_READ_NV + { VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV, + VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_INDIRECT_BUFFER + { VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, + VK_ACCESS_INDIRECT_COMMAND_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + + // THSVS_ACCESS_INDEX_BUFFER + { VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, + VK_ACCESS_INDEX_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_VERTEX_BUFFER + { VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, + VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_VERTEX_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_VERTEX_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER + { VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_VERTEX_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER + { VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER + { VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_GEOMETRY_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_GEOMETRY_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER + { VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_GEOMETRY_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_TASK_SHADER_READ_UNIFORM_BUFFER_NV + { VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_TASK_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER_NV + { VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_TASK_SHADER_READ_OTHER_NV + { VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_MESH_SHADER_READ_UNIFORM_BUFFER_NV + { VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_MESH_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER_NV + { VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_MESH_SHADER_READ_OTHER_NV + { VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_EXT + { VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT, + VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_FRAGMENT_DENSITY_MAP_READ_EXT + { VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT, + VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT, + VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT}, + // THSVS_ACCESS_SHADING_RATE_READ_NV + { VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV, + VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV, + VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV}, + + // THSVS_ACCESS_FRAGMENT_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_FRAGMENT_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER + { VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT + { VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT + { VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_FRAGMENT_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_COLOR_ATTACHMENT_READ + { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + // THSVS_ACCESS_COLOR_ATTACHMENT_ADVANCED_BLENDING_EXT + { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, + VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + // THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ + { VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL}, + + // THSVS_ACCESS_COMPUTE_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_COMPUTE_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER + { VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_COMPUTE_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_ANY_SHADER_READ_UNIFORM_BUFFER + { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_ACCESS_UNIFORM_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_ANY_SHADER_READ_UNIFORM_BUFFER_OR_VERTEX_BUFFER + { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_ACCESS_UNIFORM_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_ANY_SHADER_READ_SAMPLED_IMAGE + { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL}, + // THSVS_ACCESS_ANY_SHADER_READ_OTHER + { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_TRANSFER_READ + { VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_ACCESS_TRANSFER_READ_BIT, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL}, + // THSVS_ACCESS_HOST_READ + { VK_PIPELINE_STAGE_HOST_BIT, + VK_ACCESS_HOST_READ_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_PRESENT + { 0, + 0, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR}, + // THSVS_ACCESS_CONDITIONAL_RENDERING_READ_EXT + { VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT, + VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT, + VK_IMAGE_LAYOUT_UNDEFINED}, + + // THSVS_ACCESS_RAY_TRACING_SHADER_ACCELERATION_STRUCTURE_READ_NV + { VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV, + VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_ACCELERATION_STRUCTURE_BUILD_READ_NV + { VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV, + VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_END_OF_READ_ACCESS + { 0, + 0, + VK_IMAGE_LAYOUT_UNDEFINED}, + +// Write access + // THSVS_ACCESS_COMMAND_BUFFER_WRITE_NV + { VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV, + VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_VERTEX_SHADER_WRITE + { VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_TESSELLATION_CONTROL_SHADER_WRITE + { VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_TESSELLATION_EVALUATION_SHADER_WRITE + { VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_GEOMETRY_SHADER_WRITE + { VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_TASK_SHADER_WRITE_NV + { VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_MESH_SHADER_WRITE_NV + { VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_TRANSFORM_FEEDBACK_WRITE_EXT + { VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT, + VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_EXT + { VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT, + VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT, + VK_IMAGE_LAYOUT_UNDEFINED}, + // THSVS_ACCESS_FRAGMENT_SHADER_WRITE + { VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_COLOR_ATTACHMENT_WRITE + { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + // THSVS_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE + { VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}, + // THSVS_ACCESS_DEPTH_ATTACHMENT_WRITE_STENCIL_READ_ONLY + { VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR}, + // THSVS_ACCESS_STENCIL_ATTACHMENT_WRITE_DEPTH_READ_ONLY + { VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, + VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR}, + + // THSVS_ACCESS_COMPUTE_SHADER_WRITE + { VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_ANY_SHADER_WRITE + { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_ACCESS_SHADER_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + + // THSVS_ACCESS_TRANSFER_WRITE + { VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL}, + // THSVS_ACCESS_HOST_PREINITIALIZED + { VK_PIPELINE_STAGE_HOST_BIT, + VK_ACCESS_HOST_WRITE_BIT, + VK_IMAGE_LAYOUT_PREINITIALIZED}, + // THSVS_ACCESS_HOST_WRITE + { VK_PIPELINE_STAGE_HOST_BIT, + VK_ACCESS_HOST_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL}, + // THSVS_ACCESS_ACCELERATION_STRUCTURE_BUILD_WRITE_NV + { VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV, + VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV, + VK_IMAGE_LAYOUT_UNDEFINED}, + + // THSVS_ACCESS_COLOR_ATTACHMENT_READ_WRITE + { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL}, + // THSVS_ACCESS_GENERAL + { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, + VK_IMAGE_LAYOUT_GENERAL} +}; + +void thsvsGetAccessInfo( + uint32_t accessCount, + const ThsvsAccessType* pAccesses, + VkPipelineStageFlags* pStageMask, + VkAccessFlags* pAccessMask, + VkImageLayout* pImageLayout, + bool* pHasWriteAccess) +{ + *pStageMask = 0; + *pAccessMask = 0; + *pImageLayout = VK_IMAGE_LAYOUT_UNDEFINED; + *pHasWriteAccess = false; + + for (uint32_t i = 0; i < accessCount; ++i) + { + ThsvsAccessType access = pAccesses[i]; + const ThsvsVkAccessInfo* pAccessInfo = &ThsvsAccessMap[access]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the previous access index is a valid range for the lookup + assert(access < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(access < THSVS_END_OF_READ_ACCESS || accessCount == 1); +#endif + + *pStageMask |= pAccessInfo->stageMask; + + if (access > THSVS_END_OF_READ_ACCESS) + *pHasWriteAccess = true; + + *pAccessMask |= pAccessInfo->accessMask; + + VkImageLayout layout = pAccessInfo->imageLayout; + +#ifdef THSVS_ERROR_CHECK_MIXED_IMAGE_LAYOUT + assert(*pImageLayout == VK_IMAGE_LAYOUT_UNDEFINED || + *pImageLayout == layout); +#endif + + *pImageLayout = layout; + } +} + +void thsvsGetVulkanMemoryBarrier( + const ThsvsGlobalBarrier& thBarrier, + VkPipelineStageFlags* pSrcStages, + VkPipelineStageFlags* pDstStages, + VkMemoryBarrier* pVkBarrier) +{ + *pSrcStages = 0; + *pDstStages = 0; + pVkBarrier->sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER; + pVkBarrier->pNext = NULL; + pVkBarrier->srcAccessMask = 0; + pVkBarrier->dstAccessMask = 0; + + for (uint32_t i = 0; i < thBarrier.prevAccessCount; ++i) + { + ThsvsAccessType prevAccess = thBarrier.pPrevAccesses[i]; + const ThsvsVkAccessInfo* pPrevAccessInfo = &ThsvsAccessMap[prevAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the previous access index is a valid range for the lookup + assert(prevAccess < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(prevAccess < THSVS_END_OF_READ_ACCESS || thBarrier.prevAccessCount == 1); +#endif + + *pSrcStages |= pPrevAccessInfo->stageMask; + + // Add appropriate availability operations - for writes only. + if (prevAccess > THSVS_END_OF_READ_ACCESS) + pVkBarrier->srcAccessMask |= pPrevAccessInfo->accessMask; + } + + for (uint32_t i = 0; i < thBarrier.nextAccessCount; ++i) + { + ThsvsAccessType nextAccess = thBarrier.pNextAccesses[i]; + const ThsvsVkAccessInfo* pNextAccessInfo = &ThsvsAccessMap[nextAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the next access index is a valid range for the lookup + assert(nextAccess < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(nextAccess < THSVS_END_OF_READ_ACCESS || thBarrier.nextAccessCount == 1); +#endif + *pDstStages |= pNextAccessInfo->stageMask; + + // Add visibility operations as necessary. + // If the src access mask is zero, this is a WAR hazard (or for some reason a "RAR"), + // so the dst access mask can be safely zeroed as these don't need visibility. + if (pVkBarrier->srcAccessMask != 0) + pVkBarrier->dstAccessMask |= pNextAccessInfo->accessMask; + } + + // Ensure that the stage masks are valid if no stages were determined + if (*pSrcStages == 0) + *pSrcStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + if (*pDstStages == 0) + *pDstStages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; +} + +void thsvsGetVulkanBufferMemoryBarrier( + const ThsvsBufferBarrier& thBarrier, + VkPipelineStageFlags* pSrcStages, + VkPipelineStageFlags* pDstStages, + VkBufferMemoryBarrier* pVkBarrier) +{ + *pSrcStages = 0; + *pDstStages = 0; + pVkBarrier->sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; + pVkBarrier->pNext = NULL; + pVkBarrier->srcAccessMask = 0; + pVkBarrier->dstAccessMask = 0; + pVkBarrier->srcQueueFamilyIndex = thBarrier.srcQueueFamilyIndex; + pVkBarrier->dstQueueFamilyIndex = thBarrier.dstQueueFamilyIndex; + pVkBarrier->buffer = thBarrier.buffer; + pVkBarrier->offset = thBarrier.offset; + pVkBarrier->size = thBarrier.size; + +#ifdef THSVS_ERROR_CHECK_COULD_USE_GLOBAL_BARRIER + assert(pVkBarrier->srcQueueFamilyIndex != pVkBarrier->dstQueueFamilyIndex); +#endif + + for (uint32_t i = 0; i < thBarrier.prevAccessCount; ++i) + { + ThsvsAccessType prevAccess = thBarrier.pPrevAccesses[i]; + const ThsvsVkAccessInfo* pPrevAccessInfo = &ThsvsAccessMap[prevAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the previous access index is a valid range for the lookup + assert(prevAccess < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(prevAccess < THSVS_END_OF_READ_ACCESS || thBarrier.prevAccessCount == 1); +#endif + + *pSrcStages |= pPrevAccessInfo->stageMask; + + // Add appropriate availability operations - for writes only. + if (prevAccess > THSVS_END_OF_READ_ACCESS) + pVkBarrier->srcAccessMask |= pPrevAccessInfo->accessMask; + } + + for (uint32_t i = 0; i < thBarrier.nextAccessCount; ++i) + { + ThsvsAccessType nextAccess = thBarrier.pNextAccesses[i]; + const ThsvsVkAccessInfo* pNextAccessInfo = &ThsvsAccessMap[nextAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the next access index is a valid range for the lookup + assert(nextAccess < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(nextAccess < THSVS_END_OF_READ_ACCESS || thBarrier.nextAccessCount == 1); +#endif + + *pDstStages |= pNextAccessInfo->stageMask; + + // Add visibility operations as necessary. + // If the src access mask is zero, this is a WAR hazard (or for some reason a "RAR"), + // so the dst access mask can be safely zeroed as these don't need visibility. + if (pVkBarrier->srcAccessMask != 0) + pVkBarrier->dstAccessMask |= pNextAccessInfo->accessMask; + } + + // Ensure that the stage masks are valid if no stages were determined + if (*pSrcStages == 0) + *pSrcStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + if (*pDstStages == 0) + *pDstStages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; +} + +void thsvsGetVulkanImageMemoryBarrier( + const ThsvsImageBarrier& thBarrier, + VkPipelineStageFlags* pSrcStages, + VkPipelineStageFlags* pDstStages, + VkImageMemoryBarrier* pVkBarrier) +{ + *pSrcStages = 0; + *pDstStages = 0; + pVkBarrier->sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + pVkBarrier->pNext = NULL; + pVkBarrier->srcAccessMask = 0; + pVkBarrier->dstAccessMask = 0; + pVkBarrier->srcQueueFamilyIndex = thBarrier.srcQueueFamilyIndex; + pVkBarrier->dstQueueFamilyIndex = thBarrier.dstQueueFamilyIndex; + pVkBarrier->image = thBarrier.image; + pVkBarrier->subresourceRange = thBarrier.subresourceRange; + pVkBarrier->oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + pVkBarrier->newLayout = VK_IMAGE_LAYOUT_UNDEFINED; + + for (uint32_t i = 0; i < thBarrier.prevAccessCount; ++i) + { + ThsvsAccessType prevAccess = thBarrier.pPrevAccesses[i]; + const ThsvsVkAccessInfo* pPrevAccessInfo = &ThsvsAccessMap[prevAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the previous access index is a valid range for the lookup + assert(prevAccess < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(prevAccess < THSVS_END_OF_READ_ACCESS || thBarrier.prevAccessCount == 1); +#endif + + *pSrcStages |= pPrevAccessInfo->stageMask; + + // Add appropriate availability operations - for writes only. + if (prevAccess > THSVS_END_OF_READ_ACCESS) + pVkBarrier->srcAccessMask |= pPrevAccessInfo->accessMask; + + if (thBarrier.discardContents == VK_TRUE) + { + pVkBarrier->oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + } + else + { + VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED; + + switch(thBarrier.prevLayout) + { + case THSVS_IMAGE_LAYOUT_GENERAL: + if (prevAccess == THSVS_ACCESS_PRESENT) + layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + else + layout = VK_IMAGE_LAYOUT_GENERAL; + break; + case THSVS_IMAGE_LAYOUT_OPTIMAL: + layout = pPrevAccessInfo->imageLayout; + break; + case THSVS_IMAGE_LAYOUT_GENERAL_AND_PRESENTATION: + layout = VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR; + break; + } + + +#ifdef THSVS_ERROR_CHECK_MIXED_IMAGE_LAYOUT + assert(pVkBarrier->oldLayout == VK_IMAGE_LAYOUT_UNDEFINED || + pVkBarrier->oldLayout == layout); +#endif + pVkBarrier->oldLayout = layout; + } + } + + for (uint32_t i = 0; i < thBarrier.nextAccessCount; ++i) + { + ThsvsAccessType nextAccess = thBarrier.pNextAccesses[i]; + const ThsvsVkAccessInfo* pNextAccessInfo = &ThsvsAccessMap[nextAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the next access index is a valid range for the lookup + assert(nextAccess < THSVS_NUM_ACCESS_TYPES); +#endif + +#ifdef THSVS_ERROR_CHECK_POTENTIAL_HAZARD + // Asserts that the access is a read, else it's a write and it should appear on its own. + assert(nextAccess < THSVS_END_OF_READ_ACCESS || thBarrier.nextAccessCount == 1); +#endif + + *pDstStages |= pNextAccessInfo->stageMask; + + // Add visibility operations as necessary. + // If the src access mask is zero, this is a WAR hazard (or for some reason a "RAR"), + // so the dst access mask can be safely zeroed as these don't need visibility. + if (pVkBarrier->srcAccessMask != 0) + pVkBarrier->dstAccessMask |= pNextAccessInfo->accessMask; + + VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED; + switch(thBarrier.nextLayout) + { + case THSVS_IMAGE_LAYOUT_GENERAL: + if (nextAccess == THSVS_ACCESS_PRESENT) + layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + else + layout = VK_IMAGE_LAYOUT_GENERAL; + break; + case THSVS_IMAGE_LAYOUT_OPTIMAL: + layout = pNextAccessInfo->imageLayout; + break; + case THSVS_IMAGE_LAYOUT_GENERAL_AND_PRESENTATION: + layout = VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR; + break; + } + +#ifdef THSVS_ERROR_CHECK_MIXED_IMAGE_LAYOUT + assert(pVkBarrier->newLayout == VK_IMAGE_LAYOUT_UNDEFINED || + pVkBarrier->newLayout == layout); +#endif + pVkBarrier->newLayout = layout; + } + +#ifdef THSVS_ERROR_CHECK_COULD_USE_GLOBAL_BARRIER + assert(pVkBarrier->newLayout != pVkBarrier->oldLayout || + pVkBarrier->srcQueueFamilyIndex != pVkBarrier->dstQueueFamilyIndex); +#endif + + // Ensure that the stage masks are valid if no stages were determined + if (*pSrcStages == 0) + *pSrcStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + if (*pDstStages == 0) + *pDstStages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; +} + +void thsvsCmdPipelineBarrier( + VkCommandBuffer commandBuffer, + const ThsvsGlobalBarrier* pGlobalBarrier, + uint32_t bufferBarrierCount, + const ThsvsBufferBarrier* pBufferBarriers, + uint32_t imageBarrierCount, + const ThsvsImageBarrier* pImageBarriers) +{ + VkMemoryBarrier memoryBarrier; + // Vulkan pipeline barrier command parameters + // commandBuffer; + VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + uint32_t memoryBarrierCount = (pGlobalBarrier != NULL) ? 1 : 0; + VkMemoryBarrier* pMemoryBarriers = (pGlobalBarrier != NULL) ? &memoryBarrier : NULL; + uint32_t bufferMemoryBarrierCount = bufferBarrierCount; + VkBufferMemoryBarrier* pBufferMemoryBarriers = NULL; + uint32_t imageMemoryBarrierCount = imageBarrierCount; + VkImageMemoryBarrier* pImageMemoryBarriers = NULL; + + // Global memory barrier + if (pGlobalBarrier != NULL) + { + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + thsvsGetVulkanMemoryBarrier(*pGlobalBarrier, &tempSrcStageMask, &tempDstStageMask, pMemoryBarriers); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + } + + // Buffer memory barriers + if (bufferBarrierCount > 0) + { + pBufferMemoryBarriers = (VkBufferMemoryBarrier*)THSVS_TEMP_ALLOC(sizeof(VkBufferMemoryBarrier) * bufferMemoryBarrierCount); + + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + for (uint32_t i = 0; i < bufferBarrierCount; ++i) + { + thsvsGetVulkanBufferMemoryBarrier(pBufferBarriers[i], &tempSrcStageMask, &tempDstStageMask, &pBufferMemoryBarriers[i]); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + } + } + + // Image memory barriers + if (imageBarrierCount > 0) + { + pImageMemoryBarriers = (VkImageMemoryBarrier*)THSVS_TEMP_ALLOC(sizeof(VkImageMemoryBarrier) * imageMemoryBarrierCount); + + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + for (uint32_t i = 0; i < imageBarrierCount; ++i) + { + thsvsGetVulkanImageMemoryBarrier(pImageBarriers[i], &tempSrcStageMask, &tempDstStageMask, &pImageMemoryBarriers[i]); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + } + } + + vkCmdPipelineBarrier( + commandBuffer, + srcStageMask, + dstStageMask, + 0, + memoryBarrierCount, + pMemoryBarriers, + bufferMemoryBarrierCount, + pBufferMemoryBarriers, + imageMemoryBarrierCount, + pImageMemoryBarriers); + + THSVS_TEMP_FREE(pBufferMemoryBarriers); + THSVS_TEMP_FREE(pImageMemoryBarriers); +} + +void thsvsCmdSetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + uint32_t prevAccessCount, + const ThsvsAccessType* pPrevAccesses) +{ + VkPipelineStageFlags stageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + + for (uint32_t i = 0; i < prevAccessCount; ++i) + { + ThsvsAccessType prevAccess = pPrevAccesses[i]; + const ThsvsVkAccessInfo* pPrevAccessInfo = &ThsvsAccessMap[prevAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the previous access index is a valid range for the lookup + assert(prevAccess < THSVS_NUM_ACCESS_TYPES); +#endif + + stageMask |= pPrevAccessInfo->stageMask; + } + + vkCmdSetEvent( + commandBuffer, + event, + stageMask); +} + +void thsvsCmdResetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + uint32_t prevAccessCount, + const ThsvsAccessType* pPrevAccesses) +{ + VkPipelineStageFlags stageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + + for (uint32_t i = 0; i < prevAccessCount; ++i) + { + ThsvsAccessType prevAccess = pPrevAccesses[i]; + const ThsvsVkAccessInfo* pPrevAccessInfo = &ThsvsAccessMap[prevAccess]; + +#ifdef THSVS_ERROR_CHECK_ACCESS_TYPE_IN_RANGE + // Asserts that the previous access index is a valid range for the lookup + assert(prevAccess < THSVS_NUM_ACCESS_TYPES); +#endif + + stageMask |= pPrevAccessInfo->stageMask; + } + + vkCmdResetEvent( + commandBuffer, + event, + stageMask); +} + +void thsvsCmdWaitEvents( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + const ThsvsGlobalBarrier* pGlobalBarrier, + uint32_t bufferBarrierCount, + const ThsvsBufferBarrier* pBufferBarriers, + uint32_t imageBarrierCount, + const ThsvsImageBarrier* pImageBarriers) +{ + VkMemoryBarrier memoryBarrier; + // Vulkan pipeline barrier command parameters + // commandBuffer; + // eventCount; + // pEvents; + VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + uint32_t memoryBarrierCount = (pGlobalBarrier != NULL) ? 1 : 0; + VkMemoryBarrier* pMemoryBarriers = (pGlobalBarrier != NULL) ? &memoryBarrier : NULL; + uint32_t bufferMemoryBarrierCount = bufferBarrierCount; + VkBufferMemoryBarrier* pBufferMemoryBarriers = NULL; + uint32_t imageMemoryBarrierCount = imageBarrierCount; + VkImageMemoryBarrier* pImageMemoryBarriers = NULL; + + // Global memory barrier + if (pGlobalBarrier != NULL) + { + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + thsvsGetVulkanMemoryBarrier(*pGlobalBarrier, &tempSrcStageMask, &tempDstStageMask, pMemoryBarriers); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + } + + // Buffer memory barriers + if (bufferBarrierCount > 0) + { + pBufferMemoryBarriers = (VkBufferMemoryBarrier*)THSVS_TEMP_ALLOC(sizeof(VkBufferMemoryBarrier) * bufferMemoryBarrierCount); + + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + for (uint32_t i = 0; i < bufferBarrierCount; ++i) + { + thsvsGetVulkanBufferMemoryBarrier(pBufferBarriers[i], &tempSrcStageMask, &tempDstStageMask, &pBufferMemoryBarriers[i]); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + } + } + + // Image memory barriers + if (imageBarrierCount > 0) + { + pImageMemoryBarriers = (VkImageMemoryBarrier*)THSVS_TEMP_ALLOC(sizeof(VkImageMemoryBarrier) * imageMemoryBarrierCount); + + VkPipelineStageFlags tempSrcStageMask = 0; + VkPipelineStageFlags tempDstStageMask = 0; + for (uint32_t i = 0; i < imageBarrierCount; ++i) + { + thsvsGetVulkanImageMemoryBarrier(pImageBarriers[i], &tempSrcStageMask, &tempDstStageMask, &pImageMemoryBarriers[i]); + srcStageMask |= tempSrcStageMask; + dstStageMask |= tempDstStageMask; + } + } + + vkCmdWaitEvents( + commandBuffer, + eventCount, + pEvents, + srcStageMask, + dstStageMask, + memoryBarrierCount, + pMemoryBarriers, + bufferMemoryBarrierCount, + pBufferMemoryBarriers, + imageMemoryBarrierCount, + pImageMemoryBarriers); + + THSVS_TEMP_FREE(pBufferMemoryBarriers); + THSVS_TEMP_FREE(pImageMemoryBarriers); +} + +#endif // THSVS_SIMPLER_VULKAN_SYNCHRONIZATION_IMPLEMENTATION diff --git a/native/cocos/renderer/gfx-vulkan/volk.c b/native/cocos/renderer/gfx-vulkan/volk.c index 5e330bd477..23586ba4bf 100644 --- a/native/cocos/renderer/gfx-vulkan/volk.c +++ b/native/cocos/renderer/gfx-vulkan/volk.c @@ -62,9 +62,9 @@ VkResult volkInitialize(void) vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(module, "vkGetInstanceProcAddr"); #else - void* module = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); + void* module = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); if (!module) - module = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); + module = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); if (!module) return VK_ERROR_INITIALIZATION_FAILED; @@ -104,6 +104,12 @@ void volkLoadInstance(VkInstance instance) volkGenLoadDevice(instance, vkGetInstanceProcAddrStub); } +void volkLoadInstanceOnly(VkInstance instance) +{ + loadedInstance = instance; + volkGenLoadInstance(instance, vkGetInstanceProcAddrStub); +} + VkInstance volkGetLoadedInstance() { return loadedInstance; @@ -198,6 +204,10 @@ static void volkGenLoadInstance(void* context, PFN_vkVoidFunction (*load)(void*, #if defined(VK_EXT_direct_mode_display) vkReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT)load(context, "vkReleaseDisplayEXT"); #endif /* defined(VK_EXT_direct_mode_display) */ +#if defined(VK_EXT_directfb_surface) + vkCreateDirectFBSurfaceEXT = (PFN_vkCreateDirectFBSurfaceEXT)load(context, "vkCreateDirectFBSurfaceEXT"); + vkGetPhysicalDeviceDirectFBPresentationSupportEXT = (PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)load(context, "vkGetPhysicalDeviceDirectFBPresentationSupportEXT"); +#endif /* defined(VK_EXT_directfb_surface) */ #if defined(VK_EXT_display_surface_counter) vkGetPhysicalDeviceSurfaceCapabilities2EXT = (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)load(context, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); #endif /* defined(VK_EXT_display_surface_counter) */ @@ -246,6 +256,9 @@ static void volkGenLoadInstance(void* context, PFN_vkVoidFunction (*load)(void*, #if defined(VK_KHR_external_semaphore_capabilities) vkGetPhysicalDeviceExternalSemaphorePropertiesKHR = (PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)load(context, "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); #endif /* defined(VK_KHR_external_semaphore_capabilities) */ +#if defined(VK_KHR_fragment_shading_rate) + vkGetPhysicalDeviceFragmentShadingRatesKHR = (PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR)load(context, "vkGetPhysicalDeviceFragmentShadingRatesKHR"); +#endif /* defined(VK_KHR_fragment_shading_rate) */ #if defined(VK_KHR_get_display_properties2) vkGetDisplayModeProperties2KHR = (PFN_vkGetDisplayModeProperties2KHR)load(context, "vkGetDisplayModeProperties2KHR"); vkGetDisplayPlaneCapabilities2KHR = (PFN_vkGetDisplayPlaneCapabilities2KHR)load(context, "vkGetDisplayPlaneCapabilities2KHR"); @@ -301,9 +314,10 @@ static void volkGenLoadInstance(void* context, PFN_vkVoidFunction (*load)(void*, #if defined(VK_NN_vi_surface) vkCreateViSurfaceNN = (PFN_vkCreateViSurfaceNN)load(context, "vkCreateViSurfaceNN"); #endif /* defined(VK_NN_vi_surface) */ -#if defined(VK_NVX_device_generated_commands) - vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX = (PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)load(context, "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX"); -#endif /* defined(VK_NVX_device_generated_commands) */ +#if defined(VK_NV_acquire_winrt_display) + vkAcquireWinrtDisplayNV = (PFN_vkAcquireWinrtDisplayNV)load(context, "vkAcquireWinrtDisplayNV"); + vkGetWinrtDisplayNV = (PFN_vkGetWinrtDisplayNV)load(context, "vkGetWinrtDisplayNV"); +#endif /* defined(VK_NV_acquire_winrt_display) */ #if defined(VK_NV_cooperative_matrix) vkGetPhysicalDeviceCooperativeMatrixPropertiesNV = (PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)load(context, "vkGetPhysicalDeviceCooperativeMatrixPropertiesNV"); #endif /* defined(VK_NV_cooperative_matrix) */ @@ -520,6 +534,20 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkRegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)load(context, "vkRegisterDeviceEventEXT"); vkRegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)load(context, "vkRegisterDisplayEventEXT"); #endif /* defined(VK_EXT_display_control) */ +#if defined(VK_EXT_extended_dynamic_state) + vkCmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)load(context, "vkCmdBindVertexBuffers2EXT"); + vkCmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)load(context, "vkCmdSetCullModeEXT"); + vkCmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)load(context, "vkCmdSetDepthBoundsTestEnableEXT"); + vkCmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)load(context, "vkCmdSetDepthCompareOpEXT"); + vkCmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)load(context, "vkCmdSetDepthTestEnableEXT"); + vkCmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)load(context, "vkCmdSetDepthWriteEnableEXT"); + vkCmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)load(context, "vkCmdSetFrontFaceEXT"); + vkCmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)load(context, "vkCmdSetPrimitiveTopologyEXT"); + vkCmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)load(context, "vkCmdSetScissorWithCountEXT"); + vkCmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)load(context, "vkCmdSetStencilOpEXT"); + vkCmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)load(context, "vkCmdSetStencilTestEnableEXT"); + vkCmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)load(context, "vkCmdSetViewportWithCountEXT"); +#endif /* defined(VK_EXT_extended_dynamic_state) */ #if defined(VK_EXT_external_memory_host) vkGetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT)load(context, "vkGetMemoryHostPointerPropertiesEXT"); #endif /* defined(VK_EXT_external_memory_host) */ @@ -539,6 +567,12 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if defined(VK_EXT_line_rasterization) vkCmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)load(context, "vkCmdSetLineStippleEXT"); #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_private_data) + vkCreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT)load(context, "vkCreatePrivateDataSlotEXT"); + vkDestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT)load(context, "vkDestroyPrivateDataSlotEXT"); + vkGetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)load(context, "vkGetPrivateDataEXT"); + vkSetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)load(context, "vkSetPrivateDataEXT"); +#endif /* defined(VK_EXT_private_data) */ #if defined(VK_EXT_sample_locations) vkCmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)load(context, "vkCmdSetSampleLocationsEXT"); #endif /* defined(VK_EXT_sample_locations) */ @@ -571,6 +605,24 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkReleasePerformanceConfigurationINTEL = (PFN_vkReleasePerformanceConfigurationINTEL)load(context, "vkReleasePerformanceConfigurationINTEL"); vkUninitializePerformanceApiINTEL = (PFN_vkUninitializePerformanceApiINTEL)load(context, "vkUninitializePerformanceApiINTEL"); #endif /* defined(VK_INTEL_performance_query) */ +#if defined(VK_KHR_acceleration_structure) + vkBuildAccelerationStructuresKHR = (PFN_vkBuildAccelerationStructuresKHR)load(context, "vkBuildAccelerationStructuresKHR"); + vkCmdBuildAccelerationStructuresIndirectKHR = (PFN_vkCmdBuildAccelerationStructuresIndirectKHR)load(context, "vkCmdBuildAccelerationStructuresIndirectKHR"); + vkCmdBuildAccelerationStructuresKHR = (PFN_vkCmdBuildAccelerationStructuresKHR)load(context, "vkCmdBuildAccelerationStructuresKHR"); + vkCmdCopyAccelerationStructureKHR = (PFN_vkCmdCopyAccelerationStructureKHR)load(context, "vkCmdCopyAccelerationStructureKHR"); + vkCmdCopyAccelerationStructureToMemoryKHR = (PFN_vkCmdCopyAccelerationStructureToMemoryKHR)load(context, "vkCmdCopyAccelerationStructureToMemoryKHR"); + vkCmdCopyMemoryToAccelerationStructureKHR = (PFN_vkCmdCopyMemoryToAccelerationStructureKHR)load(context, "vkCmdCopyMemoryToAccelerationStructureKHR"); + vkCmdWriteAccelerationStructuresPropertiesKHR = (PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)load(context, "vkCmdWriteAccelerationStructuresPropertiesKHR"); + vkCopyAccelerationStructureKHR = (PFN_vkCopyAccelerationStructureKHR)load(context, "vkCopyAccelerationStructureKHR"); + vkCopyAccelerationStructureToMemoryKHR = (PFN_vkCopyAccelerationStructureToMemoryKHR)load(context, "vkCopyAccelerationStructureToMemoryKHR"); + vkCopyMemoryToAccelerationStructureKHR = (PFN_vkCopyMemoryToAccelerationStructureKHR)load(context, "vkCopyMemoryToAccelerationStructureKHR"); + vkCreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)load(context, "vkCreateAccelerationStructureKHR"); + vkDestroyAccelerationStructureKHR = (PFN_vkDestroyAccelerationStructureKHR)load(context, "vkDestroyAccelerationStructureKHR"); + vkGetAccelerationStructureBuildSizesKHR = (PFN_vkGetAccelerationStructureBuildSizesKHR)load(context, "vkGetAccelerationStructureBuildSizesKHR"); + vkGetAccelerationStructureDeviceAddressKHR = (PFN_vkGetAccelerationStructureDeviceAddressKHR)load(context, "vkGetAccelerationStructureDeviceAddressKHR"); + vkGetDeviceAccelerationStructureCompatibilityKHR = (PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)load(context, "vkGetDeviceAccelerationStructureCompatibilityKHR"); + vkWriteAccelerationStructuresPropertiesKHR = (PFN_vkWriteAccelerationStructuresPropertiesKHR)load(context, "vkWriteAccelerationStructuresPropertiesKHR"); +#endif /* defined(VK_KHR_acceleration_structure) */ #if defined(VK_KHR_bind_memory2) vkBindBufferMemory2KHR = (PFN_vkBindBufferMemory2KHR)load(context, "vkBindBufferMemory2KHR"); vkBindImageMemory2KHR = (PFN_vkBindImageMemory2KHR)load(context, "vkBindImageMemory2KHR"); @@ -580,12 +632,27 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetBufferOpaqueCaptureAddressKHR = (PFN_vkGetBufferOpaqueCaptureAddressKHR)load(context, "vkGetBufferOpaqueCaptureAddressKHR"); vkGetDeviceMemoryOpaqueCaptureAddressKHR = (PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)load(context, "vkGetDeviceMemoryOpaqueCaptureAddressKHR"); #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_copy_commands2) + vkCmdBlitImage2KHR = (PFN_vkCmdBlitImage2KHR)load(context, "vkCmdBlitImage2KHR"); + vkCmdCopyBuffer2KHR = (PFN_vkCmdCopyBuffer2KHR)load(context, "vkCmdCopyBuffer2KHR"); + vkCmdCopyBufferToImage2KHR = (PFN_vkCmdCopyBufferToImage2KHR)load(context, "vkCmdCopyBufferToImage2KHR"); + vkCmdCopyImage2KHR = (PFN_vkCmdCopyImage2KHR)load(context, "vkCmdCopyImage2KHR"); + vkCmdCopyImageToBuffer2KHR = (PFN_vkCmdCopyImageToBuffer2KHR)load(context, "vkCmdCopyImageToBuffer2KHR"); + vkCmdResolveImage2KHR = (PFN_vkCmdResolveImage2KHR)load(context, "vkCmdResolveImage2KHR"); +#endif /* defined(VK_KHR_copy_commands2) */ #if defined(VK_KHR_create_renderpass2) vkCmdBeginRenderPass2KHR = (PFN_vkCmdBeginRenderPass2KHR)load(context, "vkCmdBeginRenderPass2KHR"); vkCmdEndRenderPass2KHR = (PFN_vkCmdEndRenderPass2KHR)load(context, "vkCmdEndRenderPass2KHR"); vkCmdNextSubpass2KHR = (PFN_vkCmdNextSubpass2KHR)load(context, "vkCmdNextSubpass2KHR"); vkCreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR)load(context, "vkCreateRenderPass2KHR"); #endif /* defined(VK_KHR_create_renderpass2) */ +#if defined(VK_KHR_deferred_host_operations) + vkCreateDeferredOperationKHR = (PFN_vkCreateDeferredOperationKHR)load(context, "vkCreateDeferredOperationKHR"); + vkDeferredOperationJoinKHR = (PFN_vkDeferredOperationJoinKHR)load(context, "vkDeferredOperationJoinKHR"); + vkDestroyDeferredOperationKHR = (PFN_vkDestroyDeferredOperationKHR)load(context, "vkDestroyDeferredOperationKHR"); + vkGetDeferredOperationMaxConcurrencyKHR = (PFN_vkGetDeferredOperationMaxConcurrencyKHR)load(context, "vkGetDeferredOperationMaxConcurrencyKHR"); + vkGetDeferredOperationResultKHR = (PFN_vkGetDeferredOperationResultKHR)load(context, "vkGetDeferredOperationResultKHR"); +#endif /* defined(VK_KHR_deferred_host_operations) */ #if defined(VK_KHR_descriptor_update_template) vkCreateDescriptorUpdateTemplateKHR = (PFN_vkCreateDescriptorUpdateTemplateKHR)load(context, "vkCreateDescriptorUpdateTemplateKHR"); vkDestroyDescriptorUpdateTemplateKHR = (PFN_vkDestroyDescriptorUpdateTemplateKHR)load(context, "vkDestroyDescriptorUpdateTemplateKHR"); @@ -627,6 +694,9 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR)load(context, "vkGetSemaphoreWin32HandleKHR"); vkImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR)load(context, "vkImportSemaphoreWin32HandleKHR"); #endif /* defined(VK_KHR_external_semaphore_win32) */ +#if defined(VK_KHR_fragment_shading_rate) + vkCmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR)load(context, "vkCmdSetFragmentShadingRateKHR"); +#endif /* defined(VK_KHR_fragment_shading_rate) */ #if defined(VK_KHR_get_memory_requirements2) vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2KHR)load(context, "vkGetBufferMemoryRequirements2KHR"); vkGetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2KHR)load(context, "vkGetImageMemoryRequirements2KHR"); @@ -650,6 +720,15 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if defined(VK_KHR_push_descriptor) vkCmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR)load(context, "vkCmdPushDescriptorSetKHR"); #endif /* defined(VK_KHR_push_descriptor) */ +#if defined(VK_KHR_ray_tracing_pipeline) + vkCmdSetRayTracingPipelineStackSizeKHR = (PFN_vkCmdSetRayTracingPipelineStackSizeKHR)load(context, "vkCmdSetRayTracingPipelineStackSizeKHR"); + vkCmdTraceRaysIndirectKHR = (PFN_vkCmdTraceRaysIndirectKHR)load(context, "vkCmdTraceRaysIndirectKHR"); + vkCmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR)load(context, "vkCmdTraceRaysKHR"); + vkCreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR)load(context, "vkCreateRayTracingPipelinesKHR"); + vkGetRayTracingCaptureReplayShaderGroupHandlesKHR = (PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)load(context, "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"); + vkGetRayTracingShaderGroupHandlesKHR = (PFN_vkGetRayTracingShaderGroupHandlesKHR)load(context, "vkGetRayTracingShaderGroupHandlesKHR"); + vkGetRayTracingShaderGroupStackSizeKHR = (PFN_vkGetRayTracingShaderGroupStackSizeKHR)load(context, "vkGetRayTracingShaderGroupStackSizeKHR"); +#endif /* defined(VK_KHR_ray_tracing_pipeline) */ #if defined(VK_KHR_sampler_ycbcr_conversion) vkCreateSamplerYcbcrConversionKHR = (PFN_vkCreateSamplerYcbcrConversionKHR)load(context, "vkCreateSamplerYcbcrConversionKHR"); vkDestroySamplerYcbcrConversionKHR = (PFN_vkDestroySamplerYcbcrConversionKHR)load(context, "vkDestroySamplerYcbcrConversionKHR"); @@ -669,17 +748,8 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkSignalSemaphoreKHR = (PFN_vkSignalSemaphoreKHR)load(context, "vkSignalSemaphoreKHR"); vkWaitSemaphoresKHR = (PFN_vkWaitSemaphoresKHR)load(context, "vkWaitSemaphoresKHR"); #endif /* defined(VK_KHR_timeline_semaphore) */ -#if defined(VK_NVX_device_generated_commands) - vkCmdProcessCommandsNVX = (PFN_vkCmdProcessCommandsNVX)load(context, "vkCmdProcessCommandsNVX"); - vkCmdReserveSpaceForCommandsNVX = (PFN_vkCmdReserveSpaceForCommandsNVX)load(context, "vkCmdReserveSpaceForCommandsNVX"); - vkCreateIndirectCommandsLayoutNVX = (PFN_vkCreateIndirectCommandsLayoutNVX)load(context, "vkCreateIndirectCommandsLayoutNVX"); - vkCreateObjectTableNVX = (PFN_vkCreateObjectTableNVX)load(context, "vkCreateObjectTableNVX"); - vkDestroyIndirectCommandsLayoutNVX = (PFN_vkDestroyIndirectCommandsLayoutNVX)load(context, "vkDestroyIndirectCommandsLayoutNVX"); - vkDestroyObjectTableNVX = (PFN_vkDestroyObjectTableNVX)load(context, "vkDestroyObjectTableNVX"); - vkRegisterObjectsNVX = (PFN_vkRegisterObjectsNVX)load(context, "vkRegisterObjectsNVX"); - vkUnregisterObjectsNVX = (PFN_vkUnregisterObjectsNVX)load(context, "vkUnregisterObjectsNVX"); -#endif /* defined(VK_NVX_device_generated_commands) */ #if defined(VK_NVX_image_view_handle) + vkGetImageViewAddressNVX = (PFN_vkGetImageViewAddressNVX)load(context, "vkGetImageViewAddressNVX"); vkGetImageViewHandleNVX = (PFN_vkGetImageViewHandleNVX)load(context, "vkGetImageViewHandleNVX"); #endif /* defined(VK_NVX_image_view_handle) */ #if defined(VK_NV_clip_space_w_scaling) @@ -689,9 +759,20 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkCmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)load(context, "vkCmdSetCheckpointNV"); vkGetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)load(context, "vkGetQueueCheckpointDataNV"); #endif /* defined(VK_NV_device_diagnostic_checkpoints) */ +#if defined(VK_NV_device_generated_commands) + vkCmdBindPipelineShaderGroupNV = (PFN_vkCmdBindPipelineShaderGroupNV)load(context, "vkCmdBindPipelineShaderGroupNV"); + vkCmdExecuteGeneratedCommandsNV = (PFN_vkCmdExecuteGeneratedCommandsNV)load(context, "vkCmdExecuteGeneratedCommandsNV"); + vkCmdPreprocessGeneratedCommandsNV = (PFN_vkCmdPreprocessGeneratedCommandsNV)load(context, "vkCmdPreprocessGeneratedCommandsNV"); + vkCreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV)load(context, "vkCreateIndirectCommandsLayoutNV"); + vkDestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV)load(context, "vkDestroyIndirectCommandsLayoutNV"); + vkGetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)load(context, "vkGetGeneratedCommandsMemoryRequirementsNV"); +#endif /* defined(VK_NV_device_generated_commands) */ #if defined(VK_NV_external_memory_win32) vkGetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)load(context, "vkGetMemoryWin32HandleNV"); #endif /* defined(VK_NV_external_memory_win32) */ +#if defined(VK_NV_fragment_shading_rate_enums) + vkCmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV)load(context, "vkCmdSetFragmentShadingRateEnumNV"); +#endif /* defined(VK_NV_fragment_shading_rate_enums) */ #if defined(VK_NV_mesh_shader) vkCmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV)load(context, "vkCmdDrawMeshTasksIndirectCountNV"); vkCmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)load(context, "vkCmdDrawMeshTasksIndirectNV"); @@ -722,9 +803,9 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) vkGetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)load(context, "vkGetDeviceGroupSurfacePresentModes2EXT"); #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ -#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) +#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) vkCmdPushDescriptorSetWithTemplateKHR = (PFN_vkCmdPushDescriptorSetWithTemplateKHR)load(context, "vkCmdPushDescriptorSetWithTemplateKHR"); -#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) */ +#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ #if (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR)load(context, "vkGetDeviceGroupPresentCapabilitiesKHR"); vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR)load(context, "vkGetDeviceGroupSurfacePresentModesKHR"); @@ -936,6 +1017,20 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkRegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)load(context, "vkRegisterDeviceEventEXT"); table->vkRegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)load(context, "vkRegisterDisplayEventEXT"); #endif /* defined(VK_EXT_display_control) */ +#if defined(VK_EXT_extended_dynamic_state) + table->vkCmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)load(context, "vkCmdBindVertexBuffers2EXT"); + table->vkCmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)load(context, "vkCmdSetCullModeEXT"); + table->vkCmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)load(context, "vkCmdSetDepthBoundsTestEnableEXT"); + table->vkCmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)load(context, "vkCmdSetDepthCompareOpEXT"); + table->vkCmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)load(context, "vkCmdSetDepthTestEnableEXT"); + table->vkCmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)load(context, "vkCmdSetDepthWriteEnableEXT"); + table->vkCmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)load(context, "vkCmdSetFrontFaceEXT"); + table->vkCmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)load(context, "vkCmdSetPrimitiveTopologyEXT"); + table->vkCmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)load(context, "vkCmdSetScissorWithCountEXT"); + table->vkCmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)load(context, "vkCmdSetStencilOpEXT"); + table->vkCmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)load(context, "vkCmdSetStencilTestEnableEXT"); + table->vkCmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)load(context, "vkCmdSetViewportWithCountEXT"); +#endif /* defined(VK_EXT_extended_dynamic_state) */ #if defined(VK_EXT_external_memory_host) table->vkGetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT)load(context, "vkGetMemoryHostPointerPropertiesEXT"); #endif /* defined(VK_EXT_external_memory_host) */ @@ -955,6 +1050,12 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if defined(VK_EXT_line_rasterization) table->vkCmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)load(context, "vkCmdSetLineStippleEXT"); #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_private_data) + table->vkCreatePrivateDataSlotEXT = (PFN_vkCreatePrivateDataSlotEXT)load(context, "vkCreatePrivateDataSlotEXT"); + table->vkDestroyPrivateDataSlotEXT = (PFN_vkDestroyPrivateDataSlotEXT)load(context, "vkDestroyPrivateDataSlotEXT"); + table->vkGetPrivateDataEXT = (PFN_vkGetPrivateDataEXT)load(context, "vkGetPrivateDataEXT"); + table->vkSetPrivateDataEXT = (PFN_vkSetPrivateDataEXT)load(context, "vkSetPrivateDataEXT"); +#endif /* defined(VK_EXT_private_data) */ #if defined(VK_EXT_sample_locations) table->vkCmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)load(context, "vkCmdSetSampleLocationsEXT"); #endif /* defined(VK_EXT_sample_locations) */ @@ -987,6 +1088,24 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkReleasePerformanceConfigurationINTEL = (PFN_vkReleasePerformanceConfigurationINTEL)load(context, "vkReleasePerformanceConfigurationINTEL"); table->vkUninitializePerformanceApiINTEL = (PFN_vkUninitializePerformanceApiINTEL)load(context, "vkUninitializePerformanceApiINTEL"); #endif /* defined(VK_INTEL_performance_query) */ +#if defined(VK_KHR_acceleration_structure) + table->vkBuildAccelerationStructuresKHR = (PFN_vkBuildAccelerationStructuresKHR)load(context, "vkBuildAccelerationStructuresKHR"); + table->vkCmdBuildAccelerationStructuresIndirectKHR = (PFN_vkCmdBuildAccelerationStructuresIndirectKHR)load(context, "vkCmdBuildAccelerationStructuresIndirectKHR"); + table->vkCmdBuildAccelerationStructuresKHR = (PFN_vkCmdBuildAccelerationStructuresKHR)load(context, "vkCmdBuildAccelerationStructuresKHR"); + table->vkCmdCopyAccelerationStructureKHR = (PFN_vkCmdCopyAccelerationStructureKHR)load(context, "vkCmdCopyAccelerationStructureKHR"); + table->vkCmdCopyAccelerationStructureToMemoryKHR = (PFN_vkCmdCopyAccelerationStructureToMemoryKHR)load(context, "vkCmdCopyAccelerationStructureToMemoryKHR"); + table->vkCmdCopyMemoryToAccelerationStructureKHR = (PFN_vkCmdCopyMemoryToAccelerationStructureKHR)load(context, "vkCmdCopyMemoryToAccelerationStructureKHR"); + table->vkCmdWriteAccelerationStructuresPropertiesKHR = (PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)load(context, "vkCmdWriteAccelerationStructuresPropertiesKHR"); + table->vkCopyAccelerationStructureKHR = (PFN_vkCopyAccelerationStructureKHR)load(context, "vkCopyAccelerationStructureKHR"); + table->vkCopyAccelerationStructureToMemoryKHR = (PFN_vkCopyAccelerationStructureToMemoryKHR)load(context, "vkCopyAccelerationStructureToMemoryKHR"); + table->vkCopyMemoryToAccelerationStructureKHR = (PFN_vkCopyMemoryToAccelerationStructureKHR)load(context, "vkCopyMemoryToAccelerationStructureKHR"); + table->vkCreateAccelerationStructureKHR = (PFN_vkCreateAccelerationStructureKHR)load(context, "vkCreateAccelerationStructureKHR"); + table->vkDestroyAccelerationStructureKHR = (PFN_vkDestroyAccelerationStructureKHR)load(context, "vkDestroyAccelerationStructureKHR"); + table->vkGetAccelerationStructureBuildSizesKHR = (PFN_vkGetAccelerationStructureBuildSizesKHR)load(context, "vkGetAccelerationStructureBuildSizesKHR"); + table->vkGetAccelerationStructureDeviceAddressKHR = (PFN_vkGetAccelerationStructureDeviceAddressKHR)load(context, "vkGetAccelerationStructureDeviceAddressKHR"); + table->vkGetDeviceAccelerationStructureCompatibilityKHR = (PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)load(context, "vkGetDeviceAccelerationStructureCompatibilityKHR"); + table->vkWriteAccelerationStructuresPropertiesKHR = (PFN_vkWriteAccelerationStructuresPropertiesKHR)load(context, "vkWriteAccelerationStructuresPropertiesKHR"); +#endif /* defined(VK_KHR_acceleration_structure) */ #if defined(VK_KHR_bind_memory2) table->vkBindBufferMemory2KHR = (PFN_vkBindBufferMemory2KHR)load(context, "vkBindBufferMemory2KHR"); table->vkBindImageMemory2KHR = (PFN_vkBindImageMemory2KHR)load(context, "vkBindImageMemory2KHR"); @@ -996,12 +1115,27 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetBufferOpaqueCaptureAddressKHR = (PFN_vkGetBufferOpaqueCaptureAddressKHR)load(context, "vkGetBufferOpaqueCaptureAddressKHR"); table->vkGetDeviceMemoryOpaqueCaptureAddressKHR = (PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)load(context, "vkGetDeviceMemoryOpaqueCaptureAddressKHR"); #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_copy_commands2) + table->vkCmdBlitImage2KHR = (PFN_vkCmdBlitImage2KHR)load(context, "vkCmdBlitImage2KHR"); + table->vkCmdCopyBuffer2KHR = (PFN_vkCmdCopyBuffer2KHR)load(context, "vkCmdCopyBuffer2KHR"); + table->vkCmdCopyBufferToImage2KHR = (PFN_vkCmdCopyBufferToImage2KHR)load(context, "vkCmdCopyBufferToImage2KHR"); + table->vkCmdCopyImage2KHR = (PFN_vkCmdCopyImage2KHR)load(context, "vkCmdCopyImage2KHR"); + table->vkCmdCopyImageToBuffer2KHR = (PFN_vkCmdCopyImageToBuffer2KHR)load(context, "vkCmdCopyImageToBuffer2KHR"); + table->vkCmdResolveImage2KHR = (PFN_vkCmdResolveImage2KHR)load(context, "vkCmdResolveImage2KHR"); +#endif /* defined(VK_KHR_copy_commands2) */ #if defined(VK_KHR_create_renderpass2) table->vkCmdBeginRenderPass2KHR = (PFN_vkCmdBeginRenderPass2KHR)load(context, "vkCmdBeginRenderPass2KHR"); table->vkCmdEndRenderPass2KHR = (PFN_vkCmdEndRenderPass2KHR)load(context, "vkCmdEndRenderPass2KHR"); table->vkCmdNextSubpass2KHR = (PFN_vkCmdNextSubpass2KHR)load(context, "vkCmdNextSubpass2KHR"); table->vkCreateRenderPass2KHR = (PFN_vkCreateRenderPass2KHR)load(context, "vkCreateRenderPass2KHR"); #endif /* defined(VK_KHR_create_renderpass2) */ +#if defined(VK_KHR_deferred_host_operations) + table->vkCreateDeferredOperationKHR = (PFN_vkCreateDeferredOperationKHR)load(context, "vkCreateDeferredOperationKHR"); + table->vkDeferredOperationJoinKHR = (PFN_vkDeferredOperationJoinKHR)load(context, "vkDeferredOperationJoinKHR"); + table->vkDestroyDeferredOperationKHR = (PFN_vkDestroyDeferredOperationKHR)load(context, "vkDestroyDeferredOperationKHR"); + table->vkGetDeferredOperationMaxConcurrencyKHR = (PFN_vkGetDeferredOperationMaxConcurrencyKHR)load(context, "vkGetDeferredOperationMaxConcurrencyKHR"); + table->vkGetDeferredOperationResultKHR = (PFN_vkGetDeferredOperationResultKHR)load(context, "vkGetDeferredOperationResultKHR"); +#endif /* defined(VK_KHR_deferred_host_operations) */ #if defined(VK_KHR_descriptor_update_template) table->vkCreateDescriptorUpdateTemplateKHR = (PFN_vkCreateDescriptorUpdateTemplateKHR)load(context, "vkCreateDescriptorUpdateTemplateKHR"); table->vkDestroyDescriptorUpdateTemplateKHR = (PFN_vkDestroyDescriptorUpdateTemplateKHR)load(context, "vkDestroyDescriptorUpdateTemplateKHR"); @@ -1043,6 +1177,9 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetSemaphoreWin32HandleKHR = (PFN_vkGetSemaphoreWin32HandleKHR)load(context, "vkGetSemaphoreWin32HandleKHR"); table->vkImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR)load(context, "vkImportSemaphoreWin32HandleKHR"); #endif /* defined(VK_KHR_external_semaphore_win32) */ +#if defined(VK_KHR_fragment_shading_rate) + table->vkCmdSetFragmentShadingRateKHR = (PFN_vkCmdSetFragmentShadingRateKHR)load(context, "vkCmdSetFragmentShadingRateKHR"); +#endif /* defined(VK_KHR_fragment_shading_rate) */ #if defined(VK_KHR_get_memory_requirements2) table->vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2KHR)load(context, "vkGetBufferMemoryRequirements2KHR"); table->vkGetImageMemoryRequirements2KHR = (PFN_vkGetImageMemoryRequirements2KHR)load(context, "vkGetImageMemoryRequirements2KHR"); @@ -1066,6 +1203,15 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if defined(VK_KHR_push_descriptor) table->vkCmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR)load(context, "vkCmdPushDescriptorSetKHR"); #endif /* defined(VK_KHR_push_descriptor) */ +#if defined(VK_KHR_ray_tracing_pipeline) + table->vkCmdSetRayTracingPipelineStackSizeKHR = (PFN_vkCmdSetRayTracingPipelineStackSizeKHR)load(context, "vkCmdSetRayTracingPipelineStackSizeKHR"); + table->vkCmdTraceRaysIndirectKHR = (PFN_vkCmdTraceRaysIndirectKHR)load(context, "vkCmdTraceRaysIndirectKHR"); + table->vkCmdTraceRaysKHR = (PFN_vkCmdTraceRaysKHR)load(context, "vkCmdTraceRaysKHR"); + table->vkCreateRayTracingPipelinesKHR = (PFN_vkCreateRayTracingPipelinesKHR)load(context, "vkCreateRayTracingPipelinesKHR"); + table->vkGetRayTracingCaptureReplayShaderGroupHandlesKHR = (PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)load(context, "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"); + table->vkGetRayTracingShaderGroupHandlesKHR = (PFN_vkGetRayTracingShaderGroupHandlesKHR)load(context, "vkGetRayTracingShaderGroupHandlesKHR"); + table->vkGetRayTracingShaderGroupStackSizeKHR = (PFN_vkGetRayTracingShaderGroupStackSizeKHR)load(context, "vkGetRayTracingShaderGroupStackSizeKHR"); +#endif /* defined(VK_KHR_ray_tracing_pipeline) */ #if defined(VK_KHR_sampler_ycbcr_conversion) table->vkCreateSamplerYcbcrConversionKHR = (PFN_vkCreateSamplerYcbcrConversionKHR)load(context, "vkCreateSamplerYcbcrConversionKHR"); table->vkDestroySamplerYcbcrConversionKHR = (PFN_vkDestroySamplerYcbcrConversionKHR)load(context, "vkDestroySamplerYcbcrConversionKHR"); @@ -1085,17 +1231,8 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkSignalSemaphoreKHR = (PFN_vkSignalSemaphoreKHR)load(context, "vkSignalSemaphoreKHR"); table->vkWaitSemaphoresKHR = (PFN_vkWaitSemaphoresKHR)load(context, "vkWaitSemaphoresKHR"); #endif /* defined(VK_KHR_timeline_semaphore) */ -#if defined(VK_NVX_device_generated_commands) - table->vkCmdProcessCommandsNVX = (PFN_vkCmdProcessCommandsNVX)load(context, "vkCmdProcessCommandsNVX"); - table->vkCmdReserveSpaceForCommandsNVX = (PFN_vkCmdReserveSpaceForCommandsNVX)load(context, "vkCmdReserveSpaceForCommandsNVX"); - table->vkCreateIndirectCommandsLayoutNVX = (PFN_vkCreateIndirectCommandsLayoutNVX)load(context, "vkCreateIndirectCommandsLayoutNVX"); - table->vkCreateObjectTableNVX = (PFN_vkCreateObjectTableNVX)load(context, "vkCreateObjectTableNVX"); - table->vkDestroyIndirectCommandsLayoutNVX = (PFN_vkDestroyIndirectCommandsLayoutNVX)load(context, "vkDestroyIndirectCommandsLayoutNVX"); - table->vkDestroyObjectTableNVX = (PFN_vkDestroyObjectTableNVX)load(context, "vkDestroyObjectTableNVX"); - table->vkRegisterObjectsNVX = (PFN_vkRegisterObjectsNVX)load(context, "vkRegisterObjectsNVX"); - table->vkUnregisterObjectsNVX = (PFN_vkUnregisterObjectsNVX)load(context, "vkUnregisterObjectsNVX"); -#endif /* defined(VK_NVX_device_generated_commands) */ #if defined(VK_NVX_image_view_handle) + table->vkGetImageViewAddressNVX = (PFN_vkGetImageViewAddressNVX)load(context, "vkGetImageViewAddressNVX"); table->vkGetImageViewHandleNVX = (PFN_vkGetImageViewHandleNVX)load(context, "vkGetImageViewHandleNVX"); #endif /* defined(VK_NVX_image_view_handle) */ #if defined(VK_NV_clip_space_w_scaling) @@ -1105,9 +1242,20 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkCmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)load(context, "vkCmdSetCheckpointNV"); table->vkGetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)load(context, "vkGetQueueCheckpointDataNV"); #endif /* defined(VK_NV_device_diagnostic_checkpoints) */ +#if defined(VK_NV_device_generated_commands) + table->vkCmdBindPipelineShaderGroupNV = (PFN_vkCmdBindPipelineShaderGroupNV)load(context, "vkCmdBindPipelineShaderGroupNV"); + table->vkCmdExecuteGeneratedCommandsNV = (PFN_vkCmdExecuteGeneratedCommandsNV)load(context, "vkCmdExecuteGeneratedCommandsNV"); + table->vkCmdPreprocessGeneratedCommandsNV = (PFN_vkCmdPreprocessGeneratedCommandsNV)load(context, "vkCmdPreprocessGeneratedCommandsNV"); + table->vkCreateIndirectCommandsLayoutNV = (PFN_vkCreateIndirectCommandsLayoutNV)load(context, "vkCreateIndirectCommandsLayoutNV"); + table->vkDestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV)load(context, "vkDestroyIndirectCommandsLayoutNV"); + table->vkGetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)load(context, "vkGetGeneratedCommandsMemoryRequirementsNV"); +#endif /* defined(VK_NV_device_generated_commands) */ #if defined(VK_NV_external_memory_win32) table->vkGetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)load(context, "vkGetMemoryWin32HandleNV"); #endif /* defined(VK_NV_external_memory_win32) */ +#if defined(VK_NV_fragment_shading_rate_enums) + table->vkCmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV)load(context, "vkCmdSetFragmentShadingRateEnumNV"); +#endif /* defined(VK_NV_fragment_shading_rate_enums) */ #if defined(VK_NV_mesh_shader) table->vkCmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV)load(context, "vkCmdDrawMeshTasksIndirectCountNV"); table->vkCmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)load(context, "vkCmdDrawMeshTasksIndirectNV"); @@ -1138,9 +1286,9 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) table->vkGetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)load(context, "vkGetDeviceGroupSurfacePresentModes2EXT"); #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ -#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) +#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) table->vkCmdPushDescriptorSetWithTemplateKHR = (PFN_vkCmdPushDescriptorSetWithTemplateKHR)load(context, "vkCmdPushDescriptorSetWithTemplateKHR"); -#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) */ +#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ #if (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) table->vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR)load(context, "vkGetDeviceGroupPresentCapabilitiesKHR"); table->vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR)load(context, "vkGetDeviceGroupSurfacePresentModesKHR"); @@ -1152,8 +1300,12 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, } #ifdef __GNUC__ +#ifdef VOLK_DEFAULT_VISIBILITY +# pragma GCC visibility push(default) +#else # pragma GCC visibility push(hidden) #endif +#endif /* VOLK_GENERATE_PROTOTYPES_C */ #if defined(VK_VERSION_1_0) @@ -1400,6 +1552,10 @@ PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; #if defined(VK_EXT_direct_mode_display) PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT; #endif /* defined(VK_EXT_direct_mode_display) */ +#if defined(VK_EXT_directfb_surface) +PFN_vkCreateDirectFBSurfaceEXT vkCreateDirectFBSurfaceEXT; +PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT vkGetPhysicalDeviceDirectFBPresentationSupportEXT; +#endif /* defined(VK_EXT_directfb_surface) */ #if defined(VK_EXT_discard_rectangles) PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; #endif /* defined(VK_EXT_discard_rectangles) */ @@ -1412,6 +1568,20 @@ PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; #if defined(VK_EXT_display_surface_counter) PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; #endif /* defined(VK_EXT_display_surface_counter) */ +#if defined(VK_EXT_extended_dynamic_state) +PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; +PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; +PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; +PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; +PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; +PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; +PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; +PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; +PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; +PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; +PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; +PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; +#endif /* defined(VK_EXT_extended_dynamic_state) */ #if defined(VK_EXT_external_memory_host) PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; #endif /* defined(VK_EXT_external_memory_host) */ @@ -1438,6 +1608,12 @@ PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; #if defined(VK_EXT_metal_surface) PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; #endif /* defined(VK_EXT_metal_surface) */ +#if defined(VK_EXT_private_data) +PFN_vkCreatePrivateDataSlotEXT vkCreatePrivateDataSlotEXT; +PFN_vkDestroyPrivateDataSlotEXT vkDestroyPrivateDataSlotEXT; +PFN_vkGetPrivateDataEXT vkGetPrivateDataEXT; +PFN_vkSetPrivateDataEXT vkSetPrivateDataEXT; +#endif /* defined(VK_EXT_private_data) */ #if defined(VK_EXT_sample_locations) PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT; @@ -1480,6 +1656,24 @@ PFN_vkQueueSetPerformanceConfigurationINTEL vkQueueSetPerformanceConfigurationIN PFN_vkReleasePerformanceConfigurationINTEL vkReleasePerformanceConfigurationINTEL; PFN_vkUninitializePerformanceApiINTEL vkUninitializePerformanceApiINTEL; #endif /* defined(VK_INTEL_performance_query) */ +#if defined(VK_KHR_acceleration_structure) +PFN_vkBuildAccelerationStructuresKHR vkBuildAccelerationStructuresKHR; +PFN_vkCmdBuildAccelerationStructuresIndirectKHR vkCmdBuildAccelerationStructuresIndirectKHR; +PFN_vkCmdBuildAccelerationStructuresKHR vkCmdBuildAccelerationStructuresKHR; +PFN_vkCmdCopyAccelerationStructureKHR vkCmdCopyAccelerationStructureKHR; +PFN_vkCmdCopyAccelerationStructureToMemoryKHR vkCmdCopyAccelerationStructureToMemoryKHR; +PFN_vkCmdCopyMemoryToAccelerationStructureKHR vkCmdCopyMemoryToAccelerationStructureKHR; +PFN_vkCmdWriteAccelerationStructuresPropertiesKHR vkCmdWriteAccelerationStructuresPropertiesKHR; +PFN_vkCopyAccelerationStructureKHR vkCopyAccelerationStructureKHR; +PFN_vkCopyAccelerationStructureToMemoryKHR vkCopyAccelerationStructureToMemoryKHR; +PFN_vkCopyMemoryToAccelerationStructureKHR vkCopyMemoryToAccelerationStructureKHR; +PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR; +PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR; +PFN_vkGetAccelerationStructureBuildSizesKHR vkGetAccelerationStructureBuildSizesKHR; +PFN_vkGetAccelerationStructureDeviceAddressKHR vkGetAccelerationStructureDeviceAddressKHR; +PFN_vkGetDeviceAccelerationStructureCompatibilityKHR vkGetDeviceAccelerationStructureCompatibilityKHR; +PFN_vkWriteAccelerationStructuresPropertiesKHR vkWriteAccelerationStructuresPropertiesKHR; +#endif /* defined(VK_KHR_acceleration_structure) */ #if defined(VK_KHR_android_surface) PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; #endif /* defined(VK_KHR_android_surface) */ @@ -1492,12 +1686,27 @@ PFN_vkGetBufferDeviceAddressKHR vkGetBufferDeviceAddressKHR; PFN_vkGetBufferOpaqueCaptureAddressKHR vkGetBufferOpaqueCaptureAddressKHR; PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR vkGetDeviceMemoryOpaqueCaptureAddressKHR; #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_copy_commands2) +PFN_vkCmdBlitImage2KHR vkCmdBlitImage2KHR; +PFN_vkCmdCopyBuffer2KHR vkCmdCopyBuffer2KHR; +PFN_vkCmdCopyBufferToImage2KHR vkCmdCopyBufferToImage2KHR; +PFN_vkCmdCopyImage2KHR vkCmdCopyImage2KHR; +PFN_vkCmdCopyImageToBuffer2KHR vkCmdCopyImageToBuffer2KHR; +PFN_vkCmdResolveImage2KHR vkCmdResolveImage2KHR; +#endif /* defined(VK_KHR_copy_commands2) */ #if defined(VK_KHR_create_renderpass2) PFN_vkCmdBeginRenderPass2KHR vkCmdBeginRenderPass2KHR; PFN_vkCmdEndRenderPass2KHR vkCmdEndRenderPass2KHR; PFN_vkCmdNextSubpass2KHR vkCmdNextSubpass2KHR; PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR; #endif /* defined(VK_KHR_create_renderpass2) */ +#if defined(VK_KHR_deferred_host_operations) +PFN_vkCreateDeferredOperationKHR vkCreateDeferredOperationKHR; +PFN_vkDeferredOperationJoinKHR vkDeferredOperationJoinKHR; +PFN_vkDestroyDeferredOperationKHR vkDestroyDeferredOperationKHR; +PFN_vkGetDeferredOperationMaxConcurrencyKHR vkGetDeferredOperationMaxConcurrencyKHR; +PFN_vkGetDeferredOperationResultKHR vkGetDeferredOperationResultKHR; +#endif /* defined(VK_KHR_deferred_host_operations) */ #if defined(VK_KHR_descriptor_update_template) PFN_vkCreateDescriptorUpdateTemplateKHR vkCreateDescriptorUpdateTemplateKHR; PFN_vkDestroyDescriptorUpdateTemplateKHR vkDestroyDescriptorUpdateTemplateKHR; @@ -1560,6 +1769,10 @@ PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR; PFN_vkGetSemaphoreWin32HandleKHR vkGetSemaphoreWin32HandleKHR; PFN_vkImportSemaphoreWin32HandleKHR vkImportSemaphoreWin32HandleKHR; #endif /* defined(VK_KHR_external_semaphore_win32) */ +#if defined(VK_KHR_fragment_shading_rate) +PFN_vkCmdSetFragmentShadingRateKHR vkCmdSetFragmentShadingRateKHR; +PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR vkGetPhysicalDeviceFragmentShadingRatesKHR; +#endif /* defined(VK_KHR_fragment_shading_rate) */ #if defined(VK_KHR_get_display_properties2) PFN_vkGetDisplayModeProperties2KHR vkGetDisplayModeProperties2KHR; PFN_vkGetDisplayPlaneCapabilities2KHR vkGetDisplayPlaneCapabilities2KHR; @@ -1604,6 +1817,15 @@ PFN_vkGetPipelineExecutableStatisticsKHR vkGetPipelineExecutableStatisticsKHR; #if defined(VK_KHR_push_descriptor) PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSetKHR; #endif /* defined(VK_KHR_push_descriptor) */ +#if defined(VK_KHR_ray_tracing_pipeline) +PFN_vkCmdSetRayTracingPipelineStackSizeKHR vkCmdSetRayTracingPipelineStackSizeKHR; +PFN_vkCmdTraceRaysIndirectKHR vkCmdTraceRaysIndirectKHR; +PFN_vkCmdTraceRaysKHR vkCmdTraceRaysKHR; +PFN_vkCreateRayTracingPipelinesKHR vkCreateRayTracingPipelinesKHR; +PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR vkGetRayTracingCaptureReplayShaderGroupHandlesKHR; +PFN_vkGetRayTracingShaderGroupHandlesKHR vkGetRayTracingShaderGroupHandlesKHR; +PFN_vkGetRayTracingShaderGroupStackSizeKHR vkGetRayTracingShaderGroupStackSizeKHR; +#endif /* defined(VK_KHR_ray_tracing_pipeline) */ #if defined(VK_KHR_sampler_ycbcr_conversion) PFN_vkCreateSamplerYcbcrConversionKHR vkCreateSamplerYcbcrConversionKHR; PFN_vkDestroySamplerYcbcrConversionKHR vkDestroySamplerYcbcrConversionKHR; @@ -1655,20 +1877,14 @@ PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK; #if defined(VK_NN_vi_surface) PFN_vkCreateViSurfaceNN vkCreateViSurfaceNN; #endif /* defined(VK_NN_vi_surface) */ -#if defined(VK_NVX_device_generated_commands) -PFN_vkCmdProcessCommandsNVX vkCmdProcessCommandsNVX; -PFN_vkCmdReserveSpaceForCommandsNVX vkCmdReserveSpaceForCommandsNVX; -PFN_vkCreateIndirectCommandsLayoutNVX vkCreateIndirectCommandsLayoutNVX; -PFN_vkCreateObjectTableNVX vkCreateObjectTableNVX; -PFN_vkDestroyIndirectCommandsLayoutNVX vkDestroyIndirectCommandsLayoutNVX; -PFN_vkDestroyObjectTableNVX vkDestroyObjectTableNVX; -PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX; -PFN_vkRegisterObjectsNVX vkRegisterObjectsNVX; -PFN_vkUnregisterObjectsNVX vkUnregisterObjectsNVX; -#endif /* defined(VK_NVX_device_generated_commands) */ #if defined(VK_NVX_image_view_handle) +PFN_vkGetImageViewAddressNVX vkGetImageViewAddressNVX; PFN_vkGetImageViewHandleNVX vkGetImageViewHandleNVX; #endif /* defined(VK_NVX_image_view_handle) */ +#if defined(VK_NV_acquire_winrt_display) +PFN_vkAcquireWinrtDisplayNV vkAcquireWinrtDisplayNV; +PFN_vkGetWinrtDisplayNV vkGetWinrtDisplayNV; +#endif /* defined(VK_NV_acquire_winrt_display) */ #if defined(VK_NV_clip_space_w_scaling) PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; #endif /* defined(VK_NV_clip_space_w_scaling) */ @@ -1682,12 +1898,23 @@ PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV vkGetPhysi PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV; PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV; #endif /* defined(VK_NV_device_diagnostic_checkpoints) */ +#if defined(VK_NV_device_generated_commands) +PFN_vkCmdBindPipelineShaderGroupNV vkCmdBindPipelineShaderGroupNV; +PFN_vkCmdExecuteGeneratedCommandsNV vkCmdExecuteGeneratedCommandsNV; +PFN_vkCmdPreprocessGeneratedCommandsNV vkCmdPreprocessGeneratedCommandsNV; +PFN_vkCreateIndirectCommandsLayoutNV vkCreateIndirectCommandsLayoutNV; +PFN_vkDestroyIndirectCommandsLayoutNV vkDestroyIndirectCommandsLayoutNV; +PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; +#endif /* defined(VK_NV_device_generated_commands) */ #if defined(VK_NV_external_memory_capabilities) PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV vkGetPhysicalDeviceExternalImageFormatPropertiesNV; #endif /* defined(VK_NV_external_memory_capabilities) */ #if defined(VK_NV_external_memory_win32) PFN_vkGetMemoryWin32HandleNV vkGetMemoryWin32HandleNV; #endif /* defined(VK_NV_external_memory_win32) */ +#if defined(VK_NV_fragment_shading_rate_enums) +PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; +#endif /* defined(VK_NV_fragment_shading_rate_enums) */ #if defined(VK_NV_mesh_shader) PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; @@ -1718,9 +1945,9 @@ PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV; #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) PFN_vkGetDeviceGroupSurfacePresentModes2EXT vkGetDeviceGroupSurfacePresentModes2EXT; #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ -#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) +#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; -#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) */ +#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ #if (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) PFN_vkGetDeviceGroupPresentCapabilitiesKHR vkGetDeviceGroupPresentCapabilitiesKHR; PFN_vkGetDeviceGroupSurfacePresentModesKHR vkGetDeviceGroupSurfacePresentModesKHR; diff --git a/native/cocos/renderer/gfx-vulkan/volk.h b/native/cocos/renderer/gfx-vulkan/volk.h index b8777c57b8..62954f1088 100644 --- a/native/cocos/renderer/gfx-vulkan/volk.h +++ b/native/cocos/renderer/gfx-vulkan/volk.h @@ -15,7 +15,7 @@ #endif /* VOLK_GENERATE_VERSION_DEFINE */ -#define VOLK_HEADER_VERSION 131 +#define VOLK_HEADER_VERSION 165 /* VOLK_GENERATE_VERSION_DEFINE */ #ifndef VK_NO_PROTOTYPES @@ -42,11 +42,20 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES; # include + +# ifdef VK_ENABLE_BETA_EXTENSIONS +# include +# endif # else # include # endif #endif +/* Disable VK_NVX_image_view_handle because SDK 140 introduced a change that can't be used with prior versions */ +#if VK_HEADER_VERSION < 140 +# undef VK_NVX_image_view_handle +#endif + #ifdef __cplusplus extern "C" { #endif @@ -81,6 +90,12 @@ uint32_t volkGetInstanceVersion(void); */ void volkLoadInstance(VkInstance instance); +/** + * Load global function pointers using application-created VkInstance; call this function after creating the Vulkan instance. + * Skips loading device-based function pointers, requires usage of volkLoadDevice afterwards. + */ +void volkLoadInstanceOnly(VkInstance instance); + /** * Load global function pointers using application-created VkDevice; call this function after creating the Vulkan device. * @@ -92,13 +107,13 @@ void volkLoadDevice(VkDevice device); * Return last VkInstance for which global function pointers have been loaded via volkLoadInstance(), * or VK_NULL_HANDLE if volkLoadInstance() has not been called. */ -VkInstance volkGetLoadedInstance(); +VkInstance volkGetLoadedInstance(void); /** * Return last VkDevice for which global function pointers have been loaded via volkLoadDevice(), * or VK_NULL_HANDLE if volkLoadDevice() has not been called. */ -VkDevice volkGetLoadedDevice(); +VkDevice volkGetLoadedDevice(void); /** * Load function pointers using application-created VkDevice into a table. @@ -310,6 +325,20 @@ struct VolkDeviceTable PFN_vkRegisterDeviceEventEXT vkRegisterDeviceEventEXT; PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; #endif /* defined(VK_EXT_display_control) */ +#if defined(VK_EXT_extended_dynamic_state) + PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; + PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; + PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; + PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; + PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; + PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; + PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; + PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; + PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; + PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; + PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; + PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; +#endif /* defined(VK_EXT_extended_dynamic_state) */ #if defined(VK_EXT_external_memory_host) PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; #endif /* defined(VK_EXT_external_memory_host) */ @@ -329,6 +358,12 @@ struct VolkDeviceTable #if defined(VK_EXT_line_rasterization) PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_private_data) + PFN_vkCreatePrivateDataSlotEXT vkCreatePrivateDataSlotEXT; + PFN_vkDestroyPrivateDataSlotEXT vkDestroyPrivateDataSlotEXT; + PFN_vkGetPrivateDataEXT vkGetPrivateDataEXT; + PFN_vkSetPrivateDataEXT vkSetPrivateDataEXT; +#endif /* defined(VK_EXT_private_data) */ #if defined(VK_EXT_sample_locations) PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; #endif /* defined(VK_EXT_sample_locations) */ @@ -361,6 +396,24 @@ struct VolkDeviceTable PFN_vkReleasePerformanceConfigurationINTEL vkReleasePerformanceConfigurationINTEL; PFN_vkUninitializePerformanceApiINTEL vkUninitializePerformanceApiINTEL; #endif /* defined(VK_INTEL_performance_query) */ +#if defined(VK_KHR_acceleration_structure) + PFN_vkBuildAccelerationStructuresKHR vkBuildAccelerationStructuresKHR; + PFN_vkCmdBuildAccelerationStructuresIndirectKHR vkCmdBuildAccelerationStructuresIndirectKHR; + PFN_vkCmdBuildAccelerationStructuresKHR vkCmdBuildAccelerationStructuresKHR; + PFN_vkCmdCopyAccelerationStructureKHR vkCmdCopyAccelerationStructureKHR; + PFN_vkCmdCopyAccelerationStructureToMemoryKHR vkCmdCopyAccelerationStructureToMemoryKHR; + PFN_vkCmdCopyMemoryToAccelerationStructureKHR vkCmdCopyMemoryToAccelerationStructureKHR; + PFN_vkCmdWriteAccelerationStructuresPropertiesKHR vkCmdWriteAccelerationStructuresPropertiesKHR; + PFN_vkCopyAccelerationStructureKHR vkCopyAccelerationStructureKHR; + PFN_vkCopyAccelerationStructureToMemoryKHR vkCopyAccelerationStructureToMemoryKHR; + PFN_vkCopyMemoryToAccelerationStructureKHR vkCopyMemoryToAccelerationStructureKHR; + PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR; + PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR; + PFN_vkGetAccelerationStructureBuildSizesKHR vkGetAccelerationStructureBuildSizesKHR; + PFN_vkGetAccelerationStructureDeviceAddressKHR vkGetAccelerationStructureDeviceAddressKHR; + PFN_vkGetDeviceAccelerationStructureCompatibilityKHR vkGetDeviceAccelerationStructureCompatibilityKHR; + PFN_vkWriteAccelerationStructuresPropertiesKHR vkWriteAccelerationStructuresPropertiesKHR; +#endif /* defined(VK_KHR_acceleration_structure) */ #if defined(VK_KHR_bind_memory2) PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR; PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR; @@ -370,12 +423,27 @@ struct VolkDeviceTable PFN_vkGetBufferOpaqueCaptureAddressKHR vkGetBufferOpaqueCaptureAddressKHR; PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR vkGetDeviceMemoryOpaqueCaptureAddressKHR; #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_copy_commands2) + PFN_vkCmdBlitImage2KHR vkCmdBlitImage2KHR; + PFN_vkCmdCopyBuffer2KHR vkCmdCopyBuffer2KHR; + PFN_vkCmdCopyBufferToImage2KHR vkCmdCopyBufferToImage2KHR; + PFN_vkCmdCopyImage2KHR vkCmdCopyImage2KHR; + PFN_vkCmdCopyImageToBuffer2KHR vkCmdCopyImageToBuffer2KHR; + PFN_vkCmdResolveImage2KHR vkCmdResolveImage2KHR; +#endif /* defined(VK_KHR_copy_commands2) */ #if defined(VK_KHR_create_renderpass2) PFN_vkCmdBeginRenderPass2KHR vkCmdBeginRenderPass2KHR; PFN_vkCmdEndRenderPass2KHR vkCmdEndRenderPass2KHR; PFN_vkCmdNextSubpass2KHR vkCmdNextSubpass2KHR; PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR; #endif /* defined(VK_KHR_create_renderpass2) */ +#if defined(VK_KHR_deferred_host_operations) + PFN_vkCreateDeferredOperationKHR vkCreateDeferredOperationKHR; + PFN_vkDeferredOperationJoinKHR vkDeferredOperationJoinKHR; + PFN_vkDestroyDeferredOperationKHR vkDestroyDeferredOperationKHR; + PFN_vkGetDeferredOperationMaxConcurrencyKHR vkGetDeferredOperationMaxConcurrencyKHR; + PFN_vkGetDeferredOperationResultKHR vkGetDeferredOperationResultKHR; +#endif /* defined(VK_KHR_deferred_host_operations) */ #if defined(VK_KHR_descriptor_update_template) PFN_vkCreateDescriptorUpdateTemplateKHR vkCreateDescriptorUpdateTemplateKHR; PFN_vkDestroyDescriptorUpdateTemplateKHR vkDestroyDescriptorUpdateTemplateKHR; @@ -417,6 +485,9 @@ struct VolkDeviceTable PFN_vkGetSemaphoreWin32HandleKHR vkGetSemaphoreWin32HandleKHR; PFN_vkImportSemaphoreWin32HandleKHR vkImportSemaphoreWin32HandleKHR; #endif /* defined(VK_KHR_external_semaphore_win32) */ +#if defined(VK_KHR_fragment_shading_rate) + PFN_vkCmdSetFragmentShadingRateKHR vkCmdSetFragmentShadingRateKHR; +#endif /* defined(VK_KHR_fragment_shading_rate) */ #if defined(VK_KHR_get_memory_requirements2) PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR; PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR; @@ -440,6 +511,15 @@ struct VolkDeviceTable #if defined(VK_KHR_push_descriptor) PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSetKHR; #endif /* defined(VK_KHR_push_descriptor) */ +#if defined(VK_KHR_ray_tracing_pipeline) + PFN_vkCmdSetRayTracingPipelineStackSizeKHR vkCmdSetRayTracingPipelineStackSizeKHR; + PFN_vkCmdTraceRaysIndirectKHR vkCmdTraceRaysIndirectKHR; + PFN_vkCmdTraceRaysKHR vkCmdTraceRaysKHR; + PFN_vkCreateRayTracingPipelinesKHR vkCreateRayTracingPipelinesKHR; + PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR vkGetRayTracingCaptureReplayShaderGroupHandlesKHR; + PFN_vkGetRayTracingShaderGroupHandlesKHR vkGetRayTracingShaderGroupHandlesKHR; + PFN_vkGetRayTracingShaderGroupStackSizeKHR vkGetRayTracingShaderGroupStackSizeKHR; +#endif /* defined(VK_KHR_ray_tracing_pipeline) */ #if defined(VK_KHR_sampler_ycbcr_conversion) PFN_vkCreateSamplerYcbcrConversionKHR vkCreateSamplerYcbcrConversionKHR; PFN_vkDestroySamplerYcbcrConversionKHR vkDestroySamplerYcbcrConversionKHR; @@ -459,17 +539,8 @@ struct VolkDeviceTable PFN_vkSignalSemaphoreKHR vkSignalSemaphoreKHR; PFN_vkWaitSemaphoresKHR vkWaitSemaphoresKHR; #endif /* defined(VK_KHR_timeline_semaphore) */ -#if defined(VK_NVX_device_generated_commands) - PFN_vkCmdProcessCommandsNVX vkCmdProcessCommandsNVX; - PFN_vkCmdReserveSpaceForCommandsNVX vkCmdReserveSpaceForCommandsNVX; - PFN_vkCreateIndirectCommandsLayoutNVX vkCreateIndirectCommandsLayoutNVX; - PFN_vkCreateObjectTableNVX vkCreateObjectTableNVX; - PFN_vkDestroyIndirectCommandsLayoutNVX vkDestroyIndirectCommandsLayoutNVX; - PFN_vkDestroyObjectTableNVX vkDestroyObjectTableNVX; - PFN_vkRegisterObjectsNVX vkRegisterObjectsNVX; - PFN_vkUnregisterObjectsNVX vkUnregisterObjectsNVX; -#endif /* defined(VK_NVX_device_generated_commands) */ #if defined(VK_NVX_image_view_handle) + PFN_vkGetImageViewAddressNVX vkGetImageViewAddressNVX; PFN_vkGetImageViewHandleNVX vkGetImageViewHandleNVX; #endif /* defined(VK_NVX_image_view_handle) */ #if defined(VK_NV_clip_space_w_scaling) @@ -479,9 +550,20 @@ struct VolkDeviceTable PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV; PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV; #endif /* defined(VK_NV_device_diagnostic_checkpoints) */ +#if defined(VK_NV_device_generated_commands) + PFN_vkCmdBindPipelineShaderGroupNV vkCmdBindPipelineShaderGroupNV; + PFN_vkCmdExecuteGeneratedCommandsNV vkCmdExecuteGeneratedCommandsNV; + PFN_vkCmdPreprocessGeneratedCommandsNV vkCmdPreprocessGeneratedCommandsNV; + PFN_vkCreateIndirectCommandsLayoutNV vkCreateIndirectCommandsLayoutNV; + PFN_vkDestroyIndirectCommandsLayoutNV vkDestroyIndirectCommandsLayoutNV; + PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; +#endif /* defined(VK_NV_device_generated_commands) */ #if defined(VK_NV_external_memory_win32) PFN_vkGetMemoryWin32HandleNV vkGetMemoryWin32HandleNV; #endif /* defined(VK_NV_external_memory_win32) */ +#if defined(VK_NV_fragment_shading_rate_enums) + PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; +#endif /* defined(VK_NV_fragment_shading_rate_enums) */ #if defined(VK_NV_mesh_shader) PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; @@ -512,9 +594,9 @@ struct VolkDeviceTable #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) PFN_vkGetDeviceGroupSurfacePresentModes2EXT vkGetDeviceGroupSurfacePresentModes2EXT; #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ -#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) +#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; -#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) */ +#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ #if (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) PFN_vkGetDeviceGroupPresentCapabilitiesKHR vkGetDeviceGroupPresentCapabilitiesKHR; PFN_vkGetDeviceGroupSurfacePresentModesKHR vkGetDeviceGroupSurfacePresentModesKHR; @@ -770,6 +852,10 @@ extern PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; #if defined(VK_EXT_direct_mode_display) extern PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT; #endif /* defined(VK_EXT_direct_mode_display) */ +#if defined(VK_EXT_directfb_surface) +extern PFN_vkCreateDirectFBSurfaceEXT vkCreateDirectFBSurfaceEXT; +extern PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT vkGetPhysicalDeviceDirectFBPresentationSupportEXT; +#endif /* defined(VK_EXT_directfb_surface) */ #if defined(VK_EXT_discard_rectangles) extern PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; #endif /* defined(VK_EXT_discard_rectangles) */ @@ -782,6 +868,20 @@ extern PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; #if defined(VK_EXT_display_surface_counter) extern PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; #endif /* defined(VK_EXT_display_surface_counter) */ +#if defined(VK_EXT_extended_dynamic_state) +extern PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; +extern PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; +extern PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; +extern PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; +extern PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; +extern PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; +extern PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; +extern PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; +extern PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; +extern PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; +extern PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; +extern PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; +#endif /* defined(VK_EXT_extended_dynamic_state) */ #if defined(VK_EXT_external_memory_host) extern PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; #endif /* defined(VK_EXT_external_memory_host) */ @@ -808,6 +908,12 @@ extern PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; #if defined(VK_EXT_metal_surface) extern PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; #endif /* defined(VK_EXT_metal_surface) */ +#if defined(VK_EXT_private_data) +extern PFN_vkCreatePrivateDataSlotEXT vkCreatePrivateDataSlotEXT; +extern PFN_vkDestroyPrivateDataSlotEXT vkDestroyPrivateDataSlotEXT; +extern PFN_vkGetPrivateDataEXT vkGetPrivateDataEXT; +extern PFN_vkSetPrivateDataEXT vkSetPrivateDataEXT; +#endif /* defined(VK_EXT_private_data) */ #if defined(VK_EXT_sample_locations) extern PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; extern PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT; @@ -850,6 +956,24 @@ extern PFN_vkQueueSetPerformanceConfigurationINTEL vkQueueSetPerformanceConfigur extern PFN_vkReleasePerformanceConfigurationINTEL vkReleasePerformanceConfigurationINTEL; extern PFN_vkUninitializePerformanceApiINTEL vkUninitializePerformanceApiINTEL; #endif /* defined(VK_INTEL_performance_query) */ +#if defined(VK_KHR_acceleration_structure) +extern PFN_vkBuildAccelerationStructuresKHR vkBuildAccelerationStructuresKHR; +extern PFN_vkCmdBuildAccelerationStructuresIndirectKHR vkCmdBuildAccelerationStructuresIndirectKHR; +extern PFN_vkCmdBuildAccelerationStructuresKHR vkCmdBuildAccelerationStructuresKHR; +extern PFN_vkCmdCopyAccelerationStructureKHR vkCmdCopyAccelerationStructureKHR; +extern PFN_vkCmdCopyAccelerationStructureToMemoryKHR vkCmdCopyAccelerationStructureToMemoryKHR; +extern PFN_vkCmdCopyMemoryToAccelerationStructureKHR vkCmdCopyMemoryToAccelerationStructureKHR; +extern PFN_vkCmdWriteAccelerationStructuresPropertiesKHR vkCmdWriteAccelerationStructuresPropertiesKHR; +extern PFN_vkCopyAccelerationStructureKHR vkCopyAccelerationStructureKHR; +extern PFN_vkCopyAccelerationStructureToMemoryKHR vkCopyAccelerationStructureToMemoryKHR; +extern PFN_vkCopyMemoryToAccelerationStructureKHR vkCopyMemoryToAccelerationStructureKHR; +extern PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR; +extern PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR; +extern PFN_vkGetAccelerationStructureBuildSizesKHR vkGetAccelerationStructureBuildSizesKHR; +extern PFN_vkGetAccelerationStructureDeviceAddressKHR vkGetAccelerationStructureDeviceAddressKHR; +extern PFN_vkGetDeviceAccelerationStructureCompatibilityKHR vkGetDeviceAccelerationStructureCompatibilityKHR; +extern PFN_vkWriteAccelerationStructuresPropertiesKHR vkWriteAccelerationStructuresPropertiesKHR; +#endif /* defined(VK_KHR_acceleration_structure) */ #if defined(VK_KHR_android_surface) extern PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; #endif /* defined(VK_KHR_android_surface) */ @@ -862,12 +986,27 @@ extern PFN_vkGetBufferDeviceAddressKHR vkGetBufferDeviceAddressKHR; extern PFN_vkGetBufferOpaqueCaptureAddressKHR vkGetBufferOpaqueCaptureAddressKHR; extern PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR vkGetDeviceMemoryOpaqueCaptureAddressKHR; #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_copy_commands2) +extern PFN_vkCmdBlitImage2KHR vkCmdBlitImage2KHR; +extern PFN_vkCmdCopyBuffer2KHR vkCmdCopyBuffer2KHR; +extern PFN_vkCmdCopyBufferToImage2KHR vkCmdCopyBufferToImage2KHR; +extern PFN_vkCmdCopyImage2KHR vkCmdCopyImage2KHR; +extern PFN_vkCmdCopyImageToBuffer2KHR vkCmdCopyImageToBuffer2KHR; +extern PFN_vkCmdResolveImage2KHR vkCmdResolveImage2KHR; +#endif /* defined(VK_KHR_copy_commands2) */ #if defined(VK_KHR_create_renderpass2) extern PFN_vkCmdBeginRenderPass2KHR vkCmdBeginRenderPass2KHR; extern PFN_vkCmdEndRenderPass2KHR vkCmdEndRenderPass2KHR; extern PFN_vkCmdNextSubpass2KHR vkCmdNextSubpass2KHR; extern PFN_vkCreateRenderPass2KHR vkCreateRenderPass2KHR; #endif /* defined(VK_KHR_create_renderpass2) */ +#if defined(VK_KHR_deferred_host_operations) +extern PFN_vkCreateDeferredOperationKHR vkCreateDeferredOperationKHR; +extern PFN_vkDeferredOperationJoinKHR vkDeferredOperationJoinKHR; +extern PFN_vkDestroyDeferredOperationKHR vkDestroyDeferredOperationKHR; +extern PFN_vkGetDeferredOperationMaxConcurrencyKHR vkGetDeferredOperationMaxConcurrencyKHR; +extern PFN_vkGetDeferredOperationResultKHR vkGetDeferredOperationResultKHR; +#endif /* defined(VK_KHR_deferred_host_operations) */ #if defined(VK_KHR_descriptor_update_template) extern PFN_vkCreateDescriptorUpdateTemplateKHR vkCreateDescriptorUpdateTemplateKHR; extern PFN_vkDestroyDescriptorUpdateTemplateKHR vkDestroyDescriptorUpdateTemplateKHR; @@ -930,6 +1069,10 @@ extern PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR; extern PFN_vkGetSemaphoreWin32HandleKHR vkGetSemaphoreWin32HandleKHR; extern PFN_vkImportSemaphoreWin32HandleKHR vkImportSemaphoreWin32HandleKHR; #endif /* defined(VK_KHR_external_semaphore_win32) */ +#if defined(VK_KHR_fragment_shading_rate) +extern PFN_vkCmdSetFragmentShadingRateKHR vkCmdSetFragmentShadingRateKHR; +extern PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR vkGetPhysicalDeviceFragmentShadingRatesKHR; +#endif /* defined(VK_KHR_fragment_shading_rate) */ #if defined(VK_KHR_get_display_properties2) extern PFN_vkGetDisplayModeProperties2KHR vkGetDisplayModeProperties2KHR; extern PFN_vkGetDisplayPlaneCapabilities2KHR vkGetDisplayPlaneCapabilities2KHR; @@ -974,6 +1117,15 @@ extern PFN_vkGetPipelineExecutableStatisticsKHR vkGetPipelineExecutableStatistic #if defined(VK_KHR_push_descriptor) extern PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSetKHR; #endif /* defined(VK_KHR_push_descriptor) */ +#if defined(VK_KHR_ray_tracing_pipeline) +extern PFN_vkCmdSetRayTracingPipelineStackSizeKHR vkCmdSetRayTracingPipelineStackSizeKHR; +extern PFN_vkCmdTraceRaysIndirectKHR vkCmdTraceRaysIndirectKHR; +extern PFN_vkCmdTraceRaysKHR vkCmdTraceRaysKHR; +extern PFN_vkCreateRayTracingPipelinesKHR vkCreateRayTracingPipelinesKHR; +extern PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR vkGetRayTracingCaptureReplayShaderGroupHandlesKHR; +extern PFN_vkGetRayTracingShaderGroupHandlesKHR vkGetRayTracingShaderGroupHandlesKHR; +extern PFN_vkGetRayTracingShaderGroupStackSizeKHR vkGetRayTracingShaderGroupStackSizeKHR; +#endif /* defined(VK_KHR_ray_tracing_pipeline) */ #if defined(VK_KHR_sampler_ycbcr_conversion) extern PFN_vkCreateSamplerYcbcrConversionKHR vkCreateSamplerYcbcrConversionKHR; extern PFN_vkDestroySamplerYcbcrConversionKHR vkDestroySamplerYcbcrConversionKHR; @@ -1025,20 +1177,14 @@ extern PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK; #if defined(VK_NN_vi_surface) extern PFN_vkCreateViSurfaceNN vkCreateViSurfaceNN; #endif /* defined(VK_NN_vi_surface) */ -#if defined(VK_NVX_device_generated_commands) -extern PFN_vkCmdProcessCommandsNVX vkCmdProcessCommandsNVX; -extern PFN_vkCmdReserveSpaceForCommandsNVX vkCmdReserveSpaceForCommandsNVX; -extern PFN_vkCreateIndirectCommandsLayoutNVX vkCreateIndirectCommandsLayoutNVX; -extern PFN_vkCreateObjectTableNVX vkCreateObjectTableNVX; -extern PFN_vkDestroyIndirectCommandsLayoutNVX vkDestroyIndirectCommandsLayoutNVX; -extern PFN_vkDestroyObjectTableNVX vkDestroyObjectTableNVX; -extern PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX; -extern PFN_vkRegisterObjectsNVX vkRegisterObjectsNVX; -extern PFN_vkUnregisterObjectsNVX vkUnregisterObjectsNVX; -#endif /* defined(VK_NVX_device_generated_commands) */ #if defined(VK_NVX_image_view_handle) +extern PFN_vkGetImageViewAddressNVX vkGetImageViewAddressNVX; extern PFN_vkGetImageViewHandleNVX vkGetImageViewHandleNVX; #endif /* defined(VK_NVX_image_view_handle) */ +#if defined(VK_NV_acquire_winrt_display) +extern PFN_vkAcquireWinrtDisplayNV vkAcquireWinrtDisplayNV; +extern PFN_vkGetWinrtDisplayNV vkGetWinrtDisplayNV; +#endif /* defined(VK_NV_acquire_winrt_display) */ #if defined(VK_NV_clip_space_w_scaling) extern PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; #endif /* defined(VK_NV_clip_space_w_scaling) */ @@ -1052,12 +1198,23 @@ extern PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV vkG extern PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV; extern PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV; #endif /* defined(VK_NV_device_diagnostic_checkpoints) */ +#if defined(VK_NV_device_generated_commands) +extern PFN_vkCmdBindPipelineShaderGroupNV vkCmdBindPipelineShaderGroupNV; +extern PFN_vkCmdExecuteGeneratedCommandsNV vkCmdExecuteGeneratedCommandsNV; +extern PFN_vkCmdPreprocessGeneratedCommandsNV vkCmdPreprocessGeneratedCommandsNV; +extern PFN_vkCreateIndirectCommandsLayoutNV vkCreateIndirectCommandsLayoutNV; +extern PFN_vkDestroyIndirectCommandsLayoutNV vkDestroyIndirectCommandsLayoutNV; +extern PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; +#endif /* defined(VK_NV_device_generated_commands) */ #if defined(VK_NV_external_memory_capabilities) extern PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV vkGetPhysicalDeviceExternalImageFormatPropertiesNV; #endif /* defined(VK_NV_external_memory_capabilities) */ #if defined(VK_NV_external_memory_win32) extern PFN_vkGetMemoryWin32HandleNV vkGetMemoryWin32HandleNV; #endif /* defined(VK_NV_external_memory_win32) */ +#if defined(VK_NV_fragment_shading_rate_enums) +extern PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; +#endif /* defined(VK_NV_fragment_shading_rate_enums) */ #if defined(VK_NV_mesh_shader) extern PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; extern PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; @@ -1088,9 +1245,9 @@ extern PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePalet #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) extern PFN_vkGetDeviceGroupSurfacePresentModes2EXT vkGetDeviceGroupSurfacePresentModes2EXT; #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ -#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) +#if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) extern PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; -#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) */ +#endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ #if (defined(VK_KHR_device_group) && defined(VK_KHR_surface)) || (defined(VK_KHR_swapchain) && defined(VK_VERSION_1_1)) extern PFN_vkGetDeviceGroupPresentCapabilitiesKHR vkGetDeviceGroupPresentCapabilitiesKHR; extern PFN_vkGetDeviceGroupSurfacePresentModesKHR vkGetDeviceGroupSurfacePresentModesKHR; diff --git a/native/cocos/renderer/pipeline/BatchedBuffer.cpp b/native/cocos/renderer/pipeline/BatchedBuffer.cpp index 2ec6daf2f5..71f4c7ac82 100644 --- a/native/cocos/renderer/pipeline/BatchedBuffer.cpp +++ b/native/cocos/renderer/pipeline/BatchedBuffer.cpp @@ -1,37 +1,39 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "BatchedBuffer.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXInputAssembler.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXInputAssembler.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { map> BatchedBuffer::_buffers; -BatchedBuffer *BatchedBuffer::get(uint pass) { +BatchedBuffer * BatchedBuffer::get(uint pass) { return BatchedBuffer::get(pass, 0); } BatchedBuffer *BatchedBuffer::get(uint pass, uint extraKey) { @@ -46,16 +48,15 @@ BatchedBuffer::BatchedBuffer(const PassView *pass) _device(gfx::Device::getInstance()) { } -BatchedBuffer::~BatchedBuffer() { -} +BatchedBuffer::~BatchedBuffer() = default; void BatchedBuffer::destroy() { for (auto &batch : _batches) { - for (auto vb : batch.vbs) { + for (auto *vb : batch.vbs) { vb->destroy(); } - for (auto data : batch.vbDatas) { + for (auto *data : batch.vbDatas) { CC_FREE(data); } @@ -69,28 +70,27 @@ void BatchedBuffer::destroy() { } void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const ModelView *model) { - const auto subMesh = subModel->getSubMesh(); - const auto flatBuffersID = subMesh->getFlatBufferArrayID(); + const auto *const subMesh = subModel->getSubMesh(); + const auto *const flatBuffersID = subMesh->getFlatBufferArrayID(); const auto flatBuffersCount = flatBuffersID ? flatBuffersID[0] : 0; if (flatBuffersCount == 0) { return; } - const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[1]); - auto vbSize = 0; - auto indexSize = 0; - const auto vbCount = flatBuffer->count; - const auto pass = subModel->getPassView(passIdx); - const auto shader = subModel->getShader(passIdx); - const auto descriptorSet = subModel->getDescriptorSet(); - bool isBatchExist = false; + const auto *const flatBuffer = subMesh->getFlatBuffer(flatBuffersID[1]); + uint vbSize = 0; + uint indexSize = 0; + const auto vbCount = flatBuffer->count; + const auto *const pass = subModel->getPassView(passIdx); + auto *const shader = subModel->getShader(passIdx); + auto *const descriptorSet = subModel->getDescriptorSet(); + bool isBatchExist = false; - for (auto i = 0; i < _batches.size(); ++i) { - auto &batch = _batches[i]; + for (auto &batch : _batches) { if (batch.vbs.size() == flatBuffersCount && batch.mergeCount < UBOLocalBatched::BATCHING_COUNT) { isBatchExist = true; - for (auto j = 0; j < flatBuffersCount; ++j) { - const auto vb = batch.vbs[j]; + for (uint j = 0; j < flatBuffersCount; ++j) { + auto *const vb = batch.vbs[j]; if (vb->getStride() != subMesh->getFlatBuffer(flatBuffersID[j + 1])->stride) { isBatchExist = false; break; @@ -98,58 +98,57 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode } if (isBatchExist) { - for (auto j = 0; j < flatBuffersCount; ++j) { - const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[j + 1]); - auto batchVB = batch.vbs[j]; - auto vbData = batch.vbDatas[j]; - const auto vbBufSizeOld = batchVB->getSize(); - vbSize = (vbCount + batch.vbCount) * flatBuffer->stride; + for (uint j = 0; j < flatBuffersCount; ++j) { + const auto *const flatBuffer = subMesh->getFlatBuffer(flatBuffersID[j + 1]); + auto * batchVB = batch.vbs[j]; + auto * vbData = batch.vbDatas[j]; + const uint vbBufSizeOld = batchVB->getSize(); + vbSize = (vbCount + batch.vbCount) * flatBuffer->stride; if (vbSize > vbBufSizeOld) { - uint8_t *vbDataNew = static_cast(CC_MALLOC(vbSize)); + auto *vbDataNew = static_cast(CC_MALLOC(vbSize)); memcpy(vbDataNew, vbData, vbBufSizeOld); batchVB->resize(vbSize); CC_FREE(vbData); batch.vbDatas[j] = vbDataNew; - vbData = vbDataNew; + vbData = vbDataNew; } - auto size = 0u; - auto offset = batch.vbCount * flatBuffer->stride; - const auto data = flatBuffer->getBuffer(&size); + auto size = 0U; + auto offset = batch.vbCount * flatBuffer->stride; + auto *const data = flatBuffer->getBuffer(&size); memcpy(vbData + offset, data, size); } - auto indexData = batch.indexData; - indexSize = (vbCount + batch.vbCount) * sizeof(float); + auto *indexData = batch.indexData; + indexSize = (vbCount + batch.vbCount) * sizeof(float); if (indexSize > batch.indexBuffer->getSize()) { - - auto newIndexData = static_cast(CC_MALLOC(indexSize)); + auto *newIndexData = static_cast(CC_MALLOC(indexSize)); memcpy(newIndexData, indexData, batch.indexBuffer->getSize()); CC_FREE(indexData); batch.indexData = newIndexData; - indexData = batch.indexData; + indexData = batch.indexData; batch.indexBuffer->resize(indexSize); } - const auto start = batch.vbCount; - const auto end = start + vbCount; + const auto start = batch.vbCount; + const auto end = start + vbCount; const auto mergeCount = batch.mergeCount; if (indexData[start] != mergeCount || indexData[end - 1] != mergeCount) { for (auto j = start; j < end; j++) { - indexData[j] = mergeCount + 0.1f; // guard against underflow + indexData[j] = mergeCount + 0.1F; // guard against underflow } } // update world matrix - const auto offset = UBOLocalBatched::MAT_WORLDS_OFFSET + batch.mergeCount * 16; + const auto offset = UBOLocalBatched::MAT_WORLDS_OFFSET + batch.mergeCount * 16; const auto &worldMatrix = model->getTransform()->worldMatrix; memcpy(batch.uboData.data() + offset, worldMatrix.m, sizeof(worldMatrix)); if (!batch.mergeCount) { descriptorSet->bindBuffer(UBOLocalBatched::BINDING, batch.ubo); descriptorSet->update(); - batch.pass = pass; - batch.shader = shader; + batch.pass = pass; + batch.shader = shader; batch.descriptorSet = descriptorSet; } @@ -164,41 +163,41 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode // Create a new batch vector vbs(flatBuffersCount, nullptr); - vector vbDatas(flatBuffersCount, 0); + vector vbDatas(flatBuffersCount, nullptr); vector totalVBs(flatBuffersCount + 1, nullptr); - for (auto i = 0; i < flatBuffersCount; ++i) { - const auto flatBuffer = subMesh->getFlatBuffer(flatBuffersID[i + 1]); - auto newVB = _device->createBuffer({ + for (uint i = 0; i < flatBuffersCount; ++i) { + const auto *const flatBuffer = subMesh->getFlatBuffer(flatBuffersID[i + 1]); + auto * newVB = _device->createBuffer({ gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, flatBuffer->count * flatBuffer->stride, flatBuffer->stride, }); - auto size = 0u; - auto data = flatBuffer->getBuffer(&size); + auto size = 0U; + auto * data = flatBuffer->getBuffer(&size); newVB->update(data, size); - vbs[i] = newVB; + vbs[i] = newVB; vbDatas[i] = static_cast(CC_MALLOC(newVB->getSize())); memset(vbDatas[i], 0, newVB->getSize()); totalVBs[i] = newVB; } const auto indexBufferSize = vbCount * sizeof(float); - auto indexBuffer = _device->createBuffer({ + auto * indexBuffer = _device->createBuffer({ gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, static_cast(indexBufferSize), sizeof(float), }); - float *indexData = static_cast(CC_MALLOC(indexBufferSize)); + auto * indexData = static_cast(CC_MALLOC(indexBufferSize)); memset(indexData, 0, indexBufferSize); - indexBuffer->update(indexData, indexBufferSize); + indexBuffer->update(indexData, static_cast(indexBufferSize)); totalVBs[flatBuffersCount] = indexBuffer; vector attributes = subModel->getInputAssembler()->getAttributes(); - gfx::Attribute attrib = { + gfx::Attribute attrib = { "a_dyn_batch_id", gfx::Format::R32F, false, @@ -206,9 +205,9 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode }; attributes.emplace_back(std::move(attrib)); - auto ia = _device->createInputAssembler({std::move(attributes), std::move(totalVBs)}); + auto *ia = _device->createInputAssembler({std::move(attributes), std::move(totalVBs)}); - auto ubo = _device->createBuffer({ + auto *ubo = _device->createBuffer({ gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, UBOLocalBatched::SIZE, @@ -219,7 +218,7 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode descriptorSet->update(); std::array uboData; - const auto &worldMatrix = model->getTransform()->worldMatrix; + const auto & worldMatrix = model->getTransform()->worldMatrix; memcpy(uboData.data() + UBOLocalBatched::MAT_WORLDS_OFFSET, worldMatrix.m, sizeof(worldMatrix)); BatchedItem item = { std::move(vbs), //vbs @@ -230,7 +229,7 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode 1, //mergeCount ia, //ia ubo, //ubo - std::move(uboData), //uboData + uboData, //uboData descriptorSet, //descriptorSet pass, //pass shader, //shader @@ -240,7 +239,7 @@ void BatchedBuffer::merge(const SubModelView *subModel, uint passIdx, const Mode void BatchedBuffer::clear() { for (auto &batch : _batches) { - batch.vbCount = 0; + batch.vbCount = 0; batch.mergeCount = 0; batch.ia->setVertexCount(0); } diff --git a/native/cocos/renderer/pipeline/BatchedBuffer.h b/native/cocos/renderer/pipeline/BatchedBuffer.h index 90330229a7..2d46da2081 100644 --- a/native/cocos/renderer/pipeline/BatchedBuffer.h +++ b/native/cocos/renderer/pipeline/BatchedBuffer.h @@ -1,29 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "Define.h" +#include namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/Define.cpp b/native/cocos/renderer/pipeline/Define.cpp index 2a35acb2e1..fbb6f80fc0 100644 --- a/native/cocos/renderer/pipeline/Define.cpp +++ b/native/cocos/renderer/pipeline/Define.cpp @@ -1,48 +1,64 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "Define.h" -#include "cocos/bindings/jswrapper/SeApi.h" -#include "gfx/GFXDevice.h" +#include "bindings/jswrapper/SeApi.h" +#include "gfx-base/GFXDevice.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { -uint GLOBAL_SET = static_cast(SetIndex::GLOBAL); -uint MATERIAL_SET = static_cast(SetIndex::MATERIAL); -uint LOCAL_SET = static_cast(SetIndex::LOCAL); -DescriptorSetLayoutInfos globalDescriptorSetLayout; -DescriptorSetLayoutInfos localDescriptorSetLayout; -const String UBOGlobal::NAME = "CCGlobal"; +int globalUBOCount = static_cast(PipelineGlobalBindings::SAMPLER_SHADOWMAP); +int globalSamplerCount = static_cast(PipelineGlobalBindings::COUNT) - globalUBOCount; + +int localUBOCount = static_cast(ModelLocalBindings::SAMPLER_JOINTS); +int localSamplerCount = static_cast(ModelLocalBindings::COUNT) - localUBOCount; + +uint globalSet = static_cast(SetIndex::GLOBAL); +uint materialSet = static_cast(SetIndex::MATERIAL); +uint localSet = static_cast(SetIndex::LOCAL); + +gfx::BindingMappingInfo bindingMappingInfo = { + {0, globalUBOCount + localUBOCount, globalUBOCount}, + {-globalUBOCount, globalSamplerCount + localSamplerCount, globalSamplerCount - localUBOCount}, + 1, +}; + +DescriptorSetLayoutInfos globalDescriptorSetLayout; +DescriptorSetLayoutInfos localDescriptorSetLayout; +const String UBOGlobal::NAME = "CCGlobal"; const gfx::DescriptorSetLayoutBinding UBOGlobal::DESCRIPTOR = { UBOGlobal::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::ALL, + {}, }; const gfx::UniformBlock UBOGlobal::LAYOUT = { - GLOBAL_SET, + globalSet, UBOGlobal::BINDING, UBOGlobal::NAME, { @@ -53,15 +69,16 @@ const gfx::UniformBlock UBOGlobal::LAYOUT = { 1, }; -const String UBOLocalBatched::NAME = "CCLocalBatched"; +const String UBOLocalBatched::NAME = "CCLocalBatched"; const gfx::DescriptorSetLayoutBinding UBOLocalBatched::DESCRIPTOR = { UBOLocalBatched::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; const gfx::UniformBlock UBOLocalBatched::LAYOUT = { - LOCAL_SET, + localSet, UBOLocalBatched::BINDING, UBOLocalBatched::NAME, { @@ -70,15 +87,16 @@ const gfx::UniformBlock UBOLocalBatched::LAYOUT = { 1, }; -const String UBOCamera::NAME = "CCCamera"; +const String UBOCamera::NAME = "CCCamera"; const gfx::DescriptorSetLayoutBinding UBOCamera::DESCRIPTOR = { UBOCamera::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::ALL, + {}, }; const gfx::UniformBlock UBOCamera::LAYOUT = { - GLOBAL_SET, + globalSet, UBOCamera::BINDING, UBOCamera::NAME, { @@ -102,35 +120,40 @@ const gfx::UniformBlock UBOCamera::LAYOUT = { 1, }; -const String UBOShadow::NAME = "CCShadow"; +const String UBOShadow::NAME = "CCShadow"; const gfx::DescriptorSetLayoutBinding UBOShadow::DESCRIPTOR = { UBOShadow::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::ALL, + {}, }; const gfx::UniformBlock UBOShadow::LAYOUT = { - GLOBAL_SET, + globalSet, UBOShadow::BINDING, UBOShadow::NAME, { {"cc_matLightPlaneProj", gfx::Type::MAT4, 1}, + {"cc_matLightView", gfx::Type::MAT4, 1}, {"cc_matLightViewProj", gfx::Type::MAT4, 1}, + {"cc_shadowNFLSInfo", gfx::Type::FLOAT4, 1}, + {"cc_shadowWHPBInfo", gfx::Type::FLOAT4, 1}, + {"cc_shadowLPNNInfo", gfx::Type::FLOAT4, 1}, {"cc_shadowColor", gfx::Type::FLOAT4, 1}, - {"cc_shadowInfo", gfx::Type::FLOAT4, 1}, }, 1, }; -const String UBOLocal::NAME = "CCLocal"; +const String UBOLocal::NAME = "CCLocal"; const gfx::DescriptorSetLayoutBinding UBOLocal::DESCRIPTOR = { UBOLocal::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; const gfx::UniformBlock UBOLocal::LAYOUT = { - LOCAL_SET, + localSet, UBOLocal::BINDING, UBOLocal::NAME, { @@ -141,15 +164,16 @@ const gfx::UniformBlock UBOLocal::LAYOUT = { 1, }; -const String UBOForwardLight::NAME = "CCForwardLight"; +const String UBOForwardLight::NAME = "CCForwardLight"; const gfx::DescriptorSetLayoutBinding UBOForwardLight::DESCRIPTOR = { UBOForwardLight::BINDING, gfx::DescriptorType::DYNAMIC_UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::FRAGMENT, + {}, }; const gfx::UniformBlock UBOForwardLight::LAYOUT = { - LOCAL_SET, + localSet, UBOForwardLight::BINDING, UBOForwardLight::NAME, { @@ -161,15 +185,16 @@ const gfx::UniformBlock UBOForwardLight::LAYOUT = { 1, }; -const String UBOSkinningTexture::NAME = "CCSkinningTexture"; +const String UBOSkinningTexture::NAME = "CCSkinningTexture"; const gfx::DescriptorSetLayoutBinding UBOSkinningTexture::DESCRIPTOR = { UBOSkinningTexture::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; const gfx::UniformBlock UBOSkinningTexture::LAYOUT = { - LOCAL_SET, + localSet, UBOSkinningTexture::BINDING, UBOSkinningTexture::NAME, { @@ -178,15 +203,16 @@ const gfx::UniformBlock UBOSkinningTexture::LAYOUT = { 1, }; -const String UBOSkinningAnimation::NAME = "CCSkinningAnimation"; +const String UBOSkinningAnimation::NAME = "CCSkinningAnimation"; const gfx::DescriptorSetLayoutBinding UBOSkinningAnimation::DESCRIPTOR = { UBOSkinningAnimation::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; const gfx::UniformBlock UBOSkinningAnimation::LAYOUT = { - LOCAL_SET, + localSet, UBOSkinningAnimation::BINDING, UBOSkinningAnimation::NAME, { @@ -195,15 +221,16 @@ const gfx::UniformBlock UBOSkinningAnimation::LAYOUT = { 1, }; -const String UBOSkinning::NAME = "CCSkinning"; +const String UBOSkinning::NAME = "CCSkinning"; const gfx::DescriptorSetLayoutBinding UBOSkinning::DESCRIPTOR = { UBOSkinning::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; const gfx::UniformBlock UBOSkinning::LAYOUT = { - LOCAL_SET, + localSet, UBOSkinning::BINDING, UBOSkinning::NAME, { @@ -212,17 +239,18 @@ const gfx::UniformBlock UBOSkinning::LAYOUT = { 1, }; -const uint UBOMorph::COUNT_BASE_4_BYTES = 4 * std::ceil(UBOMorph::MAX_MORPH_TARGET_COUNT / 4) + 4; -const uint UBOMorph::SIZE = UBOMorph::COUNT_BASE_4_BYTES * 4; -const String UBOMorph::NAME = "CCMorph"; -const gfx::DescriptorSetLayoutBinding UBOMorph::DESCRIPTOR = { +const uint UBOMorph::COUNT_BASE_4_BYTES = static_cast(4 * std::ceil(UBOMorph::MAX_MORPH_TARGET_COUNT / 4) + 4); +const uint UBOMorph::SIZE = UBOMorph::COUNT_BASE_4_BYTES * 4; +const String UBOMorph::NAME = "CCMorph"; +const gfx::DescriptorSetLayoutBinding UBOMorph::DESCRIPTOR = { UBOMorph::BINDING, gfx::DescriptorType::UNIFORM_BUFFER, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; const gfx::UniformBlock UBOMorph::LAYOUT = { - LOCAL_SET, + localSet, UBOMorph::BINDING, UBOMorph::NAME, { @@ -232,142 +260,235 @@ const gfx::UniformBlock UBOMorph::LAYOUT = { 1, }; -const String SHADOWMAP::NAME = "cc_shadowMap"; +const String SHADOWMAP::NAME = "cc_shadowMap"; const gfx::DescriptorSetLayoutBinding SHADOWMAP::DESCRIPTOR = { SHADOWMAP::BINDING, - gfx::DescriptorType::SAMPLER, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::FRAGMENT, + {}, }; -const gfx::UniformSampler SHADOWMAP::LAYOUT = { - GLOBAL_SET, +const gfx::UniformSamplerTexture SHADOWMAP::LAYOUT = { + globalSet, SHADOWMAP::BINDING, SHADOWMAP::NAME, gfx::Type::SAMPLER2D, 1, }; -const String ENVIRONMENT::NAME = "cc_environment"; -const gfx::DescriptorSetLayoutBinding ENVIRONMENT::DESCRIPTOR = { - ENVIRONMENT::BINDING, - gfx::DescriptorType::SAMPLER, +const String SAMPLERGBUFFERALBEDOMAP::NAME = "cc_gbuffer_albedoMap"; +const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFERALBEDOMAP::DESCRIPTOR = { + SAMPLERGBUFFERALBEDOMAP::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::FRAGMENT, + {}, }; -const gfx::UniformSampler ENVIRONMENT::LAYOUT = { - GLOBAL_SET, +const gfx::UniformSamplerTexture SAMPLERGBUFFERALBEDOMAP::LAYOUT = { + globalSet, + SAMPLERGBUFFERALBEDOMAP::BINDING, + SAMPLERGBUFFERALBEDOMAP::NAME, + gfx::Type::SAMPLER2D, + 1, +}; + +const String SAMPLERGBUFFERPOSITIONMAP::NAME = "cc_gbuffer_positionMap"; +const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFERPOSITIONMAP::DESCRIPTOR = { + SAMPLERGBUFFERPOSITIONMAP::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, + 1, + gfx::ShaderStageFlagBit::FRAGMENT, + {}, +}; +const gfx::UniformSamplerTexture SAMPLERGBUFFERPOSITIONMAP::LAYOUT = { + globalSet, + SAMPLERGBUFFERPOSITIONMAP::BINDING, + SAMPLERGBUFFERPOSITIONMAP::NAME, + gfx::Type::SAMPLER2D, + 1, +}; + +const String SAMPLERGBUFFERNORMALMAP::NAME = "cc_gbuffer_normalMap"; +const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFERNORMALMAP::DESCRIPTOR = { + SAMPLERGBUFFERNORMALMAP::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, + 1, + gfx::ShaderStageFlagBit::FRAGMENT, + {}, +}; +const gfx::UniformSamplerTexture SAMPLERGBUFFERNORMALMAP::LAYOUT = { + globalSet, + SAMPLERGBUFFERNORMALMAP::BINDING, + SAMPLERGBUFFERNORMALMAP::NAME, + gfx::Type::SAMPLER2D, + 1, +}; + +const String SAMPLERGBUFFEREMISSIVEMAP::NAME = "cc_gbuffer_emissiveMap"; +const gfx::DescriptorSetLayoutBinding SAMPLERGBUFFEREMISSIVEMAP::DESCRIPTOR = { + SAMPLERGBUFFEREMISSIVEMAP::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, + 1, + gfx::ShaderStageFlagBit::FRAGMENT, + {}, +}; +const gfx::UniformSamplerTexture SAMPLERGBUFFEREMISSIVEMAP::LAYOUT = { + globalSet, + SAMPLERGBUFFEREMISSIVEMAP::BINDING, + SAMPLERGBUFFEREMISSIVEMAP::NAME, + gfx::Type::SAMPLER2D, + 1, +}; + +const String SAMPLERLIGHTINGRESULTMAP::NAME = "cc_lighting_resultMap"; +const gfx::DescriptorSetLayoutBinding SAMPLERLIGHTINGRESULTMAP::DESCRIPTOR = { + SAMPLERLIGHTINGRESULTMAP::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, + 1, + gfx::ShaderStageFlagBit::FRAGMENT, + {}, +}; +const gfx::UniformSamplerTexture SAMPLERLIGHTINGRESULTMAP::LAYOUT = { + globalSet, + SAMPLERLIGHTINGRESULTMAP::BINDING, + SAMPLERLIGHTINGRESULTMAP::NAME, + gfx::Type::SAMPLER2D, + 1, +}; + +const String ENVIRONMENT::NAME = "cc_environment"; +const gfx::DescriptorSetLayoutBinding ENVIRONMENT::DESCRIPTOR = { + ENVIRONMENT::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, + 1, + gfx::ShaderStageFlagBit::FRAGMENT, + {}, +}; +const gfx::UniformSamplerTexture ENVIRONMENT::LAYOUT = { + globalSet, ENVIRONMENT::BINDING, ENVIRONMENT::NAME, gfx::Type::SAMPLER_CUBE, 1, }; -const String SPOT_LIGHTING_MAP::NAME = "cc_spotLightingMap"; -const gfx::DescriptorSetLayoutBinding SPOT_LIGHTING_MAP::DESCRIPTOR = { - SPOT_LIGHTING_MAP::BINDING, - gfx::DescriptorType::SAMPLER, +const String SPOTLIGHTINGMAP::NAME = "cc_spotLightingMap"; +const gfx::DescriptorSetLayoutBinding SPOTLIGHTINGMAP::DESCRIPTOR = { + SPOTLIGHTINGMAP::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::FRAGMENT, + {}, }; -const gfx::UniformSampler SPOT_LIGHTING_MAP::LAYOUT = { - GLOBAL_SET, - SPOT_LIGHTING_MAP::BINDING, - SPOT_LIGHTING_MAP::NAME, +const gfx::UniformSamplerTexture SPOTLIGHTINGMAP::LAYOUT = { + globalSet, + SPOTLIGHTINGMAP::BINDING, + SPOTLIGHTINGMAP::NAME, gfx::Type::SAMPLER2D, 1, }; -const String JOINT_TEXTURE::NAME = "cc_jointTexture"; -const gfx::DescriptorSetLayoutBinding JOINT_TEXTURE::DESCRIPTOR = { - JOINT_TEXTURE::BINDING, - gfx::DescriptorType::SAMPLER, +const String JOINTTEXTURE::NAME = "cc_jointTexture"; +const gfx::DescriptorSetLayoutBinding JOINTTEXTURE::DESCRIPTOR = { + JOINTTEXTURE::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; -const gfx::UniformSampler JOINT_TEXTURE::LAYOUT = { - LOCAL_SET, - JOINT_TEXTURE::BINDING, - JOINT_TEXTURE::NAME, +const gfx::UniformSamplerTexture JOINTTEXTURE::LAYOUT = { + localSet, + JOINTTEXTURE::BINDING, + JOINTTEXTURE::NAME, gfx::Type::SAMPLER2D, 1, }; -const String POSITION_MORPH::NAME = "cc_PositionDisplacements"; -const gfx::DescriptorSetLayoutBinding POSITION_MORPH::DESCRIPTOR = { - POSITION_MORPH::BINDING, - gfx::DescriptorType::SAMPLER, +const String POSITIONMORPH::NAME = "cc_PositionDisplacements"; +const gfx::DescriptorSetLayoutBinding POSITIONMORPH::DESCRIPTOR = { + POSITIONMORPH::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; -const gfx::UniformSampler POSITION_MORPH::LAYOUT = { - LOCAL_SET, - POSITION_MORPH::BINDING, - POSITION_MORPH::NAME, +const gfx::UniformSamplerTexture POSITIONMORPH::LAYOUT = { + localSet, + POSITIONMORPH::BINDING, + POSITIONMORPH::NAME, gfx::Type::SAMPLER2D, 1, }; -const String NORMAL_MORPH::NAME = "cc_NormalDisplacements"; -const gfx::DescriptorSetLayoutBinding NORMAL_MORPH::DESCRIPTOR = { - NORMAL_MORPH::BINDING, - gfx::DescriptorType::SAMPLER, +const String NORMALMORPH::NAME = "cc_NormalDisplacements"; +const gfx::DescriptorSetLayoutBinding NORMALMORPH::DESCRIPTOR = { + NORMALMORPH::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; -const gfx::UniformSampler NORMAL_MORPH::LAYOUT = { - LOCAL_SET, - NORMAL_MORPH::BINDING, - NORMAL_MORPH::NAME, +const gfx::UniformSamplerTexture NORMALMORPH::LAYOUT = { + localSet, + NORMALMORPH::BINDING, + NORMALMORPH::NAME, gfx::Type::SAMPLER2D, 1, }; -const String TANGENT_MORPH::NAME = "cc_TangentDisplacements"; -const gfx::DescriptorSetLayoutBinding TANGENT_MORPH::DESCRIPTOR = { - TANGENT_MORPH::BINDING, - gfx::DescriptorType::SAMPLER, +const String TANGENTMORPH::NAME = "cc_TangentDisplacements"; +const gfx::DescriptorSetLayoutBinding TANGENTMORPH::DESCRIPTOR = { + TANGENTMORPH::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::VERTEX, + {}, }; -const gfx::UniformSampler TANGENT_MORPH::LAYOUT = { - LOCAL_SET, - TANGENT_MORPH::BINDING, - TANGENT_MORPH::NAME, +const gfx::UniformSamplerTexture TANGENTMORPH::LAYOUT = { + localSet, + TANGENTMORPH::BINDING, + TANGENTMORPH::NAME, gfx::Type::SAMPLER2D, 1, }; -const String LIGHTMAP_TEXTURE::NAME = "cc_lightingMap"; -const gfx::DescriptorSetLayoutBinding LIGHTMAP_TEXTURE::DESCRIPTOR = { - LIGHTMAP_TEXTURE::BINDING, - gfx::DescriptorType::SAMPLER, +const String LIGHTMAPTEXTURE::NAME = "cc_lightingMap"; +const gfx::DescriptorSetLayoutBinding LIGHTMAPTEXTURE::DESCRIPTOR = { + LIGHTMAPTEXTURE::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::FRAGMENT, + {}, }; -const gfx::UniformSampler LIGHTMAP_TEXTURE::LAYOUT = { - LOCAL_SET, - LIGHTMAP_TEXTURE::BINDING, - LIGHTMAP_TEXTURE::NAME, +const gfx::UniformSamplerTexture LIGHTMAPTEXTURE::LAYOUT = { + localSet, + LIGHTMAPTEXTURE::BINDING, + LIGHTMAPTEXTURE::NAME, gfx::Type::SAMPLER2D, 1, }; -const String SPRITE_TEXTURE::NAME = "cc_spriteTexture"; -const gfx::DescriptorSetLayoutBinding SPRITE_TEXTURE::DESCRIPTOR = { - SPRITE_TEXTURE::BINDING, - gfx::DescriptorType::SAMPLER, +const String SPRITETEXTURE::NAME = "cc_spriteTexture"; +const gfx::DescriptorSetLayoutBinding SPRITETEXTURE::DESCRIPTOR = { + SPRITETEXTURE::BINDING, + gfx::DescriptorType::SAMPLER_TEXTURE, 1, gfx::ShaderStageFlagBit::FRAGMENT, + {}, }; -const gfx::UniformSampler SPRITE_TEXTURE::LAYOUT = { - LOCAL_SET, +const gfx::UniformSamplerTexture SPRITETEXTURE::LAYOUT = { + localSet, static_cast(ModelLocalBindings::SAMPLER_SPRITE), "cc_spriteTexture", gfx::Type::SAMPLER2D, 1, }; -uint genSamplerHash(const gfx::SamplerInfo &info) { +uint SamplerLib::defaultSamplerHash{genSamplerHash(gfx::SamplerInfo())}; + +unordered_map SamplerLib::samplerCache{}; + +uint SamplerLib::genSamplerHash(const gfx::SamplerInfo &info) { uint hash = 0; hash |= static_cast(info.minFilter); hash |= static_cast(info.magFilter) << 2; @@ -377,43 +498,41 @@ uint genSamplerHash(const gfx::SamplerInfo &info) { hash |= static_cast(info.addressW) << 10; hash |= static_cast(info.maxAnisotropy) << 12; hash |= static_cast(info.cmpFunc) << 16; - hash |= static_cast(info.minLOD) << 20; - hash |= static_cast(info.maxLOD) << 24; hash |= static_cast(info.mipLODBias) << 28; return hash; } -static uint defaultSamplerHash = genSamplerHash(gfx::SamplerInfo()); - -map samplerCache; -gfx::Sampler *getSampler(uint hash) { +gfx::Sampler *SamplerLib::getSampler(uint hash) { if (hash == 0) { hash = defaultSamplerHash; } - auto sampler = samplerCache[hash]; - if (sampler) { - return sampler; + if (samplerCache.count(hash)) { + return samplerCache[hash]; } gfx::SamplerInfo info; - info.minFilter = static_cast(hash & 3); - info.magFilter = static_cast((hash >> 2) & 3); - info.mipFilter = static_cast((hash >> 4) & 3); - info.addressU = static_cast((hash >> 6) & 3); - info.addressV = static_cast((hash >> 8) & 3); - info.addressW = static_cast((hash >> 10) & 3); + info.minFilter = static_cast(hash & 3); + info.magFilter = static_cast((hash >> 2) & 3); + info.mipFilter = static_cast((hash >> 4) & 3); + info.addressU = static_cast((hash >> 6) & 3); + info.addressV = static_cast((hash >> 8) & 3); + info.addressW = static_cast((hash >> 10) & 3); info.maxAnisotropy = ((hash >> 12) & 15); - info.cmpFunc = static_cast((hash >> 16) & 15); - info.minLOD = ((hash >> 20) & 15); - info.maxLOD = ((hash >> 24) & 15); - info.mipLODBias = ((hash >> 28) & 15); + info.cmpFunc = static_cast((hash >> 16) & 15); + info.mipLODBias = static_cast((hash >> 28) & 15); - sampler = gfx::Device::getInstance()->createSampler(std::move(info)); - return sampler; + return samplerCache[hash] = gfx::Device::getInstance()->createSampler(info); } -uint SKYBOX_FLAG = static_cast(gfx::ClearFlagBit::STENCIL) << 1; +void SamplerLib::destroyAll() { + for (auto &pair : samplerCache) { + CC_SAFE_DESTROY(pair.second); + } + samplerCache.clear(); +} + +uint skyboxFlag = static_cast(gfx::ClearFlagBit::STENCIL) << 1; uint nextPow2(uint val) { --val; @@ -435,7 +554,7 @@ uint getPhaseID(const String &phase) { return 0; } se::Object *nrObjct = nrValue.toObject(); - se::Value nrPhase; + se::Value nrPhase; if (!nrObjct->getProperty("getPhaseID", &nrPhase)) { CC_LOG_ERROR("getPhaseID: failed to get getPhaseID property."); return 0; diff --git a/native/cocos/renderer/pipeline/Define.h b/native/cocos/renderer/pipeline/Define.h index 6cf10c4394..10db8f625b 100644 --- a/native/cocos/renderer/pipeline/Define.h +++ b/native/cocos/renderer/pipeline/Define.h @@ -1,30 +1,35 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "../core/CoreStd.h" +#include + +#include "base/Object.h" #include "base/Value.h" +#include "gfx-base/GFXDef.h" namespace cc { namespace pipeline { @@ -45,54 +50,54 @@ struct Frustum; #define JOINT_UNIFORM_CAPACITY 30 struct CC_DLL RenderObject { - float depth = 0; + float depth = 0; const ModelView *model = nullptr; }; -typedef vector RenderObjectList; +using RenderObjectList = vector; struct CC_DLL RenderTargetInfo { - uint width = 0; + uint width = 0; uint height = 0; }; struct CC_DLL RenderPass { - uint hash = 0; - float depth = 0; - uint shaderID = 0; - uint passIndex = 0; - const SubModelView *subModel = nullptr; + uint hash = 0; + float depth = 0; + uint shaderID = 0; + uint passIndex = 0; + const SubModelView *subModel = nullptr; }; -typedef vector RenderPassList; +using RenderPassList = vector; -typedef gfx::ColorAttachment ColorDesc; -typedef vector ColorDescList; +using ColorDesc = gfx::ColorAttachment; +using ColorDescList = vector; -typedef gfx::DepthStencilAttachment DepthStencilDesc; +using DepthStencilDesc = gfx::DepthStencilAttachment; struct CC_DLL RenderPassDesc { - uint index = 0; - ColorDescList colorAttachments; + uint index = 0; + ColorDescList colorAttachments; DepthStencilDesc depthStencilAttachment; }; -typedef vector RenderPassDescList; +using RenderPassDescList = vector; struct CC_DLL RenderTextureDesc { - String name; - gfx::TextureType type = gfx::TextureType::TEX2D; - gfx::TextureUsage usage = gfx::TextureUsage::COLOR_ATTACHMENT; - gfx::Format format = gfx::Format::UNKNOWN; - int width = -1; - int height = -1; + String name; + gfx::TextureType type = gfx::TextureType::TEX2D; + gfx::TextureUsage usage = gfx::TextureUsage::COLOR_ATTACHMENT; + gfx::Format format = gfx::Format::UNKNOWN; + int width = -1; + int height = -1; }; -typedef vector RenderTextureDescList; +using RenderTextureDescList = vector; struct CC_DLL FrameBufferDesc { - String name; - uint renderPass = 0; + String name; + uint renderPass = 0; vector colorTextures; - String depthStencilTexture; + String depthStencilTexture; }; -typedef vector FrameBufferDescList; +using FrameBufferDescList = vector; enum class RenderFlowType : uint8_t { SCENE, @@ -100,38 +105,38 @@ enum class RenderFlowType : uint8_t { UI, }; -typedef vector RenderStageList; -typedef vector RenderFlowList; -typedef vector LightList; -typedef vector UintList; +using RenderStageList = vector; +using RenderFlowList = vector; +using LightList = vector; +using UintList = vector; enum class CC_DLL RenderPassStage { DEFAULT = 100, - UI = 200, + UI = 200, }; struct CC_DLL InternalBindingDesc { - gfx::DescriptorType type; - gfx::UniformBlock blockInfo; - gfx::UniformSampler samplerInfo; - Value defaultValue; + gfx::DescriptorType type; + gfx::UniformBlock blockInfo; + gfx::UniformSamplerTexture samplerInfo; + Value defaultValue; }; struct CC_DLL InternalBindingInst : public InternalBindingDesc { - gfx::Buffer *buffer = nullptr; + gfx::Buffer * buffer = nullptr; gfx::Sampler *sampler = nullptr; gfx::Texture *texture = nullptr; }; struct CC_DLL RenderQueueCreateInfo { - bool isTransparent = false; - uint phases = 0; + bool isTransparent = false; + uint phases = 0; std::function sortFunc; }; enum class CC_DLL RenderPriority { - MIN = 0, - MAX = 0xff, + MIN = 0, + MAX = 0xff, DEFAULT = 0x80, }; @@ -141,30 +146,36 @@ enum class CC_DLL RenderQueueSortMode { }; struct CC_DLL RenderQueueDesc { - bool isTransparent = false; - RenderQueueSortMode sortMode = RenderQueueSortMode::FRONT_TO_BACK; - StringArray stages; + bool isTransparent = false; + RenderQueueSortMode sortMode = RenderQueueSortMode::FRONT_TO_BACK; + StringArray stages; }; -typedef std::vector RenderQueueDescList; +using RenderQueueDescList = std::vector; uint getPhaseID(const String &phase); CC_INLINE bool opaqueCompareFn(const RenderPass &a, const RenderPass &b) { - if (a.hash != b.hash) + if (a.hash != b.hash) { return a.hash < b.hash; - else if (math::IsNotEqualF(a.depth, b.depth)) + } + + if (math::IsNotEqualF(a.depth, b.depth)) { return a.depth < b.depth; - else - return a.shaderID < b.shaderID; + } + + return a.shaderID < b.shaderID; } CC_INLINE bool transparentCompareFn(const RenderPass &a, const RenderPass &b) { - if (a.hash != b.hash) + if (a.hash != b.hash) { return a.hash < b.hash; - else if (math::IsNotEqualF(a.depth, b.depth)) + } + + if (math::IsNotEqualF(a.depth, b.depth)) { return b.depth < a.depth; - else - return a.shaderID < b.shaderID; + } + + return a.shaderID < b.shaderID; } enum class CC_DLL PipelineGlobalBindings { @@ -175,10 +186,18 @@ enum class CC_DLL PipelineGlobalBindings { SAMPLER_SHADOWMAP, SAMPLER_ENVIRONMENT, // don't put this as the first sampler binding due to Mac GL driver issues: cubemap at texture unit 0 causes rendering issues SAMPLER_SPOT_LIGHTING_MAP, + SAMPLER_GBUFFER_ALBEDOMAP, + SAMPLER_GBUFFER_POSITIONMAP, + SAMPLER_GBUFFER_NORMALMAP, + SAMPLER_GBUFFER_EMISSIVEMAP, + SAMPLER_LIGHTING_RESULTMAP, COUNT, }; +extern CC_DLL int globalUBOCount; +extern CC_DLL int globalSamplerCount; + enum class CC_DLL ModelLocalBindings { UBO_LOCAL, UBO_FORWARD_LIGHTS, @@ -196,96 +215,115 @@ enum class CC_DLL ModelLocalBindings { COUNT, }; +extern CC_DLL int localUBOCount; +extern CC_DLL int localSamplerCount; + +enum class CC_DLL SetIndex { + GLOBAL, + MATERIAL, + LOCAL, +}; + +extern CC_DLL uint globalSet; +extern CC_DLL uint materialSet; +extern CC_DLL uint localSet; + +extern CC_DLL gfx::BindingMappingInfo bindingMappingInfo; + struct CC_DLL UBOLocalBatched { - static constexpr uint BATCHING_COUNT = 10; - static constexpr uint MAT_WORLDS_OFFSET = 0; - static constexpr uint COUNT = 16 * UBOLocalBatched::BATCHING_COUNT; - static constexpr uint SIZE = UBOLocalBatched::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); + static constexpr uint BATCHING_COUNT = 10; + static constexpr uint MAT_WORLDS_OFFSET = 0; + static constexpr uint COUNT = 16 * UBOLocalBatched::BATCHING_COUNT; + static constexpr uint SIZE = UBOLocalBatched::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOLocal { - static constexpr uint MAT_WORLD_OFFSET = 0; - static constexpr uint MAT_WORLD_IT_OFFSET = UBOLocal::MAT_WORLD_OFFSET + 16; - static constexpr uint LIGHTINGMAP_UVPARAM = UBOLocal::MAT_WORLD_IT_OFFSET + 16; - static constexpr uint COUNT = UBOLocal::LIGHTINGMAP_UVPARAM + 4; - static constexpr uint SIZE = UBOLocal::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); + static constexpr uint MAT_WORLD_OFFSET = 0; + static constexpr uint MAT_WORLD_IT_OFFSET = UBOLocal::MAT_WORLD_OFFSET + 16; + static constexpr uint LIGHTINGMAP_UVPARAM = UBOLocal::MAT_WORLD_IT_OFFSET + 16; + static constexpr uint COUNT = UBOLocal::LIGHTINGMAP_UVPARAM + 4; + static constexpr uint SIZE = UBOLocal::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_LOCAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOForwardLight { - static constexpr uint LIGHTS_PER_PASS = 1; - static constexpr uint LIGHT_POS_OFFSET = 0; - static constexpr uint LIGHT_COLOR_OFFSET = UBOForwardLight::LIGHT_POS_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint LIGHT_SIZE_RANGE_ANGLE_OFFSET = UBOForwardLight::LIGHT_COLOR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint LIGHT_DIR_OFFSET = UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint COUNT = UBOForwardLight::LIGHT_DIR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; - static constexpr uint SIZE = UBOForwardLight::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_FORWARD_LIGHTS); + static constexpr uint LIGHTS_PER_PASS = 1; + static constexpr uint LIGHT_POS_OFFSET = 0; + static constexpr uint LIGHT_COLOR_OFFSET = UBOForwardLight::LIGHT_POS_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint LIGHT_SIZE_RANGE_ANGLE_OFFSET = UBOForwardLight::LIGHT_COLOR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint LIGHT_DIR_OFFSET = UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint COUNT = UBOForwardLight::LIGHT_DIR_OFFSET + UBOForwardLight::LIGHTS_PER_PASS * 4; + static constexpr uint SIZE = UBOForwardLight::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_FORWARD_LIGHTS); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; +}; + +struct CC_DLL UBODeferredLight { + static constexpr uint LIGHTS_PER_PASS = 10; }; struct CC_DLL UBOSkinningTexture { - static constexpr uint JOINTS_TEXTURE_INFO_OFFSET = 0; - static constexpr uint COUNT = UBOSkinningTexture::JOINTS_TEXTURE_INFO_OFFSET + 4; - static constexpr uint SIZE = UBOSkinningTexture::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); + static constexpr uint JOINTS_TEXTURE_INFO_OFFSET = 0; + static constexpr uint COUNT = UBOSkinningTexture::JOINTS_TEXTURE_INFO_OFFSET + 4; + static constexpr uint SIZE = UBOSkinningTexture::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOSkinningAnimation { - static constexpr uint JOINTS_ANIM_INFO_OFFSET = 0; - static constexpr uint COUNT = UBOSkinningAnimation::JOINTS_ANIM_INFO_OFFSET + 4; - static constexpr uint SIZE = UBOSkinningAnimation::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_ANIMATION); + static constexpr uint JOINTS_ANIM_INFO_OFFSET = 0; + static constexpr uint COUNT = UBOSkinningAnimation::JOINTS_ANIM_INFO_OFFSET + 4; + static constexpr uint SIZE = UBOSkinningAnimation::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_ANIMATION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOSkinning { - static constexpr uint JOINTS_OFFSET = 0; - static constexpr uint COUNT = UBOSkinning::JOINTS_OFFSET + JOINT_UNIFORM_CAPACITY * 12; - static constexpr uint SIZE = UBOSkinning::COUNT * 4; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); + static constexpr uint JOINTS_OFFSET = 0; + static constexpr uint COUNT = UBOSkinning::JOINTS_OFFSET + JOINT_UNIFORM_CAPACITY * 12; + static constexpr uint SIZE = UBOSkinning::COUNT * 4; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_SKINNING_TEXTURE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOMorph { - static constexpr uint MAX_MORPH_TARGET_COUNT = 60; - static constexpr uint OFFSET_OF_WEIGHTS = 0; - static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH = 4 * MAX_MORPH_TARGET_COUNT; - static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT = OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH + 4; - static constexpr uint OFFSET_OF_VERTICES_COUNT = OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT + 4; - static const uint COUNT_BASE_4_BYTES; - static const uint SIZE; - static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_MORPH); + static constexpr uint MAX_MORPH_TARGET_COUNT = 60; + static constexpr uint OFFSET_OF_WEIGHTS = 0; + static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH = 4 * MAX_MORPH_TARGET_COUNT; + static constexpr uint OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT = OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH + 4; + static constexpr uint OFFSET_OF_VERTICES_COUNT = OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT + 4; + static const uint COUNT_BASE_4_BYTES; + static const uint SIZE; + static constexpr uint BINDING = static_cast(ModelLocalBindings::UBO_MORPH); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; enum class CC_DLL ForwardStagePriority { FORWARD = 10, - UI = 20 + UI = 20 }; enum class CC_DLL ForwardFlowPriority { - SHADOW = 0, + SHADOW = 0, FORWARD = 1, - UI = 10, + UI = 10, }; enum class CC_DLL RenderFlowTag { @@ -294,166 +332,214 @@ enum class CC_DLL RenderFlowTag { UI, }; +enum class CC_DLL DeferredStagePriority { + GBUFFER = 10, + LIGHTING = 15, + TRANSPARANT = 18, + POSTPROCESS = 19, + UI = 20 +}; + +enum class CC_DLL DeferredFlowPriority { + SHADOW = 0, + GBUFFER = 1, + LIGHTING = 5, + UI = 10 +}; + struct CC_DLL UBOGlobal : public Object { - static constexpr uint TIME_OFFSET = 0; - static constexpr uint SCREEN_SIZE_OFFSET = UBOGlobal::TIME_OFFSET + 4; - static constexpr uint NATIVE_SIZE_OFFSET = UBOGlobal::SCREEN_SIZE_OFFSET + 4; - static constexpr uint COUNT = UBOGlobal::NATIVE_SIZE_OFFSET + 4; - static constexpr uint SIZE = UBOGlobal::COUNT * 4; - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_GLOBAL); + static constexpr uint TIME_OFFSET = 0; + static constexpr uint SCREEN_SIZE_OFFSET = UBOGlobal::TIME_OFFSET + 4; + static constexpr uint NATIVE_SIZE_OFFSET = UBOGlobal::SCREEN_SIZE_OFFSET + 4; + static constexpr uint COUNT = UBOGlobal::NATIVE_SIZE_OFFSET + 4; + static constexpr uint SIZE = UBOGlobal::COUNT * 4; + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_GLOBAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOCamera : public Object { - static constexpr uint MAT_VIEW_OFFSET = 0; - static constexpr uint MAT_VIEW_INV_OFFSET = UBOCamera::MAT_VIEW_OFFSET + 16; - static constexpr uint MAT_PROJ_OFFSET = UBOCamera::MAT_VIEW_INV_OFFSET + 16; - static constexpr uint MAT_PROJ_INV_OFFSET = UBOCamera::MAT_PROJ_OFFSET + 16; - static constexpr uint MAT_VIEW_PROJ_OFFSET = UBOCamera::MAT_PROJ_INV_OFFSET + 16; - static constexpr uint MAT_VIEW_PROJ_INV_OFFSET = UBOCamera::MAT_VIEW_PROJ_OFFSET + 16; - static constexpr uint CAMERA_POS_OFFSET = UBOCamera::MAT_VIEW_PROJ_INV_OFFSET + 16; - static constexpr uint SCREEN_SCALE_OFFSET = UBOCamera::CAMERA_POS_OFFSET + 4; - static constexpr uint EXPOSURE_OFFSET = UBOCamera::SCREEN_SCALE_OFFSET + 4; - static constexpr uint MAIN_LIT_DIR_OFFSET = UBOCamera::EXPOSURE_OFFSET + 4; - static constexpr uint MAIN_LIT_COLOR_OFFSET = UBOCamera::MAIN_LIT_DIR_OFFSET + 4; - static constexpr uint AMBIENT_SKY_OFFSET = UBOCamera::MAIN_LIT_COLOR_OFFSET + 4; - static constexpr uint AMBIENT_GROUND_OFFSET = UBOCamera::AMBIENT_SKY_OFFSET + 4; - static constexpr uint GLOBAL_FOG_COLOR_OFFSET = UBOCamera::AMBIENT_GROUND_OFFSET + 4; - static constexpr uint GLOBAL_FOG_BASE_OFFSET = UBOCamera::GLOBAL_FOG_COLOR_OFFSET + 4; - static constexpr uint GLOBAL_FOG_ADD_OFFSET = UBOCamera::GLOBAL_FOG_BASE_OFFSET + 4; - static constexpr uint COUNT = UBOCamera::GLOBAL_FOG_ADD_OFFSET + 4; - static constexpr uint SIZE = UBOCamera::COUNT * 4; - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_CAMERA); + static constexpr uint MAT_VIEW_OFFSET = 0; + static constexpr uint MAT_VIEW_INV_OFFSET = UBOCamera::MAT_VIEW_OFFSET + 16; + static constexpr uint MAT_PROJ_OFFSET = UBOCamera::MAT_VIEW_INV_OFFSET + 16; + static constexpr uint MAT_PROJ_INV_OFFSET = UBOCamera::MAT_PROJ_OFFSET + 16; + static constexpr uint MAT_VIEW_PROJ_OFFSET = UBOCamera::MAT_PROJ_INV_OFFSET + 16; + static constexpr uint MAT_VIEW_PROJ_INV_OFFSET = UBOCamera::MAT_VIEW_PROJ_OFFSET + 16; + static constexpr uint CAMERA_POS_OFFSET = UBOCamera::MAT_VIEW_PROJ_INV_OFFSET + 16; + static constexpr uint SCREEN_SCALE_OFFSET = UBOCamera::CAMERA_POS_OFFSET + 4; + static constexpr uint EXPOSURE_OFFSET = UBOCamera::SCREEN_SCALE_OFFSET + 4; + static constexpr uint MAIN_LIT_DIR_OFFSET = UBOCamera::EXPOSURE_OFFSET + 4; + static constexpr uint MAIN_LIT_COLOR_OFFSET = UBOCamera::MAIN_LIT_DIR_OFFSET + 4; + static constexpr uint AMBIENT_SKY_OFFSET = UBOCamera::MAIN_LIT_COLOR_OFFSET + 4; + static constexpr uint AMBIENT_GROUND_OFFSET = UBOCamera::AMBIENT_SKY_OFFSET + 4; + static constexpr uint GLOBAL_FOG_COLOR_OFFSET = UBOCamera::AMBIENT_GROUND_OFFSET + 4; + static constexpr uint GLOBAL_FOG_BASE_OFFSET = UBOCamera::GLOBAL_FOG_COLOR_OFFSET + 4; + static constexpr uint GLOBAL_FOG_ADD_OFFSET = UBOCamera::GLOBAL_FOG_BASE_OFFSET + 4; + static constexpr uint COUNT = UBOCamera::GLOBAL_FOG_ADD_OFFSET + 4; + static constexpr uint SIZE = UBOCamera::COUNT * 4; + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_CAMERA); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; struct CC_DLL UBOShadow : public Object { - static constexpr uint MAT_LIGHT_PLANE_PROJ_OFFSET = 0; - static constexpr uint MAT_LIGHT_VIEW_PROJ_OFFSET = UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET + 16; - static constexpr uint SHADOW_COLOR_OFFSET = UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET + 16; - static constexpr uint SHADOW_INFO_OFFSET = UBOShadow::SHADOW_COLOR_OFFSET + 4; - static constexpr uint COUNT = UBOShadow::SHADOW_INFO_OFFSET + 4; - static constexpr uint SIZE = UBOShadow::COUNT * 4; - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_SHADOW); + static constexpr uint MAT_LIGHT_PLANE_PROJ_OFFSET = 0; + static constexpr uint MAT_LIGHT_VIEW_OFFSET = MAT_LIGHT_PLANE_PROJ_OFFSET + 16; + static constexpr uint MAT_LIGHT_VIEW_PROJ_OFFSET = UBOShadow::MAT_LIGHT_VIEW_OFFSET + 16; + static constexpr uint SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET = UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET + 16; + static constexpr uint SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET = UBOShadow::SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET + 4; + static constexpr uint SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET = UBOShadow::SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET + 4; + static constexpr uint SHADOW_COLOR_OFFSET = UBOShadow::SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET + 4; + static constexpr uint COUNT = UBOShadow::SHADOW_COLOR_OFFSET + 4; + static constexpr uint SIZE = UBOShadow::COUNT * 4; + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::UBO_SHADOW); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformBlock LAYOUT; - static const String NAME; + static const gfx::UniformBlock LAYOUT; + static const String NAME; }; class CC_DLL SamplerLib : public Object { public: - gfx::Sampler *getSampler(uint hash); + static gfx::Sampler *getSampler(uint hash); + static uint genSamplerHash(const gfx::SamplerInfo &info); + + static void destroyAll(); + +protected: + static uint defaultSamplerHash; + + static unordered_map samplerCache; }; struct CC_DLL DescriptorSetLayoutInfos { - gfx::DescriptorSetLayoutBindingList bindings; - unordered_map blocks; - unordered_map samplers; + gfx::DescriptorSetLayoutBindingList bindings; + unordered_map blocks; + unordered_map samplers; }; extern CC_DLL DescriptorSetLayoutInfos globalDescriptorSetLayout; extern CC_DLL DescriptorSetLayoutInfos localDescriptorSetLayout; -uint genSamplerHash(const gfx::SamplerInfo &); -gfx::Sampler *getSampler(uint hash); - enum class LayerList : uint { - NONE = 0, + NONE = 0, IGNORE_RAYCAST = (1 << 20), - GIZMOS = (1 << 21), - EDITOR = (1 << 22), - UI_3D = (1 << 23), - SCENE_GIZMO = (1 << 24), - UI_2D = (1 << 25), + GIZMOS = (1 << 21), + EDITOR = (1 << 22), + UI_3D = (1 << 23), + SCENE_GIZMO = (1 << 24), + UI_2D = (1 << 25), PROFILER = (1 << 28), - DEFAULT = (1 << 30), - ALL = 0xffffffff, + DEFAULT = (1 << 30), + ALL = 0xffffffff, }; -//TODO const uint CAMERA_DEFAULT_MASK = ~static_cast(LayerList::UI_2D) & ~static_cast(LayerList::PROFILER); //constexpr CAMERA_DEFAULT_MASK = Layers.makeMaskExclude([Layers.BitMask.UI_2D, Layers.BitMask.GIZMOS, Layers.BitMask.EDITOR, // Layers.BitMask.SCENE_GIZMO, Layers.BitMask.PROFILER]); uint nextPow2(uint val); -enum class CC_DLL SetIndex { - GLOBAL, - MATERIAL, - LOCAL, -}; -extern CC_DLL uint GLOBAL_SET; -extern CC_DLL uint MATERIAL_SET; -extern CC_DLL uint LOCAL_SET; -extern CC_DLL uint SKYBOX_FLAG; -extern CC_DLL DescriptorSetLayoutInfos globalDescriptorSetLayout; -extern CC_DLL DescriptorSetLayoutInfos localDescriptorSetLayout; +extern CC_DLL uint skyboxFlag; struct CC_DLL SHADOWMAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SHADOWMAP); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SHADOWMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; +}; + +struct CC_DLL SAMPLERGBUFFERALBEDOMAP : public Object { + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_ALBEDOMAP); + static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; +}; + +struct CC_DLL SAMPLERGBUFFERPOSITIONMAP : public Object { + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_POSITIONMAP); + static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; +}; + +struct CC_DLL SAMPLERGBUFFERNORMALMAP : public Object { + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_NORMALMAP); + static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; +}; + +struct CC_DLL SAMPLERGBUFFEREMISSIVEMAP : public Object { + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_EMISSIVEMAP); + static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; +}; + +struct CC_DLL SAMPLERLIGHTINGRESULTMAP : public Object { + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_LIGHTING_RESULTMAP); + static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; struct CC_DLL ENVIRONMENT : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_ENVIRONMENT); + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_ENVIRONMENT); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL SPOT_LIGHTING_MAP : public Object { - static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SPOT_LIGHTING_MAP); +struct CC_DLL SPOTLIGHTINGMAP : public Object { + static constexpr uint BINDING = static_cast(PipelineGlobalBindings::SAMPLER_SPOT_LIGHTING_MAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL JOINT_TEXTURE : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_JOINTS); +struct CC_DLL JOINTTEXTURE : public Object { + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_JOINTS); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL POSITION_MORPH : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_POSITION); +struct CC_DLL POSITIONMORPH : public Object { + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_POSITION); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL NORMAL_MORPH : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_NORMAL); +struct CC_DLL NORMALMORPH : public Object { + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_NORMAL); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL TANGENT_MORPH : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_TANGENT); +struct CC_DLL TANGENTMORPH : public Object { + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_MORPH_TANGENT); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL LIGHTMAP_TEXTURE : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_LIGHTMAP); +struct CC_DLL LIGHTMAPTEXTURE : public Object { + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_LIGHTMAP); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; -struct CC_DLL SPRITE_TEXTURE : public Object { - static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_SPRITE); +struct CC_DLL SPRITETEXTURE : public Object { + static constexpr uint BINDING = static_cast(ModelLocalBindings::SAMPLER_SPRITE); static const gfx::DescriptorSetLayoutBinding DESCRIPTOR; - static const gfx::UniformSampler LAYOUT; - static const String NAME; + static const gfx::UniformSamplerTexture LAYOUT; + static const String NAME; }; + } // namespace pipeline } // namespace cc diff --git a/native/cocos/renderer/pipeline/InstancedBuffer.cpp b/native/cocos/renderer/pipeline/InstancedBuffer.cpp index 2253f48f60..7e265f9e8e 100644 --- a/native/cocos/renderer/pipeline/InstancedBuffer.cpp +++ b/native/cocos/renderer/pipeline/InstancedBuffer.cpp @@ -1,42 +1,45 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "InstancedBuffer.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXInputAssembler.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXInputAssembler.h" #include "helper/SharedMemory.h" +#include "Define.h" namespace cc { namespace pipeline { -map> InstancedBuffer::_buffers; -InstancedBuffer *InstancedBuffer::get(uint pass) { +map> InstancedBuffer::buffers; +InstancedBuffer * InstancedBuffer::get(uint pass) { return InstancedBuffer::get(pass, 0); } InstancedBuffer *InstancedBuffer::get(uint pass, uint extraKey) { - auto &record = _buffers[pass]; + auto &record = buffers[pass]; auto &buffer = record[extraKey]; if (buffer == nullptr) buffer = CC_NEW(InstancedBuffer(GET_PASS(pass))); @@ -48,8 +51,7 @@ InstancedBuffer::InstancedBuffer(const PassView *pass) _device(gfx::Device::getInstance()) { } -InstancedBuffer::~InstancedBuffer() { -} +InstancedBuffer::~InstancedBuffer() = default; void InstancedBuffer::destroy() { for (auto &instance : _instances) { @@ -61,16 +63,23 @@ void InstancedBuffer::destroy() { } void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel, uint passIdx) { - uint stride = 0; - const auto instancedBuffer = model->getInstancedBuffer(&stride); + merge(model, subModel, passIdx, nullptr); +} + +void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel, uint passIdx, gfx::Shader *shaderImplant) { + uint stride = 0; + const auto *const instancedBuffer = model->getInstancedBuffer(&stride); if (!stride) return; // we assume per-instance attributes are always present - auto sourceIA = subModel->getInputAssembler(); - auto lightingMap = subModel->getDescriptorSet()->getTexture(LIGHTMAP_TEXTURE::BINDING); - auto shader = subModel->getShader(passIdx); - auto descriptorSet = subModel->getDescriptorSet(); - for (int i = 0; i < _instances.size(); i++) { - auto &instance = _instances[i]; + auto *sourceIA = subModel->getInputAssembler(); + auto *descriptorSet = subModel->getDescriptorSet(); + auto *lightingMap = descriptorSet->getTexture(LIGHTMAPTEXTURE::BINDING); + auto *shader = shaderImplant; + if (!shader) { + shader = subModel->getShader(passIdx); + } + + for (auto &instance : _instances) { if (instance.ia->getIndexBuffer() != sourceIA->getIndexBuffer() || instance.count >= MAX_CAPACITY) { continue; } @@ -85,9 +94,9 @@ void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel } if (instance.count >= instance.capacity) { // resize buffers instance.capacity <<= 1; - const auto newSize = instance.stride * instance.capacity; - const auto oldData = instance.data; - instance.data = (uint8_t *)CC_MALLOC(newSize); + const auto newSize = instance.stride * instance.capacity; + auto *const oldData = instance.data; + instance.data = static_cast(CC_MALLOC(newSize)); memcpy(instance.data, oldData, instance.vb->getSize()); instance.vb->resize(newSize); CC_FREE(oldData); @@ -104,33 +113,33 @@ void InstancedBuffer::merge(const ModelView *model, const SubModelView *subModel } // Create a new instance - auto newSize = stride * INITIAL_CAPACITY; - auto vb = _device->createBuffer({ + auto newSize = stride * INITIAL_CAPACITY; + auto *vb = _device->createBuffer({ gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, static_cast(newSize), static_cast(stride), }); - auto vertexBuffers = sourceIA->getVertexBuffers(); - auto attributes = sourceIA->getAttributes(); - auto indexBuffer = sourceIA->getIndexBuffer(); + auto vertexBuffers = sourceIA->getVertexBuffers(); + auto attributes = sourceIA->getAttributes(); + auto *indexBuffer = sourceIA->getIndexBuffer(); - const auto attributesID = model->getInstancedAttributeID(); - const auto lenght = attributesID[0]; - for (auto i = 1; i <= lenght; i++) { - const auto attribute = model->getInstancedAttribute(attributesID[i]); - gfx::Attribute newAttr = {attribute->name, attribute->format, attribute->isNormalized, static_cast(vertexBuffers.size()), true, attribute->location}; + const auto *const attributesID = model->getInstancedAttributeID(); + const auto lenght = attributesID[0]; + for (uint i = 1; i <= lenght; i++) { + auto *const attribute = ModelView::getInstancedAttribute(attributesID[i]); + gfx::Attribute newAttr = {attribute->name, attribute->format, attribute->isNormalized, static_cast(vertexBuffers.size()), true, attribute->location}; attributes.emplace_back(std::move(newAttr)); } - uint8_t *data = (uint8_t *)CC_MALLOC(newSize); + auto *data = static_cast(CC_MALLOC(newSize)); memcpy(data, instancedBuffer, stride); vertexBuffers.emplace_back(vb); gfx::InputAssemblerInfo iaInfo = {attributes, vertexBuffers, indexBuffer}; - auto ia = _device->createInputAssembler(iaInfo); - InstancedItem item = {1, INITIAL_CAPACITY, vb, data, ia, stride, shader, descriptorSet, lightingMap}; - _instances.emplace_back(std::move(item)); + auto * ia = _device->createInputAssembler(iaInfo); + InstancedItem item = {1, INITIAL_CAPACITY, vb, data, ia, stride, shader, descriptorSet, lightingMap}; + _instances.emplace_back(item); _hasPendingModels = true; } diff --git a/native/cocos/renderer/pipeline/InstancedBuffer.h b/native/cocos/renderer/pipeline/InstancedBuffer.h index 9682bc1883..c027455fed 100644 --- a/native/cocos/renderer/pipeline/InstancedBuffer.h +++ b/native/cocos/renderer/pipeline/InstancedBuffer.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "Define.h" @@ -51,8 +53,8 @@ struct CC_DLL InstancedItem { gfx::DescriptorSet *descriptorSet = nullptr; gfx::Texture *lightingMap = nullptr; }; -typedef vector InstancedItemList; -typedef vector DynamicOffsetList; +using InstancedItemList = vector; +using DynamicOffsetList = vector; class InstancedBuffer : public Object { public: @@ -61,11 +63,12 @@ public: static InstancedBuffer *get(uint pass); static InstancedBuffer *get(uint pass, uint extraKey); - InstancedBuffer(const PassView *pass); - virtual ~InstancedBuffer(); + explicit InstancedBuffer(const PassView *pass); + ~InstancedBuffer() override; void destroy(); void merge(const ModelView *, const SubModelView *, uint); + void merge(const ModelView *, const SubModelView *, uint, gfx::Shader *); void uploadBuffers(gfx::CommandBuffer *cmdBuff); void clear(); void setDynamicOffset(uint idx, uint value); @@ -76,7 +79,7 @@ public: CC_INLINE const DynamicOffsetList &dynamicOffsets() const { return _dynamicOffsets; } private: - static map> _buffers; + static map> buffers; InstancedItemList _instances; const PassView *_pass = nullptr; bool _hasPendingModels = false; diff --git a/native/cocos/renderer/pipeline/PipelineSceneData.cpp b/native/cocos/renderer/pipeline/PipelineSceneData.cpp new file mode 100644 index 0000000000..35ec53a65f --- /dev/null +++ b/native/cocos/renderer/pipeline/PipelineSceneData.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "PipelineSceneData.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" + +namespace cc { +namespace pipeline { + +void PipelineSceneData::activate(gfx::Device *device, RenderPipeline *pipeline) +{ + _device = device; + _pipeline = pipeline; + + _sphere = CC_NEW(Sphere); +} + +void PipelineSceneData::setPipelineSharedSceneData(uint handle) +{ + _sharedSceneData = GET_PIPELINE_SHARED_SCENE_DATA(handle); +} + +void PipelineSceneData::destroy() +{ + CC_SAFE_DELETE(_sphere); + + for (auto &pair : _shadowFrameBufferMap) { + pair.second->destroy(); + delete pair.second; + } + + _shadowFrameBufferMap.clear(); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/PipelineSceneData.h b/native/cocos/renderer/pipeline/PipelineSceneData.h new file mode 100644 index 0000000000..a17ceb2901 --- /dev/null +++ b/native/cocos/renderer/pipeline/PipelineSceneData.h @@ -0,0 +1,70 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "helper/SharedMemory.h" +#include "Define.h" + +namespace cc { + +namespace gfx { +class Framebuffer; +} + +namespace pipeline { + +class RenderPipeline; + +class CC_DLL PipelineSceneData : public Object { +public: + PipelineSceneData() = default; + virtual ~PipelineSceneData() = default; + void activate(gfx::Device *device, RenderPipeline *pipeline); + void setPipelineSharedSceneData (uint handle); + void destroy(); + + CC_INLINE void setShadowFramebuffer(const Light *light, gfx::Framebuffer *framebuffer) { _shadowFrameBufferMap.emplace(light, framebuffer); } + CC_INLINE const std::unordered_map &getShadowFramebufferMap() const { return _shadowFrameBufferMap; } + CC_INLINE PipelineSharedSceneData* getSharedData() const { return _sharedSceneData; } + CC_INLINE const RenderObjectList &getRenderObjects() const { return _renderObjects; } + CC_INLINE const RenderObjectList &getShadowObjects() const { return _shadowObjects; } + CC_INLINE void setRenderObjects(RenderObjectList &&ro) { _renderObjects = std::forward(ro); } + CC_INLINE void setShadowObjects(RenderObjectList &&ro) { _shadowObjects = std::forward(ro); } + CC_INLINE Sphere* getSphere() const {return _sphere; } +private: + RenderObjectList _renderObjects; + RenderObjectList _shadowObjects; + + PipelineSharedSceneData *_sharedSceneData = nullptr; + RenderPipeline *_pipeline = nullptr; + gfx::Device *_device = nullptr; + Sphere *_sphere = nullptr; + + std::unordered_map _shadowFrameBufferMap; +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/PipelineStateManager.cpp b/native/cocos/renderer/pipeline/PipelineStateManager.cpp index 367a313b4a..66249e50f9 100644 --- a/native/cocos/renderer/pipeline/PipelineStateManager.cpp +++ b/native/cocos/renderer/pipeline/PipelineStateManager.cpp @@ -1,50 +1,52 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "PipelineStateManager.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXInputAssembler.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXShader.h" +#include "gfx-base/GFXDevice.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { -map PipelineStateManager::_PSOHashMap; -gfx::PipelineState *PipelineStateManager::getOrCreatePipelineState(const PassView *pass, - gfx::Shader *shader, - gfx::InputAssembler *inputAssembler, - gfx::RenderPass *renderPass) { - const auto passHash = pass->hash; - const auto renderPassHash = renderPass->getHash(); - const auto iaHash = inputAssembler->getAttributesHash(); - const auto shaderID = shader->getID(); - const auto hash = passHash ^ renderPassHash ^ iaHash ^ shaderID; - auto pso = _PSOHashMap[hash]; +unordered_map PipelineStateManager::_PSOHashMap; + +gfx::PipelineState *PipelineStateManager::getOrCreatePipelineState(const PassView * pass, + gfx::Shader * shader, + gfx::InputAssembler *inputAssembler, + gfx::RenderPass * renderPass) { + const auto passHash = pass->hash; + const auto renderPassHash = renderPass->getHash(); + const auto iaHash = inputAssembler->getAttributesHash(); + const auto shaderID = shader->getID(); + const auto hash = passHash ^ renderPassHash ^ iaHash ^ shaderID; + + auto *pso = _PSOHashMap[hash]; if (!pso) { - auto pipelineLayout = pass->getPipelineLayout(); - gfx::PipelineStateInfo info = { + auto *pipelineLayout = pass->getPipelineLayout(); + + pso = gfx::Device::getInstance()->createPipelineState({ shader, pipelineLayout, renderPass, @@ -53,23 +55,30 @@ gfx::PipelineState *PipelineStateManager::getOrCreatePipelineState(const PassVie *(pass->getDepthStencilState()), *(pass->getBlendState()), pass->getPrimitive(), - pass->getDynamicState()}; + pass->getDynamicState(), + }); - pso = gfx::Device::getInstance()->createPipelineState(std::move(info)); _PSOHashMap[hash] = pso; } return pso; } -gfx::PipelineState *PipelineStateManager::getOrCreatePipelineStateByJS(uint32_t passHandle, - gfx::Shader *shader, +gfx::PipelineState *PipelineStateManager::getOrCreatePipelineStateByJS(uint32_t passHandle, + gfx::Shader * shader, gfx::InputAssembler *inputAssembler, - gfx::RenderPass *renderPass) { - const auto pass = GET_PASS(passHandle); + gfx::RenderPass * renderPass) { + const auto *pass = GET_PASS(passHandle); CC_ASSERT(pass); return PipelineStateManager::getOrCreatePipelineState(pass, shader, inputAssembler, renderPass); } +void PipelineStateManager::destroyAll() { + for (auto &pair : _PSOHashMap) { + CC_SAFE_DESTROY(pair.second); + } + _PSOHashMap.clear(); +} + } // namespace pipeline } // namespace cc diff --git a/native/cocos/renderer/pipeline/PipelineStateManager.h b/native/cocos/renderer/pipeline/PipelineStateManager.h index ae63748724..e60360cc74 100644 --- a/native/cocos/renderer/pipeline/PipelineStateManager.h +++ b/native/cocos/renderer/pipeline/PipelineStateManager.h @@ -1,38 +1,35 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "core/CoreStd.h" +#include "gfx-base/GFXDef.h" namespace cc { -namespace gfx { -class InputAssembler; -class PipelineState; -class RenderPass; -}; // namespace gfx - namespace pipeline { + struct PassView; class CC_DLL PipelineStateManager { @@ -41,13 +38,16 @@ public: gfx::Shader *shader, gfx::InputAssembler *inputAssembler, gfx::RenderPass *renderPass); + static gfx::PipelineState *getOrCreatePipelineStateByJS(uint32_t passHandle, gfx::Shader *shader, gfx::InputAssembler *inputAssembler, gfx::RenderPass *renderPass); + static void destroyAll(); + private: - static map _PSOHashMap; + static unordered_map _PSOHashMap; }; } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/PipelineUBO.cpp b/native/cocos/renderer/pipeline/PipelineUBO.cpp new file mode 100644 index 0000000000..ed32c601fe --- /dev/null +++ b/native/cocos/renderer/pipeline/PipelineUBO.cpp @@ -0,0 +1,407 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "PipelineUBO.h" +#include "RenderPipeline.h" +#include "SceneCulling.h" +#include "gfx-base/GFXDevice.h" +#include "platform/Application.h" + +namespace cc { + +namespace pipeline { + +#define TO_VEC3(dst, src, offset) \ + (dst)[(offset) + 0] = (src).x; \ + (dst)[(offset) + 1] = (src).y; \ + (dst)[(offset) + 2] = (src).z; +#define TO_VEC4(dst, src, offset) \ + (dst)[(offset) + 0] = (src).x; \ + (dst)[(offset) + 1] = (src).y; \ + (dst)[(offset) + 2] = (src).z; \ + (dst)[(offset) + 3] = (src).w; + +Mat4 matShadowViewProj; + +void PipelineUBO::updateGlobalUBOView(const RenderPipeline * /*pipeline*/, std::array &bufferView) { + auto *const root = GET_ROOT(); + auto * device = gfx::Device::getInstance(); + auto & uboGlobalView = bufferView; + + const auto shadingWidth = std::floor(device->getWidth()); + const auto shadingHeight = std::floor(device->getHeight()); + + // update UBOGlobal + uboGlobalView[UBOGlobal::TIME_OFFSET + 0] = root->cumulativeTime; + uboGlobalView[UBOGlobal::TIME_OFFSET + 1] = root->frameTime; + uboGlobalView[UBOGlobal::TIME_OFFSET + 2] = static_cast (Application::getInstance()->getTotalFrames()); + + uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 0] = static_cast(device->getWidth()); + uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 1] = static_cast(device->getHeight()); + uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 2] = 1.0F / uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET]; + uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 3] = 1.0F / uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 1]; + + uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 0] = static_cast(shadingWidth); + uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 1] = static_cast(shadingHeight); + uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 2] = 1.0F / uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET]; + uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 3] = 1.0F / uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 1]; +} + +void PipelineUBO::updateCameraUBOView(const RenderPipeline *pipeline, std::array &bufferView, + const Camera *camera, bool hasOffScreenAttachments) { + const auto *const scene = camera->getScene(); + const Light *mainLight = nullptr; + if (scene->mainLightID) mainLight = scene->getMainLight(); + auto * sceneData = pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + const auto fpScale = sharedData->fpScale; + auto *const descriptorSet = pipeline->getDescriptorSet(); + auto * ambient = sharedData->getAmbient(); + auto * fog = sharedData->getFog(); + const auto isHDR = sharedData->isHDR; + const auto shadingScale = sharedData->shadingScale; + + auto *device = gfx::Device::getInstance(); + auto &uboCameraView = bufferView; + + const auto shadingWidth = std::floor(device->getWidth()); + const auto shadingHeight = std::floor(device->getHeight()); + + uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 0] = static_cast(camera->width / shadingWidth * shadingScale); + uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 1] = static_cast(camera->height / shadingHeight * shadingScale); + uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 2] = 1.0F / uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET]; + uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 3] = 1.0F / uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 1]; + + const auto exposure = camera->exposure; + uboCameraView[UBOCamera::EXPOSURE_OFFSET + 0] = exposure; + uboCameraView[UBOCamera::EXPOSURE_OFFSET + 1] = 1.0F / exposure; + uboCameraView[UBOCamera::EXPOSURE_OFFSET + 2] = isHDR ? 1.0F : 0.0F; + uboCameraView[UBOCamera::EXPOSURE_OFFSET + 3] = fpScale / exposure; + + if (mainLight) { + TO_VEC3(uboCameraView, mainLight->direction, UBOCamera::MAIN_LIT_DIR_OFFSET); + TO_VEC3(uboCameraView, mainLight->color, UBOCamera::MAIN_LIT_COLOR_OFFSET); + if (mainLight->useColorTemperature) { + const auto colorTempRGB = mainLight->colorTemperatureRGB; + uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 0] *= colorTempRGB.x; + uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 1] *= colorTempRGB.y; + uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 2] *= colorTempRGB.z; + } + + if (isHDR) { + uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 3] = mainLight->luminance * fpScale; + } else { + uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 3] = mainLight->luminance * exposure; + } + } else { + TO_VEC3(uboCameraView, Vec3::UNIT_Z, UBOCamera::MAIN_LIT_DIR_OFFSET); + TO_VEC4(uboCameraView, Vec4::ZERO, UBOCamera::MAIN_LIT_COLOR_OFFSET); + } + + Vec4 skyColor = ambient->skyColor; + if (isHDR) { + skyColor.w = ambient->skyIllum * fpScale; + } else { + skyColor.w = ambient->skyIllum * exposure; + } + TO_VEC4(uboCameraView, skyColor, UBOCamera::AMBIENT_SKY_OFFSET); + + uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 0] = ambient->groundAlbedo.x; + uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 1] = ambient->groundAlbedo.y; + uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 2] = ambient->groundAlbedo.z; + auto *const envmap = descriptorSet->getTexture(static_cast(PipelineGlobalBindings::SAMPLER_ENVIRONMENT)); + if (envmap) { + uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 3] = static_cast(envmap->getLevelCount()); + } + + memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_OFFSET, camera->matView.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_INV_OFFSET, camera->getNode()->worldMatrix.m, sizeof(cc::Mat4)); + TO_VEC3(uboCameraView, camera->position, UBOCamera::CAMERA_POS_OFFSET); + + if (hasOffScreenAttachments) { + memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_OFFSET, camera->matProjOffscreen.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_INV_OFFSET, camera->matProjInvOffscreen.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_OFFSET, camera->matViewProjOffscreen.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_INV_OFFSET, camera->matViewProjInvOffscreen.m, sizeof(cc::Mat4)); + uboCameraView[UBOCamera::CAMERA_POS_OFFSET + 3] = getCombineSignY(); + } else { + memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_OFFSET, camera->matProj.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_INV_OFFSET, camera->matProjInv.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_OFFSET, camera->matViewProj.m, sizeof(cc::Mat4)); + memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_INV_OFFSET, camera->matViewProjInv.m, sizeof(cc::Mat4)); + uboCameraView[UBOCamera::CAMERA_POS_OFFSET + 3] = getCombineSignY(); + } + + if (fog->enabled) { + TO_VEC4(uboCameraView, fog->fogColor, UBOCamera::GLOBAL_FOG_COLOR_OFFSET); + + uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 0] = fog->fogStart; + uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 1] = fog->fogEnd; + uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 2] = fog->fogDensity; + + uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 0] = fog->fogTop; + uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 1] = fog->fogRange; + uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 2] = fog->fogAtten; + } +} + +void PipelineUBO::updateShadowUBOView(const RenderPipeline *pipeline, std::array &bufferView, const Camera *camera) { + const auto *const scene = camera->getScene(); + const Light *mainLight = nullptr; + if (scene->mainLightID) mainLight = scene->getMainLight(); + auto * device = gfx::Device::getInstance(); + auto *const sceneData = pipeline->getPipelineSceneData(); + auto *const shadowInfo = sceneData->getSharedData()->getShadows(); + auto & shadowUBO = bufferView; + auto * sphere = sceneData->getSphere(); + + if (shadowInfo->enabled) { + if (mainLight && shadowInfo->getShadowType() == ShadowType::SHADOWMAP) { + const auto *const node = mainLight->getNode(); + cc::Mat4 matShadowCamera; + + // light proj + float x; + float y; + float farClamp; + if (shadowInfo->autoAdapt) { + Vec3 tmpCenter; + getShadowWorldMatrix(sphere, node->worldRotation, mainLight->direction, matShadowCamera, tmpCenter); + + const float radius = sphere->radius; + x = radius * shadowInfo->aspect; + y = radius; + + const float halfFar = tmpCenter.distance(sphere->center); + farClamp = std::min(halfFar * COEFFICIENT_OF_EXPANSION, SHADOW_CAMERA_MAX_FAR); + } else { + matShadowCamera = mainLight->getNode()->worldMatrix; + + x = shadowInfo->orthoSize * shadowInfo->aspect; + y = shadowInfo->orthoSize; + + farClamp = shadowInfo->farValue; + } + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_OFFSET, matShadowCamera.m, sizeof(matShadowCamera)); + + const auto matShadowView = matShadowCamera.getInversed(); + const auto projectionSinY = device->getCapabilities().clipSpaceSignY; + Mat4::createOrthographicOffCenter(-x, x, -y, y, shadowInfo->nearValue, farClamp, device->getCapabilities().clipSpaceMinZ, projectionSinY, &matShadowViewProj); + + matShadowViewProj.multiply(matShadowView); + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); + + float shadowNFLSInfos[4] = {shadowInfo->nearValue, farClamp, static_cast(shadowInfo->linear), static_cast(shadowInfo->selfShadow)}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET, &shadowNFLSInfos, sizeof(shadowNFLSInfos)); + + float shadowWHPBInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, static_cast(shadowInfo->pcfType), shadowInfo->bias}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET, &shadowWHPBInfos, sizeof(shadowWHPBInfos)); + + float shadowLPNNInfos[4] = {0.0F, static_cast(shadowInfo->packing), shadowInfo->normalBias, 0.0F}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET, &shadowLPNNInfos, sizeof(shadowLPNNInfos)); + } else if (mainLight && shadowInfo->getShadowType() == ShadowType::PLANAR) { + updateDirLight(shadowInfo, mainLight, shadowUBO); + } + + const float color[4] = {shadowInfo->color.x, shadowInfo->color.y, shadowInfo->color.z, shadowInfo->color.w}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &color, sizeof(float) * 4); + } +} + +void PipelineUBO::updateShadowUBOLightView(const RenderPipeline *pipeline, std::array &bufferView, const Light *light) { + auto *const sceneData = pipeline->getPipelineSceneData(); + auto * shadowInfo = sceneData->getSharedData()->getShadows(); + auto * device = gfx::Device::getInstance(); + auto * sphere = sceneData->getSphere(); + auto & shadowUBO = bufferView; + switch (light->getType()) { + case LightType::DIRECTIONAL: { + cc::Mat4 matShadowCamera; + + float x; + float y; + float farClamp; + if (shadowInfo->autoAdapt) { + Vec3 tmpCenter; + getShadowWorldMatrix(sphere, light->getNode()->worldRotation, light->direction, matShadowCamera, tmpCenter); + + const auto radius = sphere->radius; + x = radius * shadowInfo->aspect; + y = radius; + + const float halfFar = tmpCenter.distance(sphere->center); + farClamp = std::min(halfFar * COEFFICIENT_OF_EXPANSION, SHADOW_CAMERA_MAX_FAR); + } else { + matShadowCamera = light->getNode()->worldMatrix; + + x = shadowInfo->orthoSize * shadowInfo->aspect; + y = shadowInfo->orthoSize; + + farClamp = shadowInfo->farValue; + } + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_OFFSET, matShadowCamera.m, sizeof(matShadowCamera)); + + const auto matShadowView = matShadowCamera.getInversed(); + const auto projectionSinY = device->getCapabilities().clipSpaceSignY; + Mat4::createOrthographicOffCenter(-x, x, -y, y, shadowInfo->nearValue, farClamp, device->getCapabilities().clipSpaceMinZ, projectionSinY, &matShadowViewProj); + + matShadowViewProj.multiply(matShadowView); + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); + + float shadowNFLSInfos[4] = {shadowInfo->nearValue, farClamp, static_cast(shadowInfo->linear), static_cast(shadowInfo->selfShadow)}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET, &shadowNFLSInfos, sizeof(shadowNFLSInfos)); + + float shadowWHPBInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, static_cast(shadowInfo->pcfType), shadowInfo->bias}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET, &shadowWHPBInfos, sizeof(shadowWHPBInfos)); + } break; + case LightType::SPOT: { + const auto &matShadowCamera = light->getNode()->worldMatrix; + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_OFFSET, matShadowCamera.m, sizeof(matShadowCamera)); + + const auto matShadowView = matShadowCamera.getInversed(); + cc::Mat4::createPerspective(light->spotAngle, light->aspect, 0.001F, light->range, &matShadowViewProj); + + matShadowViewProj.multiply(matShadowView); + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); + + float shadowNFLSInfos[4] = {0.01F, light->range, static_cast(shadowInfo->linear), static_cast(shadowInfo->selfShadow)}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET, &shadowNFLSInfos, sizeof(shadowNFLSInfos)); + + float shadowWHPBInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, static_cast(shadowInfo->pcfType), shadowInfo->bias}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET, &shadowWHPBInfos, sizeof(shadowWHPBInfos)); + } break; + default: + break; + } + + float shadowLPNNInfos[4] = {0.0F, static_cast(shadowInfo->packing), shadowInfo->normalBias, 0.0F}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET, &shadowLPNNInfos, sizeof(shadowLPNNInfos)); + + const float color[4] = {shadowInfo->color.x, shadowInfo->color.y, shadowInfo->color.z, shadowInfo->color.w}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &color, sizeof(float) * 4); +} +static uint8_t _combineSignY = 0; +uint8_t PipelineUBO::getCombineSignY() { + return _combineSignY; +} + +void PipelineUBO::initCombineSignY() { + _combineSignY = static_cast(_device->getCapabilities().screenSpaceSignY * 0.5 + 0.5) << 1 | static_cast(_device->getCapabilities().clipSpaceSignY * 0.5 + 0.5); +} + +void PipelineUBO::activate(gfx::Device *device, RenderPipeline *pipeline) { + _device = device; + _pipeline = pipeline; + + const auto descriptorSet = pipeline->getDescriptorSet(); + initCombineSignY(); + auto globalUBO = _device->createBuffer({ + gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, + gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, + UBOGlobal::SIZE, + UBOGlobal::SIZE, + gfx::BufferFlagBit::NONE, + }); + descriptorSet->bindBuffer(UBOGlobal::BINDING, globalUBO); + _ubos.push_back(globalUBO); + + auto *cameraUBO = _device->createBuffer({ + gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, + gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, + UBOCamera::SIZE, + UBOCamera::SIZE, + gfx::BufferFlagBit::NONE, + }); + descriptorSet->bindBuffer(UBOCamera::BINDING, cameraUBO); + _ubos.push_back(cameraUBO); + + auto *shadowUBO = _device->createBuffer({ + gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, + gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, + UBOShadow::SIZE, + UBOShadow::SIZE, + gfx::BufferFlagBit::NONE, + }); + descriptorSet->bindBuffer(UBOShadow::BINDING, shadowUBO); + _ubos.push_back(shadowUBO); +} + +void PipelineUBO::destroy() { + for (auto &ubo : _ubos) { + CC_SAFE_DESTROY(ubo); + } + _ubos.clear(); +} + +void PipelineUBO::updateGlobalUBO() { + auto *const ds = _pipeline->getDescriptorSet(); + auto *const cmdBuffer = _pipeline->getCommandBuffers()[0]; + ds->update(); + PipelineUBO::updateGlobalUBOView(_pipeline, _globalUBO); + cmdBuffer->updateBuffer(ds->getBuffer(UBOGlobal::BINDING), _globalUBO.data(), UBOGlobal::SIZE); +} + +void PipelineUBO::updateCameraUBO(const Camera *camera, bool hasOffScreenAttachments) { + auto *const ds = _pipeline->getDescriptorSet(); + auto *const cmdBuffer = _pipeline->getCommandBuffers()[0]; + PipelineUBO::updateCameraUBOView(_pipeline, _cameraUBO, camera, hasOffScreenAttachments); + cmdBuffer->updateBuffer(ds->getBuffer(UBOCamera::BINDING), _cameraUBO.data(), UBOCamera::SIZE); +} + +void PipelineUBO::updateShadowUBO(const Camera *camera) { + auto *const ds = _pipeline->getDescriptorSet(); + auto *const cmdBuffer = _pipeline->getCommandBuffers()[0]; + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const shadowInfo = sceneData->getSharedData()->getShadows(); + const auto *const scene = camera->getScene(); + if (!shadowInfo->enabled) return; + const auto & shadowFrameBufferMap = sceneData->getShadowFramebufferMap(); + const Light *mainLight = nullptr; + if (scene->mainLightID) mainLight = scene->getMainLight(); + ds->update(); + if (mainLight && shadowInfo->getShadowType() == ShadowType::SHADOWMAP) { + if (shadowFrameBufferMap.count(mainLight) > 0) { + auto *texture = shadowFrameBufferMap.at(mainLight)->getColorTextures()[0]; + if (texture) { + ds->bindTexture(SHADOWMAP::BINDING, texture); + } + } + } + PipelineUBO::updateShadowUBOView(_pipeline, _shadowUBO, camera); + cmdBuffer->updateBuffer(ds->getBuffer(UBOShadow::BINDING), _shadowUBO.data(), UBOShadow::SIZE); +} + +void PipelineUBO::updateShadowUBOLight(const Light *light) { + auto *const ds = _pipeline->getDescriptorSet(); + updateShadowUBOLightView(_pipeline, _shadowUBO, light); + ds->getBuffer(UBOShadow::BINDING)->update(_shadowUBO.data(), UBOShadow::SIZE); +} + +void PipelineUBO::updateShadowUBORange(uint offset, const Mat4 *data) { + memcpy(_shadowUBO.data() + offset, data->m, sizeof(*data)); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/PipelineUBO.h b/native/cocos/renderer/pipeline/PipelineUBO.h new file mode 100644 index 0000000000..a3c0df6064 --- /dev/null +++ b/native/cocos/renderer/pipeline/PipelineUBO.h @@ -0,0 +1,74 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include +#include "helper/SharedMemory.h" +#include "Define.h" + +namespace cc { + +class Mat4; +class Color; + +namespace pipeline { + +class RenderPipeline; +class Device; + +class CC_DLL PipelineUBO : public Object { +public: + static void updateGlobalUBOView(const RenderPipeline *pipeline, std::array &bufferView); + static void updateCameraUBOView(const RenderPipeline *pipeline, std::array &bufferView, const Camera *camera, bool hasOffScreenAttachments); + static void updateShadowUBOView(const RenderPipeline *pipeline, std::array &bufferView, const Camera *camera); + static void updateShadowUBOLightView(const RenderPipeline *pipeline, std::array &bufferView, const Light *light); + static uint8_t getCombineSignY(); +public: + PipelineUBO() = default; + virtual ~PipelineUBO() = default; + void activate(gfx::Device *device, RenderPipeline *pipeline); + void destroy(); + void updateGlobalUBO(); + void updateCameraUBO(const Camera *camera, bool hasOffScreenAttachments); + void updateShadowUBO(const Camera *camera); + void updateShadowUBOLight(const Light *light); + void updateShadowUBORange(uint offset, const Mat4* data); + void destroyShadowFrameBuffers(); + +private: + RenderPipeline *_pipeline = nullptr; + gfx::Device *_device = nullptr; + + std::array _globalUBO; + std::array _cameraUBO; + std::array _shadowUBO; + + std::vector _ubos; + void initCombineSignY(); +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp b/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp index 70922f33f4..817fb15dae 100644 --- a/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp +++ b/native/cocos/renderer/pipeline/PlanarShadowQueue.cpp @@ -1,89 +1,91 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "PlanarShadowQueue.h" -#include "RenderPipeline.h" -#include "BatchedBuffer.h" #include "Define.h" #include "InstancedBuffer.h" #include "PipelineStateManager.h" -#include "RenderBatchedQueue.h" +#include "PlanarShadowQueue.h" #include "RenderInstancedQueue.h" -#include "gfx/GFXCommandBuffer.h" +#include "RenderPipeline.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXShader.h" #include "helper/SharedMemory.h" -#include "forward/ForwardPipeline.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXShader.h" namespace cc { namespace pipeline { PlanarShadowQueue::PlanarShadowQueue(RenderPipeline *pipeline) -:_pipeline(static_cast(pipeline)){ +: _pipeline(pipeline) { _instancedQueue = CC_NEW(RenderInstancedQueue); } -void PlanarShadowQueue::gatherShadowPasses(Camera *camera, gfx::CommandBuffer *cmdBufferer) { +void PlanarShadowQueue::gatherShadowPasses(Camera *camera, gfx::CommandBuffer *cmdBuffer) { clear(); - const auto *shadowInfo = _pipeline->getShadows(); - if (!shadowInfo->enabled || shadowInfo->getShadowType() != ShadowType::PLANAR) { return; } + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + const auto *shadowInfo = sharedData->getShadows(); + if (!shadowInfo->enabled || shadowInfo->getShadowType() != ShadowType::PLANAR) { + return; + } - _pipeline->updateShadowUBO(camera); + auto *const pipelineUBO = _pipeline->getPipelineUBO(); + pipelineUBO->updateShadowUBO(camera); + const auto *scene = camera->getScene(); + const bool shadowVisible = camera->visibility & static_cast(LayerList::DEFAULT); - const auto *scene = camera->getScene(); - const bool shadowVisible = camera->visibility & static_cast(LayerList::DEFAULT); + if (!scene->getMainLight() || !shadowVisible) { + return; + } - if (!scene->getMainLight() || !shadowVisible) { return; } - - const auto models = scene->getModels(); + const auto *models = scene->getModels(); const auto modelCount = models[0]; - auto *instancedBuffer = InstancedBuffer::get(shadowInfo->planarPass); + auto *instancedBuffer = InstancedBuffer::get(shadowInfo->instancePass); - uint visibility = 0, lenght = 0; for (uint i = 1; i <= modelCount; i++) { - const auto *model = scene->getModelView(models[i]); - const auto *node = model->getNode(); + const auto *model = cc::pipeline::Scene::getModelView(models[i]); + const auto *node = model->getNode(); if (model->enabled && model->castShadow) { - visibility = camera->visibility; + const auto visibility = camera->visibility; if ((model->nodeID && ((visibility & node->layer) == node->layer)) || (visibility & model->visFlags)) { - // frustum culling - if ((model->worldBoundsID) && !aabb_frustum(model->getWorldBounds(), camera->getFrustum())) { + if ((model->worldBoundsID) && !aabbFrustum(model->getWorldBounds(), camera->getFrustum())) { continue; } const auto *attributesID = model->getInstancedAttributeID(); - lenght = attributesID[0]; - if (lenght > 0) { - const auto *subModelID = model->getSubModelID(); - const auto subModelCount = subModelID[0]; + const auto length = attributesID[0]; + if (length > 0) { + const auto *subModelID = model->getSubModelID(); + const auto subModelCount = subModelID[0]; for (uint m = 1; m <= subModelCount; ++m) { - const auto *subModel = model->getSubModelView(subModelID[m]); - instancedBuffer->merge(model, subModel, m - 1); + const auto *subModel = cc::pipeline::ModelView::getSubModelView(subModelID[m]); + instancedBuffer->merge(model, subModel, m - 1, subModel->getPlanarInstanceShader()); _instancedQueue->add(instancedBuffer); } } else { @@ -93,7 +95,7 @@ void PlanarShadowQueue::gatherShadowPasses(Camera *camera, gfx::CommandBuffer *c } } - _instancedQueue->uploadBuffers(cmdBufferer); + _instancedQueue->uploadBuffers(cmdBuffer); } void PlanarShadowQueue::clear() { @@ -102,25 +104,33 @@ void PlanarShadowQueue::clear() { } void PlanarShadowQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer) { - const auto *shadowInfo = _pipeline->getShadows(); - if (!shadowInfo->enabled || shadowInfo->getShadowType() != ShadowType::PLANAR || _pendingModels.empty()) { return; } + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + const auto *shadowInfo = sharedData->getShadows(); + if (!shadowInfo->enabled || shadowInfo->getShadowType() != ShadowType::PLANAR) { + return; + } _instancedQueue->recordCommandBuffer(device, renderPass, cmdBuffer); - const auto *pass = shadowInfo->getPlanarShadowPass(); - cmdBuffer->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); + if (_pendingModels.empty()) { + return; + } - for (auto model : _pendingModels) { - const auto subModelID = model->getSubModelID(); - const auto subModelCount = subModelID[0]; + const auto *pass = shadowInfo->getPlanarShadowPass(); + cmdBuffer->bindDescriptorSet(materialSet, pass->getDescriptorSet()); + + for (const auto *model : _pendingModels) { + const auto *const subModelID = model->getSubModelID(); + const auto subModelCount = subModelID[0]; for (unsigned m = 1; m <= subModelCount; ++m) { - const auto subModel = model->getSubModelView(subModelID[m]); - const auto shader = subModel->getPlanarShader(); - const auto ia = subModel->getInputAssembler(); - const auto pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelID[m]); + auto *const shader = subModel->getPlanarShader(); + auto *const ia = subModel->getInputAssembler(); + auto *const pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); cmdBuffer->bindPipelineState(pso); - cmdBuffer->bindDescriptorSet(LOCAL_SET, subModel->getDescriptorSet()); + cmdBuffer->bindDescriptorSet(localSet, subModel->getDescriptorSet()); cmdBuffer->bindInputAssembler(ia); cmdBuffer->draw(ia); } @@ -130,5 +140,6 @@ void PlanarShadowQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass void PlanarShadowQueue::destroy() { CC_SAFE_DELETE(_instancedQueue); } -} + +} // namespace pipeline } // namespace cc diff --git a/native/cocos/renderer/pipeline/PlanarShadowQueue.h b/native/cocos/renderer/pipeline/PlanarShadowQueue.h index d5a039f2ce..cb360c089a 100644 --- a/native/cocos/renderer/pipeline/PlanarShadowQueue.h +++ b/native/cocos/renderer/pipeline/PlanarShadowQueue.h @@ -1,28 +1,30 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "core/CoreStd.h" +#include "base/CoreStd.h" namespace cc { namespace gfx { @@ -33,7 +35,6 @@ class Shader; } // namespace gfx namespace pipeline { class RenderPipeline; -class ForwardPipeline; struct ModelView; struct SubModelView; struct PassView; @@ -52,16 +53,16 @@ struct ShadowRenderData { class CC_DLL PlanarShadowQueue : public Object { public: - PlanarShadowQueue(RenderPipeline *); - ~PlanarShadowQueue() = default; + explicit PlanarShadowQueue(RenderPipeline *pipeline); + ~PlanarShadowQueue() override = default; void clear(); - void gatherShadowPasses(Camera *camera , gfx::CommandBuffer *cmdBufferer); + void gatherShadowPasses(Camera *camera , gfx::CommandBuffer *cmdBuffer); void recordCommandBuffer(gfx::Device *, gfx::RenderPass *, gfx::CommandBuffer *); void destroy(); - + private: - ForwardPipeline *_pipeline = nullptr; + RenderPipeline *_pipeline = nullptr; RenderInstancedQueue *_instancedQueue = nullptr; std::vector _pendingModels; }; diff --git a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp index 588d41427f..acafe0c1fc 100644 --- a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "BatchedBuffer.h" @@ -28,75 +30,64 @@ THE SOFTWARE. #include "PipelineStateManager.h" #include "RenderAdditiveLightQueue.h" -#include "Application.h" +#include "Define.h" #include "RenderBatchedQueue.h" #include "RenderInstancedQueue.h" +#include "SceneCulling.h" #include "forward/ForwardPipeline.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXTexture.h" #include "helper/SharedMemory.h" -#include "gfx/GFXSampler.h" -#include "gfx/GFXTexture.h" -#include "Define.h" -#include "forward/SceneCulling.h" namespace cc { namespace pipeline { -namespace { -#define TO_VEC3(dst, src, offset) \ - dst[offset] = src.x; \ - dst[offset + 1] = src.y; \ - dst[offset + 2] = src.z; -#define TO_VEC4(dst, src, offset) \ - dst[offset] = src.x; \ - dst[offset + 1] = src.y; \ - dst[offset + 2] = src.z; \ - dst[offset + 3] = src.w; -} // namespace -RenderAdditiveLightQueue::RenderAdditiveLightQueue(RenderPipeline *pipeline) : _pipeline(static_cast(pipeline)), +RenderAdditiveLightQueue::RenderAdditiveLightQueue(RenderPipeline *pipeline) : _pipeline(dynamic_cast(pipeline)), _instancedQueue(CC_NEW(RenderInstancedQueue)), _batchedQueue(CC_NEW(RenderBatchedQueue)) { - _renderObjects = _pipeline->getRenderObjects(); - _fpScale = _pipeline->getFpScale(); - _isHDR = _pipeline->isHDR(); - auto *device = gfx::Device::getInstance(); - const auto alignment = device->getUboOffsetAlignment(); - _lightBufferStride = ((UBOForwardLight::SIZE + alignment - 1) / alignment) * alignment; + auto * device = gfx::Device::getInstance(); + const auto alignment = device->getCapabilities().uboOffsetAlignment; + _lightBufferStride = ((UBOForwardLight::SIZE + alignment - 1) / alignment) * alignment; _lightBufferElementCount = _lightBufferStride / sizeof(float); - _lightBuffer = device->createBuffer({ + _lightBuffer = device->createBuffer({ gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, _lightBufferStride * _lightBufferCount, _lightBufferStride, }); - _firstLightBufferView = device->createBuffer({_lightBuffer, 0, UBOForwardLight::SIZE}); + _firstLightBufferView = device->createBuffer({_lightBuffer, 0, UBOForwardLight::SIZE}); _lightBufferData.resize(_lightBufferElementCount * _lightBufferCount); _dynamicOffsets.resize(1, 0); - gfx::SamplerInfo info{ + const gfx::SamplerInfo info{ gfx::Filter::LINEAR, gfx::Filter::LINEAR, gfx::Filter::NONE, gfx::Address::CLAMP, gfx::Address::CLAMP, gfx::Address::CLAMP, + {}, + {}, + {}, + {}, }; - const auto shadowMapSamplerHash = genSamplerHash(std::move(info)); - _sampler = getSampler(shadowMapSamplerHash); - + const auto shadowMapSamplerHash = SamplerLib::genSamplerHash(info); + _sampler = SamplerLib::getSampler(shadowMapSamplerHash); _phaseID = getPhaseID("forward-add"); - _globalUBO.fill(0.f); - _shadowUBO.fill(0.f); + _shadowUBO.fill(0.F); } RenderAdditiveLightQueue ::~RenderAdditiveLightQueue() { - CC_DELETE(_instancedQueue); - CC_DELETE(_batchedQueue); + CC_SAFE_DELETE(_instancedQueue); + CC_SAFE_DELETE(_batchedQueue); + CC_SAFE_DESTROY(_firstLightBufferView); + CC_SAFE_DESTROY(_lightBuffer); } void RenderAdditiveLightQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer) { @@ -104,31 +95,31 @@ void RenderAdditiveLightQueue::recordCommandBuffer(gfx::Device *device, gfx::Ren _batchedQueue->recordCommandBuffer(device, renderPass, cmdBuffer); for (const auto &lightPass : _lightPasses) { - const auto subModel = lightPass.subModel; - const auto pass = lightPass.pass; - const auto &dynamicOffsets = lightPass.dynamicOffsets; - auto *shader = lightPass.shader; - const auto lights = lightPass.lights; - auto *ia = subModel->getInputAssembler(); - auto *pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); - auto *descriptorSet = subModel->getDescriptorSet(); + const auto *const subModel = lightPass.subModel; + const auto *const pass = lightPass.pass; + const auto & dynamicOffsets = lightPass.dynamicOffsets; + auto * shader = lightPass.shader; + const auto lights = lightPass.lights; + auto * ia = subModel->getInputAssembler(); + auto * pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); + auto * descriptorSet = subModel->getDescriptorSet(); cmdBuffer->bindPipelineState(pso); - cmdBuffer->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); + cmdBuffer->bindDescriptorSet(materialSet, pass->getDescriptorSet()); cmdBuffer->bindInputAssembler(ia); for (size_t i = 0; i < dynamicOffsets.size(); ++i) { - const auto *light = lights[i]; - auto *globalDescriptorSet = getOrCreateDescriptorSet(light); - _dynamicOffsets[0] = dynamicOffsets[i]; - cmdBuffer->bindDescriptorSet(GLOBAL_SET, globalDescriptorSet); - cmdBuffer->bindDescriptorSet(LOCAL_SET, descriptorSet, _dynamicOffsets); + const auto *light = lights[i]; + auto * globalDescriptorSet = getOrCreateDescriptorSet(light); + _dynamicOffsets[0] = dynamicOffsets[i]; + cmdBuffer->bindDescriptorSet(globalSet, globalDescriptorSet); + cmdBuffer->bindDescriptorSet(localSet, descriptorSet, _dynamicOffsets); cmdBuffer->draw(ia); } } } -void RenderAdditiveLightQueue::gatherLightPasses(const Camera *camera, gfx::CommandBuffer *cmdBufferer) { +void RenderAdditiveLightQueue::gatherLightPasses(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { static vector lightPassIndices; clear(); @@ -137,51 +128,50 @@ void RenderAdditiveLightQueue::gatherLightPasses(const Camera *camera, gfx::Comm if (_validLights.empty()) return; - updateUBOs(camera, cmdBufferer); - updateLightDescriptorSet(camera, cmdBufferer); + updateUBOs(camera, cmdBuffer); + updateLightDescriptorSet(camera, cmdBuffer); - const auto &renderObjects = _pipeline->getRenderObjects(); + const auto &renderObjects = _pipeline->getPipelineSceneData()->getRenderObjects(); for (const auto &renderObject : renderObjects) { - const auto model = renderObject.model; - if (!getLightPassIndex(model, lightPassIndices)) continue; + const auto *const model = renderObject.model; + if (!getLightPassIndex(model, &lightPassIndices)) continue; _lightIndices.clear(); for (size_t i = 0; i < _validLights.size(); i++) { - const auto light = _validLights[i]; - const bool isCulled = cullingLight(light, model); + const auto *const light = _validLights[i]; + const bool isCulled = cullingLight(light, model); if (!isCulled) { _lightIndices.emplace_back(i); } } if (_lightIndices.empty()) continue; - const auto subModelArrayID = model->getSubModelID(); - const auto subModelCount = subModelArrayID[0]; + const auto *const subModelArrayID = model->getSubModelID(); + const auto subModelCount = subModelArrayID[0]; for (unsigned j = 1; j <= subModelCount; j++) { const auto lightPassIdx = lightPassIndices[j - 1]; if (lightPassIdx == UINT_MAX) continue; - const auto subModel = model->getSubModelView(subModelArrayID[j]); - const auto pass = subModel->getPassView(lightPassIdx); - auto descriptorSet = subModel->getDescriptorSet(); + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelArrayID[j]); + const auto *const pass = subModel->getPassView(lightPassIdx); + auto * descriptorSet = subModel->getDescriptorSet(); descriptorSet->bindBuffer(UBOForwardLight::BINDING, _firstLightBufferView); descriptorSet->update(); addRenderQueue(pass, subModel, model, lightPassIdx); } } - _instancedQueue->uploadBuffers(cmdBufferer); - _batchedQueue->uploadBuffers(cmdBufferer); + _instancedQueue->uploadBuffers(cmdBuffer); + _batchedQueue->uploadBuffers(cmdBuffer); } void RenderAdditiveLightQueue::destroy() { for (auto &pair : _descriptorSetMap) { auto *descriptorSet = pair.second; - descriptorSet->getBuffer(UBOGlobal::BINDING)->destroy(); descriptorSet->getBuffer(UBOShadow::BINDING)->destroy(); descriptorSet->getSampler(SHADOWMAP::BINDING)->destroy(); descriptorSet->getTexture(SHADOWMAP::BINDING)->destroy(); - descriptorSet->getSampler(SPOT_LIGHTING_MAP::BINDING)->destroy(); - descriptorSet->getTexture(SPOT_LIGHTING_MAP::BINDING)->destroy(); + descriptorSet->getSampler(SPOTLIGHTINGMAP::BINDING)->destroy(); + descriptorSet->getTexture(SPOTLIGHTINGMAP::BINDING)->destroy(); descriptorSet->destroy(); } _descriptorSetMap.clear(); @@ -199,13 +189,13 @@ void RenderAdditiveLightQueue::clear() { _lightPasses.clear(); } -void RenderAdditiveLightQueue::gatherValidLights(const Camera* camera) { - const auto scene = camera->getScene(); - const auto sphereLightArrayID = scene->getSphereLightArrayID(); - auto count = sphereLightArrayID ? sphereLightArrayID[0] : 0; - Sphere sphere; +void RenderAdditiveLightQueue::gatherValidLights(const Camera *camera) { + const auto *const scene = camera->getScene(); + const auto *const sphereLightArrayID = scene->getSphereLightArrayID(); + auto count = sphereLightArrayID ? sphereLightArrayID[0] : 0; + Sphere sphere; for (unsigned i = 1; i <= count; i++) { - const auto light = scene->getSphereLight(sphereLightArrayID[i]); + const auto *const light = cc::pipeline::Scene::getSphereLight(sphereLightArrayID[i]); sphere.setCenter(light->position); sphere.setRadius(light->range); if (sphere_frustum(&sphere, camera->getFrustum())) { @@ -213,10 +203,10 @@ void RenderAdditiveLightQueue::gatherValidLights(const Camera* camera) { getOrCreateDescriptorSet(light); } } - const auto spotLightArrayID = scene->getSpotLightArrayID(); - count = spotLightArrayID ? spotLightArrayID[0] : 0; + const auto *const spotLightArrayID = scene->getSpotLightArrayID(); + count = spotLightArrayID ? spotLightArrayID[0] : 0; for (unsigned i = 1; i <= count; i++) { - const auto light = scene->getSpotLight(spotLightArrayID[i]); + const auto *const light = cc::pipeline::Scene::getSpotLight(spotLightArrayID[i]); sphere.setCenter(light->position); sphere.setRadius(light->range); if (sphere_frustum(&sphere, camera->getFrustum())) { @@ -229,9 +219,9 @@ void RenderAdditiveLightQueue::gatherValidLights(const Camera* camera) { bool RenderAdditiveLightQueue::cullingLight(const Light *light, const ModelView *model) { switch (light->getType()) { case LightType::SPHERE: - return model->worldBoundsID && !aabb_aabb(model->getWorldBounds(), light->getAABB()); + return model->worldBoundsID && !aabbAabb(model->getWorldBounds(), light->getAABB()); case LightType::SPOT: - return model->worldBoundsID && (!aabb_aabb(model->getWorldBounds(), light->getAABB()) || !aabb_frustum(model->getWorldBounds(), light->getFrustum())); + return model->worldBoundsID && (!aabbAabb(model->getWorldBounds(), light->getAABB()) || !aabbFrustum(model->getWorldBounds(), light->getFrustum())); default: return false; } } @@ -240,24 +230,24 @@ void RenderAdditiveLightQueue::addRenderQueue(const PassView *pass, const SubMod const auto batchingScheme = pass->getBatchingScheme(); if (batchingScheme == BatchingSchemes::INSTANCING) { // instancing for (auto idx : _lightIndices) { - auto buffer = InstancedBuffer::get(subModel->passID[lightPassIdx], idx); + auto *buffer = InstancedBuffer::get(subModel->passID[lightPassIdx], idx); buffer->merge(model, subModel, lightPassIdx); buffer->setDynamicOffset(0, _lightBufferStride * idx); _instancedQueue->add(buffer); } } else if (batchingScheme == BatchingSchemes::VB_MERGING) { // vb-merging for (auto idx : _lightIndices) { - auto buffer = BatchedBuffer::get(subModel->passID[lightPassIdx], idx); + auto *buffer = BatchedBuffer::get(subModel->passID[lightPassIdx], idx); buffer->merge(subModel, lightPassIdx, model); buffer->setDynamicOffset(0, _lightBufferStride * idx); _batchedQueue->add(buffer); } } else { // standard draw - const auto count = _lightIndices.size(); + const auto count = _lightIndices.size(); AdditiveLightPass lightPass; lightPass.subModel = subModel; - lightPass.pass = pass; - lightPass.shader = subModel->getShader(lightPassIdx); + lightPass.pass = pass; + lightPass.shader = subModel->getShader(lightPassIdx); lightPass.dynamicOffsets.resize(count); for (unsigned idx = 0; idx < count; idx++) { const auto lightIdx = _lightIndices[idx]; @@ -270,33 +260,35 @@ void RenderAdditiveLightQueue::addRenderQueue(const PassView *pass, const SubMod } void RenderAdditiveLightQueue::updateUBOs(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { - const auto exposure = camera->exposure; - const auto validLightCount = _validLights.size(); + const auto exposure = camera->exposure; + const auto validLightCount = _validLights.size(); + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); if (validLightCount > _lightBufferCount) { _firstLightBufferView->destroy(); - _lightBufferCount = nextPow2(validLightCount); + _lightBufferCount = nextPow2(static_cast(validLightCount)); _lightBuffer->resize(_lightBufferStride * _lightBufferCount); _lightBufferData.resize(_lightBufferElementCount * _lightBufferCount); _firstLightBufferView->initialize({_lightBuffer, 0, UBOForwardLight::SIZE}); } for (unsigned l = 0, offset = 0; l < validLightCount; l++, offset += _lightBufferElementCount) { - const auto light = _validLights[l]; + const auto *const light = _validLights[l]; - auto index = offset + UBOForwardLight::LIGHT_POS_OFFSET; + auto index = offset + UBOForwardLight::LIGHT_POS_OFFSET; _lightBufferData[index++] = light->position.x; _lightBufferData[index++] = light->position.y; - _lightBufferData[index] = light->position.z; + _lightBufferData[index] = light->position.z; - index = offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET; + index = offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET; _lightBufferData[index++] = light->size; - _lightBufferData[index] = light->range; + _lightBufferData[index] = light->range; - index = offset + UBOForwardLight::LIGHT_COLOR_OFFSET; + index = offset + UBOForwardLight::LIGHT_COLOR_OFFSET; const auto &color = light->color; if (light->useColorTemperature) { - const auto &tempRGB = light->colorTemperatureRGB; + const auto &tempRGB = light->colorTemperatureRGB; _lightBufferData[index++] = color.x * tempRGB.x; _lightBufferData[index++] = color.y * tempRGB.y; _lightBufferData[index++] = color.z * tempRGB.z; @@ -305,53 +297,54 @@ void RenderAdditiveLightQueue::updateUBOs(const Camera *camera, gfx::CommandBuff _lightBufferData[index++] = color.y; _lightBufferData[index++] = color.z; } - if (_isHDR) { - _lightBufferData[index] = light->luminance * _fpScale * _lightMeterScale; + if (sharedData->isHDR) { + _lightBufferData[index] = light->luminance * sharedData->fpScale * _lightMeterScale; } else { _lightBufferData[index] = light->luminance * exposure * _lightMeterScale; } switch (light->getType()) { case LightType::SPHERE: - _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 0; + _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 0; _lightBufferData[offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = 0; break; case LightType::SPOT: - _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 1.0f; + _lightBufferData[offset + UBOForwardLight::LIGHT_POS_OFFSET + 3] = 1.0F; _lightBufferData[offset + UBOForwardLight::LIGHT_SIZE_RANGE_ANGLE_OFFSET + 2] = light->spotAngle; - index = offset + UBOForwardLight::LIGHT_DIR_OFFSET; + index = offset + UBOForwardLight::LIGHT_DIR_OFFSET; _lightBufferData[index++] = light->direction.x; _lightBufferData[index++] = light->direction.y; - _lightBufferData[index] = light->direction.z; + _lightBufferData[index] = light->direction.z; break; default: break; } } - cmdBuffer->updateBuffer(_lightBuffer, _lightBufferData.data(), _lightBufferData.size() * sizeof(float)); + cmdBuffer->updateBuffer(_lightBuffer, _lightBufferData.data(), static_cast(_lightBufferData.size() * sizeof(float))); } void RenderAdditiveLightQueue::updateLightDescriptorSet(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { - auto *shadowInfo = _pipeline->getShadows(); - const auto scene = camera->getScene(); - const Light *mainLight = nullptr; + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto * shadowInfo = sceneData->getSharedData()->getShadows(); + const auto *const scene = camera->getScene(); + const Light * mainLight = nullptr; if (scene->mainLightID) mainLight = scene->getMainLight(); for (const auto *light : _validLights) { auto *descriptorSet = getOrCreateDescriptorSet(light); - if (!descriptorSet) { return; } + if (!descriptorSet) { + return; + } descriptorSet->bindSampler(SHADOWMAP::BINDING, _sampler); - descriptorSet->bindSampler(SPOT_LIGHTING_MAP::BINDING, _sampler); + descriptorSet->bindSampler(SPOTLIGHTINGMAP::BINDING, _sampler); // Main light sampler binding descriptorSet->bindTexture(SHADOWMAP::BINDING, _pipeline->getDefaultTexture()); descriptorSet->update(); - _globalUBO.fill(0.0f); - _shadowUBO.fill(0.0f); - updateGlobalDescriptorSet(camera, cmdBuffer); + _shadowUBO.fill(0.0F); switch (light->getType()) { case LightType::SPOT: { @@ -361,25 +354,28 @@ void RenderAdditiveLightQueue::updateLightDescriptorSet(const Camera *camera, gf } const auto &matShadowCamera = light->getNode()->worldMatrix; + memcpy(_shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_OFFSET, matShadowCamera.m, sizeof(matShadowCamera)); const auto matShadowView = matShadowCamera.getInversed(); cc::Mat4 matShadowViewProj; - cc::Mat4::createPerspective(light->spotAngle, light->aspect, 0.001f, light->range, &matShadowViewProj); + cc::Mat4::createPerspective(light->spotAngle, light->aspect, 0.001F, light->range, &matShadowViewProj); matShadowViewProj.multiply(matShadowView); // shadow info - float shadowInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, (float)shadowInfo->pcfType, shadowInfo->bias}; - memcpy(_shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); - memcpy(_shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &shadowInfo->color, sizeof(Vec4)); - memcpy(_shadowUBO.data() + UBOShadow::SHADOW_INFO_OFFSET, &shadowInfos, sizeof(shadowInfos)); + float shadowNFLSInfos[4] = {shadowInfo->nearValue, shadowInfo->farValue, static_cast(shadowInfo->linear), static_cast(shadowInfo->selfShadow)}; + memcpy(_shadowUBO.data() + UBOShadow::SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET, &shadowNFLSInfos, sizeof(shadowNFLSInfos)); + + float shadowWHPBInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, static_cast(shadowInfo->pcfType), shadowInfo->bias}; + memcpy(_shadowUBO.data() + UBOShadow::SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET, &shadowWHPBInfos, sizeof(shadowWHPBInfos)); + // Spot light sampler binding - const auto &shadowFramebufferMap = _pipeline->getShadowFramebufferMap(); + const auto &shadowFramebufferMap = sceneData->getShadowFramebufferMap(); if (shadowFramebufferMap.count(light) > 0) { auto *texture = shadowFramebufferMap.at(light)->getColorTextures()[0]; if (texture) { - descriptorSet->bindTexture(SPOT_LIGHTING_MAP::BINDING, texture); + descriptorSet->bindTexture(SPOTLIGHTINGMAP::BINDING, texture); } } } break; @@ -389,152 +385,46 @@ void RenderAdditiveLightQueue::updateLightDescriptorSet(const Camera *camera, gf updateDirLight(shadowInfo, mainLight, _shadowUBO); } // Reserve sphere light shadow interface + float shadowNFLSInfos[4] = {0.01F, light->range, static_cast(shadowInfo->linear), static_cast(shadowInfo->selfShadow)}; + memcpy(_shadowUBO.data() + UBOShadow::SHADOW_NEAR_FAR_LINEAR_SELF_INFO_OFFSET, &shadowNFLSInfos, sizeof(shadowNFLSInfos)); + + float shadowWHPBInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, static_cast(shadowInfo->pcfType), shadowInfo->bias}; + memcpy(_shadowUBO.data() + UBOShadow::SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET, &shadowWHPBInfos, sizeof(shadowWHPBInfos)); } break; - default:; + default: + break; } + + const float shadowLPNNInfos[4] = {0.0F, static_cast(shadowInfo->packing), shadowInfo->normalBias, 0.0F}; + memcpy(_shadowUBO.data() + UBOShadow::SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET, &shadowLPNNInfos, sizeof(shadowLPNNInfos)); + + const float color[4] = {shadowInfo->color.x, shadowInfo->color.y, shadowInfo->color.z, shadowInfo->color.w}; + memcpy(_shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &color, sizeof(float) * 4); + descriptorSet->update(); cmdBuffer->updateBuffer(descriptorSet->getBuffer(UBOShadow::BINDING), _shadowUBO.data(), UBOShadow::SIZE); - cmdBuffer->updateBuffer(descriptorSet->getBuffer(UBOGlobal::BINDING), _globalUBO.data(), UBOGlobal::SIZE); - cmdBuffer->updateBuffer(descriptorSet->getBuffer(UBOCamera::BINDING), _cameraUBO.data(), UBOCamera::SIZE); } } -void RenderAdditiveLightQueue::updateGlobalDescriptorSet(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { - const auto root = GET_ROOT(); - const auto scene = camera->getScene(); - - const auto shadingScale = _pipeline->getShadingScale(); - auto &uboGlobalView = _globalUBO; - auto *device = gfx::Device::getInstance(); - - const auto shadingWidth = std::floor(device->getWidth()); - const auto shadingHeight = std::floor(device->getHeight()); - - // update UBOGlobal - uboGlobalView[UBOGlobal::TIME_OFFSET] = root->cumulativeTime; - uboGlobalView[UBOGlobal::TIME_OFFSET + 1] = root->frameTime; - uboGlobalView[UBOGlobal::TIME_OFFSET + 2] = Application::getInstance()->getTotalFrames(); - - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET] = device->getWidth(); - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 1] = device->getHeight(); - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 2] = 1.0f / uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET]; - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 3] = 1.0f / uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 1]; - - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET] = shadingWidth; - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 1] = shadingHeight; - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 2] = 1.0f / uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET]; - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 3] = 1.0f / uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 1]; - - // update camera ubo - updateCameraUBO(camera, cmdBuffer); -} - -void RenderAdditiveLightQueue::updateCameraUBO(const Camera *camera, gfx::CommandBuffer *cmdBuffer) { - const auto scene = camera->getScene(); - - const Light *mainLight = nullptr; - if (scene->mainLightID) mainLight = scene->getMainLight(); - - const auto ambient = _pipeline->getAmbient(); - const auto fog = _pipeline->getFog(); - const auto shadingScale = _pipeline->getShadingScale(); - auto &uboCameraView = _cameraUBO; - auto *device = gfx::Device::getInstance(); - - const auto shadingWidth = std::floor(device->getWidth()); - const auto shadingHeight = std::floor(device->getHeight()); - - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET] = camera->width / shadingWidth * shadingScale; - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 1] = camera->height / shadingHeight * shadingScale; - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 2] = 1.0 / uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET]; - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 3] = 1.0 / uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 1]; - - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_OFFSET, camera->matView.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_INV_OFFSET, camera->getNode()->worldMatrix.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_OFFSET, camera->matProj.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_INV_OFFSET, camera->matProjInv.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_OFFSET, camera->matViewProj.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_INV_OFFSET, camera->matViewProjInv.m, sizeof(cc::Mat4)); - TO_VEC3(uboCameraView, camera->position, UBOCamera::CAMERA_POS_OFFSET); - - auto projectionSignY = device->getScreenSpaceSignY(); - if (camera->getWindow()->hasOffScreenAttachments) { - projectionSignY *= device->getUVSpaceSignY(); // need flipping if drawing on render targets - } - uboCameraView[UBOCamera::CAMERA_POS_OFFSET + 3] = projectionSignY; - - const auto exposure = camera->exposure; - uboCameraView[UBOCamera::EXPOSURE_OFFSET] = exposure; - uboCameraView[UBOCamera::EXPOSURE_OFFSET + 1] = 1.0f / exposure; - uboCameraView[UBOCamera::EXPOSURE_OFFSET + 2] = _isHDR ? 1.0f : 0.0; - uboCameraView[UBOCamera::EXPOSURE_OFFSET + 3] = _fpScale / exposure; - - if (mainLight) { - TO_VEC3(uboCameraView, mainLight->direction, UBOCamera::MAIN_LIT_DIR_OFFSET); - TO_VEC3(uboCameraView, mainLight->color, UBOCamera::MAIN_LIT_COLOR_OFFSET); - if (mainLight->useColorTemperature) { - const auto colorTempRGB = mainLight->colorTemperatureRGB; - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET] *= colorTempRGB.x; - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 1] *= colorTempRGB.y; - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 2] *= colorTempRGB.z; - } - - if (_isHDR) { - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 3] = mainLight->luminance * _fpScale; - } else { - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 3] = mainLight->luminance * exposure; - } - } else { - TO_VEC3(uboCameraView, Vec3::UNIT_Z, UBOCamera::MAIN_LIT_DIR_OFFSET); - TO_VEC4(uboCameraView, Vec4::ZERO, UBOCamera::MAIN_LIT_COLOR_OFFSET); - } - - Vec4 skyColor = ambient->skyColor; - if (_isHDR) { - skyColor.w = ambient->skyIllum * _fpScale; - } else { - skyColor.w = ambient->skyIllum * exposure; - } - TO_VEC4(uboCameraView, skyColor, UBOCamera::AMBIENT_SKY_OFFSET); - - uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET] = ambient->groundAlbedo.x; - uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 1] = ambient->groundAlbedo.y; - uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 2] = ambient->groundAlbedo.z; - const auto *envmap = _pipeline->getDescriptorSet()->getTexture((uint)PipelineGlobalBindings::SAMPLER_ENVIRONMENT); - if (envmap) uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 3] = envmap->getLevelCount(); - - if (fog->enabled) { - TO_VEC4(uboCameraView, fog->fogColor, UBOCamera::GLOBAL_FOG_COLOR_OFFSET); - - uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET] = fog->fogStart; - uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 1] = fog->fogEnd; - uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 2] = fog->fogDensity; - - uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET] = fog->fogTop; - uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 1] = fog->fogRange; - uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 2] = fog->fogAtten; - } -} - -bool RenderAdditiveLightQueue::getLightPassIndex(const ModelView *model, vector &lightPassIndices) const { - lightPassIndices.clear(); +bool RenderAdditiveLightQueue::getLightPassIndex(const ModelView *model, vector *lightPassIndices) const { + lightPassIndices->clear(); bool hasValidLightPass = false; - const auto subModelArrayID = model->getSubModelID(); - const auto count = subModelArrayID[0]; + const auto *const subModelArrayID = model->getSubModelID(); + const auto count = subModelArrayID[0]; for (unsigned i = 1; i <= count; i++) { - const auto subModel = model->getSubModelView(subModelArrayID[i]); - uint lightPassIndex = UINT_MAX; + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelArrayID[i]); + uint lightPassIndex = UINT_MAX; for (unsigned passIdx = 0; passIdx < subModel->passCount; passIdx++) { - const auto pass = subModel->getPassView(passIdx); + const auto *const pass = subModel->getPassView(passIdx); if (pass->phase == _phaseID) { - lightPassIndex = passIdx; + lightPassIndex = passIdx; hasValidLightPass = true; break; } } - lightPassIndices.push_back(lightPassIndex); + lightPassIndices->push_back(lightPassIndex); } return hasValidLightPass; @@ -542,28 +432,14 @@ bool RenderAdditiveLightQueue::getLightPassIndex(const ModelView *model, vector< gfx::DescriptorSet *RenderAdditiveLightQueue::getOrCreateDescriptorSet(const Light *light) { if (!_descriptorSetMap.count(light)) { - auto *device = gfx::Device::getInstance(); + auto * device = gfx::Device::getInstance(); gfx::DescriptorSet *descriptorSet = device->createDescriptorSet({_pipeline->getDescriptorSetLayout()}); - auto globalUBO = device->createBuffer({ - gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, - gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, - UBOGlobal::SIZE, - UBOGlobal::SIZE, - gfx::BufferFlagBit::NONE, - }); - descriptorSet->bindBuffer(UBOGlobal::BINDING, globalUBO); - - auto cameraUBO = device->createBuffer({ - gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, - gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, - UBOCamera::SIZE, - UBOCamera::SIZE, - gfx::BufferFlagBit::NONE, - }); - descriptorSet->bindBuffer(UBOCamera::BINDING, cameraUBO); + descriptorSet->bindBuffer(UBOGlobal::BINDING, _pipeline->getDescriptorSet()->getBuffer(UBOGlobal::BINDING)); - auto shadowUBO = device->createBuffer({ + descriptorSet->bindBuffer(UBOCamera::BINDING, _pipeline->getDescriptorSet()->getBuffer(UBOCamera::BINDING)); + + auto *shadowUBO = device->createBuffer({ gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, UBOShadow::SIZE, @@ -576,8 +452,8 @@ gfx::DescriptorSet *RenderAdditiveLightQueue::getOrCreateDescriptorSet(const Lig descriptorSet->bindSampler(SHADOWMAP::BINDING, _sampler); descriptorSet->bindTexture(SHADOWMAP::BINDING, _pipeline->getDefaultTexture()); // Spot light sampler binding - descriptorSet->bindSampler(SPOT_LIGHTING_MAP::BINDING, _sampler); - descriptorSet->bindTexture(SPOT_LIGHTING_MAP::BINDING, _pipeline->getDefaultTexture()); + descriptorSet->bindSampler(SPOTLIGHTINGMAP::BINDING, _sampler); + descriptorSet->bindTexture(SPOTLIGHTINGMAP::BINDING, _pipeline->getDefaultTexture()); descriptorSet->update(); diff --git a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h index aca8a0f0c0..1f7141ab46 100644 --- a/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h +++ b/native/cocos/renderer/pipeline/RenderAdditiveLightQueue.h @@ -1,29 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "core/CoreStd.h" +#include "Define.h" +#include "base/CoreStd.h" #include "helper/SharedMemory.h" namespace cc { @@ -32,73 +35,63 @@ struct SubModelView; struct Light; struct RenderObject; struct PassView; +struct Sphere; class RenderPipeline; class DefineMap; class RenderInstancedQueue; class RenderBatchedQueue; -class Device; -struct Sphere; -class Shader; class ForwardPipeline; -class DescriptorSet; struct AdditiveLightPass { - const SubModelView *subModel = nullptr; - const PassView *pass = nullptr; - gfx::Shader *shader = nullptr; - vector dynamicOffsets; + const SubModelView * subModel = nullptr; + const PassView * pass = nullptr; + gfx::Shader * shader = nullptr; + vector dynamicOffsets; vector lights; }; class RenderAdditiveLightQueue : public Object { public: - RenderAdditiveLightQueue(RenderPipeline *pipeline); - ~RenderAdditiveLightQueue(); + explicit RenderAdditiveLightQueue(RenderPipeline *pipeline); + ~RenderAdditiveLightQueue() override; void recordCommandBuffer(gfx::Device *device, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer); void gatherLightPasses(const Camera *camera, gfx::CommandBuffer *cmdBuffer); void destroy(); private: - void clear(); - void gatherValidLights(const Camera *camera); - bool cullingLight(const Light *light, const ModelView *model); - void addRenderQueue(const PassView *pass, const SubModelView *subModel, const ModelView *model, uint lightPassIdx); - void updateUBOs(const Camera *camera, gfx::CommandBuffer *cmdBuffer); - void updateCameraUBO(const Camera *camera, gfx::CommandBuffer *cmdBuffer); - void updateLightDescriptorSet(const Camera *camera, gfx::CommandBuffer *cmdBuffer); - void updateGlobalDescriptorSet(const Camera *camera, gfx::CommandBuffer *cmdBuffer); - bool getLightPassIndex(const ModelView *model, vector &lightPassIndices) const; - gfx::DescriptorSet *getOrCreateDescriptorSet(const Light *); + static bool cullingLight(const Light *light, const ModelView *model); -private: - ForwardPipeline *_pipeline = nullptr; + void clear(); + void gatherValidLights(const Camera *camera); + void addRenderQueue(const PassView *pass, const SubModelView *subModel, const ModelView *model, uint lightPassIdx); + void updateUBOs(const Camera *camera, gfx::CommandBuffer *cmdBuffer); + void updateLightDescriptorSet(const Camera *camera, gfx::CommandBuffer *cmdBuffer); + bool getLightPassIndex(const ModelView *model, vector *lightPassIndices) const; + gfx::DescriptorSet *getOrCreateDescriptorSet(const Light *light); + + ForwardPipeline * _pipeline = nullptr; vector> _sortedSubModelsArray; - vector> _sortedPSOCIArray; - vector _validLights; - vector _lightIndices; - vector _lightPasses; - vector _renderObjects; - vector _dynamicOffsets; - vector _lightBufferData; - RenderInstancedQueue *_instancedQueue = nullptr; - RenderBatchedQueue *_batchedQueue = nullptr; - gfx::Buffer *_lightBuffer = nullptr; - gfx::Buffer *_firstLightBufferView = nullptr; - gfx::Sampler *_sampler = nullptr; + vector> _sortedPSOCIArray; + vector _validLights; + vector _lightIndices; + vector _lightPasses; + vector _dynamicOffsets; + vector _lightBufferData; + RenderInstancedQueue * _instancedQueue = nullptr; + RenderBatchedQueue * _batchedQueue = nullptr; + gfx::Buffer * _lightBuffer = nullptr; + gfx::Buffer * _firstLightBufferView = nullptr; + gfx::Sampler * _sampler = nullptr; - std::unordered_map _descriptorSetMap; - std::array _globalUBO; - std::array _cameraUBO; - std::array _shadowUBO; + std::unordered_map _descriptorSetMap{}; + std::array _shadowUBO{}; - float _fpScale = 0; - bool _isHDR = false; - uint _lightBufferStride = 0; - uint _lightBufferElementCount = 0; - uint _lightBufferCount = 16; - float _lightMeterScale = 10000.0f; - uint _phaseID = 0; + uint _lightBufferStride = 0; + uint _lightBufferElementCount = 0; + uint _lightBufferCount = 16; + float _lightMeterScale = 10000.0F; + uint _phaseID = 0; }; } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp b/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp index e38dec2c98..d1a1a1693f 100644 --- a/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderBatchedQueue.cpp @@ -1,51 +1,54 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "RenderBatchedQueue.h" #include "BatchedBuffer.h" #include "PipelineStateManager.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXRenderPass.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { void RenderBatchedQueue::clear() { - for (auto it : _queues) { + for (auto *it : _queues) { it->clear(); } _queues.clear(); } void RenderBatchedQueue::uploadBuffers(gfx::CommandBuffer *cmdBuffer) { - for (auto batchedBuffer : _queues) { - auto &batches = batchedBuffer->getBatches(); - for (auto &batch : batches) { + for (auto *batchedBuffer : _queues) { + const auto &batches = batchedBuffer->getBatches(); + for (const auto &batch : batches) { if (!batch.mergeCount) continue; - auto i = 0u; - for (auto vb : batch.vbs) { + auto i = 0U; + for (auto *vb : batch.vbs) { cmdBuffer->updateBuffer(vb, batch.vbDatas[i++], vb->getSize()); } cmdBuffer->updateBuffer(batch.indexBuffer, batch.indexData, batch.indexBuffer->getSize()); @@ -54,20 +57,20 @@ void RenderBatchedQueue::uploadBuffers(gfx::CommandBuffer *cmdBuffer) { } } -void RenderBatchedQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer) { - for (auto batchedBuffer : _queues) { +void RenderBatchedQueue::recordCommandBuffer(gfx::Device * /*device*/, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer) { + for (auto *batchedBuffer : _queues) { bool boundPSO = false; const auto &batches = batchedBuffer->getBatches(); for (const auto &batch : batches) { if (!batch.mergeCount) continue; if (!boundPSO) { - auto pso = PipelineStateManager::getOrCreatePipelineState(batch.pass, batch.shader, batch.ia, renderPass); + auto *pso = PipelineStateManager::getOrCreatePipelineState(batch.pass, batch.shader, batch.ia, renderPass); cmdBuffer->bindPipelineState(pso); - cmdBuffer->bindDescriptorSet(MATERIAL_SET, batch.pass->getDescriptorSet()); + cmdBuffer->bindDescriptorSet(materialSet, batch.pass->getDescriptorSet()); boundPSO = true; } - cmdBuffer->bindDescriptorSet(LOCAL_SET, batch.descriptorSet, batchedBuffer->getDynamicOffset()); + cmdBuffer->bindDescriptorSet(localSet, batch.descriptorSet, batchedBuffer->getDynamicOffset()); cmdBuffer->bindInputAssembler(batch.ia); cmdBuffer->draw(batch.ia); } diff --git a/native/cocos/renderer/pipeline/RenderBatchedQueue.h b/native/cocos/renderer/pipeline/RenderBatchedQueue.h index fef431240d..a46128093c 100644 --- a/native/cocos/renderer/pipeline/RenderBatchedQueue.h +++ b/native/cocos/renderer/pipeline/RenderBatchedQueue.h @@ -1,29 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "core/CoreStd.h" +#include "gfx-base/GFXDef.h" +#include "base/Object.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/RenderFlow.cpp b/native/cocos/renderer/pipeline/RenderFlow.cpp index cacd521070..11c83e03df 100644 --- a/native/cocos/renderer/pipeline/RenderFlow.cpp +++ b/native/cocos/renderer/pipeline/RenderFlow.cpp @@ -1,40 +1,41 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "RenderFlow.h" #include "RenderStage.h" namespace cc { namespace pipeline { -RenderFlow::~RenderFlow() { -} +RenderFlow::~RenderFlow() = default; bool RenderFlow::initialize(const RenderFlowInfo &info) { - _name = info.name; + _name = info.name; _priority = info.priority; - _tag = info.tag; - _stages = info.stages; + _tag = info.tag; + _stages = info.stages; return true; } @@ -45,18 +46,21 @@ void RenderFlow::activate(RenderPipeline *pipeline) { return s1->getPriority() - s2->getPriority(); }); - for (const auto stage : _stages) + for (auto *const stage : _stages) { stage->activate(pipeline, this); + } } void RenderFlow::render(Camera *camera) { - for (const auto stage : _stages) + for (auto *const stage : _stages) { stage->render(camera); + } } void RenderFlow::destroy() { - for (const auto stage : _stages) + for (auto *const stage : _stages) { stage->destroy(); + } _stages.clear(); } diff --git a/native/cocos/renderer/pipeline/RenderFlow.h b/native/cocos/renderer/pipeline/RenderFlow.h index 742a7f42ce..ffb169d9b8 100644 --- a/native/cocos/renderer/pipeline/RenderFlow.h +++ b/native/cocos/renderer/pipeline/RenderFlow.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "Define.h" @@ -42,16 +44,16 @@ struct CC_DLL RenderFlowInfo { class CC_DLL RenderFlow : public Object { public: RenderFlow() = default; - virtual ~RenderFlow(); + ~RenderFlow() override; virtual bool initialize(const RenderFlowInfo &info); virtual void activate(RenderPipeline *pipeline); virtual void render(Camera *camera); virtual void destroy(); - CC_INLINE const String &getName() const { return _name; } - CC_INLINE uint getPriority() const { return _priority; } - CC_INLINE uint getTag() const { return _tag; } + inline const String &getName() const { return _name; } + inline uint getPriority() const { return _priority; } + inline uint getTag() const { return _tag; } protected: RenderStageList _stages; diff --git a/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp b/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp index feaef93645..4697a4a9b9 100644 --- a/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderInstancedQueue.cpp @@ -1,69 +1,70 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "RenderInstancedQueue.h" #include "InstancedBuffer.h" #include "PipelineStateManager.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { void RenderInstancedQueue::clear() { - for (auto it : _queues) { + for (auto *it : _queues) { it->clear(); } _queues.clear(); } void RenderInstancedQueue::uploadBuffers(gfx::CommandBuffer *cmdBuffer) { - for (auto instanceBuffer : _queues) { + for (auto *instanceBuffer : _queues) { if (instanceBuffer->hasPendingModels()) { instanceBuffer->uploadBuffers(cmdBuffer); } } } -void RenderInstancedQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer) { - for (auto instanceBuffer : _queues) { +void RenderInstancedQueue::recordCommandBuffer(gfx::Device * /*device*/, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuffer) { + for (auto *instanceBuffer : _queues) { if (!instanceBuffer->hasPendingModels()) continue; const auto &instances = instanceBuffer->getInstances(); - const auto pass = instanceBuffer->getPass(); - cmdBuffer->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); + const auto *pass = instanceBuffer->getPass(); + cmdBuffer->bindDescriptorSet(materialSet, pass->getDescriptorSet()); gfx::PipelineState *lastPSO = nullptr; - for (size_t b = 0; b < instances.size(); ++b) { - const auto &instance = instances[b]; + for (const auto& instance : instances) { if (!instance.count) { continue; } - auto pso = PipelineStateManager::getOrCreatePipelineState(pass, instance.shader, instance.ia, renderPass); + auto *pso = PipelineStateManager::getOrCreatePipelineState(pass, instance.shader, instance.ia, renderPass); if (lastPSO != pso) { cmdBuffer->bindPipelineState(pso); lastPSO = pso; } - cmdBuffer->bindDescriptorSet(LOCAL_SET, instance.descriptorSet, instanceBuffer->dynamicOffsets()); + cmdBuffer->bindDescriptorSet(localSet, instance.descriptorSet, instanceBuffer->dynamicOffsets()); cmdBuffer->bindInputAssembler(instance.ia); cmdBuffer->draw(instance.ia); } diff --git a/native/cocos/renderer/pipeline/RenderInstancedQueue.h b/native/cocos/renderer/pipeline/RenderInstancedQueue.h index d3b2e15c7a..cf3f78c197 100644 --- a/native/cocos/renderer/pipeline/RenderInstancedQueue.h +++ b/native/cocos/renderer/pipeline/RenderInstancedQueue.h @@ -1,31 +1,40 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "core/CoreStd.h" +#include "base/CoreStd.h" namespace cc { + +namespace gfx { +class Device; +class RenderPass; +class CommandBuffer; +} // namespace gfx + namespace pipeline { class InstancedBuffer; diff --git a/native/cocos/renderer/pipeline/RenderPipeline.cpp b/native/cocos/renderer/pipeline/RenderPipeline.cpp index deb599fc3e..ec7205aac1 100644 --- a/native/cocos/renderer/pipeline/RenderPipeline.cpp +++ b/native/cocos/renderer/pipeline/RenderPipeline.cpp @@ -1,100 +1,119 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "RenderPipeline.h" +#include "PipelineStateManager.h" #include "RenderFlow.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDescriptorSetLayout.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXTexture.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDescriptorSetLayout.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXTexture.h" namespace cc { namespace pipeline { -RenderPipeline *RenderPipeline::_instance = nullptr; + +RenderPipeline *RenderPipeline::instance = nullptr; RenderPipeline *RenderPipeline::getInstance() { - return RenderPipeline::_instance; + return RenderPipeline::instance; } RenderPipeline::RenderPipeline() : _device(gfx::Device::getInstance()) { - RenderPipeline::_instance = this; + RenderPipeline::instance = this; setDescriptorSetLayout(); + generateConstantMacros(); + + _pipelineUBO = new PipelineUBO(); + _pipelineSceneData = new PipelineSceneData(); } -RenderPipeline::~RenderPipeline() { -} +RenderPipeline::~RenderPipeline() = default; + +#define INIT_GLOBAL_DESCSET_LAYOUT(info) \ + do { \ + globalDescriptorSetLayout.samplers[info::NAME] = info::LAYOUT; \ + globalDescriptorSetLayout.bindings[info::BINDING] = info::DESCRIPTOR; \ + } while (0) void RenderPipeline::setDescriptorSetLayout() { globalDescriptorSetLayout.bindings.resize(static_cast(PipelineGlobalBindings::COUNT)); - globalDescriptorSetLayout.blocks[UBOGlobal::NAME] = UBOGlobal::LAYOUT; - globalDescriptorSetLayout.bindings[UBOGlobal::BINDING] = UBOGlobal::DESCRIPTOR; - globalDescriptorSetLayout.blocks[UBOCamera::NAME] = UBOCamera::LAYOUT; - globalDescriptorSetLayout.bindings[UBOCamera::BINDING] = UBOCamera::DESCRIPTOR; - globalDescriptorSetLayout.blocks[UBOShadow::NAME] = UBOShadow::LAYOUT; - globalDescriptorSetLayout.bindings[UBOShadow::BINDING] = UBOShadow::DESCRIPTOR; - globalDescriptorSetLayout.samplers[SHADOWMAP::NAME] = SHADOWMAP::LAYOUT; - globalDescriptorSetLayout.bindings[SHADOWMAP::BINDING] = SHADOWMAP::DESCRIPTOR; - globalDescriptorSetLayout.samplers[ENVIRONMENT::NAME] = ENVIRONMENT::LAYOUT; - globalDescriptorSetLayout.bindings[ENVIRONMENT::BINDING] = ENVIRONMENT::DESCRIPTOR; - globalDescriptorSetLayout.samplers[SPOT_LIGHTING_MAP::NAME] = SPOT_LIGHTING_MAP::LAYOUT; - globalDescriptorSetLayout.bindings[SPOT_LIGHTING_MAP::BINDING] = SPOT_LIGHTING_MAP::DESCRIPTOR; + globalDescriptorSetLayout.blocks[UBOGlobal::NAME] = UBOGlobal::LAYOUT; + globalDescriptorSetLayout.bindings[UBOGlobal::BINDING] = UBOGlobal::DESCRIPTOR; + globalDescriptorSetLayout.blocks[UBOCamera::NAME] = UBOCamera::LAYOUT; + globalDescriptorSetLayout.bindings[UBOCamera::BINDING] = UBOCamera::DESCRIPTOR; + globalDescriptorSetLayout.blocks[UBOShadow::NAME] = UBOShadow::LAYOUT; + globalDescriptorSetLayout.bindings[UBOShadow::BINDING] = UBOShadow::DESCRIPTOR; + globalDescriptorSetLayout.samplers[SHADOWMAP::NAME] = SHADOWMAP::LAYOUT; + globalDescriptorSetLayout.bindings[SHADOWMAP::BINDING] = SHADOWMAP::DESCRIPTOR; + globalDescriptorSetLayout.samplers[ENVIRONMENT::NAME] = ENVIRONMENT::LAYOUT; + globalDescriptorSetLayout.bindings[ENVIRONMENT::BINDING] = ENVIRONMENT::DESCRIPTOR; + globalDescriptorSetLayout.samplers[SPOTLIGHTINGMAP::NAME] = SPOTLIGHTINGMAP::LAYOUT; + globalDescriptorSetLayout.bindings[SPOTLIGHTINGMAP::BINDING] = SPOTLIGHTINGMAP::DESCRIPTOR; + + INIT_GLOBAL_DESCSET_LAYOUT(SAMPLERGBUFFERALBEDOMAP); + INIT_GLOBAL_DESCSET_LAYOUT(SAMPLERGBUFFERPOSITIONMAP); + INIT_GLOBAL_DESCSET_LAYOUT(SAMPLERGBUFFEREMISSIVEMAP); + INIT_GLOBAL_DESCSET_LAYOUT(SAMPLERGBUFFERNORMALMAP); + INIT_GLOBAL_DESCSET_LAYOUT(SAMPLERLIGHTINGRESULTMAP); localDescriptorSetLayout.bindings.resize(static_cast(ModelLocalBindings::COUNT)); - localDescriptorSetLayout.blocks[UBOLocalBatched::NAME] = UBOLocalBatched::LAYOUT; - localDescriptorSetLayout.bindings[UBOLocalBatched::BINDING] = UBOLocalBatched::DESCRIPTOR; - localDescriptorSetLayout.blocks[UBOLocal::NAME] = UBOLocal::LAYOUT; - localDescriptorSetLayout.bindings[UBOLocal::BINDING] = UBOLocal::DESCRIPTOR; - localDescriptorSetLayout.blocks[UBOForwardLight::NAME] = UBOForwardLight::LAYOUT; - localDescriptorSetLayout.bindings[UBOForwardLight::BINDING] = UBOForwardLight::DESCRIPTOR; - localDescriptorSetLayout.blocks[UBOSkinningTexture::NAME] = UBOSkinningTexture::LAYOUT; - localDescriptorSetLayout.bindings[UBOSkinningTexture::BINDING] = UBOSkinningTexture::DESCRIPTOR; - localDescriptorSetLayout.blocks[UBOSkinningAnimation::NAME] = UBOSkinningAnimation::LAYOUT; + localDescriptorSetLayout.blocks[UBOLocalBatched::NAME] = UBOLocalBatched::LAYOUT; + localDescriptorSetLayout.bindings[UBOLocalBatched::BINDING] = UBOLocalBatched::DESCRIPTOR; + localDescriptorSetLayout.blocks[UBOLocal::NAME] = UBOLocal::LAYOUT; + localDescriptorSetLayout.bindings[UBOLocal::BINDING] = UBOLocal::DESCRIPTOR; + localDescriptorSetLayout.blocks[UBOForwardLight::NAME] = UBOForwardLight::LAYOUT; + localDescriptorSetLayout.bindings[UBOForwardLight::BINDING] = UBOForwardLight::DESCRIPTOR; + localDescriptorSetLayout.blocks[UBOSkinningTexture::NAME] = UBOSkinningTexture::LAYOUT; + localDescriptorSetLayout.bindings[UBOSkinningTexture::BINDING] = UBOSkinningTexture::DESCRIPTOR; + localDescriptorSetLayout.blocks[UBOSkinningAnimation::NAME] = UBOSkinningAnimation::LAYOUT; localDescriptorSetLayout.bindings[UBOSkinningAnimation::BINDING] = UBOSkinningAnimation::DESCRIPTOR; - localDescriptorSetLayout.blocks[UBOSkinning::NAME] = UBOSkinning::LAYOUT; - localDescriptorSetLayout.bindings[UBOSkinning::BINDING] = UBOSkinning::DESCRIPTOR; - localDescriptorSetLayout.blocks[UBOMorph::NAME] = UBOMorph::LAYOUT; - localDescriptorSetLayout.bindings[UBOMorph::BINDING] = UBOMorph::DESCRIPTOR; - localDescriptorSetLayout.samplers[JOINT_TEXTURE::NAME] = JOINT_TEXTURE::LAYOUT; - localDescriptorSetLayout.bindings[JOINT_TEXTURE::BINDING] = JOINT_TEXTURE::DESCRIPTOR; - localDescriptorSetLayout.samplers[POSITION_MORPH::NAME] = POSITION_MORPH::LAYOUT; - localDescriptorSetLayout.bindings[POSITION_MORPH::BINDING] = POSITION_MORPH::DESCRIPTOR; - localDescriptorSetLayout.samplers[NORMAL_MORPH::NAME] = NORMAL_MORPH::LAYOUT; - localDescriptorSetLayout.bindings[NORMAL_MORPH::BINDING] = NORMAL_MORPH::DESCRIPTOR; - localDescriptorSetLayout.samplers[TANGENT_MORPH::NAME] = TANGENT_MORPH::LAYOUT; - localDescriptorSetLayout.bindings[TANGENT_MORPH::BINDING] = TANGENT_MORPH::DESCRIPTOR; - localDescriptorSetLayout.samplers[LIGHTMAP_TEXTURE::NAME] = LIGHTMAP_TEXTURE::LAYOUT; - localDescriptorSetLayout.bindings[LIGHTMAP_TEXTURE::BINDING] = LIGHTMAP_TEXTURE::DESCRIPTOR; - localDescriptorSetLayout.samplers[SPRITE_TEXTURE::NAME] = SPRITE_TEXTURE::LAYOUT; - localDescriptorSetLayout.bindings[SPRITE_TEXTURE::BINDING] = SPRITE_TEXTURE::DESCRIPTOR; + localDescriptorSetLayout.blocks[UBOSkinning::NAME] = UBOSkinning::LAYOUT; + localDescriptorSetLayout.bindings[UBOSkinning::BINDING] = UBOSkinning::DESCRIPTOR; + localDescriptorSetLayout.blocks[UBOMorph::NAME] = UBOMorph::LAYOUT; + localDescriptorSetLayout.bindings[UBOMorph::BINDING] = UBOMorph::DESCRIPTOR; + localDescriptorSetLayout.samplers[JOINTTEXTURE::NAME] = JOINTTEXTURE::LAYOUT; + localDescriptorSetLayout.bindings[JOINTTEXTURE::BINDING] = JOINTTEXTURE::DESCRIPTOR; + localDescriptorSetLayout.samplers[POSITIONMORPH::NAME] = POSITIONMORPH::LAYOUT; + localDescriptorSetLayout.bindings[POSITIONMORPH::BINDING] = POSITIONMORPH::DESCRIPTOR; + localDescriptorSetLayout.samplers[NORMALMORPH::NAME] = NORMALMORPH::LAYOUT; + localDescriptorSetLayout.bindings[NORMALMORPH::BINDING] = NORMALMORPH::DESCRIPTOR; + localDescriptorSetLayout.samplers[TANGENTMORPH::NAME] = TANGENTMORPH::LAYOUT; + localDescriptorSetLayout.bindings[TANGENTMORPH::BINDING] = TANGENTMORPH::DESCRIPTOR; + localDescriptorSetLayout.samplers[LIGHTMAPTEXTURE::NAME] = LIGHTMAPTEXTURE::LAYOUT; + localDescriptorSetLayout.bindings[LIGHTMAPTEXTURE::BINDING] = LIGHTMAPTEXTURE::DESCRIPTOR; + localDescriptorSetLayout.samplers[SPRITETEXTURE::NAME] = SPRITETEXTURE::LAYOUT; + localDescriptorSetLayout.bindings[SPRITETEXTURE::BINDING] = SPRITETEXTURE::DESCRIPTOR; } bool RenderPipeline::initialize(const RenderPipelineInfo &info) { _flows = info.flows; - _tag = info.tag; + _tag = info.tag; return true; } @@ -110,9 +129,12 @@ bool RenderPipeline::activate() { CC_DELETE(_descriptorSet); } _descriptorSet = _device->createDescriptorSet({_descriptorSetLayout}); + _pipelineUBO->activate(_device, this); + _pipelineSceneData->activate(_device, this); - for (const auto flow : _flows) + for (auto *const flow : _flows) { flow->activate(this); + } // has not initBuiltinRes, // create temporary default Texture to binding sampler2d @@ -121,8 +143,8 @@ bool RenderPipeline::activate() { gfx::TextureType::TEX2D, gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED, gfx::Format::RGBA8, - 1u, - 1u, + 1U, + 1U, }); } @@ -130,24 +152,26 @@ bool RenderPipeline::activate() { } void RenderPipeline::render(const vector &cameras) { - for (const auto flow : _flows) { + for (auto *const flow : _flows) { for (const auto cameraID : cameras) { - Camera* camera = GET_CAMERA(cameraID); + auto *camera = GET_CAMERA(cameraID); flow->render(camera); } } } void RenderPipeline::destroy() { - for (auto flow : _flows) { + for (auto *flow : _flows) { flow->destroy(); } _flows.clear(); CC_SAFE_DESTROY(_descriptorSetLayout); CC_SAFE_DESTROY(_descriptorSet); + CC_SAFE_DESTROY(_pipelineUBO); + CC_SAFE_DESTROY(_pipelineSceneData); - for (const auto cmdBuffer : _commandBuffers) { + for (auto *const cmdBuffer : _commandBuffers) { cmdBuffer->destroy(); } _commandBuffers.clear(); @@ -155,6 +179,25 @@ void RenderPipeline::destroy() { CC_SAFE_DESTROY(_defaultTexture); CC_SAFE_DELETE(_defaultTexture); + + SamplerLib::destroyAll(); + PipelineStateManager::destroyAll(); +} + +void RenderPipeline::setPipelineSharedSceneData(uint handle) { + _pipelineSceneData->setPipelineSharedSceneData(handle); +} + +void RenderPipeline::generateConstantMacros() { + _constantMacros = StringUtil::format( + R"( +#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE %d +#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS %d +#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS %d + )", + _device->hasFeature(gfx::Feature::TEXTURE_FLOAT) ? 1 : 0, + _device->getCapabilities().maxVertexUniformVectors, + _device->getCapabilities().maxFragmentUniformVectors); } } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/RenderPipeline.h b/native/cocos/renderer/pipeline/RenderPipeline.h index 20ea79162b..9fb171e7ab 100644 --- a/native/cocos/renderer/pipeline/RenderPipeline.h +++ b/native/cocos/renderer/pipeline/RenderPipeline.h @@ -1,30 +1,34 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "../core/CoreStd.h" #include "Define.h" +#include "PipelineSceneData.h" +#include "PipelineUBO.h" +#include "base/CoreStd.h" #include "helper/DefineMap.h" #include "helper/SharedMemory.h" @@ -33,13 +37,13 @@ namespace gfx { class CommandBuffer; class DescriptorSet; class DescriptorSetLayout; -struct Camera; } // namespace gfx namespace pipeline { class DefineMap; +struct Camera; struct CC_DLL RenderPipelineInfo { - uint tag = 0; + uint tag = 0; RenderFlowList flows; }; @@ -48,35 +52,49 @@ public: static RenderPipeline *getInstance(); RenderPipeline(); - virtual ~RenderPipeline(); + ~RenderPipeline() override; virtual bool activate(); virtual void destroy(); virtual bool initialize(const RenderPipelineInfo &info); virtual void render(const vector &cameras); + virtual void resize(uint width, uint height){}; - CC_INLINE const RenderFlowList &getFlows() const { return _flows; } - CC_INLINE uint getTag() const { return _tag; } - CC_INLINE const map &getGlobalBindings() const { return _globalBindings; } - CC_INLINE const DefineMap &getMacros() const { return _macros; } - CC_INLINE void setValue(const String &name, bool value) { _macros.setValue(name, value); } - CC_INLINE gfx::DescriptorSet *getDescriptorSet() const { return _descriptorSet; } - CC_INLINE gfx::DescriptorSetLayout *getDescriptorSetLayout() const { return _descriptorSetLayout; } - CC_INLINE gfx::Texture *getDefaultTexture() const { return _defaultTexture; } + void setPipelineSharedSceneData(uint handle); + + inline const RenderFlowList & getFlows() const { return _flows; } + inline uint getTag() const { return _tag; } + inline const map &getGlobalBindings() const { return _globalBindings; } + inline const DefineMap & getMacros() const { return _macros; } + inline void setValue(const String &name, bool value) { _macros.setValue(name, value); } + inline gfx::DescriptorSet * getDescriptorSet() const { return _descriptorSet; } + inline gfx::DescriptorSetLayout * getDescriptorSetLayout() const { return _descriptorSetLayout; } + inline gfx::Texture * getDefaultTexture() const { return _defaultTexture; } + inline PipelineSceneData * getPipelineSceneData() const { return _pipelineSceneData; } + inline const gfx::CommandBufferList & getCommandBuffers() const { return _commandBuffers; } + inline PipelineUBO * getPipelineUBO() const { return _pipelineUBO; } + inline const String & getConstantMacros() { return _constantMacros; } + inline gfx::Device * getDevice() { return _device; } protected: - static RenderPipeline *_instance; - void setDescriptorSetLayout(); + static RenderPipeline *instance; - gfx::CommandBufferList _commandBuffers; - RenderFlowList _flows; + static void setDescriptorSetLayout(); + + void generateConstantMacros(); + + gfx::CommandBufferList _commandBuffers; + RenderFlowList _flows; map _globalBindings; - DefineMap _macros; - uint _tag = 0; + DefineMap _macros; + uint _tag = 0; + String _constantMacros; - gfx::Device *_device = nullptr; + gfx::Device * _device = nullptr; gfx::DescriptorSetLayout *_descriptorSetLayout = nullptr; - gfx::DescriptorSet *_descriptorSet = nullptr; + gfx::DescriptorSet * _descriptorSet = nullptr; + PipelineUBO * _pipelineUBO = nullptr; + PipelineSceneData * _pipelineSceneData = nullptr; // has not initBuiltinRes, // create temporary default Texture to binding sampler2d gfx::Texture *_defaultTexture = nullptr; diff --git a/native/cocos/renderer/pipeline/RenderQueue.cpp b/native/cocos/renderer/pipeline/RenderQueue.cpp index cefb2b778d..46d9455070 100644 --- a/native/cocos/renderer/pipeline/RenderQueue.cpp +++ b/native/cocos/renderer/pipeline/RenderQueue.cpp @@ -1,37 +1,41 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "RenderQueue.h" + +#include #include "PipelineStateManager.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXShader.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXShader.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { -RenderQueue::RenderQueue(const RenderQueueCreateInfo &desc) -: _passDesc(desc) { +RenderQueue::RenderQueue(RenderQueueCreateInfo desc) +: _passDesc(std::move(desc)) { } void RenderQueue::clear() { @@ -39,10 +43,10 @@ void RenderQueue::clear() { } bool RenderQueue::insertRenderPass(const RenderObject &renderObj, uint subModelIdx, uint passIdx) { - const auto subModelID = renderObj.model->getSubModelID(); - const auto subModel = renderObj.model->getSubModelView(subModelID[subModelIdx]); - const auto pass = subModel->getPassView(passIdx); - const auto isTransparent = pass->getBlendState()->targets[0].blend; + const auto *const subModelID = renderObj.model->getSubModelID(); + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelID[subModelIdx]); + const auto *const pass = subModel->getPassView(passIdx); + const bool isTransparent = pass->getBlendState()->targets[0].blend; if (isTransparent != _passDesc.isTransparent || !(pass->phase & _passDesc.phases)) { return false; @@ -51,7 +55,7 @@ bool RenderQueue::insertRenderPass(const RenderObject &renderObj, uint subModelI const auto hash = (0 << 30) | (pass->priority << 16) | (subModel->priority << 8) | passIdx; uint shaderID = subModel->shaderID[passIdx]; RenderPass renderPass = {hash, renderObj.depth, shaderID, passIdx, subModel}; - _queue.emplace_back(std::move(renderPass)); + _queue.emplace_back(renderPass); return true; } @@ -59,19 +63,19 @@ void RenderQueue::sort() { std::sort(_queue.begin(), _queue.end(), _passDesc.sortFunc); } -void RenderQueue::recordCommandBuffer(gfx::Device *device, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuff) { - for (size_t i = 0; i < _queue.size(); ++i) { - const auto subModel = _queue[i].subModel; - const auto passIdx = _queue[i].passIndex; - auto inputAssembler = subModel->getInputAssembler(); +void RenderQueue::recordCommandBuffer(gfx::Device * /*device*/, gfx::RenderPass *renderPass, gfx::CommandBuffer *cmdBuff) { + for (auto & i : _queue) { + const auto *const subModel = i.subModel; + const auto passIdx = i.passIndex; + auto *inputAssembler = subModel->getInputAssembler(); - const auto pass = subModel->getPassView(passIdx); - auto shader = subModel->getShader(passIdx); + const auto *const pass = subModel->getPassView(passIdx); + auto *shader = subModel->getShader(passIdx); - auto pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, inputAssembler, renderPass); + auto *pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, inputAssembler, renderPass); cmdBuff->bindPipelineState(pso); - cmdBuff->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); - cmdBuff->bindDescriptorSet(LOCAL_SET, subModel->getDescriptorSet()); + cmdBuff->bindDescriptorSet(materialSet, pass->getDescriptorSet()); + cmdBuff->bindDescriptorSet(localSet, subModel->getDescriptorSet()); cmdBuff->bindInputAssembler(inputAssembler); cmdBuff->draw(inputAssembler); } diff --git a/native/cocos/renderer/pipeline/RenderQueue.h b/native/cocos/renderer/pipeline/RenderQueue.h index 85c15a1eb7..5ff47247c0 100644 --- a/native/cocos/renderer/pipeline/RenderQueue.h +++ b/native/cocos/renderer/pipeline/RenderQueue.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "Define.h" @@ -30,7 +32,7 @@ namespace pipeline { class CC_DLL RenderQueue : public Object { public: - RenderQueue(const RenderQueueCreateInfo &desc); + explicit RenderQueue(RenderQueueCreateInfo desc); void clear(); bool insertRenderPass(const RenderObject &renderObj, uint subModelIdx, uint passIdx); diff --git a/native/cocos/renderer/pipeline/RenderStage.cpp b/native/cocos/renderer/pipeline/RenderStage.cpp index decdd11a14..c2cba49538 100644 --- a/native/cocos/renderer/pipeline/RenderStage.cpp +++ b/native/cocos/renderer/pipeline/RenderStage.cpp @@ -1,34 +1,36 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "RenderStage.h" #include "RenderQueue.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXDevice.h" namespace cc { namespace pipeline { RenderStage::RenderStage() :_device(gfx::Device::getInstance()){ - + } RenderStage::~RenderStage() { diff --git a/native/cocos/renderer/pipeline/RenderStage.h b/native/cocos/renderer/pipeline/RenderStage.h index 1a1c90686d..e351c7857a 100644 --- a/native/cocos/renderer/pipeline/RenderStage.h +++ b/native/cocos/renderer/pipeline/RenderStage.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "Define.h" @@ -48,7 +50,7 @@ struct CC_DLL RenderStageInfo { class CC_DLL RenderStage : public Object { public: RenderStage(); - virtual ~RenderStage(); + ~RenderStage() override; virtual void activate(RenderPipeline *pipeline, RenderFlow *flow); virtual bool initialize(const RenderStageInfo &info); @@ -56,9 +58,10 @@ public: virtual void destroy(); virtual void render(Camera *camera) = 0; - CC_INLINE const String &getName() const { return _name; } - CC_INLINE uint getPriority() const { return _priority; } - CC_INLINE uint getTag() const { return _tag; } + inline const String &getName() const { return _name; } + inline uint getPriority() const { return _priority; } + inline uint getTag() const { return _tag; } + inline RenderFlow *getFlow() const {return _flow;} protected: RenderQueueDescList _renderQueueDescriptors; @@ -69,7 +72,7 @@ protected: String _name; uint _priority = 0; uint _tag = 0; - gfx::ColorList _clearColors = {{0, 0, 0, 1.0f}}; + gfx::ColorList _clearColors = {{0.0F, 0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F, 0.0F}}; }; } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/SceneCulling.cpp b/native/cocos/renderer/pipeline/SceneCulling.cpp new file mode 100644 index 0000000000..4059e07c2b --- /dev/null +++ b/native/cocos/renderer/pipeline/SceneCulling.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 + +#include "Define.h" +#include "RenderPipeline.h" +#include "SceneCulling.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "helper/SharedMemory.h" +#include "math/Quaternion.h" +#include "platform/Application.h" + +namespace cc { +namespace pipeline { +bool castBoundsInitialized = false; +AABB castWorldBounds; + +RenderObject genRenderObject(const ModelView *model, const Camera *camera) { + float depth = 0; + if (model->nodeID) { + const auto *const node = model->getTransform(); + cc::Vec3 position; + cc::Vec3::subtract(node->worldPosition, camera->position, &position); + depth = position.dot(camera->forward); + } + + return {depth, model}; +} + +void getShadowWorldMatrix(const Sphere *sphere, const cc::Vec4 &rotation, const cc::Vec3 &dir, cc::Mat4 &shadowWorldMat, cc::Vec3 &out) { + Vec3 translation(dir); + translation.negate(); + const auto distance = sphere->radius * COEFFICIENT_OF_EXPANSION; + translation.scale(distance); + translation.add(sphere->center); + out.set(translation); + + Mat4::fromRT(rotation, translation, &shadowWorldMat); +} + +void updateSphereLight(Shadows *shadows, const Light *light, std::array &shadowUBO) { + const auto *const node = light->getNode(); + if (!node->flagsChanged && !shadows->dirty) { + return; + } + + shadows->dirty = false; + const auto position = node->worldPosition; + const auto &normal = shadows->normal; + const auto distance = shadows->distance + 0.001F; // avoid z-fighting + const auto ndL = normal.dot(position); + const auto lx = position.x; + const auto ly = position.y; + const auto lz = position.z; + const auto nx = normal.x; + const auto ny = normal.y; + const auto nz = normal.z; + auto & matLight = shadows->matLight; + matLight.m[0] = ndL - distance - lx * nx; + matLight.m[1] = -ly * nx; + matLight.m[2] = -lz * nx; + matLight.m[3] = -nx; + matLight.m[4] = -lx * ny; + matLight.m[5] = ndL - distance - ly * ny; + matLight.m[6] = -lz * ny; + matLight.m[7] = -ny; + matLight.m[8] = -lx * nz; + matLight.m[9] = -ly * nz; + matLight.m[10] = ndL - distance - lz * nz; + matLight.m[11] = -nz; + matLight.m[12] = lx * distance; + matLight.m[13] = ly * distance; + matLight.m[14] = lz * distance; + matLight.m[15] = ndL; + + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET, matLight.m, sizeof(matLight)); +} + +void updateDirLight(Shadows *shadows, const Light *light, std::array &shadowUBO) { + const auto *const node = light->getNode(); + const auto rotation = node->worldRotation; + Quaternion qt(rotation.x, rotation.y, rotation.z, rotation.w); + Vec3 forward(0, 0, -1.0F); + forward.transformQuat(qt); + const auto &normal = shadows->normal; + const auto distance = shadows->distance + 0.001F; // avoid z-fighting + const auto ndL = normal.dot(forward); + const auto scale = 1.0F / ndL; + const auto lx = forward.x * scale; + const auto ly = forward.y * scale; + const auto lz = forward.z * scale; + const auto nx = normal.x; + const auto ny = normal.y; + const auto nz = normal.z; + auto & matLight = shadows->matLight; + matLight.m[0] = 1 - nx * lx; + matLight.m[1] = -nx * ly; + matLight.m[2] = -nx * lz; + matLight.m[3] = 0; + matLight.m[4] = -ny * lx; + matLight.m[5] = 1 - ny * ly; + matLight.m[6] = -ny * lz; + matLight.m[7] = 0; + matLight.m[8] = -nz * lx; + matLight.m[9] = -nz * ly; + matLight.m[10] = 1 - nz * lz; + matLight.m[11] = 0; + matLight.m[12] = lx * distance; + matLight.m[13] = ly * distance; + matLight.m[14] = lz * distance; + matLight.m[15] = 1; + + memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET, matLight.m, sizeof(matLight)); + float color[4] = {shadows->color.x, shadows->color.y, shadows->color.z, shadows->color.w}; + memcpy(shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &color, sizeof(float) * 4); +} + +void lightCollecting(Camera *camera, std::vector &validLights) { + validLights.clear(); + auto * sphere = CC_NEW(Sphere); + const auto *const scene = camera->getScene(); + const Light * mainLight = nullptr; + if (scene->mainLightID) mainLight = scene->getMainLight(); + validLights.emplace_back(mainLight); + + const auto *const spotLightArrayID = scene->getSpotLightArrayID(); + const auto count = spotLightArrayID ? spotLightArrayID[0] : 0; + for (uint32_t i = 1; i <= count; ++i) { + const auto *spotLight = cc::pipeline::Scene::getSpotLight(spotLightArrayID[i]); + sphere->center.set(spotLight->position); + sphere->radius = spotLight->range; + if (sphere->interset(*camera->getFrustum())) { + validLights.emplace_back(spotLight); + } + } + + CC_SAFE_DELETE(sphere); +} + + +void sceneCulling(RenderPipeline *pipeline, Camera *camera) { + auto *const sceneData = pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + auto *const shadows = sharedData->getShadows(); + auto *const skyBox = sharedData->getSkybox(); + const auto *const scene = camera->getScene(); + + castBoundsInitialized = false; + RenderObjectList shadowObjects; + bool isShadowMap = false; + if(shadows->enabled && shadows->getShadowType() == ShadowType::SHADOWMAP) { + isShadowMap = true; + } + + const Light *mainLight = nullptr; + if (scene->mainLightID) mainLight = scene->getMainLight(); + RenderObjectList renderObjects; + + if (skyBox->enabled && skyBox->modelID && (camera->clearFlag & skyboxFlag)) { + renderObjects.emplace_back(genRenderObject(skyBox->getModel(), camera)); + } + + const auto *const models = scene->getModels(); + const auto modelCount = models[0]; + for (size_t i = 1; i <= modelCount; i++) { + const auto *const model = cc::pipeline::Scene::getModelView(models[i]); + + // filter model by view visibility + if (model->enabled) { + const auto visibility = camera->visibility; + const auto *const node = model->getNode(); + if ((model->nodeID && ((visibility & node->layer) == node->layer)) || + (visibility & model->visFlags)) { + // shadow render Object + if (isShadowMap && model->castShadow && model->getWorldBounds()) { + if (!castBoundsInitialized) { + castWorldBounds = *model->getWorldBounds(); + castBoundsInitialized = true; + } + castWorldBounds.merge(*model->getWorldBounds()); + shadowObjects.emplace_back(genRenderObject(model, camera)); + } + // frustum culling + if ((model->worldBoundsID) && !aabbFrustum(model->getWorldBounds(), camera->getFrustum())) { + continue; + } + + renderObjects.emplace_back(genRenderObject(model, camera)); + } + } + } + + if(isShadowMap) { + sceneData->getSphere()->define(castWorldBounds); + sceneData->setShadowObjects(std::move(shadowObjects)); + } + + sceneData->setRenderObjects(std::move(renderObjects)); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/SceneCulling.h b/native/cocos/renderer/pipeline/SceneCulling.h new file mode 100644 index 0000000000..66eef2a4e0 --- /dev/null +++ b/native/cocos/renderer/pipeline/SceneCulling.h @@ -0,0 +1,52 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once +#include "pipeline/Define.h" + +namespace cc { +class Mat4; +class Vec4; +class Vec3; +namespace pipeline { + +struct RenderObject; +struct Model; +struct Camera; +class RenderPipeline; +struct Sphere; +struct Light; +struct Sphere; +struct Shadows; + +RenderObject genRenderObject(Model *, const Camera *); + +void lightCollecting(Camera *, std::vector&); +void sceneCulling(RenderPipeline *, Camera *); +void updateSphereLight(Shadows *shadows, const Light *light, std::array &); +void updateDirLight(Shadows *shadows, const Light *light, std::array&); +void getShadowWorldMatrix(const Sphere *sphere, const cc::Vec4 &rotation, const cc::Vec3 &dir, cc::Mat4 &shadowWorldMat, cc::Vec3 &out); +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp index 3e4f3afb85..e787ecff43 100644 --- a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp +++ b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp @@ -1,59 +1,64 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "BatchedBuffer.h" #include "Define.h" #include "InstancedBuffer.h" +#include "PipelineSceneData.h" #include "PipelineStateManager.h" +#include "PipelineUBO.h" #include "RenderBatchedQueue.h" #include "RenderInstancedQueue.h" +#include "SceneCulling.h" #include "ShadowMapBatchedQueue.h" #include "forward/ForwardPipeline.h" -#include "forward/SceneCulling.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" #include "helper/SharedMemory.h" namespace cc { namespace pipeline { ShadowMapBatchedQueue::ShadowMapBatchedQueue(ForwardPipeline *pipeline) : _phaseID(getPhaseID("shadow-caster")) { - _pipeline = pipeline; - _buffer = pipeline->getDescriptorSet()->getBuffer(UBOShadow::BINDING); + _pipeline = pipeline; + _buffer = pipeline->getDescriptorSet()->getBuffer(UBOShadow::BINDING); _instancedQueue = CC_NEW(RenderInstancedQueue); - _batchedQueue = CC_NEW(RenderBatchedQueue); + _batchedQueue = CC_NEW(RenderBatchedQueue); } void ShadowMapBatchedQueue::gatherLightPasses(const Light *light, gfx::CommandBuffer *cmdBufferer) { clear(); - const auto *shadowInfo = _pipeline->getShadows(); - const auto &shadowObjects = _pipeline->getShadowObjects(); + const auto *sceneData = _pipeline->getPipelineSceneData(); + const auto *shadowInfo = sceneData->getSharedData()->getShadows(); + const auto &shadowObjects = sceneData->getShadowObjects(); if (light && shadowInfo->enabled && shadowInfo->getShadowType() == ShadowType::SHADOWMAP) { - updateUBOs(light, cmdBufferer); + _pipeline->getPipelineUBO()->updateShadowUBOLight(light); for (const auto ro : shadowObjects) { const auto *model = ro.model; @@ -64,8 +69,8 @@ void ShadowMapBatchedQueue::gatherLightPasses(const Light *light, gfx::CommandBu break; case LightType::SPOT: if (model->getWorldBounds() && - (aabb_aabb(model->getWorldBounds(), light->getAABB()) || - aabb_frustum(model->getWorldBounds(), light->getFrustum()))) { + (aabbAabb(model->getWorldBounds(), light->getAABB()) || + aabbFrustum(model->getWorldBounds(), light->getFrustum()))) { add(model, cmdBufferer); } break; @@ -90,12 +95,12 @@ void ShadowMapBatchedQueue::add(const ModelView *model, gfx::CommandBuffer *cmdB return; } - const auto subModelID = model->getSubModelID(); - const auto subModelCount = subModelID[0]; + const auto *const subModelID = model->getSubModelID(); + const auto subModelCount = subModelID[0]; for (unsigned m = 1; m <= subModelCount; ++m) { - const auto subModel = model->getSubModelView(subModelID[m]); - const auto pass = subModel->getPassView(shadowPassIdx); - const auto batchingScheme = pass->getBatchingScheme(); + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelID[m]); + const auto *const pass = subModel->getPassView(shadowPassIdx); + const auto batchingScheme = pass->getBatchingScheme(); if (batchingScheme == BatchingSchemes::INSTANCING) { auto *instancedBuffer = InstancedBuffer::get(subModel->passID[shadowPassIdx]); @@ -121,15 +126,15 @@ void ShadowMapBatchedQueue::recordCommandBuffer(gfx::Device *device, gfx::Render _batchedQueue->recordCommandBuffer(device, renderPass, cmdBuffer); for (size_t i = 0; i < _subModels.size(); i++) { - const auto subModel = _subModels[i]; - const auto shader = _shaders[i]; - const auto pass = _passes[i]; - const auto ia = subModel->getInputAssembler(); - const auto pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); + const auto *const subModel = _subModels[i]; + auto *const shader = _shaders[i]; + const auto *const pass = _passes[i]; + auto *const ia = subModel->getInputAssembler(); + auto *const pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, ia, renderPass); cmdBuffer->bindPipelineState(pso); - cmdBuffer->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); - cmdBuffer->bindDescriptorSet(LOCAL_SET, subModel->getDescriptorSet()); + cmdBuffer->bindDescriptorSet(materialSet, pass->getDescriptorSet()); + cmdBuffer->bindDescriptorSet(localSet, subModel->getDescriptorSet()); cmdBuffer->bindInputAssembler(ia); cmdBuffer->draw(ia); } @@ -143,74 +148,15 @@ void ShadowMapBatchedQueue::destroy() { _buffer = nullptr; } -void ShadowMapBatchedQueue::updateUBOs(const Light *light, gfx::CommandBuffer *cmdBufferer) const { - const auto *shadowInfo = _pipeline->getShadows(); - auto shadowUBO = _pipeline->getShadowUBO(); - auto *device = gfx::Device::getInstance(); - - switch (light->getType()) { - case LightType::DIRECTIONAL: { - cc::Mat4 matShadowCamera; - - float x = 0.0f, y = 0.0f, farClamp = 0.0f; - if (shadowInfo->autoAdapt) { - Vec3 tmpCenter; - getShadowWorldMatrix(_pipeline->getSphere(), light->getNode()->worldRotation, light->direction, matShadowCamera, tmpCenter); - - const auto radius = _pipeline->getSphere()->radius; - x = radius * shadowInfo->aspect; - y = radius; - - const float halfFar = tmpCenter.distance(_pipeline->getSphere()->center); - farClamp = std::min(halfFar * COEFFICIENT_OF_EXPANSION, SHADOW_CAMERA_MAX_FAR); - } else { - matShadowCamera = light->getNode()->worldMatrix; - - x = shadowInfo->orthoSize * shadowInfo->aspect; - y = shadowInfo->orthoSize; - - farClamp = shadowInfo->farValue; - } - - const auto matShadowView = matShadowCamera.getInversed(); - - cc::Mat4 matShadowViewProj; - const auto projectionSinY = device->getScreenSpaceSignY() * device->getUVSpaceSignY(); - Mat4::createOrthographicOffCenter(-x, x, -y, y, shadowInfo->nearValue, farClamp, device->getClipSpaceMinZ(), projectionSinY, &matShadowViewProj); - - matShadowViewProj.multiply(matShadowView); - memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); - } break; - case LightType::SPOT: { - const auto &matShadowCamera = light->getNode()->worldMatrix; - - const auto matShadowView = matShadowCamera.getInversed(); - - cc::Mat4 matShadowViewProj; - cc::Mat4::createPerspective(light->spotAngle, light->aspect, 0.001f, light->range, &matShadowViewProj); - - matShadowViewProj.multiply(matShadowView); - memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); - } break; - default: break; - } - - float shadowInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, (float)shadowInfo->pcfType, shadowInfo->bias}; - memcpy(shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &shadowInfo->color, sizeof(Vec4)); - memcpy(shadowUBO.data() + UBOShadow::SHADOW_INFO_OFFSET, &shadowInfos, sizeof(shadowInfos)); - - cmdBufferer->updateBuffer(_pipeline->getDescriptorSet()->getBuffer(UBOShadow::BINDING), shadowUBO.data(), UBOShadow::SIZE); -} - int ShadowMapBatchedQueue::getShadowPassIndex(const ModelView *model) const { - const auto subModelArrayID = model->getSubModelID(); - const auto count = subModelArrayID[0]; + const auto *const subModelArrayID = model->getSubModelID(); + const auto count = subModelArrayID[0]; for (unsigned i = 1; i <= count; i++) { - const auto subModel = model->getSubModelView(subModelArrayID[i]); + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelArrayID[i]); for (unsigned passIdx = 0; passIdx < subModel->passCount; passIdx++) { - const auto pass = subModel->getPassView(passIdx); + const auto *const pass = subModel->getPassView(passIdx); if (pass->phase == _phaseID) { - return passIdx; + return static_cast(passIdx); } } } diff --git a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h index ef3f75ff13..b418b7f6a1 100644 --- a/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h +++ b/native/cocos/renderer/pipeline/ShadowMapBatchedQueue.h @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include -#include "core/CoreStd.h" +#include "base/CoreStd.h" #include "Define.h" namespace cc { @@ -54,7 +56,6 @@ public: void recordCommandBuffer(gfx::Device *, gfx::RenderPass *, gfx::CommandBuffer *) const; private: - void updateUBOs(const Light *, gfx::CommandBuffer *) const; int getShadowPassIndex(const ModelView *model) const; private: diff --git a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp new file mode 100644 index 0000000000..31af013aa8 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.cpp @@ -0,0 +1,560 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "DeferredPipeline.h" +#include "../SceneCulling.h" +#include "../helper/SharedMemory.h" +#include "../shadow/ShadowFlow.h" +#include "GbufferFlow.h" +#include "LightingFlow.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXTexture.h" +#include "platform/Application.h" + +namespace cc { +namespace pipeline { +namespace { +#define TO_VEC3(dst, src, offset) \ + dst[offset] = (src).x; \ + (dst)[(offset) + 1] = (src).y; \ + (dst)[(offset) + 2] = (src).z; +#define TO_VEC4(dst, src, offset) \ + dst[offset] = (src).x; \ + (dst)[(offset) + 1] = (src).y; \ + (dst)[(offset) + 2] = (src).z; \ + (dst)[(offset) + 3] = (src).w; +} // namespace + +gfx::RenderPass *DeferredPipeline::getOrCreateRenderPass(gfx::ClearFlags clearFlags) { + if (_renderPasses.find(clearFlags) != _renderPasses.end()) { + return _renderPasses[clearFlags]; + } + + auto * device = gfx::Device::getInstance(); + gfx::ColorAttachment colorAttachment; + gfx::DepthStencilAttachment depthStencilAttachment; + colorAttachment.format = device->getColorFormat(); + depthStencilAttachment.format = device->getDepthStencilFormat(); + depthStencilAttachment.stencilStoreOp = gfx::StoreOp::DISCARD; + depthStencilAttachment.depthStoreOp = gfx::StoreOp::DISCARD; + + if (!hasFlag(clearFlags, gfx::ClearFlagBit::COLOR)) { + if (hasFlag(clearFlags, static_cast(skyboxFlag))) { + colorAttachment.loadOp = gfx::LoadOp::DISCARD; + } else { + colorAttachment.loadOp = gfx::LoadOp::LOAD; + colorAttachment.beginAccesses = {gfx::AccessType::PRESENT}; + } + } + + if (static_cast(clearFlags & gfx::ClearFlagBit::DEPTH_STENCIL) != gfx::ClearFlagBit::DEPTH_STENCIL) { + if (!hasFlag(clearFlags, gfx::ClearFlagBit::DEPTH)) depthStencilAttachment.depthLoadOp = gfx::LoadOp::LOAD; + if (!hasFlag(clearFlags, gfx::ClearFlagBit::STENCIL)) depthStencilAttachment.stencilLoadOp = gfx::LoadOp::LOAD; + depthStencilAttachment.beginAccesses = {gfx::AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE}; + } + + auto *renderPass = device->createRenderPass({ + {colorAttachment}, + depthStencilAttachment, + }); + _renderPasses[clearFlags] = renderPass; + + return renderPass; +} + +bool DeferredPipeline::initialize(const RenderPipelineInfo &info) { + RenderPipeline::initialize(info); + + if (_flows.empty()) { + auto *shadowFlow = CC_NEW(ShadowFlow); + shadowFlow->initialize(ShadowFlow::getInitializeInfo()); + _flows.emplace_back(shadowFlow); + + auto *gbufferFlow = CC_NEW(GbufferFlow); + gbufferFlow->initialize(GbufferFlow::getInitializeInfo()); + _flows.emplace_back(gbufferFlow); + + auto *lightingFlow = CC_NEW(LightingFlow); + lightingFlow->initialize(LightingFlow::getInitializeInfo()); + _flows.emplace_back(lightingFlow); + } + + return true; +} + +bool DeferredPipeline::activate() { + _macros.setValue("CC_PIPELINE_TYPE", static_cast(1.0)); + + if (!RenderPipeline::activate()) { + CC_LOG_ERROR("RenderPipeline active failed."); + return false; + } + + if (!activeRenderer()) { + CC_LOG_ERROR("DeferredPipeline startup failed!"); + return false; + } + + return true; +} + +void DeferredPipeline::render(const vector &cameras) { + if (cameras.empty()) return; + _commandBuffers[0]->begin(); + _pipelineUBO->updateGlobalUBO(); + for (const auto cameraId : cameras) { + auto *camera = GET_CAMERA(cameraId); + sceneCulling(this, camera); + _pipelineUBO->updateCameraUBO(camera, true); + for (auto *const flow : _flows) { + flow->render(camera); + } + } + _commandBuffers[0]->end(); + _device->flushCommands(_commandBuffers); + _device->getQueue()->submit(_commandBuffers); +} + +void DeferredPipeline::updateQuadVertexData(const gfx::Rect &renderArea) { + if (_lastUsedRenderArea == renderArea) { + return; + } + + _lastUsedRenderArea = renderArea; + float vbData[16] = {0}; + genQuadVertexData(gfx::SurfaceTransform::IDENTITY, renderArea, vbData); + _commandBuffers[0]->updateBuffer(_quadVBOffscreen, vbData); + + genQuadVertexData(_device->getSurfaceTransform(), renderArea, vbData); + _commandBuffers[0]->updateBuffer(_quadVBOnscreen, vbData); +} + +void DeferredPipeline::genQuadVertexData(gfx::SurfaceTransform surfaceTransform, const gfx::Rect &renderArea, float *vbData) { + float minX = float(renderArea.x) / _device->getWidth(); + float maxX = float(renderArea.x + renderArea.width) / _device->getWidth(); + float minY = float(renderArea.y) / _device->getHeight(); + float maxY = float(renderArea.y + renderArea.height) / _device->getHeight(); + + int n = 0; + switch (surfaceTransform) { + case (gfx::SurfaceTransform::IDENTITY): + n = 0; + vbData[n++] = -1.0; + vbData[n++] = -1.0; + vbData[n++] = minX; // uv + vbData[n++] = maxY; + vbData[n++] = 1.0; + vbData[n++] = -1.0; + vbData[n++] = maxX; + vbData[n++] = maxY; + vbData[n++] = -1.0; + vbData[n++] = 1.0; + vbData[n++] = minX; + vbData[n++] = minY; + vbData[n++] = 1.0; + vbData[n++] = 1.0; + vbData[n++] = maxX; + vbData[n++] = minY; + break; + case (gfx::SurfaceTransform::ROTATE_90): + n = 0; + vbData[n++] = -1.0; + vbData[n++] = -1.0; + vbData[n++] = maxX; // uv + vbData[n++] = maxY; + vbData[n++] = 1.0; + vbData[n++] = -1.0; + vbData[n++] = maxX; + vbData[n++] = minY; + vbData[n++] = -1.0; + vbData[n++] = 1.0; + vbData[n++] = minX; + vbData[n++] = maxY; + vbData[n++] = 1.0; + vbData[n++] = 1.0; + vbData[n++] = minX; + vbData[n++] = minY; + break; + case (gfx::SurfaceTransform::ROTATE_180): + n = 0; + vbData[n++] = -1.0; + vbData[n++] = -1.0; + vbData[n++] = minX; // uv + vbData[n++] = minY; + vbData[n++] = 1.0; + vbData[n++] = -1.0; + vbData[n++] = maxX; + vbData[n++] = minY; + vbData[n++] = -1.0; + vbData[n++] = 1.0; + vbData[n++] = minX; + vbData[n++] = maxY; + vbData[n++] = 1.0; + vbData[n++] = 1.0; + vbData[n++] = maxX; + vbData[n++] = maxY; + break; + case (gfx::SurfaceTransform::ROTATE_270): + n = 0; + vbData[n++] = -1.0; + vbData[n++] = -1.0; + vbData[n++] = minX; // uv + vbData[n++] = minY; + vbData[n++] = 1.0; + vbData[n++] = -1.0; + vbData[n++] = minX; + vbData[n++] = maxY; + vbData[n++] = -1.0; + vbData[n++] = 1.0; + vbData[n++] = maxX; + vbData[n++] = minY; + vbData[n++] = 1.0; + vbData[n++] = 1.0; + vbData[n++] = maxX; + vbData[n++] = maxY; + break; + default: + break; + } +} + +bool DeferredPipeline::createQuadInputAssembler(gfx::Buffer **quadIB, gfx::Buffer **quadVB, gfx::InputAssembler **quadIA) { + // step 1 create vertex buffer + uint vbStride = sizeof(float) * 4; + uint vbSize = vbStride * 4; + + if (*quadVB == nullptr) { + *quadVB = _device->createBuffer({gfx::BufferUsageBit::VERTEX | gfx::BufferUsageBit::TRANSFER_DST, + gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, vbSize, vbStride}); + } + + if (*quadVB == nullptr) { + return false; + } + + // step 2 create index buffer + uint ibStride = 4; + uint ibSize = ibStride * 6; + if (*quadIB == nullptr) { + *quadIB = _device->createBuffer({gfx::BufferUsageBit::INDEX | gfx::BufferUsageBit::TRANSFER_DST, + gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, ibSize, ibStride}); + } + + if (*quadIB == nullptr) { + return false; + } + + unsigned int ibData[] = {0, 1, 2, 1, 3, 2}; + (*quadIB)->update(ibData, sizeof(ibData)); + + // step 3 create input assembler + gfx::InputAssemblerInfo info; + info.attributes.push_back({"a_position", gfx::Format::RG32F}); + info.attributes.push_back({"a_texCoord", gfx::Format::RG32F}); + info.vertexBuffers.push_back(*quadVB); + info.indexBuffer = *quadIB; + *quadIA = _device->createInputAssembler(info); + return (*quadIA) != nullptr; +} + +gfx::Rect DeferredPipeline::getRenderArea(Camera *camera, bool onScreen) { + gfx::Rect renderArea; + uint w; + uint h; + if (onScreen) { + w = camera->getWindow()->hasOnScreenAttachments && static_cast(_device->getSurfaceTransform()) % 2 ? camera->height : camera->width; + h = camera->getWindow()->hasOnScreenAttachments && static_cast(_device->getSurfaceTransform()) % 2 ? camera->width : camera->height; + } else { + w = camera->width; + h = camera->height; + } + + renderArea.x = static_cast(camera->viewportX * w); + renderArea.y = static_cast(camera->viewportY * h); + renderArea.width = static_cast(camera->viewportWidth * w * _pipelineSceneData->getSharedData()->shadingScale); + renderArea.height = static_cast(camera->viewportHeight * h * _pipelineSceneData->getSharedData()->shadingScale); + return renderArea; +} + +void DeferredPipeline::destroyQuadInputAssembler() { + if (_quadIB) { + _quadIB->destroy(); + _quadIB = nullptr; + } + + if (_quadVBOnscreen) { + _quadVBOnscreen->destroy(); + _quadVBOnscreen = nullptr; + } + + if (_quadVBOffscreen) { + _quadVBOffscreen->destroy(); + _quadVBOffscreen = nullptr; + } + + if (_quadIAOnscreen) { + _quadIAOnscreen->destroy(); + _quadIAOnscreen = nullptr; + } + + if (_quadIAOffscreen) { + _quadIAOffscreen->destroy(); + _quadIAOffscreen = nullptr; + } +} + +bool DeferredPipeline::activeRenderer() { + _commandBuffers.push_back(_device->getCommandBuffer()); + auto *const sharedData = _pipelineSceneData->getSharedData(); + + gfx::SamplerInfo info{ + gfx::Filter::LINEAR, + gfx::Filter::LINEAR, + gfx::Filter::NONE, + gfx::Address::CLAMP, + gfx::Address::CLAMP, + gfx::Address::CLAMP, + }; + const auto samplerHash = SamplerLib::genSamplerHash(info); + auto *const sampler = SamplerLib::getSampler(samplerHash); + + // Main light sampler binding + this->_descriptorSet->bindSampler(SHADOWMAP::BINDING, sampler); + this->_descriptorSet->bindTexture(SHADOWMAP::BINDING, getDefaultTexture()); + + // Spot light sampler binding + this->_descriptorSet->bindSampler(SPOTLIGHTINGMAP::BINDING, sampler); + this->_descriptorSet->bindTexture(SPOTLIGHTINGMAP::BINDING, getDefaultTexture()); + + _descriptorSet->update(); + + // update global defines when all states initialized. + _macros.setValue("CC_USE_HDR", static_cast(sharedData->isHDR)); + _macros.setValue("CC_SUPPORT_FLOAT_TEXTURE", _device->hasFeature(gfx::Feature::TEXTURE_FLOAT)); + + if (!createQuadInputAssembler(&_quadIB, &_quadVBOffscreen, &_quadIAOffscreen)) { + return false; + } + + if (!createQuadInputAssembler(&_quadIB, &_quadVBOnscreen, &_quadIAOnscreen)) { + return false; + } + + gfx::RenderPassInfo gbufferPass; + + gfx::ColorAttachment color = { + gfx::Format::RGBA16F, + gfx::SampleCount::X1, + gfx::LoadOp::CLEAR, + gfx::StoreOp::STORE, + {}, + {gfx::AccessType::COLOR_ATTACHMENT_WRITE}, + }; + + for (int i = 0; i < 4; i++) { + gbufferPass.colorAttachments.push_back(color); + } + + gfx::DepthStencilAttachment depth = { + _device->getDepthStencilFormat(), + gfx::SampleCount::X1, + gfx::LoadOp::CLEAR, + gfx::StoreOp::STORE, + gfx::LoadOp::CLEAR, + gfx::StoreOp::STORE, + }; + + gbufferPass.depthStencilAttachment = depth; + _gbufferRenderPass = _device->createRenderPass(gbufferPass); + + gfx::ColorAttachment cAttch = { + gfx::Format::RGBA16F, + gfx::SampleCount::X1, + gfx::LoadOp::CLEAR, + gfx::StoreOp::STORE, + {}, + {gfx::AccessType::COLOR_ATTACHMENT_WRITE}, + }; + + gfx::RenderPassInfo lightPass; + lightPass.colorAttachments.push_back(cAttch); + + lightPass.depthStencilAttachment = { + _device->getDepthStencilFormat(), + gfx::SampleCount::X1, + gfx::LoadOp::LOAD, + gfx::StoreOp::DISCARD, + gfx::LoadOp::DISCARD, + gfx::StoreOp::DISCARD, + {gfx::AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE}, + }; + + _lightingRenderPass = _device->createRenderPass(lightPass); + + if (_device->getSurfaceTransform() == gfx::SurfaceTransform::IDENTITY || + _device->getSurfaceTransform() == gfx::SurfaceTransform::ROTATE_180) { + _width = _device->getWidth(); + _height = _device->getHeight(); + } else { + _width = _device->getHeight(); + _height = _device->getWidth(); + } + + generateDeferredRenderData(); + + _descriptorSet->bindSampler( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_ALBEDOMAP), sampler); + _descriptorSet->bindSampler( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_POSITIONMAP), sampler); + _descriptorSet->bindSampler( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_NORMALMAP), sampler); + _descriptorSet->bindSampler( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_EMISSIVEMAP), sampler); + _descriptorSet->bindSampler( + static_cast(PipelineGlobalBindings::SAMPLER_LIGHTING_RESULTMAP), sampler); + + return true; +} + +void DeferredPipeline::resize(uint width, uint height) { + if (_width == width && _height == height) { + return; + } + _width = width; + _height = height; + destroyDeferredData(); + generateDeferredRenderData(); +} + +void DeferredPipeline::generateDeferredRenderData() { + _deferredRenderData = CC_NEW(DeferredRenderData); + + gfx::TextureInfo info = { + gfx::TextureType::TEX2D, + gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED, + gfx::Format::RGBA16F, + _width, + _height, + }; + + for (int i = 0; i < 4; i++) { + gfx::Texture *tex = _device->createTexture(info); + _deferredRenderData->gbufferRenderTargets.push_back(tex); + } + + info.usage = gfx::TextureUsageBit::DEPTH_STENCIL_ATTACHMENT; + info.format = _device->getDepthStencilFormat(); + _deferredRenderData->depthTex = _device->createTexture(info); + + gfx::FramebufferInfo gbufferInfo = { + _gbufferRenderPass, + _deferredRenderData->gbufferRenderTargets, + _deferredRenderData->depthTex, + }; + + _deferredRenderData->gbufferFrameBuffer = _device->createFramebuffer(gbufferInfo); + + gfx::TextureInfo rtInfo = { + gfx::TextureType::TEX2D, + gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED, + gfx::Format::RGBA16F, + _width, + _height, + }; + _deferredRenderData->lightingRenderTarget = _device->createTexture(rtInfo); + + gfx::FramebufferInfo lightingInfo; + lightingInfo.renderPass = _lightingRenderPass; + lightingInfo.colorTextures.push_back(_deferredRenderData->lightingRenderTarget); + lightingInfo.depthStencilTexture = _deferredRenderData->depthTex; + _deferredRenderData->lightingFrameBuff = _device->createFramebuffer(lightingInfo); + + _descriptorSet->bindTexture( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_ALBEDOMAP), _deferredRenderData->gbufferFrameBuffer->getColorTextures()[0]); + _descriptorSet->bindTexture( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_POSITIONMAP), _deferredRenderData->gbufferFrameBuffer->getColorTextures()[1]); + _descriptorSet->bindTexture( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_NORMALMAP), _deferredRenderData->gbufferFrameBuffer->getColorTextures()[2]); + _descriptorSet->bindTexture( + static_cast(PipelineGlobalBindings::SAMPLER_GBUFFER_EMISSIVEMAP), _deferredRenderData->gbufferFrameBuffer->getColorTextures()[3]); + + _descriptorSet->bindTexture( + static_cast(PipelineGlobalBindings::SAMPLER_LIGHTING_RESULTMAP), + _deferredRenderData->lightingFrameBuff->getColorTextures()[0]); +} + +void DeferredPipeline::destroy() { + destroyQuadInputAssembler(); + + if (_descriptorSet) { + _descriptorSet->getBuffer(UBOGlobal::BINDING)->destroy(); + _descriptorSet->getBuffer(UBOCamera::BINDING)->destroy(); + _descriptorSet->getBuffer(UBOShadow::BINDING)->destroy(); + _descriptorSet->getSampler(SHADOWMAP::BINDING)->destroy(); + _descriptorSet->getTexture(SHADOWMAP::BINDING)->destroy(); + _descriptorSet->getSampler(SPOTLIGHTINGMAP::BINDING)->destroy(); + _descriptorSet->getTexture(SPOTLIGHTINGMAP::BINDING)->destroy(); + } + + for (auto &it : _renderPasses) { + it.second->destroy(); + } + _renderPasses.clear(); + + _commandBuffers.clear(); + + _gbufferRenderPass = nullptr; + _lightingRenderPass = nullptr; + + RenderPipeline::destroy(); +} + +void DeferredPipeline::destroyDeferredData() { + if (_deferredRenderData->gbufferFrameBuffer) { + _deferredRenderData->gbufferFrameBuffer->destroy(); + } + + if (_deferredRenderData->lightingFrameBuff) { + _deferredRenderData->lightingFrameBuff->destroy(); + } + + if (_deferredRenderData->lightingRenderTarget) { + _deferredRenderData->lightingRenderTarget->destroy(); + } + + _deferredRenderData->gbufferRenderTargets.clear(); + + CC_DELETE(_deferredRenderData); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h new file mode 100644 index 0000000000..f512a438aa --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/DeferredPipeline.h @@ -0,0 +1,110 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include + +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXInputAssembler.h" +#include "pipeline/RenderPipeline.h" +#include "pipeline/helper/SharedMemory.h" + +namespace cc { +namespace pipeline { +struct UBOGlobal; +struct UBOCamera; +struct UBOShadow; +struct Fog; +struct Ambient; +struct Skybox; +struct Shadows; +struct Sphere; +struct Camera; + +struct CC_DLL DeferredRenderData { + gfx::TextureList gbufferRenderTargets; + gfx::Framebuffer *gbufferFrameBuffer = nullptr; + gfx::Framebuffer *lightingFrameBuff = nullptr; + gfx::Texture * lightingRenderTarget = nullptr; + gfx::Texture * depthTex = nullptr; +}; + +class CC_DLL DeferredPipeline : public RenderPipeline { +public: + DeferredPipeline() = default; + ~DeferredPipeline() override = default; + + bool initialize(const RenderPipelineInfo &info) override; + void destroy() override; + bool activate() override; + void render(const vector &cameras) override; + void resize(uint width, uint height) override; + + gfx::RenderPass *getOrCreateRenderPass(gfx::ClearFlags clearFlags); + + CC_INLINE gfx::Buffer *getLightsUBO() const { return _lightsUBO; } + CC_INLINE const LightList &getValidLights() const { return _validLights; } + CC_INLINE const gfx::BufferList &getLightBuffers() const { return _lightBuffers; } + CC_INLINE const UintList &getLightIndexOffsets() const { return _lightIndexOffsets; } + CC_INLINE const UintList &getLightIndices() const { return _lightIndices; } + gfx::InputAssembler * getQuadIAOnScreen() { return _quadIAOnscreen; } + gfx::InputAssembler * getQuadIAOffScreen() { return _quadIAOffscreen; } + gfx::Rect getRenderArea(Camera *camera, bool onScreen); + CC_INLINE DeferredRenderData *getDeferredRenderData() { return _deferredRenderData; }; + void updateQuadVertexData(const gfx::Rect &renderArea); + void genQuadVertexData(gfx::SurfaceTransform surfaceTransform, const gfx::Rect &renderArea, float *data); + +private: + bool activeRenderer(); + bool createQuadInputAssembler(gfx::Buffer **quadIB, gfx::Buffer **quadVB, gfx::InputAssembler **quadIA); + void destroyQuadInputAssembler(); + void destroyDeferredData(); + void generateDeferredRenderData(); + + gfx::Buffer * _lightsUBO = nullptr; + LightList _validLights; + gfx::BufferList _lightBuffers; + UintList _lightIndexOffsets; + UintList _lightIndices; + map _renderPasses; + gfx::Rect _lastUsedRenderArea; + + // light stage + gfx::Buffer * _quadIB = nullptr; + gfx::Buffer * _quadVBOnscreen = nullptr; + gfx::Buffer * _quadVBOffscreen = nullptr; + gfx::InputAssembler *_quadIAOnscreen = nullptr; + gfx::InputAssembler *_quadIAOffscreen = nullptr; + + DeferredRenderData *_deferredRenderData = nullptr; + gfx::RenderPass * _gbufferRenderPass = nullptr; + gfx::RenderPass * _lightingRenderPass = nullptr; + uint _width; + uint _height; +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp b/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp new file mode 100644 index 0000000000..8d3ebac326 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/GbufferFlow.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GbufferFlow.h" +#include "DeferredPipeline.h" +#include "GbufferStage.h" +#include "pipeline/SceneCulling.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXRenderPass.h" + +namespace cc { +namespace pipeline { +RenderFlowInfo GbufferFlow::initInfo = { + "GbufferFlow", + static_cast(DeferredFlowPriority::GBUFFER), + static_cast(RenderFlowTag::SCENE), + {}, +}; +const RenderFlowInfo &GbufferFlow::getInitializeInfo() { return GbufferFlow::initInfo; } + +GbufferFlow::~GbufferFlow() = default; + +bool GbufferFlow::initialize(const RenderFlowInfo &info) { + RenderFlow::initialize(info); + + if (_stages.empty()) { + auto *gbufferStage = CC_NEW(GbufferStage); + gbufferStage->initialize(GbufferStage::getInitializeInfo()); + _stages.emplace_back(gbufferStage); + } + + return true; +} + +void GbufferFlow::activate(RenderPipeline *pipeline) { + RenderFlow::activate(pipeline); +} + +void GbufferFlow::render(Camera *camera) { + RenderFlow::render(camera); +} + +void GbufferFlow::destroy() { + RenderFlow::destroy(); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/GbufferFlow.h b/native/cocos/renderer/pipeline/deferred/GbufferFlow.h new file mode 100644 index 0000000000..6ca2215ece --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/GbufferFlow.h @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "../RenderFlow.h" + +namespace cc { +namespace pipeline { + +struct Camera; +class GbufferStage; + +class CC_DLL GbufferFlow : public RenderFlow { +public: + static const RenderFlowInfo &getInitializeInfo(); + + GbufferFlow() = default; + ~GbufferFlow() override; + + bool initialize(const RenderFlowInfo &info) override; + void activate(RenderPipeline *pipeline) override; + void destroy() override; + void render(Camera *camera) override; + +private: + static RenderFlowInfo initInfo; +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp b/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp new file mode 100644 index 0000000000..22812e3d88 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/GbufferStage.cpp @@ -0,0 +1,182 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "GbufferStage.h" +#include "GbufferFlow.h" +#include "../BatchedBuffer.h" +#include "../InstancedBuffer.h" +#include "../PlanarShadowQueue.h" +#include "../RenderBatchedQueue.h" +#include "../RenderInstancedQueue.h" +#include "../RenderQueue.h" +#include "../helper/SharedMemory.h" +#include "DeferredPipeline.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" + +namespace cc { +namespace pipeline { +namespace { +void srgbToLinear(gfx::Color *out, const gfx::Color &gamma) { + out->x = gamma.x * gamma.x; + out->y = gamma.y * gamma.y; + out->z = gamma.z * gamma.z; +} + +void linearToSrgb(gfx::Color *out, const gfx::Color &linear) { + out->x = std::sqrt(linear.x); + out->y = std::sqrt(linear.y); + out->z = std::sqrt(linear.z); +} +} // namespace + +RenderStageInfo GbufferStage::initInfo = { + "GbufferStage", + static_cast(DeferredStagePriority::GBUFFER), + static_cast(RenderFlowTag::SCENE), + {{false, RenderQueueSortMode::FRONT_TO_BACK, {"default"}}, + {true, RenderQueueSortMode::BACK_TO_FRONT, {"default", "planarShadow"}}}}; +const RenderStageInfo &GbufferStage::getInitializeInfo() { return GbufferStage::initInfo; } + +GbufferStage::GbufferStage() { + _batchedQueue = CC_NEW(RenderBatchedQueue); + _instancedQueue = CC_NEW(RenderInstancedQueue); +} + +GbufferStage::~GbufferStage() = default; + +bool GbufferStage::initialize(const RenderStageInfo &info) { + RenderStage::initialize(info); + _renderQueueDescriptors = info.renderQueues; + _phaseID = getPhaseID("deferred"); + return true; +} + +void GbufferStage::activate(RenderPipeline *pipeline, RenderFlow *flow) { + RenderStage::activate(pipeline, flow); + for (const auto &descriptor : _renderQueueDescriptors) { + uint phase = 0; + for (const auto &stage : descriptor.stages) { + phase |= getPhaseID(stage); + } + + std::function sortFunc = opaqueCompareFn; + switch (descriptor.sortMode) { + case RenderQueueSortMode::BACK_TO_FRONT: + sortFunc = transparentCompareFn; + break; + case RenderQueueSortMode::FRONT_TO_BACK: + sortFunc = opaqueCompareFn; + default: + break; + } + + RenderQueueCreateInfo info = {descriptor.isTransparent, phase, sortFunc}; + _renderQueues.emplace_back(CC_NEW(RenderQueue(std::move(info)))); + } + + _planarShadowQueue = CC_NEW(PlanarShadowQueue(_pipeline)); +} + +void GbufferStage::destroy() { + CC_SAFE_DELETE(_batchedQueue); + CC_SAFE_DELETE(_instancedQueue); + CC_SAFE_DELETE(_planarShadowQueue); + RenderStage::destroy(); +} + +void GbufferStage::render(Camera *camera) { + _instancedQueue->clear(); + _batchedQueue->clear(); + auto *pipeline = static_cast(_pipeline); + const auto &renderObjects = _pipeline->getPipelineSceneData()->getRenderObjects(); + if (renderObjects.empty()) { + return; + } + + for (auto *queue : _renderQueues) { + queue->clear(); + } + + uint m = 0; + uint p = 0; + size_t k = 0; + for (auto ro : renderObjects) { + const auto *const model = ro.model; + const auto *const subModelID = model->getSubModelID(); + const auto subModelCount = subModelID[0]; + for (m = 1; m <= subModelCount; ++m) { + const auto *const subModel = cc::pipeline::ModelView::getSubModelView(subModelID[m]); + for (p = 0; p < subModel->passCount; ++p) { + const PassView *pass = subModel->getPassView(p); + + if (pass->phase != _phaseID) continue; + if (pass->getBatchingScheme() == BatchingSchemes::INSTANCING) { + auto *instancedBuffer = InstancedBuffer::get(subModel->passID[p]); + instancedBuffer->merge(model, subModel, p); + _instancedQueue->add(instancedBuffer); + } else if (pass->getBatchingScheme() == BatchingSchemes::VB_MERGING) { + auto *batchedBuffer = BatchedBuffer::get(subModel->passID[p]); + batchedBuffer->merge(subModel, p, model); + _batchedQueue->add(batchedBuffer); + } else { + for (k = 0; k < _renderQueues.size(); k++) { + _renderQueues[k]->insertRenderPass(ro, m, p); + } + } + } + } + } + for (auto *queue : _renderQueues) { + queue->sort(); + } + + auto *cmdBuff = pipeline->getCommandBuffers()[0]; + + _instancedQueue->uploadBuffers(cmdBuff); + _batchedQueue->uploadBuffers(cmdBuff); + + // render area is not oriented + _renderArea = pipeline->getRenderArea(camera, false); + pipeline->updateQuadVertexData(_renderArea); + auto *const deferredData = pipeline->getDeferredRenderData(); + auto *framebuffer = deferredData->gbufferFrameBuffer; + auto *renderPass = framebuffer->getRenderPass(); + + cmdBuff->beginRenderPass(renderPass, framebuffer, _renderArea, _clearColors, camera->clearDepth, camera->clearStencil); + cmdBuff->bindDescriptorSet(globalSet, _pipeline->getDescriptorSet()); + + _renderQueues[0]->recordCommandBuffer(_device, renderPass, cmdBuff); + _instancedQueue->recordCommandBuffer(_device, renderPass, cmdBuff); + _batchedQueue->recordCommandBuffer(_device, renderPass, cmdBuff); + //_renderQueues[1]->recordCommandBuffer(_device, renderPass, cmdBuff); + + cmdBuff->endRenderPass(); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/GbufferStage.h b/native/cocos/renderer/pipeline/deferred/GbufferStage.h new file mode 100644 index 0000000000..546d10f161 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/GbufferStage.h @@ -0,0 +1,64 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "pipeline/RenderStage.h" +#include "gfx-base/GFXFramebuffer.h" + +namespace cc { +namespace pipeline { + +class RenderFlow; +class RenderBatchedQueue; +class RenderInstancedQueue; +class RenderAdditiveLightQueue; +class PlanarShadowQueue; +struct Camera; +struct DeferredRenderData; + +class CC_DLL GbufferStage : public RenderStage { +public: + static const RenderStageInfo &getInitializeInfo(); + + GbufferStage(); + ~GbufferStage() override; + + bool initialize(const RenderStageInfo &info) override; + void activate(RenderPipeline *pipeline, RenderFlow *flow) override; + void destroy() override; + void render(Camera *camera) override; + +private: + static RenderStageInfo initInfo; + PlanarShadowQueue *_planarShadowQueue = nullptr; + RenderBatchedQueue *_batchedQueue = nullptr; + RenderInstancedQueue *_instancedQueue = nullptr; + gfx::Rect _renderArea; + uint _phaseID = 0; +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp b/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp new file mode 100644 index 0000000000..31dcac3214 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/LightingFlow.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "LightingFlow.h" +#include "DeferredPipeline.h" +#include "LightingStage.h" +#include "../SceneCulling.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXDevice.h" + +namespace cc { +namespace pipeline { +RenderFlowInfo LightingFlow::_initInfo = { + "LightingFlow", + static_cast(DeferredFlowPriority::LIGHTING), + static_cast(RenderFlowTag::SCENE), + {}, +}; +const RenderFlowInfo &LightingFlow::getInitializeInfo() { return LightingFlow::_initInfo; } + +LightingFlow::~LightingFlow() { +} + +bool LightingFlow::initialize(const RenderFlowInfo &info) { + RenderFlow::initialize(info); + + if (_stages.size() == 0) { + auto stage = CC_NEW(LightingStage); + stage->initialize(LightingStage::getInitializeInfo()); + _stages.emplace_back(stage); + } + + return true; +} + +void LightingFlow::activate(RenderPipeline *pipeline) { + RenderFlow::activate(pipeline); +} + +void LightingFlow::render(Camera *camera) { + auto pipeline = dynamic_cast(_pipeline); + RenderFlow::render(camera); +} + +void LightingFlow::destroy() { + RenderFlow::destroy(); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/LightingFlow.h b/native/cocos/renderer/pipeline/deferred/LightingFlow.h new file mode 100644 index 0000000000..ae04856e1e --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/LightingFlow.h @@ -0,0 +1,52 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "../RenderFlow.h" + +namespace cc { +namespace pipeline { + +class RenderView; + +class CC_DLL LightingFlow : public RenderFlow { +public: + static const RenderFlowInfo &getInitializeInfo(); + + LightingFlow() = default; + virtual ~LightingFlow(); + + virtual bool initialize(const RenderFlowInfo &info) override; + virtual void activate(RenderPipeline *pipeline) override; + virtual void destroy() override; + virtual void render(Camera *camera) override; + +private: + static RenderFlowInfo _initInfo; +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/LightingStage.cpp b/native/cocos/renderer/pipeline/deferred/LightingStage.cpp new file mode 100644 index 0000000000..533e42e409 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/LightingStage.cpp @@ -0,0 +1,318 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "LightingStage.h" +#include "LightingFlow.h" +#include "../BatchedBuffer.h" +#include "../InstancedBuffer.h" +#include "../PlanarShadowQueue.h" +#include "../RenderBatchedQueue.h" +#include "../RenderInstancedQueue.h" +#include "../RenderQueue.h" +#include "../helper/SharedMemory.h" +#include "DeferredPipeline.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "../PipelineStateManager.h" + +namespace cc { +namespace pipeline { +namespace { +void srgbToLinear(gfx::Color *out, const gfx::Color &gamma) { + out->x = gamma.x * gamma.x; + out->y = gamma.y * gamma.y; + out->z = gamma.z * gamma.z; +} + +void linearToSrgb(gfx::Color *out, const gfx::Color &linear) { + out->x = std::sqrt(linear.x); + out->y = std::sqrt(linear.y); + out->z = std::sqrt(linear.z); +} +} // namespace + +RenderStageInfo LightingStage::initInfo = { + "LightingStage", + static_cast(DeferredStagePriority::LIGHTING), + static_cast(RenderFlowTag::SCENE), +}; + +const RenderStageInfo &LightingStage::getInitializeInfo() { return LightingStage::initInfo; } + +LightingStage::LightingStage() = default; + +LightingStage::~LightingStage() { + _deferredLitsBufs->destroy(); + _deferredLitsBufs = nullptr; + _deferredLitsBufView->destroy(); + _deferredLitsBufView = nullptr; +} + +bool LightingStage::initialize(const RenderStageInfo &info) { + RenderStage::initialize(info); + _renderQueueDescriptors = info.renderQueues; + _phaseID = getPhaseID("default"); + return true; +} + +void LightingStage::gatherLights(Camera *camera) { + auto *pipeline = dynamic_cast(_pipeline); + if (!pipeline) { + return; + } + + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + + gfx::CommandBuffer *cmdBuf = pipeline->getCommandBuffers()[0]; + const auto *scene = camera->getScene(); + const auto *const sphereLightArrayID = scene->getSphereLightArrayID(); + auto sphereCount = sphereLightArrayID ? sphereLightArrayID[0] : 0; + const auto *const spotLightArrayID = scene->getSpotLightArrayID(); + auto spotCount = spotLightArrayID ? spotLightArrayID[0] : 0; + + Sphere sphere; + auto exposure = camera->exposure; + uint idx = 0; + int elementLen = sizeof(cc::Vec4) / sizeof(float); + uint fieldLen = elementLen * _maxDeferredLights; + uint offset = 0; + cc::Vec4 tmpArray; + + for (uint i = 1; i <= sphereCount && idx < _maxDeferredLights; i++, idx++) { + const auto *const light = scene->getSphereLight(sphereLightArrayID[i]); + sphere.setCenter(light->position); + sphere.setRadius(light->range); + if (!sphere_frustum(&sphere, camera->getFrustum())) { + continue; + } + // position + offset = idx * elementLen; + _lightBufferData[offset] = light->position.x; + _lightBufferData[offset + 1] = light->position.y; + _lightBufferData[offset + 2] = light->position.z; + _lightBufferData[offset + 3] = 0; + + // color + offset = idx * elementLen + fieldLen; + tmpArray.set(light->color.x, light->color.y, light->color.z, 0); + if (light->useColorTemperature) { + tmpArray.x *= light->colorTemperatureRGB.x; + tmpArray.y *= light->colorTemperatureRGB.y; + tmpArray.z *= light->colorTemperatureRGB.z; + } + + if (sharedData->isHDR) { + tmpArray.w = light->luminance * sharedData->fpScale * _lightMeterScale; + } else { + tmpArray.w = light->luminance * exposure * _lightMeterScale; + } + + _lightBufferData[offset + 0] = tmpArray.x; + _lightBufferData[offset + 1] = tmpArray.y; + _lightBufferData[offset + 2] = tmpArray.z; + _lightBufferData[offset + 3] = tmpArray.w; + + // size range angle + offset = idx * elementLen + fieldLen * 2; + _lightBufferData[offset] = light->size; + _lightBufferData[offset + 1] = light->range; + _lightBufferData[offset + 2] = 0; + } + + for (uint i = 1; i <= spotCount && idx < _maxDeferredLights; i++, idx++) { + const auto *const light = scene->getSpotLight(spotLightArrayID[i]); + sphere.setCenter(light->position); + sphere.setRadius(light->range); + if (!sphere_frustum(&sphere, camera->getFrustum())) { + continue; + } + // position + offset = idx * elementLen; + _lightBufferData[offset] = light->position.x; + _lightBufferData[offset + 1] = light->position.y; + _lightBufferData[offset + 2] = light->position.z; + _lightBufferData[offset + 3] = 1; + + // color + offset = idx * elementLen + fieldLen; + tmpArray.set(light->color.x, light->color.y, light->color.z, 0); + if (light->useColorTemperature) { + tmpArray.x *= light->colorTemperatureRGB.x; + tmpArray.y *= light->colorTemperatureRGB.y; + tmpArray.z *= light->colorTemperatureRGB.z; + } + + if (sharedData->isHDR) { + tmpArray.w = light->luminance * sharedData->fpScale * _lightMeterScale; + } else { + tmpArray.w = light->luminance * exposure * _lightMeterScale; + } + + _lightBufferData[offset + 0] = tmpArray.x; + _lightBufferData[offset + 1] = tmpArray.y; + _lightBufferData[offset + 2] = tmpArray.z; + _lightBufferData[offset + 3] = tmpArray.w; + + // size range angle + offset = idx * elementLen + fieldLen * 2; + _lightBufferData[offset] = light->size; + _lightBufferData[offset + 1] = light->range; + _lightBufferData[offset + 2] = light->spotAngle; + + // dir + offset = idx * elementLen + fieldLen * 3; + _lightBufferData[offset] = light->direction.x; + _lightBufferData[offset + 1] = light->direction.y; + _lightBufferData[offset + 2] = light->direction.z; + } + + // the count of lights is set to cc_lightDir[0].w + _lightBufferData[fieldLen * 3 + 3] = static_cast(idx); + cmdBuf->updateBuffer(_deferredLitsBufs, _lightBufferData.data()); +} + +void LightingStage::initLightingBuffer() { + auto *const device = _pipeline->getDevice(); + + // color/pos/dir/angle 都是vec4存储, 最后一个vec4只要x存储光源个数 + uint totalSize = sizeof(Vec4) * 4 * _maxDeferredLights; + totalSize = static_cast(std::ceil(static_cast(totalSize) / device->getCapabilities().uboOffsetAlignment) * device->getCapabilities().uboOffsetAlignment); + + // create lighting buffer and view + if (_deferredLitsBufs == nullptr) { + gfx::BufferInfo bfInfo = { + gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, + gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, + totalSize, + static_cast(device->getCapabilities().uboOffsetAlignment), + }; + _deferredLitsBufs = device->createBuffer(bfInfo); + assert(_deferredLitsBufs != nullptr); + } + + if (_deferredLitsBufView == nullptr) { + gfx::BufferViewInfo bvInfo = {_deferredLitsBufs, 0, totalSize}; + _deferredLitsBufView = device->createBuffer(bvInfo); + assert(_deferredLitsBufView != nullptr); + _descriptorSet->bindBuffer(static_cast(ModelLocalBindings::UBO_FORWARD_LIGHTS), _deferredLitsBufView); + } + + _lightBufferData.resize(totalSize / sizeof(float)); +} + +void LightingStage::activate(RenderPipeline *pipeline, RenderFlow *flow) { + RenderStage::activate(pipeline, flow); + + auto *const device = pipeline->getDevice(); + + // create descriptorset/layout + gfx::DescriptorSetLayoutInfo layoutInfo = {localDescriptorSetLayout.bindings}; + _descLayout = device->createDescriptorSetLayout(layoutInfo); + + gfx::DescriptorSetInfo setInfo = {_descLayout}; + _descriptorSet = device->createDescriptorSet(setInfo); + + // create lighting buffer and view + initLightingBuffer(); + + _planarShadowQueue = CC_NEW(PlanarShadowQueue(_pipeline)); +} + +void LightingStage::destroy() { + CC_SAFE_DELETE(_planarShadowQueue); + RenderStage::destroy(); +} + +void LightingStage::render(Camera *camera) { + auto *pipeline = static_cast(_pipeline); + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + const auto &renderObjects = sceneData->getRenderObjects(); + + if (renderObjects.empty()) { + return; + } + + auto *cmdBuff = pipeline->getCommandBuffers()[0]; + + // lighting info + gatherLights(camera); + _descriptorSet->update(); + + vector dynamicOffsets = {0}; + cmdBuff->bindDescriptorSet(static_cast(SetIndex::LOCAL), _descriptorSet, dynamicOffsets); + + // draw quad + gfx::Rect renderArea = pipeline->getRenderArea(camera, false); + + gfx::Color clearColor = {0.0, 0.0, 0.0, 1.0}; + if (camera->clearFlag & static_cast( gfx::ClearFlagBit::COLOR)) { + if (sharedData->isHDR) { + srgbToLinear(&clearColor, camera->clearColor); + const auto scale = sharedData->fpScale / camera->exposure; + clearColor.x *= scale; + clearColor.y *= scale; + clearColor.z *= scale; + } else { + clearColor = camera->clearColor; + } + } + + clearColor.w = 0; + + auto *const deferredData = pipeline->getDeferredRenderData(); + auto *frameBuffer = deferredData->lightingFrameBuff; + auto *renderPass = frameBuffer->getRenderPass(); + + cmdBuff->beginRenderPass(renderPass, frameBuffer, renderArea, &clearColor, + camera->clearDepth, camera->clearStencil); + + cmdBuff->bindDescriptorSet(static_cast(SetIndex::GLOBAL), pipeline->getDescriptorSet()); + + // get pso and draw quad + PassView *pass = sceneData->getSharedData()->getDeferredLightPass(); + gfx::Shader *shader = sceneData->getSharedData()->getDeferredLightPassShader(); + + gfx::InputAssembler* inputAssembler = pipeline->getQuadIAOffScreen(); + gfx::PipelineState *pState = PipelineStateManager::getOrCreatePipelineState( + pass, shader, inputAssembler, renderPass); + assert(pState != nullptr); + + cmdBuff->bindPipelineState(pState); + cmdBuff->bindInputAssembler(inputAssembler); + cmdBuff->draw(inputAssembler); + + // planerQueue + _planarShadowQueue->recordCommandBuffer(_device, renderPass, cmdBuff); + + cmdBuff->endRenderPass(); +} + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/LightingStage.h b/native/cocos/renderer/pipeline/deferred/LightingStage.h new file mode 100644 index 0000000000..6cae0045f9 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/LightingStage.h @@ -0,0 +1,75 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "../RenderStage.h" + +namespace cc { +namespace pipeline { + +class RenderFlow; +class RenderBatchedQueue; +class RenderInstancedQueue; +class RenderAdditiveLightQueue; +class PlanarShadowQueue; +struct Camera; +struct DeferredRenderData; + +class CC_DLL LightingStage : public RenderStage { +public: + static const RenderStageInfo &getInitializeInfo(); + + LightingStage(); + ~LightingStage() override; + + bool initialize(const RenderStageInfo &info) override; + void activate(RenderPipeline *pipeline, RenderFlow *flow) override; + void destroy() override; + void render(Camera *camera) override; + + void initLightingBuffer(); + +private: + void gatherLights(Camera *camera); + + static RenderStageInfo initInfo; + PlanarShadowQueue *_planarShadowQueue = nullptr; + gfx::Rect _renderArea; + uint _phaseID = 0; + + gfx::Buffer *_deferredLitsBufs = nullptr; + gfx::Buffer *_deferredLitsBufView = nullptr; + std::vector _lightBufferData; + uint _lightBufferStride = 0; + uint _lightBufferElementCount = 0; + float _lightMeterScale = 10000.0; + gfx::DescriptorSet *_descriptorSet = nullptr; + gfx::DescriptorSetLayout *_descLayout = nullptr; + uint _maxDeferredLights = UBODeferredLight::LIGHTS_PER_PASS; +}; + +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp b/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp new file mode 100644 index 0000000000..439a4c78ab --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/PostprocessStage.cpp @@ -0,0 +1,160 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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 "PostprocessStage.h" +#include "DeferredPipeline.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "../helper/SharedMemory.h" +#include "../PipelineStateManager.h" +#include "gfx-base/GFXDevice.h" +#include "../forward/UIPhase.h" +#include "../RenderQueue.h" + +namespace cc { +namespace pipeline { +RenderStageInfo PostprocessStage::initInfo = { + "PostprocessStage", + static_cast(DeferredStagePriority::POSTPROCESS), + 0, + {{true, RenderQueueSortMode::BACK_TO_FRONT, {"default"}}}, +}; + +PostprocessStage::PostprocessStage() { + _uiPhase = CC_NEW(UIPhase); +} + +bool PostprocessStage::initialize(const RenderStageInfo &info) { + RenderStage::initialize(info); + _renderQueueDescriptors = info.renderQueues; + return true; +} + +void PostprocessStage::activate(RenderPipeline *pipeline, RenderFlow *flow) { + RenderStage::activate(pipeline, flow); + _uiPhase->activate(pipeline); + _phaseID = getPhaseID("default"); + + for (const auto &descriptor : _renderQueueDescriptors) { + uint phase = 0; + for (const auto &stage : descriptor.stages) { + phase |= getPhaseID(stage); + } + + std::function sortFunc = opaqueCompareFn; + switch (descriptor.sortMode) { + case RenderQueueSortMode::BACK_TO_FRONT: + sortFunc = transparentCompareFn; + break; + case RenderQueueSortMode::FRONT_TO_BACK: + sortFunc = opaqueCompareFn; + default: + break; + } + + RenderQueueCreateInfo info = {descriptor.isTransparent, phase, sortFunc}; + _renderQueues.emplace_back(CC_NEW(RenderQueue(std::move(info)))); + } +} + +void PostprocessStage::destroy() { +} + +void PostprocessStage::render(Camera *camera) { + auto *pp = dynamic_cast(_pipeline); + assert(pp != nullptr); + gfx::Device *device = pp->getDevice(); + gfx::CommandBuffer *cmdBf = pp->getCommandBuffers()[0]; + + _pipeline->getPipelineUBO()->updateCameraUBO(camera, camera->getWindow()->hasOffScreenAttachments); + gfx::Rect renderArea = pp->getRenderArea(camera, !camera->getWindow()->hasOffScreenAttachments); + + if (hasFlag(static_cast(camera->clearFlag), gfx::ClearFlagBit::COLOR)) { + _clearColors[0].x = camera->clearColor.x; + _clearColors[0].y = camera->clearColor.y; + _clearColors[0].z = camera->clearColor.z; + } + + _clearColors[0].w = camera->clearColor.w; + + gfx::Framebuffer *fb = camera->getWindow()->getFramebuffer(); + const auto &colorTextures = fb->getColorTextures(); + gfx::RenderPass *rp = !colorTextures.empty() && colorTextures[0] ? + fb->getRenderPass() : pp->getOrCreateRenderPass(static_cast(camera->clearFlag)); + + cmdBf->beginRenderPass(rp, fb, renderArea, _clearColors, camera->clearDepth, camera->clearStencil); + cmdBf->bindDescriptorSet(static_cast(SetIndex::GLOBAL), pp->getDescriptorSet()); + + // post proces + auto *const sceneData = _pipeline->getPipelineSceneData(); + PassView *pv = sceneData->getSharedData()->getDeferredPostPass(); + gfx::Shader *sd = sceneData->getSharedData()->getDeferredPostPassShader(); + const auto &renderObjects = sceneData->getRenderObjects(); + + if (!renderObjects.empty()) { + gfx::InputAssembler *ia = camera->getWindow()->hasOffScreenAttachments ? pp->getQuadIAOffScreen() : pp->getQuadIAOnScreen(); + gfx::PipelineState *pso = PipelineStateManager::getOrCreatePipelineState(pv, sd, ia, rp); + assert(pso != nullptr); + + cmdBf->bindPipelineState(pso); + cmdBf->bindInputAssembler(ia); + cmdBf->draw(ia); + } + + // transparent + for (auto *queue : _renderQueues) { + queue->clear(); + } + + uint m = 0; + uint p = 0; + size_t k = 0; + for (auto ro : renderObjects) { + const auto *const model = ro.model; + const auto *const subModelID = model->getSubModelID(); + const auto subModelCount = subModelID[0]; + for (m = 1; m <= subModelCount; ++m) { + const auto *subModel = cc::pipeline::ModelView::getSubModelView(subModelID[m]); + for (p = 0; p < subModel->passCount; ++p) { + const PassView *pass = subModel->getPassView(p); + // TODO(xwx): need fallback of ulit and gizmo material. + if (pass->phase != _phaseID) continue; + for (k = 0; k < _renderQueues.size(); k++) { + _renderQueues[k]->insertRenderPass(ro, m, p); + } + } + } + } + + for (auto *queue : _renderQueues) { + queue->sort(); + queue->recordCommandBuffer(_device, rp, cmdBf); + } + + _uiPhase->render(camera, rp); + cmdBf->endRenderPass(); +} +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/deferred/PostprocessStage.h b/native/cocos/renderer/pipeline/deferred/PostprocessStage.h new file mode 100644 index 0000000000..6cefa81a08 --- /dev/null +++ b/native/cocos/renderer/pipeline/deferred/PostprocessStage.h @@ -0,0 +1,54 @@ +/**************************************************************************** + Copyright (c) 2020-2021 Huawei Technologies Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + +#pragma once + +#include "../RenderStage.h" + +namespace cc { +namespace pipeline { + +struct Camera; +class UIPhase; + +class CC_DLL PostprocessStage : public RenderStage { +public: + PostprocessStage(); + ~PostprocessStage() override = default;; + + bool initialize(const RenderStageInfo &info) override; + void activate(RenderPipeline *pipeline, RenderFlow *flow) override; + void destroy() override; + void render(Camera *camera) override; + +private: + gfx::Rect _renderArea; + static RenderStageInfo initInfo; + UIPhase *_uiPhase = nullptr; + + uint _phaseID = 0; +}; +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/forward/ForwardFlow.cpp b/native/cocos/renderer/pipeline/forward/ForwardFlow.cpp index 39a12502ca..1ff767d9ce 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardFlow.cpp +++ b/native/cocos/renderer/pipeline/forward/ForwardFlow.cpp @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "ForwardFlow.h" #include "ForwardPipeline.h" #include "ForwardStage.h" -#include "SceneCulling.h" +#include "../SceneCulling.h" namespace cc { namespace pipeline { @@ -56,8 +58,6 @@ void ForwardFlow::activate(RenderPipeline *pipeline) { } void ForwardFlow::render(Camera *camera) { - auto pipeline = static_cast(_pipeline); - sceneCulling(pipeline, camera); RenderFlow::render(camera); } diff --git a/native/cocos/renderer/pipeline/forward/ForwardFlow.h b/native/cocos/renderer/pipeline/forward/ForwardFlow.h index 0dc8a64336..63072a2d62 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardFlow.h +++ b/native/cocos/renderer/pipeline/forward/ForwardFlow.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "../RenderFlow.h" @@ -37,7 +39,7 @@ public: ForwardFlow() = default; virtual ~ForwardFlow(); - + virtual bool initialize(const RenderFlowInfo &info) override; virtual void activate(RenderPipeline *pipeline) override; virtual void destroy() override; diff --git a/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp b/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp index 5cb532d098..8b4b469771 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp +++ b/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp @@ -1,61 +1,62 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "ForwardPipeline.h" #include "../shadow/ShadowFlow.h" #include "ForwardFlow.h" -#include "SceneCulling.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXQueue.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXSampler.h" -#include "gfx/GFXTexture.h" +#include "../SceneCulling.h" +#include "gfx-base/GFXBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDescriptorSet.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXQueue.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXSampler.h" +#include "gfx-base/GFXTexture.h" #include "platform/Application.h" namespace cc { namespace pipeline { namespace { -#define TO_VEC3(dst, src, offset) \ - dst[offset] = src.x; \ - dst[offset + 1] = src.y; \ - dst[offset + 2] = src.z; -#define TO_VEC4(dst, src, offset) \ - dst[offset] = src.x; \ - dst[offset + 1] = src.y; \ - dst[offset + 2] = src.z; \ - dst[offset + 3] = src.w; +#define TO_VEC3(dst, src, offset) \ + (dst)[(offset) + 0] = (src).x; \ + (dst)[(offset) + 1] = (src).y; \ + (dst)[(offset) + 2] = (src).z; +#define TO_VEC4(dst, src, offset) \ + (dst)[(offset) + 0] = (src).x; \ + (dst)[(offset) + 1] = (src).y; \ + (dst)[(offset) + 2] = (src).z; \ + (dst)[(offset) + 3] = (src).w; } // namespace gfx::RenderPass *ForwardPipeline::getOrCreateRenderPass(gfx::ClearFlags clearFlags) { - if (_renderPasses.find(clearFlags) != _renderPasses.end()) { + if (_renderPasses.count(clearFlags)) { return _renderPasses[clearFlags]; } - auto device = gfx::Device::getInstance(); + auto *device = gfx::Device::getInstance(); gfx::ColorAttachment colorAttachment; gfx::DepthStencilAttachment depthStencilAttachment; colorAttachment.format = device->getColorFormat(); @@ -63,67 +64,44 @@ gfx::RenderPass *ForwardPipeline::getOrCreateRenderPass(gfx::ClearFlags clearFla depthStencilAttachment.stencilStoreOp = gfx::StoreOp::STORE; depthStencilAttachment.depthStoreOp = gfx::StoreOp::STORE; - if (!(clearFlags & gfx::ClearFlagBit::COLOR)) { - if (clearFlags & static_cast(SKYBOX_FLAG)) { + if (!hasFlag(clearFlags, gfx::ClearFlagBit::COLOR)) { + if (hasFlag(clearFlags, static_cast(skyboxFlag))) { colorAttachment.loadOp = gfx::LoadOp::DISCARD; } else { colorAttachment.loadOp = gfx::LoadOp::LOAD; - colorAttachment.beginLayout = gfx::TextureLayout::PRESENT_SRC; + colorAttachment.beginAccesses = {gfx::AccessType::PRESENT}; } } if (static_cast(clearFlags & gfx::ClearFlagBit::DEPTH_STENCIL) != gfx::ClearFlagBit::DEPTH_STENCIL) { - if (!(clearFlags & gfx::ClearFlagBit::DEPTH)) depthStencilAttachment.depthLoadOp = gfx::LoadOp::LOAD; - if (!(clearFlags & gfx::ClearFlagBit::STENCIL)) depthStencilAttachment.stencilLoadOp = gfx::LoadOp::LOAD; - depthStencilAttachment.beginLayout = gfx::TextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL; + if (!hasFlag(clearFlags, gfx::ClearFlagBit::DEPTH)) depthStencilAttachment.depthLoadOp = gfx::LoadOp::LOAD; + if (!hasFlag(clearFlags, gfx::ClearFlagBit::STENCIL)) depthStencilAttachment.stencilLoadOp = gfx::LoadOp::LOAD; + depthStencilAttachment.beginAccesses = {gfx::AccessType::DEPTH_STENCIL_ATTACHMENT_WRITE}; } - auto renderPass = device->createRenderPass({ + auto *renderPass = device->createRenderPass({ {colorAttachment}, depthStencilAttachment, + {}, + }); _renderPasses[clearFlags] = renderPass; return renderPass; } -void ForwardPipeline::setFog(uint fog) { - _fog = GET_FOG(fog); -} - -void ForwardPipeline::setAmbient(uint ambient) { - _ambient = GET_AMBIENT(ambient); -} - -void ForwardPipeline::setSkybox(uint skybox) { - _skybox = GET_SKYBOX(skybox); -} - -void ForwardPipeline::setShadows(uint shadows) { - _shadows = GET_SHADOWS(shadows); -} - -void ForwardPipeline::destroyShadowFrameBuffers() { - for (auto &pair : _shadowFrameBufferMap) { - pair.second->destroy(); - delete pair.second; - } - _shadowFrameBufferMap.clear(); -} - bool ForwardPipeline::initialize(const RenderPipelineInfo &info) { RenderPipeline::initialize(info); - if (_flows.size() == 0) { - auto shadowFlow = CC_NEW(ShadowFlow); + if (_flows.empty()) { + auto *shadowFlow = CC_NEW(ShadowFlow); shadowFlow->initialize(ShadowFlow::getInitializeInfo()); _flows.emplace_back(shadowFlow); - auto forwardFlow = CC_NEW(ForwardFlow); + auto *forwardFlow = CC_NEW(ForwardFlow); forwardFlow->initialize(ForwardFlow::getInitializeInfo()); _flows.emplace_back(forwardFlow); } - _sphere = CC_NEW(Sphere); return true; } @@ -144,226 +122,23 @@ bool ForwardPipeline::activate() { void ForwardPipeline::render(const vector &cameras) { _commandBuffers[0]->begin(); - updateGlobalUBO(); + _pipelineUBO->updateGlobalUBO(); for (const auto cameraId : cameras) { - Camera *camera = GET_CAMERA(cameraId); - updateCameraUBO(camera); - for (const auto flow : _flows) { + auto *camera = GET_CAMERA(cameraId); + sceneCulling(this, camera); + _pipelineUBO->updateCameraUBO(camera, camera->getWindow()->hasOffScreenAttachments); + for (auto *const flow : _flows) { flow->render(camera); } } _commandBuffers[0]->end(); + _device->flushCommands(_commandBuffers); _device->getQueue()->submit(_commandBuffers); } -void ForwardPipeline::updateCameraUBO(Camera *camera) { - const auto scene = camera->getScene(); - const Light *mainLight = nullptr; - if (scene->mainLightID) mainLight = scene->getMainLight(); - const auto ambient = _ambient; - const auto fog = _fog; - - auto *device = gfx::Device::getInstance(); - auto &uboCameraView = _cameraUBO; - - const auto shadingWidth = std::floor(_device->getWidth()); - const auto shadingHeight = std::floor(_device->getHeight()); - - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET] = camera->width / shadingWidth * _shadingScale; - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 1] = camera->height / shadingHeight * _shadingScale; - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 2] = 1.0 / uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET]; - uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 3] = 1.0 / uboCameraView[UBOCamera::SCREEN_SCALE_OFFSET + 1]; - - const auto exposure = camera->exposure; - uboCameraView[UBOCamera::EXPOSURE_OFFSET] = exposure; - uboCameraView[UBOCamera::EXPOSURE_OFFSET + 1] = 1.0f / exposure; - uboCameraView[UBOCamera::EXPOSURE_OFFSET + 2] = _isHDR ? 1.0f : 0.0; - uboCameraView[UBOCamera::EXPOSURE_OFFSET + 3] = _fpScale / exposure; - - if (mainLight) { - TO_VEC3(uboCameraView, mainLight->direction, UBOCamera::MAIN_LIT_DIR_OFFSET); - TO_VEC3(uboCameraView, mainLight->color, UBOCamera::MAIN_LIT_COLOR_OFFSET); - if (mainLight->useColorTemperature) { - const auto colorTempRGB = mainLight->colorTemperatureRGB; - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET] *= colorTempRGB.x; - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 1] *= colorTempRGB.y; - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 2] *= colorTempRGB.z; - } - - if (_isHDR) { - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 3] = mainLight->luminance * _fpScale; - } else { - uboCameraView[UBOCamera::MAIN_LIT_COLOR_OFFSET + 3] = mainLight->luminance * exposure; - } - } else { - TO_VEC3(uboCameraView, Vec3::UNIT_Z, UBOCamera::MAIN_LIT_DIR_OFFSET); - TO_VEC4(uboCameraView, Vec4::ZERO, UBOCamera::MAIN_LIT_COLOR_OFFSET); - } - - Vec4 skyColor = ambient->skyColor; - if (_isHDR) { - skyColor.w = ambient->skyIllum * _fpScale; - } else { - skyColor.w = ambient->skyIllum * exposure; - } - TO_VEC4(uboCameraView, skyColor, UBOCamera::AMBIENT_SKY_OFFSET); - - uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET] = ambient->groundAlbedo.x; - uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 1] = ambient->groundAlbedo.y; - uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 2] = ambient->groundAlbedo.z; - const auto envmap = _descriptorSet->getTexture((uint)PipelineGlobalBindings::SAMPLER_ENVIRONMENT); - if (envmap) uboCameraView[UBOCamera::AMBIENT_GROUND_OFFSET + 3] = envmap->getLevelCount(); - - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_OFFSET, camera->matView.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_INV_OFFSET, camera->getNode()->worldMatrix.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_OFFSET, camera->matProj.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_PROJ_INV_OFFSET, camera->matProjInv.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_OFFSET, camera->matViewProj.m, sizeof(cc::Mat4)); - memcpy(uboCameraView.data() + UBOCamera::MAT_VIEW_PROJ_INV_OFFSET, camera->matViewProjInv.m, sizeof(cc::Mat4)); - TO_VEC3(uboCameraView, camera->position, UBOCamera::CAMERA_POS_OFFSET); - - auto projectionSignY = _device->getScreenSpaceSignY(); - if (camera->getWindow()->hasOffScreenAttachments) { - projectionSignY *= _device->getUVSpaceSignY(); // need flipping if drawing on render targets - } - uboCameraView[UBOCamera::CAMERA_POS_OFFSET + 3] = projectionSignY; - - if (fog->enabled) { - TO_VEC4(uboCameraView, fog->fogColor, UBOCamera::GLOBAL_FOG_COLOR_OFFSET); - - uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET] = fog->fogStart; - uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 1] = fog->fogEnd; - uboCameraView[UBOCamera::GLOBAL_FOG_BASE_OFFSET + 2] = fog->fogDensity; - - uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET] = fog->fogTop; - uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 1] = fog->fogRange; - uboCameraView[UBOCamera::GLOBAL_FOG_ADD_OFFSET + 2] = fog->fogAtten; - } - - // update ubos - _commandBuffers[0]->updateBuffer(_descriptorSet->getBuffer(UBOCamera::BINDING), _cameraUBO.data(), UBOCamera::SIZE); -} - -void ForwardPipeline::updateShadowUBO(Camera *camera) { - const auto scene = camera->getScene(); - const Light *mainLight = nullptr; - if (scene->mainLightID) mainLight = scene->getMainLight(); - auto *device = gfx::Device::getInstance(); - const auto shadowInfo = _shadows; - if (shadowInfo->enabled) { - if (mainLight && shadowInfo->getShadowType() == ShadowType::SHADOWMAP) { - if (_shadowFrameBufferMap.count(mainLight) > 0) { - auto *texture = _shadowFrameBufferMap.at(mainLight)->getColorTextures()[0]; - if (texture) { - _descriptorSet->bindTexture(SHADOWMAP::BINDING, texture); - } - } - - const auto node = mainLight->getNode(); - cc::Mat4 matShadowCamera; - - // light proj - float x = 0.0f, y = 0.0f, farClamp = 0.0f; - if (shadowInfo->autoAdapt) { - Vec3 tmpCenter; - getShadowWorldMatrix(_sphere, node->worldRotation, mainLight->direction, matShadowCamera, tmpCenter); - - const float radius = _sphere->radius; - x = radius * shadowInfo->aspect; - y = radius; - - const float halfFar = tmpCenter.distance(_sphere->center); - farClamp = std::min(halfFar * COEFFICIENT_OF_EXPANSION, SHADOW_CAMERA_MAX_FAR); - } else { - matShadowCamera = mainLight->getNode()->worldMatrix; - - x = shadowInfo->orthoSize * shadowInfo->aspect; - y = shadowInfo->orthoSize; - - farClamp = shadowInfo->farValue; - } - - const auto matShadowView = matShadowCamera.getInversed(); - - Mat4 matShadowViewProj; - const auto projectionSinY = device->getScreenSpaceSignY() * device->getUVSpaceSignY(); - Mat4::createOrthographicOffCenter(-x, x, -y, y, shadowInfo->nearValue, farClamp, device->getClipSpaceMinZ(), projectionSinY, &matShadowViewProj); - - matShadowViewProj.multiply(matShadowView); - float shadowInfos[4] = {shadowInfo->size.x, shadowInfo->size.y, (float)shadowInfo->pcfType, shadowInfo->bias}; - memcpy(_shadowUBO.data() + UBOShadow::MAT_LIGHT_VIEW_PROJ_OFFSET, matShadowViewProj.m, sizeof(matShadowViewProj)); - memcpy(_shadowUBO.data() + UBOShadow::SHADOW_INFO_OFFSET, &shadowInfos, sizeof(shadowInfos)); - } else if (mainLight && shadowInfo->getShadowType() == ShadowType::PLANAR) { - updateDirLight(shadowInfo, mainLight, _shadowUBO); - } - - memcpy(_shadowUBO.data() + UBOShadow::SHADOW_COLOR_OFFSET, &shadowInfo->color, sizeof(Vec4)); - _commandBuffers[0]->updateBuffer(_descriptorSet->getBuffer(UBOShadow::BINDING), _shadowUBO.data(), UBOShadow::SIZE); - } - _descriptorSet->update(); -} - -void ForwardPipeline::updateGlobalUBO() { - _descriptorSet->update(); - - const auto root = GET_ROOT(); - auto &uboGlobalView = _globalUBO; - - const auto shadingWidth = std::floor(_device->getWidth()); - const auto shadingHeight = std::floor(_device->getHeight()); - - // update UBOGlobal - uboGlobalView[UBOGlobal::TIME_OFFSET] = root->cumulativeTime; - uboGlobalView[UBOGlobal::TIME_OFFSET + 1] = root->frameTime; - uboGlobalView[UBOGlobal::TIME_OFFSET + 2] = Application::getInstance()->getTotalFrames(); - - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET] = _device->getWidth(); - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 1] = _device->getHeight(); - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 2] = 1.0f / uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET]; - uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 3] = 1.0f / uboGlobalView[UBOGlobal::SCREEN_SIZE_OFFSET + 1]; - - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET] = shadingWidth; - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 1] = shadingHeight; - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 2] = 1.0f / uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET]; - uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 3] = 1.0f / uboGlobalView[UBOGlobal::NATIVE_SIZE_OFFSET + 1]; - - // update ubos - _commandBuffers[0]->updateBuffer(_descriptorSet->getBuffer(UBOGlobal::BINDING), _globalUBO.data(), UBOGlobal::SIZE); -} - bool ForwardPipeline::activeRenderer() { _commandBuffers.push_back(_device->getCommandBuffer()); - - _globalUBO.fill(0.f); - _cameraUBO.fill(0.f); - _shadowUBO.fill(0.f); - - auto globalUBO = _device->createBuffer({ - gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, - gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, - UBOGlobal::SIZE, - UBOGlobal::SIZE, - gfx::BufferFlagBit::NONE, - }); - _descriptorSet->bindBuffer(UBOGlobal::BINDING, globalUBO); - - auto cameraUBO = _device->createBuffer({ - gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, - gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, - UBOCamera::SIZE, - UBOCamera::SIZE, - gfx::BufferFlagBit::NONE, - }); - _descriptorSet->bindBuffer(UBOCamera::BINDING, cameraUBO); - - auto shadowUBO = _device->createBuffer({ - gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST, - gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE, - UBOShadow::SIZE, - UBOShadow::SIZE, - gfx::BufferFlagBit::NONE, - }); - _descriptorSet->bindBuffer(UBOShadow::BINDING, shadowUBO); + auto *const sharedData = _pipelineSceneData->getSharedData(); gfx::SamplerInfo info{ gfx::Filter::LINEAR, @@ -372,22 +147,25 @@ bool ForwardPipeline::activeRenderer() { gfx::Address::CLAMP, gfx::Address::CLAMP, gfx::Address::CLAMP, + {}, + {}, + {}, + {}, }; - const auto shadowMapSamplerHash = genSamplerHash(std::move(info)); - const auto shadowMapSampler = getSampler(shadowMapSamplerHash); + const auto shadowMapSamplerHash = SamplerLib::genSamplerHash(info); + auto *const shadowMapSampler = SamplerLib::getSampler(shadowMapSamplerHash); // Main light sampler binding this->_descriptorSet->bindSampler(SHADOWMAP::BINDING, shadowMapSampler); this->_descriptorSet->bindTexture(SHADOWMAP::BINDING, getDefaultTexture()); // Spot light sampler binding - this->_descriptorSet->bindSampler(SPOT_LIGHTING_MAP::BINDING, shadowMapSampler); - this->_descriptorSet->bindTexture(SPOT_LIGHTING_MAP::BINDING, getDefaultTexture()); + this->_descriptorSet->bindSampler(SPOTLIGHTINGMAP::BINDING, shadowMapSampler); + this->_descriptorSet->bindTexture(SPOTLIGHTINGMAP::BINDING, getDefaultTexture()); _descriptorSet->update(); - // update global defines when all states initialized. - _macros.setValue("CC_USE_HDR", _isHDR); + _macros.setValue("CC_USE_HDR", static_cast(sharedData->isHDR)); _macros.setValue("CC_SUPPORT_FLOAT_TEXTURE", _device->hasFeature(gfx::Feature::TEXTURE_FLOAT)); return true; @@ -400,21 +178,17 @@ void ForwardPipeline::destroy() { _descriptorSet->getBuffer(UBOShadow::BINDING)->destroy(); _descriptorSet->getSampler(SHADOWMAP::BINDING)->destroy(); _descriptorSet->getTexture(SHADOWMAP::BINDING)->destroy(); - _descriptorSet->getSampler(SPOT_LIGHTING_MAP::BINDING)->destroy(); - _descriptorSet->getTexture(SPOT_LIGHTING_MAP::BINDING)->destroy(); + _descriptorSet->getSampler(SPOTLIGHTINGMAP::BINDING)->destroy(); + _descriptorSet->getTexture(SPOTLIGHTINGMAP::BINDING)->destroy(); } for (auto &it : _renderPasses) { - it.second->destroy(); + CC_SAFE_DESTROY(it.second); } _renderPasses.clear(); _commandBuffers.clear(); - CC_SAFE_DELETE(_sphere); - - _shadowFrameBufferMap.clear(); - RenderPipeline::destroy(); } diff --git a/native/cocos/renderer/pipeline/forward/ForwardPipeline.h b/native/cocos/renderer/pipeline/forward/ForwardPipeline.h index ed3fae503e..8cd98195e3 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardPipeline.h +++ b/native/cocos/renderer/pipeline/forward/ForwardPipeline.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include @@ -51,68 +53,25 @@ public: virtual bool activate() override; virtual void render(const vector &cameras) override; - void updateGlobalUBO(); - void updateCameraUBO(Camera *camera); - void updateShadowUBO(Camera *camera); - CC_INLINE void setHDR(bool isHDR) { _isHDR = isHDR; } - gfx::RenderPass *getOrCreateRenderPass(gfx::ClearFlags clearFlags); - void setFog(uint); - void setAmbient(uint); - void setSkybox(uint); - void setShadows(uint); - void destroyShadowFrameBuffers(); - CC_INLINE void setShadowFramebuffer(const Light *light, gfx::Framebuffer *framebuffer) { _shadowFrameBufferMap.emplace(light, framebuffer); } - CC_INLINE const std::unordered_map &getShadowFramebufferMap() const { return _shadowFrameBufferMap; } CC_INLINE gfx::Buffer *getLightsUBO() const { return _lightsUBO; } CC_INLINE const LightList &getValidLights() const { return _validLights; } CC_INLINE const gfx::BufferList &getLightBuffers() const { return _lightBuffers; } CC_INLINE const UintList &getLightIndexOffsets() const { return _lightIndexOffsets; } CC_INLINE const UintList &getLightIndices() const { return _lightIndices; } - CC_INLINE const RenderObjectList &getRenderObjects() const { return _renderObjects; } - CC_INLINE const RenderObjectList &getShadowObjects() const { return _shadowObjects; } - CC_INLINE const gfx::CommandBufferList &getCommandBuffers() const { return _commandBuffers; } - CC_INLINE float getShadingScale() const { return _shadingScale; } - CC_INLINE float getFpScale() const { return _fpScale; } - CC_INLINE bool isHDR() const { return _isHDR; } - CC_INLINE const Fog *getFog() const { return _fog; } - CC_INLINE const Ambient *getAmbient() const { return _ambient; } - CC_INLINE const Skybox *getSkybox() const { return _skybox; } - CC_INLINE Shadows *getShadows() const { return _shadows; } - CC_INLINE Sphere *getSphere() const { return _sphere; } - CC_INLINE std::array getShadowUBO() const { return _shadowUBO; } - - CC_INLINE void setRenderObjects(RenderObjectList &&ro) { _renderObjects = std::forward(ro); } - CC_INLINE void setShadowObjects(RenderObjectList &&ro) { _shadowObjects = std::forward(ro); } private: bool activeRenderer(); void updateUBO(Camera *); private: - const Fog *_fog = nullptr; - const Ambient *_ambient = nullptr; - const Skybox *_skybox = nullptr; - Shadows *_shadows = nullptr; gfx::Buffer *_lightsUBO = nullptr; LightList _validLights; gfx::BufferList _lightBuffers; UintList _lightIndexOffsets; UintList _lightIndices; - RenderObjectList _renderObjects; - RenderObjectList _shadowObjects; - map _renderPasses; - std::array _globalUBO; - std::array _cameraUBO; - std::array _shadowUBO; - Sphere *_sphere = nullptr; - - float _shadingScale = 1.0f; - bool _isHDR = false; - float _fpScale = 1.0f / 1024.0f; - - std::unordered_map _shadowFrameBufferMap; + unordered_map _renderPasses; }; } // namespace pipeline diff --git a/native/cocos/renderer/pipeline/forward/ForwardStage.cpp b/native/cocos/renderer/pipeline/forward/ForwardStage.cpp index 37bec812d7..bcadf0d6e0 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardStage.cpp +++ b/native/cocos/renderer/pipeline/forward/ForwardStage.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "ForwardStage.h" #include "../BatchedBuffer.h" #include "../InstancedBuffer.h" @@ -31,44 +33,43 @@ THE SOFTWARE. #include "../RenderQueue.h" #include "../helper/SharedMemory.h" #include "ForwardPipeline.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXQueue.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXQueue.h" #include "UIPhase.h" namespace cc { namespace pipeline { namespace { -void SRGBToLinear(gfx::Color &out, const gfx::Color &gamma) { - out.x = gamma.x * gamma.x; - out.y = gamma.y * gamma.y; - out.z = gamma.z * gamma.z; +void srgbToLinear(gfx::Color *out, const gfx::Color &gamma) { + out->x = gamma.x * gamma.x; + out->y = gamma.y * gamma.y; + out->z = gamma.z * gamma.z; } -void LinearToSRGB(gfx::Color &out, const gfx::Color &linear) { - out.x = std::sqrt(linear.x); - out.y = std::sqrt(linear.y); - out.z = std::sqrt(linear.z); +void linearToSrgb(gfx::Color *out, const gfx::Color &linear) { + out->x = std::sqrt(linear.x); + out->y = std::sqrt(linear.y); + out->z = std::sqrt(linear.z); } } // namespace -RenderStageInfo ForwardStage::_initInfo = { +RenderStageInfo ForwardStage::initInfo = { "ForwardStage", static_cast(ForwardStagePriority::FORWARD), static_cast(RenderFlowTag::SCENE), {{false, RenderQueueSortMode::FRONT_TO_BACK, {"default"}}, {true, RenderQueueSortMode::BACK_TO_FRONT, {"default", "planarShadow"}}}}; -const RenderStageInfo &ForwardStage::getInitializeInfo() { return ForwardStage::_initInfo; } +const RenderStageInfo &ForwardStage::getInitializeInfo() { return ForwardStage::initInfo; } -ForwardStage::ForwardStage() : RenderStage() { +ForwardStage::ForwardStage() { _batchedQueue = CC_NEW(RenderBatchedQueue); _instancedQueue = CC_NEW(RenderInstancedQueue); _uiPhase = CC_NEW(UIPhase); } -ForwardStage::~ForwardStage() { -} +ForwardStage::~ForwardStage() = default; bool ForwardStage::initialize(const RenderStageInfo &info) { RenderStage::initialize(info); @@ -92,6 +93,7 @@ void ForwardStage::activate(RenderPipeline *pipeline, RenderFlow *flow) { break; case RenderQueueSortMode::FRONT_TO_BACK: sortFunc = opaqueCompareFn; + break; default: break; } @@ -117,32 +119,34 @@ void ForwardStage::destroy() { void ForwardStage::render(Camera *camera) { _instancedQueue->clear(); _batchedQueue->clear(); - auto pipeline = static_cast(_pipeline); - const auto &renderObjects = pipeline->getRenderObjects(); + auto *pipeline = static_cast(_pipeline); + auto *const sceneData = _pipeline->getPipelineSceneData(); + auto *const sharedData = sceneData->getSharedData(); + const auto &renderObjects = sceneData->getRenderObjects(); - for (auto queue : _renderQueues) { + for (auto *queue : _renderQueues) { queue->clear(); } - uint m = 0, p = 0; + uint m = 0; + uint p = 0; size_t k = 0; - for (size_t i = 0; i < renderObjects.size(); ++i) { - const auto &ro = renderObjects[i]; - const auto model = ro.model; - const auto subModelID = model->getSubModelID(); + for (auto ro : renderObjects) { + const auto *const model = ro.model; + const auto *const subModelID = model->getSubModelID(); const auto subModelCount = subModelID[0]; for (m = 1; m <= subModelCount; ++m) { - auto subModel = model->getSubModelView(subModelID[m]); + const auto *subModel = cc::pipeline::ModelView::getSubModelView(subModelID[m]); for (p = 0; p < subModel->passCount; ++p) { const PassView *pass = subModel->getPassView(p); if (pass->phase != _phaseID) continue; if (pass->getBatchingScheme() == BatchingSchemes::INSTANCING) { - auto instancedBuffer = InstancedBuffer::get(subModel->passID[p]); + auto *instancedBuffer = InstancedBuffer::get(subModel->passID[p]); instancedBuffer->merge(model, subModel, p); _instancedQueue->add(instancedBuffer); } else if (pass->getBatchingScheme() == BatchingSchemes::VB_MERGING) { - auto batchedBuffer = BatchedBuffer::get(subModel->passID[p]); + auto *batchedBuffer = BatchedBuffer::get(subModel->passID[p]); batchedBuffer->merge(subModel, p, model); _batchedQueue->add(batchedBuffer); } else { @@ -153,11 +157,11 @@ void ForwardStage::render(Camera *camera) { } } } - for (auto queue : _renderQueues) { + for (auto *queue : _renderQueues) { queue->sort(); } - auto cmdBuff = pipeline->getCommandBuffers()[0]; + auto *cmdBuff = pipeline->getCommandBuffers()[0]; _instancedQueue->uploadBuffers(cmdBuff); _batchedQueue->uploadBuffers(cmdBuff); @@ -165,17 +169,17 @@ void ForwardStage::render(Camera *camera) { _planarShadowQueue->gatherShadowPasses(camera, cmdBuff); // render area is not oriented - uint w = camera->getWindow()->hasOnScreenAttachments && (uint)_device->getSurfaceTransform() % 2 ? camera->height : camera->width; - uint h = camera->getWindow()->hasOnScreenAttachments && (uint)_device->getSurfaceTransform() % 2 ? camera->width : camera->height; - _renderArea.x = camera->viewportX * w; - _renderArea.y = camera->viewportY * h; - _renderArea.width = camera->viewportWidth * w * pipeline->getShadingScale(); - _renderArea.height = camera->viewportHeight * h * pipeline->getShadingScale(); + uint w = camera->getWindow()->hasOnScreenAttachments && static_cast(_device->getSurfaceTransform()) % 2 ? camera->height : camera->width; + uint h = camera->getWindow()->hasOnScreenAttachments && static_cast(_device->getSurfaceTransform()) % 2 ? camera->width : camera->height; + _renderArea.x = static_cast(camera->viewportX * w); + _renderArea.y = static_cast(camera->viewportY * h); + _renderArea.width = static_cast(camera->viewportWidth * w * sharedData->shadingScale); + _renderArea.height = static_cast(camera->viewportHeight * h * sharedData->shadingScale); - if (static_cast(camera->clearFlag) & gfx::ClearFlagBit::COLOR) { - if (pipeline->isHDR()) { - SRGBToLinear(_clearColors[0], camera->clearColor); - auto scale = pipeline->getFpScale() / camera->exposure; + if (hasFlag(static_cast(camera->clearFlag), gfx::ClearFlagBit::COLOR)) { + if (sharedData->isHDR) { + srgbToLinear(&_clearColors[0], camera->clearColor); + auto scale = sharedData->fpScale / camera->exposure; _clearColors[0].x *= scale; _clearColors[0].y *= scale; _clearColors[0].z *= scale; @@ -188,13 +192,13 @@ void ForwardStage::render(Camera *camera) { _clearColors[0].w = camera->clearColor.w; - auto framebuffer = camera->getWindow()->getFramebuffer(); + auto *framebuffer = camera->getWindow()->getFramebuffer(); const auto &colorTextures = framebuffer->getColorTextures(); - auto renderPass = colorTextures.size() && colorTextures[0] ? framebuffer->getRenderPass() : pipeline->getOrCreateRenderPass(static_cast(camera->clearFlag)); + auto *renderPass = !colorTextures.empty() && colorTextures[0] ? framebuffer->getRenderPass() : pipeline->getOrCreateRenderPass(static_cast(camera->clearFlag)); cmdBuff->beginRenderPass(renderPass, framebuffer, _renderArea, _clearColors, camera->clearDepth, camera->clearStencil); - cmdBuff->bindDescriptorSet(GLOBAL_SET, _pipeline->getDescriptorSet()); + cmdBuff->bindDescriptorSet(globalSet, _pipeline->getDescriptorSet()); _renderQueues[0]->recordCommandBuffer(_device, renderPass, cmdBuff); _instancedQueue->recordCommandBuffer(_device, renderPass, cmdBuff); @@ -203,7 +207,7 @@ void ForwardStage::render(Camera *camera) { _planarShadowQueue->recordCommandBuffer(_device, renderPass, cmdBuff); _renderQueues[1]->recordCommandBuffer(_device, renderPass, cmdBuff); _uiPhase->render(camera, renderPass); - + cmdBuff->endRenderPass(); } diff --git a/native/cocos/renderer/pipeline/forward/ForwardStage.h b/native/cocos/renderer/pipeline/forward/ForwardStage.h index b75e283320..e0c773211a 100644 --- a/native/cocos/renderer/pipeline/forward/ForwardStage.h +++ b/native/cocos/renderer/pipeline/forward/ForwardStage.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "../RenderStage.h" @@ -42,15 +44,15 @@ public: static const RenderStageInfo &getInitializeInfo(); ForwardStage(); - ~ForwardStage(); + ~ForwardStage() override; - virtual bool initialize(const RenderStageInfo &info) override; - virtual void activate(RenderPipeline *pipeline, RenderFlow *flow) override; - virtual void destroy() override; - virtual void render(Camera *camera) override; + bool initialize(const RenderStageInfo &info) override; + void activate(RenderPipeline *pipeline, RenderFlow *flow) override; + void destroy() override; + void render(Camera *camera) override; private: - static RenderStageInfo _initInfo; + static RenderStageInfo initInfo; ForwardPipeline *_forwrdPipeline = nullptr; PlanarShadowQueue *_planarShadowQueue = nullptr; RenderBatchedQueue *_batchedQueue = nullptr; diff --git a/native/cocos/renderer/pipeline/forward/SceneCulling.cpp b/native/cocos/renderer/pipeline/forward/SceneCulling.cpp deleted file mode 100644 index 538419344b..0000000000 --- a/native/cocos/renderer/pipeline/forward/SceneCulling.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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 - -#include "../Define.h" -#include "../helper/SharedMemory.h" -#include "ForwardPipeline.h" -#include "SceneCulling.h" -#include "gfx/GFXBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "math/Quaternion.h" -#include "platform/Application.h" - -namespace cc { -namespace pipeline { -bool castBoundsInitialized = false; -AABB castWorldBounds; - -RenderObject genRenderObject(const ModelView *model, const Camera *camera) { - float depth = 0; - if (model->nodeID) { - const auto node = model->getTransform(); - cc::Vec3 position; - cc::Vec3::subtract(node->worldPosition, camera->position, &position); - depth = position.dot(camera->forward); - } - - return {depth, model}; -} - -void getShadowWorldMatrix(const Sphere *sphere, const cc::Vec4 &rotation, const cc::Vec3 &dir, cc::Mat4 &shadowWorldMat, cc::Vec3 &out) { - Vec3 translation(dir); - translation.negate(); - const auto distance = sphere->radius * COEFFICIENT_OF_EXPANSION; - translation.scale(distance); - translation.add(sphere->center); - out.set(translation); - - Mat4::fromRT(rotation, translation, &shadowWorldMat); -} - -void updateSphereLight(Shadows *shadows, const Light *light, std::array &shadowUBO) { - const auto node = light->getNode(); - if (!node->flagsChanged && !shadows->dirty) { - return; - } - - shadows->dirty = false; - const auto position = node->worldPosition; - const auto &normal = shadows->normal; - const auto distance = shadows->distance + 0.001f; // avoid z-fighting - const auto NdL = normal.dot(position); - const auto lx = position.x; - const auto ly = position.y; - const auto lz = position.z; - const auto nx = normal.x; - const auto ny = normal.y; - const auto nz = normal.z; - auto &matLight = shadows->matLight; - matLight.m[0] = NdL - distance - lx * nx; - matLight.m[1] = -ly * nx; - matLight.m[2] = -lz * nx; - matLight.m[3] = -nx; - matLight.m[4] = -lx * ny; - matLight.m[5] = NdL - distance - ly * ny; - matLight.m[6] = -lz * ny; - matLight.m[7] = -ny; - matLight.m[8] = -lx * nz; - matLight.m[9] = -ly * nz; - matLight.m[10] = NdL - distance - lz * nz; - matLight.m[11] = -nz; - matLight.m[12] = lx * distance; - matLight.m[13] = ly * distance; - matLight.m[14] = lz * distance; - matLight.m[15] = NdL; - - memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET, matLight.m, sizeof(matLight)); -} - -void updateDirLight(Shadows *shadows, const Light *light, std::array &shadowUBO) { - const auto node = light->getNode(); - const auto rotation = node->worldRotation; - Quaternion _qt(rotation.x, rotation.y, rotation.z, rotation.w); - Vec3 forward(0, 0, -1.0f); - forward.transformQuat(_qt); - const auto &normal = shadows->normal; - const auto distance = shadows->distance + 0.001f; // avoid z-fighting - const auto NdL = normal.dot(forward); - const auto scale = 1.0f / NdL; - const auto lx = forward.x * scale; - const auto ly = forward.y * scale; - const auto lz = forward.z * scale; - const auto nx = normal.x; - const auto ny = normal.y; - const auto nz = normal.z; - auto &matLight = shadows->matLight; - matLight.m[0] = 1 - nx * lx; - matLight.m[1] = -nx * ly; - matLight.m[2] = -nx * lz; - matLight.m[3] = 0; - matLight.m[4] = -ny * lx; - matLight.m[5] = 1 - ny * ly; - matLight.m[6] = -ny * lz; - matLight.m[7] = 0; - matLight.m[8] = -nz * lx; - matLight.m[9] = -nz * ly; - matLight.m[10] = 1 - nz * lz; - matLight.m[11] = 0; - matLight.m[12] = lx * distance; - matLight.m[13] = ly * distance; - matLight.m[14] = lz * distance; - matLight.m[15] = 1; - - memcpy(shadowUBO.data() + UBOShadow::MAT_LIGHT_PLANE_PROJ_OFFSET, matLight.m, sizeof(matLight)); -} - -void lightCollecting(Camera *camera, std::vector &validLights) { - validLights.clear(); - auto *sphere = CC_NEW(Sphere); - const auto scene = camera->getScene(); - const Light *mainLight = nullptr; - if (scene->mainLightID) mainLight = scene->getMainLight(); - validLights.emplace_back(mainLight); - - const auto spotLightArrayID = scene->getSpotLightArrayID(); - const auto count = spotLightArrayID ? spotLightArrayID[0] : 0; - for (uint32_t i = 1; i <= count; ++i) { - const auto *spotLight = scene->getSpotLight(spotLightArrayID[i]); - sphere->center.set(spotLight->position); - sphere->radius = spotLight->range; - if (sphere->interset(*camera->getFrustum())) { - validLights.emplace_back(spotLight); - } - } - - CC_SAFE_DELETE(sphere); -} - -void shadowCollecting(ForwardPipeline *pipeline, Camera *camera) { - const auto scene = camera->getScene(); - - castBoundsInitialized = false; - - RenderObjectList shadowObjects; - - const auto models = scene->getModels(); - const auto modelCount = models[0]; - for (size_t i = 1; i <= modelCount; i++) { - const auto model = scene->getModelView(models[i]); - - // filter model by view visibility - if (model->enabled) { - const auto visibility = camera->visibility; - const auto node = model->getNode(); - if ((model->nodeID && ((visibility & node->layer) == node->layer)) || - (visibility & model->visFlags)) { - // shadow render Object - if (model->castShadow && model->getWorldBounds()) { - if (!castBoundsInitialized) { - castWorldBounds = *model->getWorldBounds(); - castBoundsInitialized = true; - } - castWorldBounds.merge(*model->getWorldBounds()); - shadowObjects.emplace_back(genRenderObject(model, camera)); - } - } - } - } - - pipeline->getSphere()->define(castWorldBounds); - - pipeline->setShadowObjects(std::move(shadowObjects)); -} - -void sceneCulling(ForwardPipeline *pipeline, Camera *camera) { - const auto shadows = pipeline->getShadows(); - const auto skyBox = pipeline->getSkybox(); - const auto scene = camera->getScene(); - - const Light *mainLight = nullptr; - if (scene->mainLightID) mainLight = scene->getMainLight(); - RenderObjectList renderObjects; - - if (skyBox->enabled && skyBox->modelID && (camera->clearFlag & SKYBOX_FLAG)) { - renderObjects.emplace_back(genRenderObject(skyBox->getModel(), camera)); - } - - const auto models = scene->getModels(); - const auto modelCount = models[0]; - for (size_t i = 1; i <= modelCount; i++) { - const auto model = scene->getModelView(models[i]); - - // filter model by view visibility - if (model->enabled) { - const auto visibility = camera->visibility; - const auto node = model->getNode(); - if ((model->nodeID && ((visibility & node->layer) == node->layer)) || - (visibility & model->visFlags)) { - - // frustum culling - if ((model->worldBoundsID) && !aabb_frustum(model->getWorldBounds(), camera->getFrustum())) { - continue; - } - - renderObjects.emplace_back(genRenderObject(model, camera)); - } - } - } - - pipeline->setRenderObjects(std::move(renderObjects)); -} - -} // namespace pipeline -} // namespace cc diff --git a/native/cocos/renderer/pipeline/forward/SceneCulling.h b/native/cocos/renderer/pipeline/forward/SceneCulling.h deleted file mode 100644 index 80fff47395..0000000000 --- a/native/cocos/renderer/pipeline/forward/SceneCulling.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -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. -****************************************************************************/ -#pragma once -#include "pipeline/Define.h" - -namespace cc { -class Mat4; -class Vec4; -class Vec3; -namespace pipeline { - -struct RenderObject; -struct Model; -struct Camera; -class ForwardPipeline; -struct Sphere; -struct Light; -struct Sphere; -struct Shadows; - -RenderObject genRenderObject(Model *, const Camera *); - -void lightCollecting(Camera *, std::vector&); -void shadowCollecting(ForwardPipeline *, Camera *); -void sceneCulling(ForwardPipeline *, Camera *); -void updateSphereLight(Shadows *shadows, const Light *light, std::array &); -void updateDirLight(Shadows *shadows, const Light *light, std::array&); -void getShadowWorldMatrix(const Sphere *sphere, const cc::Vec4 &rotation, const cc::Vec3 &dir, cc::Mat4 &shadowWorldMat, cc::Vec3 &out); -} // namespace pipeline -} // namespace cc diff --git a/native/cocos/renderer/pipeline/forward/UIPhase.cpp b/native/cocos/renderer/pipeline/forward/UIPhase.cpp index e7c43fbce7..c2b9e3078c 100644 --- a/native/cocos/renderer/pipeline/forward/UIPhase.cpp +++ b/native/cocos/renderer/pipeline/forward/UIPhase.cpp @@ -1,30 +1,32 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "UIPhase.h" #include "ForwardPipeline.h" #include "pipeline/PipelineStateManager.h" -#include "gfx/GFXCommandBuffer.h" +#include "gfx-base/GFXCommandBuffer.h" namespace cc { namespace pipeline { @@ -35,36 +37,36 @@ void UIPhase::activate(RenderPipeline *pipeline){ }; void UIPhase::render(Camera *camera, gfx::RenderPass *renderPass){ - auto pipeline = static_cast(_pipeline); - auto cmdBuff = pipeline->getCommandBuffers()[0]; + auto *pipeline = dynamic_cast(_pipeline); + auto *cmdBuff = pipeline->getCommandBuffers()[0]; - auto batches = camera->getScene()->getUIBatches(); - const int batchCount = batches[0]; + const auto *batches = camera->getScene()->getUIBatches(); + const auto batchCount = batches[0]; // Notice: The batches[0] is batchCount - for (int i = 1; i <= batchCount; ++i) { - const auto batch = GET_UI_BATCH(batches[i]); + for (uint i = 1; i <= batchCount; ++i) { + auto *const batch = GET_UI_BATCH(batches[i]); bool visible = false; if (camera->visibility & batch->visFlags) { visible = true; } if (!visible) continue; - const int count = batch->passCount; - for (int j = 0; j < count; j++) { - const auto pass = batch->getPassView(j); + const auto count = batch->passCount; + for (uint j = 0; j < count; j++) { + const auto *const pass = batch->getPassView(j); if (pass->phase != _phaseID) continue; - const auto shader = batch->getShader(j); - const auto inputAssembler = batch->getInputAssembler(); - const auto ds = batch->getDescriptorSet(); - auto *pso = PipelineStateManager::getOrCreatePipelineState(pass, shader, inputAssembler, renderPass); + auto *const shader = batch->getShader(j); + auto *const inputAssembler = batch->getInputAssembler(); + auto *const ds = batch->getDescriptorSet(); + auto *pso = cc::pipeline::PipelineStateManager::getOrCreatePipelineState(pass, shader, inputAssembler, renderPass); cmdBuff->bindPipelineState(pso); - cmdBuff->bindDescriptorSet(MATERIAL_SET, pass->getDescriptorSet()); - cmdBuff->bindDescriptorSet(LOCAL_SET, ds); + cmdBuff->bindDescriptorSet(materialSet, pass->getDescriptorSet()); + cmdBuff->bindDescriptorSet(localSet, ds); cmdBuff->bindInputAssembler(inputAssembler); cmdBuff->draw(inputAssembler); } } } -} -} +} // namespace pipeline +} // namespace cc diff --git a/native/cocos/renderer/pipeline/forward/UIPhase.h b/native/cocos/renderer/pipeline/forward/UIPhase.h index 396dbcbfb7..881901819c 100644 --- a/native/cocos/renderer/pipeline/forward/UIPhase.h +++ b/native/cocos/renderer/pipeline/forward/UIPhase.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "pipeline/RenderPipeline.h" @@ -39,5 +41,3 @@ protected: } } - - diff --git a/native/cocos/renderer/pipeline/helper/DefineMap.cpp b/native/cocos/renderer/pipeline/helper/DefineMap.cpp index 8354186ea7..777d97a274 100644 --- a/native/cocos/renderer/pipeline/helper/DefineMap.cpp +++ b/native/cocos/renderer/pipeline/helper/DefineMap.cpp @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "DefineMap.h" namespace cc { namespace pipeline { diff --git a/native/cocos/renderer/pipeline/helper/DefineMap.h b/native/cocos/renderer/pipeline/helper/DefineMap.h index 492db95a15..a46eb4dc93 100644 --- a/native/cocos/renderer/pipeline/helper/DefineMap.h +++ b/native/cocos/renderer/pipeline/helper/DefineMap.h @@ -1,29 +1,31 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "../../core/CoreStd.h" +#include "base/CoreStd.h" #include "base/Macros.h" #include "cocos/bindings/jswrapper/Object.h" diff --git a/native/cocos/renderer/pipeline/helper/SharedMemory.cpp b/native/cocos/renderer/pipeline/helper/SharedMemory.cpp index f76ed13edf..5002686496 100644 --- a/native/cocos/renderer/pipeline/helper/SharedMemory.cpp +++ b/native/cocos/renderer/pipeline/helper/SharedMemory.cpp @@ -1,53 +1,56 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "SharedMemory.h" -#include "../math/MathUtil.h" -#include "renderer/core/gfx/GFXDef.h" +#include "gfx-base/GFXDef.h" +#include "math/MathUtil.h" namespace cc { namespace pipeline { -const se::PoolType ModelView::type = se::PoolType::MODEL; -const se::PoolType SubModelView::type = se::PoolType::SUB_MODEL; -const se::PoolType PassView::type = se::PoolType::PASS; -const se::PoolType Camera::type = se::PoolType::CAMERA; -const se::PoolType AABB::type = se::PoolType::AABB; -const se::PoolType Frustum::type = se::PoolType::FRUSTUM; -const se::PoolType Scene::type = se::PoolType::SCENE; -const se::PoolType Light::type = se::PoolType::LIGHT; -const se::PoolType Ambient::type = se::PoolType::AMBIENT; -const se::PoolType Fog::type = se::PoolType::FOG; -const se::PoolType Skybox::type = se::PoolType::SKYBOX; -const se::PoolType InstancedAttributeView::type = se::PoolType::INSTANCED_ATTRIBUTE; -const se::PoolType FlatBufferView::type = se::PoolType::FLAT_BUFFER; -const se::PoolType RenderingSubMesh::type = se::PoolType::SUB_MESH; -const se::PoolType Node::type = se::PoolType::NODE; -const se::PoolType Root::type = se::PoolType::ROOT; -const se::PoolType RenderWindow::type = se::PoolType::RENDER_WINDOW; -const se::PoolType Shadows::type = se::PoolType::SHADOW; -const se::PoolType Sphere::type = se::PoolType::SPHERE; -const se::PoolType UIBatch::type = se::PoolType::UI_BATCH; +const se::PoolType ModelView::TYPE = se::PoolType::MODEL; +const se::PoolType SubModelView::TYPE = se::PoolType::SUB_MODEL; +const se::PoolType PassView::TYPE = se::PoolType::PASS; +const se::PoolType Camera::TYPE = se::PoolType::CAMERA; +const se::PoolType AABB::TYPE = se::PoolType::AABB; +const se::PoolType Frustum::TYPE = se::PoolType::FRUSTUM; +const se::PoolType Scene::TYPE = se::PoolType::SCENE; +const se::PoolType Light::TYPE = se::PoolType::LIGHT; +const se::PoolType Ambient::TYPE = se::PoolType::AMBIENT; +const se::PoolType Fog::TYPE = se::PoolType::FOG; +const se::PoolType Skybox::TYPE = se::PoolType::SKYBOX; +const se::PoolType InstancedAttributeView::TYPE = se::PoolType::INSTANCED_ATTRIBUTE; +const se::PoolType FlatBufferView::TYPE = se::PoolType::FLAT_BUFFER; +const se::PoolType RenderingSubMesh::TYPE = se::PoolType::SUB_MESH; +const se::PoolType Node::TYPE = se::PoolType::NODE; +const se::PoolType Root::TYPE = se::PoolType::ROOT; +const se::PoolType RenderWindow::TYPE = se::PoolType::RENDER_WINDOW; +const se::PoolType Shadows::TYPE = se::PoolType::SHADOW; +const se::PoolType Sphere::TYPE = se::PoolType::SPHERE; +const se::PoolType UIBatch::TYPE = se::PoolType::UI_BATCH; +const se::PoolType PipelineSharedSceneData::TYPE = se::PoolType::PIPELINE_SHARED_SCENE_DATA; void AABB::getBoundary(cc::Vec3 &minPos, cc::Vec3 &maxPos) const { minPos = center - halfExtents; @@ -59,19 +62,20 @@ void AABB::merge(const AABB &aabb) { cc::Vec3 minB = aabb.center - aabb.halfExtents; cc::Vec3 maxA = center + halfExtents; cc::Vec3 maxB = aabb.center + aabb.halfExtents; - cc::Vec3 maxP, minP; + cc::Vec3 maxP; + cc::Vec3 minP; cc::Vec3::max(maxA, maxB, &maxP); cc::Vec3::min(minA, minB, &minP); cc::Vec3 addP = maxP + minP; cc::Vec3 subP = maxP - minP; - center = addP * 0.5f; - halfExtents = subP * 0.5f; + center = addP * 0.5F; + halfExtents = subP * 0.5F; } int Sphere::interset(const Plane &plane) const { const float dot = plane.normal.dot(center); - const float r = radius * plane.normal.length(); + const float r = radius * plane.normal.length(); if (dot + r < plane.distance) { return -1; } @@ -84,7 +88,7 @@ int Sphere::interset(const Plane &plane) const { } bool Sphere::interset(const Frustum &frustum) const { - for (const auto &plane : frustum.planes) { + for (const auto &plane : frustum.planes) { // NOLINT if (this->interset(plane) == -1) { return false; } @@ -94,17 +98,17 @@ bool Sphere::interset(const Frustum &frustum) const { } void Sphere::mergePoint(const cc::Vec3 &point) { - if (radius < 0.0f) { + if (radius < 0.0F) { center = point; radius = 0.0; return; } - auto offset = point - center; + auto offset = point - center; auto distance = offset.length(); if (distance > radius) { - auto half = (distance - radius) * 0.5f; + auto half = (distance - radius) * 0.5F; radius += half; offset.scale(half / distance); center += offset; @@ -112,52 +116,58 @@ void Sphere::mergePoint(const cc::Vec3 &point) { } void Sphere::define(const AABB &aabb) { - cc::Vec3 minPos, maxPos; + cc::Vec3 minPos; + cc::Vec3 maxPos; aabb.getBoundary(minPos, maxPos); // Initialize sphere center.set(minPos); - radius = 0.0f; + radius = 0.0F; // Calculate sphere const cc::Vec3 offset = maxPos - center; - const float dist = offset.length(); + const float dist = offset.length(); - const float half = dist * 0.5f; - radius += dist * 0.5f; + const float half = dist * 0.5F; + radius += dist * 0.5F; center += (half / dist) * offset; } void Sphere::mergeAABB(const AABB *aabb) { - cc::Vec3 minPos, maxPos; + cc::Vec3 minPos; + cc::Vec3 maxPos; aabb->getBoundary(minPos, maxPos); mergePoint(minPos); mergePoint(maxPos); } -int sphere_plane(const Sphere *sphere, const Plane *plane) { +int spherePlane(const Sphere *sphere, const Plane *plane) { const auto dot = cc::Vec3::dot(plane->normal, sphere->center); - const auto r = sphere->radius * plane->normal.length(); + const auto r = sphere->radius * plane->normal.length(); if (dot + r < plane->distance) { return -1; - } else if (dot - r > plane->distance) { + } + if (dot - r > plane->distance) { return 0; } return 1; }; -bool sphere_frustum(const Sphere *sphere, const Frustum *frustum) { - for (auto i = 0; i < PLANE_LENGTH; i++) { +bool sphere_frustum(const Sphere *sphere, const Frustum *frustum) { // NOLINT + for (const auto &plane : frustum->planes) { // frustum plane normal points to the inside - if (sphere_plane(sphere, &frustum->planes[i]) == -1) { + if (spherePlane(sphere, &plane) == -1) { return false; } } // completely outside return true; } -bool aabb_aabb(const AABB *aabb1, const AABB *aabb2) { - cc::Vec3 aMin, aMax, bMin, bMax; +bool aabbAabb(const AABB *aabb1, const AABB *aabb2) { + cc::Vec3 aMin; + cc::Vec3 aMax; + cc::Vec3 bMin; + cc::Vec3 bMax; cc::Vec3::subtract(aabb1->center, aabb1->halfExtents, &aMin); cc::Vec3::add(aabb1->center, aabb1->halfExtents, &aMax); cc::Vec3::subtract(aabb2->center, aabb2->halfExtents, &bMin); @@ -167,39 +177,40 @@ bool aabb_aabb(const AABB *aabb1, const AABB *aabb2) { (aMin.z <= bMax.z && aMax.z >= bMin.z); } -int aabb_plane(const AABB *aabb, const Plane *plane) { +int aabbPlane(const AABB *aabb, const Plane *plane) { const auto &halfExtents = aabb->halfExtents; - auto r = halfExtents.x * std::abs(plane->normal.x) + + auto r = halfExtents.x * std::abs(plane->normal.x) + halfExtents.y * std::abs(plane->normal.y) + halfExtents.z * std::abs(plane->normal.z); auto dot = Vec3::dot(plane->normal, aabb->center); if (dot + r < plane->distance) { return -1; - } else if (dot - r > plane->distance) { + } + if (dot - r > plane->distance) { return 0; } return 1; }; -bool aabb_frustum(const AABB *aabb, const Frustum *frustum) { - for (size_t i = 0; i < PLANE_LENGTH; i++) { +bool aabbFrustum(const AABB *aabb, const Frustum *frustum) { + for (const auto &plane : frustum->planes) { // frustum plane normal points to the inside - if (aabb_plane(aabb, &frustum->planes[i]) == -1) { - return 0; + if (aabbPlane(aabb, &plane) == -1) { + return false; } } // completely outside - return 1; + return true; } gfx::BlendState *getBlendStateImpl(uint index) { static gfx::BlendState blendState; - auto buffer = SharedMemory::getBuffer(se::PoolType::BLEND_STATE, index); - memcpy(&blendState, buffer, 24); + auto * buffer = SharedMemory::getBuffer(se::PoolType::BLEND_STATE, index); + memcpy(&blendState, buffer, 24); // NOLINT - uint32_t targetArrayHandle = *(buffer + 6); - const auto targetsHandle = GET_BLEND_TARGET_ARRAY(targetArrayHandle); - uint32_t targetLen = targetsHandle[0]; - auto &targets = blendState.targets; + uint32_t targetArrayHandle = *(buffer + 6); + auto *const targetsHandle = GET_BLEND_TARGET_ARRAY(targetArrayHandle); + uint32_t targetLen = targetsHandle[0]; + auto & targets = blendState.targets; targets.resize(targetLen); for (uint32_t i = 1; i <= targetLen; ++i) { memcpy(&targets[i - 1], GET_BLEND_TARGET(targetsHandle[i]), sizeof(gfx::BlendTarget)); diff --git a/native/cocos/renderer/pipeline/helper/SharedMemory.h b/native/cocos/renderer/pipeline/helper/SharedMemory.h index 4b00739d80..074c01a2f3 100644 --- a/native/cocos/renderer/pipeline/helper/SharedMemory.h +++ b/native/cocos/renderer/pipeline/helper/SharedMemory.h @@ -1,32 +1,35 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once -#include "renderer/core/CoreStd.h" +#include "renderer/gfx-base/GFXDef.h" #include "bindings/dop/BufferAllocator.h" #include "bindings/dop/BufferPool.h" #include "bindings/dop/ObjectPool.h" +#include "bindings/dop/PoolType.h" #include "math/Vec2.h" #include "math/Vec3.h" #include "math/Vec4.h" @@ -41,31 +44,32 @@ namespace pipeline { extern gfx::BlendState *getBlendStateImpl(uint index); //Get buffer pool data -#define GET_SUBMODEL(index) SharedMemory::getBuffer(index) -#define GET_PASS(index) SharedMemory::getBuffer(index) -#define GET_MODEL(index) SharedMemory::getBuffer(index) -#define GET_FLAT_BUFFER(index) SharedMemory::getBuffer(index) -#define GET_INSTANCE_ATTRIBUTE(index) SharedMemory::getBuffer(index) -#define GET_RENDER_SUBMESH(index) SharedMemory::getBuffer(index) -#define GET_BUFFERVIEW(index) SharedMemory::getBuffer(index) -#define GET_NODE(index) SharedMemory::getBuffer(index) -#define GET_ROOT() SharedMemory::getBuffer(se::BufferPool::getPoolFlag()) -#define GET_CAMERA(index) SharedMemory::getBuffer(index) -#define GET_SCENE(index) SharedMemory::getBuffer(index) -#define GET_LIGHT(index) SharedMemory::getBuffer(index) -#define GET_AMBIENT(index) SharedMemory::getBuffer(index) -#define GET_FOG(index) SharedMemory::getBuffer(index) -#define GET_SKYBOX(index) SharedMemory::getBuffer(index) -#define GET_FRUSTUM(index) SharedMemory::getBuffer(index) -#define GET_AABB(index) SharedMemory::getBuffer(index) -#define GET_WINDOW(index) SharedMemory::getBuffer(index) -#define GET_SHADOWS(index) SharedMemory::getBuffer(index) -#define GET_SPHERE(index) SharedMemory::getBuffer(index) -#define GET_RASTERIZER_STATE(index) SharedMemory::getBuffer(se::PoolType::RASTERIZER_STATE, index) -#define GET_DEPTH_STENCIL_STATE(index) SharedMemory::getBuffer(se::PoolType::DEPTH_STENCIL_STATE, index) -#define GET_BLEND_TARGET(index) SharedMemory::getBuffer(se::PoolType::BLEND_TARGET, index) -#define GET_BLEND_STATE(index) getBlendStateImpl(index) -#define GET_UI_BATCH(index) SharedMemory::getBuffer(index) +#define GET_SUBMODEL(index) SharedMemory::getBuffer(index) +#define GET_PASS(index) SharedMemory::getBuffer(index) +#define GET_MODEL(index) SharedMemory::getBuffer(index) +#define GET_FLAT_BUFFER(index) SharedMemory::getBuffer(index) +#define GET_INSTANCE_ATTRIBUTE(index) SharedMemory::getBuffer(index) +#define GET_RENDER_SUBMESH(index) SharedMemory::getBuffer(index) +#define GET_BUFFERVIEW(index) SharedMemory::getBuffer(index) +#define GET_NODE(index) SharedMemory::getBuffer(index) +#define GET_ROOT() SharedMemory::getBuffer(se::BufferPool::getPoolFlag()) +#define GET_CAMERA(index) SharedMemory::getBuffer(index) +#define GET_SCENE(index) SharedMemory::getBuffer(index) +#define GET_LIGHT(index) SharedMemory::getBuffer(index) +#define GET_AMBIENT(index) SharedMemory::getBuffer(index) +#define GET_FOG(index) SharedMemory::getBuffer(index) +#define GET_SKYBOX(index) SharedMemory::getBuffer(index) +#define GET_FRUSTUM(index) SharedMemory::getBuffer(index) +#define GET_AABB(index) SharedMemory::getBuffer(index) +#define GET_WINDOW(index) SharedMemory::getBuffer(index) +#define GET_SHADOWS(index) SharedMemory::getBuffer(index) +#define GET_SPHERE(index) SharedMemory::getBuffer(index) +#define GET_RASTERIZER_STATE(index) SharedMemory::getBuffer(se::PoolType::RASTERIZER_STATE, index) +#define GET_DEPTH_STENCIL_STATE(index) SharedMemory::getBuffer(se::PoolType::DEPTH_STENCIL_STATE, index) +#define GET_BLEND_TARGET(index) SharedMemory::getBuffer(se::PoolType::BLEND_TARGET, index) +#define GET_BLEND_STATE(index) getBlendStateImpl(index) +#define GET_UI_BATCH(index) SharedMemory::getBuffer(index) +#define GET_PIPELINE_SHARED_SCENE_DATA(index) SharedMemory::getBuffer(index) //Get object pool data #define GET_DESCRIPTOR_SET(index) SharedMemory::getObject(index) @@ -83,47 +87,53 @@ extern gfx::BlendState *getBlendStateImpl(uint index); #define GET_INSTANCED_ATTRIBUTE_ARRAY(index) SharedMemory::getHandleArray(se::PoolType::INSTANCED_ATTRIBUTE_ARRAY, index) #define GET_LIGHT_ARRAY(index) SharedMemory::getHandleArray(se::PoolType::LIGHT_ARRAY, index) #define GET_BLEND_TARGET_ARRAY(index) SharedMemory::getHandleArray(se::PoolType::BLEND_TARGET_ARRAY, index) -#define GET_UI_BATCH_ARRAY(index) SharedMemory::getHandleArray(se::PoolType::UI_BATCH_ARRAY, index) +#define GET_UI_BATCH_ARRAY(index) SharedMemory::getHandleArray(se::PoolType::UI_BATCH_ARRAY, index) // Get raw buffer or gfx object. #define GET_RAW_BUFFER(index, size) SharedMemory::getRawBuffer(se::PoolType::RAW_BUFFER, index, size) -static const float SHADOW_CAMERA_MAX_FAR = 2000.0f; -static const float COEFFICIENT_OF_EXPANSION = 2.0f * std::sqrtf(3.0f); +static const float SHADOW_CAMERA_MAX_FAR = 2000.0F; +static const float COEFFICIENT_OF_EXPANSION = 2.0F * std::sqrtf(3.0F); class CC_DLL SharedMemory : public Object { public: template static T *getBuffer(uint index) { const auto &bufferMap = se::BufferPool::getPoolMap(); - if (bufferMap.count(T::type) != 0) { - const se::BufferPool *bufferPool = bufferMap.at(T::type); - return bufferPool->getTypedObject(index); - } else { - return nullptr; - } + const auto type = GET_BUFFER_POOL_ID(T::TYPE); + +#ifdef CC_DEBUG + CCASSERT(bufferMap[type] != nullptr, "BufferPool: Invalid buffer pool type"); +#endif + + const se::BufferPool *bufferPool = bufferMap[type]; + return bufferPool->getTypedObject(index); } template static T *getBuffer(se::PoolType poolType, uint index) { const auto &bufferMap = se::BufferPool::getPoolMap(); - if (bufferMap.count(poolType) != 0) { - const se::BufferPool *bufferPool = bufferMap.at(poolType); - return bufferPool->getTypedObject(index); - } else { - return nullptr; - } + const auto type = GET_BUFFER_POOL_ID(poolType); + +#ifdef CC_DEBUG + CCASSERT(bufferMap[type] != nullptr, "BufferPool: Invalid buffer pool type"); +#endif + + const se::BufferPool *bufferPool = bufferMap[type]; + return bufferPool->getTypedObject(index); } template static T *getObject(uint index) { const auto &poolMap = se::ObjectPool::getPoolMap(); - if (poolMap.count(p) != 0) { - const se::ObjectPool *objectPool = poolMap.at(p); - return objectPool->getTypedObject(index); - } else { - return nullptr; - } + const auto type = GET_OBJECT_POOL_ID(p); + +#ifdef CC_DEBUG + CCASSERT(poolMap[type] != nullptr, "BufferPool: Invalid buffer pool type"); +#endif + + const se::ObjectPool *objectPool = poolMap[type]; + return objectPool->getTypedObject(index); } static uint32_t *getHandleArray(se::PoolType type, uint index) { @@ -143,39 +153,39 @@ public: struct CC_DLL Node { uint32_t flagsChanged = 0; - uint32_t layer = 0; + uint32_t layer = 0; cc::Vec3 worldScale; cc::Vec3 worldPosition; cc::Vec4 worldRotation; cc::Mat4 worldMatrix; - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL AABB { cc::Vec3 center; cc::Vec3 halfExtents; - void getBoundary(cc::Vec3 &minPos, cc::Vec3 &maxPos) const; + void getBoundary(cc::Vec3 &minPos, cc::Vec3 &maxPos) const; // NOLINT void merge(const AABB &aabb); - const static se::PoolType type; + const static se::PoolType TYPE; }; -bool aabb_aabb(const AABB *, const AABB *); +bool aabbAabb(const AABB *, const AABB *); struct CC_DLL Plane { cc::Vec3 normal; - float distance; + float distance; }; constexpr uint PLANE_LENGTH = 6; -struct CC_DLL Frustum { +struct CC_DLL Frustum { cc::Vec3 vertices[8]; - Plane planes[PLANE_LENGTH]; + Plane planes[PLANE_LENGTH]; - const static se::PoolType type; + const static se::PoolType TYPE; }; -bool aabb_frustum(const AABB *, const Frustum *); +bool aabbFrustum(const AABB *, const Frustum *); enum class LightType { DIRECTIONAL, @@ -185,56 +195,56 @@ enum class LightType { }; struct CC_DLL Light { uint32_t useColorTemperature = 0; - float luminance = 0; - uint32_t nodeID = 0; - float range = 0; - uint32_t lightType = 0; - uint32_t aabbID = 0; - uint32_t frustumID = 0; - float size = 0.15f; - float spotAngle = 0.0f; - float aspect = 1.0f; + float luminance = 0; + uint32_t nodeID = 0; + float range = 0; + uint32_t lightType = 0; + uint32_t aabbID = 0; + uint32_t frustumID = 0; + float size = 0.15F; + float spotAngle = 0.0F; + float aspect = 1.0F; cc::Vec3 direction; cc::Vec3 color; cc::Vec3 colorTemperatureRGB; cc::Vec3 position; CC_INLINE const Node *getNode() const { return GET_NODE(nodeID); } - CC_INLINE LightType getType() const { return static_cast(lightType); } + CC_INLINE LightType getType() const { return static_cast(lightType); } CC_INLINE const AABB *getAABB() const { return GET_AABB(aabbID); } CC_INLINE const Frustum *getFrustum() const { return GET_FRUSTUM(frustumID); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL FlatBufferView { - uint32_t stride = 0; - uint32_t count = 0; + uint32_t stride = 0; + uint32_t count = 0; uint32_t bufferID = 0; // raw buffer id CC_INLINE uint8_t *getBuffer(uint *size) const { return GET_RAW_BUFFER(bufferID, size); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL InstancedAttributeView { - uint32_t nameID = 0; - uint32_t format = 0; + uint32_t nameID = 0; + uint32_t format = 0; uint32_t isNormalized = 0; - uint32_t bufferID = 0; + uint32_t bufferID = 0; CC_INLINE const uint8_t *getBuffer(uint *size) const { return GET_RAW_BUFFER(bufferID, size); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL RenderingSubMesh { uint32_t flatBuffersID = 0; // array pool id - CC_INLINE const uint *getFlatBufferArrayID() const { return GET_FLAT_BUFFER_ARRAY(flatBuffersID); } - CC_INLINE const FlatBufferView *getFlatBuffer(uint idx) const { return GET_FLAT_BUFFER(idx); } + CC_INLINE const uint * getFlatBufferArrayID() const { return GET_FLAT_BUFFER_ARRAY(flatBuffersID); } + static CC_INLINE const FlatBufferView *getFlatBuffer(uint idx) { return GET_FLAT_BUFFER(idx); } - const static se::PoolType type; + const static se::PoolType TYPE; }; enum class CC_DLL BatchingSchemes { @@ -243,18 +253,18 @@ enum class CC_DLL BatchingSchemes { }; struct CC_DLL PassView { - uint32_t priority = 0; - uint32_t stage = 0; - uint32_t phase = 0; - uint32_t batchingScheme = 0; - uint32_t primitive = 0; - uint32_t dynamicState = 0; - uint32_t hash = 0; - uint32_t rasterizerStateID = 0; + uint32_t priority = 0; + uint32_t stage = 0; + uint32_t phase = 0; + uint32_t batchingScheme = 0; + uint32_t primitive = 0; + uint32_t dynamicState = 0; + uint32_t hash = 0; + uint32_t rasterizerStateID = 0; uint32_t depthStencilStateID = 0; - uint32_t blendStateID = 0; - uint32_t descriptorSetID = 0; - uint32_t pipelineLayoutID = 0; + uint32_t blendStateID = 0; + uint32_t descriptorSetID = 0; + uint32_t pipelineLayoutID = 0; CC_INLINE BatchingSchemes getBatchingScheme() const { return static_cast(batchingScheme); } CC_INLINE gfx::PrimitiveMode getPrimitive() const { return static_cast(primitive); } @@ -265,189 +275,199 @@ struct CC_DLL PassView { CC_INLINE gfx::DescriptorSet *getDescriptorSet() const { return GET_DESCRIPTOR_SET(descriptorSetID); } CC_INLINE gfx::PipelineLayout *getPipelineLayout() const { return GET_PIPELINE_LAYOUT(pipelineLayoutID); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL SubModelView { - uint32_t priority = 0; - uint32_t passCount = 0; - uint32_t passID[4] = {0, 0, 0, 0}; - uint32_t shaderID[4] = {0, 0, 0, 0}; - uint32_t planarShaderID = 0; - uint32_t descriptorSetID = 0; - uint32_t inputAssemblerID = 0; - uint32_t subMeshID = 0; + uint32_t priority = 0; + uint32_t passCount = 0; + uint32_t passID[4] = {0, 0, 0, 0}; + uint32_t shaderID[4] = {0, 0, 0, 0}; + uint32_t planarShaderID = 0; + uint32_t planarInstanceShaderID = 0; + uint32_t descriptorSetID = 0; + uint32_t inputAssemblerID = 0; + uint32_t subMeshID = 0; CC_INLINE const PassView *getPassView(uint idx) const { return GET_PASS(passID[idx]); } CC_INLINE gfx::Shader *getShader(uint idx) const { return GET_SHADER(shaderID[idx]); } CC_INLINE gfx::Shader *getPlanarShader() const { return GET_SHADER(planarShaderID); } + CC_INLINE gfx::Shader *getPlanarInstanceShader() const { return GET_SHADER(planarInstanceShaderID); } CC_INLINE gfx::DescriptorSet *getDescriptorSet() const { return GET_DESCRIPTOR_SET(descriptorSetID); } CC_INLINE gfx::InputAssembler *getInputAssembler() const { return GET_IA(inputAssemblerID); } CC_INLINE const RenderingSubMesh *getSubMesh() const { return GET_RENDER_SUBMESH(subMeshID); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL ModelView { - uint32_t enabled = 0; - uint32_t visFlags = 0; - uint32_t castShadow = 0; - uint32_t receiveShadow = 0; - uint32_t worldBoundsID = 0; // aabb - uint32_t nodeID = 0; - uint32_t transformID = 0; - uint32_t subModelsID = 0; // array pool id + uint32_t enabled = 0; + uint32_t visFlags = 0; + uint32_t castShadow = 0; + uint32_t receiveShadow = 0; + uint32_t worldBoundsID = 0; // aabb + uint32_t nodeID = 0; + uint32_t transformID = 0; + uint32_t subModelsID = 0; // array pool id uint32_t instancedBufferID = 0; // raw buffer id - uint32_t instancedAttrsID = 0; // array pool id + uint32_t instancedAttrsID = 0; // array pool id CC_INLINE const AABB *getWorldBounds() const { return GET_AABB(worldBoundsID); } CC_INLINE const Node *getNode() const { return GET_NODE(nodeID); } CC_INLINE const Node *getTransform() const { return GET_NODE(transformID); } - CC_INLINE const uint *getSubModelID() const { return GET_SUBMODEL_ARRAY(subModelsID); } - CC_INLINE const SubModelView *getSubModelView(uint idx) const { return GET_SUBMODEL(idx); } + CC_INLINE const uint * getSubModelID() const { return GET_SUBMODEL_ARRAY(subModelsID); } + static CC_INLINE const SubModelView *getSubModelView(uint idx) { return GET_SUBMODEL(idx); } CC_INLINE const uint8_t *getInstancedBuffer(uint *size) const { return GET_RAW_BUFFER(instancedBufferID, size); } CC_INLINE const uint *getInstancedAttributeID() const { return GET_ATTRIBUTE_ARRAY(instancedAttrsID); } - CC_INLINE gfx::Attribute *getInstancedAttribute(uint idx) const { return GET_ATTRIBUTE(idx); } - const static se::PoolType type; + static CC_INLINE gfx::Attribute *getInstancedAttribute(uint idx) { return GET_ATTRIBUTE(idx); } + const static se::PoolType TYPE; }; struct CC_DLL UIBatch { - uint32_t visFlags = 0; - uint32_t passCount = 0; - uint32_t passID[4] = {0, 0, 0, 0}; - uint32_t shaderID[4] = {0, 0, 0, 0}; - uint32_t descriptorSetID = 0; + uint32_t visFlags = 0; + uint32_t passCount = 0; + uint32_t passID[4] = {0, 0, 0, 0}; + uint32_t shaderID[4] = {0, 0, 0, 0}; + uint32_t descriptorSetID = 0; uint32_t inputAssemblerID = 0; - + CC_INLINE const PassView *getPassView(uint idx) const { return GET_PASS(passID[idx]); } CC_INLINE gfx::Shader *getShader(uint idx) const { return GET_SHADER(shaderID[idx]); } CC_INLINE gfx::DescriptorSet *getDescriptorSet() const { return GET_DESCRIPTOR_SET(descriptorSetID); } CC_INLINE gfx::InputAssembler *getInputAssembler() const { return GET_IA(inputAssemblerID); } - - const static se::PoolType type; + + const static se::PoolType TYPE; }; struct CC_DLL Scene { uint32_t mainLightID = 0; uint32_t modelsID = 0; // array pool - uint32_t sphereLights; // array pool - uint32_t spotLights; // array pool - uint32_t uiBatches; // array pool + uint32_t sphereLights = 0; // array pool + uint32_t spotLights = 0; // array pool + uint32_t uiBatches = 0; // array pool CC_INLINE const Light *getMainLight() const { return GET_LIGHT(mainLightID); } - CC_INLINE const uint *getSphereLightArrayID() const { return GET_LIGHT_ARRAY(sphereLights); } - CC_INLINE const Light *getSphereLight(uint idx) const { return GET_LIGHT(idx); } - CC_INLINE const uint *getSpotLightArrayID() const { return GET_LIGHT_ARRAY(spotLights); } - CC_INLINE const Light *getSpotLight(uint idx) const { return GET_LIGHT(idx); } - CC_INLINE const uint *getModels() const { return GET_MODEL_ARRAY(modelsID); } - CC_INLINE const ModelView *getModelView(uint idx) const { return GET_MODEL(idx); } - CC_INLINE const uint *getUIBatches() const {return GET_UI_BATCH_ARRAY(uiBatches);} + CC_INLINE const uint * getSphereLightArrayID() const { return GET_LIGHT_ARRAY(sphereLights); } + static CC_INLINE const Light *getSphereLight(uint idx) { return GET_LIGHT(idx); } + CC_INLINE const uint * getSpotLightArrayID() const { return GET_LIGHT_ARRAY(spotLights); } + static CC_INLINE const Light *getSpotLight(uint idx) { return GET_LIGHT(idx); } + CC_INLINE const uint * getModels() const { return GET_MODEL_ARRAY(modelsID); } + static CC_INLINE const ModelView *getModelView(uint idx) { return GET_MODEL(idx); } + CC_INLINE const uint *getUIBatches() const { return GET_UI_BATCH_ARRAY(uiBatches); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL RenderWindow { - uint32_t hasOnScreenAttachments = 0; + uint32_t hasOnScreenAttachments = 0; uint32_t hasOffScreenAttachments = 0; - uint32_t framebufferID = 0; + uint32_t framebufferID = 0; CC_INLINE gfx::Framebuffer *getFramebuffer() const { return GET_FRAMEBUFFER(framebufferID); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL Camera { - uint32_t width = 0; - uint32_t height = 0; - float exposure = 0; - uint32_t clearFlag = 0; - float clearDepth = 0; - uint32_t clearStencil = 0; - uint32_t visibility = 0; - uint32_t nodeID = 0; - uint32_t sceneID = 0; - uint32_t frustumID = 0; - uint32_t windowID = 0; - cc::Vec3 forward; - cc::Vec3 position; - float viewportX = 0; - float viewportY = 0; - float viewportWidth = 0; - float viewportHeight = 0; + uint32_t width = 0; + uint32_t height = 0; + float exposure = 0; + uint32_t clearFlag = 0; + float clearDepth = 0; + uint32_t clearStencil = 0; + uint32_t visibility = 0; + uint32_t nodeID = 0; + uint32_t sceneID = 0; + uint32_t frustumID = 0; + uint32_t windowID = 0; + cc::Vec3 forward; + cc::Vec3 position; + float viewportX = 0; + float viewportY = 0; + float viewportWidth = 0; + float viewportHeight = 0; gfx::Color clearColor; - cc::Mat4 matView; - cc::Mat4 matViewProj; - cc::Mat4 matViewProjInv; - cc::Mat4 matProj; - cc::Mat4 matProjInv; + cc::Mat4 matView; + cc::Mat4 matViewProj; + cc::Mat4 matViewProjInv; + cc::Mat4 matProj; + cc::Mat4 matProjInv; + cc::Mat4 matViewProjOffscreen; + cc::Mat4 matViewProjInvOffscreen; + cc::Mat4 matProjOffscreen; + cc::Mat4 matProjInvOffscreen; CC_INLINE const Node *getNode() const { return GET_NODE(nodeID); } CC_INLINE const Scene *getScene() const { return GET_SCENE(sceneID); } CC_INLINE const Frustum *getFrustum() const { return GET_FRUSTUM(frustumID); } CC_INLINE const RenderWindow *getWindow() const { return GET_WINDOW(windowID); } - - const static se::PoolType type; + + const static se::PoolType TYPE; }; struct CC_DLL Ambient { - uint32_t enabled = 0; - float skyIllum = 0; + uint32_t enabled = 0; + float skyIllum = 0; cc::Vec4 skyColor; cc::Vec4 groundAlbedo; - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL Fog { - uint32_t enabled = 0; - uint32_t fogType = 0; - float fogDensity = 0; - float fogStart = 0; - float fogEnd = 0; - float fogAtten = 0; - float fogTop = 0; - float fogRange = 0; + uint32_t enabled = 0; + uint32_t fogType = 0; + float fogDensity = 0; + float fogStart = 0; + float fogEnd = 0; + float fogAtten = 0; + float fogTop = 0; + float fogRange = 0; cc::Vec4 fogColor; - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL Sphere { - float radius = 0; + float radius = 0; cc::Vec3 center; CC_INLINE void setCenter(const cc::Vec3 &val) { center = val; } CC_INLINE void setRadius(float val) { radius = val; } - void define(const AABB &aabb); - void mergeAABB(const AABB *aabb); - void mergePoint(const cc::Vec3 &point); - bool interset(const Frustum &frustum) const; - int interset(const Plane &plane) const; + void define(const AABB &aabb); + void mergeAABB(const AABB *aabb); + void mergePoint(const cc::Vec3 &point); + bool interset(const Frustum &frustum) const; + int interset(const Plane &plane) const; - const static se::PoolType type; + const static se::PoolType TYPE; }; -bool sphere_frustum(const Sphere *sphere, const Frustum *frustum); +bool sphere_frustum(const Sphere *sphere, const Frustum *frustum); //NOLINT enum class CC_DLL ShadowType { - PLANAR = 0, + PLANAR = 0, SHADOWMAP = 1 }; struct CC_DLL Shadows { - uint32_t enabled = 0; - uint32_t dirty = 0; - uint32_t shadowType = 0; - float distance = 0.0f; - uint32_t instancePass = 0; - uint32_t planarPass = 0; - float nearValue = 0.0f; - float farValue = 0.0f; - float aspect = 0.0f; - uint32_t pcfType = 0; + uint32_t enabled = 0; + uint32_t dirty = 0; + uint32_t shadowType = 0; + float distance = 0.0F; + uint32_t instancePass = 0; + uint32_t planarPass = 0; + float nearValue = 0.0F; + float farValue = 0.0F; + float aspect = 0.0F; + uint32_t pcfType = 0; uint32_t shadowMapDirty = 0; - float bias = 0.0f; - float orthoSize = 0.0f; - uint32_t autoAdapt = 0; + float bias = 0.0F; + uint32_t packing = 0; + uint32_t linear = 0; + uint32_t selfShadow = 0; + float normalBias = 0.0F; + float orthoSize = 0.0F; + uint32_t autoAdapt = 0; cc::Vec4 color; cc::Vec2 size; @@ -458,25 +478,50 @@ struct CC_DLL Shadows { CC_INLINE PassView *getPlanarShadowPass() const { return GET_PASS(planarPass); } CC_INLINE PassView *getInstancePass() const { return GET_PASS(instancePass); } - const static se::PoolType type; + const static se::PoolType TYPE; }; struct CC_DLL Skybox { uint32_t enabled = 0; - uint32_t isRGBE = 0; - uint32_t useIBL = 0; + uint32_t isRGBE = 0; + uint32_t useIBL = 0; uint32_t modelID = 0; CC_INLINE const ModelView *getModel() const { return GET_MODEL(modelID); } - const static se::PoolType type; + const static se::PoolType TYPE; +}; + +struct CC_DLL PipelineSharedSceneData { + uint32_t shadow = 0; + uint32_t skybox = 0; + uint32_t ambient = 0; + uint32_t fog = 0; + uint32_t isHDR = 0; + uint32_t shadingScale = 0; + uint32_t fpScale = 0; + uint32_t deferredLightPass = 0; + uint32_t deferredLightPassShader = 0; + uint32_t deferredPostPass = 0; + uint32_t deferredPostPassShader = 0; + + CC_INLINE Shadows *getShadows() const { return GET_SHADOWS(shadow); } + CC_INLINE Skybox *getSkybox() const { return GET_SKYBOX(skybox); } + CC_INLINE Ambient *getAmbient() const { return GET_AMBIENT(ambient); } + CC_INLINE Fog *getFog() const { return GET_FOG(fog); } + CC_INLINE PassView *getDeferredLightPass() const { return GET_PASS(deferredLightPass); } + CC_INLINE gfx::Shader *getDeferredLightPassShader() const { return GET_SHADER(deferredLightPassShader); } + CC_INLINE PassView *getDeferredPostPass() const { return GET_PASS(deferredPostPass); } + CC_INLINE gfx::Shader *getDeferredPostPassShader() const { return GET_SHADER(deferredPostPassShader); } + + const static se::PoolType TYPE; }; struct CC_DLL Root { float cumulativeTime = 0; - float frameTime = 0; + float frameTime = 0; - const static se::PoolType type; + const static se::PoolType TYPE; }; } //namespace pipeline diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp index a295721467..e8d83c9aac 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp @@ -1,55 +1,55 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "ShadowFlow.h" #include "../Define.h" #include "../forward/ForwardPipeline.h" #include "../helper/SharedMemory.h" #include "ShadowStage.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXDevice.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXRenderPass.h" -#include "gfx/GFXTexture.h" -#include "../forward/SceneCulling.h" +#include "gfx-base/GFXDevice.h" +#include "gfx-base/GFXFramebuffer.h" +#include "gfx-base/GFXRenderPass.h" +#include "gfx-base/GFXTexture.h" +#include "../SceneCulling.h" -namespace cc { -namespace pipeline { -RenderFlowInfo ShadowFlow::_initInfo = { +namespace cc::pipeline { +RenderFlowInfo ShadowFlow::initInfo = { "ShadowFlow", static_cast(ForwardFlowPriority::SHADOW), static_cast(RenderFlowTag::SCENE), - {}}; -const RenderFlowInfo &ShadowFlow::getInitializeInfo() { return ShadowFlow::_initInfo; } + {}, +}; +const RenderFlowInfo &ShadowFlow::getInitializeInfo() { return ShadowFlow::initInfo; } -ShadowFlow::~ShadowFlow() { -} +ShadowFlow::~ShadowFlow() = default; bool ShadowFlow::initialize(const RenderFlowInfo &info) { RenderFlow::initialize(info); if (_stages.empty()) { - auto shadowStage = CC_NEW(ShadowStage); + auto *shadowStage = CC_NEW(ShadowStage); shadowStage->initialize(ShadowStage::getInitializeInfo()); _stages.emplace_back(shadowStage); } @@ -62,30 +62,29 @@ void ShadowFlow::activate(RenderPipeline *pipeline) { } void ShadowFlow::render(Camera *camera) { - auto *pipeline = static_cast(_pipeline); - const auto *shadowInfo = pipeline->getShadows(); + const auto *sceneData = _pipeline->getPipelineSceneData(); + const auto *shadowInfo = sceneData->getSharedData()->getShadows(); if (!shadowInfo->enabled || shadowInfo->getShadowType() != ShadowType::SHADOWMAP) return; lightCollecting(camera, _validLights); - shadowCollecting(pipeline, camera); - if (pipeline->getShadowObjects().empty()) { + if (sceneData->getShadowObjects().empty()) { clearShadowMap(camera); return; } - const auto &shadowFramebufferMap = pipeline->getShadowFramebufferMap(); + const auto &shadowFramebufferMap = sceneData->getShadowFramebufferMap(); for (const auto *light : _validLights) { if (!shadowFramebufferMap.count(light)) { - initShadowFrameBuffer(pipeline, light); + initShadowFrameBuffer(_pipeline, light); } auto *shadowFrameBuffer = shadowFramebufferMap.at(light); if (shadowInfo->shadowMapDirty) { - resizeShadowMap(light, (uint)shadowInfo->size.x, (uint)shadowInfo->size.y); + resizeShadowMap(light, shadowInfo); } - for (auto *_stage : _stages) { - auto *shadowStage = static_cast(_stage); + for (auto *stage : _stages) { + auto *shadowStage = dynamic_cast(stage); shadowStage->setUseData(light, shadowFrameBuffer); shadowStage->render(camera); } @@ -93,44 +92,48 @@ void ShadowFlow::render(Camera *camera) { // After the shadowMap rendering of all lights is completed, // restore the ShadowUBO data of the main light. - pipeline->updateShadowUBO(camera); + _pipeline->getPipelineUBO()->updateShadowUBO(camera); } void ShadowFlow::clearShadowMap(Camera *camera) { - auto *pipeline = static_cast(_pipeline); - const auto &shadowFramebufferMap = pipeline->getShadowFramebufferMap(); + auto *sceneData = _pipeline->getPipelineSceneData(); + const auto &shadowFramebufferMap = sceneData->getShadowFramebufferMap(); for (const auto *light : _validLights) { if (!shadowFramebufferMap.count(light)) { continue; } auto *shadowFrameBuffer = shadowFramebufferMap.at(light); - for (auto *_stage : _stages) { - auto *shadowStage = static_cast(_stage); + for (auto *stage : _stages) { + auto *shadowStage = dynamic_cast(stage); shadowStage->setUseData(light, shadowFrameBuffer); shadowStage->clearFramebuffer(camera); } } } -void ShadowFlow::resizeShadowMap(const Light *light, const uint width, const uint height) const { - auto *pipeline = static_cast(_pipeline); +void ShadowFlow::resizeShadowMap(const Light *light, const Shadows *shadowInfo) const { + auto *sceneData = _pipeline->getPipelineSceneData(); - if (pipeline->getShadowFramebufferMap().count(light)) { - auto *framebuffer = pipeline->getShadowFramebufferMap().at(light); + if (sceneData->getShadowFramebufferMap().count(light)) { + auto *framebuffer = sceneData->getShadowFramebufferMap().at(light); if (!framebuffer) { return; } - auto &renderTargets = framebuffer->getColorTextures(); - for (auto *renderTarget : renderTargets) { - renderTarget->resize(width, height); - } + vector renderTargets; + renderTargets.emplace_back(gfx::Device::getInstance()->createTexture({ + gfx::TextureType::TEX2D, + gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED, + static_cast(shadowInfo->packing) ? gfx::Format::RGBA8 : gfx::Format::RGBA16F, + static_cast(shadowInfo->size.x), + static_cast(shadowInfo->size.y), + })); auto *depth = framebuffer->getDepthStencilTexture(); if (depth) { - depth->resize(width, height); + depth->resize(static_cast(shadowInfo->size.x), static_cast(shadowInfo->size.y)); } framebuffer->destroy(); @@ -143,40 +146,46 @@ void ShadowFlow::resizeShadowMap(const Light *light, const uint width, const uin } } -void ShadowFlow::initShadowFrameBuffer(ForwardPipeline *pipeline, const Light *light) { - auto device = gfx::Device::getInstance(); - const auto shadowMapSize = static_cast(this->_pipeline)->getShadows()->size; - const auto width = (uint)shadowMapSize.x; - const auto height = (uint)shadowMapSize.y; +void ShadowFlow::initShadowFrameBuffer(RenderPipeline *pipeline, const Light *light) { + auto *device = gfx::Device::getInstance(); + const auto *sceneData = _pipeline->getPipelineSceneData(); + const auto *shadowInfo = sceneData->getSharedData()->getShadows(); + const auto shadowMapSize = shadowInfo->size; + const auto width = static_cast(shadowMapSize.x); + const auto height = static_cast(shadowMapSize.y); if (!_renderPass) { - _renderPass = device->createRenderPass({ - {{ - gfx::Format::RGBA8, - 1, - gfx::LoadOp::CLEAR, // should clear color attachment - gfx::StoreOp::STORE, - gfx::TextureLayout::UNDEFINED, - gfx::TextureLayout::PRESENT_SRC, - }}, - { - device->getDepthStencilFormat(), - 1, - gfx::LoadOp::CLEAR, - gfx::StoreOp::DISCARD, - gfx::LoadOp::CLEAR, - gfx::StoreOp::DISCARD, - gfx::TextureLayout::UNDEFINED, - gfx::TextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL, - }, - }); + const gfx::ColorAttachment colorAttachment = { + gfx::Format::RGBA8, + gfx::SampleCount::X1, + gfx::LoadOp::CLEAR, + gfx::StoreOp::STORE, + {}, + {}, + }; + + const gfx::DepthStencilAttachment depthStencilAttachment = { + device->getDepthStencilFormat(), + gfx::SampleCount::X1, + gfx::LoadOp::CLEAR, + gfx::StoreOp::DISCARD, + gfx::LoadOp::CLEAR, + gfx::StoreOp::DISCARD, + {}, + {}, + }; + + gfx::RenderPassInfo rpInfo; + rpInfo.colorAttachments.emplace_back(colorAttachment); + rpInfo.depthStencilAttachment = depthStencilAttachment; + _renderPass = device->createRenderPass(rpInfo); } vector renderTargets; renderTargets.emplace_back(device->createTexture({ gfx::TextureType::TEX2D, gfx::TextureUsageBit::COLOR_ATTACHMENT | gfx::TextureUsageBit::SAMPLED, - gfx::Format::RGBA8, + static_cast(shadowInfo->packing) ? gfx::Format::RGBA8 : gfx::Format::RGBA16F, width, height, })); @@ -196,12 +205,10 @@ void ShadowFlow::initShadowFrameBuffer(ForwardPipeline *pipeline, const Light *l {}, //colorMipmapLevels }); - pipeline->setShadowFramebuffer(light, framebuffer); + pipeline->getPipelineSceneData()->setShadowFramebuffer(light, framebuffer); } void ShadowFlow::destroy() { - static_cast(_pipeline)->destroyShadowFrameBuffers(); - if (_renderPass) { _renderPass->destroy(); _renderPass = nullptr; @@ -212,5 +219,4 @@ void ShadowFlow::destroy() { RenderFlow::destroy(); } -} // namespace pipeline -} // namespace cc +} // namespace cc::pipeline diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.h b/native/cocos/renderer/pipeline/shadow/ShadowFlow.h index 27ce3865db..c66d2b5c87 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.h +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "../RenderFlow.h" namespace cc { @@ -28,31 +30,31 @@ namespace pipeline { class ForwardPipeline; struct Light; struct Camera; +struct Shadows; class CC_DLL ShadowFlow : public RenderFlow { public: ShadowFlow() = default; - virtual ~ShadowFlow(); + ~ShadowFlow() override; static const RenderFlowInfo &getInitializeInfo(); - virtual bool initialize(const RenderFlowInfo &info) override; + bool initialize(const RenderFlowInfo &info) override; - virtual void activate(RenderPipeline *pipeline) override; + void activate(RenderPipeline *pipeline) override; - virtual void render(Camera *camera) override; + void render(Camera *camera) override; - virtual void destroy() override; + void destroy() override; private: void clearShadowMap(Camera *camera); - void resizeShadowMap(const Light *light, const uint width, const uint height) const; + void resizeShadowMap(const Light *light, const Shadows *shadowInfo) const; - void initShadowFrameBuffer(ForwardPipeline *pipeline, const Light *light); + void initShadowFrameBuffer(RenderPipeline *pipeline, const Light *light); -private: - static RenderFlowInfo _initInfo; + static RenderFlowInfo initInfo; gfx::RenderPass *_renderPass = nullptr; diff --git a/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp b/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp index 6463795332..39ebdb6761 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowStage.cpp @@ -1,51 +1,46 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 "ShadowStage.h" #include "../Define.h" #include "../ShadowMapBatchedQueue.h" #include "../forward/ForwardPipeline.h" #include "../helper/SharedMemory.h" -#include "gfx/GFXCommandBuffer.h" -#include "gfx/GFXDescriptorSet.h" -#include "gfx/GFXFramebuffer.h" -#include "gfx/GFXTexture.h" +#include "gfx-base/GFXCommandBuffer.h" +#include "gfx-base/GFXFramebuffer.h" #include "math/Vec2.h" namespace cc { namespace pipeline { -ShadowStage::ShadowStage() { -} -ShadowStage::~ShadowStage() { -} - -RenderStageInfo ShadowStage::_initInfo = { +RenderStageInfo ShadowStage::initInfo = { "ShadowStage", static_cast(ForwardStagePriority::FORWARD), static_cast(RenderFlowTag::SCENE), {}}; -const RenderStageInfo &ShadowStage::getInitializeInfo() { return ShadowStage::_initInfo; } +const RenderStageInfo &ShadowStage::getInitializeInfo() { return ShadowStage::initInfo; } bool ShadowStage::initialize(const RenderStageInfo &info) { RenderStage::initialize(info); @@ -62,50 +57,51 @@ void ShadowStage::activate(RenderPipeline *pipeline, RenderFlow *flow) { } void ShadowStage::render(Camera *camera) { - const auto pipeline = static_cast(_pipeline); - const auto shadowInfo = pipeline->getShadows(); + const auto *sceneData = _pipeline->getPipelineSceneData(); + const auto *sharedData = sceneData->getSharedData(); + const auto *shadowInfo = sceneData->getSharedData()->getShadows(); if (!_light || !_framebuffer) { return; } - auto cmdBuffer = pipeline->getCommandBuffers()[0]; + auto *cmdBuffer = _pipeline->getCommandBuffers()[0]; _additiveShadowQueue->gatherLightPasses(_light, cmdBuffer); const auto shadowMapSize = shadowInfo->size; - _renderArea.x = (int)(camera->viewportX * shadowMapSize.x); - _renderArea.y = (int)(camera->viewportY * shadowMapSize.y); - _renderArea.width = (uint)(camera->viewportWidth * shadowMapSize.x * pipeline->getShadingScale()); - _renderArea.height = (uint)(camera->viewportHeight * shadowMapSize.y * pipeline->getShadingScale()); + _renderArea.x = static_cast(camera->viewportX * shadowMapSize.x); + _renderArea.y = static_cast(camera->viewportY * shadowMapSize.y); + _renderArea.width = static_cast(camera->viewportWidth * shadowMapSize.x * sharedData->shadingScale); + _renderArea.height = static_cast(camera->viewportHeight * shadowMapSize.y * sharedData->shadingScale); - _clearColors[0] = {1.0f, 1.0f, 1.0f, 1.0f}; + _clearColors[0] = {1.0F, 1.0F, 1.0F, 1.0F}; auto* renderPass = _framebuffer->getRenderPass(); cmdBuffer->beginRenderPass(renderPass, _framebuffer, _renderArea, _clearColors, camera->clearDepth, camera->clearStencil); - cmdBuffer->bindDescriptorSet(GLOBAL_SET, pipeline->getDescriptorSet()); + cmdBuffer->bindDescriptorSet(globalSet, _pipeline->getDescriptorSet()); _additiveShadowQueue->recordCommandBuffer(_device, renderPass, cmdBuffer); cmdBuffer->endRenderPass(); } -void ShadowStage::destroy() { +void ShadowStage::destroy() { CC_SAFE_DESTROY(_additiveShadowQueue); RenderStage::destroy(); } void ShadowStage::clearFramebuffer(Camera *camera) { - const auto pipeline = static_cast(_pipeline); + auto *pipeline = dynamic_cast(_pipeline); if (!_light || !_framebuffer) { return; } - auto cmdBuffer = pipeline->getCommandBuffers()[0]; + auto *cmdBuffer = pipeline->getCommandBuffers()[0]; - _clearColors[0] = {1.0f, 1.0f, 1.0f, 1.0f}; + _clearColors[0] = {1.0F, 1.0F, 1.0F, 1.0F}; auto *renderPass = _framebuffer->getRenderPass(); cmdBuffer->beginRenderPass(renderPass, _framebuffer, _renderArea, diff --git a/native/cocos/renderer/pipeline/shadow/ShadowStage.h b/native/cocos/renderer/pipeline/shadow/ShadowStage.h index cf0b73a30a..ee8276b518 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowStage.h +++ b/native/cocos/renderer/pipeline/shadow/ShadowStage.h @@ -1,26 +1,28 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2020-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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. ****************************************************************************/ + #pragma once #include "../RenderStage.h" @@ -32,15 +34,15 @@ struct Camera; class CC_DLL ShadowStage : public RenderStage { public: - ShadowStage(); - virtual ~ShadowStage(); + ShadowStage() = default; + ~ShadowStage() override = default; static const RenderStageInfo &getInitializeInfo(); - virtual bool initialize(const RenderStageInfo &info) override; - virtual void destroy() override; - virtual void render(Camera *camera) override; - virtual void activate(RenderPipeline *pipeline, RenderFlow *flow) override; + bool initialize(const RenderStageInfo &info) override; + void destroy() override; + void render(Camera *camera) override; + void activate(RenderPipeline *pipeline, RenderFlow *flow) override; CC_INLINE void setFramebuffer(gfx::Framebuffer *framebuffer) { _framebuffer = framebuffer; } CC_INLINE void setUseData(const Light *light, gfx::Framebuffer *framebuffer) { @@ -51,7 +53,7 @@ public: void clearFramebuffer(Camera *camera); private: - static RenderStageInfo _initInfo; + static RenderStageInfo initInfo; gfx::Rect _renderArea; const Light *_light = nullptr; diff --git a/native/cocos/storage/local-storage/LocalStorage-android.cpp b/native/cocos/storage/local-storage/LocalStorage-android.cpp index 80f4e21db0..6fd6fda860 100644 --- a/native/cocos/storage/local-storage/LocalStorage-android.cpp +++ b/native/cocos/storage/local-storage/LocalStorage-android.cpp @@ -1,19 +1,22 @@ -/*************************************************************************** +/**************************************************************************** Copyright (c) 2012 Zynga Inc. Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologic Inc. Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -22,7 +25,7 @@ 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. -***************************************************************************/ +****************************************************************************/ /* Local Storage support for the JS Bindings for iOS. diff --git a/native/cocos/storage/local-storage/LocalStorage.cpp b/native/cocos/storage/local-storage/LocalStorage.cpp index 104fc6bcb3..deb02fea7f 100644 --- a/native/cocos/storage/local-storage/LocalStorage.cpp +++ b/native/cocos/storage/local-storage/LocalStorage.cpp @@ -1,3 +1,28 @@ +/**************************************************************************** + Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/ + /* Copyright (c) 2012 - Zynga Inc. diff --git a/native/cocos/storage/local-storage/LocalStorage.h b/native/cocos/storage/local-storage/LocalStorage.h index 7b24316283..0d59daf174 100644 --- a/native/cocos/storage/local-storage/LocalStorage.h +++ b/native/cocos/storage/local-storage/LocalStorage.h @@ -1,27 +1,28 @@ /**************************************************************************** -Copyright (c) 2012 Zynga Inc. -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2012 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. -http://www.cocos2d-x.org + http://www.cocos.com -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: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. -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. + 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 __JSB_LOCALSTORAGE_H diff --git a/native/cocos/ui/edit-box/EditBox-android.cpp b/native/cocos/ui/edit-box/EditBox-android.cpp index 75053f5dc0..7ecf3ef9ec 100644 --- a/native/cocos/ui/edit-box/EditBox-android.cpp +++ b/native/cocos/ui/edit-box/EditBox-android.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com - http://www.cocos2d-x.org - 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,7 @@ 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 "cocos/bindings/event/EventDispatcher.h" #include "platform/Application.h" diff --git a/native/cocos/ui/edit-box/EditBox-ios.mm b/native/cocos/ui/edit-box/EditBox-ios.mm index 0d37b75c24..82668d5055 100644 --- a/native/cocos/ui/edit-box/EditBox-ios.mm +++ b/native/cocos/ui/edit-box/EditBox-ios.mm @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "EditBox.h" #include "platform/Application.h" #include "cocos/bindings/jswrapper/SeApi.h" diff --git a/native/cocos/ui/edit-box/EditBox-mac.mm b/native/cocos/ui/edit-box/EditBox-mac.mm index 3310f1d64e..c87f463d86 100644 --- a/native/cocos/ui/edit-box/EditBox-mac.mm +++ b/native/cocos/ui/edit-box/EditBox-mac.mm @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,12 +21,12 @@ 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 "EditBox.h" #include "platform/Application.h" #include "cocos/bindings/jswrapper/SeApi.h" #include "cocos/bindings/manual/jsb_global.h" -#include "cocos/bindings/event/CustomEventTypes.h" #import @@ -75,6 +76,10 @@ se::Value g_textInputCallback; return TRUE; } + +- (void) textDidEndEditing:(NSNotification *)notification { + cc::EditBox::complete(); +} @end /************************************************************************* @@ -88,6 +93,9 @@ se::Value g_textInputCallback; NSTextField *textField = [notification object]; callJSFunc("input", [textField.stringValue UTF8String]); } +- (void)controlTextDidEndEditing:(NSNotification *)obj { + cc::EditBox::complete(); +} @end /************************************************************************* @@ -242,7 +250,6 @@ void init(const cc::EditBox::ShowInfo &showInfo) { namespace cc { -uint32_t EditBox::mouseDownListenerId = 0; bool EditBox::_isShown = false; void EditBox::show(const ShowInfo &showInfo) { @@ -253,13 +260,6 @@ void EditBox::show(const ShowInfo &showInfo) { init(showInfo); EditBox::_isShown = true; - EditBox::mouseDownListenerId = EventDispatcher::addCustomEventListener(EVENT_MOUSE_DOWN, EditBox::onMouseDown); -} - -void EditBox::onMouseDown(const CustomEvent &event) { - if (event.name == EVENT_MOUSE_DOWN) { - EditBox::complete(); - } } void EditBox::hide() { @@ -277,10 +277,6 @@ void EditBox::hide() { } EditBox::_isShown = false; - if (EditBox::mouseDownListenerId != 0) { - EventDispatcher::removeCustomEventListener(EVENT_MOUSE_DOWN, EditBox::mouseDownListenerId); - EditBox::mouseDownListenerId = 0; - } } bool EditBox::complete() { diff --git a/native/cocos/ui/edit-box/EditBox-win32.cpp b/native/cocos/ui/edit-box/EditBox-win32.cpp index 2f3446f26b..14e198859c 100644 --- a/native/cocos/ui/edit-box/EditBox-win32.cpp +++ b/native/cocos/ui/edit-box/EditBox-win32.cpp @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,7 +21,8 @@ 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 "EditBox.h" #include "platform/Application.h" #include "platform/win32/View-win32.h" @@ -41,8 +43,10 @@ namespace cc { ************************************************************************/ namespace { +bool g_isMultiline = false; HWND g_hwndEditBox = nullptr; WNDPROC g_prevMainWindowProc = nullptr; +WNDPROC g_prevEditWindowProc = nullptr; se::Value g_textInputCallback; int getCocosWindowHeight() { @@ -117,6 +121,22 @@ LRESULT mainWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { return CallWindowProc(g_prevMainWindowProc, hwnd, msg, wParam, lParam); } + +LRESULT editWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + switch (msg) { + case WM_KEYUP: + if (wParam == VK_RETURN && !g_isMultiline) { + EditBox::complete(); + EditBox::hide(); + SetFocus(cc_get_application_view()->getWindowHandler()); + } + break; + default: + break; + } + + return CallWindowProc(g_prevEditWindowProc, hwnd, msg, wParam, lParam); +} } // namespace /************************************************************************* @@ -126,11 +146,12 @@ void EditBox::show(const EditBox::ShowInfo &showInfo) { int windowHeight = getCocosWindowHeight(); if (!g_hwndEditBox) { HWND parent = cc_get_application_view()->getWindowHandler(); - g_prevMainWindowProc = (WNDPROC)SetWindowLongPtr(parent, GWL_WNDPROC, (LONG_PTR)mainWindowProc); UINT32 flags = WS_CHILD | ES_LEFT | WS_TABSTOP | ES_AUTOHSCROLL; - if (showInfo.isMultiline) + g_isMultiline = showInfo.isMultiline; + if (g_isMultiline) { flags |= ES_MULTILINE; + } if (showInfo.inputType == "password") flags |= WS_EX_TRANSPARENT; @@ -159,7 +180,11 @@ void EditBox::show(const EditBox::ShowInfo &showInfo) { NULL); std::wstring_convert> convert; CC_LOG_DEBUG("Can not create editbox: %s", convert.to_bytes(buffer).c_str()); + return; } + + g_prevMainWindowProc = (WNDPROC)SetWindowLongPtr(parent, GWL_WNDPROC, (LONG_PTR)mainWindowProc); + g_prevEditWindowProc = (WNDPROC)SetWindowLongPtr(g_hwndEditBox, GWL_WNDPROC, (LONG_PTR)editWindowProc); } ::SendMessageW(g_hwndEditBox, EM_LIMITTEXT, showInfo.maxLength, 0); @@ -179,9 +204,10 @@ void EditBox::show(const EditBox::ShowInfo &showInfo) { void EditBox::hide() { DestroyWindow(g_hwndEditBox); - g_hwndEditBox = nullptr; SetWindowLongPtr(cc_get_application_view()->getWindowHandler(), GWL_WNDPROC, (LONG_PTR)g_prevMainWindowProc); + SetWindowLongPtr(g_hwndEditBox, GWL_WNDPROC, (LONG_PTR)g_prevEditWindowProc); + g_hwndEditBox = nullptr; } bool EditBox::complete() { diff --git a/native/cocos/ui/edit-box/EditBox.h b/native/cocos/ui/edit-box/EditBox.h index 0228c0e987..e7ce51c451 100644 --- a/native/cocos/ui/edit-box/EditBox.h +++ b/native/cocos/ui/edit-box/EditBox.h @@ -1,18 +1,19 @@ /**************************************************************************** - Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2018-2021 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com - http://www.cocos2d-x.org - 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. - + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + 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 @@ -20,12 +21,12 @@ 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. - ****************************************************************************/ +****************************************************************************/ + #pragma once #include #include "base/Macros.h" -#include "cocos/bindings/event/EventDispatcher.h" namespace cc { @@ -51,11 +52,6 @@ public: // Don't call it by yourself untile you know the effect. static bool complete(); -#if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) - static uint32_t mouseDownListenerId; - static void onMouseDown(const CustomEvent &); -#endif - private: static bool _isShown; }; diff --git a/native/cocos/ui/videoplayer/VideoPlayer-android.cpp b/native/cocos/ui/videoplayer/VideoPlayer-android.cpp index ead08fad23..5b74b818cc 100644 --- a/native/cocos/ui/videoplayer/VideoPlayer-android.cpp +++ b/native/cocos/ui/videoplayer/VideoPlayer-android.cpp @@ -1,17 +1,19 @@ /**************************************************************************** Copyright (c) 2014 Chukong Technologies Inc. + Copyright (c) undefined-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,7 +22,7 @@ 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 "VideoPlayer.h" diff --git a/native/cocos/ui/videoplayer/VideoPlayer-ios.mm b/native/cocos/ui/videoplayer/VideoPlayer-ios.mm index f2c6615665..e5b9e79a21 100644 --- a/native/cocos/ui/videoplayer/VideoPlayer-ios.mm +++ b/native/cocos/ui/videoplayer/VideoPlayer-ios.mm @@ -1,17 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. + Copyright (c) 2016-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,7 +22,7 @@ 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 "VideoPlayer.h" @@ -48,10 +50,11 @@ typedef NS_ENUM(NSInteger, PlayerbackState) { @property (assign, nonatomic) AVPlayerViewController *playerController; -- (void)setFrame:(int)left:(int)top +- (void)setFrame:(int)left + :(int)top :(int)width :(int)height; -- (void)setURL:(int)videoSource:(std::string &)videoUrl; +- (void)setURL:(int)videoSource :(std::string &)videoUrl; - (void)play; - (void)pause; - (void)resume; @@ -109,7 +112,8 @@ typedef NS_ENUM(NSInteger, PlayerbackState) { [super dealloc]; } -- (void)setFrame:(int)left:(int)top +- (void)setFrame:(int)left + :(int)top :(int)width :(int)height { if (_left == left && _width == width && _top == top && _height == height) @@ -135,7 +139,7 @@ typedef NS_ENUM(NSInteger, PlayerbackState) { return (self.playerController.player && self.playerController.player.rate != 0); } -- (void)setURL:(int)videoSource:(std::string &)videoUrl { +- (void)setURL:(int)videoSource :(std::string &)videoUrl { [self cleanup]; [self initPlayerController]; diff --git a/native/cocos/ui/videoplayer/VideoPlayer.h b/native/cocos/ui/videoplayer/VideoPlayer.h index f1ae8704c7..50868c0ab0 100644 --- a/native/cocos/ui/videoplayer/VideoPlayer.h +++ b/native/cocos/ui/videoplayer/VideoPlayer.h @@ -1,17 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. + Copyright (c) 2016-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -20,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/ui/webview/WebView-inl.h b/native/cocos/ui/webview/WebView-inl.h index 004e3793a5..543c8735be 100644 --- a/native/cocos/ui/webview/WebView-inl.h +++ b/native/cocos/ui/webview/WebView-inl.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 "WebView.h" #include "platform/FileUtils.h" diff --git a/native/cocos/ui/webview/WebView.h b/native/cocos/ui/webview/WebView.h index 0575d85b08..e2ae641466 100644 --- a/native/cocos/ui/webview/WebView.h +++ b/native/cocos/ui/webview/WebView.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/ui/webview/WebViewImpl-android.cpp b/native/cocos/ui/webview/WebViewImpl-android.cpp index 77515c26de..a8f1770e09 100644 --- a/native/cocos/ui/webview/WebViewImpl-android.cpp +++ b/native/cocos/ui/webview/WebViewImpl-android.cpp @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 diff --git a/native/cocos/ui/webview/WebViewImpl-android.h b/native/cocos/ui/webview/WebViewImpl-android.h index f7b73033b8..7fbe30c5af 100644 --- a/native/cocos/ui/webview/WebViewImpl-android.h +++ b/native/cocos/ui/webview/WebViewImpl-android.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ #pragma once diff --git a/native/cocos/ui/webview/WebViewImpl-ios.h b/native/cocos/ui/webview/WebViewImpl-ios.h index 05ac2ec307..6af385e3d7 100644 --- a/native/cocos/ui/webview/WebViewImpl-ios.h +++ b/native/cocos/ui/webview/WebViewImpl-ios.h @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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 __COCOS2D_UI_WEBVIEWIMPL_IOS_H_ #define __COCOS2D_UI_WEBVIEWIMPL_IOS_H_ diff --git a/native/cocos/ui/webview/WebViewImpl-ios.mm b/native/cocos/ui/webview/WebViewImpl-ios.mm index 3041b6e1ae..a525eff0d5 100644 --- a/native/cocos/ui/webview/WebViewImpl-ios.mm +++ b/native/cocos/ui/webview/WebViewImpl-ios.mm @@ -1,18 +1,19 @@ /**************************************************************************** Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd. - http://www.cocos2d-x.org + http://www.cocos.com 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: + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -21,7 +22,7 @@ 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. - ****************************************************************************/ +****************************************************************************/ // Webview not available on tvOS #if (USE_WEBVIEW > 0) && (CC_PLATFORM == CC_PLATFORM_MAC_IOS) diff --git a/native/docs/CODING_STYLE.md b/native/docs/CODING_STYLE.md new file mode 100644 index 0000000000..c494d6042b --- /dev/null +++ b/native/docs/CODING_STYLE.md @@ -0,0 +1,1415 @@ +# ![][1] C++ coding style + +_v0.1 - Last updated March 22, 2021_ + +_Forked from [Google's C++ coding style](https://google.github.io/styleguide/cppguide.html.md)_ + + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* +- [Header Files](#header-files) + - [The #pragma Guard](#the-pragma-guard) + - [Forward Declarations](#forward-declarations) + - [Inline Functions](#inline-functions) + - [The -inl.h Files](#the--inlh-files) + - [Function Parameter Ordering](#function-parameter-ordering) + - [Names and Order of Includes](#names-and-order-of-includes) +- [Scoping](#scoping) + - [Namespaces](#namespaces) + - [Internal Linkage](#internal-linkage) + - [Nonmember, Static Member, and Global Functions](#nonmember-static-member-and-global-functions) + - [Local Variables](#local-variables) + - [Static and Global Variables](#static-and-global-variables) + - [Decision on destrcution:](#decision-on-destrcution) + - [Decision on initialization](#decision-on-initialization) + - [Common patterns](#common-patterns) + - [thread_local variables](#thread_local-variables) +- [Classes](#classes) + - [Doing Work in Constructors](#doing-work-in-constructors) + - [Implicit Conversions](#implicit-conversions) + - [Copyable and Movable Types](#copyable-and-movable-types) + - [Structs vs. Classes](#structs-vs-classes) + - [Structs vs. Pairs and Tuples](#structs-vs-pairs-and-tuples) + - [Inheritance](#inheritance) + - [Operator Overloading](#operator-overloading) + - [Access Control](#access-control) + - [Declaration Order](#declaration-order) +- [Functions](#functions) + - [Inputs and Outputs](#inputs-and-outputs) + - [Write Short Functions](#write-short-functions) + - [Function Overloading](#function-overloading) + - [Default Arguments](#default-arguments) +- [Other C++ Features](#other-c-features) + - [Rvalue references](#rvalue-references) + - [Friends](#friends) + - [Exceptions](#exceptions) + - [noexcept](#noexcept) + - [Casting](#casting) + - [Streams](#streams) + - [Preincrement and Predecrement](#preincrement-and-predecrement) + - [Use of const](#use-of-const) + - [Where to put the const](#where-to-put-the-const) + - [Use of constexpr](#use-of-constexpr) + - [Integer Types](#integer-types) + - [64-bit Portability](#64-bit-portability) + - [Preprocessor Macros](#preprocessor-macros) + - [0 and nullptr/NULL](#0-and-nullptrnull) + - [Type Deduction (including auto)](#type-deduction-including-auto) + - [Lambda Expressions](#lambda-expressions) + - [Template Metaprogramming](#template-metaprogramming) + - [Boost](#boost) + - [Naming](#naming) + - [File Names](#file-names) + - [Type Names](#type-names) + - [Variable Names](#variable-names) + - [Common Variable names](#common-variable-names) + - [Class Data Members](#class-data-members) + - [Struct Data Members](#struct-data-members) + - [Constant Names](#constant-names) + - [Function Names](#function-names) + - [Namespace Names](#namespace-names) + - [Enumerator Names](#enumerator-names) + - [Macro Names](#macro-names) + - [Braced initialization](#braced-initialization) +- [Formatting](#formatting) + + + +# Header Files + +In general, every `.cpp` file should have an associated `.h` file. There are some common exceptions, such as unittests and small `.cpp` files containing just a `main()` function. + +Correct use of header files can make a huge difference to the readability, size and performance of your code. + +The following rules will guide you through the various pitfalls of using header files. + +## The #pragma Guard + +All header files should have `#pragma once` guards to prevent multiple inclusion. + +```cpp +#pragma once +``` + +## Forward Declarations + +You may forward declare ordinary classes in order to avoid unnecessary `#includes`. + +**Definition:** A "forward declaration" is a declaration of a class, function, or template without an associated definition. #include lines can often be replaced with forward declarations of whatever symbols are actually used by the client code. + +**Pros:** + +* Unnecessary #includes force the compiler to open more files and process more input. +* They can also force your code to be recompiled more often, due to changes in the header. + +**Cons:** + +* It can be difficult to determine the correct form of a forward declaration in the presence of features like templates, typedefs, default parameters, and using declarations. +* It can be difficult to determine whether a forward declaration or a full #include is needed for a given piece of code, particularly when implicit conversion operations are involved. In extreme cases, replacing an #include with a forward declaration can silently change the meaning of code. +* Forward declaring multiple symbols from a header can be more verbose than simply `#include`ing the header. +* Forward declarations of functions and templates can prevent the header owners from making otherwise-compatible changes to their APIs; for example, widening a parameter type, or adding a template parameter with a default value. +* Forward declaring symbols from namespace `std::` usually yields undefined behavior. +* Structuring code to enable forward declarations (e.g. using pointer members instead of object members) can make the code slower and more complex. +* The practical efficiency benefits of forward declarations are unproven. + +**Decision:** + +* When using a function declared in a header file, always #include that header. +* When using a class template, prefer to #include its header file. +* When using an ordinary class, relying on a forward declaration is OK, but be wary of situations where a forward declaration may be insufficient or incorrect; when in doubt, just #include the appropriate header. +* Do not replace data members with pointers just to avoid an #include. + +Always #include the file that actually provides the declarations/definitions you need; do not rely on the symbol being brought in transitively via headers not directly included. One exception is that `Myfile.cpp` may rely on #includes and forward declarations from its corresponding header file `Myfile.h`. + +## Inline Functions + +Define functions inline only when they are small, say, 10 lines or less. + +**Definition:** + +You can declare functions in a way that allows the compiler to expand them inline rather than calling them through the usual function call mechanism. + +**Pros:** + +Inlining a function can generate more efficient object code, as long as the inlined function is small. Feel free to inline accessors and mutators, and other short, performance-critical functions. + +**Cons:** + +Overuse of inlining can actually make programs slower. Depending on a function's size, inlining it can cause the code size to increase or decrease. Inlining a very small accessor function will usually decrease code size while inlining a very large function can dramatically increase code size. On modern processors smaller code usually runs faster due to better use of the instruction cache. + +**Decision:** + +A decent rule of thumb is to not inline a function if it is more than 10 lines long. Beware of destructors, which are often longer than they appear because of implicit member- and base-destructor calls! + +Another useful rule of thumb: it's typically not cost effective to inline functions with loops or switch statements (unless, in the common case, the loop or switch statement is never executed). + +It is important to know that functions are not always inlined even if they are declared as such; for example, virtual and recursive functions are not normally inlined. Usually recursive functions should not be inline. The main reason for making a virtual function inline is to place its definition in the class, either for convenience or to document its behavior, e.g., for accessors and mutators. + +## The -inl.h Files + +You may use file names with a `-inl.h` suffix to define complex inline functions when needed. + +The definition of an inline function needs to be in a header file, so that the compiler has the definition available for inlining at the call sites. However, implementation code properly belongs in `.cpp` files, and we do not like to have much actual code in `.h` files unless there is a readability or performance advantage. + +If an inline function definition is short, with very little, if any, logic in it, you should put the code in your `.h` file. For example, accessors and mutators should certainly be inside a class definition. More complex inline functions may also be put in a `.h` file for the convenience of the implementer and callers, though if this makes the .h file too unwieldy you can instead put that code in a separate `-inl.h` file. This separates the implementation from the class definition, while still allowing the implementation to be included where necessary. + +Another use of `-inl.h` files is for definitions of function templates. This can be used to keep your template definitions easy to read. + +Do not forget that a `-inl.h` file requires a #pragma guard just like any other header file. + +## Function Parameter Ordering + +When defining a function, parameter order is: inputs, then outputs. + +Parameters to C/C++ functions are either input to the function, output from the function, or both. Input parameters are usually `values` or `const references`, while output and input/output parameters will be `non-const pointers` . When ordering function parameters, put all input-only parameters before any output parameters. In particular, do not add new parameters to the end of the function just because they are new; place new input-only parameters before the output parameters. + +This is not a hard-and-fast rule. Parameters that are both input and output (often classes/structs) muddy the waters, and, as always, consistency with related functions may require you to bend the rule. + +## Names and Order of Includes + +Use standard order for readability and to avoid hidden dependencies: C library, C++ library, other libraries' `.h`, your project's `.h`. + +All of a project's header files should be listed as descendants of the project's source directory without use of UNIX directory shortcuts . (the current directory) or .. (the parent directory). For example, google-awesome-project/src/base/logging.h should be included as + +```cpp +#include "base/logging.h" +``` + +In `dir/foo.cpp` or `dir/foo_test.cpp`, whose main purpose is to implement or test the stuff in `dir2/foo2.h`, order your includes as follows: + +* dir2/foo2.h (preferred location — see details below). +* C system files. +* C++ system files. +* Other libraries' .h files. +* Your project's .h files. + +With the preferred ordering, if `dir2/foo2.h` omits any necessary includes, the build of `dir/foo.cpp` or `dir/foo_test.cpp` will break. Thus, this rule ensures that build breaks show up first for the people working on these files, not for innocent people in other packages. + +`dir/foo.cpp` and `dir2/foo2.h` are often in the same directory (e.g. `base/basictypes_test.cpp` and `base/basictypes.h`), but can be in different directories too. + +Within each section the includes should be ordered alphabetically. Note that older code might not conform to this rule and should be fixed when convenient. + +For example, the includes in `engine-native/cocos/math/Math.cpp` might look like this: + +```cpp +#include "math/Math.h" // Preferred location. + +#include +#include +#include +#include + +#include "base/basictypes.h" +#include "base/commandlineflags.h" +#include "foo/public/bar.h" +``` + +Exception: sometimes, system-specific code needs conditional includes. Such code can put conditional includes after other includes. Of course, keep your system-specific code small and localized. Example: + +```cpp +#include "foo/public/fooserver.h" + +#include "base/port.h" + +// For LANG_CXX11. +#ifdef LANG_CXX11 +#include +#endif // LANG_CXX11 +``` + +# Scoping + +## Namespaces + +With few exceptions, place code in a namespace. Namespaces should have unique names based on the project name, and possibly its path. Do not use using-directives (e.g., `using namespace foo`). Do not use inline namespaces. For unnamed namespaces, see [Internal Linkage](#internal-linkage). + +**Definition:** + + Namespaces subdivide the global scope into distinct, named scopes, and so are useful for preventing name collisions in the global scope. + +**Pros** + +Namespaces provide a method for preventing name conflicts in large programs while allowing most code to use reasonably short names. + +For example, if two different projects have a class Foo in the global scope, these symbols may collide at compile time or at runtime. If each project places their code in a namespace, `project1::Foo` and `project2::Foo` are now distinct symbols that do not collide, and code within each project's namespace can continue to refer to Foo without the prefix. + +Inline namespaces automatically place their names in the enclosing scope. Consider the following snippet, for example: + +```c++ +namespace outer { +inline namespace inner { + void foo(); +} // namespace inner +} // namespace outer +``` +The expressions `outer::inner::foo()` and `outer::foo()` are interchangeable. Inline namespaces are primarily intended for ABI compatibility across versions. + +**Cons** + +Namespaces can be confusing, because they complicate the mechanics of figuring out what definition a name refers to. + +Inline namespaces, in particular, can be confusing because names aren't actually restricted to the namespace where they are declared. They are only useful as part of some larger versioning policy. + +In some contexts, it's necessary to repeatedly refer to symbols by their fully-qualified names. For deeply-nested namespaces, this can add a lot of clutter. + +**Decision** + +Namespaces should be used as follows: + +- Follow the rules on [Namesapce Names](#namespace-names). +- Terminate multi-line namespaces with comments as shown in the given examples. +- Do not declare anything in namespace std, including forward declarations of standard library classes. Declaring entities in namespace std is undefined behavior, i.e., not portable. To declare entities from the standard library, include the appropriate header file. +- You may not use a using-directive to make all names from a namespace available. + ```c++ + // Forbidden -- This pollutes the namespace. + using namespace foo; + ``` +- Do not use Namespace aliases at namespace scope in header files except in explicitly marked internal-only namespaces, because anything imported into a namespace in a header file becomes part of the public API exported by that file. + ```c++ + // Shorten access to some commonly used names in .cpp files. + namespace baz = ::foo::bar::baz; + ``` + ```c++ + // Shorten access to some commonly used names (in a .h file). + namespace librarian { + namespace impl { // Internal, not part of the API. + namespace sidetable = ::pipeline_diagnostics::sidetable; + } // namespace impl + + inline void myInlineFunction() { + // namespace alias local to a function (or method). + namespace baz = ::foo::bar::baz; + ... + } + } // namespace librarian + ``` +- Do not use inline namespaces. + +## Internal Linkage + +When definitions in a `.cpp` file do not need to be referenced outside that file, give them internal linkage by placing them in an unnamed namespace or declaring them static. Do not use either of these constructs in .h files. + +**Definition:** + +All declarations can be given internal linkage by placing them in unnamed namespaces. Functions and variables can also be given internal linkage by declaring them static. This means that anything you're declaring can't be accessed from another file. If a different file declares something with the same name, then the two entities are completely independent. + +**Decision:** + +Use of internal linkage in `.cpp` files is encouraged for all code that does not need to be referenced elsewhere. Do not use internal linkage in `.h` files. + +Format unnamed namespaces like named namespaces. In the terminating comment, leave the namespace name empty: +```c++ +namespace { +... +} // namespace +``` + +## Nonmember, Static Member, and Global Functions + +Prefer placing nonmember functions in a namespace; use completely global functions rarely. Do not use a class simply to group static members. Static methods of a class should generally be closely related to instances of the class or the class's static data. + +**Pros:** + +Nonmember and static member functions can be useful in some situations. Putting nonmember functions in a namespace avoids polluting the global namespace. + +**Cons:** + +Nonmember and static member functions may make more sense as members of a new class, especially if they access external resources or have significant dependencies. + +**Decision:** + +Sometimes it is useful to define a function not bound to a class instance. Such a function can be either a static member or a nonmember function. Nonmember functions should not depend on external variables, and should nearly always exist in a namespace. Do not create classes only to group static members; this is no different than just giving the names a common prefix, and such grouping is usually unnecessary anyway. + +If you define a nonmember function and it is only needed in its `.cpp` file, use [Internal Linkage](#internal-linkage) to limit its scope. + +## Local Variables + +Place a function's variables in the narrowest scope possible, and initialize variables in the declaration. + +C++ allows you to declare variables anywhere in a function. We encourage you to declare them in as local a scope as possible, and as close to the first use as possible. This makes it easier for the reader to find the declaration and see what type the variable is and what it was initialized to. In particular, initialization should be used instead of declaration and assignment, e.g. + +```cpp +int i; +i = f(); // Bad -- initialization separate from declaration. + +int j = g(); // Good -- declaration has initialization. + +vector v; +v.push_back(1); // Prefer initializing using brace initialization. +v.push_back(2); + +vector v = {1, 2}; // Good -- v starts initialized. +``` + +Variables needed for if, while and for statements should normally be declared within those statements, so that such variables are confined to those scopes. E.g.: + +```cpp +while (const char* p = strchr(str, '/')) str = p + 1; +``` + +There is one caveat: if the variable is an object, its constructor is invoked every time it enters scope and is created, and its destructor is invoked every time it goes out of scope. + +```cpp +// Inefficient implementation: +for (int i = 0; i < 1000000; ++i) { + Foo f; // My ctor and dtor get called 1000000 times each. + f.doSomething(i); +} + +It may be more efficient to declare such a variable used in a loop outside that loop: + +Foo f; // My ctor and dtor get called once each. +for (int i = 0; i < 1000000; ++i) { + f.doSomething(i); +} +``` + +## Static and Global Variables + +Objects with [static storage duration](https://en.cppreference.com/w/cpp/language/storage_duration#Storage_duration) are forbidden unless they are [trivially destructible](https://en.cppreference.com/w/cpp/types/is_destructible). Informally this means that the destructor does not do anything, even taking member and base destructors into account. More formally it means that the type has no user-defined or virtual destructor and that all bases and non-static members are trivially destructible. Static function-local variables may use dynamic initialization. Use of dynamic initialization for static class member variables or variables at namespace scope is discouraged, but allowed in limited circumstances; see below for details. + +As a rule of thumb: a global variable satisfies these requirements if its declaration, considered in isolation, could be constexpr. + +**Pros:** + +Global and static variables are very useful for a large number of applications: named constants, auxiliary data structures internal to some translation unit, command-line flags, logging, registration mechanisms, background infrastructure, etc. + +**Cons:** + +Global and static variables that use dynamic initialization or have non-trivial destructors create complexity that can easily lead to hard-to-find bugs. Dynamic initialization is not ordered across translation units, and neither is destruction (except that destruction happens in reverse order of initialization). When one initialization refers to another variable with static storage duration, it is possible that this causes an object to be accessed before its lifetime has begun (or after its lifetime has ended). Moreover, when a program starts threads that are not joined at exit, those threads may attempt to access objects after their lifetime has ended if their destructor has already run. + +**Decision:** + +### Decision on destrcution: + +When destructors are trivial, their execution is not subject to ordering at all (they are effectively not "run"); otherwise we are exposed to the risk of accessing objects after the end of their lifetime. Therefore, we only allow objects with static storage duration if they are trivially destructible. Fundamental types (like pointers and int) are trivially destructible, as are arrays of trivially destructible types. Note that variables marked with constexpr are trivially destructible. + +```c++ +const int kNum = 10; // allowed + +struct X { int n; }; +const X kX[] = {{1}, {2}, {3}}; // allowed + +void foo() { + static const char* const kMessages[] = {"hello", "world"}; // allowed +} + +// allowed: constexpr guarantees trivial destructor +constexpr std::array kArray = {{1, 2, 3}}; +``` +```c++ +// bad: non-trivial destructor +const std::string kFoo = "foo"; + +// bad for the same reason, even though kBar is a reference (the +// rule also applies to lifetime-extended temporary objects) +const std::string& kBar = StrCat("a", "b", "c"); + +void bar() { + // bad: non-trivial destructor + static std::map kData = {{1, 0}, {2, 0}, {3, 0}}; +} +``` +Note that references are not objects, and thus they are not subject to the constraints on destructibility. The constraint on dynamic initialization still applies, though. In particular, a function-local static reference of the form `static T& t = *new T;` is allowed. + +### Decision on initialization + +Initialization is a more complex topic. This is because we must not only consider whether class constructors execute, but we must also consider the evaluation of the initializer: + +```c++ +int n = 5; // fine +int m = f(); // ? (depends on f) +Foo x; // ? (depends on Foo::Foo) +Bar y = g(); // ? (depends on g and on Bar::Bar) +``` + +All but the first statement expose us to indeterminate initialization ordering. + +The concept we are looking for is called constant initialization in the formal language of the C++ standard. It means that the initializing expression is a constant expression, and if the object is initialized by a constructor call, then the constructor must be specified as constexpr, too: + +```c++ +struct Foo { constexpr Foo(int) {} }; + +int n = 5; // fine, 5 is a constant expression +Foo x(2); // fine, 2 is a constant expression and the chosen constructor is constexpr +Foo a[] = { Foo(1), Foo(2), Foo(3) }; // fine +``` + +Constant initialization is always allowed. Constant initialization of static storage duration variables should be marked with constexpr. Any non-local static storage duration variable that is not so marked should be presumed to have dynamic initialization, and reviewed very carefully. + +By contrast, the following initializations are problematic: +```c++ +// Some declarations used below. +time_t time(time_t*); // not constexpr! +int f(); // not constexpr! +struct Bar { Bar() {} }; + +// Problematic initializations. +time_t m = time(nullptr); // initializing expression not a constant expression +Foo y(f()); // ditto +Bar b; // chosen constructor Bar::Bar() not constexpr +``` + +Dynamic initialization of nonlocal variables is discouraged, and in general it is forbidden. However, we do permit it if no aspect of the program depends on the sequencing of this initialization with respect to all other initializations. Under those restrictions, the ordering of the initialization does not make an observable difference. For example: + +```c++ +int p = getpid(); // allowed, as long as no other static variable + // uses p in its own initialization +``` + +Dynamic initialization of static local variables is allowed (and common). + +### Common patterns + +- Global strings: if you require a global or static string constant, consider using a simple character array, or a char pointer to the first element of a string literal. String literals have static storage duration already and are usually sufficient. +- Maps, sets, and other dynamic containers: if you require a static, fixed collection, such as a set to search against or a lookup table, you cannot use the dynamic containers from the standard library as a static variable, since they have non-trivial destructors. Instead, consider a simple array of trivial types, e.g., an array of arrays of ints (for a "map from int to int"), or an array of pairs (e.g., pairs of `int` and `const char*`). For small collections, linear search is entirely sufficient (and efficient, due to memory locality). If necessary, keep the collection in sorted order and use a binary search algorithm. If you do really prefer a dynamic container from the standard library, consider using a function-local static pointer, as described below. +- Static variables of custom types: if you require static, constant data of a type that you need to define yourself, give the type a trivial destructor and a constexpr constructor. +- If all else fails, you can create an object dynamically and never delete it by using a function-local static pointer or reference (e.g., `static const auto& impl = *new T(args...);`). + + +## thread_local variables + +thread_local variables that aren't declared inside a function must be initialized with a true compile-time constant. Prefer thread_local over other ways of defining thread-local data. + +**Definition:** + +Starting with C++11, variables can be declared with the thread_local specifier: +```c++ +thread_local Foo foo = ...; +``` + +Such a variable is actually a collection of objects, so that when different threads access it, they are actually accessing different objects. thread_local variables are much like [static storage duration variables](#static_storage_duration_variables) in many respects. For instance, they can be declared at namespace scope, inside functions, or as static class members, but not as ordinary class members. + +thread_local variable instances are initialized much like static variables, except that they must be initialized separately for each thread, rather than once at program startup. This means that thread_local variables declared within a function are safe, but other thread_local variables are subject to the same initialization-order issues as static variables (and more besides). + +thread_local variable instances are destroyed when their thread terminates, so they do not have the destruction-order issues of static variables. + +**Pros:** +- Thread-local data is inherently safe from races (because only one thread can ordinarily access it), which makes thread_local useful for concurrent programming. +- thread_local is the only standard-supported way of creating thread-local data. + +**Cons:** +- Accessing a thread_local variable may trigger execution of an unpredictable and uncontrollable amount of other code. +- thread_local variables are effectively global variables, and have all the drawbacks of global variables other than lack of thread-safety. +- The memory consumed by a thread_local variable scales with the number of running threads (in the worst case), which can be quite large in a program. +- An ordinary class member cannot be thread_local. +- thread_local may not be as efficient as certain compiler intrinsics. + +**Decision:** + +thread_local variables inside a function have no safety concerns, so they can be used without restriction. Note that you can use a function-scope thread_local to simulate a class- or namespace-scope thread_local by defining a function or static method that exposes it: + +```c++ +Foo& MyThreadLocalFoo() { + thread_local Foo result = ComplicatedInitialization(); + return result; +} +``` + +thread_local variables at class or namespace scope must be initialized with a true compile-time constant (i.e., they must have no dynamic initialization). + +thread_local should be preferred over other mechanisms for defining thread-local data. + +# Classes + +Classes are the fundamental unit of code in C++. Naturally, we use them extensively. This section lists the main dos and don'ts you should follow when writing a class. + +## Doing Work in Constructors + +Avoid virtual method calls in constructors, and avoid initialization that can fail if you can't signal an error. + +**Definition:** + +It is possible to perform initialization in the body of the constructor. + +**Pros:** +- No need to worry about whether the class has been initialized or not. +- Objects that are fully initialized by constructor call can be const and may also be easier to use with standard containers or algorithms. + +**Cons:** +- If the work calls virtual functions, these calls will not get dispatched to the subclass implementations. Future modification to your class can quietly introduce this problem even if your class is not currently subclassed, causing much confusion. +- There is no easy way for constructors to signal errors, short of crashing the program (not always appropriate) or using exceptions (which are forbidden). +- If the work fails, we now have an object whose initialization code failed, so it may be an unusual state requiring a bool IsValid() state checking mechanism (or similar) which is easy to forget to call. +- You cannot take the address of a constructor, so whatever work is done in the constructor cannot easily be handed off to, for example, another thread. + +**Decision:** + +Constructors should never call virtual functions. If appropriate for your code , terminating the program may be an appropriate error handling response. Otherwise, consider a factory function or Init() method as described in [TotW #42](https://abseil.io/tips/42). Avoid Init() methods on objects with no other states that affect which public methods may be called (semi-constructed objects of this form are particularly hard to work with correctly). + + +## Implicit Conversions + +Do not define implicit conversions. Use the explicit keyword for conversion operators and single-argument constructors. + +**Definition:** + +Implicit conversions allow an object of one type (called the source type) to be used where a different type (called the destination type) is expected, such as when passing an int argument to a function that takes a double parameter. + +In addition to the implicit conversions defined by the language, users can define their own, by adding appropriate members to the class definition of the source or destination type. An implicit conversion in the source type is defined by a type conversion operator named after the destination type (e.g., `operator bool()`). An implicit conversion in the destination type is defined by a constructor that can take the source type as its only argument (or only argument with no default value). + +The explicit keyword can be applied to a constructor or (since C++11) a conversion operator, to ensure that it can only be used when the destination type is explicit at the point of use, e.g., with a cast. This applies not only to implicit conversions, but to C++11's list initialization syntax: +```c++ +class Foo { + explicit Foo(int x, double y); + ... +}; + +void Func(Foo f); +``` + +```c++ +Func({42, 3.14}); // Error +``` + +This kind of code isn't technically an implicit conversion, but the language treats it as one as far as explicit is concerned. + +**Pros:** +- Implicit conversions can make a type more usable and expressive by eliminating the need to explicitly name a type when it's obvious. +- Implicit conversions can be a simpler alternative to overloading, such as when a single function with a string_view parameter takes the place of separate overloads for `std::string` and `const char*`. +- List initialization syntax is a concise and expressive way of initializing objects. + +**Cons:** +- Implicit conversions can hide type-mismatch bugs, where the destination type does not match the user's expectation, or the user is unaware that any conversion will take place. +- Implicit conversions can make code harder to read, particularly in the presence of overloading, by making it less obvious what code is actually getting called. +- Constructors that take a single argument may accidentally be usable as implicit type conversions, even if they are not intended to do so. +- When a single-argument constructor is not marked explicit, there's no reliable way to tell whether it's intended to define an implicit conversion, or the author simply forgot to mark it. +- Implicit conversions can lead to call-site ambiguities, especially when there are bidirectional implicit conversions. This can be caused either by having two types that both provide an implicit conversion, or by a single type that has both an implicit constructor and an implicit type conversion operator. +- List initialization can suffer from the same problems if the destination type is implicit, particularly if the list has only a single element. + +**Decision:** + +Type conversion operators, and constructors that are callable with a single argument, must be marked explicit in the class definition. As an exception, copy and move constructors should not be explicit, since they do not perform type conversion. + +Implicit conversions can sometimes be necessary and appropriate for types that are designed to be interchangeable, for example when objects of two types are just different representations of the same underlying value. In that case, contact your project leads to request a waiver of this rule. + +Constructors that cannot be called with a single argument may omit explicit. Constructors that take a single `std::initializer_list` parameter should also omit explicit, in order to support copy-initialization (e.g., `MyType m = {1, 2};`). + + +## Copyable and Movable Types + +A class's public API must make clear whether the class is copyable, move-only, or neither copyable nor movable. Support copying and/or moving if these operations are clear and meaningful for your type. + +**Definition:** + +A movable type is one that can be initialized and assigned from temporaries. + +A copyable type is one that can be initialized or assigned from any other object of the same type (so is also movable by definition), with the stipulation that the value of the source does not change. `std::unique_ptr` is an example of a movable but not copyable type (since the value of the source `std::unique_ptr` must be modified during assignment to the destination). int and std::string are examples of movable types that are also copyable. (For int, the move and copy operations are the same; for std::string, there exists a move operation that is less expensive than a copy.) + +For user-defined types, the copy behavior is defined by the copy constructor and the copy-assignment operator. Move behavior is defined by the move constructor and the move-assignment operator, if they exist, or by the copy constructor and the copy-assignment operator otherwise. + +The copy/move constructors can be implicitly invoked by the compiler in some situations, e.g., when passing objects by value. + +**Pros:** + +Objects of copyable and movable types can be passed and returned by value, which makes APIs simpler, safer, and more general. Unlike when passing objects by pointer or reference, there's no risk of confusion over ownership, lifetime, mutability, and similar issues, and no need to specify them in the contract. It also prevents non-local interactions between the client and the implementation, which makes them easier to understand, maintain, and optimize by the compiler. Further, such objects can be used with generic APIs that require pass-by-value, such as most containers, and they allow for additional flexibility in e.g., type composition. + +Copy/move constructors and assignment operators are usually easier to define correctly than alternatives like `clone()`, `copyFrom()` or `swap()`, because they can be generated by the compiler, either implicitly or with `= default`. They are concise, and ensure that all data members are copied. Copy and move constructors are also generally more efficient, because they don't require heap allocation or separate initialization and assignment steps, and they're eligible for optimizations such as [copy elision](https://en.cppreference.com/w/cpp/language/copy_elision). + +Move operations allow the implicit and efficient transfer of resources out of rvalue objects. This allows a plainer coding style in some cases. + +**Cons:** + +Some types do not need to be copyable, and providing copy operations for such types can be confusing, nonsensical, or outright incorrect. Types representing singleton objects (Registerer), objects tied to a specific scope (Cleanup), or closely coupled to object identity (Mutex) cannot be copied meaningfully. Copy operations for base class types that are to be used polymorphically are hazardous, because use of them can lead to [object slicing](https://en.wikipedia.org/wiki/Object_slicing). Defaulted or carelessly-implemented copy operations can be incorrect, and the resulting bugs can be confusing and difficult to diagnose. + +Copy constructors are invoked implicitly, which makes the invocation easy to miss. This may cause confusion for programmers used to languages where pass-by-reference is conventional or mandatory. It may also encourage excessive copying, which can cause performance problems. + +**Decision:** + +Every class's public interface must make clear which copy and move operations the class supports. This should usually take the form of explicitly declaring and/or deleting the appropriate operations in the public section of the declaration. + +Specifically, a copyable class should explicitly declare the copy operations, a move-only class should explicitly declare the move operations, and a non-copyable/movable class should explicitly delete the copy operations. A copyable class may also declare move operations in order to support efficient moves. Explicitly declaring or deleting all four copy/move operations is permitted, but not required. If you provide a copy or move assignment operator, you must also provide the corresponding constructor. + +```c++ +class Copyable { + public: + Copyable(const Copyable& other) = default; + Copyable& operator=(const Copyable& other) = default; + + // The implicit move operations are suppressed by the declarations above. + // You may explicitly declare move operations to support efficient moves. +}; + +class MoveOnly { + public: + MoveOnly(MoveOnly&& other) = default; + MoveOnly& operator=(MoveOnly&& other) = default; + + // The copy operations are implicitly deleted, but you can + // spell that out explicitly if you want: + MoveOnly(const MoveOnly&) = delete; + MoveOnly& operator=(const MoveOnly&) = delete; +}; + +class NotCopyableOrMovable { + public: + // Not copyable or movable + NotCopyableOrMovable(const NotCopyableOrMovable&) = delete; + NotCopyableOrMovable& operator=(const NotCopyableOrMovable&) + = delete; + + // The move operations are implicitly disabled, but you can + // spell that out explicitly if you want: + NotCopyableOrMovable(NotCopyableOrMovable&&) = delete; + NotCopyableOrMovable& operator=(NotCopyableOrMovable&&) + = delete; +}; +``` + +These declarations/deletions can be omitted only if they are obvious: +- If the class has no private section, like a struct or an interface-only base class, then the copyability/movability can be determined by the copyability/movability of any public data members. +- If a base class clearly isn't copyable or movable, derived classes naturally won't be either. An interface-only base class that leaves these operations implicit is not sufficient to make concrete subclasses clear. +- Note that if you explicitly declare or delete either the constructor or assignment operation for copy, the other copy operation is not obvious and must be declared or deleted. Likewise for move operations. + +A type should not be copyable/movable if the meaning of copying/moving is unclear to a casual user, or if it incurs unexpected costs. Move operations for copyable types are strictly a performance optimization and are a potential source of bugs and complexity, so avoid defining them unless they are significantly more efficient than the corresponding copy operations. If your type provides copy operations, it is recommended that you design your class so that the default implementation of those operations is correct. Remember to review the correctness of any defaulted operations as you would any other code. + +Due to the risk of slicing, prefer to avoid providing a public assignment operator or copy/move constructor for a class that's intended to be derived from (and prefer to avoid deriving from a class with such members). If your base class needs to be copyable, provide a public virtual clone() method, and a protected copy constructor that derived classes can use to implement it. + +## Structs vs. Classes + +Use a struct only for passive objects that carry data; everything else is a class. + +The struct and class keywords behave almost identically in C++. We add our own semantic meanings to each keyword, so you should use the appropriate keyword for the data-type you're defining. + +structs should be used for passive objects that carry data, and may have associated constants, but lack any functionality other than access/setting the data members. The accessing/setting of fields is done by directly accessing the fields rather than through method invocations. Methods should not provide behavior but should only be used to set up the data members, e.g., `constructor`, `destructor`, `initialize()`, `reset()`, `validate()`. + +If more functionality is required, a class is more appropriate. If in doubt, make it a class. + +For consistency with STL, you can use struct instead of class for stateless types, such as traits, template metafunctions, and some functors. + +Note that member variables in structs and classes have different naming rules. + +## Structs vs. Pairs and Tuples + +Prefer to use a struct instead of a pair or a tuple whenever the elements can have meaningful names. + +While using pairs and tuples can avoid the need to define a custom type, potentially saving work when writing code, a meaningful field name will almost always be much clearer when reading code than .first, .second, or `std::get`. While C++14's introduction of `std::get` to access a tuple element by type rather than index (when the type is unique) can sometimes partially mitigate this, a field name is usually substantially clearer and more informative than a type. + +Pairs and tuples may be appropriate in generic code where there are not specific meanings for the elements of the pair or tuple. Their use may also be required in order to interoperate with existing code or APIs. + +## Inheritance + +Composition is often more appropriate than inheritance. When using inheritance, make it public. + +**Definition:** + +When a sub-class inherits from a base class, it includes the definitions of all the data and operations that the base class defines. "Interface inheritance" is inheritance from a pure abstract base class (one with no state or defined methods); all other inheritance is "implementation inheritance". + +**Pros:** + +Implementation inheritance reduces code size by re-using the base class code as it specializes an existing type. Because inheritance is a compile-time declaration, you and the compiler can understand the operation and detect errors. Interface inheritance can be used to programmatically enforce that a class expose a particular API. Again, the compiler can detect errors, in this case, when a class does not define a necessary method of the API. + +**Cons:** + +For implementation inheritance, because the code implementing a sub-class is spread between the base and the sub-class, it can be more difficult to understand an implementation. The sub-class cannot override functions that are not virtual, so the sub-class cannot change implementation. + +Multiple inheritance is especially problematic, because it often imposes a higher performance overhead (in fact, the performance drop from single inheritance to multiple inheritance can often be greater than the performance drop from ordinary to virtual dispatch), and because it risks leading to "diamond" inheritance patterns, which are prone to ambiguity, confusion, and outright bugs. + +**Decision:** + +All inheritance should be public. If you want to do private inheritance, you should be including an instance of the base class as a member instead. + +Do not overuse implementation inheritance. Composition is often more appropriate. Try to restrict use of inheritance to the "is-a" case: Bar subclasses Foo if it can reasonably be said that Bar "is a kind of" Foo. + +Limit the use of protected to those member functions that might need to be accessed from subclasses. Note that data members should be private. + +Explicitly annotate overrides of virtual functions or virtual destructors with exactly one of an override or (less frequently) final specifier. Do not use virtual when declaring an override. Rationale: A function or destructor marked override or final that is not an override of a base class virtual function will not compile, and this helps catch common errors. The specifiers serve as documentation; if no specifier is present, the reader has to check all ancestors of the class in question to determine if the function or destructor is virtual or not. + +Multiple inheritance is permitted, but multiple implementation inheritance is strongly discouraged. + +## Operator Overloading + +Overload operators judiciously. Do not use user-defined literals. + +**Definition:** + +C++ permits user code to declare overloaded versions of the built-in operators using the operator keyword, so long as one of the parameters is a user-defined type. The operator keyword also permits user code to define new kinds of literals using operator" ", and to define type-conversion functions such as operator bool(). + +**Pros:** + +Operator overloading can make code more concise and intuitive by enabling user-defined types to behave the same as built-in types. Overloaded operators are the idiomatic names for certain operations (e.g., ==, <, =, and <<), and adhering to those conventions can make user-defined types more readable and enable them to interoperate with libraries that expect those names. + +User-defined literals are a very concise notation for creating objects of user-defined types. + +**Cons:** + +- Providing a correct, consistent, and unsurprising set of operator overloads requires some care, and failure to do so can lead to confusion and bugs. +Overuse of operators can lead to obfuscated code, particularly if the overloaded operator's semantics don't follow convention. +- The hazards of function overloading apply just as much to operator overloading, if not more so. +- Operator overloads can fool our intuition into thinking that expensive operations are cheap, built-in operations. +- Finding the call sites for overloaded operators may require a search tool that's aware of C++ syntax, rather than e.g., grep. +- If you get the argument type of an overloaded operator wrong, you may get a different overload rather than a compiler error. For example, foo < bar may do one thing, while `&foo < &bar` does something totally different. +- Certain operator overloads are inherently hazardous. Overloading unary & can cause the same code to have different meanings depending on whether the overload declaration is visible. Overloads of &&, ||, and , (comma) cannot match the evaluation-order semantics of the built-in operators. +- Operators are often defined outside the class, so there's a risk of different files introducing different definitions of the same operator. If both definitions are linked into the same binary, this results in undefined behavior, which can manifest as subtle run-time bugs. +- User-defined literals (UDLs) allow the creation of new syntactic forms that are unfamiliar even to experienced C++ programmers, such as "Hello World"sv as a shorthand for `std::string_view("Hello World")`. Existing notations are clearer, though less terse. +- Because they can't be namespace-qualified, uses of UDLs also require use of either using-directives (which we ban) or using-declarations (which we ban in header files except when the imported names are part of the interface exposed by the header file in question). Given that header files would have to avoid UDL suffixes, we prefer to avoid having conventions for literals differ between header files and source files. + +**Decision:** + +Define overloaded operators only if their meaning is obvious, unsurprising, and consistent with the corresponding built-in operators. For example, use | as a bitwise- or logical-or, not as a shell-style pipe. + +Define operators only on your own types. More precisely, define them in the same headers, .cc files, and namespaces as the types they operate on. That way, the operators are available wherever the type is, minimizing the risk of multiple definitions. If possible, avoid defining operators as templates, because they must satisfy this rule for any possible template arguments. If you define an operator, also define any related operators that make sense, and make sure they are defined consistently. For example, if you overload <, overload all the comparison operators, and make sure < and > never return true for the same arguments. + +Prefer to define non-modifying binary operators as non-member functions. If a binary operator is defined as a class member, implicit conversions will apply to the right-hand argument, but not the left-hand one. It will confuse your users if a < b compiles but b < a doesn't. + +Don't go out of your way to avoid defining operator overloads. For example, prefer to define ==, =, and <<, rather than `equals()`, `copyFrom()`, and `printTo()`. Conversely, don't define operator overloads just because other libraries expect them. For example, if your type doesn't have a natural ordering, but you want to store it in a `std::set`, use a custom comparator rather than overloading <. + +Do not overload &&, ||, , (comma), or unary &. Do not overload operator"", i.e., do not introduce user-defined literals. Do not use any such literals provided by others (including the standard library). + +Type conversion operators are covered in the section on implicit conversions. The = operator is covered in the section on copy constructors. Overloading << for use with streams is covered in the section on streams. See also the rules on function overloading, which apply to operator overloading as well. + +## Access Control + +Make classes' data members private, unless they are constants. This simplifies reasoning about invariants, at the cost of some easy boilerplate in the form of accessors (usually const) if necessary. + +For technical reasons, we allow data members of a test fixture class defined in a .cpp file to be protected when using Google Test). If a test fixture class is defined outside of the .cpp file it is used in, for example in a .h file, make data members private. + +## Declaration Order + +Group similar declarations together, placing public parts earlier. + +A class definition should usually start with a public: section, followed by protected:, then private:. Omit sections that would be empty. + +Within each section, prefer grouping similar kinds of declarations together, and prefer the following order: types (including typedef, using, and nested structs and classes), constants, factory functions, constructors and assignment operators, destructor, all other methods, data members. + +Do not put large method definitions inline in the class definition. Usually, only trivial or performance-critical, and very short, methods may be defined inline. See Inline Functions for more details. + +# Functions + +## Inputs and Outputs + +The output of a C++ function is naturally provided via a return value and sometimes via output parameters (or in/out parameters). + +Prefer using return values over output parameters: they improve readability, and often provide the same or better performance. + +Prefer to return by value or, failing that, return by reference. Avoid returning a pointer unless it can be null. + +Parameters are either inputs to the function, outputs from the function, or both. Non-optional input parameters should usually be values or const references, while non-optional output and input/output parameters should usually be references (which cannot be null). + +Avoid defining functions that require a const reference parameter to outlive the call, because const reference parameters bind to temporaries. Instead, find a way to eliminate the lifetime requirement (for example, by copying the parameter), or pass it by const pointer and document the lifetime and non-null requirements. + +When ordering function parameters, put all input-only parameters before any output parameters. In particular, do not add new parameters to the end of the function just because they are new; place new input-only parameters before the output parameters. This is not a hard-and-fast rule. Parameters that are both input and output muddy the waters, and, as always, consistency with related functions may require you to bend the rule. Variadic functions may also require unusual parameter ordering. + +## Write Short Functions + +Prefer small and focused functions. + +We recognize that long functions are sometimes appropriate, so no hard limit is placed on functions length. If a function exceeds about 40 lines, think about whether it can be broken up without harming the structure of the program. + +Even if your long function works perfectly now, someone modifying it in a few months may add new behavior. This could result in bugs that are hard to find. Keeping your functions short and simple makes it easier for other people to read and modify your code. + +You could find long and complicated functions when working with some code. Do not be intimidated by modifying existing code: if working with such a function proves to be difficult, you find that errors are hard to debug, or you want to use a piece of it in several different contexts, consider breaking up the function into smaller and more manageable pieces. + +## Function Overloading + +Use overloaded functions (including constructors) only if a reader looking at a call site can get a good idea of what is happening without having to first figure out exactly which overload is being called. + +**Definition:** + +You may write a function that takes a const std::string& and overload it with another that takes const char*. However, in this case consider std::string_view instead. + +```c++ +class MyClass { + public: + void Analyze(const std::string &text); + void Analyze(const char *text, size_t textlen); +}; +``` + +**Pros:** + +Overloading can make code more intuitive by allowing an identically-named function to take different arguments. It may be necessary for templatized code, and it can be convenient for Visitors. + +Overloading based on const or ref qualification may make utility code more usable, more efficient, or both. (See [TotW 148](https://abseil.io/tips/148) for more.) + +**Cons:** + +If a function is overloaded by the argument types alone, a reader may have to understand C++'s complex matching rules in order to tell what's going on. Also many people are confused by the semantics of inheritance if a derived class overrides only some of the variants of a function. + +**Decision:** + +You may overload a function when there are no semantic differences between variants. These overloads may vary in types, qualifiers, or argument count. However, a reader of such a call must not need to know which member of the overload set is chosen, only that something from the set is being called. If you can document all entries in the overload set with a single comment in the header, that is a good sign that it is a well-designed overload set. + +## Default Arguments + +Default arguments are allowed on non-virtual functions when the default is guaranteed to always have the same value. Follow the same restrictions as for function overloading, and prefer overloaded functions if the readability gained with default arguments doesn't outweigh the downsides below. + +**Pros:** + +Often you have a function that uses default values, but occasionally you want to override the defaults. Default parameters allow an easy way to do this without having to define many functions for the rare exceptions. Compared to overloading the function, default arguments have a cleaner syntax, with less boilerplate and a clearer distinction between 'required' and 'optional' arguments. + +**Cons:** + +Defaulted arguments are another way to achieve the semantics of overloaded functions, so all the reasons not to overload functions apply. + +The defaults for arguments in a virtual function call are determined by the static type of the target object, and there's no guarantee that all overrides of a given function declare the same defaults. + +Default parameters are re-evaluated at each call site, which can bloat the generated code. Readers may also expect the default's value to be fixed at the declaration instead of varying at each call. + +Function pointers are confusing in the presence of default arguments, since the function signature often doesn't match the call signature. Adding function overloads avoids these problems. + +**Decision:** + +Default arguments are banned on virtual functions, where they don't work properly, and in cases where the specified default might not evaluate to the same value depending on when it was evaluated. (For example, don't write `void f(int n = counter++);`.) + +In some other cases, default arguments can improve the readability of their function declarations enough to overcome the downsides above, so they are allowed. When in doubt, use overloads. + +# Other C++ Features + +## Rvalue references + +Use rvalue references only in certain special cases listed below. + + + +**Definition:** + +Rvalue references are a type of reference that can only bind to temporary objects. The syntax is similar to traditional reference syntax. For example, `void f(std::string&& s)`; declares a function whose argument is an rvalue reference to a `std::string`. + +When the token '&&' is applied to an unqualified template argument in a function parameter, special template argument deduction rules apply. Such a reference is called forwarding reference. + +**Pros:** + +- Defining a move constructor (a constructor taking an rvalue reference to the class type) makes it possible to move a value instead of copying it. If v1 is a `std::vector`, for example, then `auto v2(std::move(v1))` will probably just result in some simple pointer manipulation instead of copying a large amount of data. In many cases this can result in a major performance improvement. +- Rvalue references make it possible to implement types that are movable but not copyable, which can be useful for types that have no sensible definition of copying but where you might still want to pass them as function arguments, put them in containers, etc. +- std::move is necessary to make effective use of some standard-library types, such as `std::unique_ptr`. +- Forwarding references which use the rvalue reference token, make it possible to write a generic function wrapper that forwards its arguments to another function, and works whether or not its arguments are temporary objects and/or const. This is called 'perfect forwarding'. + +**Cons:** + +- Rvalue references are not yet widely understood. Rules like reference collapsing and the special deduction rule for forwarding references are somewhat obscure. +- Rvalue references are often misused. Using rvalue references is counter-intuitive in signatures where the argument is expected to have a valid specified state after the function call, or where no move operation is performed. + +**Decision:** + +Do not use rvalue references (or apply the && qualifier to methods), except as follows: +- You may use them to define move constructors and move assignment operators (as described in Copyable and Movable Types). +- You may use them to define &&-qualified methods that logically "consume" *this, leaving it in an unusable or empty state. Note that this applies only to method qualifiers (which come after the closing parenthesis of the function signature); if you want to "consume" an ordinary function parameter, prefer to pass it by value. +- You may use forwarding references in conjunction with `std::forward`, to support perfect forwarding. +- You may use them to define pairs of overloads, such as one taking Foo&& and the other taking const Foo&. Usually the preferred solution is just to pass by value, but an overloaded pair of functions sometimes yields better performance and is sometimes necessary in generic code that needs to support a wide variety of types. As always: if you're writing more complicated code for the sake of performance, make sure you have evidence that it actually helps. + +## Friends + +We allow use of friend classes and functions, within reason. + +Friends should usually be defined in the same file so that the reader does not have to look in another file to find uses of the private members of a class. A common use of friend is to have a FooBuilder class be a friend of Foo so that it can construct the inner state of Foo correctly, without exposing this state to the world. In some cases it may be useful to make a unittest class a friend of the class it tests. + +Friends extend, but do not break, the encapsulation boundary of a class. In some cases this is better than making a member public when you want to give only one other class access to it. However, most classes should interact with other classes solely through their public members. + +## Exceptions + +We do not use C++ exceptions. + +## noexcept + +Specify noexcept when it is useful and correct. + +**Definition:** + +The noexcept specifier is used to specify whether a function will throw exceptions or not. If an exception escapes from a function marked noexcept, the program crashes via std::terminate. + +The noexcept operator performs a compile-time check that returns true if an expression is declared to not throw any exceptions. + +**Pros:** + +- Specifying move constructors as noexcept improves performance in some cases, e.g., `std::vector::resize()` moves rather than copies the objects if T's move constructor is noexcept. +- Specifying noexcept on a function can trigger compiler optimizations in environments where exceptions are enabled, e.g., compiler does not have to generate extra code for stack-unwinding, if it knows that no exceptions can be thrown due to a noexcept specifier. + +**Cons:** +- In projects following this guide that have exceptions disabled it is hard to ensure that noexcept specifiers are correct, and hard to define what correctness even means. +- It's hard, if not impossible, to undo noexcept because it eliminates a guarantee that callers may be relying on, in ways that are hard to detect. + +**Decision:** + +You may use noexcept when it is useful for performance if it accurately reflects the intended semantics of your function, i.e., that if an exception is somehow thrown from within the function body then it represents a fatal error. You can assume that noexcept on move constructors has a meaningful performance benefit. If you think there is significant performance benefit from specifying noexcept on some other function, please discuss it with your project leads. + +Prefer unconditional noexcept if exceptions are completely disabled (i.e., most Google C++ environments). Otherwise, use conditional noexcept specifiers with simple conditions, in ways that evaluate false only in the few cases where the function could potentially throw. The tests might include type traits check on whether the involved operation might throw (e.g., `std::is_nothrow_move_constructible` for move-constructing objects), or on whether allocation can throw. Note in many cases the only possible cause for an exception is allocation failure (we believe move constructors should not throw except due to allocation failure), and there are many applications where it’s appropriate to treat memory exhaustion as a fatal error rather than an exceptional condition that your program should attempt to recover from. Even for other potential failures you should prioritize interface simplicity over supporting all possible exception throwing scenarios: instead of writing a complicated noexcept clause that depends on whether a hash function can throw, for example, simply document that your component doesn’t support hash functions throwing and make it unconditionally noexcept. + +## Casting + +Use C++-style casts like `static_cast(double_value)`, or brace initialization for conversion of arithmetic types like `int64 y = int64{1} << 42`. Do not use cast formats like `(int)x` unless the cast is to void. You may use cast formats like `T(x)` only when `T` is a class type. + +**Definition:** + +C++ introduced a different cast system from C that distinguishes the types of cast operations. + +**Pros:** + +The problem with C casts is the ambiguity of the operation; sometimes you are doing a conversion (e.g., (int)3.5) and sometimes you are doing a cast (e.g., (int)"hello"). Brace initialization and C++ casts can often help avoid this ambiguity. Additionally, C++ casts are more visible when searching for them. + +**Cons:** + +The C++-style cast syntax is verbose and cumbersome. + +**Decision:** + +In general, do not use C-style casts. Instead, use these C++-style casts when explicit type conversion is necessary. + +- Use brace initialization to convert arithmetic types (e.g., `int64{x}`). This is the safest approach because code will not compile if conversion can result in information loss. The syntax is also concise. +- Use static_cast as the equivalent of a C-style cast that does value conversion, when you need to explicitly up-cast a pointer from a class to its superclass, or when you need to explicitly cast a pointer from a superclass to a subclass. In this last case, you must be sure your object is actually an instance of the subclass. +- Use const_cast to remove the const qualifier (see const). +- Use reinterpret_cast to do unsafe conversions of pointer types to and from integer and other pointer types, including void*. Use this only if you know what you are doing and you understand the aliasing issues. + +## Streams + +Use streams where appropriate, and stick to "simple" usages. Overload << for streaming only for types representing values, and write only the user-visible value, not any implementation details. + +**Definition:** + +Streams are the standard I/O abstraction in C++, as exemplified by the standard header . They are widely used in Google code, mostly for debug logging and test diagnostics. + +**Pros:** + +The << and >> stream operators provide an API for formatted I/O that is easily learned, portable, reusable, and extensible. printf, by contrast, doesn't even support `std::string`, to say nothing of user-defined types, and is very difficult to use portably. printf also obliges you to choose among the numerous slightly different versions of that function, and navigate the dozens of conversion specifiers. + +Streams provide first-class support for console I/O via `std::cin`, `std::cout`, `std::cerr`, and `std::clog`. The C APIs do as well, but are hampered by the need to manually buffer the input. + +**Cons:** + +- Stream formatting can be configured by mutating the state of the stream. Such mutations are persistent, so the behavior of your code can be affected by the entire previous history of the stream, unless you go out of your way to restore it to a known state every time other code might have touched it. User code can not only modify the built-in state, it can add new state variables and behaviors through a registration system. +- It is difficult to precisely control stream output, due to the above issues, the way code and data are mixed in streaming code, and the use of operator overloading (which may select a different overload than you expect). +- The practice of building up output through chains of << operators interferes with internationalization, because it bakes word order into the code, and streams' support for localization is flawed. +- The streams API is subtle and complex, so programmers must develop experience with it in order to use it effectively. +- Resolving the many overloads of << is extremely costly for the compiler. When used pervasively in a large code base, it can consume as much as 20% of the parsing and semantic analysis time. + +**Decision:** + +Use streams only when they are the best tool for the job. This is typically the case when the I/O is ad-hoc, local, human-readable, and targeted at other developers rather than end-users. Be consistent with the code around you, and with the codebase as a whole; if there's an established tool for your problem, use that tool instead. In particular, logging libraries are usually a better choice than `std::cerr` or `std::clog` for diagnostic output, and the equivalent are usually a better choice than `std::stringstream`. + +Avoid using streams for I/O that faces external users or handles untrusted data. Instead, find and use the appropriate templating libraries to handle issues like internationalization, localization, and security hardening. + +If you do use streams, avoid the stateful parts of the streams API (other than error state), such as `imbue()`, xalloc(), and `registerCallback()`. Use explicit formatting functions rather than stream manipulators or formatting flags to control formatting details such as number base, precision, or padding. + +Overload << as a streaming operator for your type only if your type represents a value, and << writes out a human-readable string representation of that value. Avoid exposing implementation details in the output of <<; if you need to print object internals for debugging, use named functions instead (a method named `debugString()` is the most common convention). + +## Preincrement and Predecrement + +Use the prefix form (++i) of the increment and decrement operators unless you need postfix semantics. + +**Definition:** + +When a variable is incremented (`++i` or `i++`) or decremented (`--i` or `i--`) and the value of the expression is not used, one must decide whether to preincrement (decrement) or postincrement (decrement). + +**Pros:** + +A postfix increment/decrement expression evaluates to the value as it was before it was modified. This can result in code that is more compact but harder to read. The prefix form is generally more readable, is never less efficient, and can be more efficient because it doesn't need to make a copy of the value as it was before the operation. + +**Cons:** + +The tradition developed, in C, of using post-increment, even when the expression value is not used, especially in for loops. + +**Decision:** + +Use prefix increment/decrement, unless the code explicitly needs the result of the postfix increment/decrement expression. + +## Use of const + +In APIs, use const whenever it makes sense. constexpr is a better choice for some uses of const. + +**Definition:** + +Declared variables and parameters can be preceded by the keyword const to indicate the variables are not changed (e.g., `const int foo`). Class functions can have the const qualifier to indicate the function does not change the state of the class member variables (e.g., `class Foo { int Bar(char c) const; };`). + +**Pros:** + +Easier for people to understand how variables are being used. Allows the compiler to do better type checking, and, conceivably, generate better code. Helps people convince themselves of program correctness because they know the functions they call are limited in how they can modify your variables. Helps people know what functions are safe to use without locks in multi-threaded programs. + +**Cons:** + +const is viral: if you pass a const variable to a function, that function must have const in its prototype (or the variable will need a const_cast). This can be a particular problem when calling library functions. + +**Decision:** + +We strongly recommend using const in APIs (i.e., on function parameters, methods, and non-local variables) wherever it is meaningful and accurate. This provides consistent, mostly compiler-verified documentation of what objects an operation can mutate. Having a consistent and reliable way to distinguish reads from writes is critical to writing thread-safe code, and is useful in many other contexts as well. In particular: +- If a function guarantees that it will not modify an argument passed by reference or by pointer, the corresponding function parameter should be a reference-to-const (const T&) or pointer-to-const (const T*), respectively. +- For a function parameter passed by value, const has no effect on the caller, thus is not recommended in function declarations. See [TotW #109](https://abseil.io/tips/109). +- Declare methods to be const unless they alter the logical state of the object (or enable the user to modify that state, e.g., by returning a non-const reference, but that's rare), or they can't safely be invoked concurrently. +- Using const on local variables is neither encouraged nor discouraged. + +All of a class's const operations should be safe to invoke concurrently with each other. If that's not feasible, the class must be clearly documented as "thread-unsafe". + +### Where to put the const + +Put const first, for example, prefer `const int *foo` to `int const *foo`. + +## Use of constexpr + +Use constexpr to define true constants or to ensure constant initialization. + +**Definition:** + +Some variables can be declared constexpr to indicate the variables are true constants, i.e., fixed at compilation/link time. Some functions and constructors can be declared constexpr which enables them to be used in defining a constexpr variable. + +**Pros:** + +Use of constexpr enables definition of constants with floating-point expressions rather than just literals; definition of constants of user-defined types; and definition of constants with function calls. + +**Cons:** + +Prematurely marking something as constexpr may cause migration problems if later on it has to be downgraded. Current restrictions on what is allowed in constexpr functions and constructors may invite obscure workarounds in these definitions. + +**Decision:** + +constexpr definitions enable a more robust specification of the constant parts of an interface. Use constexpr to specify true constants and the functions that support their definitions. Avoid complexifying function definitions to enable their use with constexpr. Do not use constexpr to force inlining. + +## Integer Types + +Of the built-in C++ integer types, the only one used is int. If a program needs a variable of a different size, use a precise-width integer type from , such as int16_t. If your variable represents a value that could ever be greater than or equal to 2^31 (2GiB), use a 64-bit type such as int64_t. Keep in mind that even if your value won't ever be too large for an int, it may be used in intermediate calculations which may require a larger type. When in doubt, choose a larger type. + +**Definition:** + +C++ does not specify the sizes of integer types like int. Typically people assume that short is 16 bits, int is 32 bits, long is 32 bits and long long is 64 bits. + +**Pros:** + +Uniformity of declaration. + +**Cons:** + +The sizes of integral types in C++ can vary based on compiler and architecture. + +**Decision:** + + defines types like int16_t, uint32_t, int64_t, etc. You should always use those in preference to short, unsigned long long and the like, when you need a guarantee on the size of an integer. Of the C integer types, only int should be used. When appropriate, you are welcome to use standard types like size_t and ptrdiff_t. + +We use int very often, for integers we know are not going to be too big, e.g., loop counters. Use plain old int for such things. You should assume that an int is at least 32 bits, but don't assume that it has more than 32 bits. If you need a 64-bit integer type, use int64_t or uint64_t. + +For integers we know can be "big", use int64_t. + +If your code is a container that returns a size, be sure to use a type that will accommodate any possible usage of your container. When in doubt, use a larger type rather than a smaller type. + +Use care when converting integer types. Integer conversions and promotions can cause undefined behavior, leading to security bugs and other problems. + +## 64-bit Portability + +Code should be 64-bit and 32-bit friendly. Bear in mind problems of printing, comparisons, and structure alignment. +- Correct portable printf() conversion specifiers for some integral typedefs rely on macro expansions that we find unpleasant to use and impractical to require (the PRI macros from ). Unless there is no reasonable alternative for your particular case, try to avoid or even upgrade APIs that rely on the printf family. Instead use a library supporting typesafe numeric formatting, such as StrCat or Substitute for fast simple conversions, or std::ostream. +- Unfortunately, the PRI macros are the only portable way to specify a conversion for the standard bitwidth typedefs (e.g., int64_t, uint64_t, int32_t, uint32_t, etc). Where possible, avoid passing arguments of types specified by bitwidth typedefs to printf-based APIs. Note that it is acceptable to use typedefs for which printf has dedicated length modifiers, such as `size_t (z)`, `ptrdiff_t (t)`, and `maxint_t (j)`. +- Remember that `sizeof(void *) != sizeof(int)`. Use intptr_t if you want a pointer-sized integer. +You may need to be careful with structure alignments, particularly for structures being stored on disk. Any class/structure with a int64_t/uint64_t member will by default end up being 8-byte aligned on a 64-bit system. If you have such structures being shared on disk between 32-bit and 64-bit code, you will need to ensure that they are packed the same on both architectures. Most compilers offer a way to alter structure alignment. For gcc, you can use `__attribute__((packed))`. MSVC offers `#pragma pack()` and `__declspec(align())`. +- Use braced-initialization as needed to create 64-bit constants. For example: +```c++ +int64_t my_value{0x123456789}; +uint64_t my_mask{3ULL << 48}; +``` + +## Preprocessor Macros + +Avoid defining macros, especially in headers; prefer inline functions, enums, and const variables. Name macros with a project-specific prefix. Do not use macros to define pieces of a C++ API. + +Macros mean that the code you see is not the same as the code the compiler sees. This can introduce unexpected behavior, especially since macros have global scope. + +The problems introduced by macros are especially severe when they are used to define pieces of a C++ API, and still more so for public APIs. Every error message from the compiler when developers incorrectly use that interface now must explain how the macros formed the interface. Refactoring and analysis tools have a dramatically harder time updating the interface. As a consequence, we specifically disallow using macros in this way. For example, avoid patterns like: +```c++ +class WOMBAT_TYPE(Foo) { + // ... + + public: + EXPAND_PUBLIC_WOMBAT_API(Foo) + + EXPAND_WOMBAT_COMPARISONS(Foo, ==, <) +}; +``` + +Luckily, macros are not nearly as necessary in C++ as they are in C. Instead of using a macro to inline performance-critical code, use an inline function. Instead of using a macro to store a constant, use a const variable. Instead of using a macro to "abbreviate" a long variable name, use a reference. Instead of using a macro to conditionally compile code ... well, don't do that at all (except, of course, for the #pragma guards to prevent double inclusion of header files). It makes testing much more difficult. + +Macros can do things these other techniques cannot, and you do see them in the codebase, especially in the lower-level libraries. And some of their special features (like stringifying, concatenation, and so forth) are not available through the language proper. But before using a macro, consider carefully whether there's a non-macro way to achieve the same result. If you need to use a macro to define an interface, contact your project leads to request a waiver of this rule. + +The following usage pattern will avoid many problems with macros; if you use macros, follow it whenever possible: + +- Don't define macros in a .h file. +#define macros right before you use them, and #undef them right after. +- Do not just #undef an existing macro before replacing it with your own; instead, pick a name that's likely to be unique. +- Try not to use macros that expand to unbalanced C++ constructs, or at least document that behavior well. +- Prefer not using ## to generate function/class/variable names. + +Exporting macros from headers (i.e., defining them in a header without #undefing them before the end of the header) is extremely strongly discouraged. If you do export a macro from a header, it must have a globally unique name. To achieve this, it must be named with a prefix consisting of your project's namespace name (but upper case). + +## 0 and nullptr/NULL + +Use nullptr for pointers, and '\0' for chars (and not the 0 literal). + +For pointers (address values), use nullptr, as this provides type-safety. + +Use '\0' for the null character. Using the correct type makes the code more readable. + +Never use NULL. + +## Type Deduction (including auto) + +Use type deduction only if it makes the code clearer to readers who aren't familiar with the project, or if it makes the code safer. Do not use it merely to avoid the inconvenience of writing an explicit type. + +**Definition:** + +There are several contexts in which C++ allows (or even requires) types to be deduced by the compiler, rather than spelled out explicitly in the code: + +**Pros:** + +- C++ type names can be long and cumbersome, especially when they involve templates or namespaces. +- When a C++ type name is repeated within a single declaration or a small code region, the repetition may not be aiding readability. +- It is sometimes safer to let the type be deduced, since that avoids the possibility of unintended copies or type conversions. + +**Cons:** + +C++ code is usually clearer when types are explicit, especially when type deduction would depend on information from distant parts of the code. In expressions like: + +```c++ +auto foo = x.add_foo(); +auto i = y.Find(key); +``` + +it may not be obvious what the resulting types are if the type of y isn't very well known, or if y was declared many lines earlier. + +Programmers have to understand when type deduction will or won't produce a reference type, or they'll get copies when they didn't mean to. + +If a deduced type is used as part of an interface, then a programmer might change its type while only intending to change its value, leading to a more radical API change than intended. + +**Decision:** + +The fundamental rule is: use type deduction only to make the code clearer or safer, and do not use it merely to avoid the inconvenience of writing an explicit type. When judging whether the code is clearer, keep in mind that your readers are not necessarily on your team, or familiar with your project, so types that you and your reviewer experience as unnecessary clutter will very often provide useful information to others. For example, you can assume that the return type of make_unique() is obvious, but the return type of MyWidgetFactory() probably isn't. + +These principles apply to all forms of type deduction, but the details vary, as described in the following sections. + +## Lambda Expressions + +Use lambda expressions where appropriate. Prefer explicit captures when the lambda will escape the current scope. + +**Pros:** + +- Lambdas are much more concise than other ways of defining function objects to be passed to STL algorithms, which can be a readability improvement. +- Appropriate use of default captures can remove redundancy and highlight important exceptions from the default. +- Lambdas, std::function, and std::bind can be used in combination as a general purpose callback mechanism; they make it easy to write functions that take bound functions as arguments. + +**Cons:** + +- Variable capture in lambdas can be a source of dangling-pointer bugs, particularly if a lambda escapes the current scope. +- Default captures by value can be misleading because they do not prevent dangling-pointer bugs. - Capturing a pointer by value doesn't cause a deep copy, so it often has the same lifetime issues as capture by reference. This is especially confusing when capturing 'this' by value, since the use of 'this' is often implicit. +- Captures actually declare new variables (whether or not the captures have initializers), but they look nothing like any other variable declaration syntax in C++. In particular, there's no place for the variable's type, or even an auto placeholder (although init captures can indicate it indirectly, e.g., with a cast). This can make it difficult to even recognize them as declarations. +- Init captures inherently rely on type deduction, and suffer from many of the same drawbacks as auto, with the additional problem that the syntax doesn't even cue the reader that deduction is taking place. +- It's possible for use of lambdas to get out of hand; very long nested anonymous functions can make code harder to understand. + +**Decision:** + +- Use lambda expressions where appropriate, with formatting as described below. +- Prefer explicit captures if the lambda may escape the current scope. For example, instead of: +```c++ +{ + Foo foo; + ... + executor->Schedule([&] { Frobnicate(foo); }) + ... +} +// BAD! The fact that the lambda makes use of a reference to `foo` and +// possibly `this` (if `Frobnicate` is a member function) may not be +// apparent on a cursory inspection. If the lambda is invoked after +// the function returns, that would be bad, because both `foo` +// and the enclosing object could have been destroyed. +``` + +prefer to write: +```c++ +{ + Foo foo; + ... + executor->Schedule([&foo] { Frobnicate(foo); }) + ... +} +// BETTER - The compile will fail if `Frobnicate` is a member +// function, and it's clearer that `foo` is dangerously captured by +// reference. +``` +- Use default capture by reference ([&]) only when the lifetime of the lambda is obviously shorter than any potential captures. +- Use default capture by value ([=]) only as a means of binding a few variables for a short lambda, where the set of captured variables is obvious at a glance. Prefer not to write long or complex lambdas with default capture by value. +- Use captures only to actually capture variables from the enclosing scope. Do not use captures with initializers to introduce new names, or to substantially change the meaning of an existing name. Instead, declare a new variable in the conventional way and then capture it, or avoid the lambda shorthand and define a function object explicitly. +- See the section on type deduction for guidance on specifying the parameter and return types. + +## Template Metaprogramming + +Avoid complicated template programming. + +## Boost + +Use only approved libraries from the Boost library collection. + +//TODO: add using boost libs + +## Naming + +Optimize for readability using names that would be clear even to people on a different team. + +Use names that describe the purpose or intent of the object. Do not worry about saving horizontal space as it is far more important to make your code immediately understandable by a new reader. Minimize the use of abbreviations that would likely be unknown to someone outside your project (especially acronyms and initialisms). Do not abbreviate by deleting letters within a word. As a rule of thumb, an abbreviation is probably OK if it's listed in Wikipedia. Generally speaking, descriptiveness should be proportional to the name's scope of visibility. For example, n may be a fine name within a 5-line function, but within the scope of a class, it's likely too vague. +```c++ +class MyClass { + public: + int countFooErrors(const std::vector& foos) { + int n = 0; // Clear meaning given limited scope and context + for (const auto& foo : foos) { + ... + ++n; + } + return n; + } + void doSomethingImportant() { + std::string fqdn = ...; // Well-known abbreviation for Fully Qualified Domain Name + } + private: + const int _maxAllowedConnections = ...; // Clear meaning within context +}; +``` + +```c++ +class MyClass { + public: + int countFooErrors(const std::vector& foos) { + int totalNumberOfFooErrors = 0; // Overly verbose given limited scope and context + for (int fooIndex = 0; fooIndex < foos.size(); ++fooIndex) { // Use idiomatic `i` + ... + ++totalNumberOfFooErrors; + } + return totalNumberOfFooErrors; + } + void doSomethingImportant() { + int cstmrId = ...; // Deletes internal letters + } + private: + const int _num = ...; // Unclear meaning within broad scope +}; +``` + +Note that certain universally-known abbreviations are OK, such as i for an iteration variable and T for a template parameter. + +## File Names + +Filenames start with a capital letter and have a capital letter for each new word can include dashes (-). + +Examples of acceptable file names: +- MyUsefulClass.cpp +- Application-mac.mm + + +C++ files should end in `.cpp` and header files should end in `.h`. Files that rely on being textually included at specific points should end in .inc. + +Do not use filenames that already exist in `/usr/include`, such as `db.h`. + +In general, make your filenames very specific. For example, use `HttpServerLogs.h` rather than `logs.h`. A very common case is to have a pair of files called, e.g., `FooBar.h` and `FooBar.cpp`, defining a class called `FooBar`. + +## Type Names + +Type names start with a capital letter and have a capital letter for each new word, with no underscores: `MyExcitingClass`, `MyExcitingEnum`. + +The names of all types — classes, structs, type aliases, enums, and type template parameters — have the same naming convention. Type names should start with a capital letter and have a capital letter for each new word. No underscores. For example: +```c++ +// classes and structs +class UrlTable { ... +class UrlTableTester { ... +struct UrlTableProperties { ... + +// typedefs +typedef hash_map PropertiesMap; + +// using aliases +using PropertiesMap = hash_map; + +// enums +enum class UrlTableError { ... +``` + +## Variable Names + +The names of variables (including function parameters) and data members start with a lowercase letter and have a capital letter for each new word. + +### Common Variable names + +For example: +```c++ +std::string tableName; // OK. + +``` + +```c++ +std::string table_Name; // Bad - has underscore. +``` + + +### Class Data Members + +Data members of classes, both static and non-static, are named like ordinary nonmember variables, but with a prefix underscore. +```c++ +class TableInfo { + ... + private: + std::string _tableName; // OK. + static Pool* _pool; // OK. +}; +``` + +## Struct Data Members + +Data members of structs, both static and non-static, are named like ordinary nonmember variables. They do not have the prefix underscores that data members in classes have. +```c++ +struct UrlTableProperties { + std::string name; + int numEntries; + static Pool* pool; +}; +``` + +## Constant Names +Variables declared constexpr or const, and whose value is fixed for the duration of the program, then use all capital letters and connect each word with under scores. For example: +```c++ +const int DAYS_IN_A_WEEK = 7; +const int ANDRDOI8_0_0 = 24; // Android 8.0.0 +``` + +## Function Names + +Regular functions have mixed case; accessors and mutators may be named like variables. + +Ordinarily, functions should start with a lowercase letter and have a capital letter for each new word. +```c++ +addTableEntry() +deleteUrl() +openFileOrDie() +``` + +Accessors and mutators (get and set functions) may be named like variables. These often correspond to actual member variables, but this is not required. For example, `int count()` and `void setCount(int count)`. + +## Namespace Names + +Namespace names are all lower-case, with words separated by underscores. Top-level namespace names are based on the project name . Avoid collisions between nested namespaces and well-known top-level namespaces. + +## Enumerator Names + +Enumerators (for both scoped and unscoped enums) should be named like constants. That is, ENUM_NAME. +```c++ +enum class AlternateUrlTableError { + OK = 0, + OUT_OF_MEMORY = 1, + MALFORMED_INPUT = 2, +}; +``` + +## Macro Names + +You're not really going to define a macro, are you? If you do, they're like this: MY_MACRO_THAT_SCARES_SMALL_CHILDREN_AND_ADULTS_ALIKE. +```c++ +#define ROUND(x) ... +#define PI_ROUNDED 3.0 +``` + +## Braced initialization + +C++ provides braced initialization since C++11. It is a uniform initialization. And it will prohibit implicit narrowing conversions, for example: +```c++ +double x, y, z; +... +int sum1{ x + y + z}; // error! sum of doubles may not be expressible as int. +``` + +So use braced initialization as possible. + +# Formatting + +There is `.clang-format` file in the root of repo, please use clang format to format the codes before sending a pull request. + +[1]: https://user-images.githubusercontent.com/1503156/112012067-d5cdf580-8b63-11eb-819a-1c32cf253b25.png + diff --git a/native/docs/LINTER_AUTOFIX_GUIDE.md b/native/docs/LINTER_AUTOFIX_GUIDE.md new file mode 100644 index 0000000000..5ff6a7c987 --- /dev/null +++ b/native/docs/LINTER_AUTOFIX_GUIDE.md @@ -0,0 +1,119 @@ +# Linter Auto-fix Guide + +This is a guide to help you setting up the appropriate environment to enable auto-fixing most of the coding style check rules, including both `clang-format` and `clang-tidy`. + +For now, **Visual Studio Code** is our first recommended IDE for the job, while a brief discussion about the support in different IDEs can be found at the end of this document. + +## VS Code With `C/C++` & `Clang-Tidy` Extension + +* Make sure both `clang-tidy` and `clang-format` are directly accessible in your terminal environment, i.e. install LLVM and add the bin folder into the environment path. LLVM 11+ is recommended. + + ![](imgs/LLVM.png) + +* Make sure you have `ANDROID_NDK_HOME` or `ANDROID_NDK_ROOT` or `NDK_ROOT` environment variable pointing to the Android NDK path. + + ![](imgs/NDK.png) + +* Open terminal (or git-bash/MSYS2 if you are on windows), navigate to `engine-native` folder and run: + + ```bash + utils/generate_compile_commands_android.sh # other platforms + utils/generate_compile_commands_android_windows.sh # if using git-bash on windows + ``` + + If it succeeds, you should see a `compile_commands.json` generated in the same folder, and ignored by git. + + ![](imgs/compile_commands.png) + +* Install both `C/C++` and `Clang-Tidy` extension from the market: + + ![](imgs/extensions.png) + +* If everything goes smoothly, after opening any source file, you should be able to see the `Clang-Tidy` extension's linting process and its output as warnings right inside the editor, without any errors. + + ![](imgs/tidy-output-editor.png) + +* But in the case when you do see errors popping up like this: (note the red color in the scroll bar) + + ![](imgs/tidy-output-error.png) + + That means you have compile errors **for this single file**. Since it does compile on our target platforms as part of the engine project library, the most common cause for this issue is that the dependent header declaration is not complete, i.e. the file is not self-contained. You should always declare all the headers your file depends on. + + In the case of this screenshot, the declaration of the base class `Object` is missing, so we are indeed missing headers. + +* If you've made any changes and need to re-lint the file, you should save the file and execute the `Clang-Tidy: Lint File` command: + + ![](imgs/re-lint.png) + + This process can be a bit repetitive if you are modifying lots of files together, so there are options to `Lint On Save` or even `Fix On Save`: + + ![](imgs/tidy-options.png) + +* After clearing the compile errors, you are ready to execute auto fix. For now the only way to do this is to just enable the `Fix On Save` option, and save the file. + + ![](imgs/auto-fix.gif) + + Note that auto-fix can not fix all the issues `Clang-Tidy` reports. You still have to manually fix some of the trickier issues, but generally most of the issues are trivial and can be auto-fixed. + + Also note that the linting and fixing process for `Clang-Tidy` is understandably time-consuming. So you should only enable the xx-on-save options when actually needed to. The screenshot does not reflect the actual time needed for the process. + +* Whenever in doubt, you can always refer to the `Clang-Tidy` extension output window for more detailed information. + + ![](imgs/tidy-output.png) + + This is a screenshot of linting issue-free files. + +* For `Clang-Format` issues, there will be no in-place editor suggestions, but all issues are strictly auto-fixable, and if the environment set up above goes smoothly, it is as simple as executing the `Format Document` command. (By default `Shift + Alt + F` on Windows) + + ![](imgs/format.png) + + This functionality is provided by the C/C++ extension. + + ![](imgs/auto-format.gif) + + On the contrary to `Clang-Tidy`, `Clang-Format` auto-formatting is an immediate operation and should be used frequently. + +> Note: The `compile_commands.json` generated by the current approach is essentially the Android development environment. So other platform-specific code may likely not be included in the check. This behavior is consistent with the CI test environment. + +> Also note: Once new source files have been added to the project in the CMakeLists, the `compile_commands.json` has to be regenerated by running the same script in the third step. + +## VS Code With `clangd` Extension + +Another fairly decent choice is to install the `clangd` extension only: (`clangd` and `C/C++` extension conflicts with each other so you can't have both) + +![](imgs/clangd.png) + +`clangd` is the official language server by LLVM. Compared to the first approach, it has real-time linting & fixing support (much better performance and IDE integration). However it only supports a subset of clang-tidy rules, so the reports won't be identical to the CI environment and it doesn't provide a 'fix-all' command. But combined with the CLI approach below it still can be of a great help. + +## Command Line Interface + +The second recommended way is to directly use the CLI. + +We provide a bash script to apply auto-fix on all the changed files in arbitrary commit/range: + +First make sure the first three steps in VS Code environment setup are done, i.e. `compile_commands.json` has been generated, then: + +```bash +utils/tidy-fix-commit.sh # run auto-fix on files in the latest commit +utils/tidy-fix-commit.sh 70181ed # run auto-fix on files in the specified commit +utils/tidy-fix-commit.sh HEAD~3..HEAD # run auto-fix on files in the last 3 commit +``` + +All the issues will be reported in the standard output. This can be used as local self-test runs for CI checks. + +Also, you can install the `Command Runner` extension in VSCode: + +![](imgs/command-runner.png) + +And assign a suitable key binding for fixing the current file (See the extension doc on how to do this): +```bash +clang-tidy -fix '${file}' +``` + +## Other IDEs + +It is possible to use other IDEs as long as they [support Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/Integrations.html). + +Notably there is `CLion`, or the `Resharper C++` MSVC extension that can do a fairly decent job on analyzing and fixing linter issues. But both are commercially licensed and [intentionally](https://resharper-support.jetbrains.com/hc/en-us/articles/207242695-Can-I-fix-all-issues-Quick-Fixes-naming-suggestions-etc-at-once-) lacks the functionality to apply fixes to all the issues. They can either apply auto-fix per instance or apply to the whole project by issue types. + +Considering the current circumstances this is usually not what we want in daily development, since the more files we touch, the heavier the burden is to pass the CI check, which detects problems on all the changed files in a single pull request. diff --git a/native/docs/imgs/LLVM.png b/native/docs/imgs/LLVM.png new file mode 100644 index 0000000000..227ac7024b Binary files /dev/null and b/native/docs/imgs/LLVM.png differ diff --git a/native/docs/imgs/NDK.png b/native/docs/imgs/NDK.png new file mode 100644 index 0000000000..49bbbf0041 Binary files /dev/null and b/native/docs/imgs/NDK.png differ diff --git a/native/docs/imgs/auto-fix.gif b/native/docs/imgs/auto-fix.gif new file mode 100644 index 0000000000..8e681a982c Binary files /dev/null and b/native/docs/imgs/auto-fix.gif differ diff --git a/native/docs/imgs/auto-format.gif b/native/docs/imgs/auto-format.gif new file mode 100644 index 0000000000..c12d2673d9 Binary files /dev/null and b/native/docs/imgs/auto-format.gif differ diff --git a/native/docs/imgs/clangd.png b/native/docs/imgs/clangd.png new file mode 100644 index 0000000000..d6889bdaf8 Binary files /dev/null and b/native/docs/imgs/clangd.png differ diff --git a/native/docs/imgs/command-runner.png b/native/docs/imgs/command-runner.png new file mode 100644 index 0000000000..b9e763c4fa Binary files /dev/null and b/native/docs/imgs/command-runner.png differ diff --git a/native/docs/imgs/compile_commands.png b/native/docs/imgs/compile_commands.png new file mode 100644 index 0000000000..35e90992a7 Binary files /dev/null and b/native/docs/imgs/compile_commands.png differ diff --git a/native/docs/imgs/extensions.png b/native/docs/imgs/extensions.png new file mode 100644 index 0000000000..ba50222001 Binary files /dev/null and b/native/docs/imgs/extensions.png differ diff --git a/native/docs/imgs/format.png b/native/docs/imgs/format.png new file mode 100644 index 0000000000..f99c9eb38c Binary files /dev/null and b/native/docs/imgs/format.png differ diff --git a/native/docs/imgs/re-lint.png b/native/docs/imgs/re-lint.png new file mode 100644 index 0000000000..2ac467afe1 Binary files /dev/null and b/native/docs/imgs/re-lint.png differ diff --git a/native/docs/imgs/tidy-options.png b/native/docs/imgs/tidy-options.png new file mode 100644 index 0000000000..a336ce5339 Binary files /dev/null and b/native/docs/imgs/tidy-options.png differ diff --git a/native/docs/imgs/tidy-output-editor.png b/native/docs/imgs/tidy-output-editor.png new file mode 100644 index 0000000000..151a3e57c6 Binary files /dev/null and b/native/docs/imgs/tidy-output-editor.png differ diff --git a/native/docs/imgs/tidy-output-error.png b/native/docs/imgs/tidy-output-error.png new file mode 100644 index 0000000000..f542dac19c Binary files /dev/null and b/native/docs/imgs/tidy-output-error.png differ diff --git a/native/docs/imgs/tidy-output.png b/native/docs/imgs/tidy-output.png new file mode 100644 index 0000000000..fd9dfb9f31 Binary files /dev/null and b/native/docs/imgs/tidy-output.png differ diff --git a/native/extensions/assets-manager/AssetsManagerEx.cpp b/native/extensions/assets-manager/AssetsManagerEx.cpp index 89db380cdd..2bf9eb7df8 100644 --- a/native/extensions/assets-manager/AssetsManagerEx.cpp +++ b/native/extensions/assets-manager/AssetsManagerEx.cpp @@ -24,12 +24,14 @@ THE SOFTWARE. ****************************************************************************/ #include "AssetsManagerEx.h" -#include "base/UTF8.h" -#include "AsyncTaskPool.h" #include #include +#include "base/UTF8.h" +#include "AsyncTaskPool.h" +#include "base/Log.h" + #ifdef MINIZIP_FROM_SYSTEM #include #else // from our embedded sources diff --git a/native/extensions/cocos-ext.h b/native/extensions/cocos-ext.h index dee1abf190..6e915c4088 100644 --- a/native/extensions/cocos-ext.h +++ b/native/extensions/cocos-ext.h @@ -26,6 +26,10 @@ #ifndef __COCOS2D_EXT_H__ #define __COCOS2D_EXT_H__ +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + #include "ExtensionMacros.h" #include "assets-manager/AssetsManagerEx.h" diff --git a/native/external/config.json b/native/external/config.json index a21eff6374..a94c8d0b54 100644 --- a/native/external/config.json +++ b/native/external/config.json @@ -1,9 +1,9 @@ { - "version": "v3d-gfx-30", + "version": "v3d-gfx-43", "from": { "type": "github", "owner": "cocos-creator", - "name": "cocos2d-x-lite-external", - "checkout": "v3d-gfx-30" + "name": "engine-native-external", + "checkout": "v3d-gfx-43" } } diff --git a/native/gulpfile.js b/native/gulpfile.js index 3377333a63..3997ff6dda 100644 --- a/native/gulpfile.js +++ b/native/gulpfile.js @@ -46,7 +46,6 @@ program .parse(process.argv); gulp.task('make-cocos2d-x', gulpSequence('gen-cocos2d-x', 'upload-cocos2d-x')); -gulp.task('make-simulator', gulpSequence('gen-simulator', 'sign-simulator', 'update-simulator-config', 'update-simulator-dll', 'archive-simulator', 'upload-simulator')); if (process.platform === 'darwin') { gulp.task('publish', gulpSequence('update', 'init', 'bump-version', 'make-cocos2d-x', 'make-simulator')); @@ -63,19 +62,6 @@ function execSync (cmd, workPath) { ExecSync(cmd, execOptions); } -function downloadSimulatorDLL (callback) { - var Download = require('download'); - var destPath = Path.join('simulator', 'win32'); - Download('http://192.168.52.109/TestBuilds/Fireball/simulator/dlls/dll.zip', destPath, { - mode: '755', - extract: true, - strip: 0, - agent: null, - }).then(function (res) { - callback(); - }).catch(callback); -} - function upload2Ftp (localPath, ftpPath, config, cb) { var ftpClient = new Ftp(); ftpClient.on('error', function (err) { @@ -218,10 +204,13 @@ gulp.task('gen-simulator', async function () { console.log(data.toString ? data.toString() : data); }); }); +}); +gulp.task('clean-simulator', async function () { console.log('=====================================\n'); console.log('clean project\n'); console.log('=====================================\n'); + let isWin32 = process.platform === 'win32'; let delPatterns = [ formatPath(Path.join(__dirname, './simulator/*')), formatPath(`!${Path.join(__dirname, './simulator/Debug')}`), @@ -232,50 +221,15 @@ gulp.task('gen-simulator', async function () { } console.log('delete patterns: ', JSON.stringify(delPatterns, undefined, 2)); await del(delPatterns, { force: true }); - - console.log('done!'); }); -gulp.task('sign-simulator', function () { - try { - var cmd = fs.readFileSync(Path.join(process.env.HOME, '.ssh', 'codesignCmd_simulator.txt'), 'utf8'); - execSync(cmd); - } - catch (e) { - console.warn('No need to run sign-simulator since v1.10.', e); - } -}); - -gulp.task('update-simulator-config', function (cb) { - var destPath = process.platform === 'win32' ? './simulator/win32/config.json' : './simulator/mac/Simulator.app/Contents/Resources/config.json'; - fs.copy('./tools/simulator/config.json', destPath, cb); -}); - -// 在 'sign-simulator' 之后执行,以保留这些 dll 来自第三方的签名 -gulp.task('update-simulator-dll', function (cb) { - if (process.platform === 'win32') { - downloadSimulatorDLL(cb); - } else { - cb(); - } -}); - -gulp.task('archive-simulator', function () { - return gulp.src('./simulator/**/*') - .pipe(zip('simulator_' + process.platform + '.zip')) - .pipe(gulp.dest('./')); -}); +gulp.task('gen-simulator-release', gulp.series('gen-simulator', 'clean-simulator')); gulp.task('upload-cocos2d-x', function (cb) { var zipFileName = 'cocos2d-x.zip'; uploadZipFile(zipFileName, './tools/make-package', cb); }); -gulp.task('upload-simulator', function (cb) { - var zipFileName = 'simulator_' + process.platform + '.zip'; - uploadZipFile(zipFileName, '.', cb); -}); - gulp.task('bump-version', function (cb) { let ver; if (!program.bump) { diff --git a/native/templates/android/build/gradle.properties b/native/templates/android/build/gradle.properties index a9271cc992..58d38b8729 100644 --- a/native/templates/android/build/gradle.properties +++ b/native/templates/android/build/gradle.properties @@ -23,7 +23,7 @@ android.injected.testOnly=false PROP_COMPILE_SDK_VERSION=27 # Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=16 +PROP_MIN_SDK_VERSION=21 # Android SDK version that will be used as the latest version of android this application has been tested on PROP_TARGET_SDK_VERSION=27 diff --git a/native/templates/cocos2dx_files.json b/native/templates/cocos2dx_files.json index 9c771d5ffa..d534a82c5c 100644 --- a/native/templates/cocos2dx_files.json +++ b/native/templates/cocos2dx_files.json @@ -3,6 +3,11 @@ ".browserslistrc", ".clang-format", ".clang-tidy", + ".github/workflows/clang-format.yml", + ".github/workflows/clangtidy-android.yml", + ".github/workflows/cmake.yml", + ".github/workflows/filter_by_cdb.js", + ".vscode/c_cpp_properties.json", "CMakeLists.txt", "cocos/audio/AudioEngine.cpp", "cocos/audio/android/AssetFd.cpp", @@ -94,25 +99,28 @@ "cocos/audio/win32/AudioMacros.h", "cocos/audio/win32/AudioPlayer.cpp", "cocos/audio/win32/AudioPlayer.h", - "cocos/base/Array.cpp", - "cocos/base/Array.h", + "cocos/base/Agent.h", "cocos/base/AutoreleasePool.cpp", "cocos/base/AutoreleasePool.h", "cocos/base/CachedArray.h", "cocos/base/Config.h", + "cocos/base/CoreStd.h", "cocos/base/Data.cpp", "cocos/base/Data.h", + "cocos/base/IndexHandle.h", "cocos/base/Log.cpp", "cocos/base/Log.h", "cocos/base/Macros.h", "cocos/base/Map.h", "cocos/base/Object.h", - "cocos/base/Random.cpp", "cocos/base/Random.h", "cocos/base/Ref.cpp", "cocos/base/Ref.h", "cocos/base/Scheduler.cpp", "cocos/base/Scheduler.h", + "cocos/base/StringHandle.cpp", + "cocos/base/StringHandle.h", + "cocos/base/StringPool.h", "cocos/base/StringUtil.cpp", "cocos/base/StringUtil.h", "cocos/base/ThreadPool.cpp", @@ -120,8 +128,6 @@ "cocos/base/TypeDef.h", "cocos/base/UTF8.cpp", "cocos/base/UTF8.h", - "cocos/base/UTFString.cpp", - "cocos/base/UTFString.h", "cocos/base/Utils.cpp", "cocos/base/Utils.h", "cocos/base/Value.cpp", @@ -139,6 +145,15 @@ "cocos/base/etc1.h", "cocos/base/etc2.cpp", "cocos/base/etc2.h", + "cocos/base/job-system/JobSystem.h", + "cocos/base/job-system/job-system-taskflow/TFJobGraph.cpp", + "cocos/base/job-system/job-system-taskflow/TFJobGraph.h", + "cocos/base/job-system/job-system-taskflow/TFJobSystem.cpp", + "cocos/base/job-system/job-system-taskflow/TFJobSystem.h", + "cocos/base/job-system/job-system-tbb/TBBJobGraph.cpp", + "cocos/base/job-system/job-system-tbb/TBBJobGraph.h", + "cocos/base/job-system/job-system-tbb/TBBJobSystem.cpp", + "cocos/base/job-system/job-system-tbb/TBBJobSystem.h", "cocos/base/memory/AllocatedObj.cpp", "cocos/base/memory/AllocatedObj.h", "cocos/base/memory/JeAlloc.cpp", @@ -152,7 +167,19 @@ "cocos/base/memory/NedPooling.h", "cocos/base/memory/StdAlloc.h", "cocos/base/memory/StlAlloc.h", - "cocos/base/uthash.h", + "cocos/base/threading/ConditionVariable.cpp", + "cocos/base/threading/ConditionVariable.h", + "cocos/base/threading/Event.h", + "cocos/base/threading/MessageQueue.cpp", + "cocos/base/threading/MessageQueue.h", + "cocos/base/threading/ReadWriteLock.h", + "cocos/base/threading/Semaphore.cpp", + "cocos/base/threading/Semaphore.h", + "cocos/base/threading/ThreadPool.cpp", + "cocos/base/threading/ThreadPool.h", + "cocos/base/threading/ThreadSafeCounter.h", + "cocos/base/threading/ThreadSafeLinearAllocator.cpp", + "cocos/base/threading/ThreadSafeLinearAllocator.h", "cocos/editor-support/IOBuffer.cpp", "cocos/editor-support/IOBuffer.h", "cocos/editor-support/IOTypedArray.cpp", @@ -472,6 +499,59 @@ "cocos/network/WebSocket.h", "cocos/network/WebSocketServer.cpp", "cocos/network/WebSocketServer.h", + "cocos/physics/PhysicsSDK.h", + "cocos/physics/PhysicsSelector.h", + "cocos/physics/physx/PhysX.h", + "cocos/physics/physx/PhysXEventManager.cpp", + "cocos/physics/physx/PhysXEventManager.h", + "cocos/physics/physx/PhysXFilterShader.cpp", + "cocos/physics/physx/PhysXFilterShader.h", + "cocos/physics/physx/PhysXInc.h", + "cocos/physics/physx/PhysXRigidBody.cpp", + "cocos/physics/physx/PhysXRigidBody.h", + "cocos/physics/physx/PhysXSharedBody.cpp", + "cocos/physics/physx/PhysXSharedBody.h", + "cocos/physics/physx/PhysXUtils.cpp", + "cocos/physics/physx/PhysXUtils.h", + "cocos/physics/physx/PhysXWorld.cpp", + "cocos/physics/physx/PhysXWorld.h", + "cocos/physics/physx/joints/PhysXDistance.cpp", + "cocos/physics/physx/joints/PhysXDistance.h", + "cocos/physics/physx/joints/PhysXJoint.cpp", + "cocos/physics/physx/joints/PhysXJoint.h", + "cocos/physics/physx/joints/PhysXRevolute.cpp", + "cocos/physics/physx/joints/PhysXRevolute.h", + "cocos/physics/physx/shapes/PhysXBox.cpp", + "cocos/physics/physx/shapes/PhysXBox.h", + "cocos/physics/physx/shapes/PhysXCapsule.cpp", + "cocos/physics/physx/shapes/PhysXCapsule.h", + "cocos/physics/physx/shapes/PhysXCone.cpp", + "cocos/physics/physx/shapes/PhysXCone.h", + "cocos/physics/physx/shapes/PhysXCylinder.cpp", + "cocos/physics/physx/shapes/PhysXCylinder.h", + "cocos/physics/physx/shapes/PhysXPlane.cpp", + "cocos/physics/physx/shapes/PhysXPlane.h", + "cocos/physics/physx/shapes/PhysXShape.cpp", + "cocos/physics/physx/shapes/PhysXShape.h", + "cocos/physics/physx/shapes/PhysXSphere.cpp", + "cocos/physics/physx/shapes/PhysXSphere.h", + "cocos/physics/physx/shapes/PhysXTerrain.cpp", + "cocos/physics/physx/shapes/PhysXTerrain.h", + "cocos/physics/physx/shapes/PhysXTrimesh.cpp", + "cocos/physics/physx/shapes/PhysXTrimesh.h", + "cocos/physics/sdk/Joint.cpp", + "cocos/physics/sdk/Joint.h", + "cocos/physics/sdk/RigidBody.cpp", + "cocos/physics/sdk/RigidBody.h", + "cocos/physics/sdk/Shape.cpp", + "cocos/physics/sdk/Shape.h", + "cocos/physics/sdk/World.cpp", + "cocos/physics/sdk/World.h", + "cocos/physics/spec/IBody.h", + "cocos/physics/spec/IJoint.h", + "cocos/physics/spec/ILifecycle.h", + "cocos/physics/spec/IShape.h", + "cocos/physics/spec/IWorld.h", "cocos/platform/Application.cpp", "cocos/platform/Application.h", "cocos/platform/CanvasRenderingContext2D.h", @@ -567,50 +647,135 @@ "cocos/platform/win32/compat/stdint.h", "cocos/platform/win32/inet_pton_mingw.cpp", "cocos/platform/win32/inet_pton_mingw.h", - "cocos/renderer/CMakeLists.txt", - "cocos/renderer/core/CMakeLists.txt", - "cocos/renderer/core/Core.h", - "cocos/renderer/core/CoreStd.cpp", - "cocos/renderer/core/CoreStd.h", - "cocos/renderer/core/gfx/GFXBuffer.cpp", - "cocos/renderer/core/gfx/GFXBuffer.h", - "cocos/renderer/core/gfx/GFXCommand.h", - "cocos/renderer/core/gfx/GFXCommandBuffer.cpp", - "cocos/renderer/core/gfx/GFXCommandBuffer.h", - "cocos/renderer/core/gfx/GFXCommandPool.h", - "cocos/renderer/core/gfx/GFXContext.cpp", - "cocos/renderer/core/gfx/GFXContext.h", - "cocos/renderer/core/gfx/GFXDef.cpp", - "cocos/renderer/core/gfx/GFXDef.h", - "cocos/renderer/core/gfx/GFXDescriptorSet.cpp", - "cocos/renderer/core/gfx/GFXDescriptorSet.h", - "cocos/renderer/core/gfx/GFXDescriptorSetLayout.cpp", - "cocos/renderer/core/gfx/GFXDescriptorSetLayout.h", - "cocos/renderer/core/gfx/GFXDevice.cpp", - "cocos/renderer/core/gfx/GFXDevice.h", - "cocos/renderer/core/gfx/GFXFence.cpp", - "cocos/renderer/core/gfx/GFXFence.h", - "cocos/renderer/core/gfx/GFXFramebuffer.cpp", - "cocos/renderer/core/gfx/GFXFramebuffer.h", - "cocos/renderer/core/gfx/GFXInputAssembler.cpp", - "cocos/renderer/core/gfx/GFXInputAssembler.h", - "cocos/renderer/core/gfx/GFXObject.cpp", - "cocos/renderer/core/gfx/GFXObject.h", - "cocos/renderer/core/gfx/GFXPipelineLayout.cpp", - "cocos/renderer/core/gfx/GFXPipelineLayout.h", - "cocos/renderer/core/gfx/GFXPipelineState.cpp", - "cocos/renderer/core/gfx/GFXPipelineState.h", - "cocos/renderer/core/gfx/GFXQueue.cpp", - "cocos/renderer/core/gfx/GFXQueue.h", - "cocos/renderer/core/gfx/GFXRenderPass.cpp", - "cocos/renderer/core/gfx/GFXRenderPass.h", - "cocos/renderer/core/gfx/GFXSampler.cpp", - "cocos/renderer/core/gfx/GFXSampler.h", - "cocos/renderer/core/gfx/GFXShader.cpp", - "cocos/renderer/core/gfx/GFXShader.h", - "cocos/renderer/core/gfx/GFXTexture.cpp", - "cocos/renderer/core/gfx/GFXTexture.h", - "cocos/renderer/gfx-gles2/CMakeLists.txt", + "cocos/renderer/GFXDeviceManager.h", + "cocos/renderer/frame-graph/Blackboard.h", + "cocos/renderer/frame-graph/CallbackPass.h", + "cocos/renderer/frame-graph/DevicePass.cpp", + "cocos/renderer/frame-graph/DevicePass.h", + "cocos/renderer/frame-graph/DevicePassResourceTable.cpp", + "cocos/renderer/frame-graph/DevicePassResourceTable.h", + "cocos/renderer/frame-graph/FrameGraph.cpp", + "cocos/renderer/frame-graph/FrameGraph.h", + "cocos/renderer/frame-graph/Handle.h", + "cocos/renderer/frame-graph/PassInsertPointManager.cpp", + "cocos/renderer/frame-graph/PassInsertPointManager.h", + "cocos/renderer/frame-graph/PassNode.cpp", + "cocos/renderer/frame-graph/PassNode.h", + "cocos/renderer/frame-graph/PassNodeBuilder.cpp", + "cocos/renderer/frame-graph/PassNodeBuilder.h", + "cocos/renderer/frame-graph/RenderTargetAttachment.h", + "cocos/renderer/frame-graph/Resource.h", + "cocos/renderer/frame-graph/ResourceAllocator.h", + "cocos/renderer/frame-graph/ResourceEntry.h", + "cocos/renderer/frame-graph/ResourceNode.h", + "cocos/renderer/frame-graph/VirtualResource.cpp", + "cocos/renderer/frame-graph/VirtualResource.h", + "cocos/renderer/gfx-agent/BufferAgent.cpp", + "cocos/renderer/gfx-agent/BufferAgent.h", + "cocos/renderer/gfx-agent/CommandBufferAgent.cpp", + "cocos/renderer/gfx-agent/CommandBufferAgent.h", + "cocos/renderer/gfx-agent/DescriptorSetAgent.cpp", + "cocos/renderer/gfx-agent/DescriptorSetAgent.h", + "cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.cpp", + "cocos/renderer/gfx-agent/DescriptorSetLayoutAgent.h", + "cocos/renderer/gfx-agent/DeviceAgent.cpp", + "cocos/renderer/gfx-agent/DeviceAgent.h", + "cocos/renderer/gfx-agent/FramebufferAgent.cpp", + "cocos/renderer/gfx-agent/FramebufferAgent.h", + "cocos/renderer/gfx-agent/InputAssemblerAgent.cpp", + "cocos/renderer/gfx-agent/InputAssemblerAgent.h", + "cocos/renderer/gfx-agent/LinearAllocatorPool.h", + "cocos/renderer/gfx-agent/PipelineLayoutAgent.cpp", + "cocos/renderer/gfx-agent/PipelineLayoutAgent.h", + "cocos/renderer/gfx-agent/PipelineStateAgent.cpp", + "cocos/renderer/gfx-agent/PipelineStateAgent.h", + "cocos/renderer/gfx-agent/QueueAgent.cpp", + "cocos/renderer/gfx-agent/QueueAgent.h", + "cocos/renderer/gfx-agent/RenderPassAgent.cpp", + "cocos/renderer/gfx-agent/RenderPassAgent.h", + "cocos/renderer/gfx-agent/SamplerAgent.cpp", + "cocos/renderer/gfx-agent/SamplerAgent.h", + "cocos/renderer/gfx-agent/ShaderAgent.cpp", + "cocos/renderer/gfx-agent/ShaderAgent.h", + "cocos/renderer/gfx-agent/TextureAgent.cpp", + "cocos/renderer/gfx-agent/TextureAgent.h", + "cocos/renderer/gfx-base/GFXBase.h", + "cocos/renderer/gfx-base/GFXBuffer.cpp", + "cocos/renderer/gfx-base/GFXBuffer.h", + "cocos/renderer/gfx-base/GFXCommandBuffer.cpp", + "cocos/renderer/gfx-base/GFXCommandBuffer.h", + "cocos/renderer/gfx-base/GFXContext.cpp", + "cocos/renderer/gfx-base/GFXContext.h", + "cocos/renderer/gfx-base/GFXDef-common.h", + "cocos/renderer/gfx-base/GFXDef.cpp", + "cocos/renderer/gfx-base/GFXDef.h", + "cocos/renderer/gfx-base/GFXDescriptorSet.cpp", + "cocos/renderer/gfx-base/GFXDescriptorSet.h", + "cocos/renderer/gfx-base/GFXDescriptorSetLayout.cpp", + "cocos/renderer/gfx-base/GFXDescriptorSetLayout.h", + "cocos/renderer/gfx-base/GFXDevice.cpp", + "cocos/renderer/gfx-base/GFXDevice.h", + "cocos/renderer/gfx-base/GFXFramebuffer.cpp", + "cocos/renderer/gfx-base/GFXFramebuffer.h", + "cocos/renderer/gfx-base/GFXGlobalBarrier.cpp", + "cocos/renderer/gfx-base/GFXGlobalBarrier.h", + "cocos/renderer/gfx-base/GFXInputAssembler.cpp", + "cocos/renderer/gfx-base/GFXInputAssembler.h", + "cocos/renderer/gfx-base/GFXObject.cpp", + "cocos/renderer/gfx-base/GFXObject.h", + "cocos/renderer/gfx-base/GFXPipelineLayout.cpp", + "cocos/renderer/gfx-base/GFXPipelineLayout.h", + "cocos/renderer/gfx-base/GFXPipelineState.cpp", + "cocos/renderer/gfx-base/GFXPipelineState.h", + "cocos/renderer/gfx-base/GFXQueue.cpp", + "cocos/renderer/gfx-base/GFXQueue.h", + "cocos/renderer/gfx-base/GFXRenderPass.cpp", + "cocos/renderer/gfx-base/GFXRenderPass.h", + "cocos/renderer/gfx-base/GFXSampler.cpp", + "cocos/renderer/gfx-base/GFXSampler.h", + "cocos/renderer/gfx-base/GFXShader.cpp", + "cocos/renderer/gfx-base/GFXShader.h", + "cocos/renderer/gfx-base/GFXTexture.cpp", + "cocos/renderer/gfx-base/GFXTexture.h", + "cocos/renderer/gfx-base/GFXTextureBarrier.cpp", + "cocos/renderer/gfx-base/GFXTextureBarrier.h", + "cocos/renderer/gfx-empty/EmptyBuffer.cpp", + "cocos/renderer/gfx-empty/EmptyBuffer.h", + "cocos/renderer/gfx-empty/EmptyCommandBuffer.cpp", + "cocos/renderer/gfx-empty/EmptyCommandBuffer.h", + "cocos/renderer/gfx-empty/EmptyContext.cpp", + "cocos/renderer/gfx-empty/EmptyContext.h", + "cocos/renderer/gfx-empty/EmptyDescriptorSet.cpp", + "cocos/renderer/gfx-empty/EmptyDescriptorSet.h", + "cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.cpp", + "cocos/renderer/gfx-empty/EmptyDescriptorSetLayout.h", + "cocos/renderer/gfx-empty/EmptyDevice.cpp", + "cocos/renderer/gfx-empty/EmptyDevice.h", + "cocos/renderer/gfx-empty/EmptyFramebuffer.cpp", + "cocos/renderer/gfx-empty/EmptyFramebuffer.h", + "cocos/renderer/gfx-empty/EmptyInputAssembler.cpp", + "cocos/renderer/gfx-empty/EmptyInputAssembler.h", + "cocos/renderer/gfx-empty/EmptyPipelineLayout.cpp", + "cocos/renderer/gfx-empty/EmptyPipelineLayout.h", + "cocos/renderer/gfx-empty/EmptyPipelineState.cpp", + "cocos/renderer/gfx-empty/EmptyPipelineState.h", + "cocos/renderer/gfx-empty/EmptyQueue.cpp", + "cocos/renderer/gfx-empty/EmptyQueue.h", + "cocos/renderer/gfx-empty/EmptyRenderPass.cpp", + "cocos/renderer/gfx-empty/EmptyRenderPass.h", + "cocos/renderer/gfx-empty/EmptySampler.cpp", + "cocos/renderer/gfx-empty/EmptySampler.h", + "cocos/renderer/gfx-empty/EmptyShader.cpp", + "cocos/renderer/gfx-empty/EmptyShader.h", + "cocos/renderer/gfx-empty/EmptyTexture.cpp", + "cocos/renderer/gfx-empty/EmptyTexture.h", + "cocos/renderer/gfx-gles-common/GLESCommandPool.h", + "cocos/renderer/gfx-gles-common/eglw.cpp", + "cocos/renderer/gfx-gles-common/eglw.h", + "cocos/renderer/gfx-gles-common/gles2w.cpp", + "cocos/renderer/gfx-gles-common/gles2w.h", + "cocos/renderer/gfx-gles-common/gles3w.cpp", + "cocos/renderer/gfx-gles-common/gles3w.h", "cocos/renderer/gfx-gles2/GFXGLES2.h", "cocos/renderer/gfx-gles2/GLES2Buffer.cpp", "cocos/renderer/gfx-gles2/GLES2Buffer.h", @@ -627,8 +792,6 @@ "cocos/renderer/gfx-gles2/GLES2DescriptorSetLayout.h", "cocos/renderer/gfx-gles2/GLES2Device.cpp", "cocos/renderer/gfx-gles2/GLES2Device.h", - "cocos/renderer/gfx-gles2/GLES2Fence.cpp", - "cocos/renderer/gfx-gles2/GLES2Fence.h", "cocos/renderer/gfx-gles2/GLES2Framebuffer.cpp", "cocos/renderer/gfx-gles2/GLES2Framebuffer.h", "cocos/renderer/gfx-gles2/GLES2GPUObjects.h", @@ -652,10 +815,9 @@ "cocos/renderer/gfx-gles2/GLES2Std.h", "cocos/renderer/gfx-gles2/GLES2Texture.cpp", "cocos/renderer/gfx-gles2/GLES2Texture.h", - "cocos/renderer/gfx-gles2/gles2w.c", - "cocos/renderer/gfx-gles2/gles2w.h", - "cocos/renderer/gfx-gles2/gles2w.mm", - "cocos/renderer/gfx-gles3/CMakeLists.txt", + "cocos/renderer/gfx-gles2/GLES2Wrangler.cpp", + "cocos/renderer/gfx-gles2/GLES2Wrangler.h", + "cocos/renderer/gfx-gles2/GLES2Wrangler.mm", "cocos/renderer/gfx-gles3/GFXGLES3.h", "cocos/renderer/gfx-gles3/GLES3Buffer.cpp", "cocos/renderer/gfx-gles3/GLES3Buffer.h", @@ -672,11 +834,11 @@ "cocos/renderer/gfx-gles3/GLES3DescriptorSetLayout.h", "cocos/renderer/gfx-gles3/GLES3Device.cpp", "cocos/renderer/gfx-gles3/GLES3Device.h", - "cocos/renderer/gfx-gles3/GLES3Fence.cpp", - "cocos/renderer/gfx-gles3/GLES3Fence.h", "cocos/renderer/gfx-gles3/GLES3Framebuffer.cpp", "cocos/renderer/gfx-gles3/GLES3Framebuffer.h", "cocos/renderer/gfx-gles3/GLES3GPUObjects.h", + "cocos/renderer/gfx-gles3/GLES3GlobalBarrier.cpp", + "cocos/renderer/gfx-gles3/GLES3GlobalBarrier.h", "cocos/renderer/gfx-gles3/GLES3InputAssembler.cpp", "cocos/renderer/gfx-gles3/GLES3InputAssembler.h", "cocos/renderer/gfx-gles3/GLES3PipelineLayout.cpp", @@ -697,15 +859,16 @@ "cocos/renderer/gfx-gles3/GLES3Std.h", "cocos/renderer/gfx-gles3/GLES3Texture.cpp", "cocos/renderer/gfx-gles3/GLES3Texture.h", - "cocos/renderer/gfx-gles3/gles3w.c", - "cocos/renderer/gfx-gles3/gles3w.h", - "cocos/renderer/gfx-gles3/gles3w.mm", - "cocos/renderer/gfx-metal/CMakeLists.txt", + "cocos/renderer/gfx-gles3/GLES3Wrangler.cpp", + "cocos/renderer/gfx-gles3/GLES3Wrangler.h", + "cocos/renderer/gfx-gles3/GLES3Wrangler.mm", "cocos/renderer/gfx-metal/GFXMTL.h", "cocos/renderer/gfx-metal/MTLBuffer.h", "cocos/renderer/gfx-metal/MTLBuffer.mm", "cocos/renderer/gfx-metal/MTLCommandBuffer.h", "cocos/renderer/gfx-metal/MTLCommandBuffer.mm", + "cocos/renderer/gfx-metal/MTLCommandEncoder.h", + "cocos/renderer/gfx-metal/MTLComputeCommandEncoder.h", "cocos/renderer/gfx-metal/MTLConfig.h", "cocos/renderer/gfx-metal/MTLContext.h", "cocos/renderer/gfx-metal/MTLContext.mm", @@ -715,8 +878,6 @@ "cocos/renderer/gfx-metal/MTLDescriptorSetLayout.mm", "cocos/renderer/gfx-metal/MTLDevice.h", "cocos/renderer/gfx-metal/MTLDevice.mm", - "cocos/renderer/gfx-metal/MTLFence.h", - "cocos/renderer/gfx-metal/MTLFence.mm", "cocos/renderer/gfx-metal/MTLFramebuffer.h", "cocos/renderer/gfx-metal/MTLFramebuffer.mm", "cocos/renderer/gfx-metal/MTLGPUObjects.h", @@ -742,7 +903,36 @@ "cocos/renderer/gfx-metal/MTLTexture.mm", "cocos/renderer/gfx-metal/MTLUtils.h", "cocos/renderer/gfx-metal/MTLUtils.mm", - "cocos/renderer/gfx-vulkan/CMakeLists.txt", + "cocos/renderer/gfx-validator/BufferValidator.cpp", + "cocos/renderer/gfx-validator/BufferValidator.h", + "cocos/renderer/gfx-validator/CommandBufferValidator.cpp", + "cocos/renderer/gfx-validator/CommandBufferValidator.h", + "cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.cpp", + "cocos/renderer/gfx-validator/DescriptorSetLayoutValidator.h", + "cocos/renderer/gfx-validator/DescriptorSetValidator.cpp", + "cocos/renderer/gfx-validator/DescriptorSetValidator.h", + "cocos/renderer/gfx-validator/DeviceValidator.cpp", + "cocos/renderer/gfx-validator/DeviceValidator.h", + "cocos/renderer/gfx-validator/FramebufferValidator.cpp", + "cocos/renderer/gfx-validator/FramebufferValidator.h", + "cocos/renderer/gfx-validator/InputAssemblerValidator.cpp", + "cocos/renderer/gfx-validator/InputAssemblerValidator.h", + "cocos/renderer/gfx-validator/PipelineLayoutValidator.cpp", + "cocos/renderer/gfx-validator/PipelineLayoutValidator.h", + "cocos/renderer/gfx-validator/PipelineStateValidator.cpp", + "cocos/renderer/gfx-validator/PipelineStateValidator.h", + "cocos/renderer/gfx-validator/QueueValidator.cpp", + "cocos/renderer/gfx-validator/QueueValidator.h", + "cocos/renderer/gfx-validator/RenderPassValidator.cpp", + "cocos/renderer/gfx-validator/RenderPassValidator.h", + "cocos/renderer/gfx-validator/SamplerValidator.cpp", + "cocos/renderer/gfx-validator/SamplerValidator.h", + "cocos/renderer/gfx-validator/ShaderValidator.cpp", + "cocos/renderer/gfx-validator/ShaderValidator.h", + "cocos/renderer/gfx-validator/TextureValidator.cpp", + "cocos/renderer/gfx-validator/TextureValidator.h", + "cocos/renderer/gfx-validator/ValidationUtils.cpp", + "cocos/renderer/gfx-validator/ValidationUtils.h", "cocos/renderer/gfx-vulkan/GFXVulkan.h", "cocos/renderer/gfx-vulkan/VKBuffer.cpp", "cocos/renderer/gfx-vulkan/VKBuffer.h", @@ -758,11 +948,11 @@ "cocos/renderer/gfx-vulkan/VKDescriptorSetLayout.h", "cocos/renderer/gfx-vulkan/VKDevice.cpp", "cocos/renderer/gfx-vulkan/VKDevice.h", - "cocos/renderer/gfx-vulkan/VKFence.cpp", - "cocos/renderer/gfx-vulkan/VKFence.h", "cocos/renderer/gfx-vulkan/VKFramebuffer.cpp", "cocos/renderer/gfx-vulkan/VKFramebuffer.h", "cocos/renderer/gfx-vulkan/VKGPUObjects.h", + "cocos/renderer/gfx-vulkan/VKGlobalBarrier.cpp", + "cocos/renderer/gfx-vulkan/VKGlobalBarrier.h", "cocos/renderer/gfx-vulkan/VKInputAssembler.cpp", "cocos/renderer/gfx-vulkan/VKInputAssembler.h", "cocos/renderer/gfx-vulkan/VKPipelineLayout.cpp", @@ -782,7 +972,11 @@ "cocos/renderer/gfx-vulkan/VKStd.h", "cocos/renderer/gfx-vulkan/VKTexture.cpp", "cocos/renderer/gfx-vulkan/VKTexture.h", + "cocos/renderer/gfx-vulkan/VKTextureBarrier.cpp", + "cocos/renderer/gfx-vulkan/VKTextureBarrier.h", + "cocos/renderer/gfx-vulkan/VKUtils.cpp", "cocos/renderer/gfx-vulkan/VKUtils.h", + "cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h", "cocos/renderer/gfx-vulkan/vk_mem_alloc.h", "cocos/renderer/gfx-vulkan/volk.c", "cocos/renderer/gfx-vulkan/volk.h", @@ -792,8 +986,12 @@ "cocos/renderer/pipeline/Define.h", "cocos/renderer/pipeline/InstancedBuffer.cpp", "cocos/renderer/pipeline/InstancedBuffer.h", + "cocos/renderer/pipeline/PipelineSceneData.cpp", + "cocos/renderer/pipeline/PipelineSceneData.h", "cocos/renderer/pipeline/PipelineStateManager.cpp", "cocos/renderer/pipeline/PipelineStateManager.h", + "cocos/renderer/pipeline/PipelineUBO.cpp", + "cocos/renderer/pipeline/PipelineUBO.h", "cocos/renderer/pipeline/PlanarShadowQueue.cpp", "cocos/renderer/pipeline/PlanarShadowQueue.h", "cocos/renderer/pipeline/RenderAdditiveLightQueue.cpp", @@ -810,16 +1008,28 @@ "cocos/renderer/pipeline/RenderQueue.h", "cocos/renderer/pipeline/RenderStage.cpp", "cocos/renderer/pipeline/RenderStage.h", + "cocos/renderer/pipeline/SceneCulling.cpp", + "cocos/renderer/pipeline/SceneCulling.h", "cocos/renderer/pipeline/ShadowMapBatchedQueue.cpp", "cocos/renderer/pipeline/ShadowMapBatchedQueue.h", + "cocos/renderer/pipeline/deferred/DeferredPipeline.cpp", + "cocos/renderer/pipeline/deferred/DeferredPipeline.h", + "cocos/renderer/pipeline/deferred/GbufferFlow.cpp", + "cocos/renderer/pipeline/deferred/GbufferFlow.h", + "cocos/renderer/pipeline/deferred/GbufferStage.cpp", + "cocos/renderer/pipeline/deferred/GbufferStage.h", + "cocos/renderer/pipeline/deferred/LightingFlow.cpp", + "cocos/renderer/pipeline/deferred/LightingFlow.h", + "cocos/renderer/pipeline/deferred/LightingStage.cpp", + "cocos/renderer/pipeline/deferred/LightingStage.h", + "cocos/renderer/pipeline/deferred/PostprocessStage.cpp", + "cocos/renderer/pipeline/deferred/PostprocessStage.h", "cocos/renderer/pipeline/forward/ForwardFlow.cpp", "cocos/renderer/pipeline/forward/ForwardFlow.h", "cocos/renderer/pipeline/forward/ForwardPipeline.cpp", "cocos/renderer/pipeline/forward/ForwardPipeline.h", "cocos/renderer/pipeline/forward/ForwardStage.cpp", "cocos/renderer/pipeline/forward/ForwardStage.h", - "cocos/renderer/pipeline/forward/SceneCulling.cpp", - "cocos/renderer/pipeline/forward/SceneCulling.h", "cocos/renderer/pipeline/forward/UIPhase.cpp", "cocos/renderer/pipeline/forward/UIPhase.h", "cocos/renderer/pipeline/helper/DefineMap.cpp", @@ -847,6 +1057,22 @@ "cocos/ui/webview/WebViewImpl-android.h", "cocos/ui/webview/WebViewImpl-ios.h", "cocos/ui/webview/WebViewImpl-ios.mm", + "docs/CODING_STYLE.md", + "docs/LINTER_AUTOFIX_GUIDE.md", + "docs/imgs/LLVM.png", + "docs/imgs/NDK.png", + "docs/imgs/auto-fix.gif", + "docs/imgs/auto-format.gif", + "docs/imgs/clangd.png", + "docs/imgs/command-runner.png", + "docs/imgs/compile_commands.png", + "docs/imgs/extensions.png", + "docs/imgs/format.png", + "docs/imgs/re-lint.png", + "docs/imgs/tidy-options.png", + "docs/imgs/tidy-output-editor.png", + "docs/imgs/tidy-output-error.png", + "docs/imgs/tidy-output.png", "extensions/ExtensionExport.h", "extensions/ExtensionMacros.h", "extensions/assets-manager/AssetsManagerEx.cpp", @@ -860,6 +1086,14 @@ "extensions/cocos-ext.h", "external/CMakeLists.txt", "external/android/CMakeLists.txt", + "external/android/arm64-v8a/PhysX/libPhysXCharacterKinematic_static.a", + "external/android/arm64-v8a/PhysX/libPhysXCommon_static.a", + "external/android/arm64-v8a/PhysX/libPhysXCooking_static.a", + "external/android/arm64-v8a/PhysX/libPhysXExtensions_static.a", + "external/android/arm64-v8a/PhysX/libPhysXFoundation_static.a", + "external/android/arm64-v8a/PhysX/libPhysXPvdSDK_static.a", + "external/android/arm64-v8a/PhysX/libPhysXVehicle_static.a", + "external/android/arm64-v8a/PhysX/libPhysX_static.a", "external/android/arm64-v8a/glslang/libOGLCompiler.a", "external/android/arm64-v8a/glslang/libOSDependent.a", "external/android/arm64-v8a/glslang/libSPIRV.a", @@ -975,36 +1209,52 @@ "external/android/arm64-v8a/include/openssl/aes.h", "external/android/arm64-v8a/include/openssl/asn1.h", "external/android/arm64-v8a/include/openssl/asn1_mac.h", + "external/android/arm64-v8a/include/openssl/asn1err.h", "external/android/arm64-v8a/include/openssl/asn1t.h", "external/android/arm64-v8a/include/openssl/async.h", + "external/android/arm64-v8a/include/openssl/asyncerr.h", "external/android/arm64-v8a/include/openssl/bio.h", + "external/android/arm64-v8a/include/openssl/bioerr.h", "external/android/arm64-v8a/include/openssl/blowfish.h", "external/android/arm64-v8a/include/openssl/bn.h", + "external/android/arm64-v8a/include/openssl/bnerr.h", "external/android/arm64-v8a/include/openssl/buffer.h", + "external/android/arm64-v8a/include/openssl/buffererr.h", "external/android/arm64-v8a/include/openssl/camellia.h", "external/android/arm64-v8a/include/openssl/cast.h", "external/android/arm64-v8a/include/openssl/cmac.h", "external/android/arm64-v8a/include/openssl/cms.h", + "external/android/arm64-v8a/include/openssl/cmserr.h", "external/android/arm64-v8a/include/openssl/comp.h", + "external/android/arm64-v8a/include/openssl/comperr.h", "external/android/arm64-v8a/include/openssl/conf.h", "external/android/arm64-v8a/include/openssl/conf_api.h", + "external/android/arm64-v8a/include/openssl/conferr.h", "external/android/arm64-v8a/include/openssl/crypto.h", + "external/android/arm64-v8a/include/openssl/cryptoerr.h", "external/android/arm64-v8a/include/openssl/ct.h", + "external/android/arm64-v8a/include/openssl/cterr.h", "external/android/arm64-v8a/include/openssl/des.h", "external/android/arm64-v8a/include/openssl/dh.h", + "external/android/arm64-v8a/include/openssl/dherr.h", "external/android/arm64-v8a/include/openssl/dsa.h", + "external/android/arm64-v8a/include/openssl/dsaerr.h", "external/android/arm64-v8a/include/openssl/dtls1.h", "external/android/arm64-v8a/include/openssl/e_os2.h", "external/android/arm64-v8a/include/openssl/ebcdic.h", "external/android/arm64-v8a/include/openssl/ec.h", "external/android/arm64-v8a/include/openssl/ecdh.h", "external/android/arm64-v8a/include/openssl/ecdsa.h", + "external/android/arm64-v8a/include/openssl/ecerr.h", "external/android/arm64-v8a/include/openssl/engine.h", + "external/android/arm64-v8a/include/openssl/engineerr.h", "external/android/arm64-v8a/include/openssl/err.h", "external/android/arm64-v8a/include/openssl/evp.h", + "external/android/arm64-v8a/include/openssl/evperr.h", "external/android/arm64-v8a/include/openssl/hmac.h", "external/android/arm64-v8a/include/openssl/idea.h", "external/android/arm64-v8a/include/openssl/kdf.h", + "external/android/arm64-v8a/include/openssl/kdferr.h", "external/android/arm64-v8a/include/openssl/lhash.h", "external/android/arm64-v8a/include/openssl/md2.h", "external/android/arm64-v8a/include/openssl/md4.h", @@ -1013,23 +1263,28 @@ "external/android/arm64-v8a/include/openssl/modes.h", "external/android/arm64-v8a/include/openssl/obj_mac.h", "external/android/arm64-v8a/include/openssl/objects.h", + "external/android/arm64-v8a/include/openssl/objectserr.h", "external/android/arm64-v8a/include/openssl/ocsp.h", - "external/android/arm64-v8a/include/openssl/opensslconf-arm32.h", - "external/android/arm64-v8a/include/openssl/opensslconf-arm64.h", - "external/android/arm64-v8a/include/openssl/opensslconf-x86.h", + "external/android/arm64-v8a/include/openssl/ocsperr.h", "external/android/arm64-v8a/include/openssl/opensslconf.h", "external/android/arm64-v8a/include/openssl/opensslv.h", "external/android/arm64-v8a/include/openssl/ossl_typ.h", "external/android/arm64-v8a/include/openssl/pem.h", "external/android/arm64-v8a/include/openssl/pem2.h", + "external/android/arm64-v8a/include/openssl/pemerr.h", "external/android/arm64-v8a/include/openssl/pkcs12.h", + "external/android/arm64-v8a/include/openssl/pkcs12err.h", "external/android/arm64-v8a/include/openssl/pkcs7.h", + "external/android/arm64-v8a/include/openssl/pkcs7err.h", "external/android/arm64-v8a/include/openssl/rand.h", + "external/android/arm64-v8a/include/openssl/rand_drbg.h", + "external/android/arm64-v8a/include/openssl/randerr.h", "external/android/arm64-v8a/include/openssl/rc2.h", "external/android/arm64-v8a/include/openssl/rc4.h", "external/android/arm64-v8a/include/openssl/rc5.h", "external/android/arm64-v8a/include/openssl/ripemd.h", "external/android/arm64-v8a/include/openssl/rsa.h", + "external/android/arm64-v8a/include/openssl/rsaerr.h", "external/android/arm64-v8a/include/openssl/safestack.h", "external/android/arm64-v8a/include/openssl/seed.h", "external/android/arm64-v8a/include/openssl/sha.h", @@ -1038,16 +1293,23 @@ "external/android/arm64-v8a/include/openssl/ssl.h", "external/android/arm64-v8a/include/openssl/ssl2.h", "external/android/arm64-v8a/include/openssl/ssl3.h", + "external/android/arm64-v8a/include/openssl/sslerr.h", "external/android/arm64-v8a/include/openssl/stack.h", + "external/android/arm64-v8a/include/openssl/store.h", + "external/android/arm64-v8a/include/openssl/storeerr.h", "external/android/arm64-v8a/include/openssl/symhacks.h", "external/android/arm64-v8a/include/openssl/tls1.h", "external/android/arm64-v8a/include/openssl/ts.h", + "external/android/arm64-v8a/include/openssl/tserr.h", "external/android/arm64-v8a/include/openssl/txt_db.h", "external/android/arm64-v8a/include/openssl/ui.h", + "external/android/arm64-v8a/include/openssl/uierr.h", "external/android/arm64-v8a/include/openssl/whrlpool.h", "external/android/arm64-v8a/include/openssl/x509.h", "external/android/arm64-v8a/include/openssl/x509_vfy.h", + "external/android/arm64-v8a/include/openssl/x509err.h", "external/android/arm64-v8a/include/openssl/x509v3.h", + "external/android/arm64-v8a/include/openssl/x509v3err.h", "external/android/arm64-v8a/include/png/png.h", "external/android/arm64-v8a/include/png/pngconf.h", "external/android/arm64-v8a/include/png/pnglibconf.h", @@ -1100,12 +1362,23 @@ "external/android/arm64-v8a/libjpeg.a", "external/android/arm64-v8a/libpng.a", "external/android/arm64-v8a/libssl.a", + "external/android/arm64-v8a/libtbb_static.a", + "external/android/arm64-v8a/libtbbmalloc_proxy_static.a", + "external/android/arm64-v8a/libtbbmalloc_static.a", "external/android/arm64-v8a/libuv.a", "external/android/arm64-v8a/libwebp.a", "external/android/arm64-v8a/libwebsockets.a", "external/android/arm64-v8a/libz.a", "external/android/arm64-v8a/v8/libinspector.a", "external/android/arm64-v8a/v8/libv8_monolith.a", + "external/android/armeabi-v7a/PhysX/libPhysXCharacterKinematic_static.a", + "external/android/armeabi-v7a/PhysX/libPhysXCommon_static.a", + "external/android/armeabi-v7a/PhysX/libPhysXCooking_static.a", + "external/android/armeabi-v7a/PhysX/libPhysXExtensions_static.a", + "external/android/armeabi-v7a/PhysX/libPhysXFoundation_static.a", + "external/android/armeabi-v7a/PhysX/libPhysXPvdSDK_static.a", + "external/android/armeabi-v7a/PhysX/libPhysXVehicle_static.a", + "external/android/armeabi-v7a/PhysX/libPhysX_static.a", "external/android/armeabi-v7a/glslang/libOGLCompiler.a", "external/android/armeabi-v7a/glslang/libOSDependent.a", "external/android/armeabi-v7a/glslang/libSPIRV.a", @@ -1238,36 +1511,52 @@ "external/android/armeabi-v7a/include/openssl/aes.h", "external/android/armeabi-v7a/include/openssl/asn1.h", "external/android/armeabi-v7a/include/openssl/asn1_mac.h", + "external/android/armeabi-v7a/include/openssl/asn1err.h", "external/android/armeabi-v7a/include/openssl/asn1t.h", "external/android/armeabi-v7a/include/openssl/async.h", + "external/android/armeabi-v7a/include/openssl/asyncerr.h", "external/android/armeabi-v7a/include/openssl/bio.h", + "external/android/armeabi-v7a/include/openssl/bioerr.h", "external/android/armeabi-v7a/include/openssl/blowfish.h", "external/android/armeabi-v7a/include/openssl/bn.h", + "external/android/armeabi-v7a/include/openssl/bnerr.h", "external/android/armeabi-v7a/include/openssl/buffer.h", + "external/android/armeabi-v7a/include/openssl/buffererr.h", "external/android/armeabi-v7a/include/openssl/camellia.h", "external/android/armeabi-v7a/include/openssl/cast.h", "external/android/armeabi-v7a/include/openssl/cmac.h", "external/android/armeabi-v7a/include/openssl/cms.h", + "external/android/armeabi-v7a/include/openssl/cmserr.h", "external/android/armeabi-v7a/include/openssl/comp.h", + "external/android/armeabi-v7a/include/openssl/comperr.h", "external/android/armeabi-v7a/include/openssl/conf.h", "external/android/armeabi-v7a/include/openssl/conf_api.h", + "external/android/armeabi-v7a/include/openssl/conferr.h", "external/android/armeabi-v7a/include/openssl/crypto.h", + "external/android/armeabi-v7a/include/openssl/cryptoerr.h", "external/android/armeabi-v7a/include/openssl/ct.h", + "external/android/armeabi-v7a/include/openssl/cterr.h", "external/android/armeabi-v7a/include/openssl/des.h", "external/android/armeabi-v7a/include/openssl/dh.h", + "external/android/armeabi-v7a/include/openssl/dherr.h", "external/android/armeabi-v7a/include/openssl/dsa.h", + "external/android/armeabi-v7a/include/openssl/dsaerr.h", "external/android/armeabi-v7a/include/openssl/dtls1.h", "external/android/armeabi-v7a/include/openssl/e_os2.h", "external/android/armeabi-v7a/include/openssl/ebcdic.h", "external/android/armeabi-v7a/include/openssl/ec.h", "external/android/armeabi-v7a/include/openssl/ecdh.h", "external/android/armeabi-v7a/include/openssl/ecdsa.h", + "external/android/armeabi-v7a/include/openssl/ecerr.h", "external/android/armeabi-v7a/include/openssl/engine.h", + "external/android/armeabi-v7a/include/openssl/engineerr.h", "external/android/armeabi-v7a/include/openssl/err.h", "external/android/armeabi-v7a/include/openssl/evp.h", + "external/android/armeabi-v7a/include/openssl/evperr.h", "external/android/armeabi-v7a/include/openssl/hmac.h", "external/android/armeabi-v7a/include/openssl/idea.h", "external/android/armeabi-v7a/include/openssl/kdf.h", + "external/android/armeabi-v7a/include/openssl/kdferr.h", "external/android/armeabi-v7a/include/openssl/lhash.h", "external/android/armeabi-v7a/include/openssl/md2.h", "external/android/armeabi-v7a/include/openssl/md4.h", @@ -1276,23 +1565,28 @@ "external/android/armeabi-v7a/include/openssl/modes.h", "external/android/armeabi-v7a/include/openssl/obj_mac.h", "external/android/armeabi-v7a/include/openssl/objects.h", + "external/android/armeabi-v7a/include/openssl/objectserr.h", "external/android/armeabi-v7a/include/openssl/ocsp.h", - "external/android/armeabi-v7a/include/openssl/opensslconf-arm32.h", - "external/android/armeabi-v7a/include/openssl/opensslconf-arm64.h", - "external/android/armeabi-v7a/include/openssl/opensslconf-x86.h", + "external/android/armeabi-v7a/include/openssl/ocsperr.h", "external/android/armeabi-v7a/include/openssl/opensslconf.h", "external/android/armeabi-v7a/include/openssl/opensslv.h", "external/android/armeabi-v7a/include/openssl/ossl_typ.h", "external/android/armeabi-v7a/include/openssl/pem.h", "external/android/armeabi-v7a/include/openssl/pem2.h", + "external/android/armeabi-v7a/include/openssl/pemerr.h", "external/android/armeabi-v7a/include/openssl/pkcs12.h", + "external/android/armeabi-v7a/include/openssl/pkcs12err.h", "external/android/armeabi-v7a/include/openssl/pkcs7.h", + "external/android/armeabi-v7a/include/openssl/pkcs7err.h", "external/android/armeabi-v7a/include/openssl/rand.h", + "external/android/armeabi-v7a/include/openssl/rand_drbg.h", + "external/android/armeabi-v7a/include/openssl/randerr.h", "external/android/armeabi-v7a/include/openssl/rc2.h", "external/android/armeabi-v7a/include/openssl/rc4.h", "external/android/armeabi-v7a/include/openssl/rc5.h", "external/android/armeabi-v7a/include/openssl/ripemd.h", "external/android/armeabi-v7a/include/openssl/rsa.h", + "external/android/armeabi-v7a/include/openssl/rsaerr.h", "external/android/armeabi-v7a/include/openssl/safestack.h", "external/android/armeabi-v7a/include/openssl/seed.h", "external/android/armeabi-v7a/include/openssl/sha.h", @@ -1301,16 +1595,23 @@ "external/android/armeabi-v7a/include/openssl/ssl.h", "external/android/armeabi-v7a/include/openssl/ssl2.h", "external/android/armeabi-v7a/include/openssl/ssl3.h", + "external/android/armeabi-v7a/include/openssl/sslerr.h", "external/android/armeabi-v7a/include/openssl/stack.h", + "external/android/armeabi-v7a/include/openssl/store.h", + "external/android/armeabi-v7a/include/openssl/storeerr.h", "external/android/armeabi-v7a/include/openssl/symhacks.h", "external/android/armeabi-v7a/include/openssl/tls1.h", "external/android/armeabi-v7a/include/openssl/ts.h", + "external/android/armeabi-v7a/include/openssl/tserr.h", "external/android/armeabi-v7a/include/openssl/txt_db.h", "external/android/armeabi-v7a/include/openssl/ui.h", + "external/android/armeabi-v7a/include/openssl/uierr.h", "external/android/armeabi-v7a/include/openssl/whrlpool.h", "external/android/armeabi-v7a/include/openssl/x509.h", "external/android/armeabi-v7a/include/openssl/x509_vfy.h", + "external/android/armeabi-v7a/include/openssl/x509err.h", "external/android/armeabi-v7a/include/openssl/x509v3.h", + "external/android/armeabi-v7a/include/openssl/x509v3err.h", "external/android/armeabi-v7a/include/png/png.h", "external/android/armeabi-v7a/include/png/pngconf.h", "external/android/armeabi-v7a/include/png/pnglibconf.h", @@ -1363,6 +1664,9 @@ "external/android/armeabi-v7a/libjpeg.a", "external/android/armeabi-v7a/libpng.a", "external/android/armeabi-v7a/libssl.a", + "external/android/armeabi-v7a/libtbb_static.a", + "external/android/armeabi-v7a/libtbbmalloc_proxy_static.a", + "external/android/armeabi-v7a/libtbbmalloc_static.a", "external/android/armeabi-v7a/libuv.a", "external/android/armeabi-v7a/libwebp.a", "external/android/armeabi-v7a/libwebsockets.a", @@ -1501,36 +1805,52 @@ "external/android/x86/include/openssl/aes.h", "external/android/x86/include/openssl/asn1.h", "external/android/x86/include/openssl/asn1_mac.h", + "external/android/x86/include/openssl/asn1err.h", "external/android/x86/include/openssl/asn1t.h", "external/android/x86/include/openssl/async.h", + "external/android/x86/include/openssl/asyncerr.h", "external/android/x86/include/openssl/bio.h", + "external/android/x86/include/openssl/bioerr.h", "external/android/x86/include/openssl/blowfish.h", "external/android/x86/include/openssl/bn.h", + "external/android/x86/include/openssl/bnerr.h", "external/android/x86/include/openssl/buffer.h", + "external/android/x86/include/openssl/buffererr.h", "external/android/x86/include/openssl/camellia.h", "external/android/x86/include/openssl/cast.h", "external/android/x86/include/openssl/cmac.h", "external/android/x86/include/openssl/cms.h", + "external/android/x86/include/openssl/cmserr.h", "external/android/x86/include/openssl/comp.h", + "external/android/x86/include/openssl/comperr.h", "external/android/x86/include/openssl/conf.h", "external/android/x86/include/openssl/conf_api.h", + "external/android/x86/include/openssl/conferr.h", "external/android/x86/include/openssl/crypto.h", + "external/android/x86/include/openssl/cryptoerr.h", "external/android/x86/include/openssl/ct.h", + "external/android/x86/include/openssl/cterr.h", "external/android/x86/include/openssl/des.h", "external/android/x86/include/openssl/dh.h", + "external/android/x86/include/openssl/dherr.h", "external/android/x86/include/openssl/dsa.h", + "external/android/x86/include/openssl/dsaerr.h", "external/android/x86/include/openssl/dtls1.h", "external/android/x86/include/openssl/e_os2.h", "external/android/x86/include/openssl/ebcdic.h", "external/android/x86/include/openssl/ec.h", "external/android/x86/include/openssl/ecdh.h", "external/android/x86/include/openssl/ecdsa.h", + "external/android/x86/include/openssl/ecerr.h", "external/android/x86/include/openssl/engine.h", + "external/android/x86/include/openssl/engineerr.h", "external/android/x86/include/openssl/err.h", "external/android/x86/include/openssl/evp.h", + "external/android/x86/include/openssl/evperr.h", "external/android/x86/include/openssl/hmac.h", "external/android/x86/include/openssl/idea.h", "external/android/x86/include/openssl/kdf.h", + "external/android/x86/include/openssl/kdferr.h", "external/android/x86/include/openssl/lhash.h", "external/android/x86/include/openssl/md2.h", "external/android/x86/include/openssl/md4.h", @@ -1539,23 +1859,28 @@ "external/android/x86/include/openssl/modes.h", "external/android/x86/include/openssl/obj_mac.h", "external/android/x86/include/openssl/objects.h", + "external/android/x86/include/openssl/objectserr.h", "external/android/x86/include/openssl/ocsp.h", - "external/android/x86/include/openssl/opensslconf-arm32.h", - "external/android/x86/include/openssl/opensslconf-arm64.h", - "external/android/x86/include/openssl/opensslconf-x86.h", + "external/android/x86/include/openssl/ocsperr.h", "external/android/x86/include/openssl/opensslconf.h", "external/android/x86/include/openssl/opensslv.h", "external/android/x86/include/openssl/ossl_typ.h", "external/android/x86/include/openssl/pem.h", "external/android/x86/include/openssl/pem2.h", + "external/android/x86/include/openssl/pemerr.h", "external/android/x86/include/openssl/pkcs12.h", + "external/android/x86/include/openssl/pkcs12err.h", "external/android/x86/include/openssl/pkcs7.h", + "external/android/x86/include/openssl/pkcs7err.h", "external/android/x86/include/openssl/rand.h", + "external/android/x86/include/openssl/rand_drbg.h", + "external/android/x86/include/openssl/randerr.h", "external/android/x86/include/openssl/rc2.h", "external/android/x86/include/openssl/rc4.h", "external/android/x86/include/openssl/rc5.h", "external/android/x86/include/openssl/ripemd.h", "external/android/x86/include/openssl/rsa.h", + "external/android/x86/include/openssl/rsaerr.h", "external/android/x86/include/openssl/safestack.h", "external/android/x86/include/openssl/seed.h", "external/android/x86/include/openssl/sha.h", @@ -1564,16 +1889,23 @@ "external/android/x86/include/openssl/ssl.h", "external/android/x86/include/openssl/ssl2.h", "external/android/x86/include/openssl/ssl3.h", + "external/android/x86/include/openssl/sslerr.h", "external/android/x86/include/openssl/stack.h", + "external/android/x86/include/openssl/store.h", + "external/android/x86/include/openssl/storeerr.h", "external/android/x86/include/openssl/symhacks.h", "external/android/x86/include/openssl/tls1.h", "external/android/x86/include/openssl/ts.h", + "external/android/x86/include/openssl/tserr.h", "external/android/x86/include/openssl/txt_db.h", "external/android/x86/include/openssl/ui.h", + "external/android/x86/include/openssl/uierr.h", "external/android/x86/include/openssl/whrlpool.h", "external/android/x86/include/openssl/x509.h", "external/android/x86/include/openssl/x509_vfy.h", + "external/android/x86/include/openssl/x509err.h", "external/android/x86/include/openssl/x509v3.h", + "external/android/x86/include/openssl/x509v3err.h", "external/android/x86/include/png/png.h", "external/android/x86/include/png/pngconf.h", "external/android/x86/include/png/pnglibconf.h", @@ -1626,12 +1958,325 @@ "external/android/x86/libjpeg.a", "external/android/x86/libpng.a", "external/android/x86/libssl.a", + "external/android/x86/libtbb_static.a", + "external/android/x86/libtbbmalloc_proxy_static.a", + "external/android/x86/libtbbmalloc_static.a", "external/android/x86/libuv.a", "external/android/x86/libwebp.a", "external/android/x86/libwebsockets.a", "external/android/x86/libz.a", "external/android/x86/v8/libinspector.a", "external/android/x86/v8/libv8_monolith.a", + "external/android/x86_64/PhysX/libPhysXCharacterKinematic_static.a", + "external/android/x86_64/PhysX/libPhysXCommon_static.a", + "external/android/x86_64/PhysX/libPhysXCooking_static.a", + "external/android/x86_64/PhysX/libPhysXExtensions_static.a", + "external/android/x86_64/PhysX/libPhysXFoundation_static.a", + "external/android/x86_64/PhysX/libPhysXPvdSDK_static.a", + "external/android/x86_64/PhysX/libPhysXVehicle_static.a", + "external/android/x86_64/PhysX/libPhysX_static.a", + "external/android/x86_64/glslang/libOGLCompiler.a", + "external/android/x86_64/glslang/libOSDependent.a", + "external/android/x86_64/glslang/libSPIRV.a", + "external/android/x86_64/glslang/libglslang-default-resource-limits.a", + "external/android/x86_64/glslang/libglslang.a", + "external/android/x86_64/include/SPIRV/GLSL.ext.AMD.h", + "external/android/x86_64/include/SPIRV/GLSL.ext.EXT.h", + "external/android/x86_64/include/SPIRV/GLSL.ext.KHR.h", + "external/android/x86_64/include/SPIRV/GLSL.ext.NV.h", + "external/android/x86_64/include/SPIRV/GLSL.std.450.h", + "external/android/x86_64/include/SPIRV/GlslangToSpv.h", + "external/android/x86_64/include/SPIRV/Logger.h", + "external/android/x86_64/include/SPIRV/NonSemanticDebugPrintf.h", + "external/android/x86_64/include/SPIRV/SPVRemapper.h", + "external/android/x86_64/include/SPIRV/SpvBuilder.h", + "external/android/x86_64/include/SPIRV/SpvTools.h", + "external/android/x86_64/include/SPIRV/bitutils.h", + "external/android/x86_64/include/SPIRV/disassemble.h", + "external/android/x86_64/include/SPIRV/doc.h", + "external/android/x86_64/include/SPIRV/hex_float.h", + "external/android/x86_64/include/SPIRV/spirv.hpp", + "external/android/x86_64/include/SPIRV/spvIR.h", + "external/android/x86_64/include/StandAlone/DirStackFileIncluder.h", + "external/android/x86_64/include/StandAlone/ResourceLimits.h", + "external/android/x86_64/include/StandAlone/Worklist.h", + "external/android/x86_64/include/StandAlone/resource_limits_c.h", + "external/android/x86_64/include/freetype/config/ftconfig.h", + "external/android/x86_64/include/freetype/config/ftheader.h", + "external/android/x86_64/include/freetype/config/ftmodule.h", + "external/android/x86_64/include/freetype/config/ftoption.h", + "external/android/x86_64/include/freetype/config/ftstdlib.h", + "external/android/x86_64/include/freetype/freetype.h", + "external/android/x86_64/include/freetype/ftadvanc.h", + "external/android/x86_64/include/freetype/ftautoh.h", + "external/android/x86_64/include/freetype/ftbbox.h", + "external/android/x86_64/include/freetype/ftbdf.h", + "external/android/x86_64/include/freetype/ftbitmap.h", + "external/android/x86_64/include/freetype/ftbzip2.h", + "external/android/x86_64/include/freetype/ftcache.h", + "external/android/x86_64/include/freetype/ftcffdrv.h", + "external/android/x86_64/include/freetype/ftchapters.h", + "external/android/x86_64/include/freetype/ftcid.h", + "external/android/x86_64/include/freetype/fterrdef.h", + "external/android/x86_64/include/freetype/fterrors.h", + "external/android/x86_64/include/freetype/ftfntfmt.h", + "external/android/x86_64/include/freetype/ftgasp.h", + "external/android/x86_64/include/freetype/ftglyph.h", + "external/android/x86_64/include/freetype/ftgxval.h", + "external/android/x86_64/include/freetype/ftgzip.h", + "external/android/x86_64/include/freetype/ftimage.h", + "external/android/x86_64/include/freetype/ftincrem.h", + "external/android/x86_64/include/freetype/ftlcdfil.h", + "external/android/x86_64/include/freetype/ftlist.h", + "external/android/x86_64/include/freetype/ftlzw.h", + "external/android/x86_64/include/freetype/ftmac.h", + "external/android/x86_64/include/freetype/ftmm.h", + "external/android/x86_64/include/freetype/ftmodapi.h", + "external/android/x86_64/include/freetype/ftmoderr.h", + "external/android/x86_64/include/freetype/ftotval.h", + "external/android/x86_64/include/freetype/ftoutln.h", + "external/android/x86_64/include/freetype/ftpfr.h", + "external/android/x86_64/include/freetype/ftrender.h", + "external/android/x86_64/include/freetype/ftsizes.h", + "external/android/x86_64/include/freetype/ftsnames.h", + "external/android/x86_64/include/freetype/ftstroke.h", + "external/android/x86_64/include/freetype/ftsynth.h", + "external/android/x86_64/include/freetype/ftsystem.h", + "external/android/x86_64/include/freetype/fttrigon.h", + "external/android/x86_64/include/freetype/ftttdrv.h", + "external/android/x86_64/include/freetype/fttypes.h", + "external/android/x86_64/include/freetype/ftwinfnt.h", + "external/android/x86_64/include/freetype/t1tables.h", + "external/android/x86_64/include/freetype/ttnameid.h", + "external/android/x86_64/include/freetype/tttables.h", + "external/android/x86_64/include/freetype/tttags.h", + "external/android/x86_64/include/freetype/ttunpat.h", + "external/android/x86_64/include/glslang/Include/BaseTypes.h", + "external/android/x86_64/include/glslang/Include/Common.h", + "external/android/x86_64/include/glslang/Include/ConstantUnion.h", + "external/android/x86_64/include/glslang/Include/InfoSink.h", + "external/android/x86_64/include/glslang/Include/InitializeGlobals.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/Initialize.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/LiveTraverser.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/ParseHelper.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/RemoveTree.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/Scan.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/ScanContext.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/SymbolTable.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/Versions.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/attribute.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/gl_types.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/glslang.m4", + "external/android/x86_64/include/glslang/Include/MachineIndependent/glslang.y", + "external/android/x86_64/include/glslang/Include/MachineIndependent/glslang_tab.cpp.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/iomapper.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/localintermediate.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/parseVersions.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/pch.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/preprocessor/PpContext.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/preprocessor/PpTokens.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/propagateNoContraction.h", + "external/android/x86_64/include/glslang/Include/MachineIndependent/reflection.h", + "external/android/x86_64/include/glslang/Include/PoolAlloc.h", + "external/android/x86_64/include/glslang/Include/Public/ShaderLang.h", + "external/android/x86_64/include/glslang/Include/ResourceLimits.h", + "external/android/x86_64/include/glslang/Include/ShHandle.h", + "external/android/x86_64/include/glslang/Include/Types.h", + "external/android/x86_64/include/glslang/Include/arrays.h", + "external/android/x86_64/include/glslang/Include/glslang_c_interface.h", + "external/android/x86_64/include/glslang/Include/glslang_c_shader_types.h", + "external/android/x86_64/include/glslang/Include/intermediate.h", + "external/android/x86_64/include/glslang/MachineIndependent/Initialize.h", + "external/android/x86_64/include/glslang/MachineIndependent/LiveTraverser.h", + "external/android/x86_64/include/glslang/MachineIndependent/ParseHelper.h", + "external/android/x86_64/include/glslang/MachineIndependent/RemoveTree.h", + "external/android/x86_64/include/glslang/MachineIndependent/Scan.h", + "external/android/x86_64/include/glslang/MachineIndependent/ScanContext.h", + "external/android/x86_64/include/glslang/MachineIndependent/SymbolTable.h", + "external/android/x86_64/include/glslang/MachineIndependent/Versions.h", + "external/android/x86_64/include/glslang/MachineIndependent/attribute.h", + "external/android/x86_64/include/glslang/MachineIndependent/gl_types.h", + "external/android/x86_64/include/glslang/MachineIndependent/glslang.m4", + "external/android/x86_64/include/glslang/MachineIndependent/glslang.y", + "external/android/x86_64/include/glslang/MachineIndependent/glslang_tab.cpp.h", + "external/android/x86_64/include/glslang/MachineIndependent/iomapper.h", + "external/android/x86_64/include/glslang/MachineIndependent/localintermediate.h", + "external/android/x86_64/include/glslang/MachineIndependent/parseVersions.h", + "external/android/x86_64/include/glslang/MachineIndependent/pch.h", + "external/android/x86_64/include/glslang/MachineIndependent/preprocessor/PpContext.h", + "external/android/x86_64/include/glslang/MachineIndependent/preprocessor/PpTokens.h", + "external/android/x86_64/include/glslang/MachineIndependent/propagateNoContraction.h", + "external/android/x86_64/include/glslang/MachineIndependent/reflection.h", + "external/android/x86_64/include/glslang/Public/ShaderLang.h", + "external/android/x86_64/include/jpeg/jconfig.h", + "external/android/x86_64/include/jpeg/jerror.h", + "external/android/x86_64/include/jpeg/jmorecfg.h", + "external/android/x86_64/include/jpeg/jpeglib.h", + "external/android/x86_64/include/openssl/aes.h", + "external/android/x86_64/include/openssl/asn1.h", + "external/android/x86_64/include/openssl/asn1_mac.h", + "external/android/x86_64/include/openssl/asn1err.h", + "external/android/x86_64/include/openssl/asn1t.h", + "external/android/x86_64/include/openssl/async.h", + "external/android/x86_64/include/openssl/asyncerr.h", + "external/android/x86_64/include/openssl/bio.h", + "external/android/x86_64/include/openssl/bioerr.h", + "external/android/x86_64/include/openssl/blowfish.h", + "external/android/x86_64/include/openssl/bn.h", + "external/android/x86_64/include/openssl/bnerr.h", + "external/android/x86_64/include/openssl/buffer.h", + "external/android/x86_64/include/openssl/buffererr.h", + "external/android/x86_64/include/openssl/camellia.h", + "external/android/x86_64/include/openssl/cast.h", + "external/android/x86_64/include/openssl/cmac.h", + "external/android/x86_64/include/openssl/cms.h", + "external/android/x86_64/include/openssl/cmserr.h", + "external/android/x86_64/include/openssl/comp.h", + "external/android/x86_64/include/openssl/comperr.h", + "external/android/x86_64/include/openssl/conf.h", + "external/android/x86_64/include/openssl/conf_api.h", + "external/android/x86_64/include/openssl/conferr.h", + "external/android/x86_64/include/openssl/crypto.h", + "external/android/x86_64/include/openssl/cryptoerr.h", + "external/android/x86_64/include/openssl/ct.h", + "external/android/x86_64/include/openssl/cterr.h", + "external/android/x86_64/include/openssl/des.h", + "external/android/x86_64/include/openssl/dh.h", + "external/android/x86_64/include/openssl/dherr.h", + "external/android/x86_64/include/openssl/dsa.h", + "external/android/x86_64/include/openssl/dsaerr.h", + "external/android/x86_64/include/openssl/dtls1.h", + "external/android/x86_64/include/openssl/e_os2.h", + "external/android/x86_64/include/openssl/ebcdic.h", + "external/android/x86_64/include/openssl/ec.h", + "external/android/x86_64/include/openssl/ecdh.h", + "external/android/x86_64/include/openssl/ecdsa.h", + "external/android/x86_64/include/openssl/ecerr.h", + "external/android/x86_64/include/openssl/engine.h", + "external/android/x86_64/include/openssl/engineerr.h", + "external/android/x86_64/include/openssl/err.h", + "external/android/x86_64/include/openssl/evp.h", + "external/android/x86_64/include/openssl/evperr.h", + "external/android/x86_64/include/openssl/hmac.h", + "external/android/x86_64/include/openssl/idea.h", + "external/android/x86_64/include/openssl/kdf.h", + "external/android/x86_64/include/openssl/kdferr.h", + "external/android/x86_64/include/openssl/lhash.h", + "external/android/x86_64/include/openssl/md2.h", + "external/android/x86_64/include/openssl/md4.h", + "external/android/x86_64/include/openssl/md5.h", + "external/android/x86_64/include/openssl/mdc2.h", + "external/android/x86_64/include/openssl/modes.h", + "external/android/x86_64/include/openssl/obj_mac.h", + "external/android/x86_64/include/openssl/objects.h", + "external/android/x86_64/include/openssl/objectserr.h", + "external/android/x86_64/include/openssl/ocsp.h", + "external/android/x86_64/include/openssl/ocsperr.h", + "external/android/x86_64/include/openssl/opensslconf.h", + "external/android/x86_64/include/openssl/opensslv.h", + "external/android/x86_64/include/openssl/ossl_typ.h", + "external/android/x86_64/include/openssl/pem.h", + "external/android/x86_64/include/openssl/pem2.h", + "external/android/x86_64/include/openssl/pemerr.h", + "external/android/x86_64/include/openssl/pkcs12.h", + "external/android/x86_64/include/openssl/pkcs12err.h", + "external/android/x86_64/include/openssl/pkcs7.h", + "external/android/x86_64/include/openssl/pkcs7err.h", + "external/android/x86_64/include/openssl/rand.h", + "external/android/x86_64/include/openssl/rand_drbg.h", + "external/android/x86_64/include/openssl/randerr.h", + "external/android/x86_64/include/openssl/rc2.h", + "external/android/x86_64/include/openssl/rc4.h", + "external/android/x86_64/include/openssl/rc5.h", + "external/android/x86_64/include/openssl/ripemd.h", + "external/android/x86_64/include/openssl/rsa.h", + "external/android/x86_64/include/openssl/rsaerr.h", + "external/android/x86_64/include/openssl/safestack.h", + "external/android/x86_64/include/openssl/seed.h", + "external/android/x86_64/include/openssl/sha.h", + "external/android/x86_64/include/openssl/srp.h", + "external/android/x86_64/include/openssl/srtp.h", + "external/android/x86_64/include/openssl/ssl.h", + "external/android/x86_64/include/openssl/ssl2.h", + "external/android/x86_64/include/openssl/ssl3.h", + "external/android/x86_64/include/openssl/sslerr.h", + "external/android/x86_64/include/openssl/stack.h", + "external/android/x86_64/include/openssl/store.h", + "external/android/x86_64/include/openssl/storeerr.h", + "external/android/x86_64/include/openssl/symhacks.h", + "external/android/x86_64/include/openssl/tls1.h", + "external/android/x86_64/include/openssl/ts.h", + "external/android/x86_64/include/openssl/tserr.h", + "external/android/x86_64/include/openssl/txt_db.h", + "external/android/x86_64/include/openssl/ui.h", + "external/android/x86_64/include/openssl/uierr.h", + "external/android/x86_64/include/openssl/whrlpool.h", + "external/android/x86_64/include/openssl/x509.h", + "external/android/x86_64/include/openssl/x509_vfy.h", + "external/android/x86_64/include/openssl/x509err.h", + "external/android/x86_64/include/openssl/x509v3.h", + "external/android/x86_64/include/openssl/x509v3err.h", + "external/android/x86_64/include/png/png.h", + "external/android/x86_64/include/png/pngconf.h", + "external/android/x86_64/include/png/pnglibconf.h", + "external/android/x86_64/include/uv/pthread-barrier.h", + "external/android/x86_64/include/uv/stdint-msvc2008.h", + "external/android/x86_64/include/uv/tree.h", + "external/android/x86_64/include/uv/uv-aix.h", + "external/android/x86_64/include/uv/uv-bsd.h", + "external/android/x86_64/include/uv/uv-darwin.h", + "external/android/x86_64/include/uv/uv-errno.h", + "external/android/x86_64/include/uv/uv-linux.h", + "external/android/x86_64/include/uv/uv-os390.h", + "external/android/x86_64/include/uv/uv-posix.h", + "external/android/x86_64/include/uv/uv-sunos.h", + "external/android/x86_64/include/uv/uv-threadpool.h", + "external/android/x86_64/include/uv/uv-unix.h", + "external/android/x86_64/include/uv/uv-version.h", + "external/android/x86_64/include/uv/uv-win.h", + "external/android/x86_64/include/uv/uv.h", + "external/android/x86_64/include/v8/APIDesign.md", + "external/android/x86_64/include/v8/DEPS", + "external/android/x86_64/include/v8/OWNERS", + "external/android/x86_64/include/v8/libplatform/DEPS", + "external/android/x86_64/include/v8/libplatform/libplatform-export.h", + "external/android/x86_64/include/v8/libplatform/libplatform.h", + "external/android/x86_64/include/v8/libplatform/v8-tracing.h", + "external/android/x86_64/include/v8/v8-inspector-protocol.h", + "external/android/x86_64/include/v8/v8-inspector.h", + "external/android/x86_64/include/v8/v8-internal.h", + "external/android/x86_64/include/v8/v8-platform.h", + "external/android/x86_64/include/v8/v8-profiler.h", + "external/android/x86_64/include/v8/v8-testing.h", + "external/android/x86_64/include/v8/v8-util.h", + "external/android/x86_64/include/v8/v8-value-serializer-version.h", + "external/android/x86_64/include/v8/v8-version-string.h", + "external/android/x86_64/include/v8/v8-version.h", + "external/android/x86_64/include/v8/v8-wasm-trap-handler-posix.h", + "external/android/x86_64/include/v8/v8-wasm-trap-handler-win.h", + "external/android/x86_64/include/v8/v8.h", + "external/android/x86_64/include/v8/v8config.h", + "external/android/x86_64/include/webp/decode.h", + "external/android/x86_64/include/webp/encode.h", + "external/android/x86_64/include/webp/types.h", + "external/android/x86_64/include/websockets/libwebsockets.h", + "external/android/x86_64/include/websockets/lws_config.h", + "external/android/x86_64/include/zlib/zconf.h", + "external/android/x86_64/include/zlib/zlib.h", + "external/android/x86_64/libcrypto.a", + "external/android/x86_64/libfreetype.a", + "external/android/x86_64/libjpeg.a", + "external/android/x86_64/libpng.a", + "external/android/x86_64/libssl.a", + "external/android/x86_64/libtbb_static.a", + "external/android/x86_64/libtbbmalloc_proxy_static.a", + "external/android/x86_64/libtbbmalloc_static.a", + "external/android/x86_64/libuv.a", + "external/android/x86_64/libwebp.a", + "external/android/x86_64/libwebsockets.a", + "external/android/x86_64/libz.a", + "external/android/x86_64/v8/libinspector.a", + "external/android/x86_64/v8/libv8_monolith.a", "external/cmake/CocosExternalConfig.cmake", "external/cmake/scripts/sync_folder.py", "external/ios/CMakeLists.txt", @@ -1745,36 +2390,52 @@ "external/ios/include/openssl/aes.h", "external/ios/include/openssl/asn1.h", "external/ios/include/openssl/asn1_mac.h", + "external/ios/include/openssl/asn1err.h", "external/ios/include/openssl/asn1t.h", "external/ios/include/openssl/async.h", + "external/ios/include/openssl/asyncerr.h", "external/ios/include/openssl/bio.h", + "external/ios/include/openssl/bioerr.h", "external/ios/include/openssl/blowfish.h", "external/ios/include/openssl/bn.h", + "external/ios/include/openssl/bnerr.h", "external/ios/include/openssl/buffer.h", + "external/ios/include/openssl/buffererr.h", "external/ios/include/openssl/camellia.h", "external/ios/include/openssl/cast.h", "external/ios/include/openssl/cmac.h", "external/ios/include/openssl/cms.h", + "external/ios/include/openssl/cmserr.h", "external/ios/include/openssl/comp.h", + "external/ios/include/openssl/comperr.h", "external/ios/include/openssl/conf.h", "external/ios/include/openssl/conf_api.h", + "external/ios/include/openssl/conferr.h", "external/ios/include/openssl/crypto.h", + "external/ios/include/openssl/cryptoerr.h", "external/ios/include/openssl/ct.h", + "external/ios/include/openssl/cterr.h", "external/ios/include/openssl/des.h", "external/ios/include/openssl/dh.h", + "external/ios/include/openssl/dherr.h", "external/ios/include/openssl/dsa.h", + "external/ios/include/openssl/dsaerr.h", "external/ios/include/openssl/dtls1.h", "external/ios/include/openssl/e_os2.h", "external/ios/include/openssl/ebcdic.h", "external/ios/include/openssl/ec.h", "external/ios/include/openssl/ecdh.h", "external/ios/include/openssl/ecdsa.h", + "external/ios/include/openssl/ecerr.h", "external/ios/include/openssl/engine.h", + "external/ios/include/openssl/engineerr.h", "external/ios/include/openssl/err.h", "external/ios/include/openssl/evp.h", + "external/ios/include/openssl/evperr.h", "external/ios/include/openssl/hmac.h", "external/ios/include/openssl/idea.h", "external/ios/include/openssl/kdf.h", + "external/ios/include/openssl/kdferr.h", "external/ios/include/openssl/lhash.h", "external/ios/include/openssl/md2.h", "external/ios/include/openssl/md4.h", @@ -1783,24 +2444,28 @@ "external/ios/include/openssl/modes.h", "external/ios/include/openssl/obj_mac.h", "external/ios/include/openssl/objects.h", + "external/ios/include/openssl/objectserr.h", "external/ios/include/openssl/ocsp.h", - "external/ios/include/openssl/opensslconf-arm32.h", - "external/ios/include/openssl/opensslconf-arm64.h", - "external/ios/include/openssl/opensslconf-i386.h", - "external/ios/include/openssl/opensslconf-x86_64.h", + "external/ios/include/openssl/ocsperr.h", "external/ios/include/openssl/opensslconf.h", "external/ios/include/openssl/opensslv.h", "external/ios/include/openssl/ossl_typ.h", "external/ios/include/openssl/pem.h", "external/ios/include/openssl/pem2.h", + "external/ios/include/openssl/pemerr.h", "external/ios/include/openssl/pkcs12.h", + "external/ios/include/openssl/pkcs12err.h", "external/ios/include/openssl/pkcs7.h", + "external/ios/include/openssl/pkcs7err.h", "external/ios/include/openssl/rand.h", + "external/ios/include/openssl/rand_drbg.h", + "external/ios/include/openssl/randerr.h", "external/ios/include/openssl/rc2.h", "external/ios/include/openssl/rc4.h", "external/ios/include/openssl/rc5.h", "external/ios/include/openssl/ripemd.h", "external/ios/include/openssl/rsa.h", + "external/ios/include/openssl/rsaerr.h", "external/ios/include/openssl/safestack.h", "external/ios/include/openssl/seed.h", "external/ios/include/openssl/sha.h", @@ -1809,36 +2474,37 @@ "external/ios/include/openssl/ssl.h", "external/ios/include/openssl/ssl2.h", "external/ios/include/openssl/ssl3.h", + "external/ios/include/openssl/sslerr.h", "external/ios/include/openssl/stack.h", + "external/ios/include/openssl/store.h", + "external/ios/include/openssl/storeerr.h", "external/ios/include/openssl/symhacks.h", "external/ios/include/openssl/tls1.h", "external/ios/include/openssl/ts.h", + "external/ios/include/openssl/tserr.h", "external/ios/include/openssl/txt_db.h", "external/ios/include/openssl/ui.h", + "external/ios/include/openssl/uierr.h", "external/ios/include/openssl/whrlpool.h", "external/ios/include/openssl/x509.h", "external/ios/include/openssl/x509_vfy.h", + "external/ios/include/openssl/x509err.h", "external/ios/include/openssl/x509v3.h", + "external/ios/include/openssl/x509v3err.h", "external/ios/include/png/png.h", "external/ios/include/png/pngconf.h", "external/ios/include/png/pnglibconf.h", "external/ios/include/spirv_cross/GLSL.std.450.h", - "external/ios/include/spirv_cross/spirv.h", "external/ios/include/spirv_cross/spirv.hpp", "external/ios/include/spirv_cross/spirv_cfg.hpp", "external/ios/include/spirv_cross/spirv_common.hpp", - "external/ios/include/spirv_cross/spirv_cpp.hpp", "external/ios/include/spirv_cross/spirv_cross.hpp", - "external/ios/include/spirv_cross/spirv_cross_c.h", "external/ios/include/spirv_cross/spirv_cross_containers.hpp", "external/ios/include/spirv_cross/spirv_cross_error_handling.hpp", "external/ios/include/spirv_cross/spirv_cross_parsed_ir.hpp", - "external/ios/include/spirv_cross/spirv_cross_util.hpp", "external/ios/include/spirv_cross/spirv_glsl.hpp", - "external/ios/include/spirv_cross/spirv_hlsl.hpp", "external/ios/include/spirv_cross/spirv_msl.hpp", "external/ios/include/spirv_cross/spirv_parser.hpp", - "external/ios/include/spirv_cross/spirv_reflect.hpp", "external/ios/include/uv/uv.h", "external/ios/include/uv/uv/aix.h", "external/ios/include/uv/uv/android-ifaddrs.h", @@ -1882,6 +2548,14 @@ "external/ios/include/websockets/lws_config-i386.h", "external/ios/include/websockets/lws_config-x86_64.h", "external/ios/include/websockets/lws_config.h", + "external/ios/libs/PhysX/libPhysXCharacterKinematic_static_64.a", + "external/ios/libs/PhysX/libPhysXCommon_static_64.a", + "external/ios/libs/PhysX/libPhysXCooking_static_64.a", + "external/ios/libs/PhysX/libPhysXExtensions_static_64.a", + "external/ios/libs/PhysX/libPhysXFoundation_static_64.a", + "external/ios/libs/PhysX/libPhysXPvdSDK_static_64.a", + "external/ios/libs/PhysX/libPhysXVehicle_static_64.a", + "external/ios/libs/PhysX/libPhysX_static_64.a", "external/ios/libs/glslang/libOGLCompiler.a", "external/ios/libs/glslang/libOSDependent.a", "external/ios/libs/glslang/libSPIRV.a", @@ -1892,6 +2566,9 @@ "external/ios/libs/libjpeg.a", "external/ios/libs/libpng.a", "external/ios/libs/libssl.a", + "external/ios/libs/libtbb_static.a", + "external/ios/libs/libtbbmalloc_proxy_static.a", + "external/ios/libs/libtbbmalloc_static.a", "external/ios/libs/libuv_a.a", "external/ios/libs/libv8_monolith.a", "external/ios/libs/libwebp.a", @@ -2013,41 +2690,58 @@ "external/mac/include/glslang/SPIRV/spirv.hpp", "external/mac/include/glslang/SPIRV/spvIR.h", "external/mac/include/jpeg/jconfig.h", + "external/mac/include/jpeg/jerror.h", "external/mac/include/jpeg/jmorecfg.h", "external/mac/include/jpeg/jpeglib.h", "external/mac/include/openssl/aes.h", "external/mac/include/openssl/asn1.h", "external/mac/include/openssl/asn1_mac.h", + "external/mac/include/openssl/asn1err.h", "external/mac/include/openssl/asn1t.h", "external/mac/include/openssl/async.h", + "external/mac/include/openssl/asyncerr.h", "external/mac/include/openssl/bio.h", + "external/mac/include/openssl/bioerr.h", "external/mac/include/openssl/blowfish.h", "external/mac/include/openssl/bn.h", + "external/mac/include/openssl/bnerr.h", "external/mac/include/openssl/buffer.h", + "external/mac/include/openssl/buffererr.h", "external/mac/include/openssl/camellia.h", "external/mac/include/openssl/cast.h", "external/mac/include/openssl/cmac.h", "external/mac/include/openssl/cms.h", + "external/mac/include/openssl/cmserr.h", "external/mac/include/openssl/comp.h", + "external/mac/include/openssl/comperr.h", "external/mac/include/openssl/conf.h", "external/mac/include/openssl/conf_api.h", + "external/mac/include/openssl/conferr.h", "external/mac/include/openssl/crypto.h", + "external/mac/include/openssl/cryptoerr.h", "external/mac/include/openssl/ct.h", + "external/mac/include/openssl/cterr.h", "external/mac/include/openssl/des.h", "external/mac/include/openssl/dh.h", + "external/mac/include/openssl/dherr.h", "external/mac/include/openssl/dsa.h", + "external/mac/include/openssl/dsaerr.h", "external/mac/include/openssl/dtls1.h", "external/mac/include/openssl/e_os2.h", "external/mac/include/openssl/ebcdic.h", "external/mac/include/openssl/ec.h", "external/mac/include/openssl/ecdh.h", "external/mac/include/openssl/ecdsa.h", + "external/mac/include/openssl/ecerr.h", "external/mac/include/openssl/engine.h", + "external/mac/include/openssl/engineerr.h", "external/mac/include/openssl/err.h", "external/mac/include/openssl/evp.h", + "external/mac/include/openssl/evperr.h", "external/mac/include/openssl/hmac.h", "external/mac/include/openssl/idea.h", "external/mac/include/openssl/kdf.h", + "external/mac/include/openssl/kdferr.h", "external/mac/include/openssl/lhash.h", "external/mac/include/openssl/md2.h", "external/mac/include/openssl/md4.h", @@ -2056,20 +2750,28 @@ "external/mac/include/openssl/modes.h", "external/mac/include/openssl/obj_mac.h", "external/mac/include/openssl/objects.h", + "external/mac/include/openssl/objectserr.h", "external/mac/include/openssl/ocsp.h", + "external/mac/include/openssl/ocsperr.h", "external/mac/include/openssl/opensslconf.h", "external/mac/include/openssl/opensslv.h", "external/mac/include/openssl/ossl_typ.h", "external/mac/include/openssl/pem.h", "external/mac/include/openssl/pem2.h", + "external/mac/include/openssl/pemerr.h", "external/mac/include/openssl/pkcs12.h", + "external/mac/include/openssl/pkcs12err.h", "external/mac/include/openssl/pkcs7.h", + "external/mac/include/openssl/pkcs7err.h", "external/mac/include/openssl/rand.h", + "external/mac/include/openssl/rand_drbg.h", + "external/mac/include/openssl/randerr.h", "external/mac/include/openssl/rc2.h", "external/mac/include/openssl/rc4.h", "external/mac/include/openssl/rc5.h", "external/mac/include/openssl/ripemd.h", "external/mac/include/openssl/rsa.h", + "external/mac/include/openssl/rsaerr.h", "external/mac/include/openssl/safestack.h", "external/mac/include/openssl/seed.h", "external/mac/include/openssl/sha.h", @@ -2078,16 +2780,23 @@ "external/mac/include/openssl/ssl.h", "external/mac/include/openssl/ssl2.h", "external/mac/include/openssl/ssl3.h", + "external/mac/include/openssl/sslerr.h", "external/mac/include/openssl/stack.h", + "external/mac/include/openssl/store.h", + "external/mac/include/openssl/storeerr.h", "external/mac/include/openssl/symhacks.h", "external/mac/include/openssl/tls1.h", "external/mac/include/openssl/ts.h", + "external/mac/include/openssl/tserr.h", "external/mac/include/openssl/txt_db.h", "external/mac/include/openssl/ui.h", + "external/mac/include/openssl/uierr.h", "external/mac/include/openssl/whrlpool.h", "external/mac/include/openssl/x509.h", "external/mac/include/openssl/x509_vfy.h", + "external/mac/include/openssl/x509err.h", "external/mac/include/openssl/x509v3.h", + "external/mac/include/openssl/x509v3err.h", "external/mac/include/png/png.h", "external/mac/include/png/pngconf.h", "external/mac/include/png/pnglibconf.h", @@ -2142,22 +2851,16 @@ "external/mac/include/pvrsdk/vulkan/vulkan_xlib.h", "external/mac/include/pvrsdk/vulkan/vulkan_xlib_xrandr.h", "external/mac/include/spirv_cross/GLSL.std.450.h", - "external/mac/include/spirv_cross/spirv.h", "external/mac/include/spirv_cross/spirv.hpp", "external/mac/include/spirv_cross/spirv_cfg.hpp", "external/mac/include/spirv_cross/spirv_common.hpp", - "external/mac/include/spirv_cross/spirv_cpp.hpp", "external/mac/include/spirv_cross/spirv_cross.hpp", - "external/mac/include/spirv_cross/spirv_cross_c.h", "external/mac/include/spirv_cross/spirv_cross_containers.hpp", "external/mac/include/spirv_cross/spirv_cross_error_handling.hpp", "external/mac/include/spirv_cross/spirv_cross_parsed_ir.hpp", - "external/mac/include/spirv_cross/spirv_cross_util.hpp", "external/mac/include/spirv_cross/spirv_glsl.hpp", - "external/mac/include/spirv_cross/spirv_hlsl.hpp", "external/mac/include/spirv_cross/spirv_msl.hpp", "external/mac/include/spirv_cross/spirv_parser.hpp", - "external/mac/include/spirv_cross/spirv_reflect.hpp", "external/mac/include/uv/uv.h", "external/mac/include/uv/uv/aix.h", "external/mac/include/uv/uv/android-ifaddrs.h", @@ -2199,13 +2902,20 @@ "external/mac/include/websockets/lws_config.h", "external/mac/include/zlib/zconf.h", "external/mac/include/zlib/zlib.h", + "external/mac/libs/PhysX/libPhysXCharacterKinematic_static_64.a", + "external/mac/libs/PhysX/libPhysXCommon_static_64.a", + "external/mac/libs/PhysX/libPhysXCooking_static_64.a", + "external/mac/libs/PhysX/libPhysXExtensions_static_64.a", + "external/mac/libs/PhysX/libPhysXFoundation_static_64.a", + "external/mac/libs/PhysX/libPhysXPvdSDK_static_64.a", + "external/mac/libs/PhysX/libPhysXVehicle_static_64.a", + "external/mac/libs/PhysX/libPhysX_static_64.a", "external/mac/libs/glslang/libOGLCompiler.a", "external/mac/libs/glslang/libOSDependent.a", "external/mac/libs/glslang/libSPIRV.a", "external/mac/libs/glslang/libglslang-default-resource-limits.a", "external/mac/libs/glslang/libglslang.a", "external/mac/libs/libEGL.dylib", - "external/mac/libs/libGLESv1_CM.dylib", "external/mac/libs/libGLESv2.dylib", "external/mac/libs/libcrypto.a", "external/mac/libs/libcurl.a", @@ -2217,6 +2927,9 @@ "external/mac/libs/libspirv-cross-glsl.a", "external/mac/libs/libspirv-cross-msl.a", "external/mac/libs/libssl.a", + "external/mac/libs/libtbb_static.a", + "external/mac/libs/libtbbmalloc_proxy_static.a", + "external/mac/libs/libtbbmalloc_static.a", "external/mac/libs/libuv_a.a", "external/mac/libs/libv8_monolith.a", "external/mac/libs/libwebp.a", @@ -2227,6 +2940,250 @@ "external/sources/ConvertUTF/ConvertUTF.c", "external/sources/ConvertUTF/ConvertUTF.h", "external/sources/ConvertUTF/ConvertUTFWrapper.cpp", + "external/sources/PhysX/PhysX/include/PxActor.h", + "external/sources/PhysX/PhysX/include/PxAggregate.h", + "external/sources/PhysX/PhysX/include/PxArticulation.h", + "external/sources/PhysX/PhysX/include/PxArticulationBase.h", + "external/sources/PhysX/PhysX/include/PxArticulationJoint.h", + "external/sources/PhysX/PhysX/include/PxArticulationJointReducedCoordinate.h", + "external/sources/PhysX/PhysX/include/PxArticulationLink.h", + "external/sources/PhysX/PhysX/include/PxArticulationReducedCoordinate.h", + "external/sources/PhysX/PhysX/include/PxBatchQuery.h", + "external/sources/PhysX/PhysX/include/PxBatchQueryDesc.h", + "external/sources/PhysX/PhysX/include/PxBroadPhase.h", + "external/sources/PhysX/PhysX/include/PxClient.h", + "external/sources/PhysX/PhysX/include/PxConfig.h", + "external/sources/PhysX/PhysX/include/PxConstraint.h", + "external/sources/PhysX/PhysX/include/PxConstraintDesc.h", + "external/sources/PhysX/PhysX/include/PxContact.h", + "external/sources/PhysX/PhysX/include/PxContactModifyCallback.h", + "external/sources/PhysX/PhysX/include/PxDeletionListener.h", + "external/sources/PhysX/PhysX/include/PxFiltering.h", + "external/sources/PhysX/PhysX/include/PxForceMode.h", + "external/sources/PhysX/PhysX/include/PxFoundation.h", + "external/sources/PhysX/PhysX/include/PxImmediateMode.h", + "external/sources/PhysX/PhysX/include/PxLockedData.h", + "external/sources/PhysX/PhysX/include/PxMaterial.h", + "external/sources/PhysX/PhysX/include/PxPhysXConfig.h", + "external/sources/PhysX/PhysX/include/PxPhysics.h", + "external/sources/PhysX/PhysX/include/PxPhysicsAPI.h", + "external/sources/PhysX/PhysX/include/PxPhysicsSerialization.h", + "external/sources/PhysX/PhysX/include/PxPhysicsVersion.h", + "external/sources/PhysX/PhysX/include/PxPruningStructure.h", + "external/sources/PhysX/PhysX/include/PxQueryFiltering.h", + "external/sources/PhysX/PhysX/include/PxQueryReport.h", + "external/sources/PhysX/PhysX/include/PxRigidActor.h", + "external/sources/PhysX/PhysX/include/PxRigidBody.h", + "external/sources/PhysX/PhysX/include/PxRigidDynamic.h", + "external/sources/PhysX/PhysX/include/PxRigidStatic.h", + "external/sources/PhysX/PhysX/include/PxScene.h", + "external/sources/PhysX/PhysX/include/PxSceneDesc.h", + "external/sources/PhysX/PhysX/include/PxSceneLock.h", + "external/sources/PhysX/PhysX/include/PxShape.h", + "external/sources/PhysX/PhysX/include/PxSimulationEventCallback.h", + "external/sources/PhysX/PhysX/include/PxSimulationStatistics.h", + "external/sources/PhysX/PhysX/include/PxVisualizationParameter.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxBoxController.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxCapsuleController.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxController.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxControllerBehavior.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxControllerManager.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxControllerObstacles.h", + "external/sources/PhysX/PhysX/include/characterkinematic/PxExtended.h", + "external/sources/PhysX/PhysX/include/collision/PxCollisionDefs.h", + "external/sources/PhysX/PhysX/include/common/PxBase.h", + "external/sources/PhysX/PhysX/include/common/PxCollection.h", + "external/sources/PhysX/PhysX/include/common/PxCoreUtilityTypes.h", + "external/sources/PhysX/PhysX/include/common/PxMetaData.h", + "external/sources/PhysX/PhysX/include/common/PxMetaDataFlags.h", + "external/sources/PhysX/PhysX/include/common/PxPhysXCommonConfig.h", + "external/sources/PhysX/PhysX/include/common/PxPhysicsInsertionCallback.h", + "external/sources/PhysX/PhysX/include/common/PxProfileZone.h", + "external/sources/PhysX/PhysX/include/common/PxRenderBuffer.h", + "external/sources/PhysX/PhysX/include/common/PxSerialFramework.h", + "external/sources/PhysX/PhysX/include/common/PxSerializer.h", + "external/sources/PhysX/PhysX/include/common/PxStringTable.h", + "external/sources/PhysX/PhysX/include/common/PxTolerancesScale.h", + "external/sources/PhysX/PhysX/include/common/PxTypeInfo.h", + "external/sources/PhysX/PhysX/include/common/windows/PxWindowsDelayLoadHook.h", + "external/sources/PhysX/PhysX/include/cooking/PxBVH33MidphaseDesc.h", + "external/sources/PhysX/PhysX/include/cooking/PxBVH34MidphaseDesc.h", + "external/sources/PhysX/PhysX/include/cooking/PxBVHStructureDesc.h", + "external/sources/PhysX/PhysX/include/cooking/PxConvexMeshDesc.h", + "external/sources/PhysX/PhysX/include/cooking/PxCooking.h", + "external/sources/PhysX/PhysX/include/cooking/PxMidphaseDesc.h", + "external/sources/PhysX/PhysX/include/cooking/PxTriangleMeshDesc.h", + "external/sources/PhysX/PhysX/include/cooking/Pxc.h", + "external/sources/PhysX/PhysX/include/cudamanager/PxCudaContextManager.h", + "external/sources/PhysX/PhysX/include/cudamanager/PxCudaMemoryManager.h", + "external/sources/PhysX/PhysX/include/extensions/PxBinaryConverter.h", + "external/sources/PhysX/PhysX/include/extensions/PxBroadPhaseExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxCollectionExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxConstraintExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxContactJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxConvexMeshExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxD6Joint.h", + "external/sources/PhysX/PhysX/include/extensions/PxD6JointCreate.h", + "external/sources/PhysX/PhysX/include/extensions/PxDefaultAllocator.h", + "external/sources/PhysX/PhysX/include/extensions/PxDefaultCpuDispatcher.h", + "external/sources/PhysX/PhysX/include/extensions/PxDefaultErrorCallback.h", + "external/sources/PhysX/PhysX/include/extensions/PxDefaultSimulationFilterShader.h", + "external/sources/PhysX/PhysX/include/extensions/PxDefaultStreams.h", + "external/sources/PhysX/PhysX/include/extensions/PxDistanceJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxExtensionsAPI.h", + "external/sources/PhysX/PhysX/include/extensions/PxFixedJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxJointLimit.h", + "external/sources/PhysX/PhysX/include/extensions/PxMassProperties.h", + "external/sources/PhysX/PhysX/include/extensions/PxPrismaticJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxRaycastCCD.h", + "external/sources/PhysX/PhysX/include/extensions/PxRepXSerializer.h", + "external/sources/PhysX/PhysX/include/extensions/PxRepXSimpleType.h", + "external/sources/PhysX/PhysX/include/extensions/PxRevoluteJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxRigidActorExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxRigidBodyExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxSceneQueryExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxSerialization.h", + "external/sources/PhysX/PhysX/include/extensions/PxShapeExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxSimpleFactory.h", + "external/sources/PhysX/PhysX/include/extensions/PxSmoothNormals.h", + "external/sources/PhysX/PhysX/include/extensions/PxSphericalJoint.h", + "external/sources/PhysX/PhysX/include/extensions/PxStringTableExt.h", + "external/sources/PhysX/PhysX/include/extensions/PxTriangleMeshExt.h", + "external/sources/PhysX/PhysX/include/filebuf/PxFileBuf.h", + "external/sources/PhysX/PhysX/include/foundation/PxAssert.h", + "external/sources/PhysX/PhysX/include/foundation/PxFoundationConfig.h", + "external/sources/PhysX/PhysX/include/foundation/PxMathUtils.h", + "external/sources/PhysX/PhysX/include/geometry/PxBVHStructure.h", + "external/sources/PhysX/PhysX/include/geometry/PxBoxGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxCapsuleGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxConvexMesh.h", + "external/sources/PhysX/PhysX/include/geometry/PxConvexMeshGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxGeometryHelpers.h", + "external/sources/PhysX/PhysX/include/geometry/PxGeometryQuery.h", + "external/sources/PhysX/PhysX/include/geometry/PxHeightField.h", + "external/sources/PhysX/PhysX/include/geometry/PxHeightFieldDesc.h", + "external/sources/PhysX/PhysX/include/geometry/PxHeightFieldFlag.h", + "external/sources/PhysX/PhysX/include/geometry/PxHeightFieldGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxHeightFieldSample.h", + "external/sources/PhysX/PhysX/include/geometry/PxMeshQuery.h", + "external/sources/PhysX/PhysX/include/geometry/PxMeshScale.h", + "external/sources/PhysX/PhysX/include/geometry/PxPlaneGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxSimpleTriangleMesh.h", + "external/sources/PhysX/PhysX/include/geometry/PxSphereGeometry.h", + "external/sources/PhysX/PhysX/include/geometry/PxTriangle.h", + "external/sources/PhysX/PhysX/include/geometry/PxTriangleMesh.h", + "external/sources/PhysX/PhysX/include/geometry/PxTriangleMeshGeometry.h", + "external/sources/PhysX/PhysX/include/geomutils/GuContactBuffer.h", + "external/sources/PhysX/PhysX/include/geomutils/GuContactPoint.h", + "external/sources/PhysX/PhysX/include/gpu/PxGpu.h", + "external/sources/PhysX/PhysX/include/pvd/PxPvd.h", + "external/sources/PhysX/PhysX/include/pvd/PxPvdSceneClient.h", + "external/sources/PhysX/PhysX/include/pvd/PxPvdTransport.h", + "external/sources/PhysX/PhysX/include/solver/PxSolverDefs.h", + "external/sources/PhysX/PhysX/include/task/PxCpuDispatcher.h", + "external/sources/PhysX/PhysX/include/task/PxTask.h", + "external/sources/PhysX/PhysX/include/task/PxTaskDefine.h", + "external/sources/PhysX/PhysX/include/task/PxTaskManager.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleComponents.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleDrive.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleDrive4W.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleDriveNW.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleDriveTank.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleNoDrive.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleSDK.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleShaders.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleTireFriction.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleUpdate.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleUtil.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleUtilControl.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleUtilSetup.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleUtilTelemetry.h", + "external/sources/PhysX/PhysX/include/vehicle/PxVehicleWheels.h", + "external/sources/PhysX/PhysX/source/fastxml/include/PsFastXml.h", + "external/sources/PhysX/PhysX/source/foundation/include/Ps.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsAlignedMalloc.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsAlloca.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsAllocator.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsArray.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsAtomic.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsBasicTemplates.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsBitUtils.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsBroadcast.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsCpu.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsFPU.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsFoundation.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsHash.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsHashInternals.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsHashMap.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsHashSet.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsInlineAllocator.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsInlineAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsInlineArray.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsIntrinsics.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsMathUtils.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsMutex.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsPool.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsSList.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsSocket.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsSort.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsSortInternals.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsString.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsSync.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsTempAllocator.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsThread.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsTime.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsUserAllocated.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsUtilities.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecMath.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecMathAoSScalar.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecMathAoSScalarInline.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecMathSSE.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecMathUtilities.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecQuat.h", + "external/sources/PhysX/PhysX/source/foundation/include/PsVecTransform.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/PsUnixAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/PsUnixFPU.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/PsUnixInlineAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/PsUnixIntrinsics.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/PsUnixTrigConstants.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/neon/PsUnixNeonAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/unix/neon/PsUnixNeonInlineAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/windows/PsWindowsAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/windows/PsWindowsFPU.h", + "external/sources/PhysX/PhysX/source/foundation/include/windows/PsWindowsInclude.h", + "external/sources/PhysX/PhysX/source/foundation/include/windows/PsWindowsInlineAoS.h", + "external/sources/PhysX/PhysX/source/foundation/include/windows/PsWindowsIntrinsics.h", + "external/sources/PhysX/PhysX/source/foundation/include/windows/PsWindowsTrigConstants.h", + "external/sources/PhysX/PxShared/include/foundation/Px.h", + "external/sources/PhysX/PxShared/include/foundation/PxAllocatorCallback.h", + "external/sources/PhysX/PxShared/include/foundation/PxBitAndData.h", + "external/sources/PhysX/PxShared/include/foundation/PxBounds3.h", + "external/sources/PhysX/PxShared/include/foundation/PxErrorCallback.h", + "external/sources/PhysX/PxShared/include/foundation/PxErrors.h", + "external/sources/PhysX/PxShared/include/foundation/PxFlags.h", + "external/sources/PhysX/PxShared/include/foundation/PxIO.h", + "external/sources/PhysX/PxShared/include/foundation/PxIntrinsics.h", + "external/sources/PhysX/PxShared/include/foundation/PxMat33.h", + "external/sources/PhysX/PxShared/include/foundation/PxMat44.h", + "external/sources/PhysX/PxShared/include/foundation/PxMath.h", + "external/sources/PhysX/PxShared/include/foundation/PxMemory.h", + "external/sources/PhysX/PxShared/include/foundation/PxPlane.h", + "external/sources/PhysX/PxShared/include/foundation/PxPreprocessor.h", + "external/sources/PhysX/PxShared/include/foundation/PxProfiler.h", + "external/sources/PhysX/PxShared/include/foundation/PxQuat.h", + "external/sources/PhysX/PxShared/include/foundation/PxSharedAssert.h", + "external/sources/PhysX/PxShared/include/foundation/PxSimpleTypes.h", + "external/sources/PhysX/PxShared/include/foundation/PxStrideIterator.h", + "external/sources/PhysX/PxShared/include/foundation/PxTransform.h", + "external/sources/PhysX/PxShared/include/foundation/PxUnionCast.h", + "external/sources/PhysX/PxShared/include/foundation/PxVec2.h", + "external/sources/PhysX/PxShared/include/foundation/PxVec3.h", + "external/sources/PhysX/PxShared/include/foundation/PxVec4.h", + "external/sources/PhysX/PxShared/include/foundation/unix/PxUnixIntrinsics.h", + "external/sources/PhysX/PxShared/include/foundation/windows/PxWindowsIntrinsics.h", "external/sources/SocketRocket/CMakeLists.txt", "external/sources/SocketRocket/Internal/Delegate/SRDelegateController.h", "external/sources/SocketRocket/Internal/Delegate/SRDelegateController.m", @@ -2269,9 +3226,14432 @@ "external/sources/SocketRocket/SRWebSocket.h", "external/sources/SocketRocket/SRWebSocket.m", "external/sources/SocketRocket/SocketRocket.h", + "external/sources/acl/compression/compress.h", + "external/sources/acl/compression/compression_level.h", + "external/sources/acl/compression/compression_settings.h", + "external/sources/acl/compression/convert.h", + "external/sources/acl/compression/impl/animated_track_utils.h", + "external/sources/acl/compression/impl/clip_context.h", + "external/sources/acl/compression/impl/compact_constant_streams.h", + "external/sources/acl/compression/impl/compress.impl.h", + "external/sources/acl/compression/impl/compression_settings.impl.h", + "external/sources/acl/compression/impl/constant_track_impl.h", + "external/sources/acl/compression/impl/convert.impl.h", + "external/sources/acl/compression/impl/convert_rotation_streams.h", + "external/sources/acl/compression/impl/normalize_streams.h", + "external/sources/acl/compression/impl/normalize_track_impl.h", + "external/sources/acl/compression/impl/quantize_streams.h", + "external/sources/acl/compression/impl/quantize_track_impl.h", + "external/sources/acl/compression/impl/sample_streams.h", + "external/sources/acl/compression/impl/segment_context.h", + "external/sources/acl/compression/impl/segment_streams.h", + "external/sources/acl/compression/impl/track.impl.h", + "external/sources/acl/compression/impl/track_array.impl.h", + "external/sources/acl/compression/impl/track_bit_rate_database.h", + "external/sources/acl/compression/impl/track_error.impl.h", + "external/sources/acl/compression/impl/track_list_context.h", + "external/sources/acl/compression/impl/track_range.h", + "external/sources/acl/compression/impl/track_range_impl.h", + "external/sources/acl/compression/impl/track_stream.h", + "external/sources/acl/compression/impl/transform_bit_rate_permutations.h", + "external/sources/acl/compression/impl/write_compression_stats_impl.h", + "external/sources/acl/compression/impl/write_decompression_stats.h", + "external/sources/acl/compression/impl/write_range_data.h", + "external/sources/acl/compression/impl/write_segment_data.h", + "external/sources/acl/compression/impl/write_stats.h", + "external/sources/acl/compression/impl/write_stream_bitsets.h", + "external/sources/acl/compression/impl/write_stream_data.h", + "external/sources/acl/compression/impl/write_track_data_impl.h", + "external/sources/acl/compression/impl/write_track_metadata.h", + "external/sources/acl/compression/output_stats.h", + "external/sources/acl/compression/track.h", + "external/sources/acl/compression/track_array.h", + "external/sources/acl/compression/track_error.h", + "external/sources/acl/compression/transform_error_metrics.h", + "external/sources/acl/compression/transform_pose_utils.h", + "external/sources/acl/core/additive_utils.h", + "external/sources/acl/core/algorithm_types.h", + "external/sources/acl/core/ansi_allocator.h", + "external/sources/acl/core/bit_manip_utils.h", + "external/sources/acl/core/bitset.h", + "external/sources/acl/core/buffer_tag.h", + "external/sources/acl/core/compressed_tracks.h", + "external/sources/acl/core/compressed_tracks_version.h", + "external/sources/acl/core/enum_utils.h", + "external/sources/acl/core/error.h", + "external/sources/acl/core/error_result.h", + "external/sources/acl/core/floating_point_exceptions.h", + "external/sources/acl/core/hash.h", + "external/sources/acl/core/iallocator.h", + "external/sources/acl/core/impl/compiler_utils.h", + "external/sources/acl/core/impl/compressed_headers.h", + "external/sources/acl/core/impl/compressed_tracks.impl.h", + "external/sources/acl/core/impl/debug_track_writer.h", + "external/sources/acl/core/impl/memory_cache.h", + "external/sources/acl/core/impl/track_desc.impl.h", + "external/sources/acl/core/impl/track_formats.impl.h", + "external/sources/acl/core/interpolation_utils.h", + "external/sources/acl/core/iterator.h", + "external/sources/acl/core/memory_utils.h", + "external/sources/acl/core/ptr_offset.h", + "external/sources/acl/core/range_reduction_types.h", + "external/sources/acl/core/scope_profiler.h", + "external/sources/acl/core/string.h", + "external/sources/acl/core/track_desc.h", + "external/sources/acl/core/track_formats.h", + "external/sources/acl/core/track_traits.h", + "external/sources/acl/core/track_types.h", + "external/sources/acl/core/track_writer.h", + "external/sources/acl/core/unique_ptr.h", + "external/sources/acl/core/utils.h", + "external/sources/acl/core/variable_bit_rates.h", + "external/sources/acl/decompression/decompress.h", + "external/sources/acl/decompression/impl/decompress.impl.h", + "external/sources/acl/decompression/impl/decompression_context_selector.h", + "external/sources/acl/decompression/impl/decompression_version_selector.h", + "external/sources/acl/decompression/impl/scalar_track_decompression.h", + "external/sources/acl/decompression/impl/track_cache.h", + "external/sources/acl/decompression/impl/transform_animated_track_cache.h", + "external/sources/acl/decompression/impl/transform_constant_track_cache.h", + "external/sources/acl/decompression/impl/transform_decompression_context.h", + "external/sources/acl/decompression/impl/transform_track_decompression.h", + "external/sources/acl/decompression/impl/universal_track_decompression.h", + "external/sources/acl/io/clip_reader.h", + "external/sources/acl/io/clip_reader_error.h", + "external/sources/acl/io/clip_writer.h", + "external/sources/acl/math/quat_packing.h", + "external/sources/acl/math/quatf.h", + "external/sources/acl/math/scalar_packing.h", + "external/sources/acl/math/vector4_packing.h", + "external/sources/acl/math/vector4f.h", + "external/sources/boost/accumulators/accumulators.hpp", + "external/sources/boost/accumulators/accumulators_fwd.hpp", + "external/sources/boost/accumulators/framework/accumulator_base.hpp", + "external/sources/boost/accumulators/framework/accumulator_concept.hpp", + "external/sources/boost/accumulators/framework/accumulator_set.hpp", + "external/sources/boost/accumulators/framework/accumulators/droppable_accumulator.hpp", + "external/sources/boost/accumulators/framework/accumulators/external_accumulator.hpp", + "external/sources/boost/accumulators/framework/accumulators/reference_accumulator.hpp", + "external/sources/boost/accumulators/framework/accumulators/value_accumulator.hpp", + "external/sources/boost/accumulators/framework/depends_on.hpp", + "external/sources/boost/accumulators/framework/external.hpp", + "external/sources/boost/accumulators/framework/extractor.hpp", + "external/sources/boost/accumulators/framework/features.hpp", + "external/sources/boost/accumulators/framework/parameters/accumulator.hpp", + "external/sources/boost/accumulators/framework/parameters/sample.hpp", + "external/sources/boost/accumulators/framework/parameters/weight.hpp", + "external/sources/boost/accumulators/framework/parameters/weights.hpp", + "external/sources/boost/accumulators/numeric/detail/function1.hpp", + "external/sources/boost/accumulators/numeric/detail/function2.hpp", + "external/sources/boost/accumulators/numeric/detail/function3.hpp", + "external/sources/boost/accumulators/numeric/detail/function4.hpp", + "external/sources/boost/accumulators/numeric/detail/function_n.hpp", + "external/sources/boost/accumulators/numeric/detail/pod_singleton.hpp", + "external/sources/boost/accumulators/numeric/functional.hpp", + "external/sources/boost/accumulators/numeric/functional/complex.hpp", + "external/sources/boost/accumulators/numeric/functional/valarray.hpp", + "external/sources/boost/accumulators/numeric/functional/vector.hpp", + "external/sources/boost/accumulators/numeric/functional_fwd.hpp", + "external/sources/boost/accumulators/statistics.hpp", + "external/sources/boost/accumulators/statistics/count.hpp", + "external/sources/boost/accumulators/statistics/covariance.hpp", + "external/sources/boost/accumulators/statistics/density.hpp", + "external/sources/boost/accumulators/statistics/error_of.hpp", + "external/sources/boost/accumulators/statistics/error_of_mean.hpp", + "external/sources/boost/accumulators/statistics/extended_p_square.hpp", + "external/sources/boost/accumulators/statistics/extended_p_square_quantile.hpp", + "external/sources/boost/accumulators/statistics/kurtosis.hpp", + "external/sources/boost/accumulators/statistics/max.hpp", + "external/sources/boost/accumulators/statistics/mean.hpp", + "external/sources/boost/accumulators/statistics/median.hpp", + "external/sources/boost/accumulators/statistics/min.hpp", + "external/sources/boost/accumulators/statistics/moment.hpp", + "external/sources/boost/accumulators/statistics/p_square_cumul_dist.hpp", + "external/sources/boost/accumulators/statistics/p_square_cumulative_distribution.hpp", + "external/sources/boost/accumulators/statistics/p_square_quantile.hpp", + "external/sources/boost/accumulators/statistics/parameters/quantile_probability.hpp", + "external/sources/boost/accumulators/statistics/peaks_over_threshold.hpp", + "external/sources/boost/accumulators/statistics/pot_quantile.hpp", + "external/sources/boost/accumulators/statistics/pot_tail_mean.hpp", + "external/sources/boost/accumulators/statistics/rolling_count.hpp", + "external/sources/boost/accumulators/statistics/rolling_mean.hpp", + "external/sources/boost/accumulators/statistics/rolling_moment.hpp", + "external/sources/boost/accumulators/statistics/rolling_sum.hpp", + "external/sources/boost/accumulators/statistics/rolling_variance.hpp", + "external/sources/boost/accumulators/statistics/rolling_window.hpp", + "external/sources/boost/accumulators/statistics/skewness.hpp", + "external/sources/boost/accumulators/statistics/stats.hpp", + "external/sources/boost/accumulators/statistics/sum.hpp", + "external/sources/boost/accumulators/statistics/sum_kahan.hpp", + "external/sources/boost/accumulators/statistics/tail.hpp", + "external/sources/boost/accumulators/statistics/tail_mean.hpp", + "external/sources/boost/accumulators/statistics/tail_quantile.hpp", + "external/sources/boost/accumulators/statistics/tail_variate.hpp", + "external/sources/boost/accumulators/statistics/tail_variate_means.hpp", + "external/sources/boost/accumulators/statistics/times2_iterator.hpp", + "external/sources/boost/accumulators/statistics/variance.hpp", + "external/sources/boost/accumulators/statistics/variates/covariate.hpp", + "external/sources/boost/accumulators/statistics/weighted_covariance.hpp", + "external/sources/boost/accumulators/statistics/weighted_density.hpp", + "external/sources/boost/accumulators/statistics/weighted_extended_p_square.hpp", + "external/sources/boost/accumulators/statistics/weighted_kurtosis.hpp", + "external/sources/boost/accumulators/statistics/weighted_mean.hpp", + "external/sources/boost/accumulators/statistics/weighted_median.hpp", + "external/sources/boost/accumulators/statistics/weighted_moment.hpp", + "external/sources/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp", + "external/sources/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp", + "external/sources/boost/accumulators/statistics/weighted_p_square_quantile.hpp", + "external/sources/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp", + "external/sources/boost/accumulators/statistics/weighted_skewness.hpp", + "external/sources/boost/accumulators/statistics/weighted_sum.hpp", + "external/sources/boost/accumulators/statistics/weighted_sum_kahan.hpp", + "external/sources/boost/accumulators/statistics/weighted_tail_mean.hpp", + "external/sources/boost/accumulators/statistics/weighted_tail_quantile.hpp", + "external/sources/boost/accumulators/statistics/weighted_tail_variate_means.hpp", + "external/sources/boost/accumulators/statistics/weighted_variance.hpp", + "external/sources/boost/accumulators/statistics/with_error.hpp", + "external/sources/boost/accumulators/statistics_fwd.hpp", + "external/sources/boost/algorithm/algorithm.hpp", + "external/sources/boost/algorithm/apply_permutation.hpp", + "external/sources/boost/algorithm/clamp.hpp", + "external/sources/boost/algorithm/cxx11/all_of.hpp", + "external/sources/boost/algorithm/cxx11/any_of.hpp", + "external/sources/boost/algorithm/cxx11/copy_if.hpp", + "external/sources/boost/algorithm/cxx11/copy_n.hpp", + "external/sources/boost/algorithm/cxx11/find_if_not.hpp", + "external/sources/boost/algorithm/cxx11/iota.hpp", + "external/sources/boost/algorithm/cxx11/is_partitioned.hpp", + "external/sources/boost/algorithm/cxx11/is_permutation.hpp", + "external/sources/boost/algorithm/cxx11/is_sorted.hpp", + "external/sources/boost/algorithm/cxx11/none_of.hpp", + "external/sources/boost/algorithm/cxx11/one_of.hpp", + "external/sources/boost/algorithm/cxx11/partition_copy.hpp", + "external/sources/boost/algorithm/cxx11/partition_point.hpp", + "external/sources/boost/algorithm/cxx14/equal.hpp", + "external/sources/boost/algorithm/cxx14/is_permutation.hpp", + "external/sources/boost/algorithm/cxx14/mismatch.hpp", + "external/sources/boost/algorithm/cxx17/exclusive_scan.hpp", + "external/sources/boost/algorithm/cxx17/for_each_n.hpp", + "external/sources/boost/algorithm/cxx17/inclusive_scan.hpp", + "external/sources/boost/algorithm/cxx17/reduce.hpp", + "external/sources/boost/algorithm/cxx17/transform_exclusive_scan.hpp", + "external/sources/boost/algorithm/cxx17/transform_inclusive_scan.hpp", + "external/sources/boost/algorithm/cxx17/transform_reduce.hpp", + "external/sources/boost/algorithm/find_backward.hpp", + "external/sources/boost/algorithm/find_not.hpp", + "external/sources/boost/algorithm/gather.hpp", + "external/sources/boost/algorithm/hex.hpp", + "external/sources/boost/algorithm/is_palindrome.hpp", + "external/sources/boost/algorithm/is_partitioned_until.hpp", + "external/sources/boost/algorithm/minmax.hpp", + "external/sources/boost/algorithm/minmax_element.hpp", + "external/sources/boost/algorithm/searching/boyer_moore.hpp", + "external/sources/boost/algorithm/searching/boyer_moore_horspool.hpp", + "external/sources/boost/algorithm/searching/detail/bm_traits.hpp", + "external/sources/boost/algorithm/searching/detail/debugging.hpp", + "external/sources/boost/algorithm/searching/knuth_morris_pratt.hpp", + "external/sources/boost/algorithm/sort_subrange.hpp", + "external/sources/boost/algorithm/string.hpp", + "external/sources/boost/algorithm/string/case_conv.hpp", + "external/sources/boost/algorithm/string/classification.hpp", + "external/sources/boost/algorithm/string/compare.hpp", + "external/sources/boost/algorithm/string/concept.hpp", + "external/sources/boost/algorithm/string/config.hpp", + "external/sources/boost/algorithm/string/constants.hpp", + "external/sources/boost/algorithm/string/detail/case_conv.hpp", + "external/sources/boost/algorithm/string/detail/classification.hpp", + "external/sources/boost/algorithm/string/detail/find_format.hpp", + "external/sources/boost/algorithm/string/detail/find_format_all.hpp", + "external/sources/boost/algorithm/string/detail/find_format_store.hpp", + "external/sources/boost/algorithm/string/detail/find_iterator.hpp", + "external/sources/boost/algorithm/string/detail/finder.hpp", + "external/sources/boost/algorithm/string/detail/finder_regex.hpp", + "external/sources/boost/algorithm/string/detail/formatter.hpp", + "external/sources/boost/algorithm/string/detail/formatter_regex.hpp", + "external/sources/boost/algorithm/string/detail/predicate.hpp", + "external/sources/boost/algorithm/string/detail/replace_storage.hpp", + "external/sources/boost/algorithm/string/detail/sequence.hpp", + "external/sources/boost/algorithm/string/detail/trim.hpp", + "external/sources/boost/algorithm/string/detail/util.hpp", + "external/sources/boost/algorithm/string/erase.hpp", + "external/sources/boost/algorithm/string/find.hpp", + "external/sources/boost/algorithm/string/find_format.hpp", + "external/sources/boost/algorithm/string/find_iterator.hpp", + "external/sources/boost/algorithm/string/finder.hpp", + "external/sources/boost/algorithm/string/formatter.hpp", + "external/sources/boost/algorithm/string/iter_find.hpp", + "external/sources/boost/algorithm/string/join.hpp", + "external/sources/boost/algorithm/string/predicate.hpp", + "external/sources/boost/algorithm/string/predicate_facade.hpp", + "external/sources/boost/algorithm/string/regex.hpp", + "external/sources/boost/algorithm/string/regex_find_format.hpp", + "external/sources/boost/algorithm/string/replace.hpp", + "external/sources/boost/algorithm/string/sequence_traits.hpp", + "external/sources/boost/algorithm/string/split.hpp", + "external/sources/boost/algorithm/string/std/list_traits.hpp", + "external/sources/boost/algorithm/string/std/rope_traits.hpp", + "external/sources/boost/algorithm/string/std/slist_traits.hpp", + "external/sources/boost/algorithm/string/std/string_traits.hpp", + "external/sources/boost/algorithm/string/std_containers_traits.hpp", + "external/sources/boost/algorithm/string/trim.hpp", + "external/sources/boost/algorithm/string/trim_all.hpp", + "external/sources/boost/algorithm/string/yes_no_type.hpp", + "external/sources/boost/algorithm/string_regex.hpp", + "external/sources/boost/align.hpp", + "external/sources/boost/align/align.hpp", + "external/sources/boost/align/align_down.hpp", + "external/sources/boost/align/align_up.hpp", + "external/sources/boost/align/aligned_alloc.hpp", + "external/sources/boost/align/aligned_allocator.hpp", + "external/sources/boost/align/aligned_allocator_adaptor.hpp", + "external/sources/boost/align/aligned_allocator_adaptor_forward.hpp", + "external/sources/boost/align/aligned_allocator_forward.hpp", + "external/sources/boost/align/aligned_delete.hpp", + "external/sources/boost/align/aligned_delete_forward.hpp", + "external/sources/boost/align/alignment_of.hpp", + "external/sources/boost/align/alignment_of_forward.hpp", + "external/sources/boost/align/assume_aligned.hpp", + "external/sources/boost/align/detail/add_reference.hpp", + "external/sources/boost/align/detail/align.hpp", + "external/sources/boost/align/detail/align_cxx11.hpp", + "external/sources/boost/align/detail/align_down.hpp", + "external/sources/boost/align/detail/align_up.hpp", + "external/sources/boost/align/detail/aligned_alloc.hpp", + "external/sources/boost/align/detail/aligned_alloc_android.hpp", + "external/sources/boost/align/detail/aligned_alloc_macos.hpp", + "external/sources/boost/align/detail/aligned_alloc_mingw.hpp", + "external/sources/boost/align/detail/aligned_alloc_msvc.hpp", + "external/sources/boost/align/detail/aligned_alloc_new.hpp", + "external/sources/boost/align/detail/aligned_alloc_posix.hpp", + "external/sources/boost/align/detail/aligned_alloc_sunos.hpp", + "external/sources/boost/align/detail/alignment_of.hpp", + "external/sources/boost/align/detail/alignment_of_clang.hpp", + "external/sources/boost/align/detail/alignment_of_codegear.hpp", + "external/sources/boost/align/detail/alignment_of_cxx11.hpp", + "external/sources/boost/align/detail/alignment_of_gcc.hpp", + "external/sources/boost/align/detail/alignment_of_msvc.hpp", + "external/sources/boost/align/detail/assume_aligned.hpp", + "external/sources/boost/align/detail/assume_aligned_clang.hpp", + "external/sources/boost/align/detail/assume_aligned_gcc.hpp", + "external/sources/boost/align/detail/assume_aligned_intel.hpp", + "external/sources/boost/align/detail/assume_aligned_msvc.hpp", + "external/sources/boost/align/detail/element_type.hpp", + "external/sources/boost/align/detail/integral_constant.hpp", + "external/sources/boost/align/detail/is_aligned.hpp", + "external/sources/boost/align/detail/is_alignment.hpp", + "external/sources/boost/align/detail/is_alignment_constant.hpp", + "external/sources/boost/align/detail/max_align.hpp", + "external/sources/boost/align/detail/max_objects.hpp", + "external/sources/boost/align/detail/max_size.hpp", + "external/sources/boost/align/detail/min_size.hpp", + "external/sources/boost/align/detail/not_pointer.hpp", + "external/sources/boost/align/detail/throw_exception.hpp", + "external/sources/boost/align/is_aligned.hpp", + "external/sources/boost/aligned_storage.hpp", + "external/sources/boost/any.hpp", + "external/sources/boost/archive/archive_exception.hpp", + "external/sources/boost/archive/basic_archive.hpp", + "external/sources/boost/archive/basic_binary_iarchive.hpp", + "external/sources/boost/archive/basic_binary_iprimitive.hpp", + "external/sources/boost/archive/basic_binary_oarchive.hpp", + "external/sources/boost/archive/basic_binary_oprimitive.hpp", + "external/sources/boost/archive/basic_streambuf_locale_saver.hpp", + "external/sources/boost/archive/basic_text_iarchive.hpp", + "external/sources/boost/archive/basic_text_iprimitive.hpp", + "external/sources/boost/archive/basic_text_oarchive.hpp", + "external/sources/boost/archive/basic_text_oprimitive.hpp", + "external/sources/boost/archive/basic_xml_archive.hpp", + "external/sources/boost/archive/basic_xml_iarchive.hpp", + "external/sources/boost/archive/basic_xml_oarchive.hpp", + "external/sources/boost/archive/binary_iarchive.hpp", + "external/sources/boost/archive/binary_iarchive_impl.hpp", + "external/sources/boost/archive/binary_oarchive.hpp", + "external/sources/boost/archive/binary_oarchive_impl.hpp", + "external/sources/boost/archive/binary_wiarchive.hpp", + "external/sources/boost/archive/binary_woarchive.hpp", + "external/sources/boost/archive/codecvt_null.hpp", + "external/sources/boost/archive/detail/abi_prefix.hpp", + "external/sources/boost/archive/detail/abi_suffix.hpp", + "external/sources/boost/archive/detail/archive_serializer_map.hpp", + "external/sources/boost/archive/detail/auto_link_archive.hpp", + "external/sources/boost/archive/detail/auto_link_warchive.hpp", + "external/sources/boost/archive/detail/basic_iarchive.hpp", + "external/sources/boost/archive/detail/basic_iserializer.hpp", + "external/sources/boost/archive/detail/basic_oarchive.hpp", + "external/sources/boost/archive/detail/basic_oserializer.hpp", + "external/sources/boost/archive/detail/basic_pointer_iserializer.hpp", + "external/sources/boost/archive/detail/basic_pointer_oserializer.hpp", + "external/sources/boost/archive/detail/basic_serializer.hpp", + "external/sources/boost/archive/detail/basic_serializer_map.hpp", + "external/sources/boost/archive/detail/check.hpp", + "external/sources/boost/archive/detail/common_iarchive.hpp", + "external/sources/boost/archive/detail/common_oarchive.hpp", + "external/sources/boost/archive/detail/decl.hpp", + "external/sources/boost/archive/detail/helper_collection.hpp", + "external/sources/boost/archive/detail/interface_iarchive.hpp", + "external/sources/boost/archive/detail/interface_oarchive.hpp", + "external/sources/boost/archive/detail/iserializer.hpp", + "external/sources/boost/archive/detail/oserializer.hpp", + "external/sources/boost/archive/detail/polymorphic_iarchive_route.hpp", + "external/sources/boost/archive/detail/polymorphic_oarchive_route.hpp", + "external/sources/boost/archive/detail/register_archive.hpp", + "external/sources/boost/archive/detail/utf8_codecvt_facet.hpp", + "external/sources/boost/archive/dinkumware.hpp", + "external/sources/boost/archive/impl/archive_serializer_map.ipp", + "external/sources/boost/archive/impl/basic_binary_iarchive.ipp", + "external/sources/boost/archive/impl/basic_binary_iprimitive.ipp", + "external/sources/boost/archive/impl/basic_binary_oarchive.ipp", + "external/sources/boost/archive/impl/basic_binary_oprimitive.ipp", + "external/sources/boost/archive/impl/basic_text_iarchive.ipp", + "external/sources/boost/archive/impl/basic_text_iprimitive.ipp", + "external/sources/boost/archive/impl/basic_text_oarchive.ipp", + "external/sources/boost/archive/impl/basic_text_oprimitive.ipp", + "external/sources/boost/archive/impl/basic_xml_grammar.hpp", + "external/sources/boost/archive/impl/basic_xml_iarchive.ipp", + "external/sources/boost/archive/impl/basic_xml_oarchive.ipp", + "external/sources/boost/archive/impl/text_iarchive_impl.ipp", + "external/sources/boost/archive/impl/text_oarchive_impl.ipp", + "external/sources/boost/archive/impl/text_wiarchive_impl.ipp", + "external/sources/boost/archive/impl/text_woarchive_impl.ipp", + "external/sources/boost/archive/impl/xml_iarchive_impl.ipp", + "external/sources/boost/archive/impl/xml_oarchive_impl.ipp", + "external/sources/boost/archive/impl/xml_wiarchive_impl.ipp", + "external/sources/boost/archive/impl/xml_woarchive_impl.ipp", + "external/sources/boost/archive/iterators/base64_exception.hpp", + "external/sources/boost/archive/iterators/base64_from_binary.hpp", + "external/sources/boost/archive/iterators/binary_from_base64.hpp", + "external/sources/boost/archive/iterators/dataflow.hpp", + "external/sources/boost/archive/iterators/dataflow_exception.hpp", + "external/sources/boost/archive/iterators/escape.hpp", + "external/sources/boost/archive/iterators/insert_linebreaks.hpp", + "external/sources/boost/archive/iterators/istream_iterator.hpp", + "external/sources/boost/archive/iterators/mb_from_wchar.hpp", + "external/sources/boost/archive/iterators/ostream_iterator.hpp", + "external/sources/boost/archive/iterators/remove_whitespace.hpp", + "external/sources/boost/archive/iterators/transform_width.hpp", + "external/sources/boost/archive/iterators/unescape.hpp", + "external/sources/boost/archive/iterators/wchar_from_mb.hpp", + "external/sources/boost/archive/iterators/xml_escape.hpp", + "external/sources/boost/archive/iterators/xml_unescape.hpp", + "external/sources/boost/archive/iterators/xml_unescape_exception.hpp", + "external/sources/boost/archive/polymorphic_binary_iarchive.hpp", + "external/sources/boost/archive/polymorphic_binary_oarchive.hpp", + "external/sources/boost/archive/polymorphic_iarchive.hpp", + "external/sources/boost/archive/polymorphic_oarchive.hpp", + "external/sources/boost/archive/polymorphic_text_iarchive.hpp", + "external/sources/boost/archive/polymorphic_text_oarchive.hpp", + "external/sources/boost/archive/polymorphic_text_wiarchive.hpp", + "external/sources/boost/archive/polymorphic_text_woarchive.hpp", + "external/sources/boost/archive/polymorphic_xml_iarchive.hpp", + "external/sources/boost/archive/polymorphic_xml_oarchive.hpp", + "external/sources/boost/archive/polymorphic_xml_wiarchive.hpp", + "external/sources/boost/archive/polymorphic_xml_woarchive.hpp", + "external/sources/boost/archive/text_iarchive.hpp", + "external/sources/boost/archive/text_oarchive.hpp", + "external/sources/boost/archive/text_wiarchive.hpp", + "external/sources/boost/archive/text_woarchive.hpp", + "external/sources/boost/archive/tmpdir.hpp", + "external/sources/boost/archive/wcslen.hpp", + "external/sources/boost/archive/xml_archive_exception.hpp", + "external/sources/boost/archive/xml_iarchive.hpp", + "external/sources/boost/archive/xml_oarchive.hpp", + "external/sources/boost/archive/xml_wiarchive.hpp", + "external/sources/boost/archive/xml_woarchive.hpp", + "external/sources/boost/array.hpp", + "external/sources/boost/asio.hpp", + "external/sources/boost/asio/any_io_executor.hpp", + "external/sources/boost/asio/associated_allocator.hpp", + "external/sources/boost/asio/associated_executor.hpp", + "external/sources/boost/asio/async_result.hpp", + "external/sources/boost/asio/awaitable.hpp", + "external/sources/boost/asio/basic_datagram_socket.hpp", + "external/sources/boost/asio/basic_deadline_timer.hpp", + "external/sources/boost/asio/basic_io_object.hpp", + "external/sources/boost/asio/basic_raw_socket.hpp", + "external/sources/boost/asio/basic_seq_packet_socket.hpp", + "external/sources/boost/asio/basic_serial_port.hpp", + "external/sources/boost/asio/basic_signal_set.hpp", + "external/sources/boost/asio/basic_socket.hpp", + "external/sources/boost/asio/basic_socket_acceptor.hpp", + "external/sources/boost/asio/basic_socket_iostream.hpp", + "external/sources/boost/asio/basic_socket_streambuf.hpp", + "external/sources/boost/asio/basic_stream_socket.hpp", + "external/sources/boost/asio/basic_streambuf.hpp", + "external/sources/boost/asio/basic_streambuf_fwd.hpp", + "external/sources/boost/asio/basic_waitable_timer.hpp", + "external/sources/boost/asio/bind_executor.hpp", + "external/sources/boost/asio/buffer.hpp", + "external/sources/boost/asio/buffered_read_stream.hpp", + "external/sources/boost/asio/buffered_read_stream_fwd.hpp", + "external/sources/boost/asio/buffered_stream.hpp", + "external/sources/boost/asio/buffered_stream_fwd.hpp", + "external/sources/boost/asio/buffered_write_stream.hpp", + "external/sources/boost/asio/buffered_write_stream_fwd.hpp", + "external/sources/boost/asio/buffers_iterator.hpp", + "external/sources/boost/asio/co_spawn.hpp", + "external/sources/boost/asio/completion_condition.hpp", + "external/sources/boost/asio/compose.hpp", + "external/sources/boost/asio/connect.hpp", + "external/sources/boost/asio/coroutine.hpp", + "external/sources/boost/asio/deadline_timer.hpp", + "external/sources/boost/asio/defer.hpp", + "external/sources/boost/asio/detached.hpp", + "external/sources/boost/asio/detail/array.hpp", + "external/sources/boost/asio/detail/array_fwd.hpp", + "external/sources/boost/asio/detail/assert.hpp", + "external/sources/boost/asio/detail/atomic_count.hpp", + "external/sources/boost/asio/detail/base_from_completion_cond.hpp", + "external/sources/boost/asio/detail/bind_handler.hpp", + "external/sources/boost/asio/detail/blocking_executor_op.hpp", + "external/sources/boost/asio/detail/buffer_resize_guard.hpp", + "external/sources/boost/asio/detail/buffer_sequence_adapter.hpp", + "external/sources/boost/asio/detail/buffered_stream_storage.hpp", + "external/sources/boost/asio/detail/bulk_executor_op.hpp", + "external/sources/boost/asio/detail/call_stack.hpp", + "external/sources/boost/asio/detail/chrono.hpp", + "external/sources/boost/asio/detail/chrono_time_traits.hpp", + "external/sources/boost/asio/detail/completion_handler.hpp", + "external/sources/boost/asio/detail/concurrency_hint.hpp", + "external/sources/boost/asio/detail/conditionally_enabled_event.hpp", + "external/sources/boost/asio/detail/conditionally_enabled_mutex.hpp", + "external/sources/boost/asio/detail/config.hpp", + "external/sources/boost/asio/detail/consuming_buffers.hpp", + "external/sources/boost/asio/detail/cstddef.hpp", + "external/sources/boost/asio/detail/cstdint.hpp", + "external/sources/boost/asio/detail/date_time_fwd.hpp", + "external/sources/boost/asio/detail/deadline_timer_service.hpp", + "external/sources/boost/asio/detail/dependent_type.hpp", + "external/sources/boost/asio/detail/descriptor_ops.hpp", + "external/sources/boost/asio/detail/descriptor_read_op.hpp", + "external/sources/boost/asio/detail/descriptor_write_op.hpp", + "external/sources/boost/asio/detail/dev_poll_reactor.hpp", + "external/sources/boost/asio/detail/epoll_reactor.hpp", + "external/sources/boost/asio/detail/event.hpp", + "external/sources/boost/asio/detail/eventfd_select_interrupter.hpp", + "external/sources/boost/asio/detail/executor_function.hpp", + "external/sources/boost/asio/detail/executor_op.hpp", + "external/sources/boost/asio/detail/fd_set_adapter.hpp", + "external/sources/boost/asio/detail/fenced_block.hpp", + "external/sources/boost/asio/detail/functional.hpp", + "external/sources/boost/asio/detail/future.hpp", + "external/sources/boost/asio/detail/gcc_arm_fenced_block.hpp", + "external/sources/boost/asio/detail/gcc_hppa_fenced_block.hpp", + "external/sources/boost/asio/detail/gcc_sync_fenced_block.hpp", + "external/sources/boost/asio/detail/gcc_x86_fenced_block.hpp", + "external/sources/boost/asio/detail/global.hpp", + "external/sources/boost/asio/detail/handler_alloc_helpers.hpp", + "external/sources/boost/asio/detail/handler_cont_helpers.hpp", + "external/sources/boost/asio/detail/handler_invoke_helpers.hpp", + "external/sources/boost/asio/detail/handler_tracking.hpp", + "external/sources/boost/asio/detail/handler_type_requirements.hpp", + "external/sources/boost/asio/detail/handler_work.hpp", + "external/sources/boost/asio/detail/hash_map.hpp", + "external/sources/boost/asio/detail/impl/buffer_sequence_adapter.ipp", + "external/sources/boost/asio/detail/impl/descriptor_ops.ipp", + "external/sources/boost/asio/detail/impl/dev_poll_reactor.hpp", + "external/sources/boost/asio/detail/impl/dev_poll_reactor.ipp", + "external/sources/boost/asio/detail/impl/epoll_reactor.hpp", + "external/sources/boost/asio/detail/impl/epoll_reactor.ipp", + "external/sources/boost/asio/detail/impl/eventfd_select_interrupter.ipp", + "external/sources/boost/asio/detail/impl/handler_tracking.ipp", + "external/sources/boost/asio/detail/impl/kqueue_reactor.hpp", + "external/sources/boost/asio/detail/impl/kqueue_reactor.ipp", + "external/sources/boost/asio/detail/impl/null_event.ipp", + "external/sources/boost/asio/detail/impl/pipe_select_interrupter.ipp", + "external/sources/boost/asio/detail/impl/posix_event.ipp", + "external/sources/boost/asio/detail/impl/posix_mutex.ipp", + "external/sources/boost/asio/detail/impl/posix_thread.ipp", + "external/sources/boost/asio/detail/impl/posix_tss_ptr.ipp", + "external/sources/boost/asio/detail/impl/reactive_descriptor_service.ipp", + "external/sources/boost/asio/detail/impl/reactive_serial_port_service.ipp", + "external/sources/boost/asio/detail/impl/reactive_socket_service_base.ipp", + "external/sources/boost/asio/detail/impl/resolver_service_base.ipp", + "external/sources/boost/asio/detail/impl/scheduler.ipp", + "external/sources/boost/asio/detail/impl/select_reactor.hpp", + "external/sources/boost/asio/detail/impl/select_reactor.ipp", + "external/sources/boost/asio/detail/impl/service_registry.hpp", + "external/sources/boost/asio/detail/impl/service_registry.ipp", + "external/sources/boost/asio/detail/impl/signal_set_service.ipp", + "external/sources/boost/asio/detail/impl/socket_ops.ipp", + "external/sources/boost/asio/detail/impl/socket_select_interrupter.ipp", + "external/sources/boost/asio/detail/impl/strand_executor_service.hpp", + "external/sources/boost/asio/detail/impl/strand_executor_service.ipp", + "external/sources/boost/asio/detail/impl/strand_service.hpp", + "external/sources/boost/asio/detail/impl/strand_service.ipp", + "external/sources/boost/asio/detail/impl/throw_error.ipp", + "external/sources/boost/asio/detail/impl/timer_queue_ptime.ipp", + "external/sources/boost/asio/detail/impl/timer_queue_set.ipp", + "external/sources/boost/asio/detail/impl/win_event.ipp", + "external/sources/boost/asio/detail/impl/win_iocp_handle_service.ipp", + "external/sources/boost/asio/detail/impl/win_iocp_io_context.hpp", + "external/sources/boost/asio/detail/impl/win_iocp_io_context.ipp", + "external/sources/boost/asio/detail/impl/win_iocp_serial_port_service.ipp", + "external/sources/boost/asio/detail/impl/win_iocp_socket_service_base.ipp", + "external/sources/boost/asio/detail/impl/win_mutex.ipp", + "external/sources/boost/asio/detail/impl/win_object_handle_service.ipp", + "external/sources/boost/asio/detail/impl/win_static_mutex.ipp", + "external/sources/boost/asio/detail/impl/win_thread.ipp", + "external/sources/boost/asio/detail/impl/win_tss_ptr.ipp", + "external/sources/boost/asio/detail/impl/winrt_ssocket_service_base.ipp", + "external/sources/boost/asio/detail/impl/winrt_timer_scheduler.hpp", + "external/sources/boost/asio/detail/impl/winrt_timer_scheduler.ipp", + "external/sources/boost/asio/detail/impl/winsock_init.ipp", + "external/sources/boost/asio/detail/io_control.hpp", + "external/sources/boost/asio/detail/io_object_impl.hpp", + "external/sources/boost/asio/detail/is_buffer_sequence.hpp", + "external/sources/boost/asio/detail/is_executor.hpp", + "external/sources/boost/asio/detail/keyword_tss_ptr.hpp", + "external/sources/boost/asio/detail/kqueue_reactor.hpp", + "external/sources/boost/asio/detail/limits.hpp", + "external/sources/boost/asio/detail/local_free_on_block_exit.hpp", + "external/sources/boost/asio/detail/macos_fenced_block.hpp", + "external/sources/boost/asio/detail/memory.hpp", + "external/sources/boost/asio/detail/mutex.hpp", + "external/sources/boost/asio/detail/non_const_lvalue.hpp", + "external/sources/boost/asio/detail/noncopyable.hpp", + "external/sources/boost/asio/detail/null_event.hpp", + "external/sources/boost/asio/detail/null_fenced_block.hpp", + "external/sources/boost/asio/detail/null_global.hpp", + "external/sources/boost/asio/detail/null_mutex.hpp", + "external/sources/boost/asio/detail/null_reactor.hpp", + "external/sources/boost/asio/detail/null_signal_blocker.hpp", + "external/sources/boost/asio/detail/null_socket_service.hpp", + "external/sources/boost/asio/detail/null_static_mutex.hpp", + "external/sources/boost/asio/detail/null_thread.hpp", + "external/sources/boost/asio/detail/null_tss_ptr.hpp", + "external/sources/boost/asio/detail/object_pool.hpp", + "external/sources/boost/asio/detail/old_win_sdk_compat.hpp", + "external/sources/boost/asio/detail/op_queue.hpp", + "external/sources/boost/asio/detail/operation.hpp", + "external/sources/boost/asio/detail/pipe_select_interrupter.hpp", + "external/sources/boost/asio/detail/pop_options.hpp", + "external/sources/boost/asio/detail/posix_event.hpp", + "external/sources/boost/asio/detail/posix_fd_set_adapter.hpp", + "external/sources/boost/asio/detail/posix_global.hpp", + "external/sources/boost/asio/detail/posix_mutex.hpp", + "external/sources/boost/asio/detail/posix_signal_blocker.hpp", + "external/sources/boost/asio/detail/posix_static_mutex.hpp", + "external/sources/boost/asio/detail/posix_thread.hpp", + "external/sources/boost/asio/detail/posix_tss_ptr.hpp", + "external/sources/boost/asio/detail/push_options.hpp", + "external/sources/boost/asio/detail/reactive_descriptor_service.hpp", + "external/sources/boost/asio/detail/reactive_null_buffers_op.hpp", + "external/sources/boost/asio/detail/reactive_serial_port_service.hpp", + "external/sources/boost/asio/detail/reactive_socket_accept_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_connect_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_recv_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_recvfrom_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_recvmsg_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_send_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_sendto_op.hpp", + "external/sources/boost/asio/detail/reactive_socket_service.hpp", + "external/sources/boost/asio/detail/reactive_socket_service_base.hpp", + "external/sources/boost/asio/detail/reactive_wait_op.hpp", + "external/sources/boost/asio/detail/reactor.hpp", + "external/sources/boost/asio/detail/reactor_fwd.hpp", + "external/sources/boost/asio/detail/reactor_op.hpp", + "external/sources/boost/asio/detail/reactor_op_queue.hpp", + "external/sources/boost/asio/detail/recycling_allocator.hpp", + "external/sources/boost/asio/detail/regex_fwd.hpp", + "external/sources/boost/asio/detail/resolve_endpoint_op.hpp", + "external/sources/boost/asio/detail/resolve_op.hpp", + "external/sources/boost/asio/detail/resolve_query_op.hpp", + "external/sources/boost/asio/detail/resolver_service.hpp", + "external/sources/boost/asio/detail/resolver_service_base.hpp", + "external/sources/boost/asio/detail/scheduler.hpp", + "external/sources/boost/asio/detail/scheduler_operation.hpp", + "external/sources/boost/asio/detail/scheduler_thread_info.hpp", + "external/sources/boost/asio/detail/scoped_lock.hpp", + "external/sources/boost/asio/detail/scoped_ptr.hpp", + "external/sources/boost/asio/detail/select_interrupter.hpp", + "external/sources/boost/asio/detail/select_reactor.hpp", + "external/sources/boost/asio/detail/service_registry.hpp", + "external/sources/boost/asio/detail/signal_blocker.hpp", + "external/sources/boost/asio/detail/signal_handler.hpp", + "external/sources/boost/asio/detail/signal_init.hpp", + "external/sources/boost/asio/detail/signal_op.hpp", + "external/sources/boost/asio/detail/signal_set_service.hpp", + "external/sources/boost/asio/detail/socket_holder.hpp", + "external/sources/boost/asio/detail/socket_ops.hpp", + "external/sources/boost/asio/detail/socket_option.hpp", + "external/sources/boost/asio/detail/socket_select_interrupter.hpp", + "external/sources/boost/asio/detail/socket_types.hpp", + "external/sources/boost/asio/detail/solaris_fenced_block.hpp", + "external/sources/boost/asio/detail/source_location.hpp", + "external/sources/boost/asio/detail/static_mutex.hpp", + "external/sources/boost/asio/detail/std_event.hpp", + "external/sources/boost/asio/detail/std_fenced_block.hpp", + "external/sources/boost/asio/detail/std_global.hpp", + "external/sources/boost/asio/detail/std_mutex.hpp", + "external/sources/boost/asio/detail/std_static_mutex.hpp", + "external/sources/boost/asio/detail/std_thread.hpp", + "external/sources/boost/asio/detail/strand_executor_service.hpp", + "external/sources/boost/asio/detail/strand_service.hpp", + "external/sources/boost/asio/detail/string_view.hpp", + "external/sources/boost/asio/detail/thread.hpp", + "external/sources/boost/asio/detail/thread_context.hpp", + "external/sources/boost/asio/detail/thread_group.hpp", + "external/sources/boost/asio/detail/thread_info_base.hpp", + "external/sources/boost/asio/detail/throw_error.hpp", + "external/sources/boost/asio/detail/throw_exception.hpp", + "external/sources/boost/asio/detail/timer_queue.hpp", + "external/sources/boost/asio/detail/timer_queue_base.hpp", + "external/sources/boost/asio/detail/timer_queue_ptime.hpp", + "external/sources/boost/asio/detail/timer_queue_set.hpp", + "external/sources/boost/asio/detail/timer_scheduler.hpp", + "external/sources/boost/asio/detail/timer_scheduler_fwd.hpp", + "external/sources/boost/asio/detail/tss_ptr.hpp", + "external/sources/boost/asio/detail/type_traits.hpp", + "external/sources/boost/asio/detail/variadic_templates.hpp", + "external/sources/boost/asio/detail/wait_handler.hpp", + "external/sources/boost/asio/detail/wait_op.hpp", + "external/sources/boost/asio/detail/win_event.hpp", + "external/sources/boost/asio/detail/win_fd_set_adapter.hpp", + "external/sources/boost/asio/detail/win_fenced_block.hpp", + "external/sources/boost/asio/detail/win_global.hpp", + "external/sources/boost/asio/detail/win_iocp_handle_read_op.hpp", + "external/sources/boost/asio/detail/win_iocp_handle_service.hpp", + "external/sources/boost/asio/detail/win_iocp_handle_write_op.hpp", + "external/sources/boost/asio/detail/win_iocp_io_context.hpp", + "external/sources/boost/asio/detail/win_iocp_null_buffers_op.hpp", + "external/sources/boost/asio/detail/win_iocp_operation.hpp", + "external/sources/boost/asio/detail/win_iocp_overlapped_op.hpp", + "external/sources/boost/asio/detail/win_iocp_overlapped_ptr.hpp", + "external/sources/boost/asio/detail/win_iocp_serial_port_service.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_accept_op.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_connect_op.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_recv_op.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_send_op.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_service.hpp", + "external/sources/boost/asio/detail/win_iocp_socket_service_base.hpp", + "external/sources/boost/asio/detail/win_iocp_thread_info.hpp", + "external/sources/boost/asio/detail/win_iocp_wait_op.hpp", + "external/sources/boost/asio/detail/win_mutex.hpp", + "external/sources/boost/asio/detail/win_object_handle_service.hpp", + "external/sources/boost/asio/detail/win_static_mutex.hpp", + "external/sources/boost/asio/detail/win_thread.hpp", + "external/sources/boost/asio/detail/win_tss_ptr.hpp", + "external/sources/boost/asio/detail/winapp_thread.hpp", + "external/sources/boost/asio/detail/wince_thread.hpp", + "external/sources/boost/asio/detail/winrt_async_manager.hpp", + "external/sources/boost/asio/detail/winrt_async_op.hpp", + "external/sources/boost/asio/detail/winrt_resolve_op.hpp", + "external/sources/boost/asio/detail/winrt_resolver_service.hpp", + "external/sources/boost/asio/detail/winrt_socket_connect_op.hpp", + "external/sources/boost/asio/detail/winrt_socket_recv_op.hpp", + "external/sources/boost/asio/detail/winrt_socket_send_op.hpp", + "external/sources/boost/asio/detail/winrt_ssocket_service.hpp", + "external/sources/boost/asio/detail/winrt_ssocket_service_base.hpp", + "external/sources/boost/asio/detail/winrt_timer_scheduler.hpp", + "external/sources/boost/asio/detail/winrt_utils.hpp", + "external/sources/boost/asio/detail/winsock_init.hpp", + "external/sources/boost/asio/detail/work_dispatcher.hpp", + "external/sources/boost/asio/detail/wrapped_handler.hpp", + "external/sources/boost/asio/dispatch.hpp", + "external/sources/boost/asio/error.hpp", + "external/sources/boost/asio/execution.hpp", + "external/sources/boost/asio/execution/allocator.hpp", + "external/sources/boost/asio/execution/any_executor.hpp", + "external/sources/boost/asio/execution/bad_executor.hpp", + "external/sources/boost/asio/execution/blocking.hpp", + "external/sources/boost/asio/execution/blocking_adaptation.hpp", + "external/sources/boost/asio/execution/bulk_execute.hpp", + "external/sources/boost/asio/execution/bulk_guarantee.hpp", + "external/sources/boost/asio/execution/connect.hpp", + "external/sources/boost/asio/execution/context.hpp", + "external/sources/boost/asio/execution/context_as.hpp", + "external/sources/boost/asio/execution/detail/as_invocable.hpp", + "external/sources/boost/asio/execution/detail/as_operation.hpp", + "external/sources/boost/asio/execution/detail/as_receiver.hpp", + "external/sources/boost/asio/execution/detail/bulk_sender.hpp", + "external/sources/boost/asio/execution/detail/submit_receiver.hpp", + "external/sources/boost/asio/execution/detail/void_receiver.hpp", + "external/sources/boost/asio/execution/execute.hpp", + "external/sources/boost/asio/execution/executor.hpp", + "external/sources/boost/asio/execution/impl/bad_executor.ipp", + "external/sources/boost/asio/execution/impl/receiver_invocation_error.ipp", + "external/sources/boost/asio/execution/invocable_archetype.hpp", + "external/sources/boost/asio/execution/mapping.hpp", + "external/sources/boost/asio/execution/occupancy.hpp", + "external/sources/boost/asio/execution/operation_state.hpp", + "external/sources/boost/asio/execution/outstanding_work.hpp", + "external/sources/boost/asio/execution/prefer_only.hpp", + "external/sources/boost/asio/execution/receiver.hpp", + "external/sources/boost/asio/execution/receiver_invocation_error.hpp", + "external/sources/boost/asio/execution/relationship.hpp", + "external/sources/boost/asio/execution/schedule.hpp", + "external/sources/boost/asio/execution/scheduler.hpp", + "external/sources/boost/asio/execution/sender.hpp", + "external/sources/boost/asio/execution/set_done.hpp", + "external/sources/boost/asio/execution/set_error.hpp", + "external/sources/boost/asio/execution/set_value.hpp", + "external/sources/boost/asio/execution/start.hpp", + "external/sources/boost/asio/execution/submit.hpp", + "external/sources/boost/asio/execution_context.hpp", + "external/sources/boost/asio/executor.hpp", + "external/sources/boost/asio/executor_work_guard.hpp", + "external/sources/boost/asio/generic/basic_endpoint.hpp", + "external/sources/boost/asio/generic/datagram_protocol.hpp", + "external/sources/boost/asio/generic/detail/endpoint.hpp", + "external/sources/boost/asio/generic/detail/impl/endpoint.ipp", + "external/sources/boost/asio/generic/raw_protocol.hpp", + "external/sources/boost/asio/generic/seq_packet_protocol.hpp", + "external/sources/boost/asio/generic/stream_protocol.hpp", + "external/sources/boost/asio/handler_alloc_hook.hpp", + "external/sources/boost/asio/handler_continuation_hook.hpp", + "external/sources/boost/asio/handler_invoke_hook.hpp", + "external/sources/boost/asio/high_resolution_timer.hpp", + "external/sources/boost/asio/impl/awaitable.hpp", + "external/sources/boost/asio/impl/buffered_read_stream.hpp", + "external/sources/boost/asio/impl/buffered_write_stream.hpp", + "external/sources/boost/asio/impl/co_spawn.hpp", + "external/sources/boost/asio/impl/compose.hpp", + "external/sources/boost/asio/impl/connect.hpp", + "external/sources/boost/asio/impl/defer.hpp", + "external/sources/boost/asio/impl/detached.hpp", + "external/sources/boost/asio/impl/dispatch.hpp", + "external/sources/boost/asio/impl/error.ipp", + "external/sources/boost/asio/impl/execution_context.hpp", + "external/sources/boost/asio/impl/execution_context.ipp", + "external/sources/boost/asio/impl/executor.hpp", + "external/sources/boost/asio/impl/executor.ipp", + "external/sources/boost/asio/impl/handler_alloc_hook.ipp", + "external/sources/boost/asio/impl/io_context.hpp", + "external/sources/boost/asio/impl/io_context.ipp", + "external/sources/boost/asio/impl/multiple_exceptions.ipp", + "external/sources/boost/asio/impl/post.hpp", + "external/sources/boost/asio/impl/read.hpp", + "external/sources/boost/asio/impl/read_at.hpp", + "external/sources/boost/asio/impl/read_until.hpp", + "external/sources/boost/asio/impl/redirect_error.hpp", + "external/sources/boost/asio/impl/serial_port_base.hpp", + "external/sources/boost/asio/impl/serial_port_base.ipp", + "external/sources/boost/asio/impl/spawn.hpp", + "external/sources/boost/asio/impl/src.cpp", + "external/sources/boost/asio/impl/src.hpp", + "external/sources/boost/asio/impl/system_context.hpp", + "external/sources/boost/asio/impl/system_context.ipp", + "external/sources/boost/asio/impl/system_executor.hpp", + "external/sources/boost/asio/impl/thread_pool.hpp", + "external/sources/boost/asio/impl/thread_pool.ipp", + "external/sources/boost/asio/impl/use_awaitable.hpp", + "external/sources/boost/asio/impl/use_future.hpp", + "external/sources/boost/asio/impl/write.hpp", + "external/sources/boost/asio/impl/write_at.hpp", + "external/sources/boost/asio/io_context.hpp", + "external/sources/boost/asio/io_context_strand.hpp", + "external/sources/boost/asio/io_service.hpp", + "external/sources/boost/asio/io_service_strand.hpp", + "external/sources/boost/asio/ip/address.hpp", + "external/sources/boost/asio/ip/address_v4.hpp", + "external/sources/boost/asio/ip/address_v4_iterator.hpp", + "external/sources/boost/asio/ip/address_v4_range.hpp", + "external/sources/boost/asio/ip/address_v6.hpp", + "external/sources/boost/asio/ip/address_v6_iterator.hpp", + "external/sources/boost/asio/ip/address_v6_range.hpp", + "external/sources/boost/asio/ip/bad_address_cast.hpp", + "external/sources/boost/asio/ip/basic_endpoint.hpp", + "external/sources/boost/asio/ip/basic_resolver.hpp", + "external/sources/boost/asio/ip/basic_resolver_entry.hpp", + "external/sources/boost/asio/ip/basic_resolver_iterator.hpp", + "external/sources/boost/asio/ip/basic_resolver_query.hpp", + "external/sources/boost/asio/ip/basic_resolver_results.hpp", + "external/sources/boost/asio/ip/detail/endpoint.hpp", + "external/sources/boost/asio/ip/detail/impl/endpoint.ipp", + "external/sources/boost/asio/ip/detail/socket_option.hpp", + "external/sources/boost/asio/ip/host_name.hpp", + "external/sources/boost/asio/ip/icmp.hpp", + "external/sources/boost/asio/ip/impl/address.hpp", + "external/sources/boost/asio/ip/impl/address.ipp", + "external/sources/boost/asio/ip/impl/address_v4.hpp", + "external/sources/boost/asio/ip/impl/address_v4.ipp", + "external/sources/boost/asio/ip/impl/address_v6.hpp", + "external/sources/boost/asio/ip/impl/address_v6.ipp", + "external/sources/boost/asio/ip/impl/basic_endpoint.hpp", + "external/sources/boost/asio/ip/impl/host_name.ipp", + "external/sources/boost/asio/ip/impl/network_v4.hpp", + "external/sources/boost/asio/ip/impl/network_v4.ipp", + "external/sources/boost/asio/ip/impl/network_v6.hpp", + "external/sources/boost/asio/ip/impl/network_v6.ipp", + "external/sources/boost/asio/ip/multicast.hpp", + "external/sources/boost/asio/ip/network_v4.hpp", + "external/sources/boost/asio/ip/network_v6.hpp", + "external/sources/boost/asio/ip/resolver_base.hpp", + "external/sources/boost/asio/ip/resolver_query_base.hpp", + "external/sources/boost/asio/ip/tcp.hpp", + "external/sources/boost/asio/ip/udp.hpp", + "external/sources/boost/asio/ip/unicast.hpp", + "external/sources/boost/asio/ip/v6_only.hpp", + "external/sources/boost/asio/is_applicable_property.hpp", + "external/sources/boost/asio/is_executor.hpp", + "external/sources/boost/asio/is_read_buffered.hpp", + "external/sources/boost/asio/is_write_buffered.hpp", + "external/sources/boost/asio/local/basic_endpoint.hpp", + "external/sources/boost/asio/local/connect_pair.hpp", + "external/sources/boost/asio/local/datagram_protocol.hpp", + "external/sources/boost/asio/local/detail/endpoint.hpp", + "external/sources/boost/asio/local/detail/impl/endpoint.ipp", + "external/sources/boost/asio/local/stream_protocol.hpp", + "external/sources/boost/asio/multiple_exceptions.hpp", + "external/sources/boost/asio/packaged_task.hpp", + "external/sources/boost/asio/placeholders.hpp", + "external/sources/boost/asio/posix/basic_descriptor.hpp", + "external/sources/boost/asio/posix/basic_stream_descriptor.hpp", + "external/sources/boost/asio/posix/descriptor.hpp", + "external/sources/boost/asio/posix/descriptor_base.hpp", + "external/sources/boost/asio/posix/stream_descriptor.hpp", + "external/sources/boost/asio/post.hpp", + "external/sources/boost/asio/prefer.hpp", + "external/sources/boost/asio/query.hpp", + "external/sources/boost/asio/read.hpp", + "external/sources/boost/asio/read_at.hpp", + "external/sources/boost/asio/read_until.hpp", + "external/sources/boost/asio/redirect_error.hpp", + "external/sources/boost/asio/require.hpp", + "external/sources/boost/asio/require_concept.hpp", + "external/sources/boost/asio/serial_port.hpp", + "external/sources/boost/asio/serial_port_base.hpp", + "external/sources/boost/asio/signal_set.hpp", + "external/sources/boost/asio/socket_base.hpp", + "external/sources/boost/asio/spawn.hpp", + "external/sources/boost/asio/ssl.hpp", + "external/sources/boost/asio/ssl/context.hpp", + "external/sources/boost/asio/ssl/context_base.hpp", + "external/sources/boost/asio/ssl/detail/buffered_handshake_op.hpp", + "external/sources/boost/asio/ssl/detail/engine.hpp", + "external/sources/boost/asio/ssl/detail/handshake_op.hpp", + "external/sources/boost/asio/ssl/detail/impl/engine.ipp", + "external/sources/boost/asio/ssl/detail/impl/openssl_init.ipp", + "external/sources/boost/asio/ssl/detail/io.hpp", + "external/sources/boost/asio/ssl/detail/openssl_init.hpp", + "external/sources/boost/asio/ssl/detail/openssl_types.hpp", + "external/sources/boost/asio/ssl/detail/password_callback.hpp", + "external/sources/boost/asio/ssl/detail/read_op.hpp", + "external/sources/boost/asio/ssl/detail/shutdown_op.hpp", + "external/sources/boost/asio/ssl/detail/stream_core.hpp", + "external/sources/boost/asio/ssl/detail/verify_callback.hpp", + "external/sources/boost/asio/ssl/detail/write_op.hpp", + "external/sources/boost/asio/ssl/error.hpp", + "external/sources/boost/asio/ssl/host_name_verification.hpp", + "external/sources/boost/asio/ssl/impl/context.hpp", + "external/sources/boost/asio/ssl/impl/context.ipp", + "external/sources/boost/asio/ssl/impl/error.ipp", + "external/sources/boost/asio/ssl/impl/host_name_verification.ipp", + "external/sources/boost/asio/ssl/impl/rfc2818_verification.ipp", + "external/sources/boost/asio/ssl/impl/src.hpp", + "external/sources/boost/asio/ssl/rfc2818_verification.hpp", + "external/sources/boost/asio/ssl/stream.hpp", + "external/sources/boost/asio/ssl/stream_base.hpp", + "external/sources/boost/asio/ssl/verify_context.hpp", + "external/sources/boost/asio/ssl/verify_mode.hpp", + "external/sources/boost/asio/static_thread_pool.hpp", + "external/sources/boost/asio/steady_timer.hpp", + "external/sources/boost/asio/strand.hpp", + "external/sources/boost/asio/streambuf.hpp", + "external/sources/boost/asio/system_context.hpp", + "external/sources/boost/asio/system_executor.hpp", + "external/sources/boost/asio/system_timer.hpp", + "external/sources/boost/asio/this_coro.hpp", + "external/sources/boost/asio/thread_pool.hpp", + "external/sources/boost/asio/time_traits.hpp", + "external/sources/boost/asio/traits/bulk_execute_free.hpp", + "external/sources/boost/asio/traits/bulk_execute_member.hpp", + "external/sources/boost/asio/traits/connect_free.hpp", + "external/sources/boost/asio/traits/connect_member.hpp", + "external/sources/boost/asio/traits/equality_comparable.hpp", + "external/sources/boost/asio/traits/execute_free.hpp", + "external/sources/boost/asio/traits/execute_member.hpp", + "external/sources/boost/asio/traits/prefer_free.hpp", + "external/sources/boost/asio/traits/prefer_member.hpp", + "external/sources/boost/asio/traits/query_free.hpp", + "external/sources/boost/asio/traits/query_member.hpp", + "external/sources/boost/asio/traits/query_static_constexpr_member.hpp", + "external/sources/boost/asio/traits/require_concept_free.hpp", + "external/sources/boost/asio/traits/require_concept_member.hpp", + "external/sources/boost/asio/traits/require_free.hpp", + "external/sources/boost/asio/traits/require_member.hpp", + "external/sources/boost/asio/traits/schedule_free.hpp", + "external/sources/boost/asio/traits/schedule_member.hpp", + "external/sources/boost/asio/traits/set_done_free.hpp", + "external/sources/boost/asio/traits/set_done_member.hpp", + "external/sources/boost/asio/traits/set_error_free.hpp", + "external/sources/boost/asio/traits/set_error_member.hpp", + "external/sources/boost/asio/traits/set_value_free.hpp", + "external/sources/boost/asio/traits/set_value_member.hpp", + "external/sources/boost/asio/traits/start_free.hpp", + "external/sources/boost/asio/traits/start_member.hpp", + "external/sources/boost/asio/traits/static_query.hpp", + "external/sources/boost/asio/traits/static_require.hpp", + "external/sources/boost/asio/traits/static_require_concept.hpp", + "external/sources/boost/asio/traits/submit_free.hpp", + "external/sources/boost/asio/traits/submit_member.hpp", + "external/sources/boost/asio/ts/buffer.hpp", + "external/sources/boost/asio/ts/executor.hpp", + "external/sources/boost/asio/ts/internet.hpp", + "external/sources/boost/asio/ts/io_context.hpp", + "external/sources/boost/asio/ts/net.hpp", + "external/sources/boost/asio/ts/netfwd.hpp", + "external/sources/boost/asio/ts/socket.hpp", + "external/sources/boost/asio/ts/timer.hpp", + "external/sources/boost/asio/unyield.hpp", + "external/sources/boost/asio/use_awaitable.hpp", + "external/sources/boost/asio/use_future.hpp", + "external/sources/boost/asio/uses_executor.hpp", + "external/sources/boost/asio/version.hpp", + "external/sources/boost/asio/wait_traits.hpp", + "external/sources/boost/asio/windows/basic_object_handle.hpp", + "external/sources/boost/asio/windows/basic_overlapped_handle.hpp", + "external/sources/boost/asio/windows/basic_random_access_handle.hpp", + "external/sources/boost/asio/windows/basic_stream_handle.hpp", + "external/sources/boost/asio/windows/object_handle.hpp", + "external/sources/boost/asio/windows/overlapped_handle.hpp", + "external/sources/boost/asio/windows/overlapped_ptr.hpp", + "external/sources/boost/asio/windows/random_access_handle.hpp", + "external/sources/boost/asio/windows/stream_handle.hpp", + "external/sources/boost/asio/write.hpp", + "external/sources/boost/asio/write_at.hpp", + "external/sources/boost/asio/yield.hpp", + "external/sources/boost/assert.hpp", + "external/sources/boost/assert/source_location.hpp", + "external/sources/boost/assign.hpp", + "external/sources/boost/assign/assignment_exception.hpp", + "external/sources/boost/assign/list_inserter.hpp", + "external/sources/boost/assign/list_of.hpp", + "external/sources/boost/assign/ptr_list_inserter.hpp", + "external/sources/boost/assign/ptr_list_of.hpp", + "external/sources/boost/assign/ptr_map_inserter.hpp", + "external/sources/boost/assign/std.hpp", + "external/sources/boost/assign/std/deque.hpp", + "external/sources/boost/assign/std/list.hpp", + "external/sources/boost/assign/std/map.hpp", + "external/sources/boost/assign/std/queue.hpp", + "external/sources/boost/assign/std/set.hpp", + "external/sources/boost/assign/std/slist.hpp", + "external/sources/boost/assign/std/stack.hpp", + "external/sources/boost/assign/std/vector.hpp", + "external/sources/boost/atomic.hpp", + "external/sources/boost/atomic/atomic.hpp", + "external/sources/boost/atomic/atomic_flag.hpp", + "external/sources/boost/atomic/atomic_ref.hpp", + "external/sources/boost/atomic/capabilities.hpp", + "external/sources/boost/atomic/detail/addressof.hpp", + "external/sources/boost/atomic/detail/aligned_variable.hpp", + "external/sources/boost/atomic/detail/atomic_flag_impl.hpp", + "external/sources/boost/atomic/detail/atomic_impl.hpp", + "external/sources/boost/atomic/detail/atomic_ref_impl.hpp", + "external/sources/boost/atomic/detail/bitwise_cast.hpp", + "external/sources/boost/atomic/detail/bitwise_fp_cast.hpp", + "external/sources/boost/atomic/detail/capabilities.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_aarch32.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_aarch64.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_alpha.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_arm.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_ppc.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_sparc.hpp", + "external/sources/boost/atomic/detail/caps_arch_gcc_x86.hpp", + "external/sources/boost/atomic/detail/caps_arch_msvc_arm.hpp", + "external/sources/boost/atomic/detail/caps_arch_msvc_x86.hpp", + "external/sources/boost/atomic/detail/caps_gcc_atomic.hpp", + "external/sources/boost/atomic/detail/caps_gcc_sync.hpp", + "external/sources/boost/atomic/detail/caps_linux_arm.hpp", + "external/sources/boost/atomic/detail/caps_windows.hpp", + "external/sources/boost/atomic/detail/cas_based_exchange.hpp", + "external/sources/boost/atomic/detail/classify.hpp", + "external/sources/boost/atomic/detail/config.hpp", + "external/sources/boost/atomic/detail/core_arch_operations.hpp", + "external/sources/boost/atomic/detail/core_arch_operations_fwd.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_aarch32.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_aarch64.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_alpha.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_arm.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_ppc.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_sparc.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_gcc_x86.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_msvc_arm.hpp", + "external/sources/boost/atomic/detail/core_arch_ops_msvc_x86.hpp", + "external/sources/boost/atomic/detail/core_operations.hpp", + "external/sources/boost/atomic/detail/core_operations_emulated.hpp", + "external/sources/boost/atomic/detail/core_operations_emulated_fwd.hpp", + "external/sources/boost/atomic/detail/core_operations_fwd.hpp", + "external/sources/boost/atomic/detail/core_ops_cas_based.hpp", + "external/sources/boost/atomic/detail/core_ops_gcc_atomic.hpp", + "external/sources/boost/atomic/detail/core_ops_gcc_sync.hpp", + "external/sources/boost/atomic/detail/core_ops_linux_arm.hpp", + "external/sources/boost/atomic/detail/core_ops_windows.hpp", + "external/sources/boost/atomic/detail/extending_cas_based_arithmetic.hpp", + "external/sources/boost/atomic/detail/extra_fp_operations.hpp", + "external/sources/boost/atomic/detail/extra_fp_operations_fwd.hpp", + "external/sources/boost/atomic/detail/extra_fp_ops_emulated.hpp", + "external/sources/boost/atomic/detail/extra_fp_ops_generic.hpp", + "external/sources/boost/atomic/detail/extra_operations.hpp", + "external/sources/boost/atomic/detail/extra_operations_fwd.hpp", + "external/sources/boost/atomic/detail/extra_ops_emulated.hpp", + "external/sources/boost/atomic/detail/extra_ops_gcc_aarch32.hpp", + "external/sources/boost/atomic/detail/extra_ops_gcc_aarch64.hpp", + "external/sources/boost/atomic/detail/extra_ops_gcc_arm.hpp", + "external/sources/boost/atomic/detail/extra_ops_gcc_ppc.hpp", + "external/sources/boost/atomic/detail/extra_ops_gcc_x86.hpp", + "external/sources/boost/atomic/detail/extra_ops_generic.hpp", + "external/sources/boost/atomic/detail/extra_ops_msvc_arm.hpp", + "external/sources/boost/atomic/detail/extra_ops_msvc_x86.hpp", + "external/sources/boost/atomic/detail/fence_arch_operations.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_aarch32.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_aarch64.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_alpha.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_arm.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_ppc.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_sparc.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_gcc_x86.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_msvc_arm.hpp", + "external/sources/boost/atomic/detail/fence_arch_ops_msvc_x86.hpp", + "external/sources/boost/atomic/detail/fence_operations.hpp", + "external/sources/boost/atomic/detail/fence_operations_emulated.hpp", + "external/sources/boost/atomic/detail/fence_ops_gcc_atomic.hpp", + "external/sources/boost/atomic/detail/fence_ops_gcc_sync.hpp", + "external/sources/boost/atomic/detail/fence_ops_linux_arm.hpp", + "external/sources/boost/atomic/detail/fence_ops_windows.hpp", + "external/sources/boost/atomic/detail/float_sizes.hpp", + "external/sources/boost/atomic/detail/footer.hpp", + "external/sources/boost/atomic/detail/fp_operations.hpp", + "external/sources/boost/atomic/detail/fp_operations_fwd.hpp", + "external/sources/boost/atomic/detail/fp_ops_emulated.hpp", + "external/sources/boost/atomic/detail/fp_ops_generic.hpp", + "external/sources/boost/atomic/detail/futex.hpp", + "external/sources/boost/atomic/detail/gcc_arm_asm_common.hpp", + "external/sources/boost/atomic/detail/gcc_atomic_memory_order_utils.hpp", + "external/sources/boost/atomic/detail/header.hpp", + "external/sources/boost/atomic/detail/int_sizes.hpp", + "external/sources/boost/atomic/detail/integral_conversions.hpp", + "external/sources/boost/atomic/detail/interlocked.hpp", + "external/sources/boost/atomic/detail/intptr.hpp", + "external/sources/boost/atomic/detail/link.hpp", + "external/sources/boost/atomic/detail/lock_pool.hpp", + "external/sources/boost/atomic/detail/memory_order_utils.hpp", + "external/sources/boost/atomic/detail/once_flag.hpp", + "external/sources/boost/atomic/detail/ops_gcc_aarch32_common.hpp", + "external/sources/boost/atomic/detail/ops_gcc_aarch64_common.hpp", + "external/sources/boost/atomic/detail/ops_gcc_arm_common.hpp", + "external/sources/boost/atomic/detail/ops_gcc_ppc_common.hpp", + "external/sources/boost/atomic/detail/ops_msvc_common.hpp", + "external/sources/boost/atomic/detail/pause.hpp", + "external/sources/boost/atomic/detail/platform.hpp", + "external/sources/boost/atomic/detail/storage_traits.hpp", + "external/sources/boost/atomic/detail/string_ops.hpp", + "external/sources/boost/atomic/detail/type_traits/alignment_of.hpp", + "external/sources/boost/atomic/detail/type_traits/conditional.hpp", + "external/sources/boost/atomic/detail/type_traits/integral_constant.hpp", + "external/sources/boost/atomic/detail/type_traits/is_floating_point.hpp", + "external/sources/boost/atomic/detail/type_traits/is_function.hpp", + "external/sources/boost/atomic/detail/type_traits/is_iec559.hpp", + "external/sources/boost/atomic/detail/type_traits/is_integral.hpp", + "external/sources/boost/atomic/detail/type_traits/is_signed.hpp", + "external/sources/boost/atomic/detail/type_traits/is_trivially_copyable.hpp", + "external/sources/boost/atomic/detail/type_traits/is_trivially_default_constructible.hpp", + "external/sources/boost/atomic/detail/type_traits/make_signed.hpp", + "external/sources/boost/atomic/detail/type_traits/make_unsigned.hpp", + "external/sources/boost/atomic/detail/wait_capabilities.hpp", + "external/sources/boost/atomic/detail/wait_caps_dragonfly_umtx.hpp", + "external/sources/boost/atomic/detail/wait_caps_freebsd_umtx.hpp", + "external/sources/boost/atomic/detail/wait_caps_futex.hpp", + "external/sources/boost/atomic/detail/wait_caps_windows.hpp", + "external/sources/boost/atomic/detail/wait_operations.hpp", + "external/sources/boost/atomic/detail/wait_operations_fwd.hpp", + "external/sources/boost/atomic/detail/wait_ops_dragonfly_umtx.hpp", + "external/sources/boost/atomic/detail/wait_ops_emulated.hpp", + "external/sources/boost/atomic/detail/wait_ops_freebsd_umtx.hpp", + "external/sources/boost/atomic/detail/wait_ops_futex.hpp", + "external/sources/boost/atomic/detail/wait_ops_generic.hpp", + "external/sources/boost/atomic/detail/wait_ops_windows.hpp", + "external/sources/boost/atomic/fences.hpp", + "external/sources/boost/atomic/ipc_atomic.hpp", + "external/sources/boost/atomic/ipc_atomic_flag.hpp", + "external/sources/boost/atomic/ipc_atomic_ref.hpp", + "external/sources/boost/beast.hpp", + "external/sources/boost/beast/_experimental/http/icy_stream.hpp", + "external/sources/boost/beast/_experimental/http/impl/icy_stream.hpp", + "external/sources/boost/beast/_experimental/test/error.hpp", + "external/sources/boost/beast/_experimental/test/fail_count.hpp", + "external/sources/boost/beast/_experimental/test/handler.hpp", + "external/sources/boost/beast/_experimental/test/impl/error.hpp", + "external/sources/boost/beast/_experimental/test/impl/error.ipp", + "external/sources/boost/beast/_experimental/test/impl/fail_count.ipp", + "external/sources/boost/beast/_experimental/test/impl/stream.hpp", + "external/sources/boost/beast/_experimental/test/impl/stream.ipp", + "external/sources/boost/beast/_experimental/test/stream.hpp", + "external/sources/boost/beast/_experimental/test/tcp.hpp", + "external/sources/boost/beast/_experimental/unit_test/amount.hpp", + "external/sources/boost/beast/_experimental/unit_test/detail/const_container.hpp", + "external/sources/boost/beast/_experimental/unit_test/dstream.hpp", + "external/sources/boost/beast/_experimental/unit_test/global_suites.hpp", + "external/sources/boost/beast/_experimental/unit_test/main.ipp", + "external/sources/boost/beast/_experimental/unit_test/match.hpp", + "external/sources/boost/beast/_experimental/unit_test/recorder.hpp", + "external/sources/boost/beast/_experimental/unit_test/reporter.hpp", + "external/sources/boost/beast/_experimental/unit_test/results.hpp", + "external/sources/boost/beast/_experimental/unit_test/runner.hpp", + "external/sources/boost/beast/_experimental/unit_test/suite.hpp", + "external/sources/boost/beast/_experimental/unit_test/suite_info.hpp", + "external/sources/boost/beast/_experimental/unit_test/suite_list.hpp", + "external/sources/boost/beast/core.hpp", + "external/sources/boost/beast/core/async_base.hpp", + "external/sources/boost/beast/core/basic_stream.hpp", + "external/sources/boost/beast/core/bind_handler.hpp", + "external/sources/boost/beast/core/buffer_traits.hpp", + "external/sources/boost/beast/core/buffered_read_stream.hpp", + "external/sources/boost/beast/core/buffers_adaptor.hpp", + "external/sources/boost/beast/core/buffers_cat.hpp", + "external/sources/boost/beast/core/buffers_prefix.hpp", + "external/sources/boost/beast/core/buffers_range.hpp", + "external/sources/boost/beast/core/buffers_suffix.hpp", + "external/sources/boost/beast/core/buffers_to_string.hpp", + "external/sources/boost/beast/core/detail/allocator.hpp", + "external/sources/boost/beast/core/detail/async_base.hpp", + "external/sources/boost/beast/core/detail/base64.hpp", + "external/sources/boost/beast/core/detail/base64.ipp", + "external/sources/boost/beast/core/detail/bind_continuation.hpp", + "external/sources/boost/beast/core/detail/bind_default_executor.hpp", + "external/sources/boost/beast/core/detail/bind_handler.hpp", + "external/sources/boost/beast/core/detail/buffer.hpp", + "external/sources/boost/beast/core/detail/buffer_traits.hpp", + "external/sources/boost/beast/core/detail/buffers_pair.hpp", + "external/sources/boost/beast/core/detail/buffers_range_adaptor.hpp", + "external/sources/boost/beast/core/detail/buffers_ref.hpp", + "external/sources/boost/beast/core/detail/chacha.hpp", + "external/sources/boost/beast/core/detail/char_buffer.hpp", + "external/sources/boost/beast/core/detail/clamp.hpp", + "external/sources/boost/beast/core/detail/config.hpp", + "external/sources/boost/beast/core/detail/cpu_info.hpp", + "external/sources/boost/beast/core/detail/flat_stream.hpp", + "external/sources/boost/beast/core/detail/get_io_context.hpp", + "external/sources/boost/beast/core/detail/impl/read.hpp", + "external/sources/boost/beast/core/detail/impl/temporary_buffer.ipp", + "external/sources/boost/beast/core/detail/is_invocable.hpp", + "external/sources/boost/beast/core/detail/ostream.hpp", + "external/sources/boost/beast/core/detail/pcg.hpp", + "external/sources/boost/beast/core/detail/read.hpp", + "external/sources/boost/beast/core/detail/remap_post_to_defer.hpp", + "external/sources/boost/beast/core/detail/service_base.hpp", + "external/sources/boost/beast/core/detail/sha1.hpp", + "external/sources/boost/beast/core/detail/sha1.ipp", + "external/sources/boost/beast/core/detail/static_const.hpp", + "external/sources/boost/beast/core/detail/static_ostream.hpp", + "external/sources/boost/beast/core/detail/static_string.hpp", + "external/sources/boost/beast/core/detail/stream_base.hpp", + "external/sources/boost/beast/core/detail/stream_traits.hpp", + "external/sources/boost/beast/core/detail/string.hpp", + "external/sources/boost/beast/core/detail/temporary_buffer.hpp", + "external/sources/boost/beast/core/detail/tuple.hpp", + "external/sources/boost/beast/core/detail/type_traits.hpp", + "external/sources/boost/beast/core/detail/variant.hpp", + "external/sources/boost/beast/core/detail/varint.hpp", + "external/sources/boost/beast/core/detail/win32_unicode_path.hpp", + "external/sources/boost/beast/core/detail/work_guard.hpp", + "external/sources/boost/beast/core/detect_ssl.hpp", + "external/sources/boost/beast/core/error.hpp", + "external/sources/boost/beast/core/file.hpp", + "external/sources/boost/beast/core/file_base.hpp", + "external/sources/boost/beast/core/file_posix.hpp", + "external/sources/boost/beast/core/file_stdio.hpp", + "external/sources/boost/beast/core/file_win32.hpp", + "external/sources/boost/beast/core/flat_buffer.hpp", + "external/sources/boost/beast/core/flat_static_buffer.hpp", + "external/sources/boost/beast/core/flat_stream.hpp", + "external/sources/boost/beast/core/impl/async_base.hpp", + "external/sources/boost/beast/core/impl/basic_stream.hpp", + "external/sources/boost/beast/core/impl/buffered_read_stream.hpp", + "external/sources/boost/beast/core/impl/buffers_adaptor.hpp", + "external/sources/boost/beast/core/impl/buffers_cat.hpp", + "external/sources/boost/beast/core/impl/buffers_prefix.hpp", + "external/sources/boost/beast/core/impl/buffers_suffix.hpp", + "external/sources/boost/beast/core/impl/error.hpp", + "external/sources/boost/beast/core/impl/error.ipp", + "external/sources/boost/beast/core/impl/file_posix.ipp", + "external/sources/boost/beast/core/impl/file_stdio.ipp", + "external/sources/boost/beast/core/impl/file_win32.ipp", + "external/sources/boost/beast/core/impl/flat_buffer.hpp", + "external/sources/boost/beast/core/impl/flat_static_buffer.hpp", + "external/sources/boost/beast/core/impl/flat_static_buffer.ipp", + "external/sources/boost/beast/core/impl/flat_stream.hpp", + "external/sources/boost/beast/core/impl/multi_buffer.hpp", + "external/sources/boost/beast/core/impl/read_size.hpp", + "external/sources/boost/beast/core/impl/saved_handler.hpp", + "external/sources/boost/beast/core/impl/saved_handler.ipp", + "external/sources/boost/beast/core/impl/static_buffer.hpp", + "external/sources/boost/beast/core/impl/static_buffer.ipp", + "external/sources/boost/beast/core/impl/static_string.hpp", + "external/sources/boost/beast/core/impl/string.ipp", + "external/sources/boost/beast/core/impl/string_param.hpp", + "external/sources/boost/beast/core/make_printable.hpp", + "external/sources/boost/beast/core/multi_buffer.hpp", + "external/sources/boost/beast/core/ostream.hpp", + "external/sources/boost/beast/core/rate_policy.hpp", + "external/sources/boost/beast/core/read_size.hpp", + "external/sources/boost/beast/core/role.hpp", + "external/sources/boost/beast/core/saved_handler.hpp", + "external/sources/boost/beast/core/span.hpp", + "external/sources/boost/beast/core/static_buffer.hpp", + "external/sources/boost/beast/core/static_string.hpp", + "external/sources/boost/beast/core/stream_traits.hpp", + "external/sources/boost/beast/core/string.hpp", + "external/sources/boost/beast/core/string_param.hpp", + "external/sources/boost/beast/core/string_type.hpp", + "external/sources/boost/beast/core/tcp_stream.hpp", + "external/sources/boost/beast/http.hpp", + "external/sources/boost/beast/http/basic_dynamic_body.hpp", + "external/sources/boost/beast/http/basic_file_body.hpp", + "external/sources/boost/beast/http/basic_parser.hpp", + "external/sources/boost/beast/http/buffer_body.hpp", + "external/sources/boost/beast/http/chunk_encode.hpp", + "external/sources/boost/beast/http/detail/basic_parsed_list.hpp", + "external/sources/boost/beast/http/detail/basic_parser.hpp", + "external/sources/boost/beast/http/detail/basic_parser.ipp", + "external/sources/boost/beast/http/detail/chunk_encode.hpp", + "external/sources/boost/beast/http/detail/rfc7230.hpp", + "external/sources/boost/beast/http/detail/rfc7230.ipp", + "external/sources/boost/beast/http/detail/type_traits.hpp", + "external/sources/boost/beast/http/dynamic_body.hpp", + "external/sources/boost/beast/http/empty_body.hpp", + "external/sources/boost/beast/http/error.hpp", + "external/sources/boost/beast/http/field.hpp", + "external/sources/boost/beast/http/fields.hpp", + "external/sources/boost/beast/http/file_body.hpp", + "external/sources/boost/beast/http/impl/basic_parser.hpp", + "external/sources/boost/beast/http/impl/basic_parser.ipp", + "external/sources/boost/beast/http/impl/chunk_encode.hpp", + "external/sources/boost/beast/http/impl/error.hpp", + "external/sources/boost/beast/http/impl/error.ipp", + "external/sources/boost/beast/http/impl/field.ipp", + "external/sources/boost/beast/http/impl/fields.hpp", + "external/sources/boost/beast/http/impl/fields.ipp", + "external/sources/boost/beast/http/impl/file_body_win32.hpp", + "external/sources/boost/beast/http/impl/message.hpp", + "external/sources/boost/beast/http/impl/parser.hpp", + "external/sources/boost/beast/http/impl/read.hpp", + "external/sources/boost/beast/http/impl/rfc7230.hpp", + "external/sources/boost/beast/http/impl/rfc7230.ipp", + "external/sources/boost/beast/http/impl/serializer.hpp", + "external/sources/boost/beast/http/impl/status.ipp", + "external/sources/boost/beast/http/impl/verb.ipp", + "external/sources/boost/beast/http/impl/write.hpp", + "external/sources/boost/beast/http/message.hpp", + "external/sources/boost/beast/http/parser.hpp", + "external/sources/boost/beast/http/read.hpp", + "external/sources/boost/beast/http/rfc7230.hpp", + "external/sources/boost/beast/http/serializer.hpp", + "external/sources/boost/beast/http/span_body.hpp", + "external/sources/boost/beast/http/status.hpp", + "external/sources/boost/beast/http/string_body.hpp", + "external/sources/boost/beast/http/type_traits.hpp", + "external/sources/boost/beast/http/vector_body.hpp", + "external/sources/boost/beast/http/verb.hpp", + "external/sources/boost/beast/http/write.hpp", + "external/sources/boost/beast/src.hpp", + "external/sources/boost/beast/ssl.hpp", + "external/sources/boost/beast/ssl/ssl_stream.hpp", + "external/sources/boost/beast/version.hpp", + "external/sources/boost/beast/websocket.hpp", + "external/sources/boost/beast/websocket/detail/decorator.hpp", + "external/sources/boost/beast/websocket/detail/frame.hpp", + "external/sources/boost/beast/websocket/detail/hybi13.hpp", + "external/sources/boost/beast/websocket/detail/hybi13.ipp", + "external/sources/boost/beast/websocket/detail/impl_base.hpp", + "external/sources/boost/beast/websocket/detail/mask.hpp", + "external/sources/boost/beast/websocket/detail/mask.ipp", + "external/sources/boost/beast/websocket/detail/pmd_extension.hpp", + "external/sources/boost/beast/websocket/detail/pmd_extension.ipp", + "external/sources/boost/beast/websocket/detail/prng.hpp", + "external/sources/boost/beast/websocket/detail/prng.ipp", + "external/sources/boost/beast/websocket/detail/service.hpp", + "external/sources/boost/beast/websocket/detail/service.ipp", + "external/sources/boost/beast/websocket/detail/soft_mutex.hpp", + "external/sources/boost/beast/websocket/detail/type_traits.hpp", + "external/sources/boost/beast/websocket/detail/utf8_checker.hpp", + "external/sources/boost/beast/websocket/detail/utf8_checker.ipp", + "external/sources/boost/beast/websocket/error.hpp", + "external/sources/boost/beast/websocket/impl/accept.hpp", + "external/sources/boost/beast/websocket/impl/close.hpp", + "external/sources/boost/beast/websocket/impl/error.hpp", + "external/sources/boost/beast/websocket/impl/error.ipp", + "external/sources/boost/beast/websocket/impl/handshake.hpp", + "external/sources/boost/beast/websocket/impl/ping.hpp", + "external/sources/boost/beast/websocket/impl/read.hpp", + "external/sources/boost/beast/websocket/impl/rfc6455.hpp", + "external/sources/boost/beast/websocket/impl/ssl.hpp", + "external/sources/boost/beast/websocket/impl/stream.hpp", + "external/sources/boost/beast/websocket/impl/stream_impl.hpp", + "external/sources/boost/beast/websocket/impl/teardown.hpp", + "external/sources/boost/beast/websocket/impl/write.hpp", + "external/sources/boost/beast/websocket/option.hpp", + "external/sources/boost/beast/websocket/rfc6455.hpp", + "external/sources/boost/beast/websocket/ssl.hpp", + "external/sources/boost/beast/websocket/stream.hpp", + "external/sources/boost/beast/websocket/stream_base.hpp", + "external/sources/boost/beast/websocket/stream_fwd.hpp", + "external/sources/boost/beast/websocket/teardown.hpp", + "external/sources/boost/beast/zlib.hpp", + "external/sources/boost/beast/zlib/deflate_stream.hpp", + "external/sources/boost/beast/zlib/detail/bitstream.hpp", + "external/sources/boost/beast/zlib/detail/deflate_stream.hpp", + "external/sources/boost/beast/zlib/detail/deflate_stream.ipp", + "external/sources/boost/beast/zlib/detail/inflate_stream.hpp", + "external/sources/boost/beast/zlib/detail/inflate_stream.ipp", + "external/sources/boost/beast/zlib/detail/ranges.hpp", + "external/sources/boost/beast/zlib/detail/window.hpp", + "external/sources/boost/beast/zlib/error.hpp", + "external/sources/boost/beast/zlib/impl/error.hpp", + "external/sources/boost/beast/zlib/impl/error.ipp", + "external/sources/boost/beast/zlib/inflate_stream.hpp", + "external/sources/boost/beast/zlib/zlib.hpp", + "external/sources/boost/bimap.hpp", + "external/sources/boost/bimap/bimap.hpp", + "external/sources/boost/bimap/container_adaptor/associative_container_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/container_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/detail/comparison_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/detail/functor_bag.hpp", + "external/sources/boost/bimap/container_adaptor/detail/identity_converters.hpp", + "external/sources/boost/bimap/container_adaptor/detail/key_extractor.hpp", + "external/sources/boost/bimap/container_adaptor/detail/non_unique_container_helper.hpp", + "external/sources/boost/bimap/container_adaptor/list_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/list_map_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/map_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/multimap_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/multiset_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/ordered_associative_container_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/sequence_container_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/set_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/support/iterator_facade_converters.hpp", + "external/sources/boost/bimap/container_adaptor/unordered_associative_container_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/unordered_map_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/unordered_multiset_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/unordered_set_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/vector_adaptor.hpp", + "external/sources/boost/bimap/container_adaptor/vector_map_adaptor.hpp", + "external/sources/boost/bimap/detail/bimap_core.hpp", + "external/sources/boost/bimap/detail/concept_tags.hpp", + "external/sources/boost/bimap/detail/generate_index_binder.hpp", + "external/sources/boost/bimap/detail/generate_relation_binder.hpp", + "external/sources/boost/bimap/detail/generate_view_binder.hpp", + "external/sources/boost/bimap/detail/is_set_type_of.hpp", + "external/sources/boost/bimap/detail/manage_additional_parameters.hpp", + "external/sources/boost/bimap/detail/manage_bimap_key.hpp", + "external/sources/boost/bimap/detail/map_view_base.hpp", + "external/sources/boost/bimap/detail/map_view_iterator.hpp", + "external/sources/boost/bimap/detail/modifier_adaptor.hpp", + "external/sources/boost/bimap/detail/non_unique_views_helper.hpp", + "external/sources/boost/bimap/detail/set_view_base.hpp", + "external/sources/boost/bimap/detail/set_view_iterator.hpp", + "external/sources/boost/bimap/detail/test/check_metadata.hpp", + "external/sources/boost/bimap/detail/user_interface_config.hpp", + "external/sources/boost/bimap/list_of.hpp", + "external/sources/boost/bimap/multiset_of.hpp", + "external/sources/boost/bimap/property_map/set_support.hpp", + "external/sources/boost/bimap/property_map/unordered_set_support.hpp", + "external/sources/boost/bimap/relation/detail/access_builder.hpp", + "external/sources/boost/bimap/relation/detail/metadata_access_builder.hpp", + "external/sources/boost/bimap/relation/detail/mutant.hpp", + "external/sources/boost/bimap/relation/detail/static_access_builder.hpp", + "external/sources/boost/bimap/relation/detail/to_mutable_relation_functor.hpp", + "external/sources/boost/bimap/relation/member_at.hpp", + "external/sources/boost/bimap/relation/mutant_relation.hpp", + "external/sources/boost/bimap/relation/pair_layout.hpp", + "external/sources/boost/bimap/relation/structured_pair.hpp", + "external/sources/boost/bimap/relation/support/data_extractor.hpp", + "external/sources/boost/bimap/relation/support/get.hpp", + "external/sources/boost/bimap/relation/support/get_pair_functor.hpp", + "external/sources/boost/bimap/relation/support/is_tag_of_member_at.hpp", + "external/sources/boost/bimap/relation/support/member_with_tag.hpp", + "external/sources/boost/bimap/relation/support/opposite_tag.hpp", + "external/sources/boost/bimap/relation/support/pair_by.hpp", + "external/sources/boost/bimap/relation/support/pair_type_by.hpp", + "external/sources/boost/bimap/relation/support/value_type_of.hpp", + "external/sources/boost/bimap/relation/symmetrical_base.hpp", + "external/sources/boost/bimap/set_of.hpp", + "external/sources/boost/bimap/support/data_type_by.hpp", + "external/sources/boost/bimap/support/iterator_type_by.hpp", + "external/sources/boost/bimap/support/key_type_by.hpp", + "external/sources/boost/bimap/support/lambda.hpp", + "external/sources/boost/bimap/support/map_by.hpp", + "external/sources/boost/bimap/support/map_type_by.hpp", + "external/sources/boost/bimap/support/value_type_by.hpp", + "external/sources/boost/bimap/unconstrained_set_of.hpp", + "external/sources/boost/bimap/unordered_multiset_of.hpp", + "external/sources/boost/bimap/unordered_set_of.hpp", + "external/sources/boost/bimap/vector_of.hpp", + "external/sources/boost/bimap/views/list_map_view.hpp", + "external/sources/boost/bimap/views/list_set_view.hpp", + "external/sources/boost/bimap/views/map_view.hpp", + "external/sources/boost/bimap/views/multimap_view.hpp", + "external/sources/boost/bimap/views/multiset_view.hpp", + "external/sources/boost/bimap/views/set_view.hpp", + "external/sources/boost/bimap/views/unconstrained_map_view.hpp", + "external/sources/boost/bimap/views/unconstrained_set_view.hpp", + "external/sources/boost/bimap/views/unordered_map_view.hpp", + "external/sources/boost/bimap/views/unordered_multimap_view.hpp", + "external/sources/boost/bimap/views/unordered_multiset_view.hpp", + "external/sources/boost/bimap/views/unordered_set_view.hpp", + "external/sources/boost/bimap/views/vector_map_view.hpp", + "external/sources/boost/bimap/views/vector_set_view.hpp", + "external/sources/boost/bind.hpp", + "external/sources/boost/bind/apply.hpp", + "external/sources/boost/bind/arg.hpp", + "external/sources/boost/bind/bind.hpp", + "external/sources/boost/bind/bind_cc.hpp", + "external/sources/boost/bind/bind_mf2_cc.hpp", + "external/sources/boost/bind/bind_mf_cc.hpp", + "external/sources/boost/bind/bind_template.hpp", + "external/sources/boost/bind/make_adaptable.hpp", + "external/sources/boost/bind/mem_fn.hpp", + "external/sources/boost/bind/mem_fn_cc.hpp", + "external/sources/boost/bind/mem_fn_template.hpp", + "external/sources/boost/bind/mem_fn_vw.hpp", + "external/sources/boost/bind/placeholders.hpp", + "external/sources/boost/bind/protect.hpp", + "external/sources/boost/bind/storage.hpp", + "external/sources/boost/blank.hpp", + "external/sources/boost/blank_fwd.hpp", + "external/sources/boost/call_traits.hpp", + "external/sources/boost/callable_traits.hpp", + "external/sources/boost/callable_traits/add_member_const.hpp", + "external/sources/boost/callable_traits/add_member_cv.hpp", + "external/sources/boost/callable_traits/add_member_lvalue_reference.hpp", + "external/sources/boost/callable_traits/add_member_rvalue_reference.hpp", + "external/sources/boost/callable_traits/add_member_volatile.hpp", + "external/sources/boost/callable_traits/add_noexcept.hpp", + "external/sources/boost/callable_traits/add_transaction_safe.hpp", + "external/sources/boost/callable_traits/add_varargs.hpp", + "external/sources/boost/callable_traits/apply_member_pointer.hpp", + "external/sources/boost/callable_traits/apply_return.hpp", + "external/sources/boost/callable_traits/args.hpp", + "external/sources/boost/callable_traits/class_of.hpp", + "external/sources/boost/callable_traits/detail/config.hpp", + "external/sources/boost/callable_traits/detail/core.hpp", + "external/sources/boost/callable_traits/detail/default_callable_traits.hpp", + "external/sources/boost/callable_traits/detail/forward_declarations.hpp", + "external/sources/boost/callable_traits/detail/function.hpp", + "external/sources/boost/callable_traits/detail/function_object.hpp", + "external/sources/boost/callable_traits/detail/is_invocable_impl.hpp", + "external/sources/boost/callable_traits/detail/parameter_index_helper.hpp", + "external/sources/boost/callable_traits/detail/pmd.hpp", + "external/sources/boost/callable_traits/detail/pmf.hpp", + "external/sources/boost/callable_traits/detail/polyfills/disjunction.hpp", + "external/sources/boost/callable_traits/detail/polyfills/make_index_sequence.hpp", + "external/sources/boost/callable_traits/detail/qualifier_flags.hpp", + "external/sources/boost/callable_traits/detail/set_function_qualifiers.hpp", + "external/sources/boost/callable_traits/detail/sfinae_errors.hpp", + "external/sources/boost/callable_traits/detail/traits.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_2.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_3.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_ptr.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_ptr_2.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_ptr_3.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_ptr_varargs.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_ptr_varargs_2.hpp", + "external/sources/boost/callable_traits/detail/unguarded/function_ptr_varargs_3.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_2.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_3.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_4.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_varargs.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_varargs_2.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_varargs_3.hpp", + "external/sources/boost/callable_traits/detail/unguarded/pmf_varargs_4.hpp", + "external/sources/boost/callable_traits/detail/utility.hpp", + "external/sources/boost/callable_traits/function_type.hpp", + "external/sources/boost/callable_traits/has_member_qualifiers.hpp", + "external/sources/boost/callable_traits/has_varargs.hpp", + "external/sources/boost/callable_traits/has_void_return.hpp", + "external/sources/boost/callable_traits/is_const_member.hpp", + "external/sources/boost/callable_traits/is_cv_member.hpp", + "external/sources/boost/callable_traits/is_invocable.hpp", + "external/sources/boost/callable_traits/is_lvalue_reference_member.hpp", + "external/sources/boost/callable_traits/is_noexcept.hpp", + "external/sources/boost/callable_traits/is_reference_member.hpp", + "external/sources/boost/callable_traits/is_rvalue_reference_member.hpp", + "external/sources/boost/callable_traits/is_transaction_safe.hpp", + "external/sources/boost/callable_traits/is_volatile_member.hpp", + "external/sources/boost/callable_traits/qualified_class_of.hpp", + "external/sources/boost/callable_traits/remove_member_const.hpp", + "external/sources/boost/callable_traits/remove_member_cv.hpp", + "external/sources/boost/callable_traits/remove_member_reference.hpp", + "external/sources/boost/callable_traits/remove_member_volatile.hpp", + "external/sources/boost/callable_traits/remove_noexcept.hpp", + "external/sources/boost/callable_traits/remove_transaction_safe.hpp", + "external/sources/boost/callable_traits/remove_varargs.hpp", + "external/sources/boost/callable_traits/return_type.hpp", + "external/sources/boost/cast.hpp", + "external/sources/boost/cerrno.hpp", + "external/sources/boost/checked_delete.hpp", + "external/sources/boost/chrono.hpp", + "external/sources/boost/chrono/ceil.hpp", + "external/sources/boost/chrono/chrono.hpp", + "external/sources/boost/chrono/chrono_io.hpp", + "external/sources/boost/chrono/clock_string.hpp", + "external/sources/boost/chrono/config.hpp", + "external/sources/boost/chrono/detail/inlined/chrono.hpp", + "external/sources/boost/chrono/detail/inlined/mac/chrono.hpp", + "external/sources/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp", + "external/sources/boost/chrono/detail/inlined/mac/thread_clock.hpp", + "external/sources/boost/chrono/detail/inlined/posix/chrono.hpp", + "external/sources/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp", + "external/sources/boost/chrono/detail/inlined/posix/thread_clock.hpp", + "external/sources/boost/chrono/detail/inlined/process_cpu_clocks.hpp", + "external/sources/boost/chrono/detail/inlined/thread_clock.hpp", + "external/sources/boost/chrono/detail/inlined/win/chrono.hpp", + "external/sources/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp", + "external/sources/boost/chrono/detail/inlined/win/thread_clock.hpp", + "external/sources/boost/chrono/detail/is_evenly_divisible_by.hpp", + "external/sources/boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp", + "external/sources/boost/chrono/detail/scan_keyword.hpp", + "external/sources/boost/chrono/detail/static_assert.hpp", + "external/sources/boost/chrono/detail/system.hpp", + "external/sources/boost/chrono/duration.hpp", + "external/sources/boost/chrono/floor.hpp", + "external/sources/boost/chrono/include.hpp", + "external/sources/boost/chrono/io/duration_get.hpp", + "external/sources/boost/chrono/io/duration_io.hpp", + "external/sources/boost/chrono/io/duration_put.hpp", + "external/sources/boost/chrono/io/duration_style.hpp", + "external/sources/boost/chrono/io/duration_units.hpp", + "external/sources/boost/chrono/io/ios_base_state.hpp", + "external/sources/boost/chrono/io/time_point_get.hpp", + "external/sources/boost/chrono/io/time_point_io.hpp", + "external/sources/boost/chrono/io/time_point_put.hpp", + "external/sources/boost/chrono/io/time_point_units.hpp", + "external/sources/boost/chrono/io/timezone.hpp", + "external/sources/boost/chrono/io/utility/ios_base_state_ptr.hpp", + "external/sources/boost/chrono/io/utility/manip_base.hpp", + "external/sources/boost/chrono/io/utility/to_string.hpp", + "external/sources/boost/chrono/io_v1/chrono_io.hpp", + "external/sources/boost/chrono/process_cpu_clocks.hpp", + "external/sources/boost/chrono/round.hpp", + "external/sources/boost/chrono/system_clocks.hpp", + "external/sources/boost/chrono/thread_clock.hpp", + "external/sources/boost/chrono/time_point.hpp", + "external/sources/boost/chrono/typeof/boost/chrono/chrono.hpp", + "external/sources/boost/chrono/typeof/boost/ratio.hpp", + "external/sources/boost/circular_buffer.hpp", + "external/sources/boost/circular_buffer/base.hpp", + "external/sources/boost/circular_buffer/debug.hpp", + "external/sources/boost/circular_buffer/details.hpp", + "external/sources/boost/circular_buffer/space_optimized.hpp", + "external/sources/boost/circular_buffer_fwd.hpp", + "external/sources/boost/compatibility/cpp_c_headers/cassert", + "external/sources/boost/compatibility/cpp_c_headers/cctype", + "external/sources/boost/compatibility/cpp_c_headers/cerrno", + "external/sources/boost/compatibility/cpp_c_headers/cfloat", + "external/sources/boost/compatibility/cpp_c_headers/climits", + "external/sources/boost/compatibility/cpp_c_headers/clocale", + "external/sources/boost/compatibility/cpp_c_headers/cmath", + "external/sources/boost/compatibility/cpp_c_headers/csetjmp", + "external/sources/boost/compatibility/cpp_c_headers/csignal", + "external/sources/boost/compatibility/cpp_c_headers/cstdarg", + "external/sources/boost/compatibility/cpp_c_headers/cstddef", + "external/sources/boost/compatibility/cpp_c_headers/cstdio", + "external/sources/boost/compatibility/cpp_c_headers/cstdlib", + "external/sources/boost/compatibility/cpp_c_headers/cstring", + "external/sources/boost/compatibility/cpp_c_headers/ctime", + "external/sources/boost/compatibility/cpp_c_headers/cwchar", + "external/sources/boost/compatibility/cpp_c_headers/cwctype", + "external/sources/boost/compressed_pair.hpp", + "external/sources/boost/compute.hpp", + "external/sources/boost/compute/algorithm.hpp", + "external/sources/boost/compute/algorithm/accumulate.hpp", + "external/sources/boost/compute/algorithm/adjacent_difference.hpp", + "external/sources/boost/compute/algorithm/adjacent_find.hpp", + "external/sources/boost/compute/algorithm/all_of.hpp", + "external/sources/boost/compute/algorithm/any_of.hpp", + "external/sources/boost/compute/algorithm/binary_search.hpp", + "external/sources/boost/compute/algorithm/copy.hpp", + "external/sources/boost/compute/algorithm/copy_if.hpp", + "external/sources/boost/compute/algorithm/copy_n.hpp", + "external/sources/boost/compute/algorithm/count.hpp", + "external/sources/boost/compute/algorithm/count_if.hpp", + "external/sources/boost/compute/algorithm/detail/balanced_path.hpp", + "external/sources/boost/compute/algorithm/detail/binary_find.hpp", + "external/sources/boost/compute/algorithm/detail/compact.hpp", + "external/sources/boost/compute/algorithm/detail/copy_on_device.hpp", + "external/sources/boost/compute/algorithm/detail/copy_to_device.hpp", + "external/sources/boost/compute/algorithm/detail/copy_to_host.hpp", + "external/sources/boost/compute/algorithm/detail/count_if_with_ballot.hpp", + "external/sources/boost/compute/algorithm/detail/count_if_with_reduce.hpp", + "external/sources/boost/compute/algorithm/detail/count_if_with_threads.hpp", + "external/sources/boost/compute/algorithm/detail/find_extrema.hpp", + "external/sources/boost/compute/algorithm/detail/find_extrema_on_cpu.hpp", + "external/sources/boost/compute/algorithm/detail/find_extrema_with_atomics.hpp", + "external/sources/boost/compute/algorithm/detail/find_extrema_with_reduce.hpp", + "external/sources/boost/compute/algorithm/detail/find_if_with_atomics.hpp", + "external/sources/boost/compute/algorithm/detail/inplace_reduce.hpp", + "external/sources/boost/compute/algorithm/detail/insertion_sort.hpp", + "external/sources/boost/compute/algorithm/detail/merge_path.hpp", + "external/sources/boost/compute/algorithm/detail/merge_sort_on_cpu.hpp", + "external/sources/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp", + "external/sources/boost/compute/algorithm/detail/merge_with_merge_path.hpp", + "external/sources/boost/compute/algorithm/detail/radix_sort.hpp", + "external/sources/boost/compute/algorithm/detail/random_fill.hpp", + "external/sources/boost/compute/algorithm/detail/reduce_by_key.hpp", + "external/sources/boost/compute/algorithm/detail/reduce_by_key_with_scan.hpp", + "external/sources/boost/compute/algorithm/detail/reduce_on_cpu.hpp", + "external/sources/boost/compute/algorithm/detail/reduce_on_gpu.hpp", + "external/sources/boost/compute/algorithm/detail/scan.hpp", + "external/sources/boost/compute/algorithm/detail/scan_on_cpu.hpp", + "external/sources/boost/compute/algorithm/detail/scan_on_gpu.hpp", + "external/sources/boost/compute/algorithm/detail/search_all.hpp", + "external/sources/boost/compute/algorithm/detail/serial_accumulate.hpp", + "external/sources/boost/compute/algorithm/detail/serial_count_if.hpp", + "external/sources/boost/compute/algorithm/detail/serial_find_extrema.hpp", + "external/sources/boost/compute/algorithm/detail/serial_merge.hpp", + "external/sources/boost/compute/algorithm/detail/serial_reduce.hpp", + "external/sources/boost/compute/algorithm/detail/serial_reduce_by_key.hpp", + "external/sources/boost/compute/algorithm/detail/serial_scan.hpp", + "external/sources/boost/compute/algorithm/equal.hpp", + "external/sources/boost/compute/algorithm/equal_range.hpp", + "external/sources/boost/compute/algorithm/exclusive_scan.hpp", + "external/sources/boost/compute/algorithm/fill.hpp", + "external/sources/boost/compute/algorithm/fill_n.hpp", + "external/sources/boost/compute/algorithm/find.hpp", + "external/sources/boost/compute/algorithm/find_end.hpp", + "external/sources/boost/compute/algorithm/find_if.hpp", + "external/sources/boost/compute/algorithm/find_if_not.hpp", + "external/sources/boost/compute/algorithm/for_each.hpp", + "external/sources/boost/compute/algorithm/for_each_n.hpp", + "external/sources/boost/compute/algorithm/gather.hpp", + "external/sources/boost/compute/algorithm/generate.hpp", + "external/sources/boost/compute/algorithm/generate_n.hpp", + "external/sources/boost/compute/algorithm/includes.hpp", + "external/sources/boost/compute/algorithm/inclusive_scan.hpp", + "external/sources/boost/compute/algorithm/inner_product.hpp", + "external/sources/boost/compute/algorithm/inplace_merge.hpp", + "external/sources/boost/compute/algorithm/iota.hpp", + "external/sources/boost/compute/algorithm/is_partitioned.hpp", + "external/sources/boost/compute/algorithm/is_permutation.hpp", + "external/sources/boost/compute/algorithm/is_sorted.hpp", + "external/sources/boost/compute/algorithm/lexicographical_compare.hpp", + "external/sources/boost/compute/algorithm/lower_bound.hpp", + "external/sources/boost/compute/algorithm/max_element.hpp", + "external/sources/boost/compute/algorithm/merge.hpp", + "external/sources/boost/compute/algorithm/min_element.hpp", + "external/sources/boost/compute/algorithm/minmax_element.hpp", + "external/sources/boost/compute/algorithm/mismatch.hpp", + "external/sources/boost/compute/algorithm/next_permutation.hpp", + "external/sources/boost/compute/algorithm/none_of.hpp", + "external/sources/boost/compute/algorithm/nth_element.hpp", + "external/sources/boost/compute/algorithm/partial_sum.hpp", + "external/sources/boost/compute/algorithm/partition.hpp", + "external/sources/boost/compute/algorithm/partition_copy.hpp", + "external/sources/boost/compute/algorithm/partition_point.hpp", + "external/sources/boost/compute/algorithm/prev_permutation.hpp", + "external/sources/boost/compute/algorithm/random_shuffle.hpp", + "external/sources/boost/compute/algorithm/reduce.hpp", + "external/sources/boost/compute/algorithm/reduce_by_key.hpp", + "external/sources/boost/compute/algorithm/remove.hpp", + "external/sources/boost/compute/algorithm/remove_if.hpp", + "external/sources/boost/compute/algorithm/replace.hpp", + "external/sources/boost/compute/algorithm/replace_copy.hpp", + "external/sources/boost/compute/algorithm/reverse.hpp", + "external/sources/boost/compute/algorithm/reverse_copy.hpp", + "external/sources/boost/compute/algorithm/rotate.hpp", + "external/sources/boost/compute/algorithm/rotate_copy.hpp", + "external/sources/boost/compute/algorithm/scatter.hpp", + "external/sources/boost/compute/algorithm/scatter_if.hpp", + "external/sources/boost/compute/algorithm/search.hpp", + "external/sources/boost/compute/algorithm/search_n.hpp", + "external/sources/boost/compute/algorithm/set_difference.hpp", + "external/sources/boost/compute/algorithm/set_intersection.hpp", + "external/sources/boost/compute/algorithm/set_symmetric_difference.hpp", + "external/sources/boost/compute/algorithm/set_union.hpp", + "external/sources/boost/compute/algorithm/sort.hpp", + "external/sources/boost/compute/algorithm/sort_by_key.hpp", + "external/sources/boost/compute/algorithm/stable_partition.hpp", + "external/sources/boost/compute/algorithm/stable_sort.hpp", + "external/sources/boost/compute/algorithm/stable_sort_by_key.hpp", + "external/sources/boost/compute/algorithm/swap_ranges.hpp", + "external/sources/boost/compute/algorithm/transform.hpp", + "external/sources/boost/compute/algorithm/transform_if.hpp", + "external/sources/boost/compute/algorithm/transform_reduce.hpp", + "external/sources/boost/compute/algorithm/unique.hpp", + "external/sources/boost/compute/algorithm/unique_copy.hpp", + "external/sources/boost/compute/algorithm/upper_bound.hpp", + "external/sources/boost/compute/allocator.hpp", + "external/sources/boost/compute/allocator/buffer_allocator.hpp", + "external/sources/boost/compute/allocator/pinned_allocator.hpp", + "external/sources/boost/compute/async.hpp", + "external/sources/boost/compute/async/future.hpp", + "external/sources/boost/compute/async/wait.hpp", + "external/sources/boost/compute/async/wait_guard.hpp", + "external/sources/boost/compute/buffer.hpp", + "external/sources/boost/compute/cl.hpp", + "external/sources/boost/compute/cl_ext.hpp", + "external/sources/boost/compute/closure.hpp", + "external/sources/boost/compute/command_queue.hpp", + "external/sources/boost/compute/config.hpp", + "external/sources/boost/compute/container.hpp", + "external/sources/boost/compute/container/array.hpp", + "external/sources/boost/compute/container/basic_string.hpp", + "external/sources/boost/compute/container/detail/scalar.hpp", + "external/sources/boost/compute/container/dynamic_bitset.hpp", + "external/sources/boost/compute/container/flat_map.hpp", + "external/sources/boost/compute/container/flat_set.hpp", + "external/sources/boost/compute/container/mapped_view.hpp", + "external/sources/boost/compute/container/stack.hpp", + "external/sources/boost/compute/container/string.hpp", + "external/sources/boost/compute/container/valarray.hpp", + "external/sources/boost/compute/container/vector.hpp", + "external/sources/boost/compute/context.hpp", + "external/sources/boost/compute/core.hpp", + "external/sources/boost/compute/detail/assert_cl_success.hpp", + "external/sources/boost/compute/detail/buffer_value.hpp", + "external/sources/boost/compute/detail/cl_versions.hpp", + "external/sources/boost/compute/detail/device_ptr.hpp", + "external/sources/boost/compute/detail/diagnostic.hpp", + "external/sources/boost/compute/detail/duration.hpp", + "external/sources/boost/compute/detail/get_object_info.hpp", + "external/sources/boost/compute/detail/getenv.hpp", + "external/sources/boost/compute/detail/global_static.hpp", + "external/sources/boost/compute/detail/is_buffer_iterator.hpp", + "external/sources/boost/compute/detail/is_contiguous_iterator.hpp", + "external/sources/boost/compute/detail/iterator_plus_distance.hpp", + "external/sources/boost/compute/detail/iterator_range_size.hpp", + "external/sources/boost/compute/detail/iterator_traits.hpp", + "external/sources/boost/compute/detail/literal.hpp", + "external/sources/boost/compute/detail/lru_cache.hpp", + "external/sources/boost/compute/detail/meta_kernel.hpp", + "external/sources/boost/compute/detail/mpl_vector_to_tuple.hpp", + "external/sources/boost/compute/detail/nvidia_compute_capability.hpp", + "external/sources/boost/compute/detail/parameter_cache.hpp", + "external/sources/boost/compute/detail/path.hpp", + "external/sources/boost/compute/detail/print_range.hpp", + "external/sources/boost/compute/detail/read_write_single_value.hpp", + "external/sources/boost/compute/detail/sha1.hpp", + "external/sources/boost/compute/detail/variadic_macros.hpp", + "external/sources/boost/compute/detail/vendor.hpp", + "external/sources/boost/compute/detail/work_size.hpp", + "external/sources/boost/compute/device.hpp", + "external/sources/boost/compute/event.hpp", + "external/sources/boost/compute/exception.hpp", + "external/sources/boost/compute/exception/context_error.hpp", + "external/sources/boost/compute/exception/no_device_found.hpp", + "external/sources/boost/compute/exception/opencl_error.hpp", + "external/sources/boost/compute/exception/program_build_failure.hpp", + "external/sources/boost/compute/exception/unsupported_extension_error.hpp", + "external/sources/boost/compute/experimental/clamp_range.hpp", + "external/sources/boost/compute/experimental/malloc.hpp", + "external/sources/boost/compute/experimental/sort_by_transform.hpp", + "external/sources/boost/compute/experimental/tabulate.hpp", + "external/sources/boost/compute/function.hpp", + "external/sources/boost/compute/functional.hpp", + "external/sources/boost/compute/functional/as.hpp", + "external/sources/boost/compute/functional/atomic.hpp", + "external/sources/boost/compute/functional/bind.hpp", + "external/sources/boost/compute/functional/common.hpp", + "external/sources/boost/compute/functional/convert.hpp", + "external/sources/boost/compute/functional/detail/macros.hpp", + "external/sources/boost/compute/functional/detail/nvidia_ballot.hpp", + "external/sources/boost/compute/functional/detail/nvidia_popcount.hpp", + "external/sources/boost/compute/functional/detail/unpack.hpp", + "external/sources/boost/compute/functional/field.hpp", + "external/sources/boost/compute/functional/geometry.hpp", + "external/sources/boost/compute/functional/get.hpp", + "external/sources/boost/compute/functional/hash.hpp", + "external/sources/boost/compute/functional/identity.hpp", + "external/sources/boost/compute/functional/integer.hpp", + "external/sources/boost/compute/functional/logical.hpp", + "external/sources/boost/compute/functional/math.hpp", + "external/sources/boost/compute/functional/operator.hpp", + "external/sources/boost/compute/functional/popcount.hpp", + "external/sources/boost/compute/functional/relational.hpp", + "external/sources/boost/compute/image.hpp", + "external/sources/boost/compute/image/image1d.hpp", + "external/sources/boost/compute/image/image2d.hpp", + "external/sources/boost/compute/image/image3d.hpp", + "external/sources/boost/compute/image/image_format.hpp", + "external/sources/boost/compute/image/image_object.hpp", + "external/sources/boost/compute/image/image_sampler.hpp", + "external/sources/boost/compute/image2d.hpp", + "external/sources/boost/compute/image3d.hpp", + "external/sources/boost/compute/image_format.hpp", + "external/sources/boost/compute/image_sampler.hpp", + "external/sources/boost/compute/interop/eigen.hpp", + "external/sources/boost/compute/interop/eigen/core.hpp", + "external/sources/boost/compute/interop/opencv.hpp", + "external/sources/boost/compute/interop/opencv/core.hpp", + "external/sources/boost/compute/interop/opencv/highgui.hpp", + "external/sources/boost/compute/interop/opencv/ocl.hpp", + "external/sources/boost/compute/interop/opengl.hpp", + "external/sources/boost/compute/interop/opengl/acquire.hpp", + "external/sources/boost/compute/interop/opengl/cl_gl.hpp", + "external/sources/boost/compute/interop/opengl/cl_gl_ext.hpp", + "external/sources/boost/compute/interop/opengl/context.hpp", + "external/sources/boost/compute/interop/opengl/gl.hpp", + "external/sources/boost/compute/interop/opengl/opengl_buffer.hpp", + "external/sources/boost/compute/interop/opengl/opengl_renderbuffer.hpp", + "external/sources/boost/compute/interop/opengl/opengl_texture.hpp", + "external/sources/boost/compute/interop/qt.hpp", + "external/sources/boost/compute/interop/qt/qimage.hpp", + "external/sources/boost/compute/interop/qt/qpoint.hpp", + "external/sources/boost/compute/interop/qt/qpointf.hpp", + "external/sources/boost/compute/interop/qt/qtcore.hpp", + "external/sources/boost/compute/interop/qt/qtgui.hpp", + "external/sources/boost/compute/interop/qt/qvector.hpp", + "external/sources/boost/compute/interop/vtk.hpp", + "external/sources/boost/compute/interop/vtk/bounds.hpp", + "external/sources/boost/compute/interop/vtk/data_array.hpp", + "external/sources/boost/compute/interop/vtk/matrix4x4.hpp", + "external/sources/boost/compute/interop/vtk/points.hpp", + "external/sources/boost/compute/iterator.hpp", + "external/sources/boost/compute/iterator/buffer_iterator.hpp", + "external/sources/boost/compute/iterator/constant_buffer_iterator.hpp", + "external/sources/boost/compute/iterator/constant_iterator.hpp", + "external/sources/boost/compute/iterator/counting_iterator.hpp", + "external/sources/boost/compute/iterator/detail/get_base_iterator_buffer.hpp", + "external/sources/boost/compute/iterator/detail/swizzle_iterator.hpp", + "external/sources/boost/compute/iterator/discard_iterator.hpp", + "external/sources/boost/compute/iterator/function_input_iterator.hpp", + "external/sources/boost/compute/iterator/permutation_iterator.hpp", + "external/sources/boost/compute/iterator/strided_iterator.hpp", + "external/sources/boost/compute/iterator/transform_iterator.hpp", + "external/sources/boost/compute/iterator/zip_iterator.hpp", + "external/sources/boost/compute/kernel.hpp", + "external/sources/boost/compute/lambda.hpp", + "external/sources/boost/compute/lambda/context.hpp", + "external/sources/boost/compute/lambda/functional.hpp", + "external/sources/boost/compute/lambda/get.hpp", + "external/sources/boost/compute/lambda/make_pair.hpp", + "external/sources/boost/compute/lambda/make_tuple.hpp", + "external/sources/boost/compute/lambda/placeholder.hpp", + "external/sources/boost/compute/lambda/placeholders.hpp", + "external/sources/boost/compute/lambda/result_of.hpp", + "external/sources/boost/compute/memory.hpp", + "external/sources/boost/compute/memory/local_buffer.hpp", + "external/sources/boost/compute/memory/svm_ptr.hpp", + "external/sources/boost/compute/memory_object.hpp", + "external/sources/boost/compute/pipe.hpp", + "external/sources/boost/compute/platform.hpp", + "external/sources/boost/compute/program.hpp", + "external/sources/boost/compute/random.hpp", + "external/sources/boost/compute/random/bernoulli_distribution.hpp", + "external/sources/boost/compute/random/default_random_engine.hpp", + "external/sources/boost/compute/random/discrete_distribution.hpp", + "external/sources/boost/compute/random/linear_congruential_engine.hpp", + "external/sources/boost/compute/random/mersenne_twister_engine.hpp", + "external/sources/boost/compute/random/normal_distribution.hpp", + "external/sources/boost/compute/random/threefry_engine.hpp", + "external/sources/boost/compute/random/uniform_int_distribution.hpp", + "external/sources/boost/compute/random/uniform_real_distribution.hpp", + "external/sources/boost/compute/source.hpp", + "external/sources/boost/compute/svm.hpp", + "external/sources/boost/compute/system.hpp", + "external/sources/boost/compute/type_traits.hpp", + "external/sources/boost/compute/type_traits/common_type.hpp", + "external/sources/boost/compute/type_traits/detail/capture_traits.hpp", + "external/sources/boost/compute/type_traits/is_device_iterator.hpp", + "external/sources/boost/compute/type_traits/is_fundamental.hpp", + "external/sources/boost/compute/type_traits/is_vector_type.hpp", + "external/sources/boost/compute/type_traits/make_vector_type.hpp", + "external/sources/boost/compute/type_traits/result_of.hpp", + "external/sources/boost/compute/type_traits/scalar_type.hpp", + "external/sources/boost/compute/type_traits/type_definition.hpp", + "external/sources/boost/compute/type_traits/type_name.hpp", + "external/sources/boost/compute/type_traits/vector_size.hpp", + "external/sources/boost/compute/types.hpp", + "external/sources/boost/compute/types/builtin.hpp", + "external/sources/boost/compute/types/complex.hpp", + "external/sources/boost/compute/types/fundamental.hpp", + "external/sources/boost/compute/types/pair.hpp", + "external/sources/boost/compute/types/size_t.hpp", + "external/sources/boost/compute/types/struct.hpp", + "external/sources/boost/compute/types/tuple.hpp", + "external/sources/boost/compute/user_event.hpp", + "external/sources/boost/compute/utility.hpp", + "external/sources/boost/compute/utility/dim.hpp", + "external/sources/boost/compute/utility/extents.hpp", + "external/sources/boost/compute/utility/invoke.hpp", + "external/sources/boost/compute/utility/program_cache.hpp", + "external/sources/boost/compute/utility/source.hpp", + "external/sources/boost/compute/utility/wait_list.hpp", + "external/sources/boost/compute/version.hpp", + "external/sources/boost/compute/wait_list.hpp", + "external/sources/boost/concept/assert.hpp", + "external/sources/boost/concept/detail/backward_compatibility.hpp", + "external/sources/boost/concept/detail/borland.hpp", + "external/sources/boost/concept/detail/concept_def.hpp", + "external/sources/boost/concept/detail/concept_undef.hpp", + "external/sources/boost/concept/detail/general.hpp", + "external/sources/boost/concept/detail/has_constraints.hpp", + "external/sources/boost/concept/detail/msvc.hpp", + "external/sources/boost/concept/requires.hpp", + "external/sources/boost/concept/usage.hpp", + "external/sources/boost/concept_archetype.hpp", + "external/sources/boost/concept_check.hpp", + "external/sources/boost/concept_check/borland.hpp", + "external/sources/boost/concept_check/general.hpp", + "external/sources/boost/concept_check/has_constraints.hpp", + "external/sources/boost/concept_check/msvc.hpp", + "external/sources/boost/config.hpp", + "external/sources/boost/config/abi/borland_prefix.hpp", + "external/sources/boost/config/abi/borland_suffix.hpp", + "external/sources/boost/config/abi/msvc_prefix.hpp", + "external/sources/boost/config/abi/msvc_suffix.hpp", + "external/sources/boost/config/abi_prefix.hpp", + "external/sources/boost/config/abi_suffix.hpp", + "external/sources/boost/config/auto_link.hpp", + "external/sources/boost/config/compiler/borland.hpp", + "external/sources/boost/config/compiler/clang.hpp", + "external/sources/boost/config/compiler/codegear.hpp", + "external/sources/boost/config/compiler/comeau.hpp", + "external/sources/boost/config/compiler/common_edg.hpp", + "external/sources/boost/config/compiler/compaq_cxx.hpp", + "external/sources/boost/config/compiler/cray.hpp", + "external/sources/boost/config/compiler/diab.hpp", + "external/sources/boost/config/compiler/digitalmars.hpp", + "external/sources/boost/config/compiler/gcc.hpp", + "external/sources/boost/config/compiler/gcc_xml.hpp", + "external/sources/boost/config/compiler/greenhills.hpp", + "external/sources/boost/config/compiler/hp_acc.hpp", + "external/sources/boost/config/compiler/intel.hpp", + "external/sources/boost/config/compiler/kai.hpp", + "external/sources/boost/config/compiler/metrowerks.hpp", + "external/sources/boost/config/compiler/mpw.hpp", + "external/sources/boost/config/compiler/nvcc.hpp", + "external/sources/boost/config/compiler/pathscale.hpp", + "external/sources/boost/config/compiler/pgi.hpp", + "external/sources/boost/config/compiler/sgi_mipspro.hpp", + "external/sources/boost/config/compiler/sunpro_cc.hpp", + "external/sources/boost/config/compiler/vacpp.hpp", + "external/sources/boost/config/compiler/visualc.hpp", + "external/sources/boost/config/compiler/xlcpp.hpp", + "external/sources/boost/config/compiler/xlcpp_zos.hpp", + "external/sources/boost/config/detail/posix_features.hpp", + "external/sources/boost/config/detail/select_compiler_config.hpp", + "external/sources/boost/config/detail/select_platform_config.hpp", + "external/sources/boost/config/detail/select_stdlib_config.hpp", + "external/sources/boost/config/detail/suffix.hpp", + "external/sources/boost/config/header_deprecated.hpp", + "external/sources/boost/config/helper_macros.hpp", + "external/sources/boost/config/no_tr1/cmath.hpp", + "external/sources/boost/config/no_tr1/complex.hpp", + "external/sources/boost/config/no_tr1/functional.hpp", + "external/sources/boost/config/no_tr1/memory.hpp", + "external/sources/boost/config/no_tr1/utility.hpp", + "external/sources/boost/config/platform/aix.hpp", + "external/sources/boost/config/platform/amigaos.hpp", + "external/sources/boost/config/platform/beos.hpp", + "external/sources/boost/config/platform/bsd.hpp", + "external/sources/boost/config/platform/cloudabi.hpp", + "external/sources/boost/config/platform/cray.hpp", + "external/sources/boost/config/platform/cygwin.hpp", + "external/sources/boost/config/platform/haiku.hpp", + "external/sources/boost/config/platform/hpux.hpp", + "external/sources/boost/config/platform/irix.hpp", + "external/sources/boost/config/platform/linux.hpp", + "external/sources/boost/config/platform/macos.hpp", + "external/sources/boost/config/platform/qnxnto.hpp", + "external/sources/boost/config/platform/solaris.hpp", + "external/sources/boost/config/platform/symbian.hpp", + "external/sources/boost/config/platform/vms.hpp", + "external/sources/boost/config/platform/vxworks.hpp", + "external/sources/boost/config/platform/win32.hpp", + "external/sources/boost/config/platform/zos.hpp", + "external/sources/boost/config/pragma_message.hpp", + "external/sources/boost/config/requires_threads.hpp", + "external/sources/boost/config/stdlib/dinkumware.hpp", + "external/sources/boost/config/stdlib/libcomo.hpp", + "external/sources/boost/config/stdlib/libcpp.hpp", + "external/sources/boost/config/stdlib/libstdcpp3.hpp", + "external/sources/boost/config/stdlib/modena.hpp", + "external/sources/boost/config/stdlib/msl.hpp", + "external/sources/boost/config/stdlib/roguewave.hpp", + "external/sources/boost/config/stdlib/sgi.hpp", + "external/sources/boost/config/stdlib/stlport.hpp", + "external/sources/boost/config/stdlib/vacpp.hpp", + "external/sources/boost/config/stdlib/xlcpp_zos.hpp", + "external/sources/boost/config/user.hpp", + "external/sources/boost/config/warning_disable.hpp", + "external/sources/boost/config/workaround.hpp", + "external/sources/boost/container/adaptive_pool.hpp", + "external/sources/boost/container/allocator.hpp", + "external/sources/boost/container/allocator_traits.hpp", + "external/sources/boost/container/container_fwd.hpp", + "external/sources/boost/container/deque.hpp", + "external/sources/boost/container/detail/adaptive_node_pool.hpp", + "external/sources/boost/container/detail/adaptive_node_pool_impl.hpp", + "external/sources/boost/container/detail/addressof.hpp", + "external/sources/boost/container/detail/advanced_insert_int.hpp", + "external/sources/boost/container/detail/algorithm.hpp", + "external/sources/boost/container/detail/alloc_helpers.hpp", + "external/sources/boost/container/detail/alloc_lib.h", + "external/sources/boost/container/detail/allocation_type.hpp", + "external/sources/boost/container/detail/allocator_version_traits.hpp", + "external/sources/boost/container/detail/auto_link.hpp", + "external/sources/boost/container/detail/block_list.hpp", + "external/sources/boost/container/detail/block_slist.hpp", + "external/sources/boost/container/detail/compare_functors.hpp", + "external/sources/boost/container/detail/config_begin.hpp", + "external/sources/boost/container/detail/config_end.hpp", + "external/sources/boost/container/detail/construct_in_place.hpp", + "external/sources/boost/container/detail/container_or_allocator_rebind.hpp", + "external/sources/boost/container/detail/container_rebind.hpp", + "external/sources/boost/container/detail/copy_move_algo.hpp", + "external/sources/boost/container/detail/destroyers.hpp", + "external/sources/boost/container/detail/dispatch_uses_allocator.hpp", + "external/sources/boost/container/detail/dlmalloc.hpp", + "external/sources/boost/container/detail/flat_tree.hpp", + "external/sources/boost/container/detail/function_detector.hpp", + "external/sources/boost/container/detail/is_container.hpp", + "external/sources/boost/container/detail/is_contiguous_container.hpp", + "external/sources/boost/container/detail/is_sorted.hpp", + "external/sources/boost/container/detail/iterator.hpp", + "external/sources/boost/container/detail/iterator_to_raw_pointer.hpp", + "external/sources/boost/container/detail/iterators.hpp", + "external/sources/boost/container/detail/math_functions.hpp", + "external/sources/boost/container/detail/min_max.hpp", + "external/sources/boost/container/detail/minimal_char_traits_header.hpp", + "external/sources/boost/container/detail/mpl.hpp", + "external/sources/boost/container/detail/multiallocation_chain.hpp", + "external/sources/boost/container/detail/mutex.hpp", + "external/sources/boost/container/detail/next_capacity.hpp", + "external/sources/boost/container/detail/node_alloc_holder.hpp", + "external/sources/boost/container/detail/node_pool.hpp", + "external/sources/boost/container/detail/node_pool_impl.hpp", + "external/sources/boost/container/detail/pair.hpp", + "external/sources/boost/container/detail/pair_key_mapped_of_value.hpp", + "external/sources/boost/container/detail/placement_new.hpp", + "external/sources/boost/container/detail/pool_common.hpp", + "external/sources/boost/container/detail/pool_common_alloc.hpp", + "external/sources/boost/container/detail/pool_resource.hpp", + "external/sources/boost/container/detail/singleton.hpp", + "external/sources/boost/container/detail/std_fwd.hpp", + "external/sources/boost/container/detail/thread_mutex.hpp", + "external/sources/boost/container/detail/transform_iterator.hpp", + "external/sources/boost/container/detail/tree.hpp", + "external/sources/boost/container/detail/type_traits.hpp", + "external/sources/boost/container/detail/value_functors.hpp", + "external/sources/boost/container/detail/value_init.hpp", + "external/sources/boost/container/detail/variadic_templates_tools.hpp", + "external/sources/boost/container/detail/version_type.hpp", + "external/sources/boost/container/detail/workaround.hpp", + "external/sources/boost/container/flat_map.hpp", + "external/sources/boost/container/flat_set.hpp", + "external/sources/boost/container/list.hpp", + "external/sources/boost/container/map.hpp", + "external/sources/boost/container/new_allocator.hpp", + "external/sources/boost/container/node_allocator.hpp", + "external/sources/boost/container/node_handle.hpp", + "external/sources/boost/container/options.hpp", + "external/sources/boost/container/pmr/deque.hpp", + "external/sources/boost/container/pmr/flat_map.hpp", + "external/sources/boost/container/pmr/flat_set.hpp", + "external/sources/boost/container/pmr/global_resource.hpp", + "external/sources/boost/container/pmr/list.hpp", + "external/sources/boost/container/pmr/map.hpp", + "external/sources/boost/container/pmr/memory_resource.hpp", + "external/sources/boost/container/pmr/monotonic_buffer_resource.hpp", + "external/sources/boost/container/pmr/polymorphic_allocator.hpp", + "external/sources/boost/container/pmr/pool_options.hpp", + "external/sources/boost/container/pmr/resource_adaptor.hpp", + "external/sources/boost/container/pmr/set.hpp", + "external/sources/boost/container/pmr/slist.hpp", + "external/sources/boost/container/pmr/small_vector.hpp", + "external/sources/boost/container/pmr/stable_vector.hpp", + "external/sources/boost/container/pmr/string.hpp", + "external/sources/boost/container/pmr/synchronized_pool_resource.hpp", + "external/sources/boost/container/pmr/unsynchronized_pool_resource.hpp", + "external/sources/boost/container/pmr/vector.hpp", + "external/sources/boost/container/scoped_allocator.hpp", + "external/sources/boost/container/scoped_allocator_fwd.hpp", + "external/sources/boost/container/set.hpp", + "external/sources/boost/container/slist.hpp", + "external/sources/boost/container/small_vector.hpp", + "external/sources/boost/container/stable_vector.hpp", + "external/sources/boost/container/static_vector.hpp", + "external/sources/boost/container/string.hpp", + "external/sources/boost/container/throw_exception.hpp", + "external/sources/boost/container/uses_allocator.hpp", + "external/sources/boost/container/uses_allocator_fwd.hpp", + "external/sources/boost/container/vector.hpp", + "external/sources/boost/container_hash/detail/float_functions.hpp", + "external/sources/boost/container_hash/detail/hash_float.hpp", + "external/sources/boost/container_hash/detail/limits.hpp", + "external/sources/boost/container_hash/extensions.hpp", + "external/sources/boost/container_hash/hash.hpp", + "external/sources/boost/container_hash/hash_fwd.hpp", + "external/sources/boost/context/continuation.hpp", + "external/sources/boost/context/continuation_fcontext.hpp", + "external/sources/boost/context/continuation_ucontext.hpp", + "external/sources/boost/context/continuation_winfib.hpp", + "external/sources/boost/context/detail/apply.hpp", + "external/sources/boost/context/detail/config.hpp", + "external/sources/boost/context/detail/disable_overload.hpp", + "external/sources/boost/context/detail/exception.hpp", + "external/sources/boost/context/detail/exchange.hpp", + "external/sources/boost/context/detail/externc.hpp", + "external/sources/boost/context/detail/fcontext.hpp", + "external/sources/boost/context/detail/index_sequence.hpp", + "external/sources/boost/context/detail/invoke.hpp", + "external/sources/boost/context/detail/prefetch.hpp", + "external/sources/boost/context/detail/tuple.hpp", + "external/sources/boost/context/fiber.hpp", + "external/sources/boost/context/fiber_fcontext.hpp", + "external/sources/boost/context/fiber_ucontext.hpp", + "external/sources/boost/context/fiber_winfib.hpp", + "external/sources/boost/context/fixedsize_stack.hpp", + "external/sources/boost/context/flags.hpp", + "external/sources/boost/context/pooled_fixedsize_stack.hpp", + "external/sources/boost/context/posix/protected_fixedsize_stack.hpp", + "external/sources/boost/context/posix/segmented_stack.hpp", + "external/sources/boost/context/preallocated.hpp", + "external/sources/boost/context/protected_fixedsize_stack.hpp", + "external/sources/boost/context/segmented_stack.hpp", + "external/sources/boost/context/stack_context.hpp", + "external/sources/boost/context/stack_traits.hpp", + "external/sources/boost/context/windows/protected_fixedsize_stack.hpp", + "external/sources/boost/contract.hpp", + "external/sources/boost/contract/assert.hpp", + "external/sources/boost/contract/base_types.hpp", + "external/sources/boost/contract/call_if.hpp", + "external/sources/boost/contract/check.hpp", + "external/sources/boost/contract/constructor.hpp", + "external/sources/boost/contract/core/access.hpp", + "external/sources/boost/contract/core/check_macro.hpp", + "external/sources/boost/contract/core/config.hpp", + "external/sources/boost/contract/core/constructor_precondition.hpp", + "external/sources/boost/contract/core/exception.hpp", + "external/sources/boost/contract/core/specify.hpp", + "external/sources/boost/contract/core/virtual.hpp", + "external/sources/boost/contract/destructor.hpp", + "external/sources/boost/contract/detail/assert.hpp", + "external/sources/boost/contract/detail/auto_ptr.hpp", + "external/sources/boost/contract/detail/check.hpp", + "external/sources/boost/contract/detail/checking.hpp", + "external/sources/boost/contract/detail/condition/cond_base.hpp", + "external/sources/boost/contract/detail/condition/cond_inv.hpp", + "external/sources/boost/contract/detail/condition/cond_post.hpp", + "external/sources/boost/contract/detail/condition/cond_subcontracting.hpp", + "external/sources/boost/contract/detail/config.hpp", + "external/sources/boost/contract/detail/debug.hpp", + "external/sources/boost/contract/detail/decl.hpp", + "external/sources/boost/contract/detail/declspec.hpp", + "external/sources/boost/contract/detail/exception.hpp", + "external/sources/boost/contract/detail/inlined.hpp", + "external/sources/boost/contract/detail/inlined/core/exception.hpp", + "external/sources/boost/contract/detail/inlined/detail/checking.hpp", + "external/sources/boost/contract/detail/inlined/old.hpp", + "external/sources/boost/contract/detail/name.hpp", + "external/sources/boost/contract/detail/none.hpp", + "external/sources/boost/contract/detail/noop.hpp", + "external/sources/boost/contract/detail/operation/constructor.hpp", + "external/sources/boost/contract/detail/operation/destructor.hpp", + "external/sources/boost/contract/detail/operation/function.hpp", + "external/sources/boost/contract/detail/operation/public_function.hpp", + "external/sources/boost/contract/detail/operation/static_public_function.hpp", + "external/sources/boost/contract/detail/operator_safe_bool.hpp", + "external/sources/boost/contract/detail/preprocessor/keyword/private.hpp", + "external/sources/boost/contract/detail/preprocessor/keyword/protected.hpp", + "external/sources/boost/contract/detail/preprocessor/keyword/public.hpp", + "external/sources/boost/contract/detail/preprocessor/keyword/utility/is.hpp", + "external/sources/boost/contract/detail/preprocessor/keyword/virtual.hpp", + "external/sources/boost/contract/detail/static_local_var.hpp", + "external/sources/boost/contract/detail/tvariadic.hpp", + "external/sources/boost/contract/detail/type_traits/member_function_types.hpp", + "external/sources/boost/contract/detail/type_traits/mirror.hpp", + "external/sources/boost/contract/detail/type_traits/optional.hpp", + "external/sources/boost/contract/function.hpp", + "external/sources/boost/contract/old.hpp", + "external/sources/boost/contract/override.hpp", + "external/sources/boost/contract/public_function.hpp", + "external/sources/boost/contract_macro.hpp", + "external/sources/boost/convert.hpp", + "external/sources/boost/convert/base.hpp", + "external/sources/boost/convert/detail/char.hpp", + "external/sources/boost/convert/detail/config.hpp", + "external/sources/boost/convert/detail/has_member.hpp", + "external/sources/boost/convert/detail/is_callable.hpp", + "external/sources/boost/convert/detail/is_converter.hpp", + "external/sources/boost/convert/detail/is_fun.hpp", + "external/sources/boost/convert/detail/is_string.hpp", + "external/sources/boost/convert/detail/range.hpp", + "external/sources/boost/convert/lexical_cast.hpp", + "external/sources/boost/convert/parameters.hpp", + "external/sources/boost/convert/printf.hpp", + "external/sources/boost/convert/spirit.hpp", + "external/sources/boost/convert/stream.hpp", + "external/sources/boost/convert/strtol.hpp", + "external/sources/boost/core/addressof.hpp", + "external/sources/boost/core/alloc_construct.hpp", + "external/sources/boost/core/allocator_access.hpp", + "external/sources/boost/core/checked_delete.hpp", + "external/sources/boost/core/default_allocator.hpp", + "external/sources/boost/core/demangle.hpp", + "external/sources/boost/core/empty_value.hpp", + "external/sources/boost/core/enable_if.hpp", + "external/sources/boost/core/exchange.hpp", + "external/sources/boost/core/explicit_operator_bool.hpp", + "external/sources/boost/core/first_scalar.hpp", + "external/sources/boost/core/ignore_unused.hpp", + "external/sources/boost/core/is_same.hpp", + "external/sources/boost/core/lightweight_test.hpp", + "external/sources/boost/core/lightweight_test_trait.hpp", + "external/sources/boost/core/no_exceptions_support.hpp", + "external/sources/boost/core/noinit_adaptor.hpp", + "external/sources/boost/core/noncopyable.hpp", + "external/sources/boost/core/null_deleter.hpp", + "external/sources/boost/core/nvp.hpp", + "external/sources/boost/core/pointer_traits.hpp", + "external/sources/boost/core/quick_exit.hpp", + "external/sources/boost/core/ref.hpp", + "external/sources/boost/core/scoped_enum.hpp", + "external/sources/boost/core/swap.hpp", + "external/sources/boost/core/typeinfo.hpp", + "external/sources/boost/core/uncaught_exceptions.hpp", + "external/sources/boost/core/underlying_type.hpp", + "external/sources/boost/core/use_default.hpp", + "external/sources/boost/coroutine/all.hpp", + "external/sources/boost/coroutine/asymmetric_coroutine.hpp", + "external/sources/boost/coroutine/attributes.hpp", + "external/sources/boost/coroutine/coroutine.hpp", + "external/sources/boost/coroutine/detail/config.hpp", + "external/sources/boost/coroutine/detail/coroutine_context.hpp", + "external/sources/boost/coroutine/detail/data.hpp", + "external/sources/boost/coroutine/detail/flags.hpp", + "external/sources/boost/coroutine/detail/parameters.hpp", + "external/sources/boost/coroutine/detail/preallocated.hpp", + "external/sources/boost/coroutine/detail/pull_coroutine_impl.hpp", + "external/sources/boost/coroutine/detail/pull_coroutine_object.hpp", + "external/sources/boost/coroutine/detail/pull_coroutine_synthesized.hpp", + "external/sources/boost/coroutine/detail/push_coroutine_impl.hpp", + "external/sources/boost/coroutine/detail/push_coroutine_object.hpp", + "external/sources/boost/coroutine/detail/push_coroutine_synthesized.hpp", + "external/sources/boost/coroutine/detail/setup.hpp", + "external/sources/boost/coroutine/detail/symmetric_coroutine_call.hpp", + "external/sources/boost/coroutine/detail/symmetric_coroutine_impl.hpp", + "external/sources/boost/coroutine/detail/symmetric_coroutine_object.hpp", + "external/sources/boost/coroutine/detail/symmetric_coroutine_yield.hpp", + "external/sources/boost/coroutine/detail/trampoline.hpp", + "external/sources/boost/coroutine/detail/trampoline_pull.hpp", + "external/sources/boost/coroutine/detail/trampoline_push.hpp", + "external/sources/boost/coroutine/exceptions.hpp", + "external/sources/boost/coroutine/flags.hpp", + "external/sources/boost/coroutine/posix/protected_stack_allocator.hpp", + "external/sources/boost/coroutine/posix/segmented_stack_allocator.hpp", + "external/sources/boost/coroutine/protected_stack_allocator.hpp", + "external/sources/boost/coroutine/segmented_stack_allocator.hpp", + "external/sources/boost/coroutine/stack_allocator.hpp", + "external/sources/boost/coroutine/stack_context.hpp", + "external/sources/boost/coroutine/stack_traits.hpp", + "external/sources/boost/coroutine/standard_stack_allocator.hpp", + "external/sources/boost/coroutine/symmetric_coroutine.hpp", + "external/sources/boost/coroutine/windows/protected_stack_allocator.hpp", + "external/sources/boost/coroutine2/all.hpp", + "external/sources/boost/coroutine2/coroutine.hpp", + "external/sources/boost/coroutine2/detail/config.hpp", + "external/sources/boost/coroutine2/detail/coroutine.hpp", + "external/sources/boost/coroutine2/detail/create_control_block.ipp", + "external/sources/boost/coroutine2/detail/decay_copy.hpp", + "external/sources/boost/coroutine2/detail/disable_overload.hpp", + "external/sources/boost/coroutine2/detail/pull_control_block_cc.hpp", + "external/sources/boost/coroutine2/detail/pull_control_block_cc.ipp", + "external/sources/boost/coroutine2/detail/pull_coroutine.hpp", + "external/sources/boost/coroutine2/detail/pull_coroutine.ipp", + "external/sources/boost/coroutine2/detail/push_control_block_cc.hpp", + "external/sources/boost/coroutine2/detail/push_control_block_cc.ipp", + "external/sources/boost/coroutine2/detail/push_coroutine.hpp", + "external/sources/boost/coroutine2/detail/push_coroutine.ipp", + "external/sources/boost/coroutine2/detail/state.hpp", + "external/sources/boost/coroutine2/detail/wrap.hpp", + "external/sources/boost/coroutine2/fixedsize_stack.hpp", + "external/sources/boost/coroutine2/pooled_fixedsize_stack.hpp", + "external/sources/boost/coroutine2/protected_fixedsize_stack.hpp", + "external/sources/boost/coroutine2/segmented_stack.hpp", + "external/sources/boost/crc.hpp", + "external/sources/boost/cregex.hpp", + "external/sources/boost/cstdfloat.hpp", + "external/sources/boost/cstdint.hpp", + "external/sources/boost/cstdlib.hpp", + "external/sources/boost/current_function.hpp", + "external/sources/boost/cxx11_char_types.hpp", + "external/sources/boost/date_time.hpp", + "external/sources/boost/date_time/adjust_functors.hpp", + "external/sources/boost/date_time/c_local_time_adjustor.hpp", + "external/sources/boost/date_time/c_time.hpp", + "external/sources/boost/date_time/compiler_config.hpp", + "external/sources/boost/date_time/constrained_value.hpp", + "external/sources/boost/date_time/date.hpp", + "external/sources/boost/date_time/date_clock_device.hpp", + "external/sources/boost/date_time/date_defs.hpp", + "external/sources/boost/date_time/date_duration.hpp", + "external/sources/boost/date_time/date_duration_types.hpp", + "external/sources/boost/date_time/date_facet.hpp", + "external/sources/boost/date_time/date_format_simple.hpp", + "external/sources/boost/date_time/date_formatting.hpp", + "external/sources/boost/date_time/date_formatting_limited.hpp", + "external/sources/boost/date_time/date_formatting_locales.hpp", + "external/sources/boost/date_time/date_generator_formatter.hpp", + "external/sources/boost/date_time/date_generator_parser.hpp", + "external/sources/boost/date_time/date_generators.hpp", + "external/sources/boost/date_time/date_iterator.hpp", + "external/sources/boost/date_time/date_names_put.hpp", + "external/sources/boost/date_time/date_parsing.hpp", + "external/sources/boost/date_time/dst_rules.hpp", + "external/sources/boost/date_time/dst_transition_generators.hpp", + "external/sources/boost/date_time/filetime_functions.hpp", + "external/sources/boost/date_time/find_match.hpp", + "external/sources/boost/date_time/format_date_parser.hpp", + "external/sources/boost/date_time/gregorian/conversion.hpp", + "external/sources/boost/date_time/gregorian/formatters.hpp", + "external/sources/boost/date_time/gregorian/formatters_limited.hpp", + "external/sources/boost/date_time/gregorian/greg_calendar.hpp", + "external/sources/boost/date_time/gregorian/greg_date.hpp", + "external/sources/boost/date_time/gregorian/greg_day.hpp", + "external/sources/boost/date_time/gregorian/greg_day_of_year.hpp", + "external/sources/boost/date_time/gregorian/greg_duration.hpp", + "external/sources/boost/date_time/gregorian/greg_duration_types.hpp", + "external/sources/boost/date_time/gregorian/greg_facet.hpp", + "external/sources/boost/date_time/gregorian/greg_month.hpp", + "external/sources/boost/date_time/gregorian/greg_serialize.hpp", + "external/sources/boost/date_time/gregorian/greg_weekday.hpp", + "external/sources/boost/date_time/gregorian/greg_year.hpp", + "external/sources/boost/date_time/gregorian/greg_ymd.hpp", + "external/sources/boost/date_time/gregorian/gregorian.hpp", + "external/sources/boost/date_time/gregorian/gregorian_io.hpp", + "external/sources/boost/date_time/gregorian/gregorian_types.hpp", + "external/sources/boost/date_time/gregorian/parsers.hpp", + "external/sources/boost/date_time/gregorian_calendar.hpp", + "external/sources/boost/date_time/gregorian_calendar.ipp", + "external/sources/boost/date_time/int_adapter.hpp", + "external/sources/boost/date_time/iso_format.hpp", + "external/sources/boost/date_time/local_time/conversion.hpp", + "external/sources/boost/date_time/local_time/custom_time_zone.hpp", + "external/sources/boost/date_time/local_time/date_duration_operators.hpp", + "external/sources/boost/date_time/local_time/dst_transition_day_rules.hpp", + "external/sources/boost/date_time/local_time/local_date_time.hpp", + "external/sources/boost/date_time/local_time/local_time.hpp", + "external/sources/boost/date_time/local_time/local_time_io.hpp", + "external/sources/boost/date_time/local_time/local_time_types.hpp", + "external/sources/boost/date_time/local_time/posix_time_zone.hpp", + "external/sources/boost/date_time/local_time/tz_database.hpp", + "external/sources/boost/date_time/local_time_adjustor.hpp", + "external/sources/boost/date_time/local_timezone_defs.hpp", + "external/sources/boost/date_time/locale_config.hpp", + "external/sources/boost/date_time/microsec_time_clock.hpp", + "external/sources/boost/date_time/parse_format_base.hpp", + "external/sources/boost/date_time/period.hpp", + "external/sources/boost/date_time/period_formatter.hpp", + "external/sources/boost/date_time/period_parser.hpp", + "external/sources/boost/date_time/posix_time/conversion.hpp", + "external/sources/boost/date_time/posix_time/date_duration_operators.hpp", + "external/sources/boost/date_time/posix_time/posix_time.hpp", + "external/sources/boost/date_time/posix_time/posix_time_config.hpp", + "external/sources/boost/date_time/posix_time/posix_time_duration.hpp", + "external/sources/boost/date_time/posix_time/posix_time_io.hpp", + "external/sources/boost/date_time/posix_time/posix_time_legacy_io.hpp", + "external/sources/boost/date_time/posix_time/posix_time_system.hpp", + "external/sources/boost/date_time/posix_time/posix_time_types.hpp", + "external/sources/boost/date_time/posix_time/ptime.hpp", + "external/sources/boost/date_time/posix_time/time_formatters.hpp", + "external/sources/boost/date_time/posix_time/time_formatters_limited.hpp", + "external/sources/boost/date_time/posix_time/time_parsers.hpp", + "external/sources/boost/date_time/posix_time/time_period.hpp", + "external/sources/boost/date_time/posix_time/time_serialize.hpp", + "external/sources/boost/date_time/special_defs.hpp", + "external/sources/boost/date_time/special_values_formatter.hpp", + "external/sources/boost/date_time/special_values_parser.hpp", + "external/sources/boost/date_time/string_convert.hpp", + "external/sources/boost/date_time/string_parse_tree.hpp", + "external/sources/boost/date_time/strings_from_facet.hpp", + "external/sources/boost/date_time/time.hpp", + "external/sources/boost/date_time/time_clock.hpp", + "external/sources/boost/date_time/time_defs.hpp", + "external/sources/boost/date_time/time_duration.hpp", + "external/sources/boost/date_time/time_facet.hpp", + "external/sources/boost/date_time/time_formatting_streams.hpp", + "external/sources/boost/date_time/time_iterator.hpp", + "external/sources/boost/date_time/time_parsing.hpp", + "external/sources/boost/date_time/time_resolution_traits.hpp", + "external/sources/boost/date_time/time_system_counted.hpp", + "external/sources/boost/date_time/time_system_split.hpp", + "external/sources/boost/date_time/time_zone_base.hpp", + "external/sources/boost/date_time/time_zone_names.hpp", + "external/sources/boost/date_time/tz_db_base.hpp", + "external/sources/boost/date_time/wrapping_int.hpp", + "external/sources/boost/date_time/year_month_day.hpp", + "external/sources/boost/detail/algorithm.hpp", + "external/sources/boost/detail/allocator_utilities.hpp", + "external/sources/boost/detail/atomic_count.hpp", + "external/sources/boost/detail/basic_pointerbuf.hpp", + "external/sources/boost/detail/binary_search.hpp", + "external/sources/boost/detail/bitmask.hpp", + "external/sources/boost/detail/call_traits.hpp", + "external/sources/boost/detail/catch_exceptions.hpp", + "external/sources/boost/detail/compressed_pair.hpp", + "external/sources/boost/detail/container_fwd.hpp", + "external/sources/boost/detail/fenv.hpp", + "external/sources/boost/detail/has_default_constructor.hpp", + "external/sources/boost/detail/identifier.hpp", + "external/sources/boost/detail/indirect_traits.hpp", + "external/sources/boost/detail/interlocked.hpp", + "external/sources/boost/detail/is_incrementable.hpp", + "external/sources/boost/detail/is_sorted.hpp", + "external/sources/boost/detail/is_xxx.hpp", + "external/sources/boost/detail/iterator.hpp", + "external/sources/boost/detail/lcast_precision.hpp", + "external/sources/boost/detail/lightweight_main.hpp", + "external/sources/boost/detail/lightweight_mutex.hpp", + "external/sources/boost/detail/lightweight_test.hpp", + "external/sources/boost/detail/lightweight_test_report.hpp", + "external/sources/boost/detail/lightweight_thread.hpp", + "external/sources/boost/detail/named_template_params.hpp", + "external/sources/boost/detail/no_exceptions_support.hpp", + "external/sources/boost/detail/numeric_traits.hpp", + "external/sources/boost/detail/ob_compressed_pair.hpp", + "external/sources/boost/detail/quick_allocator.hpp", + "external/sources/boost/detail/reference_content.hpp", + "external/sources/boost/detail/scoped_enum_emulation.hpp", + "external/sources/boost/detail/select_type.hpp", + "external/sources/boost/detail/sp_typeinfo.hpp", + "external/sources/boost/detail/templated_streams.hpp", + "external/sources/boost/detail/utf8_codecvt_facet.hpp", + "external/sources/boost/detail/utf8_codecvt_facet.ipp", + "external/sources/boost/detail/winapi/access_rights.hpp", + "external/sources/boost/detail/winapi/apc.hpp", + "external/sources/boost/detail/winapi/basic_types.hpp", + "external/sources/boost/detail/winapi/bcrypt.hpp", + "external/sources/boost/detail/winapi/character_code_conversion.hpp", + "external/sources/boost/detail/winapi/condition_variable.hpp", + "external/sources/boost/detail/winapi/config.hpp", + "external/sources/boost/detail/winapi/critical_section.hpp", + "external/sources/boost/detail/winapi/crypt.hpp", + "external/sources/boost/detail/winapi/dbghelp.hpp", + "external/sources/boost/detail/winapi/debugapi.hpp", + "external/sources/boost/detail/winapi/detail/deprecated_namespace.hpp", + "external/sources/boost/detail/winapi/directory_management.hpp", + "external/sources/boost/detail/winapi/dll.hpp", + "external/sources/boost/detail/winapi/environment.hpp", + "external/sources/boost/detail/winapi/error_codes.hpp", + "external/sources/boost/detail/winapi/error_handling.hpp", + "external/sources/boost/detail/winapi/event.hpp", + "external/sources/boost/detail/winapi/file_management.hpp", + "external/sources/boost/detail/winapi/file_mapping.hpp", + "external/sources/boost/detail/winapi/get_current_process.hpp", + "external/sources/boost/detail/winapi/get_current_process_id.hpp", + "external/sources/boost/detail/winapi/get_current_thread.hpp", + "external/sources/boost/detail/winapi/get_current_thread_id.hpp", + "external/sources/boost/detail/winapi/get_last_error.hpp", + "external/sources/boost/detail/winapi/get_process_times.hpp", + "external/sources/boost/detail/winapi/get_system_directory.hpp", + "external/sources/boost/detail/winapi/get_thread_times.hpp", + "external/sources/boost/detail/winapi/handle_info.hpp", + "external/sources/boost/detail/winapi/handles.hpp", + "external/sources/boost/detail/winapi/heap_memory.hpp", + "external/sources/boost/detail/winapi/init_once.hpp", + "external/sources/boost/detail/winapi/jobs.hpp", + "external/sources/boost/detail/winapi/limits.hpp", + "external/sources/boost/detail/winapi/local_memory.hpp", + "external/sources/boost/detail/winapi/memory.hpp", + "external/sources/boost/detail/winapi/mutex.hpp", + "external/sources/boost/detail/winapi/overlapped.hpp", + "external/sources/boost/detail/winapi/page_protection_flags.hpp", + "external/sources/boost/detail/winapi/pipes.hpp", + "external/sources/boost/detail/winapi/priority_class.hpp", + "external/sources/boost/detail/winapi/process.hpp", + "external/sources/boost/detail/winapi/security.hpp", + "external/sources/boost/detail/winapi/semaphore.hpp", + "external/sources/boost/detail/winapi/shell.hpp", + "external/sources/boost/detail/winapi/show_window.hpp", + "external/sources/boost/detail/winapi/srw_lock.hpp", + "external/sources/boost/detail/winapi/stack_backtrace.hpp", + "external/sources/boost/detail/winapi/synchronization.hpp", + "external/sources/boost/detail/winapi/system.hpp", + "external/sources/boost/detail/winapi/thread.hpp", + "external/sources/boost/detail/winapi/thread_pool.hpp", + "external/sources/boost/detail/winapi/time.hpp", + "external/sources/boost/detail/winapi/timers.hpp", + "external/sources/boost/detail/winapi/tls.hpp", + "external/sources/boost/detail/winapi/wait.hpp", + "external/sources/boost/detail/winapi/waitable_timer.hpp", + "external/sources/boost/detail/workaround.hpp", + "external/sources/boost/dll.hpp", + "external/sources/boost/dll/alias.hpp", + "external/sources/boost/dll/config.hpp", + "external/sources/boost/dll/detail/aggressive_ptr_cast.hpp", + "external/sources/boost/dll/detail/ctor_dtor.hpp", + "external/sources/boost/dll/detail/demangling/demangle_symbol.hpp", + "external/sources/boost/dll/detail/demangling/itanium.hpp", + "external/sources/boost/dll/detail/demangling/mangled_storage_base.hpp", + "external/sources/boost/dll/detail/demangling/msvc.hpp", + "external/sources/boost/dll/detail/elf_info.hpp", + "external/sources/boost/dll/detail/get_mem_fn_type.hpp", + "external/sources/boost/dll/detail/import_mangled_helpers.hpp", + "external/sources/boost/dll/detail/macho_info.hpp", + "external/sources/boost/dll/detail/pe_info.hpp", + "external/sources/boost/dll/detail/posix/path_from_handle.hpp", + "external/sources/boost/dll/detail/posix/program_location_impl.hpp", + "external/sources/boost/dll/detail/posix/shared_library_impl.hpp", + "external/sources/boost/dll/detail/system_error.hpp", + "external/sources/boost/dll/detail/type_info.hpp", + "external/sources/boost/dll/detail/windows/path_from_handle.hpp", + "external/sources/boost/dll/detail/windows/shared_library_impl.hpp", + "external/sources/boost/dll/import.hpp", + "external/sources/boost/dll/import_class.hpp", + "external/sources/boost/dll/import_mangled.hpp", + "external/sources/boost/dll/library_info.hpp", + "external/sources/boost/dll/runtime_symbol_info.hpp", + "external/sources/boost/dll/shared_library.hpp", + "external/sources/boost/dll/shared_library_load_mode.hpp", + "external/sources/boost/dll/smart_library.hpp", + "external/sources/boost/dynamic_bitset.hpp", + "external/sources/boost/dynamic_bitset/config.hpp", + "external/sources/boost/dynamic_bitset/detail/dynamic_bitset.hpp", + "external/sources/boost/dynamic_bitset/detail/lowest_bit.hpp", + "external/sources/boost/dynamic_bitset/dynamic_bitset.hpp", + "external/sources/boost/dynamic_bitset/serialization.hpp", + "external/sources/boost/dynamic_bitset_fwd.hpp", + "external/sources/boost/enable_shared_from_this.hpp", + "external/sources/boost/endian.hpp", + "external/sources/boost/endian/arithmetic.hpp", + "external/sources/boost/endian/buffers.hpp", + "external/sources/boost/endian/conversion.hpp", + "external/sources/boost/endian/detail/disable_warnings.hpp", + "external/sources/boost/endian/detail/disable_warnings_pop.hpp", + "external/sources/boost/endian/detail/endian_load.hpp", + "external/sources/boost/endian/detail/endian_reverse.hpp", + "external/sources/boost/endian/detail/endian_store.hpp", + "external/sources/boost/endian/detail/integral_by_size.hpp", + "external/sources/boost/endian/detail/intrinsic.hpp", + "external/sources/boost/endian/detail/is_scoped_enum.hpp", + "external/sources/boost/endian/detail/is_trivially_copyable.hpp", + "external/sources/boost/endian/detail/order.hpp", + "external/sources/boost/endian/endian.hpp", + "external/sources/boost/exception/all.hpp", + "external/sources/boost/exception/current_exception_cast.hpp", + "external/sources/boost/exception/detail/clone_current_exception.hpp", + "external/sources/boost/exception/detail/error_info_impl.hpp", + "external/sources/boost/exception/detail/exception_ptr.hpp", + "external/sources/boost/exception/detail/is_output_streamable.hpp", + "external/sources/boost/exception/detail/object_hex_dump.hpp", + "external/sources/boost/exception/detail/shared_ptr.hpp", + "external/sources/boost/exception/detail/type_info.hpp", + "external/sources/boost/exception/diagnostic_information.hpp", + "external/sources/boost/exception/enable_current_exception.hpp", + "external/sources/boost/exception/enable_error_info.hpp", + "external/sources/boost/exception/errinfo_api_function.hpp", + "external/sources/boost/exception/errinfo_at_line.hpp", + "external/sources/boost/exception/errinfo_errno.hpp", + "external/sources/boost/exception/errinfo_file_handle.hpp", + "external/sources/boost/exception/errinfo_file_name.hpp", + "external/sources/boost/exception/errinfo_file_open_mode.hpp", + "external/sources/boost/exception/errinfo_nested_exception.hpp", + "external/sources/boost/exception/errinfo_type_info_name.hpp", + "external/sources/boost/exception/error_info.hpp", + "external/sources/boost/exception/exception.hpp", + "external/sources/boost/exception/get_error_info.hpp", + "external/sources/boost/exception/info.hpp", + "external/sources/boost/exception/info_tuple.hpp", + "external/sources/boost/exception/to_string.hpp", + "external/sources/boost/exception/to_string_stub.hpp", + "external/sources/boost/exception_ptr.hpp", + "external/sources/boost/fiber/algo/algorithm.hpp", + "external/sources/boost/fiber/algo/round_robin.hpp", + "external/sources/boost/fiber/algo/shared_work.hpp", + "external/sources/boost/fiber/algo/work_stealing.hpp", + "external/sources/boost/fiber/all.hpp", + "external/sources/boost/fiber/barrier.hpp", + "external/sources/boost/fiber/buffered_channel.hpp", + "external/sources/boost/fiber/channel_op_status.hpp", + "external/sources/boost/fiber/condition_variable.hpp", + "external/sources/boost/fiber/context.hpp", + "external/sources/boost/fiber/cuda/waitfor.hpp", + "external/sources/boost/fiber/detail/config.hpp", + "external/sources/boost/fiber/detail/context_spinlock_queue.hpp", + "external/sources/boost/fiber/detail/context_spmc_queue.hpp", + "external/sources/boost/fiber/detail/convert.hpp", + "external/sources/boost/fiber/detail/cpu_relax.hpp", + "external/sources/boost/fiber/detail/data.hpp", + "external/sources/boost/fiber/detail/decay_copy.hpp", + "external/sources/boost/fiber/detail/disable_overload.hpp", + "external/sources/boost/fiber/detail/exchange.hpp", + "external/sources/boost/fiber/detail/fss.hpp", + "external/sources/boost/fiber/detail/futex.hpp", + "external/sources/boost/fiber/detail/is_all_same.hpp", + "external/sources/boost/fiber/detail/rtm.hpp", + "external/sources/boost/fiber/detail/spinlock.hpp", + "external/sources/boost/fiber/detail/spinlock_rtm.hpp", + "external/sources/boost/fiber/detail/spinlock_status.hpp", + "external/sources/boost/fiber/detail/spinlock_ttas.hpp", + "external/sources/boost/fiber/detail/spinlock_ttas_adaptive.hpp", + "external/sources/boost/fiber/detail/spinlock_ttas_adaptive_futex.hpp", + "external/sources/boost/fiber/detail/spinlock_ttas_futex.hpp", + "external/sources/boost/fiber/detail/thread_barrier.hpp", + "external/sources/boost/fiber/exceptions.hpp", + "external/sources/boost/fiber/fiber.hpp", + "external/sources/boost/fiber/fixedsize_stack.hpp", + "external/sources/boost/fiber/fss.hpp", + "external/sources/boost/fiber/future.hpp", + "external/sources/boost/fiber/future/async.hpp", + "external/sources/boost/fiber/future/detail/shared_state.hpp", + "external/sources/boost/fiber/future/detail/shared_state_object.hpp", + "external/sources/boost/fiber/future/detail/task_base.hpp", + "external/sources/boost/fiber/future/detail/task_object.hpp", + "external/sources/boost/fiber/future/future.hpp", + "external/sources/boost/fiber/future/future_status.hpp", + "external/sources/boost/fiber/future/packaged_task.hpp", + "external/sources/boost/fiber/future/promise.hpp", + "external/sources/boost/fiber/hip/waitfor.hpp", + "external/sources/boost/fiber/mutex.hpp", + "external/sources/boost/fiber/numa/algo/work_stealing.hpp", + "external/sources/boost/fiber/numa/all.hpp", + "external/sources/boost/fiber/numa/pin_thread.hpp", + "external/sources/boost/fiber/numa/topology.hpp", + "external/sources/boost/fiber/operations.hpp", + "external/sources/boost/fiber/policy.hpp", + "external/sources/boost/fiber/pooled_fixedsize_stack.hpp", + "external/sources/boost/fiber/properties.hpp", + "external/sources/boost/fiber/protected_fixedsize_stack.hpp", + "external/sources/boost/fiber/recursive_mutex.hpp", + "external/sources/boost/fiber/recursive_timed_mutex.hpp", + "external/sources/boost/fiber/scheduler.hpp", + "external/sources/boost/fiber/segmented_stack.hpp", + "external/sources/boost/fiber/timed_mutex.hpp", + "external/sources/boost/fiber/type.hpp", + "external/sources/boost/fiber/unbuffered_channel.hpp", + "external/sources/boost/filesystem.hpp", + "external/sources/boost/filesystem/config.hpp", + "external/sources/boost/filesystem/convenience.hpp", + "external/sources/boost/filesystem/detail/macro_value.hpp", + "external/sources/boost/filesystem/detail/utf8_codecvt_facet.hpp", + "external/sources/boost/filesystem/directory.hpp", + "external/sources/boost/filesystem/exception.hpp", + "external/sources/boost/filesystem/file_status.hpp", + "external/sources/boost/filesystem/fstream.hpp", + "external/sources/boost/filesystem/operations.hpp", + "external/sources/boost/filesystem/path.hpp", + "external/sources/boost/filesystem/path_traits.hpp", + "external/sources/boost/filesystem/string_file.hpp", + "external/sources/boost/flyweight.hpp", + "external/sources/boost/flyweight/assoc_container_factory.hpp", + "external/sources/boost/flyweight/assoc_container_factory_fwd.hpp", + "external/sources/boost/flyweight/detail/archive_constructed.hpp", + "external/sources/boost/flyweight/detail/default_value_policy.hpp", + "external/sources/boost/flyweight/detail/dyn_perfect_fwd.hpp", + "external/sources/boost/flyweight/detail/flyweight_core.hpp", + "external/sources/boost/flyweight/detail/is_placeholder_expr.hpp", + "external/sources/boost/flyweight/detail/nested_xxx_if_not_ph.hpp", + "external/sources/boost/flyweight/detail/not_placeholder_expr.hpp", + "external/sources/boost/flyweight/detail/perfect_fwd.hpp", + "external/sources/boost/flyweight/detail/pp_perfect_fwd.hpp", + "external/sources/boost/flyweight/detail/recursive_lw_mutex.hpp", + "external/sources/boost/flyweight/detail/serialization_helper.hpp", + "external/sources/boost/flyweight/detail/value_tag.hpp", + "external/sources/boost/flyweight/factory_tag.hpp", + "external/sources/boost/flyweight/flyweight.hpp", + "external/sources/boost/flyweight/flyweight_fwd.hpp", + "external/sources/boost/flyweight/hashed_factory.hpp", + "external/sources/boost/flyweight/hashed_factory_fwd.hpp", + "external/sources/boost/flyweight/holder_tag.hpp", + "external/sources/boost/flyweight/intermodule_holder.hpp", + "external/sources/boost/flyweight/intermodule_holder_fwd.hpp", + "external/sources/boost/flyweight/key_value.hpp", + "external/sources/boost/flyweight/key_value_fwd.hpp", + "external/sources/boost/flyweight/locking_tag.hpp", + "external/sources/boost/flyweight/no_locking.hpp", + "external/sources/boost/flyweight/no_locking_fwd.hpp", + "external/sources/boost/flyweight/no_tracking.hpp", + "external/sources/boost/flyweight/no_tracking_fwd.hpp", + "external/sources/boost/flyweight/refcounted.hpp", + "external/sources/boost/flyweight/refcounted_fwd.hpp", + "external/sources/boost/flyweight/serialize.hpp", + "external/sources/boost/flyweight/set_factory.hpp", + "external/sources/boost/flyweight/set_factory_fwd.hpp", + "external/sources/boost/flyweight/simple_locking.hpp", + "external/sources/boost/flyweight/simple_locking_fwd.hpp", + "external/sources/boost/flyweight/static_holder.hpp", + "external/sources/boost/flyweight/static_holder_fwd.hpp", + "external/sources/boost/flyweight/tag.hpp", + "external/sources/boost/flyweight/tracking_tag.hpp", + "external/sources/boost/foreach.hpp", + "external/sources/boost/foreach_fwd.hpp", + "external/sources/boost/format.hpp", + "external/sources/boost/format/alt_sstream.hpp", + "external/sources/boost/format/alt_sstream_impl.hpp", + "external/sources/boost/format/detail/compat_workarounds.hpp", + "external/sources/boost/format/detail/config_macros.hpp", + "external/sources/boost/format/detail/msvc_disambiguater.hpp", + "external/sources/boost/format/detail/unset_macros.hpp", + "external/sources/boost/format/detail/workarounds_gcc-2_95.hpp", + "external/sources/boost/format/detail/workarounds_stlport.hpp", + "external/sources/boost/format/exceptions.hpp", + "external/sources/boost/format/feed_args.hpp", + "external/sources/boost/format/format_class.hpp", + "external/sources/boost/format/format_fwd.hpp", + "external/sources/boost/format/format_implementation.hpp", + "external/sources/boost/format/free_funcs.hpp", + "external/sources/boost/format/group.hpp", + "external/sources/boost/format/internals.hpp", + "external/sources/boost/format/internals_fwd.hpp", + "external/sources/boost/format/parsing.hpp", + "external/sources/boost/function.hpp", + "external/sources/boost/function/detail/function_iterate.hpp", + "external/sources/boost/function/detail/gen_maybe_include.pl", + "external/sources/boost/function/detail/maybe_include.hpp", + "external/sources/boost/function/detail/prologue.hpp", + "external/sources/boost/function/function0.hpp", + "external/sources/boost/function/function1.hpp", + "external/sources/boost/function/function10.hpp", + "external/sources/boost/function/function2.hpp", + "external/sources/boost/function/function3.hpp", + "external/sources/boost/function/function4.hpp", + "external/sources/boost/function/function5.hpp", + "external/sources/boost/function/function6.hpp", + "external/sources/boost/function/function7.hpp", + "external/sources/boost/function/function8.hpp", + "external/sources/boost/function/function9.hpp", + "external/sources/boost/function/function_base.hpp", + "external/sources/boost/function/function_fwd.hpp", + "external/sources/boost/function/function_template.hpp", + "external/sources/boost/function/function_typeof.hpp", + "external/sources/boost/function/gen_function_N.pl", + "external/sources/boost/function_equal.hpp", + "external/sources/boost/function_output_iterator.hpp", + "external/sources/boost/function_types/components.hpp", + "external/sources/boost/function_types/config/cc_names.hpp", + "external/sources/boost/function_types/config/compiler.hpp", + "external/sources/boost/function_types/config/config.hpp", + "external/sources/boost/function_types/detail/class_transform.hpp", + "external/sources/boost/function_types/detail/classifier.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity10_0.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity10_1.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity20_0.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity20_1.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity30_0.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity30_1.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity40_0.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity40_1.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity50_0.hpp", + "external/sources/boost/function_types/detail/classifier_impl/arity50_1.hpp", + "external/sources/boost/function_types/detail/classifier_impl/master.hpp", + "external/sources/boost/function_types/detail/components_as_mpl_sequence.hpp", + "external/sources/boost/function_types/detail/components_impl/arity10_0.hpp", + "external/sources/boost/function_types/detail/components_impl/arity10_1.hpp", + "external/sources/boost/function_types/detail/components_impl/arity20_0.hpp", + "external/sources/boost/function_types/detail/components_impl/arity20_1.hpp", + "external/sources/boost/function_types/detail/components_impl/arity30_0.hpp", + "external/sources/boost/function_types/detail/components_impl/arity30_1.hpp", + "external/sources/boost/function_types/detail/components_impl/arity40_0.hpp", + "external/sources/boost/function_types/detail/components_impl/arity40_1.hpp", + "external/sources/boost/function_types/detail/components_impl/arity50_0.hpp", + "external/sources/boost/function_types/detail/components_impl/arity50_1.hpp", + "external/sources/boost/function_types/detail/components_impl/master.hpp", + "external/sources/boost/function_types/detail/cv_traits.hpp", + "external/sources/boost/function_types/detail/encoding/aliases_def.hpp", + "external/sources/boost/function_types/detail/encoding/aliases_undef.hpp", + "external/sources/boost/function_types/detail/encoding/def.hpp", + "external/sources/boost/function_types/detail/encoding/undef.hpp", + "external/sources/boost/function_types/detail/pp_arity_loop.hpp", + "external/sources/boost/function_types/detail/pp_cc_loop/master.hpp", + "external/sources/boost/function_types/detail/pp_cc_loop/preprocessed.hpp", + "external/sources/boost/function_types/detail/pp_loop.hpp", + "external/sources/boost/function_types/detail/pp_retag_default_cc/master.hpp", + "external/sources/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp", + "external/sources/boost/function_types/detail/pp_tags/cc_tag.hpp", + "external/sources/boost/function_types/detail/pp_tags/master.hpp", + "external/sources/boost/function_types/detail/pp_tags/preprocessed.hpp", + "external/sources/boost/function_types/detail/pp_variate_loop/master.hpp", + "external/sources/boost/function_types/detail/pp_variate_loop/preprocessed.hpp", + "external/sources/boost/function_types/detail/retag_default_cc.hpp", + "external/sources/boost/function_types/detail/synthesize.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity10_0.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity10_1.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity20_0.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity20_1.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity30_0.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity30_1.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity40_0.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity40_1.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity50_0.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/arity50_1.hpp", + "external/sources/boost/function_types/detail/synthesize_impl/master.hpp", + "external/sources/boost/function_types/detail/to_sequence.hpp", + "external/sources/boost/function_types/function_arity.hpp", + "external/sources/boost/function_types/function_pointer.hpp", + "external/sources/boost/function_types/function_reference.hpp", + "external/sources/boost/function_types/function_type.hpp", + "external/sources/boost/function_types/is_callable_builtin.hpp", + "external/sources/boost/function_types/is_function.hpp", + "external/sources/boost/function_types/is_function_pointer.hpp", + "external/sources/boost/function_types/is_function_reference.hpp", + "external/sources/boost/function_types/is_member_function_pointer.hpp", + "external/sources/boost/function_types/is_member_object_pointer.hpp", + "external/sources/boost/function_types/is_member_pointer.hpp", + "external/sources/boost/function_types/is_nonmember_callable_builtin.hpp", + "external/sources/boost/function_types/member_function_pointer.hpp", + "external/sources/boost/function_types/member_object_pointer.hpp", + "external/sources/boost/function_types/parameter_types.hpp", + "external/sources/boost/function_types/property_tags.hpp", + "external/sources/boost/function_types/result_type.hpp", + "external/sources/boost/functional.hpp", + "external/sources/boost/functional/factory.hpp", + "external/sources/boost/functional/forward_adapter.hpp", + "external/sources/boost/functional/hash.hpp", + "external/sources/boost/functional/hash/extensions.hpp", + "external/sources/boost/functional/hash/hash.hpp", + "external/sources/boost/functional/hash/hash_fwd.hpp", + "external/sources/boost/functional/hash_fwd.hpp", + "external/sources/boost/functional/lightweight_forward_adapter.hpp", + "external/sources/boost/functional/overloaded_function.hpp", + "external/sources/boost/functional/overloaded_function/config.hpp", + "external/sources/boost/functional/overloaded_function/detail/base.hpp", + "external/sources/boost/functional/overloaded_function/detail/function_type.hpp", + "external/sources/boost/functional/value_factory.hpp", + "external/sources/boost/fusion/adapted.hpp", + "external/sources/boost/fusion/adapted/adt.hpp", + "external/sources/boost/fusion/adapted/adt/adapt_adt.hpp", + "external/sources/boost/fusion/adapted/adt/adapt_adt_named.hpp", + "external/sources/boost/fusion/adapted/adt/adapt_assoc_adt.hpp", + "external/sources/boost/fusion/adapted/adt/adapt_assoc_adt_named.hpp", + "external/sources/boost/fusion/adapted/adt/detail/adapt_base.hpp", + "external/sources/boost/fusion/adapted/adt/detail/adapt_base_assoc_attr_filler.hpp", + "external/sources/boost/fusion/adapted/adt/detail/adapt_base_attr_filler.hpp", + "external/sources/boost/fusion/adapted/adt/detail/extension.hpp", + "external/sources/boost/fusion/adapted/array.hpp", + "external/sources/boost/fusion/adapted/array/at_impl.hpp", + "external/sources/boost/fusion/adapted/array/begin_impl.hpp", + "external/sources/boost/fusion/adapted/array/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/array/deref_impl.hpp", + "external/sources/boost/fusion/adapted/array/end_impl.hpp", + "external/sources/boost/fusion/adapted/array/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/array/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/array/size_impl.hpp", + "external/sources/boost/fusion/adapted/array/tag_of.hpp", + "external/sources/boost/fusion/adapted/array/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/array/value_of_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array.hpp", + "external/sources/boost/fusion/adapted/boost_array/array_iterator.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/at_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/begin_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/end_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/size_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/detail/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/boost_array/tag_of.hpp", + "external/sources/boost/fusion/adapted/boost_tuple.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/begin_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/size_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/detail/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/mpl/clear.hpp", + "external/sources/boost/fusion/adapted/boost_tuple/tag_of.hpp", + "external/sources/boost/fusion/adapted/mpl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/at_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/begin_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/empty_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/end_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/has_key_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/size_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/detail/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/mpl/mpl_iterator.hpp", + "external/sources/boost/fusion/adapted/std_array.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/array_size.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/at_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/begin_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/end_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/size_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/detail/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/std_array/std_array_iterator.hpp", + "external/sources/boost/fusion/adapted/std_array/tag_of.hpp", + "external/sources/boost/fusion/adapted/std_pair.hpp", + "external/sources/boost/fusion/adapted/std_tuple.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/at_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/begin_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/convert_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/end_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/size_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/detail/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/std_tuple/mpl/clear.hpp", + "external/sources/boost/fusion/adapted/std_tuple/std_tuple_iterator.hpp", + "external/sources/boost/fusion/adapted/std_tuple/tag_of.hpp", + "external/sources/boost/fusion/adapted/struct.hpp", + "external/sources/boost/fusion/adapted/struct/adapt_assoc_struct.hpp", + "external/sources/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp", + "external/sources/boost/fusion/adapted/struct/adapt_struct.hpp", + "external/sources/boost/fusion/adapted/struct/adapt_struct_named.hpp", + "external/sources/boost/fusion/adapted/struct/define_assoc_struct.hpp", + "external/sources/boost/fusion/adapted/struct/define_struct.hpp", + "external/sources/boost/fusion/adapted/struct/define_struct_inline.hpp", + "external/sources/boost/fusion/adapted/struct/detail/adapt_auto.hpp", + "external/sources/boost/fusion/adapted/struct/detail/adapt_base.hpp", + "external/sources/boost/fusion/adapted/struct/detail/adapt_base_assoc_attr_filler.hpp", + "external/sources/boost/fusion/adapted/struct/detail/adapt_base_attr_filler.hpp", + "external/sources/boost/fusion/adapted/struct/detail/adapt_is_tpl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/at_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/begin_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/category_of_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/define_struct.hpp", + "external/sources/boost/fusion/adapted/struct/detail/define_struct_inline.hpp", + "external/sources/boost/fusion/adapted/struct/detail/deref_data_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/deref_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/end_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/extension.hpp", + "external/sources/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/is_view_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/key_of_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/namespace.hpp", + "external/sources/boost/fusion/adapted/struct/detail/preprocessor/is_seq.hpp", + "external/sources/boost/fusion/adapted/struct/detail/proxy_type.hpp", + "external/sources/boost/fusion/adapted/struct/detail/size_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/value_at_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/value_of_data_impl.hpp", + "external/sources/boost/fusion/adapted/struct/detail/value_of_impl.hpp", + "external/sources/boost/fusion/algorithm.hpp", + "external/sources/boost/fusion/algorithm/auxiliary.hpp", + "external/sources/boost/fusion/algorithm/auxiliary/copy.hpp", + "external/sources/boost/fusion/algorithm/auxiliary/move.hpp", + "external/sources/boost/fusion/algorithm/iteration.hpp", + "external/sources/boost/fusion/algorithm/iteration/accumulate.hpp", + "external/sources/boost/fusion/algorithm/iteration/accumulate_fwd.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/for_each.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/preprocessed/iter_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp", + "external/sources/boost/fusion/algorithm/iteration/fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/fold_fwd.hpp", + "external/sources/boost/fusion/algorithm/iteration/for_each.hpp", + "external/sources/boost/fusion/algorithm/iteration/for_each_fwd.hpp", + "external/sources/boost/fusion/algorithm/iteration/iter_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/iter_fold_fwd.hpp", + "external/sources/boost/fusion/algorithm/iteration/reverse_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp", + "external/sources/boost/fusion/algorithm/iteration/reverse_iter_fold.hpp", + "external/sources/boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp", + "external/sources/boost/fusion/algorithm/query.hpp", + "external/sources/boost/fusion/algorithm/query/all.hpp", + "external/sources/boost/fusion/algorithm/query/any.hpp", + "external/sources/boost/fusion/algorithm/query/count.hpp", + "external/sources/boost/fusion/algorithm/query/count_if.hpp", + "external/sources/boost/fusion/algorithm/query/detail/all.hpp", + "external/sources/boost/fusion/algorithm/query/detail/any.hpp", + "external/sources/boost/fusion/algorithm/query/detail/count.hpp", + "external/sources/boost/fusion/algorithm/query/detail/count_if.hpp", + "external/sources/boost/fusion/algorithm/query/detail/find_if.hpp", + "external/sources/boost/fusion/algorithm/query/detail/segmented_find.hpp", + "external/sources/boost/fusion/algorithm/query/detail/segmented_find_if.hpp", + "external/sources/boost/fusion/algorithm/query/find.hpp", + "external/sources/boost/fusion/algorithm/query/find_fwd.hpp", + "external/sources/boost/fusion/algorithm/query/find_if.hpp", + "external/sources/boost/fusion/algorithm/query/find_if_fwd.hpp", + "external/sources/boost/fusion/algorithm/query/none.hpp", + "external/sources/boost/fusion/algorithm/transformation.hpp", + "external/sources/boost/fusion/algorithm/transformation/clear.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/preprocessed/zip.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/preprocessed/zip10.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/preprocessed/zip20.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/preprocessed/zip30.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/preprocessed/zip40.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/preprocessed/zip50.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/replace.hpp", + "external/sources/boost/fusion/algorithm/transformation/detail/replace_if.hpp", + "external/sources/boost/fusion/algorithm/transformation/erase.hpp", + "external/sources/boost/fusion/algorithm/transformation/erase_key.hpp", + "external/sources/boost/fusion/algorithm/transformation/filter.hpp", + "external/sources/boost/fusion/algorithm/transformation/filter_if.hpp", + "external/sources/boost/fusion/algorithm/transformation/flatten.hpp", + "external/sources/boost/fusion/algorithm/transformation/insert.hpp", + "external/sources/boost/fusion/algorithm/transformation/insert_range.hpp", + "external/sources/boost/fusion/algorithm/transformation/join.hpp", + "external/sources/boost/fusion/algorithm/transformation/pop_back.hpp", + "external/sources/boost/fusion/algorithm/transformation/pop_front.hpp", + "external/sources/boost/fusion/algorithm/transformation/push_back.hpp", + "external/sources/boost/fusion/algorithm/transformation/push_front.hpp", + "external/sources/boost/fusion/algorithm/transformation/remove.hpp", + "external/sources/boost/fusion/algorithm/transformation/remove_if.hpp", + "external/sources/boost/fusion/algorithm/transformation/replace.hpp", + "external/sources/boost/fusion/algorithm/transformation/replace_if.hpp", + "external/sources/boost/fusion/algorithm/transformation/reverse.hpp", + "external/sources/boost/fusion/algorithm/transformation/transform.hpp", + "external/sources/boost/fusion/algorithm/transformation/zip.hpp", + "external/sources/boost/fusion/container.hpp", + "external/sources/boost/fusion/container/deque.hpp", + "external/sources/boost/fusion/container/deque/back_extended_deque.hpp", + "external/sources/boost/fusion/container/deque/convert.hpp", + "external/sources/boost/fusion/container/deque/deque.hpp", + "external/sources/boost/fusion/container/deque/deque_fwd.hpp", + "external/sources/boost/fusion/container/deque/deque_iterator.hpp", + "external/sources/boost/fusion/container/deque/detail/at_impl.hpp", + "external/sources/boost/fusion/container/deque/detail/begin_impl.hpp", + "external/sources/boost/fusion/container/deque/detail/convert_impl.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/as_deque.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/deque.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/deque_forward_ctor.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/deque_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/deque_initial_size.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/deque_keyed_values.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/deque_keyed_values_call.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/limits.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque10.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque20.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque30.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque40.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque50.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque10.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque10_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque20.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque20_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque30.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque30_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque40.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque40_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque50.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque50_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_fwd.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_initial_size.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_initial_size10.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_initial_size20.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_initial_size30.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_initial_size40.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_initial_size50.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_keyed_values.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_keyed_values10.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_keyed_values20.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_keyed_values30.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_keyed_values40.hpp", + "external/sources/boost/fusion/container/deque/detail/cpp03/preprocessed/deque_keyed_values50.hpp", + "external/sources/boost/fusion/container/deque/detail/deque_keyed_values.hpp", + "external/sources/boost/fusion/container/deque/detail/end_impl.hpp", + "external/sources/boost/fusion/container/deque/detail/is_sequence_impl.hpp", + "external/sources/boost/fusion/container/deque/detail/keyed_element.hpp", + "external/sources/boost/fusion/container/deque/detail/value_at_impl.hpp", + "external/sources/boost/fusion/container/deque/front_extended_deque.hpp", + "external/sources/boost/fusion/container/generation.hpp", + "external/sources/boost/fusion/container/generation/cons_tie.hpp", + "external/sources/boost/fusion/container/generation/deque_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_deque_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_list_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_make_deque.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_make_list.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_make_map.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_make_set.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_make_vector.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_map_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/pp_vector_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/deque_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/deque_tie10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/deque_tie20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/deque_tie30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/deque_tie40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/deque_tie50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/list_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/list_tie10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/list_tie20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/list_tie30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/list_tie40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/list_tie50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_deque.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_deque10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_deque20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_deque30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_deque40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_deque50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_list.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_list10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_list20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_list30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_list40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_list50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_map.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_map10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_map20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_map30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_map40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_map50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_set.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_set10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_set20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_set30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_set40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_set50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_vector.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_vector10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_vector20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_vector30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_vector40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/make_vector50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/map_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/map_tie10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/map_tie20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/map_tie30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/map_tie40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/map_tie50.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/vector_tie.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/vector_tie10.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/vector_tie20.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/vector_tie30.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/vector_tie40.hpp", + "external/sources/boost/fusion/container/generation/detail/preprocessed/vector_tie50.hpp", + "external/sources/boost/fusion/container/generation/ignore.hpp", + "external/sources/boost/fusion/container/generation/list_tie.hpp", + "external/sources/boost/fusion/container/generation/make_cons.hpp", + "external/sources/boost/fusion/container/generation/make_deque.hpp", + "external/sources/boost/fusion/container/generation/make_list.hpp", + "external/sources/boost/fusion/container/generation/make_map.hpp", + "external/sources/boost/fusion/container/generation/make_set.hpp", + "external/sources/boost/fusion/container/generation/make_vector.hpp", + "external/sources/boost/fusion/container/generation/map_tie.hpp", + "external/sources/boost/fusion/container/generation/pair_tie.hpp", + "external/sources/boost/fusion/container/generation/vector_tie.hpp", + "external/sources/boost/fusion/container/list.hpp", + "external/sources/boost/fusion/container/list/cons.hpp", + "external/sources/boost/fusion/container/list/cons_fwd.hpp", + "external/sources/boost/fusion/container/list/cons_iterator.hpp", + "external/sources/boost/fusion/container/list/convert.hpp", + "external/sources/boost/fusion/container/list/detail/at_impl.hpp", + "external/sources/boost/fusion/container/list/detail/begin_impl.hpp", + "external/sources/boost/fusion/container/list/detail/convert_impl.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/limits.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/list.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/list_forward_ctor.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/list_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/list_to_cons.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/list_to_cons_call.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list10.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list10_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list20.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list20_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list30.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list30_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list40.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list40_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list50.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list50_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_fwd.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons10.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons20.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons30.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons40.hpp", + "external/sources/boost/fusion/container/list/detail/cpp03/preprocessed/list_to_cons50.hpp", + "external/sources/boost/fusion/container/list/detail/deref_impl.hpp", + "external/sources/boost/fusion/container/list/detail/empty_impl.hpp", + "external/sources/boost/fusion/container/list/detail/end_impl.hpp", + "external/sources/boost/fusion/container/list/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/container/list/detail/list_to_cons.hpp", + "external/sources/boost/fusion/container/list/detail/next_impl.hpp", + "external/sources/boost/fusion/container/list/detail/reverse_cons.hpp", + "external/sources/boost/fusion/container/list/detail/value_at_impl.hpp", + "external/sources/boost/fusion/container/list/detail/value_of_impl.hpp", + "external/sources/boost/fusion/container/list/list.hpp", + "external/sources/boost/fusion/container/list/list_fwd.hpp", + "external/sources/boost/fusion/container/list/nil.hpp", + "external/sources/boost/fusion/container/map.hpp", + "external/sources/boost/fusion/container/map/convert.hpp", + "external/sources/boost/fusion/container/map/detail/at_impl.hpp", + "external/sources/boost/fusion/container/map/detail/at_key_impl.hpp", + "external/sources/boost/fusion/container/map/detail/begin_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/as_map.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/at_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/begin_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/convert.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/convert_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/deref_data_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/deref_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/end_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/key_of_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/limits.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/map.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/map_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/as_map.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/as_map10.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/as_map20.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/as_map30.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/as_map40.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/as_map50.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map10.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map10_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map20.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map20_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map30.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map30_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map40.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map40_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map50.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map50_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/preprocessed/map_fwd.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/value_at_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/value_of_data_impl.hpp", + "external/sources/boost/fusion/container/map/detail/cpp03/value_of_impl.hpp", + "external/sources/boost/fusion/container/map/detail/end_impl.hpp", + "external/sources/boost/fusion/container/map/detail/map_impl.hpp", + "external/sources/boost/fusion/container/map/detail/map_index.hpp", + "external/sources/boost/fusion/container/map/detail/value_at_impl.hpp", + "external/sources/boost/fusion/container/map/detail/value_at_key_impl.hpp", + "external/sources/boost/fusion/container/map/map.hpp", + "external/sources/boost/fusion/container/map/map_fwd.hpp", + "external/sources/boost/fusion/container/map/map_iterator.hpp", + "external/sources/boost/fusion/container/set.hpp", + "external/sources/boost/fusion/container/set/convert.hpp", + "external/sources/boost/fusion/container/set/detail/as_set.hpp", + "external/sources/boost/fusion/container/set/detail/begin_impl.hpp", + "external/sources/boost/fusion/container/set/detail/convert_impl.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/as_set.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/limits.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/as_set.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/as_set10.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/as_set20.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/as_set30.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/as_set40.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/as_set50.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set10.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set10_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set20.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set20_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set30.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set30_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set40.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set40_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set50.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set50_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/preprocessed/set_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/set.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/set_forward_ctor.hpp", + "external/sources/boost/fusion/container/set/detail/cpp03/set_fwd.hpp", + "external/sources/boost/fusion/container/set/detail/deref_data_impl.hpp", + "external/sources/boost/fusion/container/set/detail/deref_impl.hpp", + "external/sources/boost/fusion/container/set/detail/end_impl.hpp", + "external/sources/boost/fusion/container/set/detail/key_of_impl.hpp", + "external/sources/boost/fusion/container/set/detail/value_of_data_impl.hpp", + "external/sources/boost/fusion/container/set/detail/value_of_impl.hpp", + "external/sources/boost/fusion/container/set/set.hpp", + "external/sources/boost/fusion/container/set/set_fwd.hpp", + "external/sources/boost/fusion/container/vector.hpp", + "external/sources/boost/fusion/container/vector/convert.hpp", + "external/sources/boost/fusion/container/vector/detail/advance_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/as_vector.hpp", + "external/sources/boost/fusion/container/vector/detail/at_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/begin_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/config.hpp", + "external/sources/boost/fusion/container/vector/detail/convert_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/as_vector.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/limits.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/as_vector.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/as_vector10.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/as_vector20.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/as_vector30.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/as_vector40.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/as_vector50.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector10.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector10_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector20.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector20_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector30.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector30_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector40.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector40_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector50.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector50_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_chooser.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_chooser10.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_chooser20.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_chooser30.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_chooser40.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_chooser50.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vector_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector10.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector10_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector20.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector20_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector30.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector30_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector40.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector40_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector50.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/preprocessed/vvector50_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/value_at_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector10.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector10_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector20.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector20_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector30.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector30_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector40.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector40_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector50.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector50_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector_forward_ctor.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector_fwd.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector_n.hpp", + "external/sources/boost/fusion/container/vector/detail/cpp03/vector_n_chooser.hpp", + "external/sources/boost/fusion/container/vector/detail/deref_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/distance_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/end_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/next_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/prior_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/value_at_impl.hpp", + "external/sources/boost/fusion/container/vector/detail/value_of_impl.hpp", + "external/sources/boost/fusion/container/vector/vector.hpp", + "external/sources/boost/fusion/container/vector/vector10.hpp", + "external/sources/boost/fusion/container/vector/vector20.hpp", + "external/sources/boost/fusion/container/vector/vector30.hpp", + "external/sources/boost/fusion/container/vector/vector40.hpp", + "external/sources/boost/fusion/container/vector/vector50.hpp", + "external/sources/boost/fusion/container/vector/vector_fwd.hpp", + "external/sources/boost/fusion/container/vector/vector_iterator.hpp", + "external/sources/boost/fusion/functional.hpp", + "external/sources/boost/fusion/functional/adapter.hpp", + "external/sources/boost/fusion/functional/adapter/detail/access.hpp", + "external/sources/boost/fusion/functional/adapter/fused.hpp", + "external/sources/boost/fusion/functional/adapter/fused_function_object.hpp", + "external/sources/boost/fusion/functional/adapter/fused_procedure.hpp", + "external/sources/boost/fusion/functional/adapter/limits.hpp", + "external/sources/boost/fusion/functional/adapter/unfused.hpp", + "external/sources/boost/fusion/functional/adapter/unfused_typed.hpp", + "external/sources/boost/fusion/functional/generation.hpp", + "external/sources/boost/fusion/functional/generation/detail/gen_make_adapter.hpp", + "external/sources/boost/fusion/functional/generation/make_fused.hpp", + "external/sources/boost/fusion/functional/generation/make_fused_function_object.hpp", + "external/sources/boost/fusion/functional/generation/make_fused_procedure.hpp", + "external/sources/boost/fusion/functional/generation/make_unfused.hpp", + "external/sources/boost/fusion/functional/invocation.hpp", + "external/sources/boost/fusion/functional/invocation/detail/that_ptr.hpp", + "external/sources/boost/fusion/functional/invocation/invoke.hpp", + "external/sources/boost/fusion/functional/invocation/invoke_function_object.hpp", + "external/sources/boost/fusion/functional/invocation/invoke_procedure.hpp", + "external/sources/boost/fusion/functional/invocation/limits.hpp", + "external/sources/boost/fusion/include/accumulate.hpp", + "external/sources/boost/fusion/include/adapt_adt.hpp", + "external/sources/boost/fusion/include/adapt_adt_named.hpp", + "external/sources/boost/fusion/include/adapt_assoc_adt.hpp", + "external/sources/boost/fusion/include/adapt_assoc_adt_named.hpp", + "external/sources/boost/fusion/include/adapt_assoc_struct.hpp", + "external/sources/boost/fusion/include/adapt_assoc_struct_named.hpp", + "external/sources/boost/fusion/include/adapt_struct.hpp", + "external/sources/boost/fusion/include/adapt_struct_named.hpp", + "external/sources/boost/fusion/include/adapted.hpp", + "external/sources/boost/fusion/include/adapter.hpp", + "external/sources/boost/fusion/include/advance.hpp", + "external/sources/boost/fusion/include/algorithm.hpp", + "external/sources/boost/fusion/include/all.hpp", + "external/sources/boost/fusion/include/any.hpp", + "external/sources/boost/fusion/include/array.hpp", + "external/sources/boost/fusion/include/as_deque.hpp", + "external/sources/boost/fusion/include/as_list.hpp", + "external/sources/boost/fusion/include/as_map.hpp", + "external/sources/boost/fusion/include/as_set.hpp", + "external/sources/boost/fusion/include/as_vector.hpp", + "external/sources/boost/fusion/include/at.hpp", + "external/sources/boost/fusion/include/at_c.hpp", + "external/sources/boost/fusion/include/at_key.hpp", + "external/sources/boost/fusion/include/auxiliary.hpp", + "external/sources/boost/fusion/include/back.hpp", + "external/sources/boost/fusion/include/begin.hpp", + "external/sources/boost/fusion/include/boost_array.hpp", + "external/sources/boost/fusion/include/boost_tuple.hpp", + "external/sources/boost/fusion/include/category_of.hpp", + "external/sources/boost/fusion/include/clear.hpp", + "external/sources/boost/fusion/include/comparison.hpp", + "external/sources/boost/fusion/include/cons.hpp", + "external/sources/boost/fusion/include/cons_tie.hpp", + "external/sources/boost/fusion/include/container.hpp", + "external/sources/boost/fusion/include/convert.hpp", + "external/sources/boost/fusion/include/copy.hpp", + "external/sources/boost/fusion/include/count.hpp", + "external/sources/boost/fusion/include/count_if.hpp", + "external/sources/boost/fusion/include/deduce.hpp", + "external/sources/boost/fusion/include/deduce_sequence.hpp", + "external/sources/boost/fusion/include/define_assoc_struct.hpp", + "external/sources/boost/fusion/include/define_struct.hpp", + "external/sources/boost/fusion/include/define_struct_inline.hpp", + "external/sources/boost/fusion/include/deque.hpp", + "external/sources/boost/fusion/include/deque_fwd.hpp", + "external/sources/boost/fusion/include/deque_tie.hpp", + "external/sources/boost/fusion/include/deref.hpp", + "external/sources/boost/fusion/include/deref_data.hpp", + "external/sources/boost/fusion/include/distance.hpp", + "external/sources/boost/fusion/include/empty.hpp", + "external/sources/boost/fusion/include/end.hpp", + "external/sources/boost/fusion/include/equal_to.hpp", + "external/sources/boost/fusion/include/erase.hpp", + "external/sources/boost/fusion/include/erase_key.hpp", + "external/sources/boost/fusion/include/filter.hpp", + "external/sources/boost/fusion/include/filter_if.hpp", + "external/sources/boost/fusion/include/filter_view.hpp", + "external/sources/boost/fusion/include/find.hpp", + "external/sources/boost/fusion/include/find_if.hpp", + "external/sources/boost/fusion/include/flatten.hpp", + "external/sources/boost/fusion/include/flatten_view.hpp", + "external/sources/boost/fusion/include/fold.hpp", + "external/sources/boost/fusion/include/for_each.hpp", + "external/sources/boost/fusion/include/front.hpp", + "external/sources/boost/fusion/include/functional.hpp", + "external/sources/boost/fusion/include/fused.hpp", + "external/sources/boost/fusion/include/fused_function_object.hpp", + "external/sources/boost/fusion/include/fused_procedure.hpp", + "external/sources/boost/fusion/include/generation.hpp", + "external/sources/boost/fusion/include/greater.hpp", + "external/sources/boost/fusion/include/greater_equal.hpp", + "external/sources/boost/fusion/include/has_key.hpp", + "external/sources/boost/fusion/include/hash.hpp", + "external/sources/boost/fusion/include/ignore.hpp", + "external/sources/boost/fusion/include/in.hpp", + "external/sources/boost/fusion/include/insert.hpp", + "external/sources/boost/fusion/include/insert_range.hpp", + "external/sources/boost/fusion/include/intrinsic.hpp", + "external/sources/boost/fusion/include/invocation.hpp", + "external/sources/boost/fusion/include/invoke.hpp", + "external/sources/boost/fusion/include/invoke_function_object.hpp", + "external/sources/boost/fusion/include/invoke_procedure.hpp", + "external/sources/boost/fusion/include/io.hpp", + "external/sources/boost/fusion/include/is_iterator.hpp", + "external/sources/boost/fusion/include/is_segmented.hpp", + "external/sources/boost/fusion/include/is_sequence.hpp", + "external/sources/boost/fusion/include/is_view.hpp", + "external/sources/boost/fusion/include/iter_fold.hpp", + "external/sources/boost/fusion/include/iteration.hpp", + "external/sources/boost/fusion/include/iterator.hpp", + "external/sources/boost/fusion/include/iterator_adapter.hpp", + "external/sources/boost/fusion/include/iterator_base.hpp", + "external/sources/boost/fusion/include/iterator_facade.hpp", + "external/sources/boost/fusion/include/iterator_range.hpp", + "external/sources/boost/fusion/include/join.hpp", + "external/sources/boost/fusion/include/joint_view.hpp", + "external/sources/boost/fusion/include/key_of.hpp", + "external/sources/boost/fusion/include/less.hpp", + "external/sources/boost/fusion/include/less_equal.hpp", + "external/sources/boost/fusion/include/list.hpp", + "external/sources/boost/fusion/include/list_fwd.hpp", + "external/sources/boost/fusion/include/list_tie.hpp", + "external/sources/boost/fusion/include/make_cons.hpp", + "external/sources/boost/fusion/include/make_deque.hpp", + "external/sources/boost/fusion/include/make_fused.hpp", + "external/sources/boost/fusion/include/make_fused_function_object.hpp", + "external/sources/boost/fusion/include/make_fused_procedure.hpp", + "external/sources/boost/fusion/include/make_list.hpp", + "external/sources/boost/fusion/include/make_map.hpp", + "external/sources/boost/fusion/include/make_set.hpp", + "external/sources/boost/fusion/include/make_tuple.hpp", + "external/sources/boost/fusion/include/make_unfused.hpp", + "external/sources/boost/fusion/include/make_vector.hpp", + "external/sources/boost/fusion/include/map.hpp", + "external/sources/boost/fusion/include/map_fwd.hpp", + "external/sources/boost/fusion/include/map_tie.hpp", + "external/sources/boost/fusion/include/move.hpp", + "external/sources/boost/fusion/include/mpl.hpp", + "external/sources/boost/fusion/include/next.hpp", + "external/sources/boost/fusion/include/nil.hpp", + "external/sources/boost/fusion/include/none.hpp", + "external/sources/boost/fusion/include/not_equal_to.hpp", + "external/sources/boost/fusion/include/nview.hpp", + "external/sources/boost/fusion/include/out.hpp", + "external/sources/boost/fusion/include/pair.hpp", + "external/sources/boost/fusion/include/pair_tie.hpp", + "external/sources/boost/fusion/include/pop_back.hpp", + "external/sources/boost/fusion/include/pop_front.hpp", + "external/sources/boost/fusion/include/prior.hpp", + "external/sources/boost/fusion/include/proxy_type.hpp", + "external/sources/boost/fusion/include/push_back.hpp", + "external/sources/boost/fusion/include/push_front.hpp", + "external/sources/boost/fusion/include/query.hpp", + "external/sources/boost/fusion/include/remove.hpp", + "external/sources/boost/fusion/include/remove_if.hpp", + "external/sources/boost/fusion/include/repetitive_view.hpp", + "external/sources/boost/fusion/include/replace.hpp", + "external/sources/boost/fusion/include/replace_if.hpp", + "external/sources/boost/fusion/include/reverse.hpp", + "external/sources/boost/fusion/include/reverse_fold.hpp", + "external/sources/boost/fusion/include/reverse_iter_fold.hpp", + "external/sources/boost/fusion/include/reverse_view.hpp", + "external/sources/boost/fusion/include/segmented_fold_until.hpp", + "external/sources/boost/fusion/include/segmented_iterator.hpp", + "external/sources/boost/fusion/include/segments.hpp", + "external/sources/boost/fusion/include/sequence.hpp", + "external/sources/boost/fusion/include/sequence_base.hpp", + "external/sources/boost/fusion/include/sequence_facade.hpp", + "external/sources/boost/fusion/include/set.hpp", + "external/sources/boost/fusion/include/set_fwd.hpp", + "external/sources/boost/fusion/include/single_view.hpp", + "external/sources/boost/fusion/include/size.hpp", + "external/sources/boost/fusion/include/std_array.hpp", + "external/sources/boost/fusion/include/std_pair.hpp", + "external/sources/boost/fusion/include/std_tuple.hpp", + "external/sources/boost/fusion/include/struct.hpp", + "external/sources/boost/fusion/include/support.hpp", + "external/sources/boost/fusion/include/swap.hpp", + "external/sources/boost/fusion/include/tag_of.hpp", + "external/sources/boost/fusion/include/tag_of_fwd.hpp", + "external/sources/boost/fusion/include/transform.hpp", + "external/sources/boost/fusion/include/transform_view.hpp", + "external/sources/boost/fusion/include/transformation.hpp", + "external/sources/boost/fusion/include/tuple.hpp", + "external/sources/boost/fusion/include/tuple_fwd.hpp", + "external/sources/boost/fusion/include/tuple_tie.hpp", + "external/sources/boost/fusion/include/unfused.hpp", + "external/sources/boost/fusion/include/unfused_typed.hpp", + "external/sources/boost/fusion/include/unused.hpp", + "external/sources/boost/fusion/include/value_at.hpp", + "external/sources/boost/fusion/include/value_at_key.hpp", + "external/sources/boost/fusion/include/value_of.hpp", + "external/sources/boost/fusion/include/value_of_data.hpp", + "external/sources/boost/fusion/include/vector.hpp", + "external/sources/boost/fusion/include/vector10.hpp", + "external/sources/boost/fusion/include/vector20.hpp", + "external/sources/boost/fusion/include/vector30.hpp", + "external/sources/boost/fusion/include/vector40.hpp", + "external/sources/boost/fusion/include/vector50.hpp", + "external/sources/boost/fusion/include/vector_fwd.hpp", + "external/sources/boost/fusion/include/vector_tie.hpp", + "external/sources/boost/fusion/include/view.hpp", + "external/sources/boost/fusion/include/void.hpp", + "external/sources/boost/fusion/include/zip.hpp", + "external/sources/boost/fusion/include/zip_view.hpp", + "external/sources/boost/fusion/iterator.hpp", + "external/sources/boost/fusion/iterator/advance.hpp", + "external/sources/boost/fusion/iterator/basic_iterator.hpp", + "external/sources/boost/fusion/iterator/deref.hpp", + "external/sources/boost/fusion/iterator/deref_data.hpp", + "external/sources/boost/fusion/iterator/detail/adapt_deref_traits.hpp", + "external/sources/boost/fusion/iterator/detail/adapt_value_traits.hpp", + "external/sources/boost/fusion/iterator/detail/advance.hpp", + "external/sources/boost/fusion/iterator/detail/distance.hpp", + "external/sources/boost/fusion/iterator/detail/segment_sequence.hpp", + "external/sources/boost/fusion/iterator/detail/segmented_equal_to.hpp", + "external/sources/boost/fusion/iterator/detail/segmented_iterator.hpp", + "external/sources/boost/fusion/iterator/detail/segmented_next_impl.hpp", + "external/sources/boost/fusion/iterator/distance.hpp", + "external/sources/boost/fusion/iterator/equal_to.hpp", + "external/sources/boost/fusion/iterator/iterator_adapter.hpp", + "external/sources/boost/fusion/iterator/iterator_facade.hpp", + "external/sources/boost/fusion/iterator/key_of.hpp", + "external/sources/boost/fusion/iterator/mpl.hpp", + "external/sources/boost/fusion/iterator/mpl/convert_iterator.hpp", + "external/sources/boost/fusion/iterator/mpl/fusion_iterator.hpp", + "external/sources/boost/fusion/iterator/next.hpp", + "external/sources/boost/fusion/iterator/prior.hpp", + "external/sources/boost/fusion/iterator/segmented_iterator.hpp", + "external/sources/boost/fusion/iterator/value_of.hpp", + "external/sources/boost/fusion/iterator/value_of_data.hpp", + "external/sources/boost/fusion/mpl.hpp", + "external/sources/boost/fusion/mpl/at.hpp", + "external/sources/boost/fusion/mpl/back.hpp", + "external/sources/boost/fusion/mpl/begin.hpp", + "external/sources/boost/fusion/mpl/clear.hpp", + "external/sources/boost/fusion/mpl/detail/clear.hpp", + "external/sources/boost/fusion/mpl/empty.hpp", + "external/sources/boost/fusion/mpl/end.hpp", + "external/sources/boost/fusion/mpl/erase.hpp", + "external/sources/boost/fusion/mpl/erase_key.hpp", + "external/sources/boost/fusion/mpl/front.hpp", + "external/sources/boost/fusion/mpl/has_key.hpp", + "external/sources/boost/fusion/mpl/insert.hpp", + "external/sources/boost/fusion/mpl/insert_range.hpp", + "external/sources/boost/fusion/mpl/pop_back.hpp", + "external/sources/boost/fusion/mpl/pop_front.hpp", + "external/sources/boost/fusion/mpl/push_back.hpp", + "external/sources/boost/fusion/mpl/push_front.hpp", + "external/sources/boost/fusion/mpl/size.hpp", + "external/sources/boost/fusion/sequence.hpp", + "external/sources/boost/fusion/sequence/comparison.hpp", + "external/sources/boost/fusion/sequence/comparison/detail/equal_to.hpp", + "external/sources/boost/fusion/sequence/comparison/detail/greater.hpp", + "external/sources/boost/fusion/sequence/comparison/detail/greater_equal.hpp", + "external/sources/boost/fusion/sequence/comparison/detail/less.hpp", + "external/sources/boost/fusion/sequence/comparison/detail/less_equal.hpp", + "external/sources/boost/fusion/sequence/comparison/detail/not_equal_to.hpp", + "external/sources/boost/fusion/sequence/comparison/enable_comparison.hpp", + "external/sources/boost/fusion/sequence/comparison/equal_to.hpp", + "external/sources/boost/fusion/sequence/comparison/greater.hpp", + "external/sources/boost/fusion/sequence/comparison/greater_equal.hpp", + "external/sources/boost/fusion/sequence/comparison/less.hpp", + "external/sources/boost/fusion/sequence/comparison/less_equal.hpp", + "external/sources/boost/fusion/sequence/comparison/not_equal_to.hpp", + "external/sources/boost/fusion/sequence/convert.hpp", + "external/sources/boost/fusion/sequence/hash.hpp", + "external/sources/boost/fusion/sequence/intrinsic.hpp", + "external/sources/boost/fusion/sequence/intrinsic/at.hpp", + "external/sources/boost/fusion/sequence/intrinsic/at_c.hpp", + "external/sources/boost/fusion/sequence/intrinsic/at_key.hpp", + "external/sources/boost/fusion/sequence/intrinsic/back.hpp", + "external/sources/boost/fusion/sequence/intrinsic/begin.hpp", + "external/sources/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp", + "external/sources/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp", + "external/sources/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp", + "external/sources/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp", + "external/sources/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp", + "external/sources/boost/fusion/sequence/intrinsic/empty.hpp", + "external/sources/boost/fusion/sequence/intrinsic/end.hpp", + "external/sources/boost/fusion/sequence/intrinsic/front.hpp", + "external/sources/boost/fusion/sequence/intrinsic/has_key.hpp", + "external/sources/boost/fusion/sequence/intrinsic/segments.hpp", + "external/sources/boost/fusion/sequence/intrinsic/size.hpp", + "external/sources/boost/fusion/sequence/intrinsic/swap.hpp", + "external/sources/boost/fusion/sequence/intrinsic/value_at.hpp", + "external/sources/boost/fusion/sequence/intrinsic/value_at_key.hpp", + "external/sources/boost/fusion/sequence/intrinsic_fwd.hpp", + "external/sources/boost/fusion/sequence/io.hpp", + "external/sources/boost/fusion/sequence/io/detail/in.hpp", + "external/sources/boost/fusion/sequence/io/detail/manip.hpp", + "external/sources/boost/fusion/sequence/io/detail/out.hpp", + "external/sources/boost/fusion/sequence/io/in.hpp", + "external/sources/boost/fusion/sequence/io/out.hpp", + "external/sources/boost/fusion/sequence/sequence_facade.hpp", + "external/sources/boost/fusion/support.hpp", + "external/sources/boost/fusion/support/as_const.hpp", + "external/sources/boost/fusion/support/category_of.hpp", + "external/sources/boost/fusion/support/config.hpp", + "external/sources/boost/fusion/support/deduce.hpp", + "external/sources/boost/fusion/support/deduce_sequence.hpp", + "external/sources/boost/fusion/support/detail/access.hpp", + "external/sources/boost/fusion/support/detail/and.hpp", + "external/sources/boost/fusion/support/detail/as_fusion_element.hpp", + "external/sources/boost/fusion/support/detail/enabler.hpp", + "external/sources/boost/fusion/support/detail/index_sequence.hpp", + "external/sources/boost/fusion/support/detail/is_mpl_sequence.hpp", + "external/sources/boost/fusion/support/detail/is_native_fusion_sequence.hpp", + "external/sources/boost/fusion/support/detail/is_same_size.hpp", + "external/sources/boost/fusion/support/detail/mpl_iterator_category.hpp", + "external/sources/boost/fusion/support/detail/pp_round.hpp", + "external/sources/boost/fusion/support/detail/segmented_fold_until_impl.hpp", + "external/sources/boost/fusion/support/is_iterator.hpp", + "external/sources/boost/fusion/support/is_segmented.hpp", + "external/sources/boost/fusion/support/is_sequence.hpp", + "external/sources/boost/fusion/support/is_view.hpp", + "external/sources/boost/fusion/support/iterator_base.hpp", + "external/sources/boost/fusion/support/pair.hpp", + "external/sources/boost/fusion/support/segmented_fold_until.hpp", + "external/sources/boost/fusion/support/sequence_base.hpp", + "external/sources/boost/fusion/support/tag_of.hpp", + "external/sources/boost/fusion/support/tag_of_fwd.hpp", + "external/sources/boost/fusion/support/unused.hpp", + "external/sources/boost/fusion/support/void.hpp", + "external/sources/boost/fusion/tuple.hpp", + "external/sources/boost/fusion/tuple/detail/make_tuple.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/make_tuple10.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/make_tuple20.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/make_tuple30.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/make_tuple40.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/make_tuple50.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple10.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple10_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple20.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple20_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple30.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple30_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple40.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple40_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple50.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple50_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_tie10.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_tie20.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_tie30.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_tie40.hpp", + "external/sources/boost/fusion/tuple/detail/preprocessed/tuple_tie50.hpp", + "external/sources/boost/fusion/tuple/detail/tuple.hpp", + "external/sources/boost/fusion/tuple/detail/tuple_expand.hpp", + "external/sources/boost/fusion/tuple/detail/tuple_fwd.hpp", + "external/sources/boost/fusion/tuple/detail/tuple_tie.hpp", + "external/sources/boost/fusion/tuple/make_tuple.hpp", + "external/sources/boost/fusion/tuple/tuple.hpp", + "external/sources/boost/fusion/tuple/tuple_fwd.hpp", + "external/sources/boost/fusion/tuple/tuple_tie.hpp", + "external/sources/boost/fusion/view.hpp", + "external/sources/boost/fusion/view/detail/strictest_traversal.hpp", + "external/sources/boost/fusion/view/filter_view.hpp", + "external/sources/boost/fusion/view/filter_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/deref_data_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/key_of_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/size_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/value_of_data_impl.hpp", + "external/sources/boost/fusion/view/filter_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/filter_view/filter_view.hpp", + "external/sources/boost/fusion/view/filter_view/filter_view_iterator.hpp", + "external/sources/boost/fusion/view/flatten_view.hpp", + "external/sources/boost/fusion/view/flatten_view/flatten_view.hpp", + "external/sources/boost/fusion/view/flatten_view/flatten_view_iterator.hpp", + "external/sources/boost/fusion/view/iterator_range.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/at_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/end_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/segments_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/size_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/detail/value_at_impl.hpp", + "external/sources/boost/fusion/view/iterator_range/iterator_range.hpp", + "external/sources/boost/fusion/view/joint_view.hpp", + "external/sources/boost/fusion/view/joint_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/deref_data_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/key_of_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/value_of_data_impl.hpp", + "external/sources/boost/fusion/view/joint_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/joint_view/joint_view.hpp", + "external/sources/boost/fusion/view/joint_view/joint_view_fwd.hpp", + "external/sources/boost/fusion/view/joint_view/joint_view_iterator.hpp", + "external/sources/boost/fusion/view/nview.hpp", + "external/sources/boost/fusion/view/nview/detail/advance_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/at_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/cpp03/nview_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/distance_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/end_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/next_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/nview_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/prior_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/size_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/value_at_impl.hpp", + "external/sources/boost/fusion/view/nview/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/nview/nview.hpp", + "external/sources/boost/fusion/view/nview/nview_iterator.hpp", + "external/sources/boost/fusion/view/repetitive_view.hpp", + "external/sources/boost/fusion/view/repetitive_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/repetitive_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/repetitive_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/repetitive_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/repetitive_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/repetitive_view/repetitive_view.hpp", + "external/sources/boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp", + "external/sources/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp", + "external/sources/boost/fusion/view/reverse_view.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/advance_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/at_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/deref_data_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/distance_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/key_of_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/prior_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/value_at_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/value_of_data_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/reverse_view/reverse_view.hpp", + "external/sources/boost/fusion/view/reverse_view/reverse_view_iterator.hpp", + "external/sources/boost/fusion/view/single_view.hpp", + "external/sources/boost/fusion/view/single_view/detail/advance_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/at_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/distance_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/prior_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/size_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/value_at_impl.hpp", + "external/sources/boost/fusion/view/single_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/single_view/single_view.hpp", + "external/sources/boost/fusion/view/single_view/single_view_iterator.hpp", + "external/sources/boost/fusion/view/transform_view.hpp", + "external/sources/boost/fusion/view/transform_view/detail/advance_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/at_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/distance_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/prior_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/value_at_impl.hpp", + "external/sources/boost/fusion/view/transform_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/transform_view/transform_view.hpp", + "external/sources/boost/fusion/view/transform_view/transform_view_fwd.hpp", + "external/sources/boost/fusion/view/transform_view/transform_view_iterator.hpp", + "external/sources/boost/fusion/view/zip_view.hpp", + "external/sources/boost/fusion/view/zip_view/detail/advance_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/at_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/begin_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/deref_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/distance_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/end_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/equal_to_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/next_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/prior_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/size_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/value_at_impl.hpp", + "external/sources/boost/fusion/view/zip_view/detail/value_of_impl.hpp", + "external/sources/boost/fusion/view/zip_view/zip_view.hpp", + "external/sources/boost/fusion/view/zip_view/zip_view_iterator.hpp", + "external/sources/boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp", + "external/sources/boost/generator_iterator.hpp", + "external/sources/boost/geometry.hpp", + "external/sources/boost/geometry/algorithms/append.hpp", + "external/sources/boost/geometry/algorithms/area.hpp", + "external/sources/boost/geometry/algorithms/assign.hpp", + "external/sources/boost/geometry/algorithms/buffer.hpp", + "external/sources/boost/geometry/algorithms/centroid.hpp", + "external/sources/boost/geometry/algorithms/clear.hpp", + "external/sources/boost/geometry/algorithms/comparable_distance.hpp", + "external/sources/boost/geometry/algorithms/convert.hpp", + "external/sources/boost/geometry/algorithms/convex_hull.hpp", + "external/sources/boost/geometry/algorithms/correct.hpp", + "external/sources/boost/geometry/algorithms/correct_closure.hpp", + "external/sources/boost/geometry/algorithms/covered_by.hpp", + "external/sources/boost/geometry/algorithms/crosses.hpp", + "external/sources/boost/geometry/algorithms/densify.hpp", + "external/sources/boost/geometry/algorithms/detail/as_range.hpp", + "external/sources/boost/geometry/algorithms/detail/assign_box_corners.hpp", + "external/sources/boost/geometry/algorithms/detail/assign_indexed_point.hpp", + "external/sources/boost/geometry/algorithms/detail/assign_values.hpp", + "external/sources/boost/geometry/algorithms/detail/azimuth.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/buffer_box.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/buffered_ring.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/line_line_intersection.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/piece_border.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/turn_in_original_visitor.hpp", + "external/sources/boost/geometry/algorithms/detail/buffer/turn_in_piece_visitor.hpp", + "external/sources/boost/geometry/algorithms/detail/calculate_null.hpp", + "external/sources/boost/geometry/algorithms/detail/calculate_point_order.hpp", + "external/sources/boost/geometry/algorithms/detail/calculate_sum.hpp", + "external/sources/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp", + "external/sources/boost/geometry/algorithms/detail/check_iterator_range.hpp", + "external/sources/boost/geometry/algorithms/detail/closest_feature/geometry_to_range.hpp", + "external/sources/boost/geometry/algorithms/detail/closest_feature/point_to_range.hpp", + "external/sources/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp", + "external/sources/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/comparable_distance/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp", + "external/sources/boost/geometry/algorithms/detail/convert_point_to_point.hpp", + "external/sources/boost/geometry/algorithms/detail/counting.hpp", + "external/sources/boost/geometry/algorithms/detail/course.hpp", + "external/sources/boost/geometry/algorithms/detail/covered_by/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/covered_by/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/direction_code.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/box_box.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/linear_segment_or_box.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/multipoint_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/point_box.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/point_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/point_point.hpp", + "external/sources/boost/geometry/algorithms/detail/disjoint/segment_box.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/backward_compatibility.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/box_to_box.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/default_strategies.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/geometry_to_segment_or_box.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/is_comparable.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/iterator_selector.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/linear_or_areal_to_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/linear_to_box.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/linear_to_linear.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/multipoint_to_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/point_to_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/range_to_geometry_rtree.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/segment_to_box.hpp", + "external/sources/boost/geometry/algorithms/detail/distance/segment_to_segment.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/areal.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/box.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/initialize.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/intersects_antimeridian.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/linear.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/multipoint.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/point.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/range.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/segment.hpp", + "external/sources/boost/geometry/algorithms/detail/envelope/transform_units.hpp", + "external/sources/boost/geometry/algorithms/detail/equals/collect_vectors.hpp", + "external/sources/boost/geometry/algorithms/detail/equals/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/equals/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/equals/point_point.hpp", + "external/sources/boost/geometry/algorithms/detail/expand/box.hpp", + "external/sources/boost/geometry/algorithms/detail/expand/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/expand/indexed.hpp", + "external/sources/boost/geometry/algorithms/detail/expand/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/expand/point.hpp", + "external/sources/boost/geometry/algorithms/detail/expand/segment.hpp", + "external/sources/boost/geometry/algorithms/detail/expand_by_epsilon.hpp", + "external/sources/boost/geometry/algorithms/detail/extreme_points.hpp", + "external/sources/boost/geometry/algorithms/detail/for_each_range.hpp", + "external/sources/boost/geometry/algorithms/detail/get_max_size.hpp", + "external/sources/boost/geometry/algorithms/detail/has_self_intersections.hpp", + "external/sources/boost/geometry/algorithms/detail/interior_iterator.hpp", + "external/sources/boost/geometry/algorithms/detail/intersection/areal_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/intersection/box_box.hpp", + "external/sources/boost/geometry/algorithms/detail/intersection/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/intersection/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/intersection/multi.hpp", + "external/sources/boost/geometry/algorithms/detail/intersects/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/intersects/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/always_simple.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/areal.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/debug_print_boundary_points.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/failure_policy.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/linear.hpp", + "external/sources/boost/geometry/algorithms/detail/is_simple/multipoint.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/box.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/complement_graph.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/debug_complement_graph.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/debug_print_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/debug_validity_phase.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/has_spikes.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/is_acceptable_turn.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/linear.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/pointlike.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/polygon.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/ring.hpp", + "external/sources/boost/geometry/algorithms/detail/is_valid/segment.hpp", + "external/sources/boost/geometry/algorithms/detail/make/make.hpp", + "external/sources/boost/geometry/algorithms/detail/max_interval_gap.hpp", + "external/sources/boost/geometry/algorithms/detail/multi_modify.hpp", + "external/sources/boost/geometry/algorithms/detail/multi_modify_with_predicate.hpp", + "external/sources/boost/geometry/algorithms/detail/multi_sum.hpp", + "external/sources/boost/geometry/algorithms/detail/normalize.hpp", + "external/sources/boost/geometry/algorithms/detail/not.hpp", + "external/sources/boost/geometry/algorithms/detail/num_distinct_consecutive_points.hpp", + "external/sources/boost/geometry/algorithms/detail/overlaps/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/overlaps/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/add_rings.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/assign_parents.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/check_enrich.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/cluster_exits.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/cluster_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/convert_ring.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/copy_segments.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/do_reverse.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/enrichment_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/follow.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_distance_measure.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_relative_order.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_ring.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/get_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/handle_self_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/is_self_turn.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/linear_linear.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/needs_self_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/overlay.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/overlay_type.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/pointlike_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/range_in_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/ring_properties.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/segment_as_subrange.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/segment_identifier.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/select_rings.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/stream_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/traversal.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/traversal_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/traverse.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/turn_info.hpp", + "external/sources/boost/geometry/algorithms/detail/overlay/visit_info.hpp", + "external/sources/boost/geometry/algorithms/detail/partition.hpp", + "external/sources/boost/geometry/algorithms/detail/point_is_spike_or_equal.hpp", + "external/sources/boost/geometry/algorithms/detail/point_on_border.hpp", + "external/sources/boost/geometry/algorithms/detail/recalculate.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/areal_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/boundary_checker.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/de9im.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/follow_helpers.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/linear_areal.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/linear_linear.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/multi_point_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/point_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/point_point.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/relate_impl.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/result.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/topology_check.hpp", + "external/sources/boost/geometry/algorithms/detail/relate/turns.hpp", + "external/sources/boost/geometry/algorithms/detail/relation/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/relation/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/ring_identifier.hpp", + "external/sources/boost/geometry/algorithms/detail/sections/range_by_section.hpp", + "external/sources/boost/geometry/algorithms/detail/sections/section_box_policies.hpp", + "external/sources/boost/geometry/algorithms/detail/sections/section_functions.hpp", + "external/sources/boost/geometry/algorithms/detail/sections/sectionalize.hpp", + "external/sources/boost/geometry/algorithms/detail/signed_size_type.hpp", + "external/sources/boost/geometry/algorithms/detail/single_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/sub_range.hpp", + "external/sources/boost/geometry/algorithms/detail/sweep.hpp", + "external/sources/boost/geometry/algorithms/detail/throw_on_empty_input.hpp", + "external/sources/boost/geometry/algorithms/detail/touches/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/touches/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/tupled_output.hpp", + "external/sources/boost/geometry/algorithms/detail/turns/compare_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/turns/debug_turn.hpp", + "external/sources/boost/geometry/algorithms/detail/turns/filter_continue_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/turns/print_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/turns/remove_duplicate_turns.hpp", + "external/sources/boost/geometry/algorithms/detail/within/implementation.hpp", + "external/sources/boost/geometry/algorithms/detail/within/interface.hpp", + "external/sources/boost/geometry/algorithms/detail/within/multi_point.hpp", + "external/sources/boost/geometry/algorithms/detail/within/point_in_geometry.hpp", + "external/sources/boost/geometry/algorithms/detail/within/within_no_turns.hpp", + "external/sources/boost/geometry/algorithms/difference.hpp", + "external/sources/boost/geometry/algorithms/discrete_frechet_distance.hpp", + "external/sources/boost/geometry/algorithms/discrete_hausdorff_distance.hpp", + "external/sources/boost/geometry/algorithms/disjoint.hpp", + "external/sources/boost/geometry/algorithms/dispatch/disjoint.hpp", + "external/sources/boost/geometry/algorithms/dispatch/distance.hpp", + "external/sources/boost/geometry/algorithms/dispatch/envelope.hpp", + "external/sources/boost/geometry/algorithms/dispatch/expand.hpp", + "external/sources/boost/geometry/algorithms/dispatch/is_simple.hpp", + "external/sources/boost/geometry/algorithms/dispatch/is_valid.hpp", + "external/sources/boost/geometry/algorithms/distance.hpp", + "external/sources/boost/geometry/algorithms/envelope.hpp", + "external/sources/boost/geometry/algorithms/equals.hpp", + "external/sources/boost/geometry/algorithms/expand.hpp", + "external/sources/boost/geometry/algorithms/for_each.hpp", + "external/sources/boost/geometry/algorithms/intersection.hpp", + "external/sources/boost/geometry/algorithms/intersects.hpp", + "external/sources/boost/geometry/algorithms/is_convex.hpp", + "external/sources/boost/geometry/algorithms/is_empty.hpp", + "external/sources/boost/geometry/algorithms/is_simple.hpp", + "external/sources/boost/geometry/algorithms/is_valid.hpp", + "external/sources/boost/geometry/algorithms/length.hpp", + "external/sources/boost/geometry/algorithms/line_interpolate.hpp", + "external/sources/boost/geometry/algorithms/make.hpp", + "external/sources/boost/geometry/algorithms/not_implemented.hpp", + "external/sources/boost/geometry/algorithms/num_geometries.hpp", + "external/sources/boost/geometry/algorithms/num_interior_rings.hpp", + "external/sources/boost/geometry/algorithms/num_points.hpp", + "external/sources/boost/geometry/algorithms/num_segments.hpp", + "external/sources/boost/geometry/algorithms/overlaps.hpp", + "external/sources/boost/geometry/algorithms/perimeter.hpp", + "external/sources/boost/geometry/algorithms/point_on_surface.hpp", + "external/sources/boost/geometry/algorithms/relate.hpp", + "external/sources/boost/geometry/algorithms/relation.hpp", + "external/sources/boost/geometry/algorithms/remove_spikes.hpp", + "external/sources/boost/geometry/algorithms/reverse.hpp", + "external/sources/boost/geometry/algorithms/simplify.hpp", + "external/sources/boost/geometry/algorithms/sym_difference.hpp", + "external/sources/boost/geometry/algorithms/touches.hpp", + "external/sources/boost/geometry/algorithms/transform.hpp", + "external/sources/boost/geometry/algorithms/union.hpp", + "external/sources/boost/geometry/algorithms/unique.hpp", + "external/sources/boost/geometry/algorithms/validity_failure_type.hpp", + "external/sources/boost/geometry/algorithms/within.hpp", + "external/sources/boost/geometry/arithmetic/arithmetic.hpp", + "external/sources/boost/geometry/arithmetic/cross_product.hpp", + "external/sources/boost/geometry/arithmetic/determinant.hpp", + "external/sources/boost/geometry/arithmetic/dot_product.hpp", + "external/sources/boost/geometry/arithmetic/infinite_line_functions.hpp", + "external/sources/boost/geometry/arithmetic/normalize.hpp", + "external/sources/boost/geometry/core/access.hpp", + "external/sources/boost/geometry/core/assert.hpp", + "external/sources/boost/geometry/core/closure.hpp", + "external/sources/boost/geometry/core/config.hpp", + "external/sources/boost/geometry/core/coordinate_dimension.hpp", + "external/sources/boost/geometry/core/coordinate_system.hpp", + "external/sources/boost/geometry/core/coordinate_type.hpp", + "external/sources/boost/geometry/core/cs.hpp", + "external/sources/boost/geometry/core/exception.hpp", + "external/sources/boost/geometry/core/exterior_ring.hpp", + "external/sources/boost/geometry/core/geometry_id.hpp", + "external/sources/boost/geometry/core/interior_rings.hpp", + "external/sources/boost/geometry/core/interior_type.hpp", + "external/sources/boost/geometry/core/is_areal.hpp", + "external/sources/boost/geometry/core/mutable_range.hpp", + "external/sources/boost/geometry/core/point_order.hpp", + "external/sources/boost/geometry/core/point_type.hpp", + "external/sources/boost/geometry/core/radian_access.hpp", + "external/sources/boost/geometry/core/radius.hpp", + "external/sources/boost/geometry/core/reverse_dispatch.hpp", + "external/sources/boost/geometry/core/ring_type.hpp", + "external/sources/boost/geometry/core/tag.hpp", + "external/sources/boost/geometry/core/tag_cast.hpp", + "external/sources/boost/geometry/core/tags.hpp", + "external/sources/boost/geometry/core/topological_dimension.hpp", + "external/sources/boost/geometry/formulas/andoyer_inverse.hpp", + "external/sources/boost/geometry/formulas/area_formulas.hpp", + "external/sources/boost/geometry/formulas/authalic_radius_sqr.hpp", + "external/sources/boost/geometry/formulas/differential_quantities.hpp", + "external/sources/boost/geometry/formulas/eccentricity_sqr.hpp", + "external/sources/boost/geometry/formulas/flattening.hpp", + "external/sources/boost/geometry/formulas/geographic.hpp", + "external/sources/boost/geometry/formulas/gnomonic_intersection.hpp", + "external/sources/boost/geometry/formulas/gnomonic_spheroid.hpp", + "external/sources/boost/geometry/formulas/interpolate_point_spherical.hpp", + "external/sources/boost/geometry/formulas/karney_direct.hpp", + "external/sources/boost/geometry/formulas/karney_inverse.hpp", + "external/sources/boost/geometry/formulas/mean_radius.hpp", + "external/sources/boost/geometry/formulas/meridian_direct.hpp", + "external/sources/boost/geometry/formulas/meridian_inverse.hpp", + "external/sources/boost/geometry/formulas/meridian_segment.hpp", + "external/sources/boost/geometry/formulas/quarter_meridian.hpp", + "external/sources/boost/geometry/formulas/result_direct.hpp", + "external/sources/boost/geometry/formulas/result_inverse.hpp", + "external/sources/boost/geometry/formulas/sjoberg_intersection.hpp", + "external/sources/boost/geometry/formulas/spherical.hpp", + "external/sources/boost/geometry/formulas/thomas_direct.hpp", + "external/sources/boost/geometry/formulas/thomas_inverse.hpp", + "external/sources/boost/geometry/formulas/unit_spheroid.hpp", + "external/sources/boost/geometry/formulas/vertex_latitude.hpp", + "external/sources/boost/geometry/formulas/vertex_longitude.hpp", + "external/sources/boost/geometry/formulas/vincenty_direct.hpp", + "external/sources/boost/geometry/formulas/vincenty_inverse.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_array.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_fusion.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/box.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/hole_iterator.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/holes_proxy.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/point.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/polygon.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/ring.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_range/adjacent_filtered.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_range/filtered.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_range/reversed.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_range/sliced.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_range/strided.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_range/uniqued.hpp", + "external/sources/boost/geometry/geometries/adapted/boost_tuple.hpp", + "external/sources/boost/geometry/geometries/adapted/c_array.hpp", + "external/sources/boost/geometry/geometries/adapted/std_array.hpp", + "external/sources/boost/geometry/geometries/adapted/std_pair_as_segment.hpp", + "external/sources/boost/geometry/geometries/box.hpp", + "external/sources/boost/geometry/geometries/concepts/box_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/check.hpp", + "external/sources/boost/geometry/geometries/concepts/linestring_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/multi_linestring_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/multi_point_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/multi_polygon_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/point_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/polygon_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/ring_concept.hpp", + "external/sources/boost/geometry/geometries/concepts/segment_concept.hpp", + "external/sources/boost/geometry/geometries/geometries.hpp", + "external/sources/boost/geometry/geometries/helper_geometry.hpp", + "external/sources/boost/geometry/geometries/infinite_line.hpp", + "external/sources/boost/geometry/geometries/linestring.hpp", + "external/sources/boost/geometry/geometries/multi_linestring.hpp", + "external/sources/boost/geometry/geometries/multi_point.hpp", + "external/sources/boost/geometry/geometries/multi_polygon.hpp", + "external/sources/boost/geometry/geometries/point.hpp", + "external/sources/boost/geometry/geometries/point_xy.hpp", + "external/sources/boost/geometry/geometries/point_xyz.hpp", + "external/sources/boost/geometry/geometries/pointing_segment.hpp", + "external/sources/boost/geometry/geometries/polygon.hpp", + "external/sources/boost/geometry/geometries/register/box.hpp", + "external/sources/boost/geometry/geometries/register/linestring.hpp", + "external/sources/boost/geometry/geometries/register/multi_linestring.hpp", + "external/sources/boost/geometry/geometries/register/multi_point.hpp", + "external/sources/boost/geometry/geometries/register/multi_polygon.hpp", + "external/sources/boost/geometry/geometries/register/point.hpp", + "external/sources/boost/geometry/geometries/register/ring.hpp", + "external/sources/boost/geometry/geometries/register/segment.hpp", + "external/sources/boost/geometry/geometries/ring.hpp", + "external/sources/boost/geometry/geometries/segment.hpp", + "external/sources/boost/geometry/geometries/variant.hpp", + "external/sources/boost/geometry/geometry.hpp", + "external/sources/boost/geometry/index/adaptors/query.hpp", + "external/sources/boost/geometry/index/detail/algorithms/bounds.hpp", + "external/sources/boost/geometry/index/detail/algorithms/comparable_distance_centroid.hpp", + "external/sources/boost/geometry/index/detail/algorithms/comparable_distance_far.hpp", + "external/sources/boost/geometry/index/detail/algorithms/comparable_distance_near.hpp", + "external/sources/boost/geometry/index/detail/algorithms/content.hpp", + "external/sources/boost/geometry/index/detail/algorithms/diff_abs.hpp", + "external/sources/boost/geometry/index/detail/algorithms/intersection_content.hpp", + "external/sources/boost/geometry/index/detail/algorithms/is_valid.hpp", + "external/sources/boost/geometry/index/detail/algorithms/margin.hpp", + "external/sources/boost/geometry/index/detail/algorithms/minmaxdist.hpp", + "external/sources/boost/geometry/index/detail/algorithms/nth_element.hpp", + "external/sources/boost/geometry/index/detail/algorithms/path_intersection.hpp", + "external/sources/boost/geometry/index/detail/algorithms/segment_intersection.hpp", + "external/sources/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp", + "external/sources/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp", + "external/sources/boost/geometry/index/detail/algorithms/union_content.hpp", + "external/sources/boost/geometry/index/detail/assert.hpp", + "external/sources/boost/geometry/index/detail/bounded_view.hpp", + "external/sources/boost/geometry/index/detail/config_begin.hpp", + "external/sources/boost/geometry/index/detail/config_end.hpp", + "external/sources/boost/geometry/index/detail/distance_predicates.hpp", + "external/sources/boost/geometry/index/detail/exception.hpp", + "external/sources/boost/geometry/index/detail/is_bounding_geometry.hpp", + "external/sources/boost/geometry/index/detail/is_indexable.hpp", + "external/sources/boost/geometry/index/detail/meta.hpp", + "external/sources/boost/geometry/index/detail/predicates.hpp", + "external/sources/boost/geometry/index/detail/rtree/adaptors.hpp", + "external/sources/boost/geometry/index/detail/rtree/iterators.hpp", + "external/sources/boost/geometry/index/detail/rtree/kmeans/kmeans.hpp", + "external/sources/boost/geometry/index/detail/rtree/kmeans/split.hpp", + "external/sources/boost/geometry/index/detail/rtree/linear/linear.hpp", + "external/sources/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/concept.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/node.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/node_elements.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/pairs.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/scoped_deallocator.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/subtree_destroyer.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/variant_static.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/variant_visitor.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/weak_static.hpp", + "external/sources/boost/geometry/index/detail/rtree/node/weak_visitor.hpp", + "external/sources/boost/geometry/index/detail/rtree/options.hpp", + "external/sources/boost/geometry/index/detail/rtree/pack_create.hpp", + "external/sources/boost/geometry/index/detail/rtree/quadratic/quadratic.hpp", + "external/sources/boost/geometry/index/detail/rtree/quadratic/redistribute_elements.hpp", + "external/sources/boost/geometry/index/detail/rtree/query_iterators.hpp", + "external/sources/boost/geometry/index/detail/rtree/rstar/choose_next_node.hpp", + "external/sources/boost/geometry/index/detail/rtree/rstar/insert.hpp", + "external/sources/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp", + "external/sources/boost/geometry/index/detail/rtree/rstar/rstar.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/are_boxes_ok.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/are_counts_ok.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/are_levels_ok.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/gl_draw.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/print.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/statistics.hpp", + "external/sources/boost/geometry/index/detail/rtree/utilities/view.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/children_box.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/copy.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/count.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/destroy.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/distance_query.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/insert.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/is_leaf.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/iterator.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/remove.hpp", + "external/sources/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp", + "external/sources/boost/geometry/index/detail/serialization.hpp", + "external/sources/boost/geometry/index/detail/tags.hpp", + "external/sources/boost/geometry/index/detail/translator.hpp", + "external/sources/boost/geometry/index/detail/utilities.hpp", + "external/sources/boost/geometry/index/detail/varray.hpp", + "external/sources/boost/geometry/index/detail/varray_detail.hpp", + "external/sources/boost/geometry/index/distance_predicates.hpp", + "external/sources/boost/geometry/index/equal_to.hpp", + "external/sources/boost/geometry/index/indexable.hpp", + "external/sources/boost/geometry/index/inserter.hpp", + "external/sources/boost/geometry/index/parameters.hpp", + "external/sources/boost/geometry/index/predicates.hpp", + "external/sources/boost/geometry/index/rtree.hpp", + "external/sources/boost/geometry/io/dsv/write.hpp", + "external/sources/boost/geometry/io/io.hpp", + "external/sources/boost/geometry/io/svg/svg_mapper.hpp", + "external/sources/boost/geometry/io/svg/write.hpp", + "external/sources/boost/geometry/io/svg/write_svg.hpp", + "external/sources/boost/geometry/io/svg/write_svg_multi.hpp", + "external/sources/boost/geometry/io/wkt/detail/prefix.hpp", + "external/sources/boost/geometry/io/wkt/detail/wkt_multi.hpp", + "external/sources/boost/geometry/io/wkt/read.hpp", + "external/sources/boost/geometry/io/wkt/stream.hpp", + "external/sources/boost/geometry/io/wkt/wkt.hpp", + "external/sources/boost/geometry/io/wkt/write.hpp", + "external/sources/boost/geometry/iterators/base.hpp", + "external/sources/boost/geometry/iterators/closing_iterator.hpp", + "external/sources/boost/geometry/iterators/concatenate_iterator.hpp", + "external/sources/boost/geometry/iterators/detail/point_iterator/inner_range_type.hpp", + "external/sources/boost/geometry/iterators/detail/point_iterator/iterator_type.hpp", + "external/sources/boost/geometry/iterators/detail/point_iterator/value_type.hpp", + "external/sources/boost/geometry/iterators/detail/segment_iterator/iterator_type.hpp", + "external/sources/boost/geometry/iterators/detail/segment_iterator/range_segment_iterator.hpp", + "external/sources/boost/geometry/iterators/detail/segment_iterator/value_type.hpp", + "external/sources/boost/geometry/iterators/dispatch/point_iterator.hpp", + "external/sources/boost/geometry/iterators/dispatch/segment_iterator.hpp", + "external/sources/boost/geometry/iterators/ever_circling_iterator.hpp", + "external/sources/boost/geometry/iterators/flatten_iterator.hpp", + "external/sources/boost/geometry/iterators/has_one_element.hpp", + "external/sources/boost/geometry/iterators/point_iterator.hpp", + "external/sources/boost/geometry/iterators/point_reverse_iterator.hpp", + "external/sources/boost/geometry/iterators/segment_iterator.hpp", + "external/sources/boost/geometry/multi/algorithms/append.hpp", + "external/sources/boost/geometry/multi/algorithms/area.hpp", + "external/sources/boost/geometry/multi/algorithms/centroid.hpp", + "external/sources/boost/geometry/multi/algorithms/clear.hpp", + "external/sources/boost/geometry/multi/algorithms/convert.hpp", + "external/sources/boost/geometry/multi/algorithms/correct.hpp", + "external/sources/boost/geometry/multi/algorithms/covered_by.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/extreme_points.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/for_each_range.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/modify.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/multi_sum.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/point_on_border.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp", + "external/sources/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp", + "external/sources/boost/geometry/multi/algorithms/disjoint.hpp", + "external/sources/boost/geometry/multi/algorithms/distance.hpp", + "external/sources/boost/geometry/multi/algorithms/envelope.hpp", + "external/sources/boost/geometry/multi/algorithms/equals.hpp", + "external/sources/boost/geometry/multi/algorithms/for_each.hpp", + "external/sources/boost/geometry/multi/algorithms/intersection.hpp", + "external/sources/boost/geometry/multi/algorithms/length.hpp", + "external/sources/boost/geometry/multi/algorithms/num_geometries.hpp", + "external/sources/boost/geometry/multi/algorithms/num_interior_rings.hpp", + "external/sources/boost/geometry/multi/algorithms/num_points.hpp", + "external/sources/boost/geometry/multi/algorithms/perimeter.hpp", + "external/sources/boost/geometry/multi/algorithms/remove_spikes.hpp", + "external/sources/boost/geometry/multi/algorithms/reverse.hpp", + "external/sources/boost/geometry/multi/algorithms/simplify.hpp", + "external/sources/boost/geometry/multi/algorithms/transform.hpp", + "external/sources/boost/geometry/multi/algorithms/unique.hpp", + "external/sources/boost/geometry/multi/algorithms/within.hpp", + "external/sources/boost/geometry/multi/core/closure.hpp", + "external/sources/boost/geometry/multi/core/geometry_id.hpp", + "external/sources/boost/geometry/multi/core/interior_rings.hpp", + "external/sources/boost/geometry/multi/core/is_areal.hpp", + "external/sources/boost/geometry/multi/core/point_order.hpp", + "external/sources/boost/geometry/multi/core/point_type.hpp", + "external/sources/boost/geometry/multi/core/ring_type.hpp", + "external/sources/boost/geometry/multi/core/tags.hpp", + "external/sources/boost/geometry/multi/core/topological_dimension.hpp", + "external/sources/boost/geometry/multi/geometries/concepts/check.hpp", + "external/sources/boost/geometry/multi/geometries/concepts/multi_linestring_concept.hpp", + "external/sources/boost/geometry/multi/geometries/concepts/multi_point_concept.hpp", + "external/sources/boost/geometry/multi/geometries/concepts/multi_polygon_concept.hpp", + "external/sources/boost/geometry/multi/geometries/multi_geometries.hpp", + "external/sources/boost/geometry/multi/geometries/multi_linestring.hpp", + "external/sources/boost/geometry/multi/geometries/multi_point.hpp", + "external/sources/boost/geometry/multi/geometries/multi_polygon.hpp", + "external/sources/boost/geometry/multi/geometries/register/multi_linestring.hpp", + "external/sources/boost/geometry/multi/geometries/register/multi_point.hpp", + "external/sources/boost/geometry/multi/geometries/register/multi_polygon.hpp", + "external/sources/boost/geometry/multi/io/dsv/write.hpp", + "external/sources/boost/geometry/multi/io/wkt/detail/prefix.hpp", + "external/sources/boost/geometry/multi/io/wkt/read.hpp", + "external/sources/boost/geometry/multi/io/wkt/wkt.hpp", + "external/sources/boost/geometry/multi/io/wkt/write.hpp", + "external/sources/boost/geometry/multi/multi.hpp", + "external/sources/boost/geometry/multi/strategies/cartesian/centroid_average.hpp", + "external/sources/boost/geometry/multi/views/detail/range_type.hpp", + "external/sources/boost/geometry/policies/compare.hpp", + "external/sources/boost/geometry/policies/disjoint_interrupt_policy.hpp", + "external/sources/boost/geometry/policies/is_valid/default_policy.hpp", + "external/sources/boost/geometry/policies/is_valid/failing_reason_policy.hpp", + "external/sources/boost/geometry/policies/is_valid/failure_type_policy.hpp", + "external/sources/boost/geometry/policies/predicate_based_interrupt_policy.hpp", + "external/sources/boost/geometry/policies/relate/direction.hpp", + "external/sources/boost/geometry/policies/relate/intersection_points.hpp", + "external/sources/boost/geometry/policies/relate/intersection_ratios.hpp", + "external/sources/boost/geometry/policies/relate/tupled.hpp", + "external/sources/boost/geometry/policies/robustness/get_rescale_policy.hpp", + "external/sources/boost/geometry/policies/robustness/no_rescale_policy.hpp", + "external/sources/boost/geometry/policies/robustness/rescale_policy.hpp", + "external/sources/boost/geometry/policies/robustness/rescale_policy_tags.hpp", + "external/sources/boost/geometry/policies/robustness/robust_point_type.hpp", + "external/sources/boost/geometry/policies/robustness/robust_type.hpp", + "external/sources/boost/geometry/policies/robustness/segment_ratio.hpp", + "external/sources/boost/geometry/policies/robustness/segment_ratio_type.hpp", + "external/sources/boost/geometry/srs/epsg.hpp", + "external/sources/boost/geometry/srs/esri.hpp", + "external/sources/boost/geometry/srs/iau2000.hpp", + "external/sources/boost/geometry/srs/projection.hpp", + "external/sources/boost/geometry/srs/projections/code.hpp", + "external/sources/boost/geometry/srs/projections/constants.hpp", + "external/sources/boost/geometry/srs/projections/dpar.hpp", + "external/sources/boost/geometry/srs/projections/epsg.hpp", + "external/sources/boost/geometry/srs/projections/epsg_params.hpp", + "external/sources/boost/geometry/srs/projections/epsg_traits.hpp", + "external/sources/boost/geometry/srs/projections/esri.hpp", + "external/sources/boost/geometry/srs/projections/esri_params.hpp", + "external/sources/boost/geometry/srs/projections/esri_traits.hpp", + "external/sources/boost/geometry/srs/projections/exception.hpp", + "external/sources/boost/geometry/srs/projections/factory.hpp", + "external/sources/boost/geometry/srs/projections/grids.hpp", + "external/sources/boost/geometry/srs/projections/iau2000.hpp", + "external/sources/boost/geometry/srs/projections/iau2000_params.hpp", + "external/sources/boost/geometry/srs/projections/iau2000_traits.hpp", + "external/sources/boost/geometry/srs/projections/impl/aasincos.hpp", + "external/sources/boost/geometry/srs/projections/impl/adjlon.hpp", + "external/sources/boost/geometry/srs/projections/impl/base_dynamic.hpp", + "external/sources/boost/geometry/srs/projections/impl/base_static.hpp", + "external/sources/boost/geometry/srs/projections/impl/dms_parser.hpp", + "external/sources/boost/geometry/srs/projections/impl/factory_entry.hpp", + "external/sources/boost/geometry/srs/projections/impl/function_overloads.hpp", + "external/sources/boost/geometry/srs/projections/impl/geocent.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_apply_gridshift.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_auth.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_datum_set.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_datums.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_ell_set.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_ellps.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_fwd.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_gauss.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_gridinfo.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_gridlist.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_init.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_inv.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_mlfn.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_msfn.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_param.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_phi2.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_qsfn.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_strerrno.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_transform.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_tsfn.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_units.hpp", + "external/sources/boost/geometry/srs/projections/impl/pj_zpoly1.hpp", + "external/sources/boost/geometry/srs/projections/impl/proj_mdist.hpp", + "external/sources/boost/geometry/srs/projections/impl/projects.hpp", + "external/sources/boost/geometry/srs/projections/invalid_point.hpp", + "external/sources/boost/geometry/srs/projections/par_data.hpp", + "external/sources/boost/geometry/srs/projections/proj/aea.hpp", + "external/sources/boost/geometry/srs/projections/proj/aeqd.hpp", + "external/sources/boost/geometry/srs/projections/proj/airy.hpp", + "external/sources/boost/geometry/srs/projections/proj/aitoff.hpp", + "external/sources/boost/geometry/srs/projections/proj/august.hpp", + "external/sources/boost/geometry/srs/projections/proj/bacon.hpp", + "external/sources/boost/geometry/srs/projections/proj/bipc.hpp", + "external/sources/boost/geometry/srs/projections/proj/boggs.hpp", + "external/sources/boost/geometry/srs/projections/proj/bonne.hpp", + "external/sources/boost/geometry/srs/projections/proj/cass.hpp", + "external/sources/boost/geometry/srs/projections/proj/cc.hpp", + "external/sources/boost/geometry/srs/projections/proj/cea.hpp", + "external/sources/boost/geometry/srs/projections/proj/chamb.hpp", + "external/sources/boost/geometry/srs/projections/proj/collg.hpp", + "external/sources/boost/geometry/srs/projections/proj/crast.hpp", + "external/sources/boost/geometry/srs/projections/proj/denoy.hpp", + "external/sources/boost/geometry/srs/projections/proj/eck1.hpp", + "external/sources/boost/geometry/srs/projections/proj/eck2.hpp", + "external/sources/boost/geometry/srs/projections/proj/eck3.hpp", + "external/sources/boost/geometry/srs/projections/proj/eck4.hpp", + "external/sources/boost/geometry/srs/projections/proj/eck5.hpp", + "external/sources/boost/geometry/srs/projections/proj/eqc.hpp", + "external/sources/boost/geometry/srs/projections/proj/eqdc.hpp", + "external/sources/boost/geometry/srs/projections/proj/etmerc.hpp", + "external/sources/boost/geometry/srs/projections/proj/fahey.hpp", + "external/sources/boost/geometry/srs/projections/proj/fouc_s.hpp", + "external/sources/boost/geometry/srs/projections/proj/gall.hpp", + "external/sources/boost/geometry/srs/projections/proj/geocent.hpp", + "external/sources/boost/geometry/srs/projections/proj/geos.hpp", + "external/sources/boost/geometry/srs/projections/proj/gins8.hpp", + "external/sources/boost/geometry/srs/projections/proj/gn_sinu.hpp", + "external/sources/boost/geometry/srs/projections/proj/gnom.hpp", + "external/sources/boost/geometry/srs/projections/proj/goode.hpp", + "external/sources/boost/geometry/srs/projections/proj/gstmerc.hpp", + "external/sources/boost/geometry/srs/projections/proj/hammer.hpp", + "external/sources/boost/geometry/srs/projections/proj/hatano.hpp", + "external/sources/boost/geometry/srs/projections/proj/healpix.hpp", + "external/sources/boost/geometry/srs/projections/proj/igh.hpp", + "external/sources/boost/geometry/srs/projections/proj/imw_p.hpp", + "external/sources/boost/geometry/srs/projections/proj/isea.hpp", + "external/sources/boost/geometry/srs/projections/proj/krovak.hpp", + "external/sources/boost/geometry/srs/projections/proj/labrd.hpp", + "external/sources/boost/geometry/srs/projections/proj/laea.hpp", + "external/sources/boost/geometry/srs/projections/proj/lagrng.hpp", + "external/sources/boost/geometry/srs/projections/proj/larr.hpp", + "external/sources/boost/geometry/srs/projections/proj/lask.hpp", + "external/sources/boost/geometry/srs/projections/proj/latlong.hpp", + "external/sources/boost/geometry/srs/projections/proj/lcc.hpp", + "external/sources/boost/geometry/srs/projections/proj/lcca.hpp", + "external/sources/boost/geometry/srs/projections/proj/loxim.hpp", + "external/sources/boost/geometry/srs/projections/proj/lsat.hpp", + "external/sources/boost/geometry/srs/projections/proj/mbt_fps.hpp", + "external/sources/boost/geometry/srs/projections/proj/mbtfpp.hpp", + "external/sources/boost/geometry/srs/projections/proj/mbtfpq.hpp", + "external/sources/boost/geometry/srs/projections/proj/merc.hpp", + "external/sources/boost/geometry/srs/projections/proj/mill.hpp", + "external/sources/boost/geometry/srs/projections/proj/mod_ster.hpp", + "external/sources/boost/geometry/srs/projections/proj/moll.hpp", + "external/sources/boost/geometry/srs/projections/proj/natearth.hpp", + "external/sources/boost/geometry/srs/projections/proj/nell.hpp", + "external/sources/boost/geometry/srs/projections/proj/nell_h.hpp", + "external/sources/boost/geometry/srs/projections/proj/nocol.hpp", + "external/sources/boost/geometry/srs/projections/proj/nsper.hpp", + "external/sources/boost/geometry/srs/projections/proj/nzmg.hpp", + "external/sources/boost/geometry/srs/projections/proj/ob_tran.hpp", + "external/sources/boost/geometry/srs/projections/proj/ocea.hpp", + "external/sources/boost/geometry/srs/projections/proj/oea.hpp", + "external/sources/boost/geometry/srs/projections/proj/omerc.hpp", + "external/sources/boost/geometry/srs/projections/proj/ortho.hpp", + "external/sources/boost/geometry/srs/projections/proj/poly.hpp", + "external/sources/boost/geometry/srs/projections/proj/putp2.hpp", + "external/sources/boost/geometry/srs/projections/proj/putp3.hpp", + "external/sources/boost/geometry/srs/projections/proj/putp4p.hpp", + "external/sources/boost/geometry/srs/projections/proj/putp5.hpp", + "external/sources/boost/geometry/srs/projections/proj/putp6.hpp", + "external/sources/boost/geometry/srs/projections/proj/qsc.hpp", + "external/sources/boost/geometry/srs/projections/proj/robin.hpp", + "external/sources/boost/geometry/srs/projections/proj/rouss.hpp", + "external/sources/boost/geometry/srs/projections/proj/rpoly.hpp", + "external/sources/boost/geometry/srs/projections/proj/sconics.hpp", + "external/sources/boost/geometry/srs/projections/proj/somerc.hpp", + "external/sources/boost/geometry/srs/projections/proj/stere.hpp", + "external/sources/boost/geometry/srs/projections/proj/sterea.hpp", + "external/sources/boost/geometry/srs/projections/proj/sts.hpp", + "external/sources/boost/geometry/srs/projections/proj/tcc.hpp", + "external/sources/boost/geometry/srs/projections/proj/tcea.hpp", + "external/sources/boost/geometry/srs/projections/proj/tmerc.hpp", + "external/sources/boost/geometry/srs/projections/proj/tpeqd.hpp", + "external/sources/boost/geometry/srs/projections/proj/urm5.hpp", + "external/sources/boost/geometry/srs/projections/proj/urmfps.hpp", + "external/sources/boost/geometry/srs/projections/proj/vandg.hpp", + "external/sources/boost/geometry/srs/projections/proj/vandg2.hpp", + "external/sources/boost/geometry/srs/projections/proj/vandg4.hpp", + "external/sources/boost/geometry/srs/projections/proj/wag2.hpp", + "external/sources/boost/geometry/srs/projections/proj/wag3.hpp", + "external/sources/boost/geometry/srs/projections/proj/wag7.hpp", + "external/sources/boost/geometry/srs/projections/proj/wink1.hpp", + "external/sources/boost/geometry/srs/projections/proj/wink2.hpp", + "external/sources/boost/geometry/srs/projections/proj4.hpp", + "external/sources/boost/geometry/srs/projections/spar.hpp", + "external/sources/boost/geometry/srs/projections/srid_traits.hpp", + "external/sources/boost/geometry/srs/projections/str_cast.hpp", + "external/sources/boost/geometry/srs/shared_grids.hpp", + "external/sources/boost/geometry/srs/shared_grids_boost.hpp", + "external/sources/boost/geometry/srs/shared_grids_std.hpp", + "external/sources/boost/geometry/srs/sphere.hpp", + "external/sources/boost/geometry/srs/spheroid.hpp", + "external/sources/boost/geometry/srs/srs.hpp", + "external/sources/boost/geometry/srs/transformation.hpp", + "external/sources/boost/geometry/strategies/agnostic/buffer_distance_asymmetric.hpp", + "external/sources/boost/geometry/strategies/agnostic/buffer_distance_symmetric.hpp", + "external/sources/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp", + "external/sources/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp", + "external/sources/boost/geometry/strategies/agnostic/point_in_point.hpp", + "external/sources/boost/geometry/strategies/agnostic/point_in_poly_oriented_winding.hpp", + "external/sources/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp", + "external/sources/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp", + "external/sources/boost/geometry/strategies/area.hpp", + "external/sources/boost/geometry/strategies/area_result.hpp", + "external/sources/boost/geometry/strategies/azimuth.hpp", + "external/sources/boost/geometry/strategies/buffer.hpp", + "external/sources/boost/geometry/strategies/cartesian/area.hpp", + "external/sources/boost/geometry/strategies/cartesian/area_surveyor.hpp", + "external/sources/boost/geometry/strategies/cartesian/azimuth.hpp", + "external/sources/boost/geometry/strategies/cartesian/box_in_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_end_flat.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_end_round.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_join_miter.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_join_round.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_join_round_by_divide.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_point_circle.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_point_square.hpp", + "external/sources/boost/geometry/strategies/cartesian/buffer_side_straight.hpp", + "external/sources/boost/geometry/strategies/cartesian/centroid_average.hpp", + "external/sources/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp", + "external/sources/boost/geometry/strategies/cartesian/centroid_weighted_length.hpp", + "external/sources/boost/geometry/strategies/cartesian/densify.hpp", + "external/sources/boost/geometry/strategies/cartesian/disjoint_box_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/distance_projected_point.hpp", + "external/sources/boost/geometry/strategies/cartesian/distance_projected_point_ax.hpp", + "external/sources/boost/geometry/strategies/cartesian/distance_pythagoras.hpp", + "external/sources/boost/geometry/strategies/cartesian/distance_pythagoras_box_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/distance_segment_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/envelope.hpp", + "external/sources/boost/geometry/strategies/cartesian/envelope_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/envelope_multipoint.hpp", + "external/sources/boost/geometry/strategies/cartesian/envelope_point.hpp", + "external/sources/boost/geometry/strategies/cartesian/envelope_segment.hpp", + "external/sources/boost/geometry/strategies/cartesian/expand_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/expand_point.hpp", + "external/sources/boost/geometry/strategies/cartesian/expand_segment.hpp", + "external/sources/boost/geometry/strategies/cartesian/index.hpp", + "external/sources/boost/geometry/strategies/cartesian/intersection.hpp", + "external/sources/boost/geometry/strategies/cartesian/io.hpp", + "external/sources/boost/geometry/strategies/cartesian/line_interpolate.hpp", + "external/sources/boost/geometry/strategies/cartesian/point_in_box.hpp", + "external/sources/boost/geometry/strategies/cartesian/point_in_point.hpp", + "external/sources/boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp", + "external/sources/boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp", + "external/sources/boost/geometry/strategies/cartesian/point_in_poly_winding.hpp", + "external/sources/boost/geometry/strategies/cartesian/point_order.hpp", + "external/sources/boost/geometry/strategies/cartesian/side_by_triangle.hpp", + "external/sources/boost/geometry/strategies/cartesian/turn_in_ring_winding.hpp", + "external/sources/boost/geometry/strategies/centroid.hpp", + "external/sources/boost/geometry/strategies/comparable_distance_result.hpp", + "external/sources/boost/geometry/strategies/compare.hpp", + "external/sources/boost/geometry/strategies/concepts/area_concept.hpp", + "external/sources/boost/geometry/strategies/concepts/centroid_concept.hpp", + "external/sources/boost/geometry/strategies/concepts/convex_hull_concept.hpp", + "external/sources/boost/geometry/strategies/concepts/distance_concept.hpp", + "external/sources/boost/geometry/strategies/concepts/segment_intersect_concept.hpp", + "external/sources/boost/geometry/strategies/concepts/simplify_concept.hpp", + "external/sources/boost/geometry/strategies/concepts/within_concept.hpp", + "external/sources/boost/geometry/strategies/convex_hull.hpp", + "external/sources/boost/geometry/strategies/covered_by.hpp", + "external/sources/boost/geometry/strategies/default_area_result.hpp", + "external/sources/boost/geometry/strategies/default_comparable_distance_result.hpp", + "external/sources/boost/geometry/strategies/default_distance_result.hpp", + "external/sources/boost/geometry/strategies/default_length_result.hpp", + "external/sources/boost/geometry/strategies/default_strategy.hpp", + "external/sources/boost/geometry/strategies/densify.hpp", + "external/sources/boost/geometry/strategies/disjoint.hpp", + "external/sources/boost/geometry/strategies/distance.hpp", + "external/sources/boost/geometry/strategies/distance_result.hpp", + "external/sources/boost/geometry/strategies/envelope.hpp", + "external/sources/boost/geometry/strategies/expand.hpp", + "external/sources/boost/geometry/strategies/geographic/area.hpp", + "external/sources/boost/geometry/strategies/geographic/azimuth.hpp", + "external/sources/boost/geometry/strategies/geographic/buffer_point_circle.hpp", + "external/sources/boost/geometry/strategies/geographic/densify.hpp", + "external/sources/boost/geometry/strategies/geographic/disjoint_segment_box.hpp", + "external/sources/boost/geometry/strategies/geographic/distance.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_andoyer.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_cross_track.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_karney.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_segment_box.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_thomas.hpp", + "external/sources/boost/geometry/strategies/geographic/distance_vincenty.hpp", + "external/sources/boost/geometry/strategies/geographic/envelope.hpp", + "external/sources/boost/geometry/strategies/geographic/envelope_segment.hpp", + "external/sources/boost/geometry/strategies/geographic/expand_segment.hpp", + "external/sources/boost/geometry/strategies/geographic/index.hpp", + "external/sources/boost/geometry/strategies/geographic/intersection.hpp", + "external/sources/boost/geometry/strategies/geographic/intersection_elliptic.hpp", + "external/sources/boost/geometry/strategies/geographic/io.hpp", + "external/sources/boost/geometry/strategies/geographic/line_interpolate.hpp", + "external/sources/boost/geometry/strategies/geographic/mapping_ssf.hpp", + "external/sources/boost/geometry/strategies/geographic/parameters.hpp", + "external/sources/boost/geometry/strategies/geographic/point_in_poly_winding.hpp", + "external/sources/boost/geometry/strategies/geographic/point_order.hpp", + "external/sources/boost/geometry/strategies/geographic/side.hpp", + "external/sources/boost/geometry/strategies/geographic/side_andoyer.hpp", + "external/sources/boost/geometry/strategies/geographic/side_thomas.hpp", + "external/sources/boost/geometry/strategies/geographic/side_vincenty.hpp", + "external/sources/boost/geometry/strategies/index.hpp", + "external/sources/boost/geometry/strategies/intersection.hpp", + "external/sources/boost/geometry/strategies/intersection_result.hpp", + "external/sources/boost/geometry/strategies/intersection_strategies.hpp", + "external/sources/boost/geometry/strategies/io.hpp", + "external/sources/boost/geometry/strategies/line_interpolate.hpp", + "external/sources/boost/geometry/strategies/normalize.hpp", + "external/sources/boost/geometry/strategies/point_order.hpp", + "external/sources/boost/geometry/strategies/relate.hpp", + "external/sources/boost/geometry/strategies/side.hpp", + "external/sources/boost/geometry/strategies/side_info.hpp", + "external/sources/boost/geometry/strategies/spherical/area.hpp", + "external/sources/boost/geometry/strategies/spherical/azimuth.hpp", + "external/sources/boost/geometry/strategies/spherical/compare.hpp", + "external/sources/boost/geometry/strategies/spherical/densify.hpp", + "external/sources/boost/geometry/strategies/spherical/disjoint_box_box.hpp", + "external/sources/boost/geometry/strategies/spherical/disjoint_segment_box.hpp", + "external/sources/boost/geometry/strategies/spherical/distance_cross_track.hpp", + "external/sources/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp", + "external/sources/boost/geometry/strategies/spherical/distance_cross_track_point_box.hpp", + "external/sources/boost/geometry/strategies/spherical/distance_haversine.hpp", + "external/sources/boost/geometry/strategies/spherical/distance_segment_box.hpp", + "external/sources/boost/geometry/strategies/spherical/envelope.hpp", + "external/sources/boost/geometry/strategies/spherical/envelope_box.hpp", + "external/sources/boost/geometry/strategies/spherical/envelope_multipoint.hpp", + "external/sources/boost/geometry/strategies/spherical/envelope_point.hpp", + "external/sources/boost/geometry/strategies/spherical/envelope_segment.hpp", + "external/sources/boost/geometry/strategies/spherical/expand_box.hpp", + "external/sources/boost/geometry/strategies/spherical/expand_point.hpp", + "external/sources/boost/geometry/strategies/spherical/expand_segment.hpp", + "external/sources/boost/geometry/strategies/spherical/get_radius.hpp", + "external/sources/boost/geometry/strategies/spherical/index.hpp", + "external/sources/boost/geometry/strategies/spherical/intersection.hpp", + "external/sources/boost/geometry/strategies/spherical/io.hpp", + "external/sources/boost/geometry/strategies/spherical/line_interpolate.hpp", + "external/sources/boost/geometry/strategies/spherical/point_in_point.hpp", + "external/sources/boost/geometry/strategies/spherical/point_in_poly_winding.hpp", + "external/sources/boost/geometry/strategies/spherical/point_order.hpp", + "external/sources/boost/geometry/strategies/spherical/side_by_cross_track.hpp", + "external/sources/boost/geometry/strategies/spherical/ssf.hpp", + "external/sources/boost/geometry/strategies/strategies.hpp", + "external/sources/boost/geometry/strategies/strategy_transform.hpp", + "external/sources/boost/geometry/strategies/tags.hpp", + "external/sources/boost/geometry/strategies/transform.hpp", + "external/sources/boost/geometry/strategies/transform/inverse_transformer.hpp", + "external/sources/boost/geometry/strategies/transform/map_transformer.hpp", + "external/sources/boost/geometry/strategies/transform/matrix_transformers.hpp", + "external/sources/boost/geometry/strategies/transform/srs_transformer.hpp", + "external/sources/boost/geometry/strategies/within.hpp", + "external/sources/boost/geometry/util/add_const_if_c.hpp", + "external/sources/boost/geometry/util/bare_type.hpp", + "external/sources/boost/geometry/util/calculation_type.hpp", + "external/sources/boost/geometry/util/closure_as_bool.hpp", + "external/sources/boost/geometry/util/combine_if.hpp", + "external/sources/boost/geometry/util/compress_variant.hpp", + "external/sources/boost/geometry/util/condition.hpp", + "external/sources/boost/geometry/util/coordinate_cast.hpp", + "external/sources/boost/geometry/util/for_each_coordinate.hpp", + "external/sources/boost/geometry/util/has_infinite_coordinate.hpp", + "external/sources/boost/geometry/util/has_nan_coordinate.hpp", + "external/sources/boost/geometry/util/has_non_finite_coordinate.hpp", + "external/sources/boost/geometry/util/is_inverse_spheroidal_coordinates.hpp", + "external/sources/boost/geometry/util/math.hpp", + "external/sources/boost/geometry/util/normalize_spheroidal_box_coordinates.hpp", + "external/sources/boost/geometry/util/normalize_spheroidal_coordinates.hpp", + "external/sources/boost/geometry/util/order_as_direction.hpp", + "external/sources/boost/geometry/util/parameter_type_of.hpp", + "external/sources/boost/geometry/util/promote_floating_point.hpp", + "external/sources/boost/geometry/util/promote_integral.hpp", + "external/sources/boost/geometry/util/range.hpp", + "external/sources/boost/geometry/util/rational.hpp", + "external/sources/boost/geometry/util/readme.txt", + "external/sources/boost/geometry/util/select_calculation_type.hpp", + "external/sources/boost/geometry/util/select_coordinate_type.hpp", + "external/sources/boost/geometry/util/select_most_precise.hpp", + "external/sources/boost/geometry/util/select_sequence_element.hpp", + "external/sources/boost/geometry/util/series_expansion.hpp", + "external/sources/boost/geometry/util/transform_variant.hpp", + "external/sources/boost/geometry/util/tuples.hpp", + "external/sources/boost/geometry/views/box_view.hpp", + "external/sources/boost/geometry/views/closeable_view.hpp", + "external/sources/boost/geometry/views/detail/boundary_view.hpp", + "external/sources/boost/geometry/views/detail/boundary_view/implementation.hpp", + "external/sources/boost/geometry/views/detail/boundary_view/interface.hpp", + "external/sources/boost/geometry/views/detail/indexed_point_view.hpp", + "external/sources/boost/geometry/views/detail/normalized_view.hpp", + "external/sources/boost/geometry/views/detail/points_view.hpp", + "external/sources/boost/geometry/views/detail/range_type.hpp", + "external/sources/boost/geometry/views/detail/two_dimensional_view.hpp", + "external/sources/boost/geometry/views/identity_view.hpp", + "external/sources/boost/geometry/views/reversible_view.hpp", + "external/sources/boost/geometry/views/segment_view.hpp", + "external/sources/boost/get_pointer.hpp", + "external/sources/boost/gil.hpp", + "external/sources/boost/gil/algorithm.hpp", + "external/sources/boost/gil/bit_aligned_pixel_iterator.hpp", + "external/sources/boost/gil/bit_aligned_pixel_reference.hpp", + "external/sources/boost/gil/channel.hpp", + "external/sources/boost/gil/channel_algorithm.hpp", + "external/sources/boost/gil/cmyk.hpp", + "external/sources/boost/gil/color_base.hpp", + "external/sources/boost/gil/color_base_algorithm.hpp", + "external/sources/boost/gil/color_convert.hpp", + "external/sources/boost/gil/concepts.hpp", + "external/sources/boost/gil/concepts/basic.hpp", + "external/sources/boost/gil/concepts/channel.hpp", + "external/sources/boost/gil/concepts/color.hpp", + "external/sources/boost/gil/concepts/color_base.hpp", + "external/sources/boost/gil/concepts/concept_check.hpp", + "external/sources/boost/gil/concepts/detail/type_traits.hpp", + "external/sources/boost/gil/concepts/detail/utility.hpp", + "external/sources/boost/gil/concepts/dynamic_step.hpp", + "external/sources/boost/gil/concepts/fwd.hpp", + "external/sources/boost/gil/concepts/image.hpp", + "external/sources/boost/gil/concepts/image_view.hpp", + "external/sources/boost/gil/concepts/pixel.hpp", + "external/sources/boost/gil/concepts/pixel_based.hpp", + "external/sources/boost/gil/concepts/pixel_dereference.hpp", + "external/sources/boost/gil/concepts/pixel_iterator.hpp", + "external/sources/boost/gil/concepts/pixel_locator.hpp", + "external/sources/boost/gil/concepts/point.hpp", + "external/sources/boost/gil/deprecated.hpp", + "external/sources/boost/gil/detail/is_channel_integral.hpp", + "external/sources/boost/gil/detail/math.hpp", + "external/sources/boost/gil/detail/mp11.hpp", + "external/sources/boost/gil/detail/std_common_type.hpp", + "external/sources/boost/gil/detail/type_traits.hpp", + "external/sources/boost/gil/device_n.hpp", + "external/sources/boost/gil/dynamic_step.hpp", + "external/sources/boost/gil/extension/dynamic_image/algorithm.hpp", + "external/sources/boost/gil/extension/dynamic_image/any_image.hpp", + "external/sources/boost/gil/extension/dynamic_image/any_image_view.hpp", + "external/sources/boost/gil/extension/dynamic_image/apply_operation.hpp", + "external/sources/boost/gil/extension/dynamic_image/dynamic_at_c.hpp", + "external/sources/boost/gil/extension/dynamic_image/dynamic_image_all.hpp", + "external/sources/boost/gil/extension/dynamic_image/image_view_factory.hpp", + "external/sources/boost/gil/extension/io/bmp.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/read.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/scanline_read.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/write.hpp", + "external/sources/boost/gil/extension/io/bmp/detail/writer_backend.hpp", + "external/sources/boost/gil/extension/io/bmp/old.hpp", + "external/sources/boost/gil/extension/io/bmp/read.hpp", + "external/sources/boost/gil/extension/io/bmp/tags.hpp", + "external/sources/boost/gil/extension/io/bmp/write.hpp", + "external/sources/boost/gil/extension/io/jpeg.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/base.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/read.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/scanline_read.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/write.hpp", + "external/sources/boost/gil/extension/io/jpeg/detail/writer_backend.hpp", + "external/sources/boost/gil/extension/io/jpeg/old.hpp", + "external/sources/boost/gil/extension/io/jpeg/read.hpp", + "external/sources/boost/gil/extension/io/jpeg/tags.hpp", + "external/sources/boost/gil/extension/io/jpeg/write.hpp", + "external/sources/boost/gil/extension/io/png.hpp", + "external/sources/boost/gil/extension/io/png/detail/base.hpp", + "external/sources/boost/gil/extension/io/png/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/png/detail/read.hpp", + "external/sources/boost/gil/extension/io/png/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/png/detail/scanline_read.hpp", + "external/sources/boost/gil/extension/io/png/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/png/detail/write.hpp", + "external/sources/boost/gil/extension/io/png/detail/writer_backend.hpp", + "external/sources/boost/gil/extension/io/png/old.hpp", + "external/sources/boost/gil/extension/io/png/read.hpp", + "external/sources/boost/gil/extension/io/png/tags.hpp", + "external/sources/boost/gil/extension/io/png/write.hpp", + "external/sources/boost/gil/extension/io/pnm.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/read.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/scanline_read.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/write.hpp", + "external/sources/boost/gil/extension/io/pnm/detail/writer_backend.hpp", + "external/sources/boost/gil/extension/io/pnm/old.hpp", + "external/sources/boost/gil/extension/io/pnm/read.hpp", + "external/sources/boost/gil/extension/io/pnm/tags.hpp", + "external/sources/boost/gil/extension/io/pnm/write.hpp", + "external/sources/boost/gil/extension/io/raw.hpp", + "external/sources/boost/gil/extension/io/raw/detail/device.hpp", + "external/sources/boost/gil/extension/io/raw/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/raw/detail/read.hpp", + "external/sources/boost/gil/extension/io/raw/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/raw/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/raw/read.hpp", + "external/sources/boost/gil/extension/io/raw/tags.hpp", + "external/sources/boost/gil/extension/io/targa.hpp", + "external/sources/boost/gil/extension/io/targa/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/targa/detail/read.hpp", + "external/sources/boost/gil/extension/io/targa/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/targa/detail/scanline_read.hpp", + "external/sources/boost/gil/extension/io/targa/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/targa/detail/write.hpp", + "external/sources/boost/gil/extension/io/targa/detail/writer_backend.hpp", + "external/sources/boost/gil/extension/io/targa/old.hpp", + "external/sources/boost/gil/extension/io/targa/read.hpp", + "external/sources/boost/gil/extension/io/targa/tags.hpp", + "external/sources/boost/gil/extension/io/targa/write.hpp", + "external/sources/boost/gil/extension/io/tiff.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/device.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/is_allowed.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/log.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/read.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/reader_backend.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/scanline_read.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/supported_types.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/write.hpp", + "external/sources/boost/gil/extension/io/tiff/detail/writer_backend.hpp", + "external/sources/boost/gil/extension/io/tiff/old.hpp", + "external/sources/boost/gil/extension/io/tiff/read.hpp", + "external/sources/boost/gil/extension/io/tiff/tags.hpp", + "external/sources/boost/gil/extension/io/tiff/write.hpp", + "external/sources/boost/gil/extension/numeric/affine.hpp", + "external/sources/boost/gil/extension/numeric/algorithm.hpp", + "external/sources/boost/gil/extension/numeric/channel_numeric_operations.hpp", + "external/sources/boost/gil/extension/numeric/convolve.hpp", + "external/sources/boost/gil/extension/numeric/kernel.hpp", + "external/sources/boost/gil/extension/numeric/pixel_numeric_operations.hpp", + "external/sources/boost/gil/extension/numeric/resample.hpp", + "external/sources/boost/gil/extension/numeric/sampler.hpp", + "external/sources/boost/gil/extension/toolbox/color_converters.hpp", + "external/sources/boost/gil/extension/toolbox/color_converters/gray_to_rgba.hpp", + "external/sources/boost/gil/extension/toolbox/color_converters/rgb_to_luminance.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/cmyka.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/gray_alpha.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/hsl.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/hsv.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/lab.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/xyz.hpp", + "external/sources/boost/gil/extension/toolbox/color_spaces/ycbcr.hpp", + "external/sources/boost/gil/extension/toolbox/dynamic_images.hpp", + "external/sources/boost/gil/extension/toolbox/image_types.hpp", + "external/sources/boost/gil/extension/toolbox/image_types/indexed_image.hpp", + "external/sources/boost/gil/extension/toolbox/image_types/subchroma_image.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/channel_type.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/channel_view.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/get_num_bits.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/is_homogeneous.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/is_similar.hpp", + "external/sources/boost/gil/extension/toolbox/metafunctions/pixel_bit_size.hpp", + "external/sources/boost/gil/extension/toolbox/toolbox.hpp", + "external/sources/boost/gil/gray.hpp", + "external/sources/boost/gil/image.hpp", + "external/sources/boost/gil/image_processing/filter.hpp", + "external/sources/boost/gil/image_processing/harris.hpp", + "external/sources/boost/gil/image_processing/hessian.hpp", + "external/sources/boost/gil/image_processing/numeric.hpp", + "external/sources/boost/gil/image_processing/scaling.hpp", + "external/sources/boost/gil/image_processing/threshold.hpp", + "external/sources/boost/gil/image_view.hpp", + "external/sources/boost/gil/image_view_factory.hpp", + "external/sources/boost/gil/io/base.hpp", + "external/sources/boost/gil/io/bit_operations.hpp", + "external/sources/boost/gil/io/conversion_policies.hpp", + "external/sources/boost/gil/io/device.hpp", + "external/sources/boost/gil/io/dynamic_io_new.hpp", + "external/sources/boost/gil/io/error.hpp", + "external/sources/boost/gil/io/get_read_device.hpp", + "external/sources/boost/gil/io/get_reader.hpp", + "external/sources/boost/gil/io/get_write_device.hpp", + "external/sources/boost/gil/io/get_writer.hpp", + "external/sources/boost/gil/io/io.hpp", + "external/sources/boost/gil/io/make_backend.hpp", + "external/sources/boost/gil/io/make_dynamic_image_reader.hpp", + "external/sources/boost/gil/io/make_dynamic_image_writer.hpp", + "external/sources/boost/gil/io/make_reader.hpp", + "external/sources/boost/gil/io/make_scanline_reader.hpp", + "external/sources/boost/gil/io/make_writer.hpp", + "external/sources/boost/gil/io/path_spec.hpp", + "external/sources/boost/gil/io/read_and_convert_image.hpp", + "external/sources/boost/gil/io/read_and_convert_view.hpp", + "external/sources/boost/gil/io/read_image.hpp", + "external/sources/boost/gil/io/read_image_info.hpp", + "external/sources/boost/gil/io/read_view.hpp", + "external/sources/boost/gil/io/reader_base.hpp", + "external/sources/boost/gil/io/row_buffer_helper.hpp", + "external/sources/boost/gil/io/scanline_read_iterator.hpp", + "external/sources/boost/gil/io/typedefs.hpp", + "external/sources/boost/gil/io/write_view.hpp", + "external/sources/boost/gil/iterator_from_2d.hpp", + "external/sources/boost/gil/locator.hpp", + "external/sources/boost/gil/metafunctions.hpp", + "external/sources/boost/gil/packed_pixel.hpp", + "external/sources/boost/gil/pixel.hpp", + "external/sources/boost/gil/pixel_iterator.hpp", + "external/sources/boost/gil/pixel_iterator_adaptor.hpp", + "external/sources/boost/gil/planar_pixel_iterator.hpp", + "external/sources/boost/gil/planar_pixel_reference.hpp", + "external/sources/boost/gil/point.hpp", + "external/sources/boost/gil/position_iterator.hpp", + "external/sources/boost/gil/premultiply.hpp", + "external/sources/boost/gil/promote_integral.hpp", + "external/sources/boost/gil/rgb.hpp", + "external/sources/boost/gil/rgba.hpp", + "external/sources/boost/gil/step_iterator.hpp", + "external/sources/boost/gil/typedefs.hpp", + "external/sources/boost/gil/utilities.hpp", + "external/sources/boost/gil/virtual_locator.hpp", + "external/sources/boost/graph/accounting.hpp", + "external/sources/boost/graph/adj_list_serialize.hpp", + "external/sources/boost/graph/adjacency_iterator.hpp", + "external/sources/boost/graph/adjacency_list.hpp", + "external/sources/boost/graph/adjacency_list_io.hpp", + "external/sources/boost/graph/adjacency_matrix.hpp", + "external/sources/boost/graph/astar_search.hpp", + "external/sources/boost/graph/bandwidth.hpp", + "external/sources/boost/graph/bc_clustering.hpp", + "external/sources/boost/graph/bellman_ford_shortest_paths.hpp", + "external/sources/boost/graph/betweenness_centrality.hpp", + "external/sources/boost/graph/biconnected_components.hpp", + "external/sources/boost/graph/bipartite.hpp", + "external/sources/boost/graph/boyer_myrvold_planar_test.hpp", + "external/sources/boost/graph/boykov_kolmogorov_max_flow.hpp", + "external/sources/boost/graph/breadth_first_search.hpp", + "external/sources/boost/graph/bron_kerbosch_all_cliques.hpp", + "external/sources/boost/graph/buffer_concepts.hpp", + "external/sources/boost/graph/chrobak_payne_drawing.hpp", + "external/sources/boost/graph/circle_layout.hpp", + "external/sources/boost/graph/closeness_centrality.hpp", + "external/sources/boost/graph/clustering_coefficient.hpp", + "external/sources/boost/graph/compressed_sparse_row_graph.hpp", + "external/sources/boost/graph/connected_components.hpp", + "external/sources/boost/graph/copy.hpp", + "external/sources/boost/graph/core_numbers.hpp", + "external/sources/boost/graph/create_condensation_graph.hpp", + "external/sources/boost/graph/cuthill_mckee_ordering.hpp", + "external/sources/boost/graph/cycle_canceling.hpp", + "external/sources/boost/graph/dag_shortest_paths.hpp", + "external/sources/boost/graph/degree_centrality.hpp", + "external/sources/boost/graph/depth_first_search.hpp", + "external/sources/boost/graph/detail/adj_list_edge_iterator.hpp", + "external/sources/boost/graph/detail/adjacency_list.hpp", + "external/sources/boost/graph/detail/array_binary_tree.hpp", + "external/sources/boost/graph/detail/augment.hpp", + "external/sources/boost/graph/detail/compressed_sparse_row_struct.hpp", + "external/sources/boost/graph/detail/connected_components.hpp", + "external/sources/boost/graph/detail/d_ary_heap.hpp", + "external/sources/boost/graph/detail/edge.hpp", + "external/sources/boost/graph/detail/empty_header.hpp", + "external/sources/boost/graph/detail/geodesic.hpp", + "external/sources/boost/graph/detail/histogram_sort.hpp", + "external/sources/boost/graph/detail/incidence_iterator.hpp", + "external/sources/boost/graph/detail/incremental_components.hpp", + "external/sources/boost/graph/detail/index.hpp", + "external/sources/boost/graph/detail/indexed_properties.hpp", + "external/sources/boost/graph/detail/is_distributed_selector.hpp", + "external/sources/boost/graph/detail/labeled_graph_traits.hpp", + "external/sources/boost/graph/detail/list_base.hpp", + "external/sources/boost/graph/detail/mpi_include.hpp", + "external/sources/boost/graph/detail/permutation.hpp", + "external/sources/boost/graph/detail/read_graphviz_new.hpp", + "external/sources/boost/graph/detail/read_graphviz_spirit.hpp", + "external/sources/boost/graph/detail/self_avoiding_walk.hpp", + "external/sources/boost/graph/detail/set_adaptor.hpp", + "external/sources/boost/graph/detail/shadow_iterator.hpp", + "external/sources/boost/graph/detail/sparse_ordering.hpp", + "external/sources/boost/graph/dijkstra_shortest_paths.hpp", + "external/sources/boost/graph/dijkstra_shortest_paths_no_color_map.hpp", + "external/sources/boost/graph/dimacs.hpp", + "external/sources/boost/graph/directed_graph.hpp", + "external/sources/boost/graph/distributed/adjacency_list.hpp", + "external/sources/boost/graph/distributed/adjlist/handlers.hpp", + "external/sources/boost/graph/distributed/adjlist/initialize.hpp", + "external/sources/boost/graph/distributed/adjlist/redistribute.hpp", + "external/sources/boost/graph/distributed/adjlist/serialization.hpp", + "external/sources/boost/graph/distributed/betweenness_centrality.hpp", + "external/sources/boost/graph/distributed/boman_et_al_graph_coloring.hpp", + "external/sources/boost/graph/distributed/breadth_first_search.hpp", + "external/sources/boost/graph/distributed/compressed_sparse_row_graph.hpp", + "external/sources/boost/graph/distributed/concepts.hpp", + "external/sources/boost/graph/distributed/connected_components.hpp", + "external/sources/boost/graph/distributed/connected_components_parallel_search.hpp", + "external/sources/boost/graph/distributed/crauser_et_al_shortest_paths.hpp", + "external/sources/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp", + "external/sources/boost/graph/distributed/delta_stepping_shortest_paths.hpp", + "external/sources/boost/graph/distributed/depth_first_search.hpp", + "external/sources/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp", + "external/sources/boost/graph/distributed/detail/filtered_queue.hpp", + "external/sources/boost/graph/distributed/detail/mpi_process_group.ipp", + "external/sources/boost/graph/distributed/detail/queue.ipp", + "external/sources/boost/graph/distributed/detail/remote_update_set.hpp", + "external/sources/boost/graph/distributed/detail/tag_allocator.hpp", + "external/sources/boost/graph/distributed/dijkstra_shortest_paths.hpp", + "external/sources/boost/graph/distributed/distributed_graph_utility.hpp", + "external/sources/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp", + "external/sources/boost/graph/distributed/filtered_graph.hpp", + "external/sources/boost/graph/distributed/fruchterman_reingold.hpp", + "external/sources/boost/graph/distributed/graphviz.hpp", + "external/sources/boost/graph/distributed/hohberg_biconnected_components.hpp", + "external/sources/boost/graph/distributed/local_subgraph.hpp", + "external/sources/boost/graph/distributed/mpi_process_group.hpp", + "external/sources/boost/graph/distributed/named_graph.hpp", + "external/sources/boost/graph/distributed/one_bit_color_map.hpp", + "external/sources/boost/graph/distributed/page_rank.hpp", + "external/sources/boost/graph/distributed/queue.hpp", + "external/sources/boost/graph/distributed/reverse_graph.hpp", + "external/sources/boost/graph/distributed/rmat_graph_generator.hpp", + "external/sources/boost/graph/distributed/selector.hpp", + "external/sources/boost/graph/distributed/shuffled_distribution.hpp", + "external/sources/boost/graph/distributed/st_connected.hpp", + "external/sources/boost/graph/distributed/strong_components.hpp", + "external/sources/boost/graph/distributed/two_bit_color_map.hpp", + "external/sources/boost/graph/distributed/unsafe_serialize.hpp", + "external/sources/boost/graph/distributed/vertex_list_adaptor.hpp", + "external/sources/boost/graph/dll_import_export.hpp", + "external/sources/boost/graph/dominator_tree.hpp", + "external/sources/boost/graph/eccentricity.hpp", + "external/sources/boost/graph/edge_coloring.hpp", + "external/sources/boost/graph/edge_connectivity.hpp", + "external/sources/boost/graph/edge_list.hpp", + "external/sources/boost/graph/edmonds_karp_max_flow.hpp", + "external/sources/boost/graph/edmunds_karp_max_flow.hpp", + "external/sources/boost/graph/erdos_renyi_generator.hpp", + "external/sources/boost/graph/exception.hpp", + "external/sources/boost/graph/exterior_property.hpp", + "external/sources/boost/graph/filtered_graph.hpp", + "external/sources/boost/graph/find_flow_cost.hpp", + "external/sources/boost/graph/floyd_warshall_shortest.hpp", + "external/sources/boost/graph/fruchterman_reingold.hpp", + "external/sources/boost/graph/geodesic_distance.hpp", + "external/sources/boost/graph/graph_archetypes.hpp", + "external/sources/boost/graph/graph_as_tree.hpp", + "external/sources/boost/graph/graph_concepts.hpp", + "external/sources/boost/graph/graph_mutability_traits.hpp", + "external/sources/boost/graph/graph_selectors.hpp", + "external/sources/boost/graph/graph_stats.hpp", + "external/sources/boost/graph/graph_traits.hpp", + "external/sources/boost/graph/graph_utility.hpp", + "external/sources/boost/graph/graphml.hpp", + "external/sources/boost/graph/graphviz.hpp", + "external/sources/boost/graph/grid_graph.hpp", + "external/sources/boost/graph/gursoy_atun_layout.hpp", + "external/sources/boost/graph/hawick_circuits.hpp", + "external/sources/boost/graph/howard_cycle_ratio.hpp", + "external/sources/boost/graph/incremental_components.hpp", + "external/sources/boost/graph/is_kuratowski_subgraph.hpp", + "external/sources/boost/graph/is_straight_line_drawing.hpp", + "external/sources/boost/graph/isomorphism.hpp", + "external/sources/boost/graph/iteration_macros.hpp", + "external/sources/boost/graph/iteration_macros_undef.hpp", + "external/sources/boost/graph/johnson_all_pairs_shortest.hpp", + "external/sources/boost/graph/kamada_kawai_spring_layout.hpp", + "external/sources/boost/graph/king_ordering.hpp", + "external/sources/boost/graph/kruskal_min_spanning_tree.hpp", + "external/sources/boost/graph/labeled_graph.hpp", + "external/sources/boost/graph/leda_graph.hpp", + "external/sources/boost/graph/lookup_edge.hpp", + "external/sources/boost/graph/loop_erased_random_walk.hpp", + "external/sources/boost/graph/make_biconnected_planar.hpp", + "external/sources/boost/graph/make_connected.hpp", + "external/sources/boost/graph/make_maximal_planar.hpp", + "external/sources/boost/graph/matrix_as_graph.hpp", + "external/sources/boost/graph/max_cardinality_matching.hpp", + "external/sources/boost/graph/maximum_adjacency_search.hpp", + "external/sources/boost/graph/maximum_weighted_matching.hpp", + "external/sources/boost/graph/mcgregor_common_subgraphs.hpp", + "external/sources/boost/graph/mesh_graph_generator.hpp", + "external/sources/boost/graph/metis.hpp", + "external/sources/boost/graph/metric_tsp_approx.hpp", + "external/sources/boost/graph/minimum_degree_ordering.hpp", + "external/sources/boost/graph/named_function_params.hpp", + "external/sources/boost/graph/named_graph.hpp", + "external/sources/boost/graph/neighbor_bfs.hpp", + "external/sources/boost/graph/numeric_values.hpp", + "external/sources/boost/graph/one_bit_color_map.hpp", + "external/sources/boost/graph/overloading.hpp", + "external/sources/boost/graph/page_rank.hpp", + "external/sources/boost/graph/parallel/algorithm.hpp", + "external/sources/boost/graph/parallel/basic_reduce.hpp", + "external/sources/boost/graph/parallel/container_traits.hpp", + "external/sources/boost/graph/parallel/detail/inplace_all_to_all.hpp", + "external/sources/boost/graph/parallel/detail/property_holders.hpp", + "external/sources/boost/graph/parallel/detail/untracked_pair.hpp", + "external/sources/boost/graph/parallel/distribution.hpp", + "external/sources/boost/graph/parallel/process_group.hpp", + "external/sources/boost/graph/parallel/properties.hpp", + "external/sources/boost/graph/parallel/simple_trigger.hpp", + "external/sources/boost/graph/planar_canonical_ordering.hpp", + "external/sources/boost/graph/planar_detail/add_edge_visitors.hpp", + "external/sources/boost/graph/planar_detail/boyer_myrvold_impl.hpp", + "external/sources/boost/graph/planar_detail/bucket_sort.hpp", + "external/sources/boost/graph/planar_detail/face_handles.hpp", + "external/sources/boost/graph/planar_detail/face_iterators.hpp", + "external/sources/boost/graph/planar_face_traversal.hpp", + "external/sources/boost/graph/plod_generator.hpp", + "external/sources/boost/graph/point_traits.hpp", + "external/sources/boost/graph/prim_minimum_spanning_tree.hpp", + "external/sources/boost/graph/profile.hpp", + "external/sources/boost/graph/properties.hpp", + "external/sources/boost/graph/property_iter_range.hpp", + "external/sources/boost/graph/property_maps/constant_property_map.hpp", + "external/sources/boost/graph/property_maps/container_property_map.hpp", + "external/sources/boost/graph/property_maps/matrix_property_map.hpp", + "external/sources/boost/graph/property_maps/null_property_map.hpp", + "external/sources/boost/graph/push_relabel_max_flow.hpp", + "external/sources/boost/graph/r_c_shortest_paths.hpp", + "external/sources/boost/graph/random.hpp", + "external/sources/boost/graph/random_layout.hpp", + "external/sources/boost/graph/random_spanning_tree.hpp", + "external/sources/boost/graph/read_dimacs.hpp", + "external/sources/boost/graph/relax.hpp", + "external/sources/boost/graph/reverse_graph.hpp", + "external/sources/boost/graph/rmat_graph_generator.hpp", + "external/sources/boost/graph/sequential_vertex_coloring.hpp", + "external/sources/boost/graph/simple_point.hpp", + "external/sources/boost/graph/sloan_ordering.hpp", + "external/sources/boost/graph/small_world_generator.hpp", + "external/sources/boost/graph/smallest_last_ordering.hpp", + "external/sources/boost/graph/ssca_graph_generator.hpp", + "external/sources/boost/graph/st_connected.hpp", + "external/sources/boost/graph/stanford_graph.hpp", + "external/sources/boost/graph/stoer_wagner_min_cut.hpp", + "external/sources/boost/graph/strong_components.hpp", + "external/sources/boost/graph/subgraph.hpp", + "external/sources/boost/graph/successive_shortest_path_nonnegative_weights.hpp", + "external/sources/boost/graph/tiernan_all_cycles.hpp", + "external/sources/boost/graph/topological_sort.hpp", + "external/sources/boost/graph/topology.hpp", + "external/sources/boost/graph/transitive_closure.hpp", + "external/sources/boost/graph/transitive_reduction.hpp", + "external/sources/boost/graph/transpose_graph.hpp", + "external/sources/boost/graph/tree_traits.hpp", + "external/sources/boost/graph/two_bit_color_map.hpp", + "external/sources/boost/graph/two_graphs_common_spanning_trees.hpp", + "external/sources/boost/graph/undirected_dfs.hpp", + "external/sources/boost/graph/undirected_graph.hpp", + "external/sources/boost/graph/use_mpi.hpp", + "external/sources/boost/graph/vector_as_graph.hpp", + "external/sources/boost/graph/vertex_and_edge_range.hpp", + "external/sources/boost/graph/vf2_sub_graph_iso.hpp", + "external/sources/boost/graph/visitors.hpp", + "external/sources/boost/graph/wavefront.hpp", + "external/sources/boost/graph/write_dimacs.hpp", + "external/sources/boost/hana.hpp", + "external/sources/boost/hana/accessors.hpp", + "external/sources/boost/hana/adapt_adt.hpp", + "external/sources/boost/hana/adapt_struct.hpp", + "external/sources/boost/hana/adjust.hpp", + "external/sources/boost/hana/adjust_if.hpp", + "external/sources/boost/hana/all.hpp", + "external/sources/boost/hana/all_of.hpp", + "external/sources/boost/hana/and.hpp", + "external/sources/boost/hana/any.hpp", + "external/sources/boost/hana/any_of.hpp", + "external/sources/boost/hana/ap.hpp", + "external/sources/boost/hana/append.hpp", + "external/sources/boost/hana/assert.hpp", + "external/sources/boost/hana/at.hpp", + "external/sources/boost/hana/at_key.hpp", + "external/sources/boost/hana/back.hpp", + "external/sources/boost/hana/basic_tuple.hpp", + "external/sources/boost/hana/bool.hpp", + "external/sources/boost/hana/cartesian_product.hpp", + "external/sources/boost/hana/chain.hpp", + "external/sources/boost/hana/comparing.hpp", + "external/sources/boost/hana/concat.hpp", + "external/sources/boost/hana/concept.hpp", + "external/sources/boost/hana/concept/applicative.hpp", + "external/sources/boost/hana/concept/comonad.hpp", + "external/sources/boost/hana/concept/comparable.hpp", + "external/sources/boost/hana/concept/constant.hpp", + "external/sources/boost/hana/concept/euclidean_ring.hpp", + "external/sources/boost/hana/concept/foldable.hpp", + "external/sources/boost/hana/concept/functor.hpp", + "external/sources/boost/hana/concept/group.hpp", + "external/sources/boost/hana/concept/hashable.hpp", + "external/sources/boost/hana/concept/integral_constant.hpp", + "external/sources/boost/hana/concept/iterable.hpp", + "external/sources/boost/hana/concept/logical.hpp", + "external/sources/boost/hana/concept/metafunction.hpp", + "external/sources/boost/hana/concept/monad.hpp", + "external/sources/boost/hana/concept/monad_plus.hpp", + "external/sources/boost/hana/concept/monoid.hpp", + "external/sources/boost/hana/concept/orderable.hpp", + "external/sources/boost/hana/concept/product.hpp", + "external/sources/boost/hana/concept/ring.hpp", + "external/sources/boost/hana/concept/searchable.hpp", + "external/sources/boost/hana/concept/sequence.hpp", + "external/sources/boost/hana/concept/struct.hpp", + "external/sources/boost/hana/config.hpp", + "external/sources/boost/hana/contains.hpp", + "external/sources/boost/hana/core.hpp", + "external/sources/boost/hana/core/common.hpp", + "external/sources/boost/hana/core/default.hpp", + "external/sources/boost/hana/core/dispatch.hpp", + "external/sources/boost/hana/core/is_a.hpp", + "external/sources/boost/hana/core/make.hpp", + "external/sources/boost/hana/core/tag_of.hpp", + "external/sources/boost/hana/core/to.hpp", + "external/sources/boost/hana/core/when.hpp", + "external/sources/boost/hana/count.hpp", + "external/sources/boost/hana/count_if.hpp", + "external/sources/boost/hana/cycle.hpp", + "external/sources/boost/hana/define_struct.hpp", + "external/sources/boost/hana/detail/algorithm.hpp", + "external/sources/boost/hana/detail/any_of.hpp", + "external/sources/boost/hana/detail/array.hpp", + "external/sources/boost/hana/detail/canonical_constant.hpp", + "external/sources/boost/hana/detail/concepts.hpp", + "external/sources/boost/hana/detail/create.hpp", + "external/sources/boost/hana/detail/decay.hpp", + "external/sources/boost/hana/detail/dispatch_if.hpp", + "external/sources/boost/hana/detail/ebo.hpp", + "external/sources/boost/hana/detail/fast_and.hpp", + "external/sources/boost/hana/detail/first_unsatisfied_index.hpp", + "external/sources/boost/hana/detail/has_common_embedding.hpp", + "external/sources/boost/hana/detail/has_duplicates.hpp", + "external/sources/boost/hana/detail/hash_table.hpp", + "external/sources/boost/hana/detail/index_if.hpp", + "external/sources/boost/hana/detail/integral_constant.hpp", + "external/sources/boost/hana/detail/intrinsics.hpp", + "external/sources/boost/hana/detail/nested_by.hpp", + "external/sources/boost/hana/detail/nested_by_fwd.hpp", + "external/sources/boost/hana/detail/nested_than.hpp", + "external/sources/boost/hana/detail/nested_than_fwd.hpp", + "external/sources/boost/hana/detail/nested_to.hpp", + "external/sources/boost/hana/detail/nested_to_fwd.hpp", + "external/sources/boost/hana/detail/operators/adl.hpp", + "external/sources/boost/hana/detail/operators/arithmetic.hpp", + "external/sources/boost/hana/detail/operators/comparable.hpp", + "external/sources/boost/hana/detail/operators/iterable.hpp", + "external/sources/boost/hana/detail/operators/logical.hpp", + "external/sources/boost/hana/detail/operators/monad.hpp", + "external/sources/boost/hana/detail/operators/orderable.hpp", + "external/sources/boost/hana/detail/operators/searchable.hpp", + "external/sources/boost/hana/detail/preprocessor.hpp", + "external/sources/boost/hana/detail/std_common_type.hpp", + "external/sources/boost/hana/detail/struct_macros.hpp", + "external/sources/boost/hana/detail/struct_macros.hpp.erb", + "external/sources/boost/hana/detail/type_at.hpp", + "external/sources/boost/hana/detail/type_foldl1.hpp", + "external/sources/boost/hana/detail/type_foldr1.hpp", + "external/sources/boost/hana/detail/unpack_flatten.hpp", + "external/sources/boost/hana/detail/variadic/at.hpp", + "external/sources/boost/hana/detail/variadic/drop_into.hpp", + "external/sources/boost/hana/detail/variadic/foldl1.hpp", + "external/sources/boost/hana/detail/variadic/foldr1.hpp", + "external/sources/boost/hana/detail/variadic/reverse_apply.hpp", + "external/sources/boost/hana/detail/variadic/reverse_apply/flat.hpp", + "external/sources/boost/hana/detail/variadic/reverse_apply/unrolled.hpp", + "external/sources/boost/hana/detail/variadic/split_at.hpp", + "external/sources/boost/hana/detail/variadic/take.hpp", + "external/sources/boost/hana/detail/void_t.hpp", + "external/sources/boost/hana/detail/wrong.hpp", + "external/sources/boost/hana/difference.hpp", + "external/sources/boost/hana/div.hpp", + "external/sources/boost/hana/drop_back.hpp", + "external/sources/boost/hana/drop_front.hpp", + "external/sources/boost/hana/drop_front_exactly.hpp", + "external/sources/boost/hana/drop_while.hpp", + "external/sources/boost/hana/duplicate.hpp", + "external/sources/boost/hana/empty.hpp", + "external/sources/boost/hana/equal.hpp", + "external/sources/boost/hana/erase_key.hpp", + "external/sources/boost/hana/eval.hpp", + "external/sources/boost/hana/eval_if.hpp", + "external/sources/boost/hana/experimental/printable.hpp", + "external/sources/boost/hana/experimental/type_name.hpp", + "external/sources/boost/hana/experimental/types.hpp", + "external/sources/boost/hana/experimental/view.hpp", + "external/sources/boost/hana/ext/boost.hpp", + "external/sources/boost/hana/ext/boost/fusion.hpp", + "external/sources/boost/hana/ext/boost/fusion/deque.hpp", + "external/sources/boost/hana/ext/boost/fusion/detail/common.hpp", + "external/sources/boost/hana/ext/boost/fusion/list.hpp", + "external/sources/boost/hana/ext/boost/fusion/tuple.hpp", + "external/sources/boost/hana/ext/boost/fusion/vector.hpp", + "external/sources/boost/hana/ext/boost/mpl.hpp", + "external/sources/boost/hana/ext/boost/mpl/integral_c.hpp", + "external/sources/boost/hana/ext/boost/mpl/list.hpp", + "external/sources/boost/hana/ext/boost/mpl/vector.hpp", + "external/sources/boost/hana/ext/boost/tuple.hpp", + "external/sources/boost/hana/ext/std.hpp", + "external/sources/boost/hana/ext/std/array.hpp", + "external/sources/boost/hana/ext/std/integer_sequence.hpp", + "external/sources/boost/hana/ext/std/integral_constant.hpp", + "external/sources/boost/hana/ext/std/pair.hpp", + "external/sources/boost/hana/ext/std/ratio.hpp", + "external/sources/boost/hana/ext/std/tuple.hpp", + "external/sources/boost/hana/ext/std/vector.hpp", + "external/sources/boost/hana/extend.hpp", + "external/sources/boost/hana/extract.hpp", + "external/sources/boost/hana/fill.hpp", + "external/sources/boost/hana/filter.hpp", + "external/sources/boost/hana/find.hpp", + "external/sources/boost/hana/find_if.hpp", + "external/sources/boost/hana/first.hpp", + "external/sources/boost/hana/flatten.hpp", + "external/sources/boost/hana/fold.hpp", + "external/sources/boost/hana/fold_left.hpp", + "external/sources/boost/hana/fold_right.hpp", + "external/sources/boost/hana/for_each.hpp", + "external/sources/boost/hana/front.hpp", + "external/sources/boost/hana/functional.hpp", + "external/sources/boost/hana/functional/always.hpp", + "external/sources/boost/hana/functional/apply.hpp", + "external/sources/boost/hana/functional/arg.hpp", + "external/sources/boost/hana/functional/capture.hpp", + "external/sources/boost/hana/functional/compose.hpp", + "external/sources/boost/hana/functional/curry.hpp", + "external/sources/boost/hana/functional/demux.hpp", + "external/sources/boost/hana/functional/fix.hpp", + "external/sources/boost/hana/functional/flip.hpp", + "external/sources/boost/hana/functional/id.hpp", + "external/sources/boost/hana/functional/infix.hpp", + "external/sources/boost/hana/functional/iterate.hpp", + "external/sources/boost/hana/functional/lockstep.hpp", + "external/sources/boost/hana/functional/on.hpp", + "external/sources/boost/hana/functional/overload.hpp", + "external/sources/boost/hana/functional/overload_linearly.hpp", + "external/sources/boost/hana/functional/partial.hpp", + "external/sources/boost/hana/functional/placeholder.hpp", + "external/sources/boost/hana/functional/reverse_partial.hpp", + "external/sources/boost/hana/fuse.hpp", + "external/sources/boost/hana/fwd/accessors.hpp", + "external/sources/boost/hana/fwd/adapt_adt.hpp", + "external/sources/boost/hana/fwd/adapt_struct.hpp", + "external/sources/boost/hana/fwd/adjust.hpp", + "external/sources/boost/hana/fwd/adjust_if.hpp", + "external/sources/boost/hana/fwd/all.hpp", + "external/sources/boost/hana/fwd/all_of.hpp", + "external/sources/boost/hana/fwd/and.hpp", + "external/sources/boost/hana/fwd/any.hpp", + "external/sources/boost/hana/fwd/any_of.hpp", + "external/sources/boost/hana/fwd/ap.hpp", + "external/sources/boost/hana/fwd/append.hpp", + "external/sources/boost/hana/fwd/at.hpp", + "external/sources/boost/hana/fwd/at_key.hpp", + "external/sources/boost/hana/fwd/back.hpp", + "external/sources/boost/hana/fwd/basic_tuple.hpp", + "external/sources/boost/hana/fwd/bool.hpp", + "external/sources/boost/hana/fwd/cartesian_product.hpp", + "external/sources/boost/hana/fwd/chain.hpp", + "external/sources/boost/hana/fwd/comparing.hpp", + "external/sources/boost/hana/fwd/concat.hpp", + "external/sources/boost/hana/fwd/concept/applicative.hpp", + "external/sources/boost/hana/fwd/concept/comonad.hpp", + "external/sources/boost/hana/fwd/concept/comparable.hpp", + "external/sources/boost/hana/fwd/concept/constant.hpp", + "external/sources/boost/hana/fwd/concept/euclidean_ring.hpp", + "external/sources/boost/hana/fwd/concept/foldable.hpp", + "external/sources/boost/hana/fwd/concept/functor.hpp", + "external/sources/boost/hana/fwd/concept/group.hpp", + "external/sources/boost/hana/fwd/concept/hashable.hpp", + "external/sources/boost/hana/fwd/concept/integral_constant.hpp", + "external/sources/boost/hana/fwd/concept/iterable.hpp", + "external/sources/boost/hana/fwd/concept/logical.hpp", + "external/sources/boost/hana/fwd/concept/metafunction.hpp", + "external/sources/boost/hana/fwd/concept/monad.hpp", + "external/sources/boost/hana/fwd/concept/monad_plus.hpp", + "external/sources/boost/hana/fwd/concept/monoid.hpp", + "external/sources/boost/hana/fwd/concept/orderable.hpp", + "external/sources/boost/hana/fwd/concept/product.hpp", + "external/sources/boost/hana/fwd/concept/ring.hpp", + "external/sources/boost/hana/fwd/concept/searchable.hpp", + "external/sources/boost/hana/fwd/concept/sequence.hpp", + "external/sources/boost/hana/fwd/concept/struct.hpp", + "external/sources/boost/hana/fwd/contains.hpp", + "external/sources/boost/hana/fwd/core.hpp", + "external/sources/boost/hana/fwd/core/common.hpp", + "external/sources/boost/hana/fwd/core/default.hpp", + "external/sources/boost/hana/fwd/core/is_a.hpp", + "external/sources/boost/hana/fwd/core/make.hpp", + "external/sources/boost/hana/fwd/core/tag_of.hpp", + "external/sources/boost/hana/fwd/core/to.hpp", + "external/sources/boost/hana/fwd/core/when.hpp", + "external/sources/boost/hana/fwd/count.hpp", + "external/sources/boost/hana/fwd/count_if.hpp", + "external/sources/boost/hana/fwd/cycle.hpp", + "external/sources/boost/hana/fwd/define_struct.hpp", + "external/sources/boost/hana/fwd/difference.hpp", + "external/sources/boost/hana/fwd/div.hpp", + "external/sources/boost/hana/fwd/drop_back.hpp", + "external/sources/boost/hana/fwd/drop_front.hpp", + "external/sources/boost/hana/fwd/drop_front_exactly.hpp", + "external/sources/boost/hana/fwd/drop_while.hpp", + "external/sources/boost/hana/fwd/duplicate.hpp", + "external/sources/boost/hana/fwd/empty.hpp", + "external/sources/boost/hana/fwd/equal.hpp", + "external/sources/boost/hana/fwd/erase_key.hpp", + "external/sources/boost/hana/fwd/eval.hpp", + "external/sources/boost/hana/fwd/eval_if.hpp", + "external/sources/boost/hana/fwd/extend.hpp", + "external/sources/boost/hana/fwd/extract.hpp", + "external/sources/boost/hana/fwd/fill.hpp", + "external/sources/boost/hana/fwd/filter.hpp", + "external/sources/boost/hana/fwd/find.hpp", + "external/sources/boost/hana/fwd/find_if.hpp", + "external/sources/boost/hana/fwd/first.hpp", + "external/sources/boost/hana/fwd/flatten.hpp", + "external/sources/boost/hana/fwd/fold.hpp", + "external/sources/boost/hana/fwd/fold_left.hpp", + "external/sources/boost/hana/fwd/fold_right.hpp", + "external/sources/boost/hana/fwd/for_each.hpp", + "external/sources/boost/hana/fwd/front.hpp", + "external/sources/boost/hana/fwd/fuse.hpp", + "external/sources/boost/hana/fwd/greater.hpp", + "external/sources/boost/hana/fwd/greater_equal.hpp", + "external/sources/boost/hana/fwd/group.hpp", + "external/sources/boost/hana/fwd/hash.hpp", + "external/sources/boost/hana/fwd/if.hpp", + "external/sources/boost/hana/fwd/index_if.hpp", + "external/sources/boost/hana/fwd/insert.hpp", + "external/sources/boost/hana/fwd/insert_range.hpp", + "external/sources/boost/hana/fwd/integral_constant.hpp", + "external/sources/boost/hana/fwd/intersection.hpp", + "external/sources/boost/hana/fwd/intersperse.hpp", + "external/sources/boost/hana/fwd/is_disjoint.hpp", + "external/sources/boost/hana/fwd/is_empty.hpp", + "external/sources/boost/hana/fwd/is_subset.hpp", + "external/sources/boost/hana/fwd/keys.hpp", + "external/sources/boost/hana/fwd/lazy.hpp", + "external/sources/boost/hana/fwd/length.hpp", + "external/sources/boost/hana/fwd/less.hpp", + "external/sources/boost/hana/fwd/less_equal.hpp", + "external/sources/boost/hana/fwd/lexicographical_compare.hpp", + "external/sources/boost/hana/fwd/lift.hpp", + "external/sources/boost/hana/fwd/map.hpp", + "external/sources/boost/hana/fwd/max.hpp", + "external/sources/boost/hana/fwd/maximum.hpp", + "external/sources/boost/hana/fwd/members.hpp", + "external/sources/boost/hana/fwd/min.hpp", + "external/sources/boost/hana/fwd/minimum.hpp", + "external/sources/boost/hana/fwd/minus.hpp", + "external/sources/boost/hana/fwd/mod.hpp", + "external/sources/boost/hana/fwd/monadic_compose.hpp", + "external/sources/boost/hana/fwd/monadic_fold_left.hpp", + "external/sources/boost/hana/fwd/monadic_fold_right.hpp", + "external/sources/boost/hana/fwd/mult.hpp", + "external/sources/boost/hana/fwd/negate.hpp", + "external/sources/boost/hana/fwd/none.hpp", + "external/sources/boost/hana/fwd/none_of.hpp", + "external/sources/boost/hana/fwd/not.hpp", + "external/sources/boost/hana/fwd/not_equal.hpp", + "external/sources/boost/hana/fwd/one.hpp", + "external/sources/boost/hana/fwd/optional.hpp", + "external/sources/boost/hana/fwd/or.hpp", + "external/sources/boost/hana/fwd/ordering.hpp", + "external/sources/boost/hana/fwd/pair.hpp", + "external/sources/boost/hana/fwd/partition.hpp", + "external/sources/boost/hana/fwd/permutations.hpp", + "external/sources/boost/hana/fwd/plus.hpp", + "external/sources/boost/hana/fwd/power.hpp", + "external/sources/boost/hana/fwd/prefix.hpp", + "external/sources/boost/hana/fwd/prepend.hpp", + "external/sources/boost/hana/fwd/product.hpp", + "external/sources/boost/hana/fwd/range.hpp", + "external/sources/boost/hana/fwd/remove.hpp", + "external/sources/boost/hana/fwd/remove_at.hpp", + "external/sources/boost/hana/fwd/remove_if.hpp", + "external/sources/boost/hana/fwd/remove_range.hpp", + "external/sources/boost/hana/fwd/repeat.hpp", + "external/sources/boost/hana/fwd/replace.hpp", + "external/sources/boost/hana/fwd/replace_if.hpp", + "external/sources/boost/hana/fwd/replicate.hpp", + "external/sources/boost/hana/fwd/reverse.hpp", + "external/sources/boost/hana/fwd/reverse_fold.hpp", + "external/sources/boost/hana/fwd/scan_left.hpp", + "external/sources/boost/hana/fwd/scan_right.hpp", + "external/sources/boost/hana/fwd/second.hpp", + "external/sources/boost/hana/fwd/set.hpp", + "external/sources/boost/hana/fwd/size.hpp", + "external/sources/boost/hana/fwd/slice.hpp", + "external/sources/boost/hana/fwd/sort.hpp", + "external/sources/boost/hana/fwd/span.hpp", + "external/sources/boost/hana/fwd/string.hpp", + "external/sources/boost/hana/fwd/suffix.hpp", + "external/sources/boost/hana/fwd/sum.hpp", + "external/sources/boost/hana/fwd/symmetric_difference.hpp", + "external/sources/boost/hana/fwd/take_back.hpp", + "external/sources/boost/hana/fwd/take_front.hpp", + "external/sources/boost/hana/fwd/take_while.hpp", + "external/sources/boost/hana/fwd/tap.hpp", + "external/sources/boost/hana/fwd/then.hpp", + "external/sources/boost/hana/fwd/transform.hpp", + "external/sources/boost/hana/fwd/tuple.hpp", + "external/sources/boost/hana/fwd/type.hpp", + "external/sources/boost/hana/fwd/unfold_left.hpp", + "external/sources/boost/hana/fwd/unfold_right.hpp", + "external/sources/boost/hana/fwd/union.hpp", + "external/sources/boost/hana/fwd/unique.hpp", + "external/sources/boost/hana/fwd/unpack.hpp", + "external/sources/boost/hana/fwd/value.hpp", + "external/sources/boost/hana/fwd/while.hpp", + "external/sources/boost/hana/fwd/zero.hpp", + "external/sources/boost/hana/fwd/zip.hpp", + "external/sources/boost/hana/fwd/zip_shortest.hpp", + "external/sources/boost/hana/fwd/zip_shortest_with.hpp", + "external/sources/boost/hana/fwd/zip_with.hpp", + "external/sources/boost/hana/greater.hpp", + "external/sources/boost/hana/greater_equal.hpp", + "external/sources/boost/hana/group.hpp", + "external/sources/boost/hana/hash.hpp", + "external/sources/boost/hana/if.hpp", + "external/sources/boost/hana/index_if.hpp", + "external/sources/boost/hana/insert.hpp", + "external/sources/boost/hana/insert_range.hpp", + "external/sources/boost/hana/integral_constant.hpp", + "external/sources/boost/hana/intersection.hpp", + "external/sources/boost/hana/intersperse.hpp", + "external/sources/boost/hana/is_disjoint.hpp", + "external/sources/boost/hana/is_empty.hpp", + "external/sources/boost/hana/is_subset.hpp", + "external/sources/boost/hana/keys.hpp", + "external/sources/boost/hana/lazy.hpp", + "external/sources/boost/hana/length.hpp", + "external/sources/boost/hana/less.hpp", + "external/sources/boost/hana/less_equal.hpp", + "external/sources/boost/hana/lexicographical_compare.hpp", + "external/sources/boost/hana/lift.hpp", + "external/sources/boost/hana/map.hpp", + "external/sources/boost/hana/max.hpp", + "external/sources/boost/hana/maximum.hpp", + "external/sources/boost/hana/members.hpp", + "external/sources/boost/hana/min.hpp", + "external/sources/boost/hana/minimum.hpp", + "external/sources/boost/hana/minus.hpp", + "external/sources/boost/hana/mod.hpp", + "external/sources/boost/hana/monadic_compose.hpp", + "external/sources/boost/hana/monadic_fold_left.hpp", + "external/sources/boost/hana/monadic_fold_right.hpp", + "external/sources/boost/hana/mult.hpp", + "external/sources/boost/hana/negate.hpp", + "external/sources/boost/hana/none.hpp", + "external/sources/boost/hana/none_of.hpp", + "external/sources/boost/hana/not.hpp", + "external/sources/boost/hana/not_equal.hpp", + "external/sources/boost/hana/one.hpp", + "external/sources/boost/hana/optional.hpp", + "external/sources/boost/hana/or.hpp", + "external/sources/boost/hana/ordering.hpp", + "external/sources/boost/hana/pair.hpp", + "external/sources/boost/hana/partition.hpp", + "external/sources/boost/hana/permutations.hpp", + "external/sources/boost/hana/plus.hpp", + "external/sources/boost/hana/power.hpp", + "external/sources/boost/hana/prefix.hpp", + "external/sources/boost/hana/prepend.hpp", + "external/sources/boost/hana/product.hpp", + "external/sources/boost/hana/range.hpp", + "external/sources/boost/hana/remove.hpp", + "external/sources/boost/hana/remove_at.hpp", + "external/sources/boost/hana/remove_if.hpp", + "external/sources/boost/hana/remove_range.hpp", + "external/sources/boost/hana/repeat.hpp", + "external/sources/boost/hana/replace.hpp", + "external/sources/boost/hana/replace_if.hpp", + "external/sources/boost/hana/replicate.hpp", + "external/sources/boost/hana/reverse.hpp", + "external/sources/boost/hana/reverse_fold.hpp", + "external/sources/boost/hana/scan_left.hpp", + "external/sources/boost/hana/scan_right.hpp", + "external/sources/boost/hana/second.hpp", + "external/sources/boost/hana/set.hpp", + "external/sources/boost/hana/size.hpp", + "external/sources/boost/hana/slice.hpp", + "external/sources/boost/hana/sort.hpp", + "external/sources/boost/hana/span.hpp", + "external/sources/boost/hana/string.hpp", + "external/sources/boost/hana/suffix.hpp", + "external/sources/boost/hana/sum.hpp", + "external/sources/boost/hana/symmetric_difference.hpp", + "external/sources/boost/hana/take_back.hpp", + "external/sources/boost/hana/take_front.hpp", + "external/sources/boost/hana/take_while.hpp", + "external/sources/boost/hana/tap.hpp", + "external/sources/boost/hana/then.hpp", + "external/sources/boost/hana/traits.hpp", + "external/sources/boost/hana/transform.hpp", + "external/sources/boost/hana/tuple.hpp", + "external/sources/boost/hana/type.hpp", + "external/sources/boost/hana/unfold_left.hpp", + "external/sources/boost/hana/unfold_right.hpp", + "external/sources/boost/hana/union.hpp", + "external/sources/boost/hana/unique.hpp", + "external/sources/boost/hana/unpack.hpp", + "external/sources/boost/hana/value.hpp", + "external/sources/boost/hana/version.hpp", + "external/sources/boost/hana/while.hpp", + "external/sources/boost/hana/zero.hpp", + "external/sources/boost/hana/zip.hpp", + "external/sources/boost/hana/zip_shortest.hpp", + "external/sources/boost/hana/zip_shortest_with.hpp", + "external/sources/boost/hana/zip_with.hpp", + "external/sources/boost/heap/binomial_heap.hpp", + "external/sources/boost/heap/d_ary_heap.hpp", + "external/sources/boost/heap/detail/heap_comparison.hpp", + "external/sources/boost/heap/detail/heap_node.hpp", + "external/sources/boost/heap/detail/ilog2.hpp", + "external/sources/boost/heap/detail/mutable_heap.hpp", + "external/sources/boost/heap/detail/ordered_adaptor_iterator.hpp", + "external/sources/boost/heap/detail/stable_heap.hpp", + "external/sources/boost/heap/detail/tree_iterator.hpp", + "external/sources/boost/heap/fibonacci_heap.hpp", + "external/sources/boost/heap/heap_concepts.hpp", + "external/sources/boost/heap/heap_merge.hpp", + "external/sources/boost/heap/pairing_heap.hpp", + "external/sources/boost/heap/policies.hpp", + "external/sources/boost/heap/priority_queue.hpp", + "external/sources/boost/heap/skew_heap.hpp", + "external/sources/boost/histogram.hpp", + "external/sources/boost/histogram/accumulators.hpp", + "external/sources/boost/histogram/accumulators/count.hpp", + "external/sources/boost/histogram/accumulators/mean.hpp", + "external/sources/boost/histogram/accumulators/ostream.hpp", + "external/sources/boost/histogram/accumulators/sum.hpp", + "external/sources/boost/histogram/accumulators/thread_safe.hpp", + "external/sources/boost/histogram/accumulators/weighted_mean.hpp", + "external/sources/boost/histogram/accumulators/weighted_sum.hpp", + "external/sources/boost/histogram/algorithm.hpp", + "external/sources/boost/histogram/algorithm/empty.hpp", + "external/sources/boost/histogram/algorithm/project.hpp", + "external/sources/boost/histogram/algorithm/reduce.hpp", + "external/sources/boost/histogram/algorithm/sum.hpp", + "external/sources/boost/histogram/axis.hpp", + "external/sources/boost/histogram/axis/boolean.hpp", + "external/sources/boost/histogram/axis/category.hpp", + "external/sources/boost/histogram/axis/integer.hpp", + "external/sources/boost/histogram/axis/interval_view.hpp", + "external/sources/boost/histogram/axis/iterator.hpp", + "external/sources/boost/histogram/axis/metadata_base.hpp", + "external/sources/boost/histogram/axis/option.hpp", + "external/sources/boost/histogram/axis/ostream.hpp", + "external/sources/boost/histogram/axis/polymorphic_bin.hpp", + "external/sources/boost/histogram/axis/regular.hpp", + "external/sources/boost/histogram/axis/traits.hpp", + "external/sources/boost/histogram/axis/variable.hpp", + "external/sources/boost/histogram/axis/variant.hpp", + "external/sources/boost/histogram/detail/accumulator_traits.hpp", + "external/sources/boost/histogram/detail/args_type.hpp", + "external/sources/boost/histogram/detail/argument_traits.hpp", + "external/sources/boost/histogram/detail/array_wrapper.hpp", + "external/sources/boost/histogram/detail/axes.hpp", + "external/sources/boost/histogram/detail/common_type.hpp", + "external/sources/boost/histogram/detail/convert_integer.hpp", + "external/sources/boost/histogram/detail/counting_streambuf.hpp", + "external/sources/boost/histogram/detail/detect.hpp", + "external/sources/boost/histogram/detail/fill.hpp", + "external/sources/boost/histogram/detail/fill_n.hpp", + "external/sources/boost/histogram/detail/index_translator.hpp", + "external/sources/boost/histogram/detail/iterator_adaptor.hpp", + "external/sources/boost/histogram/detail/large_int.hpp", + "external/sources/boost/histogram/detail/limits.hpp", + "external/sources/boost/histogram/detail/linearize.hpp", + "external/sources/boost/histogram/detail/make_default.hpp", + "external/sources/boost/histogram/detail/mutex_base.hpp", + "external/sources/boost/histogram/detail/nonmember_container_access.hpp", + "external/sources/boost/histogram/detail/operators.hpp", + "external/sources/boost/histogram/detail/optional_index.hpp", + "external/sources/boost/histogram/detail/priority.hpp", + "external/sources/boost/histogram/detail/reduce_command.hpp", + "external/sources/boost/histogram/detail/relaxed_equal.hpp", + "external/sources/boost/histogram/detail/relaxed_tuple_size.hpp", + "external/sources/boost/histogram/detail/replace_type.hpp", + "external/sources/boost/histogram/detail/safe_comparison.hpp", + "external/sources/boost/histogram/detail/span.hpp", + "external/sources/boost/histogram/detail/static_if.hpp", + "external/sources/boost/histogram/detail/sub_array.hpp", + "external/sources/boost/histogram/detail/try_cast.hpp", + "external/sources/boost/histogram/detail/tuple_slice.hpp", + "external/sources/boost/histogram/detail/type_name.hpp", + "external/sources/boost/histogram/detail/variant_proxy.hpp", + "external/sources/boost/histogram/fwd.hpp", + "external/sources/boost/histogram/histogram.hpp", + "external/sources/boost/histogram/indexed.hpp", + "external/sources/boost/histogram/literals.hpp", + "external/sources/boost/histogram/make_histogram.hpp", + "external/sources/boost/histogram/make_profile.hpp", + "external/sources/boost/histogram/multi_index.hpp", + "external/sources/boost/histogram/ostream.hpp", + "external/sources/boost/histogram/sample.hpp", + "external/sources/boost/histogram/serialization.hpp", + "external/sources/boost/histogram/storage_adaptor.hpp", + "external/sources/boost/histogram/unlimited_storage.hpp", + "external/sources/boost/histogram/unsafe_access.hpp", + "external/sources/boost/histogram/weight.hpp", + "external/sources/boost/hof.hpp", + "external/sources/boost/hof/alias.hpp", + "external/sources/boost/hof/always.hpp", + "external/sources/boost/hof/apply.hpp", + "external/sources/boost/hof/apply_eval.hpp", + "external/sources/boost/hof/arg.hpp", + "external/sources/boost/hof/capture.hpp", + "external/sources/boost/hof/combine.hpp", + "external/sources/boost/hof/compose.hpp", + "external/sources/boost/hof/config.hpp", + "external/sources/boost/hof/construct.hpp", + "external/sources/boost/hof/decay.hpp", + "external/sources/boost/hof/decorate.hpp", + "external/sources/boost/hof/detail/and.hpp", + "external/sources/boost/hof/detail/callable_base.hpp", + "external/sources/boost/hof/detail/can_be_called.hpp", + "external/sources/boost/hof/detail/compressed_pair.hpp", + "external/sources/boost/hof/detail/constexpr_deduce.hpp", + "external/sources/boost/hof/detail/delegate.hpp", + "external/sources/boost/hof/detail/forward.hpp", + "external/sources/boost/hof/detail/holder.hpp", + "external/sources/boost/hof/detail/intrinsics.hpp", + "external/sources/boost/hof/detail/join.hpp", + "external/sources/boost/hof/detail/make.hpp", + "external/sources/boost/hof/detail/move.hpp", + "external/sources/boost/hof/detail/noexcept.hpp", + "external/sources/boost/hof/detail/pp.hpp", + "external/sources/boost/hof/detail/recursive_constexpr_depth.hpp", + "external/sources/boost/hof/detail/remove_rvalue_reference.hpp", + "external/sources/boost/hof/detail/result_of.hpp", + "external/sources/boost/hof/detail/result_type.hpp", + "external/sources/boost/hof/detail/seq.hpp", + "external/sources/boost/hof/detail/static_const_var.hpp", + "external/sources/boost/hof/detail/unpack_tuple.hpp", + "external/sources/boost/hof/detail/unwrap.hpp", + "external/sources/boost/hof/detail/using.hpp", + "external/sources/boost/hof/eval.hpp", + "external/sources/boost/hof/first_of.hpp", + "external/sources/boost/hof/fix.hpp", + "external/sources/boost/hof/flip.hpp", + "external/sources/boost/hof/flow.hpp", + "external/sources/boost/hof/fold.hpp", + "external/sources/boost/hof/function.hpp", + "external/sources/boost/hof/function_param_limit.hpp", + "external/sources/boost/hof/identity.hpp", + "external/sources/boost/hof/if.hpp", + "external/sources/boost/hof/implicit.hpp", + "external/sources/boost/hof/indirect.hpp", + "external/sources/boost/hof/infix.hpp", + "external/sources/boost/hof/is_invocable.hpp", + "external/sources/boost/hof/is_unpackable.hpp", + "external/sources/boost/hof/lambda.hpp", + "external/sources/boost/hof/lazy.hpp", + "external/sources/boost/hof/lift.hpp", + "external/sources/boost/hof/limit.hpp", + "external/sources/boost/hof/match.hpp", + "external/sources/boost/hof/mutable.hpp", + "external/sources/boost/hof/pack.hpp", + "external/sources/boost/hof/partial.hpp", + "external/sources/boost/hof/pipable.hpp", + "external/sources/boost/hof/placeholders.hpp", + "external/sources/boost/hof/proj.hpp", + "external/sources/boost/hof/protect.hpp", + "external/sources/boost/hof/repeat.hpp", + "external/sources/boost/hof/repeat_while.hpp", + "external/sources/boost/hof/result.hpp", + "external/sources/boost/hof/returns.hpp", + "external/sources/boost/hof/reveal.hpp", + "external/sources/boost/hof/reverse_fold.hpp", + "external/sources/boost/hof/rotate.hpp", + "external/sources/boost/hof/static.hpp", + "external/sources/boost/hof/tap.hpp", + "external/sources/boost/hof/unpack.hpp", + "external/sources/boost/hof/unpack_sequence.hpp", + "external/sources/boost/hof/version.hpp", + "external/sources/boost/icl/associative_element_container.hpp", + "external/sources/boost/icl/associative_interval_container.hpp", + "external/sources/boost/icl/closed_interval.hpp", + "external/sources/boost/icl/concept/comparable.hpp", + "external/sources/boost/icl/concept/container.hpp", + "external/sources/boost/icl/concept/element_associator.hpp", + "external/sources/boost/icl/concept/element_map.hpp", + "external/sources/boost/icl/concept/element_set.hpp", + "external/sources/boost/icl/concept/element_set_value.hpp", + "external/sources/boost/icl/concept/interval.hpp", + "external/sources/boost/icl/concept/interval_associator.hpp", + "external/sources/boost/icl/concept/interval_associator_base.hpp", + "external/sources/boost/icl/concept/interval_bounds.hpp", + "external/sources/boost/icl/concept/interval_map.hpp", + "external/sources/boost/icl/concept/interval_set.hpp", + "external/sources/boost/icl/concept/interval_set_value.hpp", + "external/sources/boost/icl/concept/joinable.hpp", + "external/sources/boost/icl/concept/map_value.hpp", + "external/sources/boost/icl/concept/set_value.hpp", + "external/sources/boost/icl/continuous_interval.hpp", + "external/sources/boost/icl/detail/associated_value.hpp", + "external/sources/boost/icl/detail/boost_config.hpp", + "external/sources/boost/icl/detail/concept_check.hpp", + "external/sources/boost/icl/detail/design_config.hpp", + "external/sources/boost/icl/detail/element_comparer.hpp", + "external/sources/boost/icl/detail/element_iterator.hpp", + "external/sources/boost/icl/detail/exclusive_less_than.hpp", + "external/sources/boost/icl/detail/interval_map_algo.hpp", + "external/sources/boost/icl/detail/interval_morphism.hpp", + "external/sources/boost/icl/detail/interval_set_algo.hpp", + "external/sources/boost/icl/detail/interval_subset_comparer.hpp", + "external/sources/boost/icl/detail/map_algo.hpp", + "external/sources/boost/icl/detail/mapped_reference.hpp", + "external/sources/boost/icl/detail/notate.hpp", + "external/sources/boost/icl/detail/on_absorbtion.hpp", + "external/sources/boost/icl/detail/relation_state.hpp", + "external/sources/boost/icl/detail/set_algo.hpp", + "external/sources/boost/icl/detail/std_set.hpp", + "external/sources/boost/icl/detail/subset_comparer.hpp", + "external/sources/boost/icl/discrete_interval.hpp", + "external/sources/boost/icl/dynamic_interval_traits.hpp", + "external/sources/boost/icl/functors.hpp", + "external/sources/boost/icl/gregorian.hpp", + "external/sources/boost/icl/impl_config.hpp", + "external/sources/boost/icl/interval.hpp", + "external/sources/boost/icl/interval_base_map.hpp", + "external/sources/boost/icl/interval_base_set.hpp", + "external/sources/boost/icl/interval_bounds.hpp", + "external/sources/boost/icl/interval_combining_style.hpp", + "external/sources/boost/icl/interval_map.hpp", + "external/sources/boost/icl/interval_set.hpp", + "external/sources/boost/icl/interval_traits.hpp", + "external/sources/boost/icl/iterator.hpp", + "external/sources/boost/icl/left_open_interval.hpp", + "external/sources/boost/icl/map.hpp", + "external/sources/boost/icl/open_interval.hpp", + "external/sources/boost/icl/predicates/distinct_equal.hpp", + "external/sources/boost/icl/predicates/element_equal.hpp", + "external/sources/boost/icl/predicates/std_equal.hpp", + "external/sources/boost/icl/predicates/sub_super_set.hpp", + "external/sources/boost/icl/ptime.hpp", + "external/sources/boost/icl/rational.hpp", + "external/sources/boost/icl/right_open_interval.hpp", + "external/sources/boost/icl/separate_interval_set.hpp", + "external/sources/boost/icl/set.hpp", + "external/sources/boost/icl/split_interval_map.hpp", + "external/sources/boost/icl/split_interval_set.hpp", + "external/sources/boost/icl/type_traits/absorbs_identities.hpp", + "external/sources/boost/icl/type_traits/adds_inversely.hpp", + "external/sources/boost/icl/type_traits/codomain_type_of.hpp", + "external/sources/boost/icl/type_traits/difference.hpp", + "external/sources/boost/icl/type_traits/difference_type_of.hpp", + "external/sources/boost/icl/type_traits/domain_type_of.hpp", + "external/sources/boost/icl/type_traits/element_type_of.hpp", + "external/sources/boost/icl/type_traits/has_inverse.hpp", + "external/sources/boost/icl/type_traits/has_set_semantics.hpp", + "external/sources/boost/icl/type_traits/identity_element.hpp", + "external/sources/boost/icl/type_traits/infinity.hpp", + "external/sources/boost/icl/type_traits/interval_type_default.hpp", + "external/sources/boost/icl/type_traits/interval_type_of.hpp", + "external/sources/boost/icl/type_traits/is_associative_element_container.hpp", + "external/sources/boost/icl/type_traits/is_asymmetric_interval.hpp", + "external/sources/boost/icl/type_traits/is_combinable.hpp", + "external/sources/boost/icl/type_traits/is_concept_equivalent.hpp", + "external/sources/boost/icl/type_traits/is_container.hpp", + "external/sources/boost/icl/type_traits/is_continuous.hpp", + "external/sources/boost/icl/type_traits/is_continuous_interval.hpp", + "external/sources/boost/icl/type_traits/is_discrete.hpp", + "external/sources/boost/icl/type_traits/is_discrete_interval.hpp", + "external/sources/boost/icl/type_traits/is_element_container.hpp", + "external/sources/boost/icl/type_traits/is_icl_container.hpp", + "external/sources/boost/icl/type_traits/is_increasing.hpp", + "external/sources/boost/icl/type_traits/is_interval.hpp", + "external/sources/boost/icl/type_traits/is_interval_container.hpp", + "external/sources/boost/icl/type_traits/is_interval_joiner.hpp", + "external/sources/boost/icl/type_traits/is_interval_separator.hpp", + "external/sources/boost/icl/type_traits/is_interval_splitter.hpp", + "external/sources/boost/icl/type_traits/is_key_container_of.hpp", + "external/sources/boost/icl/type_traits/is_map.hpp", + "external/sources/boost/icl/type_traits/is_numeric.hpp", + "external/sources/boost/icl/type_traits/is_set.hpp", + "external/sources/boost/icl/type_traits/is_total.hpp", + "external/sources/boost/icl/type_traits/no_type.hpp", + "external/sources/boost/icl/type_traits/predicate.hpp", + "external/sources/boost/icl/type_traits/rep_type_of.hpp", + "external/sources/boost/icl/type_traits/segment_type_of.hpp", + "external/sources/boost/icl/type_traits/size.hpp", + "external/sources/boost/icl/type_traits/size_type_of.hpp", + "external/sources/boost/icl/type_traits/succ_pred.hpp", + "external/sources/boost/icl/type_traits/to_string.hpp", + "external/sources/boost/icl/type_traits/type_to_string.hpp", + "external/sources/boost/icl/type_traits/unit_element.hpp", + "external/sources/boost/icl/type_traits/value_size.hpp", + "external/sources/boost/implicit_cast.hpp", + "external/sources/boost/indirect_reference.hpp", + "external/sources/boost/integer.hpp", + "external/sources/boost/integer/common_factor.hpp", + "external/sources/boost/integer/common_factor_ct.hpp", + "external/sources/boost/integer/common_factor_rt.hpp", + "external/sources/boost/integer/extended_euclidean.hpp", + "external/sources/boost/integer/integer_log2.hpp", + "external/sources/boost/integer/integer_mask.hpp", + "external/sources/boost/integer/mod_inverse.hpp", + "external/sources/boost/integer/static_log2.hpp", + "external/sources/boost/integer/static_min_max.hpp", + "external/sources/boost/integer_fwd.hpp", + "external/sources/boost/integer_traits.hpp", + "external/sources/boost/interprocess/allocators/adaptive_pool.hpp", + "external/sources/boost/interprocess/allocators/allocator.hpp", + "external/sources/boost/interprocess/allocators/cached_adaptive_pool.hpp", + "external/sources/boost/interprocess/allocators/cached_node_allocator.hpp", + "external/sources/boost/interprocess/allocators/detail/adaptive_node_pool.hpp", + "external/sources/boost/interprocess/allocators/detail/allocator_common.hpp", + "external/sources/boost/interprocess/allocators/detail/node_pool.hpp", + "external/sources/boost/interprocess/allocators/detail/node_tools.hpp", + "external/sources/boost/interprocess/allocators/node_allocator.hpp", + "external/sources/boost/interprocess/allocators/private_adaptive_pool.hpp", + "external/sources/boost/interprocess/allocators/private_node_allocator.hpp", + "external/sources/boost/interprocess/anonymous_shared_memory.hpp", + "external/sources/boost/interprocess/containers/allocation_type.hpp", + "external/sources/boost/interprocess/containers/containers_fwd.hpp", + "external/sources/boost/interprocess/containers/deque.hpp", + "external/sources/boost/interprocess/containers/flat_map.hpp", + "external/sources/boost/interprocess/containers/flat_set.hpp", + "external/sources/boost/interprocess/containers/list.hpp", + "external/sources/boost/interprocess/containers/map.hpp", + "external/sources/boost/interprocess/containers/pair.hpp", + "external/sources/boost/interprocess/containers/set.hpp", + "external/sources/boost/interprocess/containers/slist.hpp", + "external/sources/boost/interprocess/containers/stable_vector.hpp", + "external/sources/boost/interprocess/containers/string.hpp", + "external/sources/boost/interprocess/containers/vector.hpp", + "external/sources/boost/interprocess/containers/version_type.hpp", + "external/sources/boost/interprocess/creation_tags.hpp", + "external/sources/boost/interprocess/detail/atomic.hpp", + "external/sources/boost/interprocess/detail/cast_tags.hpp", + "external/sources/boost/interprocess/detail/config_begin.hpp", + "external/sources/boost/interprocess/detail/config_end.hpp", + "external/sources/boost/interprocess/detail/config_external_begin.hpp", + "external/sources/boost/interprocess/detail/config_external_end.hpp", + "external/sources/boost/interprocess/detail/file_locking_helpers.hpp", + "external/sources/boost/interprocess/detail/file_wrapper.hpp", + "external/sources/boost/interprocess/detail/in_place_interface.hpp", + "external/sources/boost/interprocess/detail/intermodule_singleton.hpp", + "external/sources/boost/interprocess/detail/intermodule_singleton_common.hpp", + "external/sources/boost/interprocess/detail/interprocess_tester.hpp", + "external/sources/boost/interprocess/detail/intersegment_ptr.hpp", + "external/sources/boost/interprocess/detail/managed_global_memory.hpp", + "external/sources/boost/interprocess/detail/managed_memory_impl.hpp", + "external/sources/boost/interprocess/detail/managed_multi_shared_memory.hpp", + "external/sources/boost/interprocess/detail/managed_open_or_create_impl.hpp", + "external/sources/boost/interprocess/detail/math_functions.hpp", + "external/sources/boost/interprocess/detail/min_max.hpp", + "external/sources/boost/interprocess/detail/move.hpp", + "external/sources/boost/interprocess/detail/mpl.hpp", + "external/sources/boost/interprocess/detail/named_proxy.hpp", + "external/sources/boost/interprocess/detail/nothrow.hpp", + "external/sources/boost/interprocess/detail/os_file_functions.hpp", + "external/sources/boost/interprocess/detail/os_thread_functions.hpp", + "external/sources/boost/interprocess/detail/pointer_type.hpp", + "external/sources/boost/interprocess/detail/portable_intermodule_singleton.hpp", + "external/sources/boost/interprocess/detail/posix_time_types_wrk.hpp", + "external/sources/boost/interprocess/detail/ptime_wrk.hpp", + "external/sources/boost/interprocess/detail/robust_emulation.hpp", + "external/sources/boost/interprocess/detail/segment_manager_helper.hpp", + "external/sources/boost/interprocess/detail/shared_dir_helpers.hpp", + "external/sources/boost/interprocess/detail/simple_swap.hpp", + "external/sources/boost/interprocess/detail/std_fwd.hpp", + "external/sources/boost/interprocess/detail/transform_iterator.hpp", + "external/sources/boost/interprocess/detail/type_traits.hpp", + "external/sources/boost/interprocess/detail/utilities.hpp", + "external/sources/boost/interprocess/detail/variadic_templates_tools.hpp", + "external/sources/boost/interprocess/detail/win32_api.hpp", + "external/sources/boost/interprocess/detail/windows_intermodule_singleton.hpp", + "external/sources/boost/interprocess/detail/workaround.hpp", + "external/sources/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp", + "external/sources/boost/interprocess/errors.hpp", + "external/sources/boost/interprocess/exceptions.hpp", + "external/sources/boost/interprocess/file_mapping.hpp", + "external/sources/boost/interprocess/indexes/flat_map_index.hpp", + "external/sources/boost/interprocess/indexes/iset_index.hpp", + "external/sources/boost/interprocess/indexes/iunordered_set_index.hpp", + "external/sources/boost/interprocess/indexes/map_index.hpp", + "external/sources/boost/interprocess/indexes/null_index.hpp", + "external/sources/boost/interprocess/indexes/unordered_map_index.hpp", + "external/sources/boost/interprocess/interprocess_fwd.hpp", + "external/sources/boost/interprocess/ipc/message_queue.hpp", + "external/sources/boost/interprocess/managed_external_buffer.hpp", + "external/sources/boost/interprocess/managed_heap_memory.hpp", + "external/sources/boost/interprocess/managed_mapped_file.hpp", + "external/sources/boost/interprocess/managed_shared_memory.hpp", + "external/sources/boost/interprocess/managed_windows_shared_memory.hpp", + "external/sources/boost/interprocess/managed_xsi_shared_memory.hpp", + "external/sources/boost/interprocess/mapped_region.hpp", + "external/sources/boost/interprocess/mem_algo/detail/mem_algo_common.hpp", + "external/sources/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp", + "external/sources/boost/interprocess/mem_algo/rbtree_best_fit.hpp", + "external/sources/boost/interprocess/mem_algo/simple_seq_fit.hpp", + "external/sources/boost/interprocess/offset_ptr.hpp", + "external/sources/boost/interprocess/permissions.hpp", + "external/sources/boost/interprocess/segment_manager.hpp", + "external/sources/boost/interprocess/shared_memory_object.hpp", + "external/sources/boost/interprocess/smart_ptr/deleter.hpp", + "external/sources/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp", + "external/sources/boost/interprocess/smart_ptr/detail/shared_count.hpp", + "external/sources/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp", + "external/sources/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp", + "external/sources/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp", + "external/sources/boost/interprocess/smart_ptr/enable_shared_from_this.hpp", + "external/sources/boost/interprocess/smart_ptr/intrusive_ptr.hpp", + "external/sources/boost/interprocess/smart_ptr/scoped_ptr.hpp", + "external/sources/boost/interprocess/smart_ptr/shared_ptr.hpp", + "external/sources/boost/interprocess/smart_ptr/unique_ptr.hpp", + "external/sources/boost/interprocess/smart_ptr/weak_ptr.hpp", + "external/sources/boost/interprocess/streams/bufferstream.hpp", + "external/sources/boost/interprocess/streams/vectorstream.hpp", + "external/sources/boost/interprocess/sync/detail/common_algorithms.hpp", + "external/sources/boost/interprocess/sync/detail/condition_algorithm_8a.hpp", + "external/sources/boost/interprocess/sync/detail/condition_any_algorithm.hpp", + "external/sources/boost/interprocess/sync/detail/locks.hpp", + "external/sources/boost/interprocess/sync/file_lock.hpp", + "external/sources/boost/interprocess/sync/interprocess_condition.hpp", + "external/sources/boost/interprocess/sync/interprocess_condition_any.hpp", + "external/sources/boost/interprocess/sync/interprocess_mutex.hpp", + "external/sources/boost/interprocess/sync/interprocess_recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/interprocess_semaphore.hpp", + "external/sources/boost/interprocess/sync/interprocess_sharable_mutex.hpp", + "external/sources/boost/interprocess/sync/interprocess_upgradable_mutex.hpp", + "external/sources/boost/interprocess/sync/lock_options.hpp", + "external/sources/boost/interprocess/sync/mutex_family.hpp", + "external/sources/boost/interprocess/sync/named_condition.hpp", + "external/sources/boost/interprocess/sync/named_condition_any.hpp", + "external/sources/boost/interprocess/sync/named_mutex.hpp", + "external/sources/boost/interprocess/sync/named_recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/named_semaphore.hpp", + "external/sources/boost/interprocess/sync/named_sharable_mutex.hpp", + "external/sources/boost/interprocess/sync/named_upgradable_mutex.hpp", + "external/sources/boost/interprocess/sync/null_mutex.hpp", + "external/sources/boost/interprocess/sync/posix/condition.hpp", + "external/sources/boost/interprocess/sync/posix/mutex.hpp", + "external/sources/boost/interprocess/sync/posix/named_mutex.hpp", + "external/sources/boost/interprocess/sync/posix/named_semaphore.hpp", + "external/sources/boost/interprocess/sync/posix/pthread_helpers.hpp", + "external/sources/boost/interprocess/sync/posix/ptime_to_timespec.hpp", + "external/sources/boost/interprocess/sync/posix/recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/posix/semaphore.hpp", + "external/sources/boost/interprocess/sync/posix/semaphore_wrapper.hpp", + "external/sources/boost/interprocess/sync/scoped_lock.hpp", + "external/sources/boost/interprocess/sync/sharable_lock.hpp", + "external/sources/boost/interprocess/sync/shm/named_condition.hpp", + "external/sources/boost/interprocess/sync/shm/named_condition_any.hpp", + "external/sources/boost/interprocess/sync/shm/named_creation_functor.hpp", + "external/sources/boost/interprocess/sync/shm/named_mutex.hpp", + "external/sources/boost/interprocess/sync/shm/named_recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/shm/named_semaphore.hpp", + "external/sources/boost/interprocess/sync/shm/named_upgradable_mutex.hpp", + "external/sources/boost/interprocess/sync/spin/condition.hpp", + "external/sources/boost/interprocess/sync/spin/interprocess_barrier.hpp", + "external/sources/boost/interprocess/sync/spin/mutex.hpp", + "external/sources/boost/interprocess/sync/spin/recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/spin/semaphore.hpp", + "external/sources/boost/interprocess/sync/spin/wait.hpp", + "external/sources/boost/interprocess/sync/upgradable_lock.hpp", + "external/sources/boost/interprocess/sync/windows/condition.hpp", + "external/sources/boost/interprocess/sync/windows/mutex.hpp", + "external/sources/boost/interprocess/sync/windows/named_condition.hpp", + "external/sources/boost/interprocess/sync/windows/named_condition_any.hpp", + "external/sources/boost/interprocess/sync/windows/named_mutex.hpp", + "external/sources/boost/interprocess/sync/windows/named_recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/windows/named_semaphore.hpp", + "external/sources/boost/interprocess/sync/windows/named_sync.hpp", + "external/sources/boost/interprocess/sync/windows/recursive_mutex.hpp", + "external/sources/boost/interprocess/sync/windows/semaphore.hpp", + "external/sources/boost/interprocess/sync/windows/sync_utils.hpp", + "external/sources/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp", + "external/sources/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp", + "external/sources/boost/interprocess/sync/windows/winapi_wrapper_common.hpp", + "external/sources/boost/interprocess/windows_shared_memory.hpp", + "external/sources/boost/interprocess/xsi_key.hpp", + "external/sources/boost/interprocess/xsi_shared_memory.hpp", + "external/sources/boost/intrusive/any_hook.hpp", + "external/sources/boost/intrusive/avl_set.hpp", + "external/sources/boost/intrusive/avl_set_hook.hpp", + "external/sources/boost/intrusive/avltree.hpp", + "external/sources/boost/intrusive/avltree_algorithms.hpp", + "external/sources/boost/intrusive/bs_set.hpp", + "external/sources/boost/intrusive/bs_set_hook.hpp", + "external/sources/boost/intrusive/bstree.hpp", + "external/sources/boost/intrusive/bstree_algorithms.hpp", + "external/sources/boost/intrusive/circular_list_algorithms.hpp", + "external/sources/boost/intrusive/circular_slist_algorithms.hpp", + "external/sources/boost/intrusive/derivation_value_traits.hpp", + "external/sources/boost/intrusive/detail/algo_type.hpp", + "external/sources/boost/intrusive/detail/algorithm.hpp", + "external/sources/boost/intrusive/detail/any_node_and_algorithms.hpp", + "external/sources/boost/intrusive/detail/array_initializer.hpp", + "external/sources/boost/intrusive/detail/assert.hpp", + "external/sources/boost/intrusive/detail/avltree_node.hpp", + "external/sources/boost/intrusive/detail/bstree_algorithms_base.hpp", + "external/sources/boost/intrusive/detail/common_slist_algorithms.hpp", + "external/sources/boost/intrusive/detail/config_begin.hpp", + "external/sources/boost/intrusive/detail/config_end.hpp", + "external/sources/boost/intrusive/detail/default_header_holder.hpp", + "external/sources/boost/intrusive/detail/ebo_functor_holder.hpp", + "external/sources/boost/intrusive/detail/empty_node_checker.hpp", + "external/sources/boost/intrusive/detail/equal_to_value.hpp", + "external/sources/boost/intrusive/detail/exception_disposer.hpp", + "external/sources/boost/intrusive/detail/function_detector.hpp", + "external/sources/boost/intrusive/detail/generic_hook.hpp", + "external/sources/boost/intrusive/detail/get_value_traits.hpp", + "external/sources/boost/intrusive/detail/has_member_function_callable_with.hpp", + "external/sources/boost/intrusive/detail/hashtable_node.hpp", + "external/sources/boost/intrusive/detail/hook_traits.hpp", + "external/sources/boost/intrusive/detail/iiterator.hpp", + "external/sources/boost/intrusive/detail/is_stateful_value_traits.hpp", + "external/sources/boost/intrusive/detail/iterator.hpp", + "external/sources/boost/intrusive/detail/key_nodeptr_comp.hpp", + "external/sources/boost/intrusive/detail/list_iterator.hpp", + "external/sources/boost/intrusive/detail/list_node.hpp", + "external/sources/boost/intrusive/detail/math.hpp", + "external/sources/boost/intrusive/detail/minimal_less_equal_header.hpp", + "external/sources/boost/intrusive/detail/minimal_pair_header.hpp", + "external/sources/boost/intrusive/detail/mpl.hpp", + "external/sources/boost/intrusive/detail/node_cloner_disposer.hpp", + "external/sources/boost/intrusive/detail/node_holder.hpp", + "external/sources/boost/intrusive/detail/node_to_value.hpp", + "external/sources/boost/intrusive/detail/parent_from_member.hpp", + "external/sources/boost/intrusive/detail/rbtree_node.hpp", + "external/sources/boost/intrusive/detail/reverse_iterator.hpp", + "external/sources/boost/intrusive/detail/simple_disposers.hpp", + "external/sources/boost/intrusive/detail/size_holder.hpp", + "external/sources/boost/intrusive/detail/slist_iterator.hpp", + "external/sources/boost/intrusive/detail/slist_node.hpp", + "external/sources/boost/intrusive/detail/std_fwd.hpp", + "external/sources/boost/intrusive/detail/transform_iterator.hpp", + "external/sources/boost/intrusive/detail/tree_iterator.hpp", + "external/sources/boost/intrusive/detail/tree_node.hpp", + "external/sources/boost/intrusive/detail/tree_value_compare.hpp", + "external/sources/boost/intrusive/detail/uncast.hpp", + "external/sources/boost/intrusive/detail/workaround.hpp", + "external/sources/boost/intrusive/hashtable.hpp", + "external/sources/boost/intrusive/intrusive_fwd.hpp", + "external/sources/boost/intrusive/linear_slist_algorithms.hpp", + "external/sources/boost/intrusive/link_mode.hpp", + "external/sources/boost/intrusive/list.hpp", + "external/sources/boost/intrusive/list_hook.hpp", + "external/sources/boost/intrusive/member_value_traits.hpp", + "external/sources/boost/intrusive/options.hpp", + "external/sources/boost/intrusive/pack_options.hpp", + "external/sources/boost/intrusive/parent_from_member.hpp", + "external/sources/boost/intrusive/pointer_plus_bits.hpp", + "external/sources/boost/intrusive/pointer_rebind.hpp", + "external/sources/boost/intrusive/pointer_traits.hpp", + "external/sources/boost/intrusive/priority_compare.hpp", + "external/sources/boost/intrusive/rbtree.hpp", + "external/sources/boost/intrusive/rbtree_algorithms.hpp", + "external/sources/boost/intrusive/set.hpp", + "external/sources/boost/intrusive/set_hook.hpp", + "external/sources/boost/intrusive/sg_set.hpp", + "external/sources/boost/intrusive/sgtree.hpp", + "external/sources/boost/intrusive/sgtree_algorithms.hpp", + "external/sources/boost/intrusive/slist.hpp", + "external/sources/boost/intrusive/slist_hook.hpp", + "external/sources/boost/intrusive/splay_set.hpp", + "external/sources/boost/intrusive/splaytree.hpp", + "external/sources/boost/intrusive/splaytree_algorithms.hpp", + "external/sources/boost/intrusive/treap.hpp", + "external/sources/boost/intrusive/treap_algorithms.hpp", + "external/sources/boost/intrusive/treap_set.hpp", + "external/sources/boost/intrusive/trivial_value_traits.hpp", + "external/sources/boost/intrusive/unordered_set.hpp", + "external/sources/boost/intrusive/unordered_set_hook.hpp", + "external/sources/boost/intrusive_ptr.hpp", + "external/sources/boost/io/detail/buffer_fill.hpp", + "external/sources/boost/io/detail/ostream_guard.hpp", + "external/sources/boost/io/ios_state.hpp", + "external/sources/boost/io/ostream_joiner.hpp", + "external/sources/boost/io/ostream_put.hpp", + "external/sources/boost/io/quoted.hpp", + "external/sources/boost/io_fwd.hpp", + "external/sources/boost/iostreams/categories.hpp", + "external/sources/boost/iostreams/chain.hpp", + "external/sources/boost/iostreams/char_traits.hpp", + "external/sources/boost/iostreams/checked_operations.hpp", + "external/sources/boost/iostreams/close.hpp", + "external/sources/boost/iostreams/code_converter.hpp", + "external/sources/boost/iostreams/combine.hpp", + "external/sources/boost/iostreams/compose.hpp", + "external/sources/boost/iostreams/concepts.hpp", + "external/sources/boost/iostreams/constants.hpp", + "external/sources/boost/iostreams/copy.hpp", + "external/sources/boost/iostreams/detail/absolute_path.hpp", + "external/sources/boost/iostreams/detail/access_control.hpp", + "external/sources/boost/iostreams/detail/adapter/concept_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/device_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/direct_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/filter_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/mode_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/non_blocking_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/output_iterator_adapter.hpp", + "external/sources/boost/iostreams/detail/adapter/range_adapter.hpp", + "external/sources/boost/iostreams/detail/add_facet.hpp", + "external/sources/boost/iostreams/detail/bool_trait_def.hpp", + "external/sources/boost/iostreams/detail/broken_overload_resolution/forward.hpp", + "external/sources/boost/iostreams/detail/broken_overload_resolution/stream.hpp", + "external/sources/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp", + "external/sources/boost/iostreams/detail/buffer.hpp", + "external/sources/boost/iostreams/detail/call_traits.hpp", + "external/sources/boost/iostreams/detail/char_traits.hpp", + "external/sources/boost/iostreams/detail/codecvt_helper.hpp", + "external/sources/boost/iostreams/detail/codecvt_holder.hpp", + "external/sources/boost/iostreams/detail/config/auto_link.hpp", + "external/sources/boost/iostreams/detail/config/bzip2.hpp", + "external/sources/boost/iostreams/detail/config/codecvt.hpp", + "external/sources/boost/iostreams/detail/config/disable_warnings.hpp", + "external/sources/boost/iostreams/detail/config/dyn_link.hpp", + "external/sources/boost/iostreams/detail/config/enable_warnings.hpp", + "external/sources/boost/iostreams/detail/config/fpos.hpp", + "external/sources/boost/iostreams/detail/config/gcc.hpp", + "external/sources/boost/iostreams/detail/config/limits.hpp", + "external/sources/boost/iostreams/detail/config/overload_resolution.hpp", + "external/sources/boost/iostreams/detail/config/rtl.hpp", + "external/sources/boost/iostreams/detail/config/unreachable_return.hpp", + "external/sources/boost/iostreams/detail/config/wide_streams.hpp", + "external/sources/boost/iostreams/detail/config/windows_posix.hpp", + "external/sources/boost/iostreams/detail/config/zlib.hpp", + "external/sources/boost/iostreams/detail/counted_array.hpp", + "external/sources/boost/iostreams/detail/current_directory.hpp", + "external/sources/boost/iostreams/detail/default_arg.hpp", + "external/sources/boost/iostreams/detail/dispatch.hpp", + "external/sources/boost/iostreams/detail/double_object.hpp", + "external/sources/boost/iostreams/detail/enable_if_stream.hpp", + "external/sources/boost/iostreams/detail/error.hpp", + "external/sources/boost/iostreams/detail/execute.hpp", + "external/sources/boost/iostreams/detail/file_handle.hpp", + "external/sources/boost/iostreams/detail/forward.hpp", + "external/sources/boost/iostreams/detail/fstream.hpp", + "external/sources/boost/iostreams/detail/functional.hpp", + "external/sources/boost/iostreams/detail/ios.hpp", + "external/sources/boost/iostreams/detail/iostream.hpp", + "external/sources/boost/iostreams/detail/is_dereferenceable.hpp", + "external/sources/boost/iostreams/detail/is_iterator_range.hpp", + "external/sources/boost/iostreams/detail/newline.hpp", + "external/sources/boost/iostreams/detail/optional.hpp", + "external/sources/boost/iostreams/detail/param_type.hpp", + "external/sources/boost/iostreams/detail/path.hpp", + "external/sources/boost/iostreams/detail/push.hpp", + "external/sources/boost/iostreams/detail/push_params.hpp", + "external/sources/boost/iostreams/detail/resolve.hpp", + "external/sources/boost/iostreams/detail/restrict_impl.hpp", + "external/sources/boost/iostreams/detail/select.hpp", + "external/sources/boost/iostreams/detail/select_by_size.hpp", + "external/sources/boost/iostreams/detail/streambuf.hpp", + "external/sources/boost/iostreams/detail/streambuf/chainbuf.hpp", + "external/sources/boost/iostreams/detail/streambuf/direct_streambuf.hpp", + "external/sources/boost/iostreams/detail/streambuf/indirect_streambuf.hpp", + "external/sources/boost/iostreams/detail/streambuf/linked_streambuf.hpp", + "external/sources/boost/iostreams/detail/system_failure.hpp", + "external/sources/boost/iostreams/detail/template_params.hpp", + "external/sources/boost/iostreams/detail/translate_int_type.hpp", + "external/sources/boost/iostreams/detail/wrap_unwrap.hpp", + "external/sources/boost/iostreams/device/array.hpp", + "external/sources/boost/iostreams/device/back_inserter.hpp", + "external/sources/boost/iostreams/device/file.hpp", + "external/sources/boost/iostreams/device/file_descriptor.hpp", + "external/sources/boost/iostreams/device/mapped_file.hpp", + "external/sources/boost/iostreams/device/null.hpp", + "external/sources/boost/iostreams/filter/aggregate.hpp", + "external/sources/boost/iostreams/filter/bzip2.hpp", + "external/sources/boost/iostreams/filter/counter.hpp", + "external/sources/boost/iostreams/filter/grep.hpp", + "external/sources/boost/iostreams/filter/gzip.hpp", + "external/sources/boost/iostreams/filter/line.hpp", + "external/sources/boost/iostreams/filter/lzma.hpp", + "external/sources/boost/iostreams/filter/newline.hpp", + "external/sources/boost/iostreams/filter/regex.hpp", + "external/sources/boost/iostreams/filter/stdio.hpp", + "external/sources/boost/iostreams/filter/symmetric.hpp", + "external/sources/boost/iostreams/filter/test.hpp", + "external/sources/boost/iostreams/filter/zlib.hpp", + "external/sources/boost/iostreams/filter/zstd.hpp", + "external/sources/boost/iostreams/filtering_stream.hpp", + "external/sources/boost/iostreams/filtering_streambuf.hpp", + "external/sources/boost/iostreams/flush.hpp", + "external/sources/boost/iostreams/get.hpp", + "external/sources/boost/iostreams/imbue.hpp", + "external/sources/boost/iostreams/input_sequence.hpp", + "external/sources/boost/iostreams/invert.hpp", + "external/sources/boost/iostreams/operations.hpp", + "external/sources/boost/iostreams/operations_fwd.hpp", + "external/sources/boost/iostreams/optimal_buffer_size.hpp", + "external/sources/boost/iostreams/output_sequence.hpp", + "external/sources/boost/iostreams/pipeline.hpp", + "external/sources/boost/iostreams/positioning.hpp", + "external/sources/boost/iostreams/put.hpp", + "external/sources/boost/iostreams/putback.hpp", + "external/sources/boost/iostreams/read.hpp", + "external/sources/boost/iostreams/restrict.hpp", + "external/sources/boost/iostreams/seek.hpp", + "external/sources/boost/iostreams/skip.hpp", + "external/sources/boost/iostreams/slice.hpp", + "external/sources/boost/iostreams/stream.hpp", + "external/sources/boost/iostreams/stream_buffer.hpp", + "external/sources/boost/iostreams/tee.hpp", + "external/sources/boost/iostreams/traits.hpp", + "external/sources/boost/iostreams/traits_fwd.hpp", + "external/sources/boost/iostreams/write.hpp", + "external/sources/boost/is_placeholder.hpp", + "external/sources/boost/iterator.hpp", + "external/sources/boost/iterator/advance.hpp", + "external/sources/boost/iterator/counting_iterator.hpp", + "external/sources/boost/iterator/detail/any_conversion_eater.hpp", + "external/sources/boost/iterator/detail/config_def.hpp", + "external/sources/boost/iterator/detail/config_undef.hpp", + "external/sources/boost/iterator/detail/enable_if.hpp", + "external/sources/boost/iterator/detail/facade_iterator_category.hpp", + "external/sources/boost/iterator/detail/minimum_category.hpp", + "external/sources/boost/iterator/distance.hpp", + "external/sources/boost/iterator/filter_iterator.hpp", + "external/sources/boost/iterator/function_input_iterator.hpp", + "external/sources/boost/iterator/function_output_iterator.hpp", + "external/sources/boost/iterator/indirect_iterator.hpp", + "external/sources/boost/iterator/interoperable.hpp", + "external/sources/boost/iterator/is_lvalue_iterator.hpp", + "external/sources/boost/iterator/is_readable_iterator.hpp", + "external/sources/boost/iterator/iterator_adaptor.hpp", + "external/sources/boost/iterator/iterator_archetypes.hpp", + "external/sources/boost/iterator/iterator_categories.hpp", + "external/sources/boost/iterator/iterator_concepts.hpp", + "external/sources/boost/iterator/iterator_facade.hpp", + "external/sources/boost/iterator/iterator_traits.hpp", + "external/sources/boost/iterator/minimum_category.hpp", + "external/sources/boost/iterator/new_iterator_tests.hpp", + "external/sources/boost/iterator/permutation_iterator.hpp", + "external/sources/boost/iterator/reverse_iterator.hpp", + "external/sources/boost/iterator/transform_iterator.hpp", + "external/sources/boost/iterator/zip_iterator.hpp", + "external/sources/boost/iterator_adaptors.hpp", + "external/sources/boost/lambda/algorithm.hpp", + "external/sources/boost/lambda/bind.hpp", + "external/sources/boost/lambda/casts.hpp", + "external/sources/boost/lambda/closures.hpp", + "external/sources/boost/lambda/construct.hpp", + "external/sources/boost/lambda/control_structures.hpp", + "external/sources/boost/lambda/core.hpp", + "external/sources/boost/lambda/detail/actions.hpp", + "external/sources/boost/lambda/detail/arity_code.hpp", + "external/sources/boost/lambda/detail/bind_functions.hpp", + "external/sources/boost/lambda/detail/control_constructs_common.hpp", + "external/sources/boost/lambda/detail/function_adaptors.hpp", + "external/sources/boost/lambda/detail/is_instance_of.hpp", + "external/sources/boost/lambda/detail/lambda_config.hpp", + "external/sources/boost/lambda/detail/lambda_functor_base.hpp", + "external/sources/boost/lambda/detail/lambda_functors.hpp", + "external/sources/boost/lambda/detail/lambda_fwd.hpp", + "external/sources/boost/lambda/detail/lambda_traits.hpp", + "external/sources/boost/lambda/detail/member_ptr.hpp", + "external/sources/boost/lambda/detail/operator_actions.hpp", + "external/sources/boost/lambda/detail/operator_lambda_func_base.hpp", + "external/sources/boost/lambda/detail/operator_return_type_traits.hpp", + "external/sources/boost/lambda/detail/operators.hpp", + "external/sources/boost/lambda/detail/ret.hpp", + "external/sources/boost/lambda/detail/return_type_traits.hpp", + "external/sources/boost/lambda/detail/select_functions.hpp", + "external/sources/boost/lambda/detail/suppress_unused.hpp", + "external/sources/boost/lambda/exceptions.hpp", + "external/sources/boost/lambda/if.hpp", + "external/sources/boost/lambda/lambda.hpp", + "external/sources/boost/lambda/loops.hpp", + "external/sources/boost/lambda/numeric.hpp", + "external/sources/boost/lambda/switch.hpp", + "external/sources/boost/lexical_cast.hpp", + "external/sources/boost/lexical_cast/bad_lexical_cast.hpp", + "external/sources/boost/lexical_cast/detail/converter_lexical.hpp", + "external/sources/boost/lexical_cast/detail/converter_lexical_streams.hpp", + "external/sources/boost/lexical_cast/detail/converter_numeric.hpp", + "external/sources/boost/lexical_cast/detail/inf_nan.hpp", + "external/sources/boost/lexical_cast/detail/is_character.hpp", + "external/sources/boost/lexical_cast/detail/lcast_char_constants.hpp", + "external/sources/boost/lexical_cast/detail/lcast_unsigned_converters.hpp", + "external/sources/boost/lexical_cast/detail/widest_char.hpp", + "external/sources/boost/lexical_cast/lexical_cast_old.hpp", + "external/sources/boost/lexical_cast/try_lexical_convert.hpp", + "external/sources/boost/limits.hpp", + "external/sources/boost/local_function.hpp", + "external/sources/boost/local_function/aux_/add_pointed_const.hpp", + "external/sources/boost/local_function/aux_/function.hpp", + "external/sources/boost/local_function/aux_/macro/code_/bind.hpp", + "external/sources/boost/local_function/aux_/macro/code_/functor.hpp", + "external/sources/boost/local_function/aux_/macro/code_/result.hpp", + "external/sources/boost/local_function/aux_/macro/decl.hpp", + "external/sources/boost/local_function/aux_/macro/name.hpp", + "external/sources/boost/local_function/aux_/macro/typeof.hpp", + "external/sources/boost/local_function/aux_/member.hpp", + "external/sources/boost/local_function/aux_/nobind.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/bind.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/append.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/index.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/nil.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/validate.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/validate_/return_count.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_/validate_/this_count.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_binds.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_const_binds.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_error.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_params.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_returns.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_sign_/any_bind_type.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_sign_/sign.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/defaults.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/decl_sign_/validate_/this.hpp", + "external/sources/boost/local_function/aux_/preprocessor/traits/param.hpp", + "external/sources/boost/local_function/aux_/symbol.hpp", + "external/sources/boost/local_function/config.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/auto.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/bind.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/const.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/const_bind.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/default.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/facility/add.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/facility/is.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/facility/remove.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/inline.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/recursive.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/register.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/return.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/this.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/thisunderscore.hpp", + "external/sources/boost/local_function/detail/preprocessor/keyword/void.hpp", + "external/sources/boost/local_function/detail/preprocessor/line_counter.hpp", + "external/sources/boost/local_function/detail/preprocessor/void_list.hpp", + "external/sources/boost/locale.hpp", + "external/sources/boost/locale/boundary.hpp", + "external/sources/boost/locale/boundary/boundary_point.hpp", + "external/sources/boost/locale/boundary/facets.hpp", + "external/sources/boost/locale/boundary/index.hpp", + "external/sources/boost/locale/boundary/segment.hpp", + "external/sources/boost/locale/boundary/types.hpp", + "external/sources/boost/locale/collator.hpp", + "external/sources/boost/locale/config.hpp", + "external/sources/boost/locale/conversion.hpp", + "external/sources/boost/locale/date_time.hpp", + "external/sources/boost/locale/date_time_facet.hpp", + "external/sources/boost/locale/definitions.hpp", + "external/sources/boost/locale/encoding.hpp", + "external/sources/boost/locale/encoding_errors.hpp", + "external/sources/boost/locale/encoding_utf.hpp", + "external/sources/boost/locale/format.hpp", + "external/sources/boost/locale/formatting.hpp", + "external/sources/boost/locale/generator.hpp", + "external/sources/boost/locale/generic_codecvt.hpp", + "external/sources/boost/locale/gnu_gettext.hpp", + "external/sources/boost/locale/hold_ptr.hpp", + "external/sources/boost/locale/info.hpp", + "external/sources/boost/locale/localization_backend.hpp", + "external/sources/boost/locale/message.hpp", + "external/sources/boost/locale/time_zone.hpp", + "external/sources/boost/locale/utf.hpp", + "external/sources/boost/locale/utf8_codecvt.hpp", + "external/sources/boost/locale/util.hpp", + "external/sources/boost/lockfree/detail/atomic.hpp", + "external/sources/boost/lockfree/detail/copy_payload.hpp", + "external/sources/boost/lockfree/detail/freelist.hpp", + "external/sources/boost/lockfree/detail/parameter.hpp", + "external/sources/boost/lockfree/detail/prefix.hpp", + "external/sources/boost/lockfree/detail/tagged_ptr.hpp", + "external/sources/boost/lockfree/detail/tagged_ptr_dcas.hpp", + "external/sources/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp", + "external/sources/boost/lockfree/lockfree_forward.hpp", + "external/sources/boost/lockfree/policies.hpp", + "external/sources/boost/lockfree/queue.hpp", + "external/sources/boost/lockfree/spsc_queue.hpp", + "external/sources/boost/lockfree/stack.hpp", + "external/sources/boost/log/attributes.hpp", + "external/sources/boost/log/attributes/attribute.hpp", + "external/sources/boost/log/attributes/attribute_cast.hpp", + "external/sources/boost/log/attributes/attribute_name.hpp", + "external/sources/boost/log/attributes/attribute_set.hpp", + "external/sources/boost/log/attributes/attribute_value.hpp", + "external/sources/boost/log/attributes/attribute_value_impl.hpp", + "external/sources/boost/log/attributes/attribute_value_set.hpp", + "external/sources/boost/log/attributes/clock.hpp", + "external/sources/boost/log/attributes/constant.hpp", + "external/sources/boost/log/attributes/counter.hpp", + "external/sources/boost/log/attributes/current_process_id.hpp", + "external/sources/boost/log/attributes/current_process_name.hpp", + "external/sources/boost/log/attributes/current_thread_id.hpp", + "external/sources/boost/log/attributes/fallback_policy.hpp", + "external/sources/boost/log/attributes/fallback_policy_fwd.hpp", + "external/sources/boost/log/attributes/function.hpp", + "external/sources/boost/log/attributes/mutable_constant.hpp", + "external/sources/boost/log/attributes/named_scope.hpp", + "external/sources/boost/log/attributes/scoped_attribute.hpp", + "external/sources/boost/log/attributes/time_traits.hpp", + "external/sources/boost/log/attributes/timer.hpp", + "external/sources/boost/log/attributes/value_extraction.hpp", + "external/sources/boost/log/attributes/value_extraction_fwd.hpp", + "external/sources/boost/log/attributes/value_visitation.hpp", + "external/sources/boost/log/attributes/value_visitation_fwd.hpp", + "external/sources/boost/log/common.hpp", + "external/sources/boost/log/core.hpp", + "external/sources/boost/log/core/core.hpp", + "external/sources/boost/log/core/record.hpp", + "external/sources/boost/log/core/record_view.hpp", + "external/sources/boost/log/detail/adaptive_mutex.hpp", + "external/sources/boost/log/detail/allocator_traits.hpp", + "external/sources/boost/log/detail/asio_fwd.hpp", + "external/sources/boost/log/detail/attachable_sstream_buf.hpp", + "external/sources/boost/log/detail/attr_output_impl.hpp", + "external/sources/boost/log/detail/attr_output_terminal.hpp", + "external/sources/boost/log/detail/attribute_get_value_impl.hpp", + "external/sources/boost/log/detail/attribute_predicate.hpp", + "external/sources/boost/log/detail/c_str.hpp", + "external/sources/boost/log/detail/cleanup_scope_guard.hpp", + "external/sources/boost/log/detail/code_conversion.hpp", + "external/sources/boost/log/detail/config.hpp", + "external/sources/boost/log/detail/copy_cv.hpp", + "external/sources/boost/log/detail/custom_terminal_spec.hpp", + "external/sources/boost/log/detail/date_time_fmt_gen_traits_fwd.hpp", + "external/sources/boost/log/detail/date_time_format_parser.hpp", + "external/sources/boost/log/detail/decomposed_time.hpp", + "external/sources/boost/log/detail/deduce_char_type.hpp", + "external/sources/boost/log/detail/default_attribute_names.hpp", + "external/sources/boost/log/detail/embedded_string_type.hpp", + "external/sources/boost/log/detail/enqueued_record.hpp", + "external/sources/boost/log/detail/event.hpp", + "external/sources/boost/log/detail/fake_mutex.hpp", + "external/sources/boost/log/detail/footer.hpp", + "external/sources/boost/log/detail/format.hpp", + "external/sources/boost/log/detail/function_traits.hpp", + "external/sources/boost/log/detail/generate_overloads.hpp", + "external/sources/boost/log/detail/header.hpp", + "external/sources/boost/log/detail/id.hpp", + "external/sources/boost/log/detail/is_character_type.hpp", + "external/sources/boost/log/detail/is_ostream.hpp", + "external/sources/boost/log/detail/light_function.hpp", + "external/sources/boost/log/detail/light_function_pp.hpp", + "external/sources/boost/log/detail/light_rw_mutex.hpp", + "external/sources/boost/log/detail/locking_ptr.hpp", + "external/sources/boost/log/detail/locks.hpp", + "external/sources/boost/log/detail/named_scope_fmt_pp.hpp", + "external/sources/boost/log/detail/native_typeof.hpp", + "external/sources/boost/log/detail/parameter_tools.hpp", + "external/sources/boost/log/detail/pause.hpp", + "external/sources/boost/log/detail/pp_identity.hpp", + "external/sources/boost/log/detail/process_id.hpp", + "external/sources/boost/log/detail/setup_config.hpp", + "external/sources/boost/log/detail/sfinae_tools.hpp", + "external/sources/boost/log/detail/singleton.hpp", + "external/sources/boost/log/detail/sink_init_helpers.hpp", + "external/sources/boost/log/detail/snprintf.hpp", + "external/sources/boost/log/detail/tagged_integer.hpp", + "external/sources/boost/log/detail/thread_id.hpp", + "external/sources/boost/log/detail/thread_specific.hpp", + "external/sources/boost/log/detail/threadsafe_queue.hpp", + "external/sources/boost/log/detail/timestamp.hpp", + "external/sources/boost/log/detail/trivial_keyword.hpp", + "external/sources/boost/log/detail/unary_function_terminal.hpp", + "external/sources/boost/log/detail/value_ref_visitation.hpp", + "external/sources/boost/log/exceptions.hpp", + "external/sources/boost/log/expressions.hpp", + "external/sources/boost/log/expressions/attr.hpp", + "external/sources/boost/log/expressions/attr_fwd.hpp", + "external/sources/boost/log/expressions/filter.hpp", + "external/sources/boost/log/expressions/formatter.hpp", + "external/sources/boost/log/expressions/formatters.hpp", + "external/sources/boost/log/expressions/formatters/auto_newline.hpp", + "external/sources/boost/log/expressions/formatters/c_decorator.hpp", + "external/sources/boost/log/expressions/formatters/char_decorator.hpp", + "external/sources/boost/log/expressions/formatters/csv_decorator.hpp", + "external/sources/boost/log/expressions/formatters/date_time.hpp", + "external/sources/boost/log/expressions/formatters/format.hpp", + "external/sources/boost/log/expressions/formatters/if.hpp", + "external/sources/boost/log/expressions/formatters/max_size_decorator.hpp", + "external/sources/boost/log/expressions/formatters/named_scope.hpp", + "external/sources/boost/log/expressions/formatters/stream.hpp", + "external/sources/boost/log/expressions/formatters/wrap_formatter.hpp", + "external/sources/boost/log/expressions/formatters/xml_decorator.hpp", + "external/sources/boost/log/expressions/is_keyword_descriptor.hpp", + "external/sources/boost/log/expressions/keyword.hpp", + "external/sources/boost/log/expressions/keyword_fwd.hpp", + "external/sources/boost/log/expressions/message.hpp", + "external/sources/boost/log/expressions/predicates.hpp", + "external/sources/boost/log/expressions/predicates/begins_with.hpp", + "external/sources/boost/log/expressions/predicates/channel_severity_filter.hpp", + "external/sources/boost/log/expressions/predicates/contains.hpp", + "external/sources/boost/log/expressions/predicates/ends_with.hpp", + "external/sources/boost/log/expressions/predicates/has_attr.hpp", + "external/sources/boost/log/expressions/predicates/is_debugger_present.hpp", + "external/sources/boost/log/expressions/predicates/is_in_range.hpp", + "external/sources/boost/log/expressions/predicates/matches.hpp", + "external/sources/boost/log/expressions/record.hpp", + "external/sources/boost/log/keywords/auto_flush.hpp", + "external/sources/boost/log/keywords/auto_newline_mode.hpp", + "external/sources/boost/log/keywords/block_size.hpp", + "external/sources/boost/log/keywords/capacity.hpp", + "external/sources/boost/log/keywords/channel.hpp", + "external/sources/boost/log/keywords/delimiter.hpp", + "external/sources/boost/log/keywords/depth.hpp", + "external/sources/boost/log/keywords/empty_marker.hpp", + "external/sources/boost/log/keywords/enable_final_rotation.hpp", + "external/sources/boost/log/keywords/facility.hpp", + "external/sources/boost/log/keywords/file_name.hpp", + "external/sources/boost/log/keywords/filter.hpp", + "external/sources/boost/log/keywords/format.hpp", + "external/sources/boost/log/keywords/ident.hpp", + "external/sources/boost/log/keywords/incomplete_marker.hpp", + "external/sources/boost/log/keywords/ip_version.hpp", + "external/sources/boost/log/keywords/iteration.hpp", + "external/sources/boost/log/keywords/log_name.hpp", + "external/sources/boost/log/keywords/log_source.hpp", + "external/sources/boost/log/keywords/max_files.hpp", + "external/sources/boost/log/keywords/max_size.hpp", + "external/sources/boost/log/keywords/message_file.hpp", + "external/sources/boost/log/keywords/min_free_space.hpp", + "external/sources/boost/log/keywords/name.hpp", + "external/sources/boost/log/keywords/open_mode.hpp", + "external/sources/boost/log/keywords/order.hpp", + "external/sources/boost/log/keywords/ordering_window.hpp", + "external/sources/boost/log/keywords/overflow_policy.hpp", + "external/sources/boost/log/keywords/permissions.hpp", + "external/sources/boost/log/keywords/registration.hpp", + "external/sources/boost/log/keywords/rotation_size.hpp", + "external/sources/boost/log/keywords/scan_method.hpp", + "external/sources/boost/log/keywords/severity.hpp", + "external/sources/boost/log/keywords/start_thread.hpp", + "external/sources/boost/log/keywords/target.hpp", + "external/sources/boost/log/keywords/target_file_name.hpp", + "external/sources/boost/log/keywords/time_based_rotation.hpp", + "external/sources/boost/log/keywords/use_impl.hpp", + "external/sources/boost/log/sinks.hpp", + "external/sources/boost/log/sinks/async_frontend.hpp", + "external/sources/boost/log/sinks/attribute_mapping.hpp", + "external/sources/boost/log/sinks/auto_newline_mode.hpp", + "external/sources/boost/log/sinks/basic_sink_backend.hpp", + "external/sources/boost/log/sinks/basic_sink_frontend.hpp", + "external/sources/boost/log/sinks/block_on_overflow.hpp", + "external/sources/boost/log/sinks/bounded_fifo_queue.hpp", + "external/sources/boost/log/sinks/bounded_ordering_queue.hpp", + "external/sources/boost/log/sinks/debug_output_backend.hpp", + "external/sources/boost/log/sinks/drop_on_overflow.hpp", + "external/sources/boost/log/sinks/event_log_backend.hpp", + "external/sources/boost/log/sinks/event_log_constants.hpp", + "external/sources/boost/log/sinks/frontend_requirements.hpp", + "external/sources/boost/log/sinks/sink.hpp", + "external/sources/boost/log/sinks/sync_frontend.hpp", + "external/sources/boost/log/sinks/syslog_backend.hpp", + "external/sources/boost/log/sinks/syslog_constants.hpp", + "external/sources/boost/log/sinks/text_file_backend.hpp", + "external/sources/boost/log/sinks/text_ipc_message_queue_backend.hpp", + "external/sources/boost/log/sinks/text_multifile_backend.hpp", + "external/sources/boost/log/sinks/text_ostream_backend.hpp", + "external/sources/boost/log/sinks/unbounded_fifo_queue.hpp", + "external/sources/boost/log/sinks/unbounded_ordering_queue.hpp", + "external/sources/boost/log/sinks/unlocked_frontend.hpp", + "external/sources/boost/log/sources/basic_logger.hpp", + "external/sources/boost/log/sources/channel_feature.hpp", + "external/sources/boost/log/sources/channel_logger.hpp", + "external/sources/boost/log/sources/exception_handler_feature.hpp", + "external/sources/boost/log/sources/features.hpp", + "external/sources/boost/log/sources/global_logger_storage.hpp", + "external/sources/boost/log/sources/logger.hpp", + "external/sources/boost/log/sources/record_ostream.hpp", + "external/sources/boost/log/sources/severity_channel_logger.hpp", + "external/sources/boost/log/sources/severity_feature.hpp", + "external/sources/boost/log/sources/severity_logger.hpp", + "external/sources/boost/log/sources/threading_models.hpp", + "external/sources/boost/log/support/date_time.hpp", + "external/sources/boost/log/support/exception.hpp", + "external/sources/boost/log/support/regex.hpp", + "external/sources/boost/log/support/spirit_classic.hpp", + "external/sources/boost/log/support/spirit_qi.hpp", + "external/sources/boost/log/support/std_regex.hpp", + "external/sources/boost/log/support/xpressive.hpp", + "external/sources/boost/log/trivial.hpp", + "external/sources/boost/log/utility/exception_handler.hpp", + "external/sources/boost/log/utility/formatting_ostream.hpp", + "external/sources/boost/log/utility/formatting_ostream_fwd.hpp", + "external/sources/boost/log/utility/functional.hpp", + "external/sources/boost/log/utility/functional/as_action.hpp", + "external/sources/boost/log/utility/functional/begins_with.hpp", + "external/sources/boost/log/utility/functional/bind.hpp", + "external/sources/boost/log/utility/functional/bind_assign.hpp", + "external/sources/boost/log/utility/functional/bind_output.hpp", + "external/sources/boost/log/utility/functional/bind_to_log.hpp", + "external/sources/boost/log/utility/functional/contains.hpp", + "external/sources/boost/log/utility/functional/ends_with.hpp", + "external/sources/boost/log/utility/functional/fun_ref.hpp", + "external/sources/boost/log/utility/functional/in_range.hpp", + "external/sources/boost/log/utility/functional/logical.hpp", + "external/sources/boost/log/utility/functional/matches.hpp", + "external/sources/boost/log/utility/functional/nop.hpp", + "external/sources/boost/log/utility/functional/save_result.hpp", + "external/sources/boost/log/utility/ipc/object_name.hpp", + "external/sources/boost/log/utility/ipc/reliable_message_queue.hpp", + "external/sources/boost/log/utility/manipulators.hpp", + "external/sources/boost/log/utility/manipulators/add_value.hpp", + "external/sources/boost/log/utility/manipulators/auto_newline.hpp", + "external/sources/boost/log/utility/manipulators/dump.hpp", + "external/sources/boost/log/utility/manipulators/optional.hpp", + "external/sources/boost/log/utility/manipulators/range.hpp", + "external/sources/boost/log/utility/manipulators/to_log.hpp", + "external/sources/boost/log/utility/manipulators/tuple.hpp", + "external/sources/boost/log/utility/once_block.hpp", + "external/sources/boost/log/utility/open_mode.hpp", + "external/sources/boost/log/utility/permissions.hpp", + "external/sources/boost/log/utility/record_ordering.hpp", + "external/sources/boost/log/utility/setup.hpp", + "external/sources/boost/log/utility/setup/common_attributes.hpp", + "external/sources/boost/log/utility/setup/console.hpp", + "external/sources/boost/log/utility/setup/file.hpp", + "external/sources/boost/log/utility/setup/filter_parser.hpp", + "external/sources/boost/log/utility/setup/formatter_parser.hpp", + "external/sources/boost/log/utility/setup/from_settings.hpp", + "external/sources/boost/log/utility/setup/from_stream.hpp", + "external/sources/boost/log/utility/setup/settings.hpp", + "external/sources/boost/log/utility/setup/settings_parser.hpp", + "external/sources/boost/log/utility/strictest_lock.hpp", + "external/sources/boost/log/utility/string_literal.hpp", + "external/sources/boost/log/utility/string_literal_fwd.hpp", + "external/sources/boost/log/utility/type_dispatch/date_time_types.hpp", + "external/sources/boost/log/utility/type_dispatch/dynamic_type_dispatcher.hpp", + "external/sources/boost/log/utility/type_dispatch/standard_types.hpp", + "external/sources/boost/log/utility/type_dispatch/static_type_dispatcher.hpp", + "external/sources/boost/log/utility/type_dispatch/type_dispatcher.hpp", + "external/sources/boost/log/utility/unique_identifier_name.hpp", + "external/sources/boost/log/utility/unused_variable.hpp", + "external/sources/boost/log/utility/value_ref.hpp", + "external/sources/boost/log/utility/value_ref_fwd.hpp", + "external/sources/boost/logic/tribool.hpp", + "external/sources/boost/logic/tribool_fwd.hpp", + "external/sources/boost/logic/tribool_io.hpp", + "external/sources/boost/make_default.hpp", + "external/sources/boost/make_shared.hpp", + "external/sources/boost/make_unique.hpp", + "external/sources/boost/math/bindings/detail/big_digamma.hpp", + "external/sources/boost/math/bindings/detail/big_lanczos.hpp", + "external/sources/boost/math/bindings/e_float.hpp", + "external/sources/boost/math/bindings/mpfr.hpp", + "external/sources/boost/math/bindings/mpreal.hpp", + "external/sources/boost/math/bindings/rr.hpp", + "external/sources/boost/math/common_factor.hpp", + "external/sources/boost/math/common_factor_ct.hpp", + "external/sources/boost/math/common_factor_rt.hpp", + "external/sources/boost/math/complex.hpp", + "external/sources/boost/math/complex/acos.hpp", + "external/sources/boost/math/complex/acosh.hpp", + "external/sources/boost/math/complex/asin.hpp", + "external/sources/boost/math/complex/asinh.hpp", + "external/sources/boost/math/complex/atan.hpp", + "external/sources/boost/math/complex/atanh.hpp", + "external/sources/boost/math/complex/details.hpp", + "external/sources/boost/math/complex/fabs.hpp", + "external/sources/boost/math/concepts/distributions.hpp", + "external/sources/boost/math/concepts/real_concept.hpp", + "external/sources/boost/math/concepts/real_type_concept.hpp", + "external/sources/boost/math/concepts/std_real_concept.hpp", + "external/sources/boost/math/constants/calculate_constants.hpp", + "external/sources/boost/math/constants/constants.hpp", + "external/sources/boost/math/constants/info.hpp", + "external/sources/boost/math/cstdfloat/cstdfloat_cmath.hpp", + "external/sources/boost/math/cstdfloat/cstdfloat_complex.hpp", + "external/sources/boost/math/cstdfloat/cstdfloat_complex_std.hpp", + "external/sources/boost/math/cstdfloat/cstdfloat_iostream.hpp", + "external/sources/boost/math/cstdfloat/cstdfloat_limits.hpp", + "external/sources/boost/math/cstdfloat/cstdfloat_types.hpp", + "external/sources/boost/math/differentiation/autodiff.hpp", + "external/sources/boost/math/differentiation/autodiff_cpp11.hpp", + "external/sources/boost/math/differentiation/finite_difference.hpp", + "external/sources/boost/math/differentiation/lanczos_smoothing.hpp", + "external/sources/boost/math/distributions.hpp", + "external/sources/boost/math/distributions/arcsine.hpp", + "external/sources/boost/math/distributions/bernoulli.hpp", + "external/sources/boost/math/distributions/beta.hpp", + "external/sources/boost/math/distributions/binomial.hpp", + "external/sources/boost/math/distributions/cauchy.hpp", + "external/sources/boost/math/distributions/chi_squared.hpp", + "external/sources/boost/math/distributions/complement.hpp", + "external/sources/boost/math/distributions/detail/common_error_handling.hpp", + "external/sources/boost/math/distributions/detail/derived_accessors.hpp", + "external/sources/boost/math/distributions/detail/generic_mode.hpp", + "external/sources/boost/math/distributions/detail/generic_quantile.hpp", + "external/sources/boost/math/distributions/detail/hypergeometric_cdf.hpp", + "external/sources/boost/math/distributions/detail/hypergeometric_pdf.hpp", + "external/sources/boost/math/distributions/detail/hypergeometric_quantile.hpp", + "external/sources/boost/math/distributions/detail/inv_discrete_quantile.hpp", + "external/sources/boost/math/distributions/empirical_cumulative_distribution_function.hpp", + "external/sources/boost/math/distributions/exponential.hpp", + "external/sources/boost/math/distributions/extreme_value.hpp", + "external/sources/boost/math/distributions/find_location.hpp", + "external/sources/boost/math/distributions/find_scale.hpp", + "external/sources/boost/math/distributions/fisher_f.hpp", + "external/sources/boost/math/distributions/fwd.hpp", + "external/sources/boost/math/distributions/gamma.hpp", + "external/sources/boost/math/distributions/geometric.hpp", + "external/sources/boost/math/distributions/hyperexponential.hpp", + "external/sources/boost/math/distributions/hypergeometric.hpp", + "external/sources/boost/math/distributions/inverse_chi_squared.hpp", + "external/sources/boost/math/distributions/inverse_gamma.hpp", + "external/sources/boost/math/distributions/inverse_gaussian.hpp", + "external/sources/boost/math/distributions/laplace.hpp", + "external/sources/boost/math/distributions/logistic.hpp", + "external/sources/boost/math/distributions/lognormal.hpp", + "external/sources/boost/math/distributions/negative_binomial.hpp", + "external/sources/boost/math/distributions/non_central_beta.hpp", + "external/sources/boost/math/distributions/non_central_chi_squared.hpp", + "external/sources/boost/math/distributions/non_central_f.hpp", + "external/sources/boost/math/distributions/non_central_t.hpp", + "external/sources/boost/math/distributions/normal.hpp", + "external/sources/boost/math/distributions/pareto.hpp", + "external/sources/boost/math/distributions/poisson.hpp", + "external/sources/boost/math/distributions/rayleigh.hpp", + "external/sources/boost/math/distributions/skew_normal.hpp", + "external/sources/boost/math/distributions/students_t.hpp", + "external/sources/boost/math/distributions/triangular.hpp", + "external/sources/boost/math/distributions/uniform.hpp", + "external/sources/boost/math/distributions/weibull.hpp", + "external/sources/boost/math/filters/daubechies.hpp", + "external/sources/boost/math/interpolators/barycentric_rational.hpp", + "external/sources/boost/math/interpolators/cardinal_cubic_b_spline.hpp", + "external/sources/boost/math/interpolators/cardinal_quadratic_b_spline.hpp", + "external/sources/boost/math/interpolators/cardinal_quintic_b_spline.hpp", + "external/sources/boost/math/interpolators/cardinal_trigonometric.hpp", + "external/sources/boost/math/interpolators/catmull_rom.hpp", + "external/sources/boost/math/interpolators/cubic_b_spline.hpp", + "external/sources/boost/math/interpolators/cubic_hermite.hpp", + "external/sources/boost/math/interpolators/detail/barycentric_rational_detail.hpp", + "external/sources/boost/math/interpolators/detail/cardinal_cubic_b_spline_detail.hpp", + "external/sources/boost/math/interpolators/detail/cardinal_quadratic_b_spline_detail.hpp", + "external/sources/boost/math/interpolators/detail/cardinal_quintic_b_spline_detail.hpp", + "external/sources/boost/math/interpolators/detail/cardinal_trigonometric_detail.hpp", + "external/sources/boost/math/interpolators/detail/cubic_b_spline_detail.hpp", + "external/sources/boost/math/interpolators/detail/cubic_hermite_detail.hpp", + "external/sources/boost/math/interpolators/detail/quintic_hermite_detail.hpp", + "external/sources/boost/math/interpolators/detail/septic_hermite_detail.hpp", + "external/sources/boost/math/interpolators/detail/vector_barycentric_rational_detail.hpp", + "external/sources/boost/math/interpolators/detail/whittaker_shannon_detail.hpp", + "external/sources/boost/math/interpolators/makima.hpp", + "external/sources/boost/math/interpolators/pchip.hpp", + "external/sources/boost/math/interpolators/quintic_hermite.hpp", + "external/sources/boost/math/interpolators/septic_hermite.hpp", + "external/sources/boost/math/interpolators/vector_barycentric_rational.hpp", + "external/sources/boost/math/interpolators/whittaker_shannon.hpp", + "external/sources/boost/math/octonion.hpp", + "external/sources/boost/math/policies/error_handling.hpp", + "external/sources/boost/math/policies/policy.hpp", + "external/sources/boost/math/quadrature/detail/exp_sinh_detail.hpp", + "external/sources/boost/math/quadrature/detail/ooura_fourier_integrals_detail.hpp", + "external/sources/boost/math/quadrature/detail/sinh_sinh_detail.hpp", + "external/sources/boost/math/quadrature/detail/tanh_sinh_constants.hpp", + "external/sources/boost/math/quadrature/detail/tanh_sinh_detail.hpp", + "external/sources/boost/math/quadrature/exp_sinh.hpp", + "external/sources/boost/math/quadrature/gauss.hpp", + "external/sources/boost/math/quadrature/gauss_kronrod.hpp", + "external/sources/boost/math/quadrature/naive_monte_carlo.hpp", + "external/sources/boost/math/quadrature/ooura_fourier_integrals.hpp", + "external/sources/boost/math/quadrature/sinh_sinh.hpp", + "external/sources/boost/math/quadrature/tanh_sinh.hpp", + "external/sources/boost/math/quadrature/trapezoidal.hpp", + "external/sources/boost/math/quadrature/wavelet_transforms.hpp", + "external/sources/boost/math/quaternion.hpp", + "external/sources/boost/math/special_functions.hpp", + "external/sources/boost/math/special_functions/acosh.hpp", + "external/sources/boost/math/special_functions/airy.hpp", + "external/sources/boost/math/special_functions/asinh.hpp", + "external/sources/boost/math/special_functions/atanh.hpp", + "external/sources/boost/math/special_functions/bernoulli.hpp", + "external/sources/boost/math/special_functions/bessel.hpp", + "external/sources/boost/math/special_functions/bessel_iterators.hpp", + "external/sources/boost/math/special_functions/bessel_prime.hpp", + "external/sources/boost/math/special_functions/beta.hpp", + "external/sources/boost/math/special_functions/binomial.hpp", + "external/sources/boost/math/special_functions/cardinal_b_spline.hpp", + "external/sources/boost/math/special_functions/cbrt.hpp", + "external/sources/boost/math/special_functions/chebyshev.hpp", + "external/sources/boost/math/special_functions/chebyshev_transform.hpp", + "external/sources/boost/math/special_functions/cos_pi.hpp", + "external/sources/boost/math/special_functions/daubechies_scaling.hpp", + "external/sources/boost/math/special_functions/daubechies_wavelet.hpp", + "external/sources/boost/math/special_functions/detail/airy_ai_bi_zero.hpp", + "external/sources/boost/math/special_functions/detail/bernoulli_details.hpp", + "external/sources/boost/math/special_functions/detail/bessel_derivatives_linear.hpp", + "external/sources/boost/math/special_functions/detail/bessel_i0.hpp", + "external/sources/boost/math/special_functions/detail/bessel_i1.hpp", + "external/sources/boost/math/special_functions/detail/bessel_ik.hpp", + "external/sources/boost/math/special_functions/detail/bessel_j0.hpp", + "external/sources/boost/math/special_functions/detail/bessel_j1.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jn.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jy.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jy_asym.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jy_derivatives_asym.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jy_series.hpp", + "external/sources/boost/math/special_functions/detail/bessel_jy_zero.hpp", + "external/sources/boost/math/special_functions/detail/bessel_k0.hpp", + "external/sources/boost/math/special_functions/detail/bessel_k1.hpp", + "external/sources/boost/math/special_functions/detail/bessel_kn.hpp", + "external/sources/boost/math/special_functions/detail/bessel_y0.hpp", + "external/sources/boost/math/special_functions/detail/bessel_y1.hpp", + "external/sources/boost/math/special_functions/detail/bessel_yn.hpp", + "external/sources/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp", + "external/sources/boost/math/special_functions/detail/erf_inv.hpp", + "external/sources/boost/math/special_functions/detail/fp_traits.hpp", + "external/sources/boost/math/special_functions/detail/gamma_inva.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_0F1_bessel.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_addition_theorems_on_z.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_bessel.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_by_ratios.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_cf.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_large_a.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_large_abz.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_negative_b_regions.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_recurrence.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_scaled_series.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_1F1_small_a_negative_b_by_ratio.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_asym.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_cf.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_pFq_checked_series.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_pade.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_rational.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_separated_series.hpp", + "external/sources/boost/math/special_functions/detail/hypergeometric_series.hpp", + "external/sources/boost/math/special_functions/detail/ibeta_inv_ab.hpp", + "external/sources/boost/math/special_functions/detail/ibeta_inverse.hpp", + "external/sources/boost/math/special_functions/detail/iconv.hpp", + "external/sources/boost/math/special_functions/detail/igamma_inverse.hpp", + "external/sources/boost/math/special_functions/detail/igamma_large.hpp", + "external/sources/boost/math/special_functions/detail/lambert_w_lookup_table.ipp", + "external/sources/boost/math/special_functions/detail/lanczos_sse2.hpp", + "external/sources/boost/math/special_functions/detail/lgamma_small.hpp", + "external/sources/boost/math/special_functions/detail/polygamma.hpp", + "external/sources/boost/math/special_functions/detail/round_fwd.hpp", + "external/sources/boost/math/special_functions/detail/t_distribution_inv.hpp", + "external/sources/boost/math/special_functions/detail/unchecked_bernoulli.hpp", + "external/sources/boost/math/special_functions/detail/unchecked_factorial.hpp", + "external/sources/boost/math/special_functions/digamma.hpp", + "external/sources/boost/math/special_functions/ellint_1.hpp", + "external/sources/boost/math/special_functions/ellint_2.hpp", + "external/sources/boost/math/special_functions/ellint_3.hpp", + "external/sources/boost/math/special_functions/ellint_d.hpp", + "external/sources/boost/math/special_functions/ellint_rc.hpp", + "external/sources/boost/math/special_functions/ellint_rd.hpp", + "external/sources/boost/math/special_functions/ellint_rf.hpp", + "external/sources/boost/math/special_functions/ellint_rg.hpp", + "external/sources/boost/math/special_functions/ellint_rj.hpp", + "external/sources/boost/math/special_functions/erf.hpp", + "external/sources/boost/math/special_functions/expint.hpp", + "external/sources/boost/math/special_functions/expm1.hpp", + "external/sources/boost/math/special_functions/factorials.hpp", + "external/sources/boost/math/special_functions/fpclassify.hpp", + "external/sources/boost/math/special_functions/gamma.hpp", + "external/sources/boost/math/special_functions/gegenbauer.hpp", + "external/sources/boost/math/special_functions/hankel.hpp", + "external/sources/boost/math/special_functions/hermite.hpp", + "external/sources/boost/math/special_functions/heuman_lambda.hpp", + "external/sources/boost/math/special_functions/hypergeometric_0F1.hpp", + "external/sources/boost/math/special_functions/hypergeometric_1F0.hpp", + "external/sources/boost/math/special_functions/hypergeometric_1F1.hpp", + "external/sources/boost/math/special_functions/hypergeometric_2F0.hpp", + "external/sources/boost/math/special_functions/hypergeometric_pFq.hpp", + "external/sources/boost/math/special_functions/hypot.hpp", + "external/sources/boost/math/special_functions/jacobi.hpp", + "external/sources/boost/math/special_functions/jacobi_elliptic.hpp", + "external/sources/boost/math/special_functions/jacobi_zeta.hpp", + "external/sources/boost/math/special_functions/laguerre.hpp", + "external/sources/boost/math/special_functions/lambert_w.hpp", + "external/sources/boost/math/special_functions/lanczos.hpp", + "external/sources/boost/math/special_functions/legendre.hpp", + "external/sources/boost/math/special_functions/legendre_stieltjes.hpp", + "external/sources/boost/math/special_functions/log1p.hpp", + "external/sources/boost/math/special_functions/math_fwd.hpp", + "external/sources/boost/math/special_functions/modf.hpp", + "external/sources/boost/math/special_functions/next.hpp", + "external/sources/boost/math/special_functions/nonfinite_num_facets.hpp", + "external/sources/boost/math/special_functions/owens_t.hpp", + "external/sources/boost/math/special_functions/polygamma.hpp", + "external/sources/boost/math/special_functions/pow.hpp", + "external/sources/boost/math/special_functions/powm1.hpp", + "external/sources/boost/math/special_functions/prime.hpp", + "external/sources/boost/math/special_functions/relative_difference.hpp", + "external/sources/boost/math/special_functions/round.hpp", + "external/sources/boost/math/special_functions/sign.hpp", + "external/sources/boost/math/special_functions/sin_pi.hpp", + "external/sources/boost/math/special_functions/sinc.hpp", + "external/sources/boost/math/special_functions/sinhc.hpp", + "external/sources/boost/math/special_functions/spherical_harmonic.hpp", + "external/sources/boost/math/special_functions/sqrt1pm1.hpp", + "external/sources/boost/math/special_functions/trigamma.hpp", + "external/sources/boost/math/special_functions/trunc.hpp", + "external/sources/boost/math/special_functions/ulp.hpp", + "external/sources/boost/math/special_functions/zeta.hpp", + "external/sources/boost/math/statistics/anderson_darling.hpp", + "external/sources/boost/math/statistics/bivariate_statistics.hpp", + "external/sources/boost/math/statistics/linear_regression.hpp", + "external/sources/boost/math/statistics/ljung_box.hpp", + "external/sources/boost/math/statistics/runs_test.hpp", + "external/sources/boost/math/statistics/signal_statistics.hpp", + "external/sources/boost/math/statistics/t_test.hpp", + "external/sources/boost/math/statistics/univariate_statistics.hpp", + "external/sources/boost/math/tools/atomic.hpp", + "external/sources/boost/math/tools/big_constant.hpp", + "external/sources/boost/math/tools/bivariate_statistics.hpp", + "external/sources/boost/math/tools/complex.hpp", + "external/sources/boost/math/tools/condition_numbers.hpp", + "external/sources/boost/math/tools/config.hpp", + "external/sources/boost/math/tools/convert_from_string.hpp", + "external/sources/boost/math/tools/cxx03_warn.hpp", + "external/sources/boost/math/tools/detail/is_const_iterable.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_10.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_11.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_12.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_13.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_14.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_15.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_16.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_17.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_18.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_19.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_2.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_20.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_3.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_4.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_5.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_6.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_7.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_8.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner1_9.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_10.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_11.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_12.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_13.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_14.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_15.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_16.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_17.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_18.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_19.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_2.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_20.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_3.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_4.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_5.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_6.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_7.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_8.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner2_9.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_10.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_11.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_12.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_13.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_14.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_15.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_16.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_17.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_18.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_19.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_2.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_20.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_3.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_4.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_5.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_6.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_7.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_8.hpp", + "external/sources/boost/math/tools/detail/polynomial_horner3_9.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_10.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_11.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_12.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_13.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_14.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_15.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_16.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_17.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_18.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_19.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_2.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_20.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_3.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_4.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_5.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_6.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_7.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_8.hpp", + "external/sources/boost/math/tools/detail/rational_horner1_9.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_10.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_11.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_12.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_13.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_14.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_15.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_16.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_17.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_18.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_19.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_2.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_20.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_3.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_4.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_5.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_6.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_7.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_8.hpp", + "external/sources/boost/math/tools/detail/rational_horner2_9.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_10.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_11.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_12.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_13.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_14.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_15.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_16.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_17.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_18.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_19.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_2.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_20.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_3.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_4.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_5.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_6.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_7.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_8.hpp", + "external/sources/boost/math/tools/detail/rational_horner3_9.hpp", + "external/sources/boost/math/tools/fraction.hpp", + "external/sources/boost/math/tools/minima.hpp", + "external/sources/boost/math/tools/norms.hpp", + "external/sources/boost/math/tools/numerical_differentiation.hpp", + "external/sources/boost/math/tools/polynomial.hpp", + "external/sources/boost/math/tools/polynomial_gcd.hpp", + "external/sources/boost/math/tools/precision.hpp", + "external/sources/boost/math/tools/promotion.hpp", + "external/sources/boost/math/tools/rational.hpp", + "external/sources/boost/math/tools/real_cast.hpp", + "external/sources/boost/math/tools/recurrence.hpp", + "external/sources/boost/math/tools/roots.hpp", + "external/sources/boost/math/tools/series.hpp", + "external/sources/boost/math/tools/signal_statistics.hpp", + "external/sources/boost/math/tools/stats.hpp", + "external/sources/boost/math/tools/test_value.hpp", + "external/sources/boost/math/tools/toms748_solve.hpp", + "external/sources/boost/math/tools/traits.hpp", + "external/sources/boost/math/tools/tuple.hpp", + "external/sources/boost/math/tools/univariate_statistics.hpp", + "external/sources/boost/math/tools/user.hpp", + "external/sources/boost/math/tools/workaround.hpp", + "external/sources/boost/math/tr1.hpp", + "external/sources/boost/math/tr1_c_macros.ipp", + "external/sources/boost/math_fwd.hpp", + "external/sources/boost/mem_fn.hpp", + "external/sources/boost/memory_order.hpp", + "external/sources/boost/metaparse.hpp", + "external/sources/boost/metaparse/accept.hpp", + "external/sources/boost/metaparse/accept_tag.hpp", + "external/sources/boost/metaparse/accept_when.hpp", + "external/sources/boost/metaparse/alphanum.hpp", + "external/sources/boost/metaparse/always.hpp", + "external/sources/boost/metaparse/always_c.hpp", + "external/sources/boost/metaparse/change_error_message.hpp", + "external/sources/boost/metaparse/config.hpp", + "external/sources/boost/metaparse/debug_parsing_error.hpp", + "external/sources/boost/metaparse/define_error.hpp", + "external/sources/boost/metaparse/digit.hpp", + "external/sources/boost/metaparse/digit_val.hpp", + "external/sources/boost/metaparse/empty.hpp", + "external/sources/boost/metaparse/entire_input.hpp", + "external/sources/boost/metaparse/error/digit_expected.hpp", + "external/sources/boost/metaparse/error/end_of_input_expected.hpp", + "external/sources/boost/metaparse/error/index_out_of_range.hpp", + "external/sources/boost/metaparse/error/letter_expected.hpp", + "external/sources/boost/metaparse/error/literal_expected.hpp", + "external/sources/boost/metaparse/error/none_of_the_expected_cases_found.hpp", + "external/sources/boost/metaparse/error/unexpected_character.hpp", + "external/sources/boost/metaparse/error/unexpected_end_of_input.hpp", + "external/sources/boost/metaparse/error/unpaired.hpp", + "external/sources/boost/metaparse/error/whitespace_expected.hpp", + "external/sources/boost/metaparse/except.hpp", + "external/sources/boost/metaparse/fail.hpp", + "external/sources/boost/metaparse/fail_at_first_char_expected.hpp", + "external/sources/boost/metaparse/fail_tag.hpp", + "external/sources/boost/metaparse/first_of.hpp", + "external/sources/boost/metaparse/foldl.hpp", + "external/sources/boost/metaparse/foldl1.hpp", + "external/sources/boost/metaparse/foldl_reject_incomplete.hpp", + "external/sources/boost/metaparse/foldl_reject_incomplete1.hpp", + "external/sources/boost/metaparse/foldl_reject_incomplete_start_with_parser.hpp", + "external/sources/boost/metaparse/foldl_start_with_parser.hpp", + "external/sources/boost/metaparse/foldr.hpp", + "external/sources/boost/metaparse/foldr1.hpp", + "external/sources/boost/metaparse/foldr_reject_incomplete.hpp", + "external/sources/boost/metaparse/foldr_reject_incomplete1.hpp", + "external/sources/boost/metaparse/foldr_start_with_parser.hpp", + "external/sources/boost/metaparse/get_col.hpp", + "external/sources/boost/metaparse/get_line.hpp", + "external/sources/boost/metaparse/get_message.hpp", + "external/sources/boost/metaparse/get_position.hpp", + "external/sources/boost/metaparse/get_prev_char.hpp", + "external/sources/boost/metaparse/get_remaining.hpp", + "external/sources/boost/metaparse/get_result.hpp", + "external/sources/boost/metaparse/grammar.hpp", + "external/sources/boost/metaparse/if_.hpp", + "external/sources/boost/metaparse/int_.hpp", + "external/sources/boost/metaparse/is_error.hpp", + "external/sources/boost/metaparse/iterate.hpp", + "external/sources/boost/metaparse/iterate_c.hpp", + "external/sources/boost/metaparse/keyword.hpp", + "external/sources/boost/metaparse/last_of.hpp", + "external/sources/boost/metaparse/letter.hpp", + "external/sources/boost/metaparse/limit_one_char_except_size.hpp", + "external/sources/boost/metaparse/limit_one_of_size.hpp", + "external/sources/boost/metaparse/limit_sequence_size.hpp", + "external/sources/boost/metaparse/limit_string_size.hpp", + "external/sources/boost/metaparse/lit.hpp", + "external/sources/boost/metaparse/lit_c.hpp", + "external/sources/boost/metaparse/look_ahead.hpp", + "external/sources/boost/metaparse/middle_of.hpp", + "external/sources/boost/metaparse/next_char.hpp", + "external/sources/boost/metaparse/next_line.hpp", + "external/sources/boost/metaparse/nth_of.hpp", + "external/sources/boost/metaparse/nth_of_c.hpp", + "external/sources/boost/metaparse/one_char.hpp", + "external/sources/boost/metaparse/one_char_except.hpp", + "external/sources/boost/metaparse/one_char_except_c.hpp", + "external/sources/boost/metaparse/one_of.hpp", + "external/sources/boost/metaparse/one_of_c.hpp", + "external/sources/boost/metaparse/optional.hpp", + "external/sources/boost/metaparse/range.hpp", + "external/sources/boost/metaparse/range_c.hpp", + "external/sources/boost/metaparse/reject.hpp", + "external/sources/boost/metaparse/repeated.hpp", + "external/sources/boost/metaparse/repeated1.hpp", + "external/sources/boost/metaparse/repeated_one_of.hpp", + "external/sources/boost/metaparse/repeated_one_of1.hpp", + "external/sources/boost/metaparse/repeated_reject_incomplete.hpp", + "external/sources/boost/metaparse/repeated_reject_incomplete1.hpp", + "external/sources/boost/metaparse/return_.hpp", + "external/sources/boost/metaparse/sequence.hpp", + "external/sources/boost/metaparse/sequence_apply.hpp", + "external/sources/boost/metaparse/source_position.hpp", + "external/sources/boost/metaparse/source_position_tag.hpp", + "external/sources/boost/metaparse/space.hpp", + "external/sources/boost/metaparse/spaces.hpp", + "external/sources/boost/metaparse/start.hpp", + "external/sources/boost/metaparse/string.hpp", + "external/sources/boost/metaparse/string_tag.hpp", + "external/sources/boost/metaparse/token.hpp", + "external/sources/boost/metaparse/transform.hpp", + "external/sources/boost/metaparse/transform_error.hpp", + "external/sources/boost/metaparse/transform_error_message.hpp", + "external/sources/boost/metaparse/unless_error.hpp", + "external/sources/boost/metaparse/util/digit_to_int.hpp", + "external/sources/boost/metaparse/util/digit_to_int_c.hpp", + "external/sources/boost/metaparse/util/in_range.hpp", + "external/sources/boost/metaparse/util/in_range_c.hpp", + "external/sources/boost/metaparse/util/int_to_digit.hpp", + "external/sources/boost/metaparse/util/int_to_digit_c.hpp", + "external/sources/boost/metaparse/util/is_digit.hpp", + "external/sources/boost/metaparse/util/is_lcase_letter.hpp", + "external/sources/boost/metaparse/util/is_letter.hpp", + "external/sources/boost/metaparse/util/is_ucase_letter.hpp", + "external/sources/boost/metaparse/util/is_whitespace.hpp", + "external/sources/boost/metaparse/util/is_whitespace_c.hpp", + "external/sources/boost/metaparse/v1/accept.hpp", + "external/sources/boost/metaparse/v1/accept_tag.hpp", + "external/sources/boost/metaparse/v1/accept_when.hpp", + "external/sources/boost/metaparse/v1/alphanum.hpp", + "external/sources/boost/metaparse/v1/always.hpp", + "external/sources/boost/metaparse/v1/always_c.hpp", + "external/sources/boost/metaparse/v1/change_error_message.hpp", + "external/sources/boost/metaparse/v1/cpp11/first_of.hpp", + "external/sources/boost/metaparse/v1/cpp11/fwd/string.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/any_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/at_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/concat.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/empty_string.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/eval_later_result.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/is_none_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/is_none_c_impl.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/nth_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/nth_of_c_skip_remaining.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/or_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/pop_back.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/pop_front.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/push_back_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/push_front_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/push_front_result.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/size.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/string.hpp", + "external/sources/boost/metaparse/v1/cpp11/impl/string_at.hpp", + "external/sources/boost/metaparse/v1/cpp11/last_of.hpp", + "external/sources/boost/metaparse/v1/cpp11/nth_of.hpp", + "external/sources/boost/metaparse/v1/cpp11/nth_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/one_char_except.hpp", + "external/sources/boost/metaparse/v1/cpp11/one_char_except_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/one_of.hpp", + "external/sources/boost/metaparse/v1/cpp11/one_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp11/repeated_one_of.hpp", + "external/sources/boost/metaparse/v1/cpp11/repeated_one_of1.hpp", + "external/sources/boost/metaparse/v1/cpp11/sequence.hpp", + "external/sources/boost/metaparse/v1/cpp11/string.hpp", + "external/sources/boost/metaparse/v1/cpp14/impl/any_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp14/one_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/first_of.hpp", + "external/sources/boost/metaparse/v1/cpp98/fwd/string.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/at_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/empty_string.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/is_none.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/later_result.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/nth_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/nth_of_c_impl.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/one_char_except_not_used.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/one_of.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/one_of_fwd_op.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/pop_back.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/pop_front.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/push_back_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/push_front_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/sequence.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/sequence_impl.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/size.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/skip_seq.hpp", + "external/sources/boost/metaparse/v1/cpp98/impl/update_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/last_of.hpp", + "external/sources/boost/metaparse/v1/cpp98/nth_of.hpp", + "external/sources/boost/metaparse/v1/cpp98/nth_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/one_char_except.hpp", + "external/sources/boost/metaparse/v1/cpp98/one_char_except_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/one_of.hpp", + "external/sources/boost/metaparse/v1/cpp98/one_of_c.hpp", + "external/sources/boost/metaparse/v1/cpp98/repeated_one_of.hpp", + "external/sources/boost/metaparse/v1/cpp98/repeated_one_of1.hpp", + "external/sources/boost/metaparse/v1/cpp98/sequence.hpp", + "external/sources/boost/metaparse/v1/cpp98/string.hpp", + "external/sources/boost/metaparse/v1/debug_parsing_error.hpp", + "external/sources/boost/metaparse/v1/define_error.hpp", + "external/sources/boost/metaparse/v1/digit.hpp", + "external/sources/boost/metaparse/v1/digit_val.hpp", + "external/sources/boost/metaparse/v1/empty.hpp", + "external/sources/boost/metaparse/v1/entire_input.hpp", + "external/sources/boost/metaparse/v1/error/digit_expected.hpp", + "external/sources/boost/metaparse/v1/error/end_of_input_expected.hpp", + "external/sources/boost/metaparse/v1/error/expected_to_fail.hpp", + "external/sources/boost/metaparse/v1/error/index_out_of_range.hpp", + "external/sources/boost/metaparse/v1/error/letter_expected.hpp", + "external/sources/boost/metaparse/v1/error/literal_expected.hpp", + "external/sources/boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp", + "external/sources/boost/metaparse/v1/error/unexpected_character.hpp", + "external/sources/boost/metaparse/v1/error/unexpected_end_of_input.hpp", + "external/sources/boost/metaparse/v1/error/unpaired.hpp", + "external/sources/boost/metaparse/v1/error/whitespace_expected.hpp", + "external/sources/boost/metaparse/v1/except.hpp", + "external/sources/boost/metaparse/v1/fail.hpp", + "external/sources/boost/metaparse/v1/fail_at_first_char_expected.hpp", + "external/sources/boost/metaparse/v1/fail_tag.hpp", + "external/sources/boost/metaparse/v1/first_of.hpp", + "external/sources/boost/metaparse/v1/foldl.hpp", + "external/sources/boost/metaparse/v1/foldl1.hpp", + "external/sources/boost/metaparse/v1/foldl_reject_incomplete.hpp", + "external/sources/boost/metaparse/v1/foldl_reject_incomplete1.hpp", + "external/sources/boost/metaparse/v1/foldl_reject_incomplete_start_with_parser.hpp", + "external/sources/boost/metaparse/v1/foldl_start_with_parser.hpp", + "external/sources/boost/metaparse/v1/foldr.hpp", + "external/sources/boost/metaparse/v1/foldr1.hpp", + "external/sources/boost/metaparse/v1/foldr_reject_incomplete.hpp", + "external/sources/boost/metaparse/v1/foldr_reject_incomplete1.hpp", + "external/sources/boost/metaparse/v1/foldr_start_with_parser.hpp", + "external/sources/boost/metaparse/v1/fwd/accept.hpp", + "external/sources/boost/metaparse/v1/fwd/get_col.hpp", + "external/sources/boost/metaparse/v1/fwd/get_line.hpp", + "external/sources/boost/metaparse/v1/fwd/get_message.hpp", + "external/sources/boost/metaparse/v1/fwd/get_position.hpp", + "external/sources/boost/metaparse/v1/fwd/get_prev_char.hpp", + "external/sources/boost/metaparse/v1/fwd/get_remaining.hpp", + "external/sources/boost/metaparse/v1/fwd/get_result.hpp", + "external/sources/boost/metaparse/v1/fwd/next_char.hpp", + "external/sources/boost/metaparse/v1/fwd/next_line.hpp", + "external/sources/boost/metaparse/v1/fwd/reject.hpp", + "external/sources/boost/metaparse/v1/fwd/source_position.hpp", + "external/sources/boost/metaparse/v1/fwd/string.hpp", + "external/sources/boost/metaparse/v1/get_col.hpp", + "external/sources/boost/metaparse/v1/get_line.hpp", + "external/sources/boost/metaparse/v1/get_message.hpp", + "external/sources/boost/metaparse/v1/get_position.hpp", + "external/sources/boost/metaparse/v1/get_prev_char.hpp", + "external/sources/boost/metaparse/v1/get_remaining.hpp", + "external/sources/boost/metaparse/v1/get_result.hpp", + "external/sources/boost/metaparse/v1/grammar.hpp", + "external/sources/boost/metaparse/v1/if_.hpp", + "external/sources/boost/metaparse/v1/impl/apply_parser.hpp", + "external/sources/boost/metaparse/v1/impl/assert_string_length.hpp", + "external/sources/boost/metaparse/v1/impl/at_c.hpp", + "external/sources/boost/metaparse/v1/impl/back_inserter.hpp", + "external/sources/boost/metaparse/v1/impl/front_inserter.hpp", + "external/sources/boost/metaparse/v1/impl/fwd/iterate_impl.hpp", + "external/sources/boost/metaparse/v1/impl/has_type.hpp", + "external/sources/boost/metaparse/v1/impl/is_char_c.hpp", + "external/sources/boost/metaparse/v1/impl/iterate_impl.hpp", + "external/sources/boost/metaparse/v1/impl/iterate_impl_unchecked.hpp", + "external/sources/boost/metaparse/v1/impl/next_digit.hpp", + "external/sources/boost/metaparse/v1/impl/no_char.hpp", + "external/sources/boost/metaparse/v1/impl/returns.hpp", + "external/sources/boost/metaparse/v1/impl/string_iterator.hpp", + "external/sources/boost/metaparse/v1/impl/string_iterator_tag.hpp", + "external/sources/boost/metaparse/v1/impl/void_.hpp", + "external/sources/boost/metaparse/v1/int_.hpp", + "external/sources/boost/metaparse/v1/is_error.hpp", + "external/sources/boost/metaparse/v1/iterate.hpp", + "external/sources/boost/metaparse/v1/iterate_c.hpp", + "external/sources/boost/metaparse/v1/keyword.hpp", + "external/sources/boost/metaparse/v1/last_of.hpp", + "external/sources/boost/metaparse/v1/letter.hpp", + "external/sources/boost/metaparse/v1/lit.hpp", + "external/sources/boost/metaparse/v1/lit_c.hpp", + "external/sources/boost/metaparse/v1/look_ahead.hpp", + "external/sources/boost/metaparse/v1/middle_of.hpp", + "external/sources/boost/metaparse/v1/next_char.hpp", + "external/sources/boost/metaparse/v1/next_line.hpp", + "external/sources/boost/metaparse/v1/nth_of.hpp", + "external/sources/boost/metaparse/v1/nth_of_c.hpp", + "external/sources/boost/metaparse/v1/one_char.hpp", + "external/sources/boost/metaparse/v1/one_char_except.hpp", + "external/sources/boost/metaparse/v1/one_char_except_c.hpp", + "external/sources/boost/metaparse/v1/one_of.hpp", + "external/sources/boost/metaparse/v1/one_of_c.hpp", + "external/sources/boost/metaparse/v1/optional.hpp", + "external/sources/boost/metaparse/v1/range.hpp", + "external/sources/boost/metaparse/v1/range_c.hpp", + "external/sources/boost/metaparse/v1/reject.hpp", + "external/sources/boost/metaparse/v1/repeated.hpp", + "external/sources/boost/metaparse/v1/repeated1.hpp", + "external/sources/boost/metaparse/v1/repeated_one_of.hpp", + "external/sources/boost/metaparse/v1/repeated_one_of1.hpp", + "external/sources/boost/metaparse/v1/repeated_reject_incomplete.hpp", + "external/sources/boost/metaparse/v1/repeated_reject_incomplete1.hpp", + "external/sources/boost/metaparse/v1/return_.hpp", + "external/sources/boost/metaparse/v1/sequence.hpp", + "external/sources/boost/metaparse/v1/sequence_apply.hpp", + "external/sources/boost/metaparse/v1/source_position.hpp", + "external/sources/boost/metaparse/v1/source_position_tag.hpp", + "external/sources/boost/metaparse/v1/space.hpp", + "external/sources/boost/metaparse/v1/spaces.hpp", + "external/sources/boost/metaparse/v1/start.hpp", + "external/sources/boost/metaparse/v1/string.hpp", + "external/sources/boost/metaparse/v1/string_tag.hpp", + "external/sources/boost/metaparse/v1/swap.hpp", + "external/sources/boost/metaparse/v1/token.hpp", + "external/sources/boost/metaparse/v1/transform.hpp", + "external/sources/boost/metaparse/v1/transform_error.hpp", + "external/sources/boost/metaparse/v1/transform_error_message.hpp", + "external/sources/boost/metaparse/v1/unless_error.hpp", + "external/sources/boost/metaparse/v1/util/digit_to_int.hpp", + "external/sources/boost/metaparse/v1/util/digit_to_int_c.hpp", + "external/sources/boost/metaparse/v1/util/in_range.hpp", + "external/sources/boost/metaparse/v1/util/in_range_c.hpp", + "external/sources/boost/metaparse/v1/util/int_to_digit.hpp", + "external/sources/boost/metaparse/v1/util/int_to_digit_c.hpp", + "external/sources/boost/metaparse/v1/util/is_digit.hpp", + "external/sources/boost/metaparse/v1/util/is_lcase_letter.hpp", + "external/sources/boost/metaparse/v1/util/is_letter.hpp", + "external/sources/boost/metaparse/v1/util/is_ucase_letter.hpp", + "external/sources/boost/metaparse/v1/util/is_whitespace.hpp", + "external/sources/boost/metaparse/v1/util/is_whitespace_c.hpp", + "external/sources/boost/metaparse/version.hpp", + "external/sources/boost/move/adl_move_swap.hpp", + "external/sources/boost/move/algo/adaptive_merge.hpp", + "external/sources/boost/move/algo/adaptive_sort.hpp", + "external/sources/boost/move/algo/detail/adaptive_sort_merge.hpp", + "external/sources/boost/move/algo/detail/basic_op.hpp", + "external/sources/boost/move/algo/detail/heap_sort.hpp", + "external/sources/boost/move/algo/detail/insertion_sort.hpp", + "external/sources/boost/move/algo/detail/is_sorted.hpp", + "external/sources/boost/move/algo/detail/merge.hpp", + "external/sources/boost/move/algo/detail/merge_sort.hpp", + "external/sources/boost/move/algo/detail/pdqsort.hpp", + "external/sources/boost/move/algo/detail/set_difference.hpp", + "external/sources/boost/move/algo/move.hpp", + "external/sources/boost/move/algo/predicate.hpp", + "external/sources/boost/move/algo/unique.hpp", + "external/sources/boost/move/algorithm.hpp", + "external/sources/boost/move/core.hpp", + "external/sources/boost/move/default_delete.hpp", + "external/sources/boost/move/detail/config_begin.hpp", + "external/sources/boost/move/detail/config_end.hpp", + "external/sources/boost/move/detail/destruct_n.hpp", + "external/sources/boost/move/detail/fwd_macros.hpp", + "external/sources/boost/move/detail/iterator_to_raw_pointer.hpp", + "external/sources/boost/move/detail/iterator_traits.hpp", + "external/sources/boost/move/detail/meta_utils.hpp", + "external/sources/boost/move/detail/meta_utils_core.hpp", + "external/sources/boost/move/detail/move_helpers.hpp", + "external/sources/boost/move/detail/placement_new.hpp", + "external/sources/boost/move/detail/pointer_element.hpp", + "external/sources/boost/move/detail/reverse_iterator.hpp", + "external/sources/boost/move/detail/std_ns_begin.hpp", + "external/sources/boost/move/detail/std_ns_end.hpp", + "external/sources/boost/move/detail/to_raw_pointer.hpp", + "external/sources/boost/move/detail/type_traits.hpp", + "external/sources/boost/move/detail/unique_ptr_meta_utils.hpp", + "external/sources/boost/move/detail/workaround.hpp", + "external/sources/boost/move/iterator.hpp", + "external/sources/boost/move/make_unique.hpp", + "external/sources/boost/move/move.hpp", + "external/sources/boost/move/traits.hpp", + "external/sources/boost/move/unique_ptr.hpp", + "external/sources/boost/move/utility.hpp", + "external/sources/boost/move/utility_core.hpp", + "external/sources/boost/mp11.hpp", + "external/sources/boost/mp11/algorithm.hpp", + "external/sources/boost/mp11/bind.hpp", + "external/sources/boost/mp11/detail/config.hpp", + "external/sources/boost/mp11/detail/mp_append.hpp", + "external/sources/boost/mp11/detail/mp_copy_if.hpp", + "external/sources/boost/mp11/detail/mp_count.hpp", + "external/sources/boost/mp11/detail/mp_fold.hpp", + "external/sources/boost/mp11/detail/mp_is_list.hpp", + "external/sources/boost/mp11/detail/mp_list.hpp", + "external/sources/boost/mp11/detail/mp_map_find.hpp", + "external/sources/boost/mp11/detail/mp_min_element.hpp", + "external/sources/boost/mp11/detail/mp_plus.hpp", + "external/sources/boost/mp11/detail/mp_remove_if.hpp", + "external/sources/boost/mp11/detail/mp_void.hpp", + "external/sources/boost/mp11/detail/mp_with_index.hpp", + "external/sources/boost/mp11/detail/mpl_common.hpp", + "external/sources/boost/mp11/function.hpp", + "external/sources/boost/mp11/integer_sequence.hpp", + "external/sources/boost/mp11/integral.hpp", + "external/sources/boost/mp11/list.hpp", + "external/sources/boost/mp11/map.hpp", + "external/sources/boost/mp11/mpl.hpp", + "external/sources/boost/mp11/mpl_list.hpp", + "external/sources/boost/mp11/mpl_tuple.hpp", + "external/sources/boost/mp11/set.hpp", + "external/sources/boost/mp11/tuple.hpp", + "external/sources/boost/mp11/utility.hpp", + "external/sources/boost/mp11/version.hpp", + "external/sources/boost/mpi.hpp", + "external/sources/boost/mpi/allocator.hpp", + "external/sources/boost/mpi/cartesian_communicator.hpp", + "external/sources/boost/mpi/collectives.hpp", + "external/sources/boost/mpi/collectives/all_gather.hpp", + "external/sources/boost/mpi/collectives/all_gatherv.hpp", + "external/sources/boost/mpi/collectives/all_reduce.hpp", + "external/sources/boost/mpi/collectives/all_to_all.hpp", + "external/sources/boost/mpi/collectives/broadcast.hpp", + "external/sources/boost/mpi/collectives/gather.hpp", + "external/sources/boost/mpi/collectives/gatherv.hpp", + "external/sources/boost/mpi/collectives/reduce.hpp", + "external/sources/boost/mpi/collectives/scan.hpp", + "external/sources/boost/mpi/collectives/scatter.hpp", + "external/sources/boost/mpi/collectives/scatterv.hpp", + "external/sources/boost/mpi/collectives_fwd.hpp", + "external/sources/boost/mpi/communicator.hpp", + "external/sources/boost/mpi/config.hpp", + "external/sources/boost/mpi/datatype.hpp", + "external/sources/boost/mpi/datatype_fwd.hpp", + "external/sources/boost/mpi/detail/antiques.hpp", + "external/sources/boost/mpi/detail/binary_buffer_iprimitive.hpp", + "external/sources/boost/mpi/detail/binary_buffer_oprimitive.hpp", + "external/sources/boost/mpi/detail/broadcast_sc.hpp", + "external/sources/boost/mpi/detail/communicator_sc.hpp", + "external/sources/boost/mpi/detail/computation_tree.hpp", + "external/sources/boost/mpi/detail/content_oarchive.hpp", + "external/sources/boost/mpi/detail/forward_iprimitive.hpp", + "external/sources/boost/mpi/detail/forward_oprimitive.hpp", + "external/sources/boost/mpi/detail/forward_skeleton_iarchive.hpp", + "external/sources/boost/mpi/detail/forward_skeleton_oarchive.hpp", + "external/sources/boost/mpi/detail/ignore_iprimitive.hpp", + "external/sources/boost/mpi/detail/ignore_oprimitive.hpp", + "external/sources/boost/mpi/detail/ignore_skeleton_oarchive.hpp", + "external/sources/boost/mpi/detail/mpi_datatype_cache.hpp", + "external/sources/boost/mpi/detail/mpi_datatype_oarchive.hpp", + "external/sources/boost/mpi/detail/mpi_datatype_primitive.hpp", + "external/sources/boost/mpi/detail/offsets.hpp", + "external/sources/boost/mpi/detail/packed_iprimitive.hpp", + "external/sources/boost/mpi/detail/packed_oprimitive.hpp", + "external/sources/boost/mpi/detail/point_to_point.hpp", + "external/sources/boost/mpi/detail/request_handlers.hpp", + "external/sources/boost/mpi/detail/text_skeleton_oarchive.hpp", + "external/sources/boost/mpi/environment.hpp", + "external/sources/boost/mpi/error_string.hpp", + "external/sources/boost/mpi/exception.hpp", + "external/sources/boost/mpi/graph_communicator.hpp", + "external/sources/boost/mpi/group.hpp", + "external/sources/boost/mpi/inplace.hpp", + "external/sources/boost/mpi/intercommunicator.hpp", + "external/sources/boost/mpi/nonblocking.hpp", + "external/sources/boost/mpi/operations.hpp", + "external/sources/boost/mpi/packed_iarchive.hpp", + "external/sources/boost/mpi/packed_oarchive.hpp", + "external/sources/boost/mpi/python.hpp", + "external/sources/boost/mpi/python/config.hpp", + "external/sources/boost/mpi/python/serialize.hpp", + "external/sources/boost/mpi/python/skeleton_and_content.hpp", + "external/sources/boost/mpi/request.hpp", + "external/sources/boost/mpi/skeleton_and_content.hpp", + "external/sources/boost/mpi/skeleton_and_content_fwd.hpp", + "external/sources/boost/mpi/skeleton_and_content_types.hpp", + "external/sources/boost/mpi/status.hpp", + "external/sources/boost/mpi/timer.hpp", + "external/sources/boost/mpl/O1_size.hpp", + "external/sources/boost/mpl/O1_size_fwd.hpp", + "external/sources/boost/mpl/accumulate.hpp", + "external/sources/boost/mpl/advance.hpp", + "external/sources/boost/mpl/advance_fwd.hpp", + "external/sources/boost/mpl/alias.hpp", + "external/sources/boost/mpl/always.hpp", + "external/sources/boost/mpl/and.hpp", + "external/sources/boost/mpl/apply.hpp", + "external/sources/boost/mpl/apply_fwd.hpp", + "external/sources/boost/mpl/apply_wrap.hpp", + "external/sources/boost/mpl/arg.hpp", + "external/sources/boost/mpl/arg_fwd.hpp", + "external/sources/boost/mpl/arithmetic.hpp", + "external/sources/boost/mpl/as_sequence.hpp", + "external/sources/boost/mpl/assert.hpp", + "external/sources/boost/mpl/at.hpp", + "external/sources/boost/mpl/at_fwd.hpp", + "external/sources/boost/mpl/aux_/O1_size_impl.hpp", + "external/sources/boost/mpl/aux_/adl_barrier.hpp", + "external/sources/boost/mpl/aux_/advance_backward.hpp", + "external/sources/boost/mpl/aux_/advance_forward.hpp", + "external/sources/boost/mpl/aux_/apply_1st.hpp", + "external/sources/boost/mpl/aux_/arg_typedef.hpp", + "external/sources/boost/mpl/aux_/arithmetic_op.hpp", + "external/sources/boost/mpl/aux_/arity.hpp", + "external/sources/boost/mpl/aux_/arity_spec.hpp", + "external/sources/boost/mpl/aux_/at_impl.hpp", + "external/sources/boost/mpl/aux_/back_impl.hpp", + "external/sources/boost/mpl/aux_/basic_bind.hpp", + "external/sources/boost/mpl/aux_/begin_end_impl.hpp", + "external/sources/boost/mpl/aux_/clear_impl.hpp", + "external/sources/boost/mpl/aux_/common_name_wknd.hpp", + "external/sources/boost/mpl/aux_/comparison_op.hpp", + "external/sources/boost/mpl/aux_/config/adl.hpp", + "external/sources/boost/mpl/aux_/config/arrays.hpp", + "external/sources/boost/mpl/aux_/config/bcc.hpp", + "external/sources/boost/mpl/aux_/config/bind.hpp", + "external/sources/boost/mpl/aux_/config/compiler.hpp", + "external/sources/boost/mpl/aux_/config/ctps.hpp", + "external/sources/boost/mpl/aux_/config/dependent_nttp.hpp", + "external/sources/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp", + "external/sources/boost/mpl/aux_/config/dtp.hpp", + "external/sources/boost/mpl/aux_/config/eti.hpp", + "external/sources/boost/mpl/aux_/config/forwarding.hpp", + "external/sources/boost/mpl/aux_/config/gcc.hpp", + "external/sources/boost/mpl/aux_/config/gpu.hpp", + "external/sources/boost/mpl/aux_/config/has_apply.hpp", + "external/sources/boost/mpl/aux_/config/has_xxx.hpp", + "external/sources/boost/mpl/aux_/config/integral.hpp", + "external/sources/boost/mpl/aux_/config/intel.hpp", + "external/sources/boost/mpl/aux_/config/lambda.hpp", + "external/sources/boost/mpl/aux_/config/msvc.hpp", + "external/sources/boost/mpl/aux_/config/msvc_typename.hpp", + "external/sources/boost/mpl/aux_/config/nttp.hpp", + "external/sources/boost/mpl/aux_/config/operators.hpp", + "external/sources/boost/mpl/aux_/config/overload_resolution.hpp", + "external/sources/boost/mpl/aux_/config/pp_counter.hpp", + "external/sources/boost/mpl/aux_/config/preprocessor.hpp", + "external/sources/boost/mpl/aux_/config/static_constant.hpp", + "external/sources/boost/mpl/aux_/config/ttp.hpp", + "external/sources/boost/mpl/aux_/config/typeof.hpp", + "external/sources/boost/mpl/aux_/config/use_preprocessed.hpp", + "external/sources/boost/mpl/aux_/config/workaround.hpp", + "external/sources/boost/mpl/aux_/contains_impl.hpp", + "external/sources/boost/mpl/aux_/count_args.hpp", + "external/sources/boost/mpl/aux_/count_impl.hpp", + "external/sources/boost/mpl/aux_/empty_impl.hpp", + "external/sources/boost/mpl/aux_/erase_impl.hpp", + "external/sources/boost/mpl/aux_/erase_key_impl.hpp", + "external/sources/boost/mpl/aux_/filter_iter.hpp", + "external/sources/boost/mpl/aux_/find_if_pred.hpp", + "external/sources/boost/mpl/aux_/fold_impl.hpp", + "external/sources/boost/mpl/aux_/fold_impl_body.hpp", + "external/sources/boost/mpl/aux_/fold_op.hpp", + "external/sources/boost/mpl/aux_/fold_pred.hpp", + "external/sources/boost/mpl/aux_/front_impl.hpp", + "external/sources/boost/mpl/aux_/full_lambda.hpp", + "external/sources/boost/mpl/aux_/has_apply.hpp", + "external/sources/boost/mpl/aux_/has_begin.hpp", + "external/sources/boost/mpl/aux_/has_key_impl.hpp", + "external/sources/boost/mpl/aux_/has_rebind.hpp", + "external/sources/boost/mpl/aux_/has_size.hpp", + "external/sources/boost/mpl/aux_/has_tag.hpp", + "external/sources/boost/mpl/aux_/has_type.hpp", + "external/sources/boost/mpl/aux_/include_preprocessed.hpp", + "external/sources/boost/mpl/aux_/insert_impl.hpp", + "external/sources/boost/mpl/aux_/insert_range_impl.hpp", + "external/sources/boost/mpl/aux_/inserter_algorithm.hpp", + "external/sources/boost/mpl/aux_/integral_wrapper.hpp", + "external/sources/boost/mpl/aux_/is_msvc_eti_arg.hpp", + "external/sources/boost/mpl/aux_/iter_apply.hpp", + "external/sources/boost/mpl/aux_/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/iter_push_front.hpp", + "external/sources/boost/mpl/aux_/joint_iter.hpp", + "external/sources/boost/mpl/aux_/lambda_arity_param.hpp", + "external/sources/boost/mpl/aux_/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/lambda_spec.hpp", + "external/sources/boost/mpl/aux_/lambda_support.hpp", + "external/sources/boost/mpl/aux_/largest_int.hpp", + "external/sources/boost/mpl/aux_/logical_op.hpp", + "external/sources/boost/mpl/aux_/msvc_dtw.hpp", + "external/sources/boost/mpl/aux_/msvc_eti_base.hpp", + "external/sources/boost/mpl/aux_/msvc_is_class.hpp", + "external/sources/boost/mpl/aux_/msvc_never_true.hpp", + "external/sources/boost/mpl/aux_/msvc_type.hpp", + "external/sources/boost/mpl/aux_/na.hpp", + "external/sources/boost/mpl/aux_/na_assert.hpp", + "external/sources/boost/mpl/aux_/na_fwd.hpp", + "external/sources/boost/mpl/aux_/na_spec.hpp", + "external/sources/boost/mpl/aux_/nested_type_wknd.hpp", + "external/sources/boost/mpl/aux_/nttp_decl.hpp", + "external/sources/boost/mpl/aux_/numeric_cast_utils.hpp", + "external/sources/boost/mpl/aux_/numeric_op.hpp", + "external/sources/boost/mpl/aux_/order_impl.hpp", + "external/sources/boost/mpl/aux_/overload_names.hpp", + "external/sources/boost/mpl/aux_/partition_op.hpp", + "external/sources/boost/mpl/aux_/pop_back_impl.hpp", + "external/sources/boost/mpl/aux_/pop_front_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc551/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/bcc_pre590/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/dmc/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/gcc/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc60/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/msvc70/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/mwcw/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ctps/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/no_ttp/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/advance_backward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/advance_forward.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/and.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/apply.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/apply_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/apply_wrap.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/arg.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/basic_bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/bind.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/bind_fwd.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/bitand.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/bitor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/bitxor.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/deque.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/divides.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/full_lambda.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/greater.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/greater_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/inherit.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/iter_fold_if_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/lambda_no_ctps.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/less.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/less_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/list.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/list_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/map.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/minus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/modulus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/not_equal_to.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/or.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/placeholders.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/plus.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/quote.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/set.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/set_c.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/shift_left.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/shift_right.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/template_arity.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/times.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/unpack_args.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/vector.hpp", + "external/sources/boost/mpl/aux_/preprocessed/plain/vector_c.hpp", + "external/sources/boost/mpl/aux_/preprocessor/add.hpp", + "external/sources/boost/mpl/aux_/preprocessor/def_params_tail.hpp", + "external/sources/boost/mpl/aux_/preprocessor/default_params.hpp", + "external/sources/boost/mpl/aux_/preprocessor/enum.hpp", + "external/sources/boost/mpl/aux_/preprocessor/ext_params.hpp", + "external/sources/boost/mpl/aux_/preprocessor/filter_params.hpp", + "external/sources/boost/mpl/aux_/preprocessor/is_seq.hpp", + "external/sources/boost/mpl/aux_/preprocessor/params.hpp", + "external/sources/boost/mpl/aux_/preprocessor/partial_spec_params.hpp", + "external/sources/boost/mpl/aux_/preprocessor/range.hpp", + "external/sources/boost/mpl/aux_/preprocessor/repeat.hpp", + "external/sources/boost/mpl/aux_/preprocessor/sub.hpp", + "external/sources/boost/mpl/aux_/preprocessor/token_equal.hpp", + "external/sources/boost/mpl/aux_/preprocessor/tuple.hpp", + "external/sources/boost/mpl/aux_/ptr_to_ref.hpp", + "external/sources/boost/mpl/aux_/push_back_impl.hpp", + "external/sources/boost/mpl/aux_/push_front_impl.hpp", + "external/sources/boost/mpl/aux_/range_c/O1_size.hpp", + "external/sources/boost/mpl/aux_/range_c/back.hpp", + "external/sources/boost/mpl/aux_/range_c/empty.hpp", + "external/sources/boost/mpl/aux_/range_c/front.hpp", + "external/sources/boost/mpl/aux_/range_c/iterator.hpp", + "external/sources/boost/mpl/aux_/range_c/size.hpp", + "external/sources/boost/mpl/aux_/range_c/tag.hpp", + "external/sources/boost/mpl/aux_/reverse_fold_impl.hpp", + "external/sources/boost/mpl/aux_/reverse_fold_impl_body.hpp", + "external/sources/boost/mpl/aux_/reverse_iter_fold_impl.hpp", + "external/sources/boost/mpl/aux_/sequence_wrapper.hpp", + "external/sources/boost/mpl/aux_/shift_op.hpp", + "external/sources/boost/mpl/aux_/single_element_iter.hpp", + "external/sources/boost/mpl/aux_/size_impl.hpp", + "external/sources/boost/mpl/aux_/sort_impl.hpp", + "external/sources/boost/mpl/aux_/static_cast.hpp", + "external/sources/boost/mpl/aux_/template_arity.hpp", + "external/sources/boost/mpl/aux_/template_arity_fwd.hpp", + "external/sources/boost/mpl/aux_/test.hpp", + "external/sources/boost/mpl/aux_/test/assert.hpp", + "external/sources/boost/mpl/aux_/test/data.hpp", + "external/sources/boost/mpl/aux_/test/test_case.hpp", + "external/sources/boost/mpl/aux_/traits_lambda_spec.hpp", + "external/sources/boost/mpl/aux_/transform_iter.hpp", + "external/sources/boost/mpl/aux_/type_wrapper.hpp", + "external/sources/boost/mpl/aux_/unwrap.hpp", + "external/sources/boost/mpl/aux_/value_wknd.hpp", + "external/sources/boost/mpl/aux_/yes_no.hpp", + "external/sources/boost/mpl/back.hpp", + "external/sources/boost/mpl/back_fwd.hpp", + "external/sources/boost/mpl/back_inserter.hpp", + "external/sources/boost/mpl/base.hpp", + "external/sources/boost/mpl/begin.hpp", + "external/sources/boost/mpl/begin_end.hpp", + "external/sources/boost/mpl/begin_end_fwd.hpp", + "external/sources/boost/mpl/bind.hpp", + "external/sources/boost/mpl/bind_fwd.hpp", + "external/sources/boost/mpl/bitand.hpp", + "external/sources/boost/mpl/bitor.hpp", + "external/sources/boost/mpl/bitwise.hpp", + "external/sources/boost/mpl/bitxor.hpp", + "external/sources/boost/mpl/bool.hpp", + "external/sources/boost/mpl/bool_fwd.hpp", + "external/sources/boost/mpl/char.hpp", + "external/sources/boost/mpl/char_fwd.hpp", + "external/sources/boost/mpl/clear.hpp", + "external/sources/boost/mpl/clear_fwd.hpp", + "external/sources/boost/mpl/comparison.hpp", + "external/sources/boost/mpl/contains.hpp", + "external/sources/boost/mpl/contains_fwd.hpp", + "external/sources/boost/mpl/copy.hpp", + "external/sources/boost/mpl/copy_if.hpp", + "external/sources/boost/mpl/count.hpp", + "external/sources/boost/mpl/count_fwd.hpp", + "external/sources/boost/mpl/count_if.hpp", + "external/sources/boost/mpl/deque.hpp", + "external/sources/boost/mpl/deref.hpp", + "external/sources/boost/mpl/distance.hpp", + "external/sources/boost/mpl/distance_fwd.hpp", + "external/sources/boost/mpl/divides.hpp", + "external/sources/boost/mpl/empty.hpp", + "external/sources/boost/mpl/empty_base.hpp", + "external/sources/boost/mpl/empty_fwd.hpp", + "external/sources/boost/mpl/empty_sequence.hpp", + "external/sources/boost/mpl/end.hpp", + "external/sources/boost/mpl/equal.hpp", + "external/sources/boost/mpl/equal_to.hpp", + "external/sources/boost/mpl/erase.hpp", + "external/sources/boost/mpl/erase_fwd.hpp", + "external/sources/boost/mpl/erase_key.hpp", + "external/sources/boost/mpl/erase_key_fwd.hpp", + "external/sources/boost/mpl/eval_if.hpp", + "external/sources/boost/mpl/filter_view.hpp", + "external/sources/boost/mpl/find.hpp", + "external/sources/boost/mpl/find_if.hpp", + "external/sources/boost/mpl/fold.hpp", + "external/sources/boost/mpl/for_each.hpp", + "external/sources/boost/mpl/front.hpp", + "external/sources/boost/mpl/front_fwd.hpp", + "external/sources/boost/mpl/front_inserter.hpp", + "external/sources/boost/mpl/get_tag.hpp", + "external/sources/boost/mpl/greater.hpp", + "external/sources/boost/mpl/greater_equal.hpp", + "external/sources/boost/mpl/has_key.hpp", + "external/sources/boost/mpl/has_key_fwd.hpp", + "external/sources/boost/mpl/has_xxx.hpp", + "external/sources/boost/mpl/identity.hpp", + "external/sources/boost/mpl/if.hpp", + "external/sources/boost/mpl/index_if.hpp", + "external/sources/boost/mpl/index_of.hpp", + "external/sources/boost/mpl/inherit.hpp", + "external/sources/boost/mpl/inherit_linearly.hpp", + "external/sources/boost/mpl/insert.hpp", + "external/sources/boost/mpl/insert_fwd.hpp", + "external/sources/boost/mpl/insert_range.hpp", + "external/sources/boost/mpl/insert_range_fwd.hpp", + "external/sources/boost/mpl/inserter.hpp", + "external/sources/boost/mpl/int.hpp", + "external/sources/boost/mpl/int_fwd.hpp", + "external/sources/boost/mpl/integral_c.hpp", + "external/sources/boost/mpl/integral_c_fwd.hpp", + "external/sources/boost/mpl/integral_c_tag.hpp", + "external/sources/boost/mpl/is_placeholder.hpp", + "external/sources/boost/mpl/is_sequence.hpp", + "external/sources/boost/mpl/iter_fold.hpp", + "external/sources/boost/mpl/iter_fold_if.hpp", + "external/sources/boost/mpl/iterator_category.hpp", + "external/sources/boost/mpl/iterator_range.hpp", + "external/sources/boost/mpl/iterator_tags.hpp", + "external/sources/boost/mpl/joint_view.hpp", + "external/sources/boost/mpl/key_type.hpp", + "external/sources/boost/mpl/key_type_fwd.hpp", + "external/sources/boost/mpl/lambda.hpp", + "external/sources/boost/mpl/lambda_fwd.hpp", + "external/sources/boost/mpl/less.hpp", + "external/sources/boost/mpl/less_equal.hpp", + "external/sources/boost/mpl/limits/arity.hpp", + "external/sources/boost/mpl/limits/list.hpp", + "external/sources/boost/mpl/limits/map.hpp", + "external/sources/boost/mpl/limits/set.hpp", + "external/sources/boost/mpl/limits/string.hpp", + "external/sources/boost/mpl/limits/unrolling.hpp", + "external/sources/boost/mpl/limits/vector.hpp", + "external/sources/boost/mpl/list.hpp", + "external/sources/boost/mpl/list/aux_/O1_size.hpp", + "external/sources/boost/mpl/list/aux_/begin_end.hpp", + "external/sources/boost/mpl/list/aux_/clear.hpp", + "external/sources/boost/mpl/list/aux_/empty.hpp", + "external/sources/boost/mpl/list/aux_/front.hpp", + "external/sources/boost/mpl/list/aux_/include_preprocessed.hpp", + "external/sources/boost/mpl/list/aux_/item.hpp", + "external/sources/boost/mpl/list/aux_/iterator.hpp", + "external/sources/boost/mpl/list/aux_/numbered.hpp", + "external/sources/boost/mpl/list/aux_/numbered_c.hpp", + "external/sources/boost/mpl/list/aux_/pop_front.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list10.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list10_c.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list20.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list20_c.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list30.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list30_c.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list40.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list40_c.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list50.hpp", + "external/sources/boost/mpl/list/aux_/preprocessed/plain/list50_c.hpp", + "external/sources/boost/mpl/list/aux_/push_back.hpp", + "external/sources/boost/mpl/list/aux_/push_front.hpp", + "external/sources/boost/mpl/list/aux_/size.hpp", + "external/sources/boost/mpl/list/aux_/tag.hpp", + "external/sources/boost/mpl/list/list0.hpp", + "external/sources/boost/mpl/list/list0_c.hpp", + "external/sources/boost/mpl/list/list10.hpp", + "external/sources/boost/mpl/list/list10_c.hpp", + "external/sources/boost/mpl/list/list20.hpp", + "external/sources/boost/mpl/list/list20_c.hpp", + "external/sources/boost/mpl/list/list30.hpp", + "external/sources/boost/mpl/list/list30_c.hpp", + "external/sources/boost/mpl/list/list40.hpp", + "external/sources/boost/mpl/list/list40_c.hpp", + "external/sources/boost/mpl/list/list50.hpp", + "external/sources/boost/mpl/list/list50_c.hpp", + "external/sources/boost/mpl/list_c.hpp", + "external/sources/boost/mpl/logical.hpp", + "external/sources/boost/mpl/long.hpp", + "external/sources/boost/mpl/long_fwd.hpp", + "external/sources/boost/mpl/lower_bound.hpp", + "external/sources/boost/mpl/map.hpp", + "external/sources/boost/mpl/map/aux_/at_impl.hpp", + "external/sources/boost/mpl/map/aux_/begin_end_impl.hpp", + "external/sources/boost/mpl/map/aux_/clear_impl.hpp", + "external/sources/boost/mpl/map/aux_/contains_impl.hpp", + "external/sources/boost/mpl/map/aux_/empty_impl.hpp", + "external/sources/boost/mpl/map/aux_/erase_impl.hpp", + "external/sources/boost/mpl/map/aux_/erase_key_impl.hpp", + "external/sources/boost/mpl/map/aux_/has_key_impl.hpp", + "external/sources/boost/mpl/map/aux_/include_preprocessed.hpp", + "external/sources/boost/mpl/map/aux_/insert_impl.hpp", + "external/sources/boost/mpl/map/aux_/insert_range_impl.hpp", + "external/sources/boost/mpl/map/aux_/item.hpp", + "external/sources/boost/mpl/map/aux_/iterator.hpp", + "external/sources/boost/mpl/map/aux_/key_type_impl.hpp", + "external/sources/boost/mpl/map/aux_/map0.hpp", + "external/sources/boost/mpl/map/aux_/numbered.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/no_ctps/map10.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/no_ctps/map20.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/no_ctps/map30.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/no_ctps/map40.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/no_ctps/map50.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/plain/map10.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/plain/map20.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/plain/map30.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/plain/map40.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/plain/map50.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/typeof_based/map10.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/typeof_based/map20.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/typeof_based/map30.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/typeof_based/map40.hpp", + "external/sources/boost/mpl/map/aux_/preprocessed/typeof_based/map50.hpp", + "external/sources/boost/mpl/map/aux_/size_impl.hpp", + "external/sources/boost/mpl/map/aux_/tag.hpp", + "external/sources/boost/mpl/map/aux_/value_type_impl.hpp", + "external/sources/boost/mpl/map/map0.hpp", + "external/sources/boost/mpl/map/map10.hpp", + "external/sources/boost/mpl/map/map20.hpp", + "external/sources/boost/mpl/map/map30.hpp", + "external/sources/boost/mpl/map/map40.hpp", + "external/sources/boost/mpl/map/map50.hpp", + "external/sources/boost/mpl/math/fixed_c.hpp", + "external/sources/boost/mpl/math/is_even.hpp", + "external/sources/boost/mpl/math/rational_c.hpp", + "external/sources/boost/mpl/max.hpp", + "external/sources/boost/mpl/max_element.hpp", + "external/sources/boost/mpl/min.hpp", + "external/sources/boost/mpl/min_element.hpp", + "external/sources/boost/mpl/min_max.hpp", + "external/sources/boost/mpl/minus.hpp", + "external/sources/boost/mpl/modulus.hpp", + "external/sources/boost/mpl/multiplies.hpp", + "external/sources/boost/mpl/multiset/aux_/count_impl.hpp", + "external/sources/boost/mpl/multiset/aux_/insert_impl.hpp", + "external/sources/boost/mpl/multiset/aux_/item.hpp", + "external/sources/boost/mpl/multiset/aux_/multiset0.hpp", + "external/sources/boost/mpl/multiset/aux_/tag.hpp", + "external/sources/boost/mpl/multiset/multiset0.hpp", + "external/sources/boost/mpl/negate.hpp", + "external/sources/boost/mpl/next.hpp", + "external/sources/boost/mpl/next_prior.hpp", + "external/sources/boost/mpl/not.hpp", + "external/sources/boost/mpl/not_equal_to.hpp", + "external/sources/boost/mpl/numeric_cast.hpp", + "external/sources/boost/mpl/or.hpp", + "external/sources/boost/mpl/order.hpp", + "external/sources/boost/mpl/order_fwd.hpp", + "external/sources/boost/mpl/pair.hpp", + "external/sources/boost/mpl/pair_view.hpp", + "external/sources/boost/mpl/partition.hpp", + "external/sources/boost/mpl/placeholders.hpp", + "external/sources/boost/mpl/plus.hpp", + "external/sources/boost/mpl/pop_back.hpp", + "external/sources/boost/mpl/pop_back_fwd.hpp", + "external/sources/boost/mpl/pop_front.hpp", + "external/sources/boost/mpl/pop_front_fwd.hpp", + "external/sources/boost/mpl/print.hpp", + "external/sources/boost/mpl/prior.hpp", + "external/sources/boost/mpl/protect.hpp", + "external/sources/boost/mpl/push_back.hpp", + "external/sources/boost/mpl/push_back_fwd.hpp", + "external/sources/boost/mpl/push_front.hpp", + "external/sources/boost/mpl/push_front_fwd.hpp", + "external/sources/boost/mpl/quote.hpp", + "external/sources/boost/mpl/range_c.hpp", + "external/sources/boost/mpl/remove.hpp", + "external/sources/boost/mpl/remove_if.hpp", + "external/sources/boost/mpl/replace.hpp", + "external/sources/boost/mpl/replace_if.hpp", + "external/sources/boost/mpl/reverse.hpp", + "external/sources/boost/mpl/reverse_fold.hpp", + "external/sources/boost/mpl/reverse_iter_fold.hpp", + "external/sources/boost/mpl/same_as.hpp", + "external/sources/boost/mpl/sequence_tag.hpp", + "external/sources/boost/mpl/sequence_tag_fwd.hpp", + "external/sources/boost/mpl/set.hpp", + "external/sources/boost/mpl/set/aux_/at_impl.hpp", + "external/sources/boost/mpl/set/aux_/begin_end_impl.hpp", + "external/sources/boost/mpl/set/aux_/clear_impl.hpp", + "external/sources/boost/mpl/set/aux_/empty_impl.hpp", + "external/sources/boost/mpl/set/aux_/erase_impl.hpp", + "external/sources/boost/mpl/set/aux_/erase_key_impl.hpp", + "external/sources/boost/mpl/set/aux_/has_key_impl.hpp", + "external/sources/boost/mpl/set/aux_/include_preprocessed.hpp", + "external/sources/boost/mpl/set/aux_/insert_impl.hpp", + "external/sources/boost/mpl/set/aux_/insert_range_impl.hpp", + "external/sources/boost/mpl/set/aux_/item.hpp", + "external/sources/boost/mpl/set/aux_/iterator.hpp", + "external/sources/boost/mpl/set/aux_/key_type_impl.hpp", + "external/sources/boost/mpl/set/aux_/numbered.hpp", + "external/sources/boost/mpl/set/aux_/numbered_c.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set10.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set10_c.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set20.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set20_c.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set30.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set30_c.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set40.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set40_c.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set50.hpp", + "external/sources/boost/mpl/set/aux_/preprocessed/plain/set50_c.hpp", + "external/sources/boost/mpl/set/aux_/set0.hpp", + "external/sources/boost/mpl/set/aux_/size_impl.hpp", + "external/sources/boost/mpl/set/aux_/tag.hpp", + "external/sources/boost/mpl/set/aux_/value_type_impl.hpp", + "external/sources/boost/mpl/set/set0.hpp", + "external/sources/boost/mpl/set/set0_c.hpp", + "external/sources/boost/mpl/set/set10.hpp", + "external/sources/boost/mpl/set/set10_c.hpp", + "external/sources/boost/mpl/set/set20.hpp", + "external/sources/boost/mpl/set/set20_c.hpp", + "external/sources/boost/mpl/set/set30.hpp", + "external/sources/boost/mpl/set/set30_c.hpp", + "external/sources/boost/mpl/set/set40.hpp", + "external/sources/boost/mpl/set/set40_c.hpp", + "external/sources/boost/mpl/set/set50.hpp", + "external/sources/boost/mpl/set/set50_c.hpp", + "external/sources/boost/mpl/set_c.hpp", + "external/sources/boost/mpl/shift_left.hpp", + "external/sources/boost/mpl/shift_right.hpp", + "external/sources/boost/mpl/single_view.hpp", + "external/sources/boost/mpl/size.hpp", + "external/sources/boost/mpl/size_fwd.hpp", + "external/sources/boost/mpl/size_t.hpp", + "external/sources/boost/mpl/size_t_fwd.hpp", + "external/sources/boost/mpl/sizeof.hpp", + "external/sources/boost/mpl/sort.hpp", + "external/sources/boost/mpl/stable_partition.hpp", + "external/sources/boost/mpl/string.hpp", + "external/sources/boost/mpl/switch.hpp", + "external/sources/boost/mpl/tag.hpp", + "external/sources/boost/mpl/times.hpp", + "external/sources/boost/mpl/transform.hpp", + "external/sources/boost/mpl/transform_view.hpp", + "external/sources/boost/mpl/unique.hpp", + "external/sources/boost/mpl/unpack_args.hpp", + "external/sources/boost/mpl/upper_bound.hpp", + "external/sources/boost/mpl/value_type.hpp", + "external/sources/boost/mpl/value_type_fwd.hpp", + "external/sources/boost/mpl/vector.hpp", + "external/sources/boost/mpl/vector/aux_/O1_size.hpp", + "external/sources/boost/mpl/vector/aux_/at.hpp", + "external/sources/boost/mpl/vector/aux_/back.hpp", + "external/sources/boost/mpl/vector/aux_/begin_end.hpp", + "external/sources/boost/mpl/vector/aux_/clear.hpp", + "external/sources/boost/mpl/vector/aux_/empty.hpp", + "external/sources/boost/mpl/vector/aux_/front.hpp", + "external/sources/boost/mpl/vector/aux_/include_preprocessed.hpp", + "external/sources/boost/mpl/vector/aux_/item.hpp", + "external/sources/boost/mpl/vector/aux_/iterator.hpp", + "external/sources/boost/mpl/vector/aux_/numbered.hpp", + "external/sources/boost/mpl/vector/aux_/numbered_c.hpp", + "external/sources/boost/mpl/vector/aux_/pop_back.hpp", + "external/sources/boost/mpl/vector/aux_/pop_front.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector10.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector10_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector20.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector20_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector30.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector30_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector40.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector40_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector50.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/no_ctps/vector50_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector10.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector10_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector20.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector20_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector30.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector30_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector40.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector40_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector50.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/plain/vector50_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector20.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector20_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector30.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector30_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector40.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector40_c.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector50.hpp", + "external/sources/boost/mpl/vector/aux_/preprocessed/typeof_based/vector50_c.hpp", + "external/sources/boost/mpl/vector/aux_/push_back.hpp", + "external/sources/boost/mpl/vector/aux_/push_front.hpp", + "external/sources/boost/mpl/vector/aux_/size.hpp", + "external/sources/boost/mpl/vector/aux_/tag.hpp", + "external/sources/boost/mpl/vector/aux_/vector0.hpp", + "external/sources/boost/mpl/vector/vector0.hpp", + "external/sources/boost/mpl/vector/vector0_c.hpp", + "external/sources/boost/mpl/vector/vector10.hpp", + "external/sources/boost/mpl/vector/vector10_c.hpp", + "external/sources/boost/mpl/vector/vector20.hpp", + "external/sources/boost/mpl/vector/vector20_c.hpp", + "external/sources/boost/mpl/vector/vector30.hpp", + "external/sources/boost/mpl/vector/vector30_c.hpp", + "external/sources/boost/mpl/vector/vector40.hpp", + "external/sources/boost/mpl/vector/vector40_c.hpp", + "external/sources/boost/mpl/vector/vector50.hpp", + "external/sources/boost/mpl/vector/vector50_c.hpp", + "external/sources/boost/mpl/vector_c.hpp", + "external/sources/boost/mpl/void.hpp", + "external/sources/boost/mpl/void_fwd.hpp", + "external/sources/boost/mpl/zip_view.hpp", + "external/sources/boost/msm/active_state_switching_policies.hpp", + "external/sources/boost/msm/back/args.hpp", + "external/sources/boost/msm/back/bind_helpers.hpp", + "external/sources/boost/msm/back/common_types.hpp", + "external/sources/boost/msm/back/copy_policies.hpp", + "external/sources/boost/msm/back/default_compile_policy.hpp", + "external/sources/boost/msm/back/dispatch_table.hpp", + "external/sources/boost/msm/back/favor_compile_time.hpp", + "external/sources/boost/msm/back/fold_to_list.hpp", + "external/sources/boost/msm/back/history_policies.hpp", + "external/sources/boost/msm/back/metafunctions.hpp", + "external/sources/boost/msm/back/mpl_graph_fsm_check.hpp", + "external/sources/boost/msm/back/no_fsm_check.hpp", + "external/sources/boost/msm/back/queue_container_circular.hpp", + "external/sources/boost/msm/back/queue_container_deque.hpp", + "external/sources/boost/msm/back/state_machine.hpp", + "external/sources/boost/msm/back/tools.hpp", + "external/sources/boost/msm/common.hpp", + "external/sources/boost/msm/event_traits.hpp", + "external/sources/boost/msm/front/common_states.hpp", + "external/sources/boost/msm/front/completion_event.hpp", + "external/sources/boost/msm/front/detail/common_states.hpp", + "external/sources/boost/msm/front/detail/row2_helper.hpp", + "external/sources/boost/msm/front/euml/algorithm.hpp", + "external/sources/boost/msm/front/euml/common.hpp", + "external/sources/boost/msm/front/euml/container.hpp", + "external/sources/boost/msm/front/euml/euml.hpp", + "external/sources/boost/msm/front/euml/euml_typeof.hpp", + "external/sources/boost/msm/front/euml/guard_grammar.hpp", + "external/sources/boost/msm/front/euml/iteration.hpp", + "external/sources/boost/msm/front/euml/operator.hpp", + "external/sources/boost/msm/front/euml/phoenix_placeholders.hpp", + "external/sources/boost/msm/front/euml/querying.hpp", + "external/sources/boost/msm/front/euml/state_grammar.hpp", + "external/sources/boost/msm/front/euml/stl.hpp", + "external/sources/boost/msm/front/euml/stt_grammar.hpp", + "external/sources/boost/msm/front/euml/transformation.hpp", + "external/sources/boost/msm/front/functor_row.hpp", + "external/sources/boost/msm/front/internal_row.hpp", + "external/sources/boost/msm/front/row2.hpp", + "external/sources/boost/msm/front/state_machine_def.hpp", + "external/sources/boost/msm/front/states.hpp", + "external/sources/boost/msm/mpl_graph/adjacency_list_graph.hpp", + "external/sources/boost/msm/mpl_graph/breadth_first_search.hpp", + "external/sources/boost/msm/mpl_graph/depth_first_search.hpp", + "external/sources/boost/msm/mpl_graph/detail/adjacency_list_graph.ipp", + "external/sources/boost/msm/mpl_graph/detail/graph_implementation_interface.ipp", + "external/sources/boost/msm/mpl_graph/detail/incidence_list_graph.ipp", + "external/sources/boost/msm/mpl_graph/incidence_list_graph.hpp", + "external/sources/boost/msm/mpl_graph/mpl_graph.hpp", + "external/sources/boost/msm/mpl_graph/mpl_utils.hpp", + "external/sources/boost/msm/mpl_graph/search_colors.hpp", + "external/sources/boost/msm/msm_grammar.hpp", + "external/sources/boost/msm/proto_config.hpp", + "external/sources/boost/msm/row_tags.hpp", + "external/sources/boost/multi_array.hpp", + "external/sources/boost/multi_array/algorithm.hpp", + "external/sources/boost/multi_array/base.hpp", + "external/sources/boost/multi_array/collection_concept.hpp", + "external/sources/boost/multi_array/concept_checks.hpp", + "external/sources/boost/multi_array/copy_array.hpp", + "external/sources/boost/multi_array/extent_gen.hpp", + "external/sources/boost/multi_array/extent_range.hpp", + "external/sources/boost/multi_array/index_gen.hpp", + "external/sources/boost/multi_array/index_range.hpp", + "external/sources/boost/multi_array/iterator.hpp", + "external/sources/boost/multi_array/multi_array_ref.hpp", + "external/sources/boost/multi_array/range_list.hpp", + "external/sources/boost/multi_array/storage_order.hpp", + "external/sources/boost/multi_array/subarray.hpp", + "external/sources/boost/multi_array/types.hpp", + "external/sources/boost/multi_array/view.hpp", + "external/sources/boost/multi_index/composite_key.hpp", + "external/sources/boost/multi_index/detail/access_specifier.hpp", + "external/sources/boost/multi_index/detail/adl_swap.hpp", + "external/sources/boost/multi_index/detail/allocator_traits.hpp", + "external/sources/boost/multi_index/detail/archive_constructed.hpp", + "external/sources/boost/multi_index/detail/auto_space.hpp", + "external/sources/boost/multi_index/detail/base_type.hpp", + "external/sources/boost/multi_index/detail/bidir_node_iterator.hpp", + "external/sources/boost/multi_index/detail/bucket_array.hpp", + "external/sources/boost/multi_index/detail/cons_stdtuple.hpp", + "external/sources/boost/multi_index/detail/converter.hpp", + "external/sources/boost/multi_index/detail/copy_map.hpp", + "external/sources/boost/multi_index/detail/define_if_constexpr_macro.hpp", + "external/sources/boost/multi_index/detail/do_not_copy_elements_tag.hpp", + "external/sources/boost/multi_index/detail/duplicates_iterator.hpp", + "external/sources/boost/multi_index/detail/has_tag.hpp", + "external/sources/boost/multi_index/detail/hash_index_args.hpp", + "external/sources/boost/multi_index/detail/hash_index_iterator.hpp", + "external/sources/boost/multi_index/detail/hash_index_node.hpp", + "external/sources/boost/multi_index/detail/header_holder.hpp", + "external/sources/boost/multi_index/detail/ignore_wstrict_aliasing.hpp", + "external/sources/boost/multi_index/detail/index_base.hpp", + "external/sources/boost/multi_index/detail/index_loader.hpp", + "external/sources/boost/multi_index/detail/index_matcher.hpp", + "external/sources/boost/multi_index/detail/index_node_base.hpp", + "external/sources/boost/multi_index/detail/index_saver.hpp", + "external/sources/boost/multi_index/detail/invariant_assert.hpp", + "external/sources/boost/multi_index/detail/is_function.hpp", + "external/sources/boost/multi_index/detail/is_index_list.hpp", + "external/sources/boost/multi_index/detail/is_transparent.hpp", + "external/sources/boost/multi_index/detail/iter_adaptor.hpp", + "external/sources/boost/multi_index/detail/modify_key_adaptor.hpp", + "external/sources/boost/multi_index/detail/no_duplicate_tags.hpp", + "external/sources/boost/multi_index/detail/node_handle.hpp", + "external/sources/boost/multi_index/detail/node_type.hpp", + "external/sources/boost/multi_index/detail/ord_index_args.hpp", + "external/sources/boost/multi_index/detail/ord_index_impl.hpp", + "external/sources/boost/multi_index/detail/ord_index_impl_fwd.hpp", + "external/sources/boost/multi_index/detail/ord_index_node.hpp", + "external/sources/boost/multi_index/detail/ord_index_ops.hpp", + "external/sources/boost/multi_index/detail/promotes_arg.hpp", + "external/sources/boost/multi_index/detail/raw_ptr.hpp", + "external/sources/boost/multi_index/detail/restore_wstrict_aliasing.hpp", + "external/sources/boost/multi_index/detail/rnd_index_loader.hpp", + "external/sources/boost/multi_index/detail/rnd_index_node.hpp", + "external/sources/boost/multi_index/detail/rnd_index_ops.hpp", + "external/sources/boost/multi_index/detail/rnd_index_ptr_array.hpp", + "external/sources/boost/multi_index/detail/rnd_node_iterator.hpp", + "external/sources/boost/multi_index/detail/rnk_index_ops.hpp", + "external/sources/boost/multi_index/detail/safe_mode.hpp", + "external/sources/boost/multi_index/detail/scope_guard.hpp", + "external/sources/boost/multi_index/detail/seq_index_node.hpp", + "external/sources/boost/multi_index/detail/seq_index_ops.hpp", + "external/sources/boost/multi_index/detail/serialization_version.hpp", + "external/sources/boost/multi_index/detail/uintptr_type.hpp", + "external/sources/boost/multi_index/detail/unbounded.hpp", + "external/sources/boost/multi_index/detail/undef_if_constexpr_macro.hpp", + "external/sources/boost/multi_index/detail/value_compare.hpp", + "external/sources/boost/multi_index/detail/vartempl_support.hpp", + "external/sources/boost/multi_index/global_fun.hpp", + "external/sources/boost/multi_index/hashed_index.hpp", + "external/sources/boost/multi_index/hashed_index_fwd.hpp", + "external/sources/boost/multi_index/identity.hpp", + "external/sources/boost/multi_index/identity_fwd.hpp", + "external/sources/boost/multi_index/indexed_by.hpp", + "external/sources/boost/multi_index/key.hpp", + "external/sources/boost/multi_index/key_extractors.hpp", + "external/sources/boost/multi_index/mem_fun.hpp", + "external/sources/boost/multi_index/member.hpp", + "external/sources/boost/multi_index/ordered_index.hpp", + "external/sources/boost/multi_index/ordered_index_fwd.hpp", + "external/sources/boost/multi_index/random_access_index.hpp", + "external/sources/boost/multi_index/random_access_index_fwd.hpp", + "external/sources/boost/multi_index/ranked_index.hpp", + "external/sources/boost/multi_index/ranked_index_fwd.hpp", + "external/sources/boost/multi_index/safe_mode_errors.hpp", + "external/sources/boost/multi_index/sequenced_index.hpp", + "external/sources/boost/multi_index/sequenced_index_fwd.hpp", + "external/sources/boost/multi_index/tag.hpp", + "external/sources/boost/multi_index_container.hpp", + "external/sources/boost/multi_index_container_fwd.hpp", + "external/sources/boost/multiprecision/complex128.hpp", + "external/sources/boost/multiprecision/complex_adaptor.hpp", + "external/sources/boost/multiprecision/concepts/mp_number_archetypes.hpp", + "external/sources/boost/multiprecision/cpp_bin_float.hpp", + "external/sources/boost/multiprecision/cpp_bin_float/io.hpp", + "external/sources/boost/multiprecision/cpp_bin_float/transcendental.hpp", + "external/sources/boost/multiprecision/cpp_complex.hpp", + "external/sources/boost/multiprecision/cpp_dec_float.hpp", + "external/sources/boost/multiprecision/cpp_int.hpp", + "external/sources/boost/multiprecision/cpp_int/add.hpp", + "external/sources/boost/multiprecision/cpp_int/bitwise.hpp", + "external/sources/boost/multiprecision/cpp_int/checked.hpp", + "external/sources/boost/multiprecision/cpp_int/comparison.hpp", + "external/sources/boost/multiprecision/cpp_int/cpp_int_config.hpp", + "external/sources/boost/multiprecision/cpp_int/divide.hpp", + "external/sources/boost/multiprecision/cpp_int/import_export.hpp", + "external/sources/boost/multiprecision/cpp_int/limits.hpp", + "external/sources/boost/multiprecision/cpp_int/literals.hpp", + "external/sources/boost/multiprecision/cpp_int/misc.hpp", + "external/sources/boost/multiprecision/cpp_int/multiply.hpp", + "external/sources/boost/multiprecision/cpp_int/serialize.hpp", + "external/sources/boost/multiprecision/cpp_int/value_pack.hpp", + "external/sources/boost/multiprecision/debug_adaptor.hpp", + "external/sources/boost/multiprecision/detail/atomic.hpp", + "external/sources/boost/multiprecision/detail/big_lanczos.hpp", + "external/sources/boost/multiprecision/detail/bitscan.hpp", + "external/sources/boost/multiprecision/detail/constexpr.hpp", + "external/sources/boost/multiprecision/detail/default_ops.hpp", + "external/sources/boost/multiprecision/detail/digits.hpp", + "external/sources/boost/multiprecision/detail/dynamic_array.hpp", + "external/sources/boost/multiprecision/detail/et_ops.hpp", + "external/sources/boost/multiprecision/detail/float_string_cvt.hpp", + "external/sources/boost/multiprecision/detail/functions/constants.hpp", + "external/sources/boost/multiprecision/detail/functions/pow.hpp", + "external/sources/boost/multiprecision/detail/functions/trig.hpp", + "external/sources/boost/multiprecision/detail/generic_interconvert.hpp", + "external/sources/boost/multiprecision/detail/integer_ops.hpp", + "external/sources/boost/multiprecision/detail/itos.hpp", + "external/sources/boost/multiprecision/detail/min_max.hpp", + "external/sources/boost/multiprecision/detail/no_et_ops.hpp", + "external/sources/boost/multiprecision/detail/number_base.hpp", + "external/sources/boost/multiprecision/detail/number_compare.hpp", + "external/sources/boost/multiprecision/detail/precision.hpp", + "external/sources/boost/multiprecision/detail/rebind.hpp", + "external/sources/boost/multiprecision/detail/ublas_interop.hpp", + "external/sources/boost/multiprecision/detail/utype_helper.hpp", + "external/sources/boost/multiprecision/eigen.hpp", + "external/sources/boost/multiprecision/float128.hpp", + "external/sources/boost/multiprecision/gmp.hpp", + "external/sources/boost/multiprecision/integer.hpp", + "external/sources/boost/multiprecision/logged_adaptor.hpp", + "external/sources/boost/multiprecision/miller_rabin.hpp", + "external/sources/boost/multiprecision/mpc.hpp", + "external/sources/boost/multiprecision/mpfi.hpp", + "external/sources/boost/multiprecision/mpfr.hpp", + "external/sources/boost/multiprecision/number.hpp", + "external/sources/boost/multiprecision/random.hpp", + "external/sources/boost/multiprecision/rational_adaptor.hpp", + "external/sources/boost/multiprecision/tommath.hpp", + "external/sources/boost/multiprecision/traits/explicit_conversion.hpp", + "external/sources/boost/multiprecision/traits/extract_exponent_type.hpp", + "external/sources/boost/multiprecision/traits/is_backend.hpp", + "external/sources/boost/multiprecision/traits/is_byte_container.hpp", + "external/sources/boost/multiprecision/traits/is_restricted_conversion.hpp", + "external/sources/boost/multiprecision/traits/is_variable_precision.hpp", + "external/sources/boost/next_prior.hpp", + "external/sources/boost/non_type.hpp", + "external/sources/boost/noncopyable.hpp", + "external/sources/boost/nondet_random.hpp", + "external/sources/boost/none.hpp", + "external/sources/boost/none_t.hpp", + "external/sources/boost/nowide/args.hpp", + "external/sources/boost/nowide/config.hpp", + "external/sources/boost/nowide/convert.hpp", + "external/sources/boost/nowide/cstdio.hpp", + "external/sources/boost/nowide/cstdlib.hpp", + "external/sources/boost/nowide/detail/convert.hpp", + "external/sources/boost/nowide/detail/utf.hpp", + "external/sources/boost/nowide/filebuf.hpp", + "external/sources/boost/nowide/filesystem.hpp", + "external/sources/boost/nowide/fstream.hpp", + "external/sources/boost/nowide/iostream.hpp", + "external/sources/boost/nowide/replacement.hpp", + "external/sources/boost/nowide/stackstring.hpp", + "external/sources/boost/nowide/stat.hpp", + "external/sources/boost/nowide/utf/convert.hpp", + "external/sources/boost/nowide/utf/utf.hpp", + "external/sources/boost/nowide/utf8_codecvt.hpp", + "external/sources/boost/nowide/windows.hpp", + "external/sources/boost/numeric/conversion/bounds.hpp", + "external/sources/boost/numeric/conversion/cast.hpp", + "external/sources/boost/numeric/conversion/conversion_traits.hpp", + "external/sources/boost/numeric/conversion/converter.hpp", + "external/sources/boost/numeric/conversion/converter_policies.hpp", + "external/sources/boost/numeric/conversion/detail/bounds.hpp", + "external/sources/boost/numeric/conversion/detail/conversion_traits.hpp", + "external/sources/boost/numeric/conversion/detail/converter.hpp", + "external/sources/boost/numeric/conversion/detail/int_float_mixture.hpp", + "external/sources/boost/numeric/conversion/detail/is_subranged.hpp", + "external/sources/boost/numeric/conversion/detail/meta.hpp", + "external/sources/boost/numeric/conversion/detail/numeric_cast_traits.hpp", + "external/sources/boost/numeric/conversion/detail/old_numeric_cast.hpp", + "external/sources/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp", + "external/sources/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp", + "external/sources/boost/numeric/conversion/detail/sign_mixture.hpp", + "external/sources/boost/numeric/conversion/detail/udt_builtin_mixture.hpp", + "external/sources/boost/numeric/conversion/int_float_mixture.hpp", + "external/sources/boost/numeric/conversion/int_float_mixture_enum.hpp", + "external/sources/boost/numeric/conversion/is_subranged.hpp", + "external/sources/boost/numeric/conversion/numeric_cast_traits.hpp", + "external/sources/boost/numeric/conversion/sign_mixture.hpp", + "external/sources/boost/numeric/conversion/sign_mixture_enum.hpp", + "external/sources/boost/numeric/conversion/udt_builtin_mixture.hpp", + "external/sources/boost/numeric/conversion/udt_builtin_mixture_enum.hpp", + "external/sources/boost/numeric/interval.hpp", + "external/sources/boost/numeric/interval/arith.hpp", + "external/sources/boost/numeric/interval/arith2.hpp", + "external/sources/boost/numeric/interval/arith3.hpp", + "external/sources/boost/numeric/interval/checking.hpp", + "external/sources/boost/numeric/interval/compare.hpp", + "external/sources/boost/numeric/interval/compare/certain.hpp", + "external/sources/boost/numeric/interval/compare/explicit.hpp", + "external/sources/boost/numeric/interval/compare/lexicographic.hpp", + "external/sources/boost/numeric/interval/compare/possible.hpp", + "external/sources/boost/numeric/interval/compare/set.hpp", + "external/sources/boost/numeric/interval/compare/tribool.hpp", + "external/sources/boost/numeric/interval/constants.hpp", + "external/sources/boost/numeric/interval/detail/alpha_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/bcc_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/bugs.hpp", + "external/sources/boost/numeric/interval/detail/c99_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/c99sub_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/division.hpp", + "external/sources/boost/numeric/interval/detail/ia64_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/interval_prototype.hpp", + "external/sources/boost/numeric/interval/detail/msvc_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/ppc_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/sparc_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/test_input.hpp", + "external/sources/boost/numeric/interval/detail/x86_rounding_control.hpp", + "external/sources/boost/numeric/interval/detail/x86gcc_rounding_control.hpp", + "external/sources/boost/numeric/interval/ext/integer.hpp", + "external/sources/boost/numeric/interval/ext/x86_fast_rounding_control.hpp", + "external/sources/boost/numeric/interval/hw_rounding.hpp", + "external/sources/boost/numeric/interval/interval.hpp", + "external/sources/boost/numeric/interval/io.hpp", + "external/sources/boost/numeric/interval/limits.hpp", + "external/sources/boost/numeric/interval/policies.hpp", + "external/sources/boost/numeric/interval/rounded_arith.hpp", + "external/sources/boost/numeric/interval/rounded_transc.hpp", + "external/sources/boost/numeric/interval/rounding.hpp", + "external/sources/boost/numeric/interval/transc.hpp", + "external/sources/boost/numeric/interval/utility.hpp", + "external/sources/boost/numeric/interval/utility_fwd.hpp", + "external/sources/boost/numeric/odeint.hpp", + "external/sources/boost/numeric/odeint/algebra/algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/algebra/array_algebra.hpp", + "external/sources/boost/numeric/odeint/algebra/default_operations.hpp", + "external/sources/boost/numeric/odeint/algebra/detail/extract_value_type.hpp", + "external/sources/boost/numeric/odeint/algebra/detail/for_each.hpp", + "external/sources/boost/numeric/odeint/algebra/detail/macros.hpp", + "external/sources/boost/numeric/odeint/algebra/detail/norm_inf.hpp", + "external/sources/boost/numeric/odeint/algebra/fusion_algebra.hpp", + "external/sources/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/algebra/multi_array_algebra.hpp", + "external/sources/boost/numeric/odeint/algebra/norm_result_type.hpp", + "external/sources/boost/numeric/odeint/algebra/operations_dispatcher.hpp", + "external/sources/boost/numeric/odeint/algebra/range_algebra.hpp", + "external/sources/boost/numeric/odeint/algebra/vector_space_algebra.hpp", + "external/sources/boost/numeric/odeint/config.hpp", + "external/sources/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/blaze/blaze_resize.hpp", + "external/sources/boost/numeric/odeint/external/compute/compute.hpp", + "external/sources/boost/numeric/odeint/external/compute/compute_algebra.hpp", + "external/sources/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/compute/compute_operations.hpp", + "external/sources/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/compute/compute_resize.hpp", + "external/sources/boost/numeric/odeint/external/eigen/eigen.hpp", + "external/sources/boost/numeric/odeint/external/eigen/eigen_algebra.hpp", + "external/sources/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/eigen/eigen_resize.hpp", + "external/sources/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp", + "external/sources/boost/numeric/odeint/external/mkl/mkl_operations.hpp", + "external/sources/boost/numeric/odeint/external/mpi/mpi.hpp", + "external/sources/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp", + "external/sources/boost/numeric/odeint/external/mpi/mpi_state.hpp", + "external/sources/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp", + "external/sources/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp", + "external/sources/boost/numeric/odeint/external/mtl4/mtl4.hpp", + "external/sources/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp", + "external/sources/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/nt2/nt2_copy.hpp", + "external/sources/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp", + "external/sources/boost/numeric/odeint/external/nt2/nt2_resize.hpp", + "external/sources/boost/numeric/odeint/external/openmp/openmp.hpp", + "external/sources/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp", + "external/sources/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp", + "external/sources/boost/numeric/odeint/external/openmp/openmp_state.hpp", + "external/sources/boost/numeric/odeint/external/thrust/thrust.hpp", + "external/sources/boost/numeric/odeint/external/thrust/thrust_algebra.hpp", + "external/sources/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/thrust/thrust_operations.hpp", + "external/sources/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/thrust/thrust_resize.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp", + "external/sources/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp", + "external/sources/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp", + "external/sources/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp", + "external/sources/boost/numeric/odeint/integrate/check_adapter.hpp", + "external/sources/boost/numeric/odeint/integrate/detail/functors.hpp", + "external/sources/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp", + "external/sources/boost/numeric/odeint/integrate/detail/integrate_const.hpp", + "external/sources/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp", + "external/sources/boost/numeric/odeint/integrate/detail/integrate_times.hpp", + "external/sources/boost/numeric/odeint/integrate/integrate.hpp", + "external/sources/boost/numeric/odeint/integrate/integrate_adaptive.hpp", + "external/sources/boost/numeric/odeint/integrate/integrate_const.hpp", + "external/sources/boost/numeric/odeint/integrate/integrate_n_steps.hpp", + "external/sources/boost/numeric/odeint/integrate/integrate_times.hpp", + "external/sources/boost/numeric/odeint/integrate/max_step_checker.hpp", + "external/sources/boost/numeric/odeint/integrate/null_observer.hpp", + "external/sources/boost/numeric/odeint/integrate/observer_collection.hpp", + "external/sources/boost/numeric/odeint/iterator/adaptive_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/const_step_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/const_step_time_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp", + "external/sources/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp", + "external/sources/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp", + "external/sources/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp", + "external/sources/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/detail/functors.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/integrate.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/integrate_const.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/integrate_times.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/null_observer.hpp", + "external/sources/boost/numeric/odeint/iterator/integrate/observer_collection.hpp", + "external/sources/boost/numeric/odeint/iterator/n_step_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/n_step_time_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/times_iterator.hpp", + "external/sources/boost/numeric/odeint/iterator/times_time_iterator.hpp", + "external/sources/boost/numeric/odeint/stepper/adams_bashforth.hpp", + "external/sources/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp", + "external/sources/boost/numeric/odeint/stepper/adams_moulton.hpp", + "external/sources/boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp", + "external/sources/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp", + "external/sources/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp", + "external/sources/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp", + "external/sources/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp", + "external/sources/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp", + "external/sources/boost/numeric/odeint/stepper/bulirsch_stoer.hpp", + "external/sources/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp", + "external/sources/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp", + "external/sources/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp", + "external/sources/boost/numeric/odeint/stepper/controlled_step_result.hpp", + "external/sources/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/adaptive_adams_coefficients.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/pid_step_adjuster.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/pid_step_adjuster_coefficients.hpp", + "external/sources/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp", + "external/sources/boost/numeric/odeint/stepper/euler.hpp", + "external/sources/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp", + "external/sources/boost/numeric/odeint/stepper/explicit_generic_rk.hpp", + "external/sources/boost/numeric/odeint/stepper/extrapolation_stepper.hpp", + "external/sources/boost/numeric/odeint/stepper/generation.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_controlled_adams_bashforth_moulton.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/make_controlled.hpp", + "external/sources/boost/numeric/odeint/stepper/generation/make_dense_output.hpp", + "external/sources/boost/numeric/odeint/stepper/implicit_euler.hpp", + "external/sources/boost/numeric/odeint/stepper/modified_midpoint.hpp", + "external/sources/boost/numeric/odeint/stepper/rosenbrock4.hpp", + "external/sources/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp", + "external/sources/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp", + "external/sources/boost/numeric/odeint/stepper/runge_kutta4.hpp", + "external/sources/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp", + "external/sources/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp", + "external/sources/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp", + "external/sources/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp", + "external/sources/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp", + "external/sources/boost/numeric/odeint/stepper/stepper_categories.hpp", + "external/sources/boost/numeric/odeint/stepper/symplectic_euler.hpp", + "external/sources/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp", + "external/sources/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp", + "external/sources/boost/numeric/odeint/stepper/velocity_verlet.hpp", + "external/sources/boost/numeric/odeint/util/bind.hpp", + "external/sources/boost/numeric/odeint/util/copy.hpp", + "external/sources/boost/numeric/odeint/util/detail/is_range.hpp", + "external/sources/boost/numeric/odeint/util/detail/less_with_sign.hpp", + "external/sources/boost/numeric/odeint/util/is_pair.hpp", + "external/sources/boost/numeric/odeint/util/is_resizeable.hpp", + "external/sources/boost/numeric/odeint/util/multi_array_adaption.hpp", + "external/sources/boost/numeric/odeint/util/n_ary_helper.hpp", + "external/sources/boost/numeric/odeint/util/odeint_error.hpp", + "external/sources/boost/numeric/odeint/util/resize.hpp", + "external/sources/boost/numeric/odeint/util/resizer.hpp", + "external/sources/boost/numeric/odeint/util/same_instance.hpp", + "external/sources/boost/numeric/odeint/util/same_size.hpp", + "external/sources/boost/numeric/odeint/util/split.hpp", + "external/sources/boost/numeric/odeint/util/split_adaptor.hpp", + "external/sources/boost/numeric/odeint/util/state_wrapper.hpp", + "external/sources/boost/numeric/odeint/util/stepper_traits.hpp", + "external/sources/boost/numeric/odeint/util/ublas_matrix_expression.patch", + "external/sources/boost/numeric/odeint/util/ublas_wrapper.hpp", + "external/sources/boost/numeric/odeint/util/unit_helper.hpp", + "external/sources/boost/numeric/odeint/util/unwrap_reference.hpp", + "external/sources/boost/numeric/odeint/version.hpp", + "external/sources/boost/numeric/ublas/assignment.hpp", + "external/sources/boost/numeric/ublas/banded.hpp", + "external/sources/boost/numeric/ublas/blas.hpp", + "external/sources/boost/numeric/ublas/detail/concepts.hpp", + "external/sources/boost/numeric/ublas/detail/config.hpp", + "external/sources/boost/numeric/ublas/detail/definitions.hpp", + "external/sources/boost/numeric/ublas/detail/documentation.hpp", + "external/sources/boost/numeric/ublas/detail/duff.hpp", + "external/sources/boost/numeric/ublas/detail/iterator.hpp", + "external/sources/boost/numeric/ublas/detail/matrix_assign.hpp", + "external/sources/boost/numeric/ublas/detail/raw.hpp", + "external/sources/boost/numeric/ublas/detail/returntype_deduction.hpp", + "external/sources/boost/numeric/ublas/detail/temporary.hpp", + "external/sources/boost/numeric/ublas/detail/vector_assign.hpp", + "external/sources/boost/numeric/ublas/doxydoc.hpp", + "external/sources/boost/numeric/ublas/exception.hpp", + "external/sources/boost/numeric/ublas/experimental/sparse_view.hpp", + "external/sources/boost/numeric/ublas/expression_types.hpp", + "external/sources/boost/numeric/ublas/functional.hpp", + "external/sources/boost/numeric/ublas/fwd.hpp", + "external/sources/boost/numeric/ublas/hermitian.hpp", + "external/sources/boost/numeric/ublas/io.hpp", + "external/sources/boost/numeric/ublas/lu.hpp", + "external/sources/boost/numeric/ublas/matrix.hpp", + "external/sources/boost/numeric/ublas/matrix_expression.hpp", + "external/sources/boost/numeric/ublas/matrix_proxy.hpp", + "external/sources/boost/numeric/ublas/matrix_sparse.hpp", + "external/sources/boost/numeric/ublas/matrix_vector.hpp", + "external/sources/boost/numeric/ublas/opencl.hpp", + "external/sources/boost/numeric/ublas/opencl/elementwise.hpp", + "external/sources/boost/numeric/ublas/opencl/library.hpp", + "external/sources/boost/numeric/ublas/opencl/matrix.hpp", + "external/sources/boost/numeric/ublas/opencl/misc.hpp", + "external/sources/boost/numeric/ublas/opencl/operations.hpp", + "external/sources/boost/numeric/ublas/opencl/prod.hpp", + "external/sources/boost/numeric/ublas/opencl/transpose.hpp", + "external/sources/boost/numeric/ublas/opencl/vector.hpp", + "external/sources/boost/numeric/ublas/operation.hpp", + "external/sources/boost/numeric/ublas/operation/begin.hpp", + "external/sources/boost/numeric/ublas/operation/c_array.hpp", + "external/sources/boost/numeric/ublas/operation/end.hpp", + "external/sources/boost/numeric/ublas/operation/num_columns.hpp", + "external/sources/boost/numeric/ublas/operation/num_rows.hpp", + "external/sources/boost/numeric/ublas/operation/size.hpp", + "external/sources/boost/numeric/ublas/operation_blocked.hpp", + "external/sources/boost/numeric/ublas/operation_sparse.hpp", + "external/sources/boost/numeric/ublas/operations.hpp", + "external/sources/boost/numeric/ublas/storage.hpp", + "external/sources/boost/numeric/ublas/storage_sparse.hpp", + "external/sources/boost/numeric/ublas/symmetric.hpp", + "external/sources/boost/numeric/ublas/tags.hpp", + "external/sources/boost/numeric/ublas/tensor.hpp", + "external/sources/boost/numeric/ublas/tensor/algorithms.hpp", + "external/sources/boost/numeric/ublas/tensor/expression.hpp", + "external/sources/boost/numeric/ublas/tensor/expression_evaluation.hpp", + "external/sources/boost/numeric/ublas/tensor/extents.hpp", + "external/sources/boost/numeric/ublas/tensor/functions.hpp", + "external/sources/boost/numeric/ublas/tensor/index.hpp", + "external/sources/boost/numeric/ublas/tensor/multi_index.hpp", + "external/sources/boost/numeric/ublas/tensor/multi_index_utility.hpp", + "external/sources/boost/numeric/ublas/tensor/multiplication.hpp", + "external/sources/boost/numeric/ublas/tensor/operators_arithmetic.hpp", + "external/sources/boost/numeric/ublas/tensor/operators_comparison.hpp", + "external/sources/boost/numeric/ublas/tensor/ostream.hpp", + "external/sources/boost/numeric/ublas/tensor/storage_traits.hpp", + "external/sources/boost/numeric/ublas/tensor/strides.hpp", + "external/sources/boost/numeric/ublas/tensor/tensor.hpp", + "external/sources/boost/numeric/ublas/traits.hpp", + "external/sources/boost/numeric/ublas/traits/c_array.hpp", + "external/sources/boost/numeric/ublas/traits/const_iterator_type.hpp", + "external/sources/boost/numeric/ublas/traits/iterator_type.hpp", + "external/sources/boost/numeric/ublas/triangular.hpp", + "external/sources/boost/numeric/ublas/vector.hpp", + "external/sources/boost/numeric/ublas/vector_expression.hpp", + "external/sources/boost/numeric/ublas/vector_of_vector.hpp", + "external/sources/boost/numeric/ublas/vector_proxy.hpp", + "external/sources/boost/numeric/ublas/vector_sparse.hpp", + "external/sources/boost/operators.hpp", + "external/sources/boost/operators_v1.hpp", + "external/sources/boost/optional.hpp", + "external/sources/boost/optional/bad_optional_access.hpp", + "external/sources/boost/optional/detail/experimental_traits.hpp", + "external/sources/boost/optional/detail/old_optional_implementation.hpp", + "external/sources/boost/optional/detail/optional_aligned_storage.hpp", + "external/sources/boost/optional/detail/optional_config.hpp", + "external/sources/boost/optional/detail/optional_factory_support.hpp", + "external/sources/boost/optional/detail/optional_reference_spec.hpp", + "external/sources/boost/optional/detail/optional_relops.hpp", + "external/sources/boost/optional/detail/optional_swap.hpp", + "external/sources/boost/optional/detail/optional_trivially_copyable_base.hpp", + "external/sources/boost/optional/optional.hpp", + "external/sources/boost/optional/optional_fwd.hpp", + "external/sources/boost/optional/optional_io.hpp", + "external/sources/boost/outcome.hpp", + "external/sources/boost/outcome/bad_access.hpp", + "external/sources/boost/outcome/basic_outcome.hpp", + "external/sources/boost/outcome/basic_result.hpp", + "external/sources/boost/outcome/boost_outcome.hpp", + "external/sources/boost/outcome/boost_result.hpp", + "external/sources/boost/outcome/config.hpp", + "external/sources/boost/outcome/convert.hpp", + "external/sources/boost/outcome/coroutine_support.hpp", + "external/sources/boost/outcome/detail/basic_outcome_exception_observers.hpp", + "external/sources/boost/outcome/detail/basic_outcome_exception_observers_impl.hpp", + "external/sources/boost/outcome/detail/basic_outcome_failure_observers.hpp", + "external/sources/boost/outcome/detail/basic_result_error_observers.hpp", + "external/sources/boost/outcome/detail/basic_result_final.hpp", + "external/sources/boost/outcome/detail/basic_result_storage.hpp", + "external/sources/boost/outcome/detail/basic_result_value_observers.hpp", + "external/sources/boost/outcome/detail/coroutine_support.ipp", + "external/sources/boost/outcome/detail/revision.hpp", + "external/sources/boost/outcome/detail/trait_std_error_code.hpp", + "external/sources/boost/outcome/detail/trait_std_exception.hpp", + "external/sources/boost/outcome/detail/value_storage.hpp", + "external/sources/boost/outcome/detail/version.hpp", + "external/sources/boost/outcome/experimental/coroutine_support.hpp", + "external/sources/boost/outcome/experimental/result.h", + "external/sources/boost/outcome/experimental/status-code/com_code.hpp", + "external/sources/boost/outcome/experimental/status-code/config.hpp", + "external/sources/boost/outcome/experimental/status-code/detail/nt_code_to_generic_code.ipp", + "external/sources/boost/outcome/experimental/status-code/detail/nt_code_to_win32_code.ipp", + "external/sources/boost/outcome/experimental/status-code/detail/win32_code_to_generic_code.ipp", + "external/sources/boost/outcome/experimental/status-code/error.hpp", + "external/sources/boost/outcome/experimental/status-code/errored_status_code.hpp", + "external/sources/boost/outcome/experimental/status-code/generic_code.hpp", + "external/sources/boost/outcome/experimental/status-code/getaddrinfo_code.hpp", + "external/sources/boost/outcome/experimental/status-code/iostream_support.hpp", + "external/sources/boost/outcome/experimental/status-code/nt_code.hpp", + "external/sources/boost/outcome/experimental/status-code/posix_code.hpp", + "external/sources/boost/outcome/experimental/status-code/quick_status_code_from_enum.hpp", + "external/sources/boost/outcome/experimental/status-code/result.hpp", + "external/sources/boost/outcome/experimental/status-code/status_code.hpp", + "external/sources/boost/outcome/experimental/status-code/status_code_domain.hpp", + "external/sources/boost/outcome/experimental/status-code/status_code_ptr.hpp", + "external/sources/boost/outcome/experimental/status-code/status_error.hpp", + "external/sources/boost/outcome/experimental/status-code/std_error_code.hpp", + "external/sources/boost/outcome/experimental/status-code/system_code.hpp", + "external/sources/boost/outcome/experimental/status-code/system_code_from_exception.hpp", + "external/sources/boost/outcome/experimental/status-code/system_error2.hpp", + "external/sources/boost/outcome/experimental/status-code/win32_code.hpp", + "external/sources/boost/outcome/experimental/status_outcome.hpp", + "external/sources/boost/outcome/experimental/status_result.hpp", + "external/sources/boost/outcome/iostream_support.hpp", + "external/sources/boost/outcome/outcome.hpp", + "external/sources/boost/outcome/policy/all_narrow.hpp", + "external/sources/boost/outcome/policy/base.hpp", + "external/sources/boost/outcome/policy/fail_to_compile_observers.hpp", + "external/sources/boost/outcome/policy/outcome_error_code_throw_as_system_error.hpp", + "external/sources/boost/outcome/policy/outcome_exception_ptr_rethrow.hpp", + "external/sources/boost/outcome/policy/result_error_code_throw_as_system_error.hpp", + "external/sources/boost/outcome/policy/result_exception_ptr_rethrow.hpp", + "external/sources/boost/outcome/policy/terminate.hpp", + "external/sources/boost/outcome/policy/throw_bad_result_access.hpp", + "external/sources/boost/outcome/result.hpp", + "external/sources/boost/outcome/std_outcome.hpp", + "external/sources/boost/outcome/std_result.hpp", + "external/sources/boost/outcome/success_failure.hpp", + "external/sources/boost/outcome/trait.hpp", + "external/sources/boost/outcome/try.hpp", + "external/sources/boost/outcome/utils.hpp", + "external/sources/boost/parameter.hpp", + "external/sources/boost/parameter/are_tagged_arguments.hpp", + "external/sources/boost/parameter/aux_/always_true_predicate.hpp", + "external/sources/boost/parameter/aux_/arg_list.hpp", + "external/sources/boost/parameter/aux_/as_lvalue.hpp", + "external/sources/boost/parameter/aux_/augment_predicate.hpp", + "external/sources/boost/parameter/aux_/cast.hpp", + "external/sources/boost/parameter/aux_/default.hpp", + "external/sources/boost/parameter/aux_/has_nested_template_fn.hpp", + "external/sources/boost/parameter/aux_/is_maybe.hpp", + "external/sources/boost/parameter/aux_/is_placeholder.hpp", + "external/sources/boost/parameter/aux_/is_tagged_argument.hpp", + "external/sources/boost/parameter/aux_/lambda_tag.hpp", + "external/sources/boost/parameter/aux_/maybe.hpp", + "external/sources/boost/parameter/aux_/name.hpp", + "external/sources/boost/parameter/aux_/pack/as_parameter_requirements.hpp", + "external/sources/boost/parameter/aux_/pack/deduce_tag.hpp", + "external/sources/boost/parameter/aux_/pack/deduced_item.hpp", + "external/sources/boost/parameter/aux_/pack/insert_tagged.hpp", + "external/sources/boost/parameter/aux_/pack/is_named_argument.hpp", + "external/sources/boost/parameter/aux_/pack/item.hpp", + "external/sources/boost/parameter/aux_/pack/make_arg_list.hpp", + "external/sources/boost/parameter/aux_/pack/make_deduced_items.hpp", + "external/sources/boost/parameter/aux_/pack/make_items.hpp", + "external/sources/boost/parameter/aux_/pack/make_parameter_spec_items.hpp", + "external/sources/boost/parameter/aux_/pack/parameter_requirements.hpp", + "external/sources/boost/parameter/aux_/pack/predicate.hpp", + "external/sources/boost/parameter/aux_/pack/satisfies.hpp", + "external/sources/boost/parameter/aux_/pack/tag_deduced.hpp", + "external/sources/boost/parameter/aux_/pack/tag_keyword_arg.hpp", + "external/sources/boost/parameter/aux_/pack/tag_keyword_arg_ref.hpp", + "external/sources/boost/parameter/aux_/pack/tag_template_keyword_arg.hpp", + "external/sources/boost/parameter/aux_/pack/tag_type.hpp", + "external/sources/boost/parameter/aux_/pack/unmatched_argument.hpp", + "external/sources/boost/parameter/aux_/parameter_requirements.hpp", + "external/sources/boost/parameter/aux_/parenthesized_type.hpp", + "external/sources/boost/parameter/aux_/pp_impl/argument_pack.hpp", + "external/sources/boost/parameter/aux_/pp_impl/match.hpp", + "external/sources/boost/parameter/aux_/pp_impl/unwrap_predicate.hpp", + "external/sources/boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp", + "external/sources/boost/parameter/aux_/preprocessor/binary_seq_for_each_inc.hpp", + "external/sources/boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp", + "external/sources/boost/parameter/aux_/preprocessor/convert_binary_seq.hpp", + "external/sources/boost/parameter/aux_/preprocessor/flatten.hpp", + "external/sources/boost/parameter/aux_/preprocessor/for_each.hpp", + "external/sources/boost/parameter/aux_/preprocessor/for_each_pred.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/argument_specs.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/arity_range.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/flatten.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/for_each.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/forwarding_overloads.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/function_cast.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/function_dispatch_layer.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/function_dispatch_tuple.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/function_forward_match.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/function_name.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/no_spec_overloads.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/parenthesized_return_type.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/specification.hpp", + "external/sources/boost/parameter/aux_/preprocessor/impl/split_args.hpp", + "external/sources/boost/parameter/aux_/preprocessor/inc_binary_seq.hpp", + "external/sources/boost/parameter/aux_/preprocessor/is_binary.hpp", + "external/sources/boost/parameter/aux_/preprocessor/is_nullary.hpp", + "external/sources/boost/parameter/aux_/preprocessor/no_perfect_forwarding_begin.hpp", + "external/sources/boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp", + "external/sources/boost/parameter/aux_/preprocessor/nullptr.hpp", + "external/sources/boost/parameter/aux_/preprocessor/overloads.hpp", + "external/sources/boost/parameter/aux_/preprocessor/qualifier.hpp", + "external/sources/boost/parameter/aux_/preprocessor/seq_enum.hpp", + "external/sources/boost/parameter/aux_/preprocessor/seq_merge.hpp", + "external/sources/boost/parameter/aux_/python/invoker.hpp", + "external/sources/boost/parameter/aux_/python/invoker_iterate.hpp", + "external/sources/boost/parameter/aux_/result_of0.hpp", + "external/sources/boost/parameter/aux_/set.hpp", + "external/sources/boost/parameter/aux_/tag.hpp", + "external/sources/boost/parameter/aux_/tagged_argument.hpp", + "external/sources/boost/parameter/aux_/tagged_argument_fwd.hpp", + "external/sources/boost/parameter/aux_/template_keyword.hpp", + "external/sources/boost/parameter/aux_/unwrap_cv_reference.hpp", + "external/sources/boost/parameter/aux_/use_default.hpp", + "external/sources/boost/parameter/aux_/use_default_tag.hpp", + "external/sources/boost/parameter/aux_/void.hpp", + "external/sources/boost/parameter/aux_/yesno.hpp", + "external/sources/boost/parameter/binding.hpp", + "external/sources/boost/parameter/compose.hpp", + "external/sources/boost/parameter/config.hpp", + "external/sources/boost/parameter/deduced.hpp", + "external/sources/boost/parameter/is_argument_pack.hpp", + "external/sources/boost/parameter/keyword.hpp", + "external/sources/boost/parameter/keyword_fwd.hpp", + "external/sources/boost/parameter/macros.hpp", + "external/sources/boost/parameter/match.hpp", + "external/sources/boost/parameter/name.hpp", + "external/sources/boost/parameter/nested_keyword.hpp", + "external/sources/boost/parameter/optional.hpp", + "external/sources/boost/parameter/parameters.hpp", + "external/sources/boost/parameter/preprocessor.hpp", + "external/sources/boost/parameter/preprocessor_no_spec.hpp", + "external/sources/boost/parameter/python.hpp", + "external/sources/boost/parameter/required.hpp", + "external/sources/boost/parameter/template_keyword.hpp", + "external/sources/boost/parameter/value_type.hpp", + "external/sources/boost/pending/bucket_sorter.hpp", + "external/sources/boost/pending/container_traits.hpp", + "external/sources/boost/pending/detail/disjoint_sets.hpp", + "external/sources/boost/pending/detail/int_iterator.hpp", + "external/sources/boost/pending/detail/property.hpp", + "external/sources/boost/pending/disjoint_sets.hpp", + "external/sources/boost/pending/fenced_priority_queue.hpp", + "external/sources/boost/pending/fibonacci_heap.hpp", + "external/sources/boost/pending/indirect_cmp.hpp", + "external/sources/boost/pending/integer_log2.hpp", + "external/sources/boost/pending/is_heap.hpp", + "external/sources/boost/pending/iterator_adaptors.hpp", + "external/sources/boost/pending/iterator_tests.hpp", + "external/sources/boost/pending/mutable_heap.hpp", + "external/sources/boost/pending/mutable_queue.hpp", + "external/sources/boost/pending/property.hpp", + "external/sources/boost/pending/property_serialize.hpp", + "external/sources/boost/pending/queue.hpp", + "external/sources/boost/pending/relaxed_heap.hpp", + "external/sources/boost/pending/stringtok.hpp", + "external/sources/boost/phoenix.hpp", + "external/sources/boost/phoenix/bind.hpp", + "external/sources/boost/phoenix/bind/bind_function.hpp", + "external/sources/boost/phoenix/bind/bind_function_object.hpp", + "external/sources/boost/phoenix/bind/bind_member_function.hpp", + "external/sources/boost/phoenix/bind/bind_member_variable.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/bind_function.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/bind_function_object.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/bind_member_function.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/function_ptr.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/member_function_ptr.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_10.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_20.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_30.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_40.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_50.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_10.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_20.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_30.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_40.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_object_50.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_10.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_20.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_30.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_40.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_50.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/function_ptr.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/function_ptr_10.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/function_ptr_20.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/function_ptr_30.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/function_ptr_40.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/function_ptr_50.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr_10.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr_20.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr_30.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr_40.hpp", + "external/sources/boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr_50.hpp", + "external/sources/boost/phoenix/bind/detail/member_variable.hpp", + "external/sources/boost/phoenix/config.hpp", + "external/sources/boost/phoenix/core.hpp", + "external/sources/boost/phoenix/core/actor.hpp", + "external/sources/boost/phoenix/core/argument.hpp", + "external/sources/boost/phoenix/core/arity.hpp", + "external/sources/boost/phoenix/core/as_actor.hpp", + "external/sources/boost/phoenix/core/call.hpp", + "external/sources/boost/phoenix/core/debug.hpp", + "external/sources/boost/phoenix/core/detail/argument.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/actor_operator.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/actor_result_of.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/call.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/expression.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/function_eval.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/function_eval_expr.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_operator.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_operator_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_operator_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_operator_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_operator_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_operator_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/actor_result_of_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/call.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/call_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/call_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/call_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/call_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/call_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/expression.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/expression_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/expression_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/expression_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/expression_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/expression_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_50.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_10.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_20.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_30.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_40.hpp", + "external/sources/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_50.hpp", + "external/sources/boost/phoenix/core/detail/expression.hpp", + "external/sources/boost/phoenix/core/detail/function_eval.hpp", + "external/sources/boost/phoenix/core/detail/index_sequence.hpp", + "external/sources/boost/phoenix/core/domain.hpp", + "external/sources/boost/phoenix/core/environment.hpp", + "external/sources/boost/phoenix/core/expression.hpp", + "external/sources/boost/phoenix/core/function_equal.hpp", + "external/sources/boost/phoenix/core/is_actor.hpp", + "external/sources/boost/phoenix/core/is_nullary.hpp", + "external/sources/boost/phoenix/core/is_value.hpp", + "external/sources/boost/phoenix/core/limits.hpp", + "external/sources/boost/phoenix/core/meta_grammar.hpp", + "external/sources/boost/phoenix/core/nothing.hpp", + "external/sources/boost/phoenix/core/reference.hpp", + "external/sources/boost/phoenix/core/terminal.hpp", + "external/sources/boost/phoenix/core/terminal_fwd.hpp", + "external/sources/boost/phoenix/core/v2_eval.hpp", + "external/sources/boost/phoenix/core/value.hpp", + "external/sources/boost/phoenix/debug.hpp", + "external/sources/boost/phoenix/function.hpp", + "external/sources/boost/phoenix/function/adapt_callable.hpp", + "external/sources/boost/phoenix/function/adapt_function.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/function_operator.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/preprocessed/function_operator.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/preprocessed/function_operator_10.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/preprocessed/function_operator_20.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/preprocessed/function_operator_30.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/preprocessed/function_operator_40.hpp", + "external/sources/boost/phoenix/function/detail/cpp03/preprocessed/function_operator_50.hpp", + "external/sources/boost/phoenix/function/function.hpp", + "external/sources/boost/phoenix/function/lazy_list.hpp", + "external/sources/boost/phoenix/function/lazy_operator.hpp", + "external/sources/boost/phoenix/function/lazy_prelude.hpp", + "external/sources/boost/phoenix/function/lazy_reuse.hpp", + "external/sources/boost/phoenix/function/lazy_signature.hpp", + "external/sources/boost/phoenix/function/lazy_smart.hpp", + "external/sources/boost/phoenix/fusion.hpp", + "external/sources/boost/phoenix/fusion/at.hpp", + "external/sources/boost/phoenix/object.hpp", + "external/sources/boost/phoenix/object/const_cast.hpp", + "external/sources/boost/phoenix/object/construct.hpp", + "external/sources/boost/phoenix/object/delete.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/construct.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/construct_eval.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/construct_expr.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/new.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/new_eval.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/new_expr.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_10.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_20.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_30.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_40.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_50.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_eval.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_10.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_20.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_30.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_40.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_eval_50.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_10.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_20.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_30.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_40.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_50.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_10.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_20.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_30.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_40.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_50.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_eval.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_eval_10.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_eval_20.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_eval_30.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_eval_40.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_eval_50.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_expr.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_10.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_20.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_30.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_40.hpp", + "external/sources/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_50.hpp", + "external/sources/boost/phoenix/object/detail/target.hpp", + "external/sources/boost/phoenix/object/dynamic_cast.hpp", + "external/sources/boost/phoenix/object/new.hpp", + "external/sources/boost/phoenix/object/reinterpret_cast.hpp", + "external/sources/boost/phoenix/object/static_cast.hpp", + "external/sources/boost/phoenix/operator.hpp", + "external/sources/boost/phoenix/operator/arithmetic.hpp", + "external/sources/boost/phoenix/operator/bitwise.hpp", + "external/sources/boost/phoenix/operator/comparison.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/mem_fun_ptr_eval.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/mem_fun_ptr_eval_result_of.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/mem_fun_ptr_expr.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/mem_fun_ptr_gen.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_10.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_20.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_30.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_40.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_50.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of_10.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of_20.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of_30.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of_40.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of_50.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr_10.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr_20.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr_30.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr_40.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr_50.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_10.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_20.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_30.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_40.hpp", + "external/sources/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_50.hpp", + "external/sources/boost/phoenix/operator/detail/define_operator.hpp", + "external/sources/boost/phoenix/operator/detail/undef_operator.hpp", + "external/sources/boost/phoenix/operator/if_else.hpp", + "external/sources/boost/phoenix/operator/io.hpp", + "external/sources/boost/phoenix/operator/logical.hpp", + "external/sources/boost/phoenix/operator/member.hpp", + "external/sources/boost/phoenix/operator/self.hpp", + "external/sources/boost/phoenix/phoenix.hpp", + "external/sources/boost/phoenix/scope.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/dynamic.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/lambda.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/local_gen.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/dynamic.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/dynamic_10.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/dynamic_20.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/dynamic_30.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/dynamic_40.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/dynamic_50.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/lambda.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/lambda_10.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/lambda_20.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/lambda_30.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/lambda_40.hpp", + "external/sources/boost/phoenix/scope/detail/cpp03/preprocessed/lambda_50.hpp", + "external/sources/boost/phoenix/scope/detail/local_gen.hpp", + "external/sources/boost/phoenix/scope/detail/local_variable.hpp", + "external/sources/boost/phoenix/scope/dynamic.hpp", + "external/sources/boost/phoenix/scope/lambda.hpp", + "external/sources/boost/phoenix/scope/let.hpp", + "external/sources/boost/phoenix/scope/local_variable.hpp", + "external/sources/boost/phoenix/scope/scoped_environment.hpp", + "external/sources/boost/phoenix/scope/this.hpp", + "external/sources/boost/phoenix/statement.hpp", + "external/sources/boost/phoenix/statement/detail/catch_push_back.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/catch_push_back.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/catch_push_back_10.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/catch_push_back_20.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/catch_push_back_30.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/catch_push_back_40.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/catch_push_back_50.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/switch.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/switch_10.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/switch_20.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/switch_30.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/switch_40.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/switch_50.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_eval.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_eval_10.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_eval_20.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_eval_30.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_eval_40.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_eval_50.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_expression.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_expression_10.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_expression_20.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_expression_30.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_expression_40.hpp", + "external/sources/boost/phoenix/statement/detail/preprocessed/try_catch_expression_50.hpp", + "external/sources/boost/phoenix/statement/detail/switch.hpp", + "external/sources/boost/phoenix/statement/detail/try_catch_eval.hpp", + "external/sources/boost/phoenix/statement/detail/try_catch_expression.hpp", + "external/sources/boost/phoenix/statement/do_while.hpp", + "external/sources/boost/phoenix/statement/for.hpp", + "external/sources/boost/phoenix/statement/if.hpp", + "external/sources/boost/phoenix/statement/sequence.hpp", + "external/sources/boost/phoenix/statement/switch.hpp", + "external/sources/boost/phoenix/statement/throw.hpp", + "external/sources/boost/phoenix/statement/try_catch.hpp", + "external/sources/boost/phoenix/statement/while.hpp", + "external/sources/boost/phoenix/stl.hpp", + "external/sources/boost/phoenix/stl/algorithm.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/begin.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/decay_array.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/end.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_equal_range.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_find.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_lower_bound.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_remove.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_remove_if.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_reverse.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_sort.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_unique.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/has_upper_bound.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/is_std_hash_map.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/is_std_hash_set.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/is_std_list.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/is_std_map.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/is_std_set.hpp", + "external/sources/boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp", + "external/sources/boost/phoenix/stl/algorithm/iteration.hpp", + "external/sources/boost/phoenix/stl/algorithm/querying.hpp", + "external/sources/boost/phoenix/stl/algorithm/transformation.hpp", + "external/sources/boost/phoenix/stl/cmath.hpp", + "external/sources/boost/phoenix/stl/container.hpp", + "external/sources/boost/phoenix/stl/container/container.hpp", + "external/sources/boost/phoenix/stl/container/detail/container.hpp", + "external/sources/boost/phoenix/support/detail/iterate.hpp", + "external/sources/boost/phoenix/support/detail/iterate_define.hpp", + "external/sources/boost/phoenix/support/detail/iterate_undef.hpp", + "external/sources/boost/phoenix/support/iterate.hpp", + "external/sources/boost/phoenix/support/preprocessed/vector.hpp", + "external/sources/boost/phoenix/support/preprocessed/vector_10.hpp", + "external/sources/boost/phoenix/support/preprocessed/vector_20.hpp", + "external/sources/boost/phoenix/support/preprocessed/vector_30.hpp", + "external/sources/boost/phoenix/support/preprocessed/vector_40.hpp", + "external/sources/boost/phoenix/support/preprocessed/vector_50.hpp", + "external/sources/boost/phoenix/support/preprocessor/round.hpp", + "external/sources/boost/phoenix/support/vector.hpp", + "external/sources/boost/phoenix/version.hpp", + "external/sources/boost/pointee.hpp", + "external/sources/boost/pointer_cast.hpp", + "external/sources/boost/pointer_to_other.hpp", + "external/sources/boost/poly_collection/algorithm.hpp", + "external/sources/boost/poly_collection/any_collection.hpp", + "external/sources/boost/poly_collection/any_collection_fwd.hpp", + "external/sources/boost/poly_collection/base_collection.hpp", + "external/sources/boost/poly_collection/base_collection_fwd.hpp", + "external/sources/boost/poly_collection/detail/allocator_adaptor.hpp", + "external/sources/boost/poly_collection/detail/any_iterator.hpp", + "external/sources/boost/poly_collection/detail/any_model.hpp", + "external/sources/boost/poly_collection/detail/auto_iterator.hpp", + "external/sources/boost/poly_collection/detail/base_model.hpp", + "external/sources/boost/poly_collection/detail/callable_wrapper.hpp", + "external/sources/boost/poly_collection/detail/callable_wrapper_iterator.hpp", + "external/sources/boost/poly_collection/detail/function_model.hpp", + "external/sources/boost/poly_collection/detail/functional.hpp", + "external/sources/boost/poly_collection/detail/is_acceptable.hpp", + "external/sources/boost/poly_collection/detail/is_constructible.hpp", + "external/sources/boost/poly_collection/detail/is_equality_comparable.hpp", + "external/sources/boost/poly_collection/detail/is_final.hpp", + "external/sources/boost/poly_collection/detail/is_invocable.hpp", + "external/sources/boost/poly_collection/detail/is_nothrow_eq_comparable.hpp", + "external/sources/boost/poly_collection/detail/iterator_impl.hpp", + "external/sources/boost/poly_collection/detail/iterator_traits.hpp", + "external/sources/boost/poly_collection/detail/packed_segment.hpp", + "external/sources/boost/poly_collection/detail/poly_collection.hpp", + "external/sources/boost/poly_collection/detail/segment.hpp", + "external/sources/boost/poly_collection/detail/segment_backend.hpp", + "external/sources/boost/poly_collection/detail/segment_split.hpp", + "external/sources/boost/poly_collection/detail/split_segment.hpp", + "external/sources/boost/poly_collection/detail/stride_iterator.hpp", + "external/sources/boost/poly_collection/detail/type_info_map.hpp", + "external/sources/boost/poly_collection/detail/type_restitution.hpp", + "external/sources/boost/poly_collection/detail/value_holder.hpp", + "external/sources/boost/poly_collection/exception.hpp", + "external/sources/boost/poly_collection/function_collection.hpp", + "external/sources/boost/poly_collection/function_collection_fwd.hpp", + "external/sources/boost/polygon/detail/boolean_op.hpp", + "external/sources/boost/polygon/detail/boolean_op_45.hpp", + "external/sources/boost/polygon/detail/iterator_compact_to_points.hpp", + "external/sources/boost/polygon/detail/iterator_geometry_to_set.hpp", + "external/sources/boost/polygon/detail/iterator_points_to_compact.hpp", + "external/sources/boost/polygon/detail/max_cover.hpp", + "external/sources/boost/polygon/detail/minkowski.hpp", + "external/sources/boost/polygon/detail/polygon_45_formation.hpp", + "external/sources/boost/polygon/detail/polygon_45_set_view.hpp", + "external/sources/boost/polygon/detail/polygon_45_touch.hpp", + "external/sources/boost/polygon/detail/polygon_90_set_view.hpp", + "external/sources/boost/polygon/detail/polygon_90_touch.hpp", + "external/sources/boost/polygon/detail/polygon_arbitrary_formation.hpp", + "external/sources/boost/polygon/detail/polygon_formation.hpp", + "external/sources/boost/polygon/detail/polygon_set_view.hpp", + "external/sources/boost/polygon/detail/polygon_simplify.hpp", + "external/sources/boost/polygon/detail/polygon_sort_adaptor.hpp", + "external/sources/boost/polygon/detail/property_merge.hpp", + "external/sources/boost/polygon/detail/property_merge_45.hpp", + "external/sources/boost/polygon/detail/rectangle_formation.hpp", + "external/sources/boost/polygon/detail/scan_arbitrary.hpp", + "external/sources/boost/polygon/detail/voronoi_ctypes.hpp", + "external/sources/boost/polygon/detail/voronoi_predicates.hpp", + "external/sources/boost/polygon/detail/voronoi_robust_fpt.hpp", + "external/sources/boost/polygon/detail/voronoi_structures.hpp", + "external/sources/boost/polygon/gmp_override.hpp", + "external/sources/boost/polygon/gtl.hpp", + "external/sources/boost/polygon/interval_concept.hpp", + "external/sources/boost/polygon/interval_data.hpp", + "external/sources/boost/polygon/interval_traits.hpp", + "external/sources/boost/polygon/isotropy.hpp", + "external/sources/boost/polygon/point_concept.hpp", + "external/sources/boost/polygon/point_data.hpp", + "external/sources/boost/polygon/point_traits.hpp", + "external/sources/boost/polygon/polygon.hpp", + "external/sources/boost/polygon/polygon_45_data.hpp", + "external/sources/boost/polygon/polygon_45_set_concept.hpp", + "external/sources/boost/polygon/polygon_45_set_data.hpp", + "external/sources/boost/polygon/polygon_45_set_traits.hpp", + "external/sources/boost/polygon/polygon_45_with_holes_data.hpp", + "external/sources/boost/polygon/polygon_90_data.hpp", + "external/sources/boost/polygon/polygon_90_set_concept.hpp", + "external/sources/boost/polygon/polygon_90_set_data.hpp", + "external/sources/boost/polygon/polygon_90_set_traits.hpp", + "external/sources/boost/polygon/polygon_90_with_holes_data.hpp", + "external/sources/boost/polygon/polygon_data.hpp", + "external/sources/boost/polygon/polygon_set_concept.hpp", + "external/sources/boost/polygon/polygon_set_data.hpp", + "external/sources/boost/polygon/polygon_set_traits.hpp", + "external/sources/boost/polygon/polygon_traits.hpp", + "external/sources/boost/polygon/polygon_with_holes_data.hpp", + "external/sources/boost/polygon/rectangle_concept.hpp", + "external/sources/boost/polygon/rectangle_data.hpp", + "external/sources/boost/polygon/rectangle_traits.hpp", + "external/sources/boost/polygon/segment_concept.hpp", + "external/sources/boost/polygon/segment_data.hpp", + "external/sources/boost/polygon/segment_traits.hpp", + "external/sources/boost/polygon/segment_utils.hpp", + "external/sources/boost/polygon/transform.hpp", + "external/sources/boost/polygon/voronoi.hpp", + "external/sources/boost/polygon/voronoi_builder.hpp", + "external/sources/boost/polygon/voronoi_diagram.hpp", + "external/sources/boost/polygon/voronoi_geometry_type.hpp", + "external/sources/boost/polymorphic_cast.hpp", + "external/sources/boost/polymorphic_pointer_cast.hpp", + "external/sources/boost/pool/detail/for.m4", + "external/sources/boost/pool/detail/guard.hpp", + "external/sources/boost/pool/detail/mutex.hpp", + "external/sources/boost/pool/detail/pool_construct.bat", + "external/sources/boost/pool/detail/pool_construct.ipp", + "external/sources/boost/pool/detail/pool_construct.m4", + "external/sources/boost/pool/detail/pool_construct.sh", + "external/sources/boost/pool/detail/pool_construct_simple.bat", + "external/sources/boost/pool/detail/pool_construct_simple.ipp", + "external/sources/boost/pool/detail/pool_construct_simple.m4", + "external/sources/boost/pool/detail/pool_construct_simple.sh", + "external/sources/boost/pool/object_pool.hpp", + "external/sources/boost/pool/pool.hpp", + "external/sources/boost/pool/pool_alloc.hpp", + "external/sources/boost/pool/poolfwd.hpp", + "external/sources/boost/pool/simple_segregated_storage.hpp", + "external/sources/boost/pool/singleton_pool.hpp", + "external/sources/boost/predef.h", + "external/sources/boost/predef/architecture.h", + "external/sources/boost/predef/architecture/alpha.h", + "external/sources/boost/predef/architecture/arm.h", + "external/sources/boost/predef/architecture/blackfin.h", + "external/sources/boost/predef/architecture/convex.h", + "external/sources/boost/predef/architecture/ia64.h", + "external/sources/boost/predef/architecture/m68k.h", + "external/sources/boost/predef/architecture/mips.h", + "external/sources/boost/predef/architecture/parisc.h", + "external/sources/boost/predef/architecture/ppc.h", + "external/sources/boost/predef/architecture/ptx.h", + "external/sources/boost/predef/architecture/pyramid.h", + "external/sources/boost/predef/architecture/riscv.h", + "external/sources/boost/predef/architecture/rs6k.h", + "external/sources/boost/predef/architecture/sparc.h", + "external/sources/boost/predef/architecture/superh.h", + "external/sources/boost/predef/architecture/sys370.h", + "external/sources/boost/predef/architecture/sys390.h", + "external/sources/boost/predef/architecture/x86.h", + "external/sources/boost/predef/architecture/x86/32.h", + "external/sources/boost/predef/architecture/x86/64.h", + "external/sources/boost/predef/architecture/z.h", + "external/sources/boost/predef/compiler.h", + "external/sources/boost/predef/compiler/borland.h", + "external/sources/boost/predef/compiler/clang.h", + "external/sources/boost/predef/compiler/comeau.h", + "external/sources/boost/predef/compiler/compaq.h", + "external/sources/boost/predef/compiler/diab.h", + "external/sources/boost/predef/compiler/digitalmars.h", + "external/sources/boost/predef/compiler/dignus.h", + "external/sources/boost/predef/compiler/edg.h", + "external/sources/boost/predef/compiler/ekopath.h", + "external/sources/boost/predef/compiler/gcc.h", + "external/sources/boost/predef/compiler/gcc_xml.h", + "external/sources/boost/predef/compiler/greenhills.h", + "external/sources/boost/predef/compiler/hp_acc.h", + "external/sources/boost/predef/compiler/iar.h", + "external/sources/boost/predef/compiler/ibm.h", + "external/sources/boost/predef/compiler/intel.h", + "external/sources/boost/predef/compiler/kai.h", + "external/sources/boost/predef/compiler/llvm.h", + "external/sources/boost/predef/compiler/metaware.h", + "external/sources/boost/predef/compiler/metrowerks.h", + "external/sources/boost/predef/compiler/microtec.h", + "external/sources/boost/predef/compiler/mpw.h", + "external/sources/boost/predef/compiler/nvcc.h", + "external/sources/boost/predef/compiler/palm.h", + "external/sources/boost/predef/compiler/pgi.h", + "external/sources/boost/predef/compiler/sgi_mipspro.h", + "external/sources/boost/predef/compiler/sunpro.h", + "external/sources/boost/predef/compiler/tendra.h", + "external/sources/boost/predef/compiler/visualc.h", + "external/sources/boost/predef/compiler/watcom.h", + "external/sources/boost/predef/detail/_cassert.h", + "external/sources/boost/predef/detail/_exception.h", + "external/sources/boost/predef/detail/comp_detected.h", + "external/sources/boost/predef/detail/os_detected.h", + "external/sources/boost/predef/detail/platform_detected.h", + "external/sources/boost/predef/detail/test.h", + "external/sources/boost/predef/detail/test_def.h", + "external/sources/boost/predef/hardware.h", + "external/sources/boost/predef/hardware/simd.h", + "external/sources/boost/predef/hardware/simd/arm.h", + "external/sources/boost/predef/hardware/simd/arm/versions.h", + "external/sources/boost/predef/hardware/simd/ppc.h", + "external/sources/boost/predef/hardware/simd/ppc/versions.h", + "external/sources/boost/predef/hardware/simd/x86.h", + "external/sources/boost/predef/hardware/simd/x86/versions.h", + "external/sources/boost/predef/hardware/simd/x86_amd.h", + "external/sources/boost/predef/hardware/simd/x86_amd/versions.h", + "external/sources/boost/predef/language.h", + "external/sources/boost/predef/language/cuda.h", + "external/sources/boost/predef/language/objc.h", + "external/sources/boost/predef/language/stdc.h", + "external/sources/boost/predef/language/stdcpp.h", + "external/sources/boost/predef/library.h", + "external/sources/boost/predef/library/c.h", + "external/sources/boost/predef/library/c/_prefix.h", + "external/sources/boost/predef/library/c/cloudabi.h", + "external/sources/boost/predef/library/c/gnu.h", + "external/sources/boost/predef/library/c/uc.h", + "external/sources/boost/predef/library/c/vms.h", + "external/sources/boost/predef/library/c/zos.h", + "external/sources/boost/predef/library/std.h", + "external/sources/boost/predef/library/std/_prefix.h", + "external/sources/boost/predef/library/std/cxx.h", + "external/sources/boost/predef/library/std/dinkumware.h", + "external/sources/boost/predef/library/std/libcomo.h", + "external/sources/boost/predef/library/std/modena.h", + "external/sources/boost/predef/library/std/msl.h", + "external/sources/boost/predef/library/std/roguewave.h", + "external/sources/boost/predef/library/std/sgi.h", + "external/sources/boost/predef/library/std/stdcpp3.h", + "external/sources/boost/predef/library/std/stlport.h", + "external/sources/boost/predef/library/std/vacpp.h", + "external/sources/boost/predef/make.h", + "external/sources/boost/predef/os.h", + "external/sources/boost/predef/os/aix.h", + "external/sources/boost/predef/os/amigaos.h", + "external/sources/boost/predef/os/beos.h", + "external/sources/boost/predef/os/bsd.h", + "external/sources/boost/predef/os/bsd/bsdi.h", + "external/sources/boost/predef/os/bsd/dragonfly.h", + "external/sources/boost/predef/os/bsd/free.h", + "external/sources/boost/predef/os/bsd/net.h", + "external/sources/boost/predef/os/bsd/open.h", + "external/sources/boost/predef/os/cygwin.h", + "external/sources/boost/predef/os/haiku.h", + "external/sources/boost/predef/os/hpux.h", + "external/sources/boost/predef/os/ios.h", + "external/sources/boost/predef/os/irix.h", + "external/sources/boost/predef/os/linux.h", + "external/sources/boost/predef/os/macos.h", + "external/sources/boost/predef/os/os400.h", + "external/sources/boost/predef/os/qnxnto.h", + "external/sources/boost/predef/os/solaris.h", + "external/sources/boost/predef/os/unix.h", + "external/sources/boost/predef/os/vms.h", + "external/sources/boost/predef/os/windows.h", + "external/sources/boost/predef/other.h", + "external/sources/boost/predef/other/endian.h", + "external/sources/boost/predef/other/workaround.h", + "external/sources/boost/predef/platform.h", + "external/sources/boost/predef/platform/android.h", + "external/sources/boost/predef/platform/cloudabi.h", + "external/sources/boost/predef/platform/ios.h", + "external/sources/boost/predef/platform/mingw.h", + "external/sources/boost/predef/platform/mingw32.h", + "external/sources/boost/predef/platform/mingw64.h", + "external/sources/boost/predef/platform/windows_desktop.h", + "external/sources/boost/predef/platform/windows_phone.h", + "external/sources/boost/predef/platform/windows_runtime.h", + "external/sources/boost/predef/platform/windows_server.h", + "external/sources/boost/predef/platform/windows_store.h", + "external/sources/boost/predef/platform/windows_system.h", + "external/sources/boost/predef/platform/windows_uwp.h", + "external/sources/boost/predef/version.h", + "external/sources/boost/predef/version_number.h", + "external/sources/boost/preprocessor.hpp", + "external/sources/boost/preprocessor/arithmetic.hpp", + "external/sources/boost/preprocessor/arithmetic/add.hpp", + "external/sources/boost/preprocessor/arithmetic/dec.hpp", + "external/sources/boost/preprocessor/arithmetic/detail/div_base.hpp", + "external/sources/boost/preprocessor/arithmetic/div.hpp", + "external/sources/boost/preprocessor/arithmetic/inc.hpp", + "external/sources/boost/preprocessor/arithmetic/mod.hpp", + "external/sources/boost/preprocessor/arithmetic/mul.hpp", + "external/sources/boost/preprocessor/arithmetic/sub.hpp", + "external/sources/boost/preprocessor/array.hpp", + "external/sources/boost/preprocessor/array/data.hpp", + "external/sources/boost/preprocessor/array/detail/get_data.hpp", + "external/sources/boost/preprocessor/array/elem.hpp", + "external/sources/boost/preprocessor/array/enum.hpp", + "external/sources/boost/preprocessor/array/insert.hpp", + "external/sources/boost/preprocessor/array/pop_back.hpp", + "external/sources/boost/preprocessor/array/pop_front.hpp", + "external/sources/boost/preprocessor/array/push_back.hpp", + "external/sources/boost/preprocessor/array/push_front.hpp", + "external/sources/boost/preprocessor/array/remove.hpp", + "external/sources/boost/preprocessor/array/replace.hpp", + "external/sources/boost/preprocessor/array/reverse.hpp", + "external/sources/boost/preprocessor/array/size.hpp", + "external/sources/boost/preprocessor/array/to_list.hpp", + "external/sources/boost/preprocessor/array/to_seq.hpp", + "external/sources/boost/preprocessor/array/to_tuple.hpp", + "external/sources/boost/preprocessor/assert_msg.hpp", + "external/sources/boost/preprocessor/cat.hpp", + "external/sources/boost/preprocessor/comma.hpp", + "external/sources/boost/preprocessor/comma_if.hpp", + "external/sources/boost/preprocessor/comparison.hpp", + "external/sources/boost/preprocessor/comparison/equal.hpp", + "external/sources/boost/preprocessor/comparison/greater.hpp", + "external/sources/boost/preprocessor/comparison/greater_equal.hpp", + "external/sources/boost/preprocessor/comparison/less.hpp", + "external/sources/boost/preprocessor/comparison/less_equal.hpp", + "external/sources/boost/preprocessor/comparison/not_equal.hpp", + "external/sources/boost/preprocessor/config/config.hpp", + "external/sources/boost/preprocessor/config/limits.hpp", + "external/sources/boost/preprocessor/control.hpp", + "external/sources/boost/preprocessor/control/deduce_d.hpp", + "external/sources/boost/preprocessor/control/detail/dmc/while.hpp", + "external/sources/boost/preprocessor/control/detail/edg/while.hpp", + "external/sources/boost/preprocessor/control/detail/msvc/while.hpp", + "external/sources/boost/preprocessor/control/detail/while.hpp", + "external/sources/boost/preprocessor/control/expr_if.hpp", + "external/sources/boost/preprocessor/control/expr_iif.hpp", + "external/sources/boost/preprocessor/control/if.hpp", + "external/sources/boost/preprocessor/control/iif.hpp", + "external/sources/boost/preprocessor/control/while.hpp", + "external/sources/boost/preprocessor/debug.hpp", + "external/sources/boost/preprocessor/dec.hpp", + "external/sources/boost/preprocessor/detail/auto_rec.hpp", + "external/sources/boost/preprocessor/detail/check.hpp", + "external/sources/boost/preprocessor/detail/dmc/auto_rec.hpp", + "external/sources/boost/preprocessor/detail/is_binary.hpp", + "external/sources/boost/preprocessor/detail/is_nullary.hpp", + "external/sources/boost/preprocessor/detail/is_unary.hpp", + "external/sources/boost/preprocessor/detail/null.hpp", + "external/sources/boost/preprocessor/detail/split.hpp", + "external/sources/boost/preprocessor/empty.hpp", + "external/sources/boost/preprocessor/enum.hpp", + "external/sources/boost/preprocessor/enum_params.hpp", + "external/sources/boost/preprocessor/enum_params_with_a_default.hpp", + "external/sources/boost/preprocessor/enum_params_with_defaults.hpp", + "external/sources/boost/preprocessor/enum_shifted.hpp", + "external/sources/boost/preprocessor/enum_shifted_params.hpp", + "external/sources/boost/preprocessor/expand.hpp", + "external/sources/boost/preprocessor/expr_if.hpp", + "external/sources/boost/preprocessor/facilities.hpp", + "external/sources/boost/preprocessor/facilities/apply.hpp", + "external/sources/boost/preprocessor/facilities/check_empty.hpp", + "external/sources/boost/preprocessor/facilities/detail/is_empty.hpp", + "external/sources/boost/preprocessor/facilities/empty.hpp", + "external/sources/boost/preprocessor/facilities/expand.hpp", + "external/sources/boost/preprocessor/facilities/identity.hpp", + "external/sources/boost/preprocessor/facilities/intercept.hpp", + "external/sources/boost/preprocessor/facilities/is_1.hpp", + "external/sources/boost/preprocessor/facilities/is_empty.hpp", + "external/sources/boost/preprocessor/facilities/is_empty_or_1.hpp", + "external/sources/boost/preprocessor/facilities/is_empty_variadic.hpp", + "external/sources/boost/preprocessor/facilities/overload.hpp", + "external/sources/boost/preprocessor/facilities/va_opt.hpp", + "external/sources/boost/preprocessor/for.hpp", + "external/sources/boost/preprocessor/identity.hpp", + "external/sources/boost/preprocessor/if.hpp", + "external/sources/boost/preprocessor/inc.hpp", + "external/sources/boost/preprocessor/iterate.hpp", + "external/sources/boost/preprocessor/iteration.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/lower1.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/lower2.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/lower3.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/lower4.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/lower5.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/upper1.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/upper2.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/upper3.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/upper4.hpp", + "external/sources/boost/preprocessor/iteration/detail/bounds/upper5.hpp", + "external/sources/boost/preprocessor/iteration/detail/finish.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/forward1.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/forward2.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/forward3.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/forward4.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/forward5.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/reverse1.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/reverse2.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/reverse3.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/reverse4.hpp", + "external/sources/boost/preprocessor/iteration/detail/iter/reverse5.hpp", + "external/sources/boost/preprocessor/iteration/detail/local.hpp", + "external/sources/boost/preprocessor/iteration/detail/rlocal.hpp", + "external/sources/boost/preprocessor/iteration/detail/self.hpp", + "external/sources/boost/preprocessor/iteration/detail/start.hpp", + "external/sources/boost/preprocessor/iteration/iterate.hpp", + "external/sources/boost/preprocessor/iteration/local.hpp", + "external/sources/boost/preprocessor/iteration/self.hpp", + "external/sources/boost/preprocessor/library.hpp", + "external/sources/boost/preprocessor/limits.hpp", + "external/sources/boost/preprocessor/list.hpp", + "external/sources/boost/preprocessor/list/adt.hpp", + "external/sources/boost/preprocessor/list/append.hpp", + "external/sources/boost/preprocessor/list/at.hpp", + "external/sources/boost/preprocessor/list/cat.hpp", + "external/sources/boost/preprocessor/list/detail/dmc/fold_left.hpp", + "external/sources/boost/preprocessor/list/detail/edg/fold_left.hpp", + "external/sources/boost/preprocessor/list/detail/edg/fold_right.hpp", + "external/sources/boost/preprocessor/list/detail/fold_left.hpp", + "external/sources/boost/preprocessor/list/detail/fold_right.hpp", + "external/sources/boost/preprocessor/list/enum.hpp", + "external/sources/boost/preprocessor/list/filter.hpp", + "external/sources/boost/preprocessor/list/first_n.hpp", + "external/sources/boost/preprocessor/list/fold_left.hpp", + "external/sources/boost/preprocessor/list/fold_right.hpp", + "external/sources/boost/preprocessor/list/for_each.hpp", + "external/sources/boost/preprocessor/list/for_each_i.hpp", + "external/sources/boost/preprocessor/list/for_each_product.hpp", + "external/sources/boost/preprocessor/list/rest_n.hpp", + "external/sources/boost/preprocessor/list/reverse.hpp", + "external/sources/boost/preprocessor/list/size.hpp", + "external/sources/boost/preprocessor/list/to_array.hpp", + "external/sources/boost/preprocessor/list/to_seq.hpp", + "external/sources/boost/preprocessor/list/to_tuple.hpp", + "external/sources/boost/preprocessor/list/transform.hpp", + "external/sources/boost/preprocessor/logical.hpp", + "external/sources/boost/preprocessor/logical/and.hpp", + "external/sources/boost/preprocessor/logical/bitand.hpp", + "external/sources/boost/preprocessor/logical/bitnor.hpp", + "external/sources/boost/preprocessor/logical/bitor.hpp", + "external/sources/boost/preprocessor/logical/bitxor.hpp", + "external/sources/boost/preprocessor/logical/bool.hpp", + "external/sources/boost/preprocessor/logical/compl.hpp", + "external/sources/boost/preprocessor/logical/nor.hpp", + "external/sources/boost/preprocessor/logical/not.hpp", + "external/sources/boost/preprocessor/logical/or.hpp", + "external/sources/boost/preprocessor/logical/xor.hpp", + "external/sources/boost/preprocessor/max.hpp", + "external/sources/boost/preprocessor/min.hpp", + "external/sources/boost/preprocessor/punctuation.hpp", + "external/sources/boost/preprocessor/punctuation/comma.hpp", + "external/sources/boost/preprocessor/punctuation/comma_if.hpp", + "external/sources/boost/preprocessor/punctuation/detail/is_begin_parens.hpp", + "external/sources/boost/preprocessor/punctuation/is_begin_parens.hpp", + "external/sources/boost/preprocessor/punctuation/paren.hpp", + "external/sources/boost/preprocessor/punctuation/paren_if.hpp", + "external/sources/boost/preprocessor/punctuation/remove_parens.hpp", + "external/sources/boost/preprocessor/repeat.hpp", + "external/sources/boost/preprocessor/repeat_2nd.hpp", + "external/sources/boost/preprocessor/repeat_3rd.hpp", + "external/sources/boost/preprocessor/repeat_from_to.hpp", + "external/sources/boost/preprocessor/repeat_from_to_2nd.hpp", + "external/sources/boost/preprocessor/repeat_from_to_3rd.hpp", + "external/sources/boost/preprocessor/repetition.hpp", + "external/sources/boost/preprocessor/repetition/deduce_r.hpp", + "external/sources/boost/preprocessor/repetition/deduce_z.hpp", + "external/sources/boost/preprocessor/repetition/detail/dmc/for.hpp", + "external/sources/boost/preprocessor/repetition/detail/edg/for.hpp", + "external/sources/boost/preprocessor/repetition/detail/for.hpp", + "external/sources/boost/preprocessor/repetition/detail/msvc/for.hpp", + "external/sources/boost/preprocessor/repetition/enum.hpp", + "external/sources/boost/preprocessor/repetition/enum_binary_params.hpp", + "external/sources/boost/preprocessor/repetition/enum_params.hpp", + "external/sources/boost/preprocessor/repetition/enum_params_with_a_default.hpp", + "external/sources/boost/preprocessor/repetition/enum_params_with_defaults.hpp", + "external/sources/boost/preprocessor/repetition/enum_shifted.hpp", + "external/sources/boost/preprocessor/repetition/enum_shifted_binary_params.hpp", + "external/sources/boost/preprocessor/repetition/enum_shifted_params.hpp", + "external/sources/boost/preprocessor/repetition/enum_trailing.hpp", + "external/sources/boost/preprocessor/repetition/enum_trailing_binary_params.hpp", + "external/sources/boost/preprocessor/repetition/enum_trailing_params.hpp", + "external/sources/boost/preprocessor/repetition/for.hpp", + "external/sources/boost/preprocessor/repetition/repeat.hpp", + "external/sources/boost/preprocessor/repetition/repeat_from_to.hpp", + "external/sources/boost/preprocessor/selection.hpp", + "external/sources/boost/preprocessor/selection/max.hpp", + "external/sources/boost/preprocessor/selection/min.hpp", + "external/sources/boost/preprocessor/seq.hpp", + "external/sources/boost/preprocessor/seq/cat.hpp", + "external/sources/boost/preprocessor/seq/detail/binary_transform.hpp", + "external/sources/boost/preprocessor/seq/detail/is_empty.hpp", + "external/sources/boost/preprocessor/seq/detail/split.hpp", + "external/sources/boost/preprocessor/seq/detail/to_list_msvc.hpp", + "external/sources/boost/preprocessor/seq/elem.hpp", + "external/sources/boost/preprocessor/seq/enum.hpp", + "external/sources/boost/preprocessor/seq/filter.hpp", + "external/sources/boost/preprocessor/seq/first_n.hpp", + "external/sources/boost/preprocessor/seq/fold_left.hpp", + "external/sources/boost/preprocessor/seq/fold_right.hpp", + "external/sources/boost/preprocessor/seq/for_each.hpp", + "external/sources/boost/preprocessor/seq/for_each_i.hpp", + "external/sources/boost/preprocessor/seq/for_each_product.hpp", + "external/sources/boost/preprocessor/seq/insert.hpp", + "external/sources/boost/preprocessor/seq/pop_back.hpp", + "external/sources/boost/preprocessor/seq/pop_front.hpp", + "external/sources/boost/preprocessor/seq/push_back.hpp", + "external/sources/boost/preprocessor/seq/push_front.hpp", + "external/sources/boost/preprocessor/seq/remove.hpp", + "external/sources/boost/preprocessor/seq/replace.hpp", + "external/sources/boost/preprocessor/seq/rest_n.hpp", + "external/sources/boost/preprocessor/seq/reverse.hpp", + "external/sources/boost/preprocessor/seq/seq.hpp", + "external/sources/boost/preprocessor/seq/size.hpp", + "external/sources/boost/preprocessor/seq/subseq.hpp", + "external/sources/boost/preprocessor/seq/to_array.hpp", + "external/sources/boost/preprocessor/seq/to_list.hpp", + "external/sources/boost/preprocessor/seq/to_tuple.hpp", + "external/sources/boost/preprocessor/seq/transform.hpp", + "external/sources/boost/preprocessor/seq/variadic_seq_to_seq.hpp", + "external/sources/boost/preprocessor/slot.hpp", + "external/sources/boost/preprocessor/slot/counter.hpp", + "external/sources/boost/preprocessor/slot/detail/counter.hpp", + "external/sources/boost/preprocessor/slot/detail/def.hpp", + "external/sources/boost/preprocessor/slot/detail/shared.hpp", + "external/sources/boost/preprocessor/slot/detail/slot1.hpp", + "external/sources/boost/preprocessor/slot/detail/slot2.hpp", + "external/sources/boost/preprocessor/slot/detail/slot3.hpp", + "external/sources/boost/preprocessor/slot/detail/slot4.hpp", + "external/sources/boost/preprocessor/slot/detail/slot5.hpp", + "external/sources/boost/preprocessor/slot/slot.hpp", + "external/sources/boost/preprocessor/stringize.hpp", + "external/sources/boost/preprocessor/tuple.hpp", + "external/sources/boost/preprocessor/tuple/detail/is_single_return.hpp", + "external/sources/boost/preprocessor/tuple/eat.hpp", + "external/sources/boost/preprocessor/tuple/elem.hpp", + "external/sources/boost/preprocessor/tuple/enum.hpp", + "external/sources/boost/preprocessor/tuple/insert.hpp", + "external/sources/boost/preprocessor/tuple/pop_back.hpp", + "external/sources/boost/preprocessor/tuple/pop_front.hpp", + "external/sources/boost/preprocessor/tuple/push_back.hpp", + "external/sources/boost/preprocessor/tuple/push_front.hpp", + "external/sources/boost/preprocessor/tuple/rem.hpp", + "external/sources/boost/preprocessor/tuple/remove.hpp", + "external/sources/boost/preprocessor/tuple/replace.hpp", + "external/sources/boost/preprocessor/tuple/reverse.hpp", + "external/sources/boost/preprocessor/tuple/size.hpp", + "external/sources/boost/preprocessor/tuple/to_array.hpp", + "external/sources/boost/preprocessor/tuple/to_list.hpp", + "external/sources/boost/preprocessor/tuple/to_seq.hpp", + "external/sources/boost/preprocessor/variadic.hpp", + "external/sources/boost/preprocessor/variadic/detail/has_opt.hpp", + "external/sources/boost/preprocessor/variadic/detail/is_single_return.hpp", + "external/sources/boost/preprocessor/variadic/elem.hpp", + "external/sources/boost/preprocessor/variadic/has_opt.hpp", + "external/sources/boost/preprocessor/variadic/size.hpp", + "external/sources/boost/preprocessor/variadic/to_array.hpp", + "external/sources/boost/preprocessor/variadic/to_list.hpp", + "external/sources/boost/preprocessor/variadic/to_seq.hpp", + "external/sources/boost/preprocessor/variadic/to_tuple.hpp", + "external/sources/boost/preprocessor/while.hpp", + "external/sources/boost/preprocessor/wstringize.hpp", + "external/sources/boost/process.hpp", + "external/sources/boost/process/args.hpp", + "external/sources/boost/process/async.hpp", + "external/sources/boost/process/async_pipe.hpp", + "external/sources/boost/process/async_system.hpp", + "external/sources/boost/process/child.hpp", + "external/sources/boost/process/cmd.hpp", + "external/sources/boost/process/detail/async_handler.hpp", + "external/sources/boost/process/detail/basic_cmd.hpp", + "external/sources/boost/process/detail/child_decl.hpp", + "external/sources/boost/process/detail/config.hpp", + "external/sources/boost/process/detail/execute_impl.hpp", + "external/sources/boost/process/detail/handler.hpp", + "external/sources/boost/process/detail/handler_base.hpp", + "external/sources/boost/process/detail/on_exit.hpp", + "external/sources/boost/process/detail/posix/asio_fwd.hpp", + "external/sources/boost/process/detail/posix/async_handler.hpp", + "external/sources/boost/process/detail/posix/async_in.hpp", + "external/sources/boost/process/detail/posix/async_out.hpp", + "external/sources/boost/process/detail/posix/async_pipe.hpp", + "external/sources/boost/process/detail/posix/basic_cmd.hpp", + "external/sources/boost/process/detail/posix/basic_pipe.hpp", + "external/sources/boost/process/detail/posix/child_handle.hpp", + "external/sources/boost/process/detail/posix/close_in.hpp", + "external/sources/boost/process/detail/posix/close_out.hpp", + "external/sources/boost/process/detail/posix/cmd.hpp", + "external/sources/boost/process/detail/posix/compare_handles.hpp", + "external/sources/boost/process/detail/posix/env_init.hpp", + "external/sources/boost/process/detail/posix/environment.hpp", + "external/sources/boost/process/detail/posix/exe.hpp", + "external/sources/boost/process/detail/posix/executor.hpp", + "external/sources/boost/process/detail/posix/fd.hpp", + "external/sources/boost/process/detail/posix/file_descriptor.hpp", + "external/sources/boost/process/detail/posix/file_in.hpp", + "external/sources/boost/process/detail/posix/file_out.hpp", + "external/sources/boost/process/detail/posix/group_handle.hpp", + "external/sources/boost/process/detail/posix/group_ref.hpp", + "external/sources/boost/process/detail/posix/handler.hpp", + "external/sources/boost/process/detail/posix/handles.hpp", + "external/sources/boost/process/detail/posix/io_context_ref.hpp", + "external/sources/boost/process/detail/posix/is_running.hpp", + "external/sources/boost/process/detail/posix/null_in.hpp", + "external/sources/boost/process/detail/posix/null_out.hpp", + "external/sources/boost/process/detail/posix/on_exit.hpp", + "external/sources/boost/process/detail/posix/pipe_in.hpp", + "external/sources/boost/process/detail/posix/pipe_out.hpp", + "external/sources/boost/process/detail/posix/search_path.hpp", + "external/sources/boost/process/detail/posix/shell_path.hpp", + "external/sources/boost/process/detail/posix/sigchld_service.hpp", + "external/sources/boost/process/detail/posix/signal.hpp", + "external/sources/boost/process/detail/posix/start_dir.hpp", + "external/sources/boost/process/detail/posix/terminate.hpp", + "external/sources/boost/process/detail/posix/use_vfork.hpp", + "external/sources/boost/process/detail/posix/wait_for_exit.hpp", + "external/sources/boost/process/detail/posix/wait_group.hpp", + "external/sources/boost/process/detail/throw_on_error.hpp", + "external/sources/boost/process/detail/traits.hpp", + "external/sources/boost/process/detail/traits/async.hpp", + "external/sources/boost/process/detail/traits/cmd_or_exe.hpp", + "external/sources/boost/process/detail/traits/decl.hpp", + "external/sources/boost/process/detail/traits/env.hpp", + "external/sources/boost/process/detail/traits/error.hpp", + "external/sources/boost/process/detail/traits/group.hpp", + "external/sources/boost/process/detail/traits/wchar_t.hpp", + "external/sources/boost/process/detail/used_handles.hpp", + "external/sources/boost/process/detail/windows/asio_fwd.hpp", + "external/sources/boost/process/detail/windows/async_handler.hpp", + "external/sources/boost/process/detail/windows/async_in.hpp", + "external/sources/boost/process/detail/windows/async_out.hpp", + "external/sources/boost/process/detail/windows/async_pipe.hpp", + "external/sources/boost/process/detail/windows/basic_cmd.hpp", + "external/sources/boost/process/detail/windows/basic_pipe.hpp", + "external/sources/boost/process/detail/windows/child_handle.hpp", + "external/sources/boost/process/detail/windows/close_in.hpp", + "external/sources/boost/process/detail/windows/close_out.hpp", + "external/sources/boost/process/detail/windows/cmd.hpp", + "external/sources/boost/process/detail/windows/compare_handles.hpp", + "external/sources/boost/process/detail/windows/env_init.hpp", + "external/sources/boost/process/detail/windows/environment.hpp", + "external/sources/boost/process/detail/windows/executor.hpp", + "external/sources/boost/process/detail/windows/file_descriptor.hpp", + "external/sources/boost/process/detail/windows/file_in.hpp", + "external/sources/boost/process/detail/windows/file_out.hpp", + "external/sources/boost/process/detail/windows/group_handle.hpp", + "external/sources/boost/process/detail/windows/group_ref.hpp", + "external/sources/boost/process/detail/windows/handle_workaround.hpp", + "external/sources/boost/process/detail/windows/handler.hpp", + "external/sources/boost/process/detail/windows/handles.hpp", + "external/sources/boost/process/detail/windows/io_context_ref.hpp", + "external/sources/boost/process/detail/windows/is_running.hpp", + "external/sources/boost/process/detail/windows/job_workaround.hpp", + "external/sources/boost/process/detail/windows/locale.hpp", + "external/sources/boost/process/detail/windows/null_in.hpp", + "external/sources/boost/process/detail/windows/null_out.hpp", + "external/sources/boost/process/detail/windows/on_exit.hpp", + "external/sources/boost/process/detail/windows/pipe_in.hpp", + "external/sources/boost/process/detail/windows/pipe_out.hpp", + "external/sources/boost/process/detail/windows/search_path.hpp", + "external/sources/boost/process/detail/windows/shell_path.hpp", + "external/sources/boost/process/detail/windows/show_window.hpp", + "external/sources/boost/process/detail/windows/start_dir.hpp", + "external/sources/boost/process/detail/windows/terminate.hpp", + "external/sources/boost/process/detail/windows/wait_for_exit.hpp", + "external/sources/boost/process/detail/windows/wait_group.hpp", + "external/sources/boost/process/env.hpp", + "external/sources/boost/process/environment.hpp", + "external/sources/boost/process/error.hpp", + "external/sources/boost/process/exception.hpp", + "external/sources/boost/process/exe.hpp", + "external/sources/boost/process/extend.hpp", + "external/sources/boost/process/group.hpp", + "external/sources/boost/process/handles.hpp", + "external/sources/boost/process/io.hpp", + "external/sources/boost/process/locale.hpp", + "external/sources/boost/process/pipe.hpp", + "external/sources/boost/process/posix.hpp", + "external/sources/boost/process/search_path.hpp", + "external/sources/boost/process/shell.hpp", + "external/sources/boost/process/spawn.hpp", + "external/sources/boost/process/start_dir.hpp", + "external/sources/boost/process/system.hpp", + "external/sources/boost/process/windows.hpp", + "external/sources/boost/program_options.hpp", + "external/sources/boost/program_options/cmdline.hpp", + "external/sources/boost/program_options/config.hpp", + "external/sources/boost/program_options/detail/cmdline.hpp", + "external/sources/boost/program_options/detail/config_file.hpp", + "external/sources/boost/program_options/detail/convert.hpp", + "external/sources/boost/program_options/detail/parsers.hpp", + "external/sources/boost/program_options/detail/utf8_codecvt_facet.hpp", + "external/sources/boost/program_options/detail/value_semantic.hpp", + "external/sources/boost/program_options/environment_iterator.hpp", + "external/sources/boost/program_options/eof_iterator.hpp", + "external/sources/boost/program_options/errors.hpp", + "external/sources/boost/program_options/option.hpp", + "external/sources/boost/program_options/options_description.hpp", + "external/sources/boost/program_options/parsers.hpp", + "external/sources/boost/program_options/positional_options.hpp", + "external/sources/boost/program_options/value_semantic.hpp", + "external/sources/boost/program_options/variables_map.hpp", + "external/sources/boost/program_options/version.hpp", + "external/sources/boost/progress.hpp", + "external/sources/boost/property_map/compose_property_map.hpp", + "external/sources/boost/property_map/dynamic_property_map.hpp", + "external/sources/boost/property_map/function_property_map.hpp", + "external/sources/boost/property_map/parallel/basic_reduce.hpp", + "external/sources/boost/property_map/parallel/caching_property_map.hpp", + "external/sources/boost/property_map/parallel/detail/untracked_pair.hpp", + "external/sources/boost/property_map/parallel/distributed_property_map.hpp", + "external/sources/boost/property_map/parallel/global_index_map.hpp", + "external/sources/boost/property_map/parallel/impl/distributed_property_map.ipp", + "external/sources/boost/property_map/parallel/local_property_map.hpp", + "external/sources/boost/property_map/parallel/parallel_property_maps.hpp", + "external/sources/boost/property_map/parallel/process_group.hpp", + "external/sources/boost/property_map/parallel/simple_trigger.hpp", + "external/sources/boost/property_map/parallel/unsafe_serialize.hpp", + "external/sources/boost/property_map/parallel/vector_property_map.hpp", + "external/sources/boost/property_map/property_map.hpp", + "external/sources/boost/property_map/property_map_iterator.hpp", + "external/sources/boost/property_map/shared_array_property_map.hpp", + "external/sources/boost/property_map/transform_value_property_map.hpp", + "external/sources/boost/property_map/vector_property_map.hpp", + "external/sources/boost/property_tree/detail/exception_implementation.hpp", + "external/sources/boost/property_tree/detail/file_parser_error.hpp", + "external/sources/boost/property_tree/detail/info_parser_error.hpp", + "external/sources/boost/property_tree/detail/info_parser_read.hpp", + "external/sources/boost/property_tree/detail/info_parser_utils.hpp", + "external/sources/boost/property_tree/detail/info_parser_write.hpp", + "external/sources/boost/property_tree/detail/info_parser_writer_settings.hpp", + "external/sources/boost/property_tree/detail/ptree_implementation.hpp", + "external/sources/boost/property_tree/detail/ptree_utils.hpp", + "external/sources/boost/property_tree/detail/rapidxml.hpp", + "external/sources/boost/property_tree/detail/xml_parser_error.hpp", + "external/sources/boost/property_tree/detail/xml_parser_flags.hpp", + "external/sources/boost/property_tree/detail/xml_parser_read_rapidxml.hpp", + "external/sources/boost/property_tree/detail/xml_parser_utils.hpp", + "external/sources/boost/property_tree/detail/xml_parser_write.hpp", + "external/sources/boost/property_tree/detail/xml_parser_writer_settings.hpp", + "external/sources/boost/property_tree/exceptions.hpp", + "external/sources/boost/property_tree/id_translator.hpp", + "external/sources/boost/property_tree/info_parser.hpp", + "external/sources/boost/property_tree/ini_parser.hpp", + "external/sources/boost/property_tree/json_parser.hpp", + "external/sources/boost/property_tree/json_parser/detail/narrow_encoding.hpp", + "external/sources/boost/property_tree/json_parser/detail/parser.hpp", + "external/sources/boost/property_tree/json_parser/detail/read.hpp", + "external/sources/boost/property_tree/json_parser/detail/standard_callbacks.hpp", + "external/sources/boost/property_tree/json_parser/detail/wide_encoding.hpp", + "external/sources/boost/property_tree/json_parser/detail/write.hpp", + "external/sources/boost/property_tree/json_parser/error.hpp", + "external/sources/boost/property_tree/ptree.hpp", + "external/sources/boost/property_tree/ptree_fwd.hpp", + "external/sources/boost/property_tree/ptree_serialization.hpp", + "external/sources/boost/property_tree/stream_translator.hpp", + "external/sources/boost/property_tree/string_path.hpp", + "external/sources/boost/property_tree/xml_parser.hpp", + "external/sources/boost/proto/args.hpp", + "external/sources/boost/proto/context.hpp", + "external/sources/boost/proto/context/callable.hpp", + "external/sources/boost/proto/context/default.hpp", + "external/sources/boost/proto/context/detail/callable_eval.hpp", + "external/sources/boost/proto/context/detail/default_eval.hpp", + "external/sources/boost/proto/context/detail/null_eval.hpp", + "external/sources/boost/proto/context/detail/preprocessed/callable_eval.hpp", + "external/sources/boost/proto/context/detail/preprocessed/default_eval.hpp", + "external/sources/boost/proto/context/detail/preprocessed/null_eval.hpp", + "external/sources/boost/proto/context/null.hpp", + "external/sources/boost/proto/core.hpp", + "external/sources/boost/proto/debug.hpp", + "external/sources/boost/proto/deep_copy.hpp", + "external/sources/boost/proto/detail/and_n.hpp", + "external/sources/boost/proto/detail/any.hpp", + "external/sources/boost/proto/detail/args.hpp", + "external/sources/boost/proto/detail/as_expr.hpp", + "external/sources/boost/proto/detail/as_lvalue.hpp", + "external/sources/boost/proto/detail/basic_expr.hpp", + "external/sources/boost/proto/detail/class_member_traits.hpp", + "external/sources/boost/proto/detail/decltype.hpp", + "external/sources/boost/proto/detail/deduce_domain.hpp", + "external/sources/boost/proto/detail/deduce_domain_n.hpp", + "external/sources/boost/proto/detail/deep_copy.hpp", + "external/sources/boost/proto/detail/deprecated.hpp", + "external/sources/boost/proto/detail/dont_care.hpp", + "external/sources/boost/proto/detail/expr.hpp", + "external/sources/boost/proto/detail/expr_funop.hpp", + "external/sources/boost/proto/detail/extends_funop.hpp", + "external/sources/boost/proto/detail/extends_funop_const.hpp", + "external/sources/boost/proto/detail/funop.hpp", + "external/sources/boost/proto/detail/generate_by_value.hpp", + "external/sources/boost/proto/detail/ignore_unused.hpp", + "external/sources/boost/proto/detail/is_noncopyable.hpp", + "external/sources/boost/proto/detail/lambda_matches.hpp", + "external/sources/boost/proto/detail/local.hpp", + "external/sources/boost/proto/detail/make_expr.hpp", + "external/sources/boost/proto/detail/make_expr_.hpp", + "external/sources/boost/proto/detail/make_expr_funop.hpp", + "external/sources/boost/proto/detail/matches_.hpp", + "external/sources/boost/proto/detail/memfun_funop.hpp", + "external/sources/boost/proto/detail/or_n.hpp", + "external/sources/boost/proto/detail/poly_function.hpp", + "external/sources/boost/proto/detail/poly_function_funop.hpp", + "external/sources/boost/proto/detail/poly_function_traits.hpp", + "external/sources/boost/proto/detail/preprocessed/and_n.hpp", + "external/sources/boost/proto/detail/preprocessed/args.hpp", + "external/sources/boost/proto/detail/preprocessed/basic_expr.hpp", + "external/sources/boost/proto/detail/preprocessed/class_member_traits.hpp", + "external/sources/boost/proto/detail/preprocessed/deduce_domain_n.hpp", + "external/sources/boost/proto/detail/preprocessed/deep_copy.hpp", + "external/sources/boost/proto/detail/preprocessed/expr.hpp", + "external/sources/boost/proto/detail/preprocessed/expr_variadic.hpp", + "external/sources/boost/proto/detail/preprocessed/extends_funop.hpp", + "external/sources/boost/proto/detail/preprocessed/extends_funop_const.hpp", + "external/sources/boost/proto/detail/preprocessed/funop.hpp", + "external/sources/boost/proto/detail/preprocessed/generate_by_value.hpp", + "external/sources/boost/proto/detail/preprocessed/lambda_matches.hpp", + "external/sources/boost/proto/detail/preprocessed/make_expr.hpp", + "external/sources/boost/proto/detail/preprocessed/make_expr_.hpp", + "external/sources/boost/proto/detail/preprocessed/make_expr_funop.hpp", + "external/sources/boost/proto/detail/preprocessed/matches_.hpp", + "external/sources/boost/proto/detail/preprocessed/memfun_funop.hpp", + "external/sources/boost/proto/detail/preprocessed/or_n.hpp", + "external/sources/boost/proto/detail/preprocessed/poly_function_funop.hpp", + "external/sources/boost/proto/detail/preprocessed/poly_function_traits.hpp", + "external/sources/boost/proto/detail/preprocessed/template_arity_helper.hpp", + "external/sources/boost/proto/detail/preprocessed/traits.hpp", + "external/sources/boost/proto/detail/preprocessed/unpack_expr_.hpp", + "external/sources/boost/proto/detail/preprocessed/vararg_matches_impl.hpp", + "external/sources/boost/proto/detail/remove_typename.hpp", + "external/sources/boost/proto/detail/static_const.hpp", + "external/sources/boost/proto/detail/template_arity.hpp", + "external/sources/boost/proto/detail/template_arity_helper.hpp", + "external/sources/boost/proto/detail/traits.hpp", + "external/sources/boost/proto/detail/unpack_expr_.hpp", + "external/sources/boost/proto/detail/vararg_matches_impl.hpp", + "external/sources/boost/proto/domain.hpp", + "external/sources/boost/proto/eval.hpp", + "external/sources/boost/proto/expr.hpp", + "external/sources/boost/proto/extends.hpp", + "external/sources/boost/proto/functional.hpp", + "external/sources/boost/proto/functional/fusion.hpp", + "external/sources/boost/proto/functional/fusion/at.hpp", + "external/sources/boost/proto/functional/fusion/pop_back.hpp", + "external/sources/boost/proto/functional/fusion/pop_front.hpp", + "external/sources/boost/proto/functional/fusion/push_back.hpp", + "external/sources/boost/proto/functional/fusion/push_front.hpp", + "external/sources/boost/proto/functional/fusion/reverse.hpp", + "external/sources/boost/proto/functional/range.hpp", + "external/sources/boost/proto/functional/range/begin.hpp", + "external/sources/boost/proto/functional/range/empty.hpp", + "external/sources/boost/proto/functional/range/end.hpp", + "external/sources/boost/proto/functional/range/rbegin.hpp", + "external/sources/boost/proto/functional/range/rend.hpp", + "external/sources/boost/proto/functional/range/size.hpp", + "external/sources/boost/proto/functional/std.hpp", + "external/sources/boost/proto/functional/std/iterator.hpp", + "external/sources/boost/proto/functional/std/utility.hpp", + "external/sources/boost/proto/fusion.hpp", + "external/sources/boost/proto/generate.hpp", + "external/sources/boost/proto/literal.hpp", + "external/sources/boost/proto/make_expr.hpp", + "external/sources/boost/proto/matches.hpp", + "external/sources/boost/proto/operators.hpp", + "external/sources/boost/proto/proto.hpp", + "external/sources/boost/proto/proto_fwd.hpp", + "external/sources/boost/proto/proto_typeof.hpp", + "external/sources/boost/proto/repeat.hpp", + "external/sources/boost/proto/tags.hpp", + "external/sources/boost/proto/traits.hpp", + "external/sources/boost/proto/transform.hpp", + "external/sources/boost/proto/transform/arg.hpp", + "external/sources/boost/proto/transform/call.hpp", + "external/sources/boost/proto/transform/default.hpp", + "external/sources/boost/proto/transform/detail/call.hpp", + "external/sources/boost/proto/transform/detail/construct_funop.hpp", + "external/sources/boost/proto/transform/detail/construct_pod_funop.hpp", + "external/sources/boost/proto/transform/detail/default_function_impl.hpp", + "external/sources/boost/proto/transform/detail/expand_pack.hpp", + "external/sources/boost/proto/transform/detail/fold_impl.hpp", + "external/sources/boost/proto/transform/detail/lazy.hpp", + "external/sources/boost/proto/transform/detail/make.hpp", + "external/sources/boost/proto/transform/detail/make_gcc_workaround.hpp", + "external/sources/boost/proto/transform/detail/pack.hpp", + "external/sources/boost/proto/transform/detail/pack_impl.hpp", + "external/sources/boost/proto/transform/detail/pass_through_impl.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/call.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/construct_funop.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/construct_pod_funop.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/default_function_impl.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/expand_pack.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/fold_impl.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/lazy.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/make.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/make_gcc_workaround.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/pack_impl.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/pass_through_impl.hpp", + "external/sources/boost/proto/transform/detail/preprocessed/when.hpp", + "external/sources/boost/proto/transform/detail/when.hpp", + "external/sources/boost/proto/transform/env.hpp", + "external/sources/boost/proto/transform/fold.hpp", + "external/sources/boost/proto/transform/fold_tree.hpp", + "external/sources/boost/proto/transform/impl.hpp", + "external/sources/boost/proto/transform/integral_c.hpp", + "external/sources/boost/proto/transform/lazy.hpp", + "external/sources/boost/proto/transform/make.hpp", + "external/sources/boost/proto/transform/pass_through.hpp", + "external/sources/boost/proto/transform/when.hpp", + "external/sources/boost/ptr_container/clone_allocator.hpp", + "external/sources/boost/ptr_container/detail/associative_ptr_container.hpp", + "external/sources/boost/ptr_container/detail/default_deleter.hpp", + "external/sources/boost/ptr_container/detail/is_convertible.hpp", + "external/sources/boost/ptr_container/detail/map_iterator.hpp", + "external/sources/boost/ptr_container/detail/meta_functions.hpp", + "external/sources/boost/ptr_container/detail/move.hpp", + "external/sources/boost/ptr_container/detail/ptr_container_disable_deprecated.hpp", + "external/sources/boost/ptr_container/detail/reversible_ptr_container.hpp", + "external/sources/boost/ptr_container/detail/scoped_deleter.hpp", + "external/sources/boost/ptr_container/detail/serialize_ptr_map_adapter.hpp", + "external/sources/boost/ptr_container/detail/serialize_reversible_cont.hpp", + "external/sources/boost/ptr_container/detail/serialize_xml_names.hpp", + "external/sources/boost/ptr_container/detail/static_move_ptr.hpp", + "external/sources/boost/ptr_container/detail/throw_exception.hpp", + "external/sources/boost/ptr_container/detail/void_ptr_iterator.hpp", + "external/sources/boost/ptr_container/exception.hpp", + "external/sources/boost/ptr_container/indirect_fun.hpp", + "external/sources/boost/ptr_container/nullable.hpp", + "external/sources/boost/ptr_container/ptr_array.hpp", + "external/sources/boost/ptr_container/ptr_circular_buffer.hpp", + "external/sources/boost/ptr_container/ptr_container.hpp", + "external/sources/boost/ptr_container/ptr_deque.hpp", + "external/sources/boost/ptr_container/ptr_inserter.hpp", + "external/sources/boost/ptr_container/ptr_list.hpp", + "external/sources/boost/ptr_container/ptr_map.hpp", + "external/sources/boost/ptr_container/ptr_map_adapter.hpp", + "external/sources/boost/ptr_container/ptr_sequence_adapter.hpp", + "external/sources/boost/ptr_container/ptr_set.hpp", + "external/sources/boost/ptr_container/ptr_set_adapter.hpp", + "external/sources/boost/ptr_container/ptr_unordered_map.hpp", + "external/sources/boost/ptr_container/ptr_unordered_set.hpp", + "external/sources/boost/ptr_container/ptr_vector.hpp", + "external/sources/boost/ptr_container/serialize_ptr_array.hpp", + "external/sources/boost/ptr_container/serialize_ptr_circular_buffer.hpp", + "external/sources/boost/ptr_container/serialize_ptr_container.hpp", + "external/sources/boost/ptr_container/serialize_ptr_deque.hpp", + "external/sources/boost/ptr_container/serialize_ptr_list.hpp", + "external/sources/boost/ptr_container/serialize_ptr_map.hpp", + "external/sources/boost/ptr_container/serialize_ptr_set.hpp", + "external/sources/boost/ptr_container/serialize_ptr_unordered_map.hpp", + "external/sources/boost/ptr_container/serialize_ptr_unordered_set.hpp", + "external/sources/boost/ptr_container/serialize_ptr_vector.hpp", + "external/sources/boost/python.hpp", + "external/sources/boost/python/arg_from_python.hpp", + "external/sources/boost/python/args.hpp", + "external/sources/boost/python/args_fwd.hpp", + "external/sources/boost/python/back_reference.hpp", + "external/sources/boost/python/base_type_traits.hpp", + "external/sources/boost/python/bases.hpp", + "external/sources/boost/python/borrowed.hpp", + "external/sources/boost/python/call.hpp", + "external/sources/boost/python/call_method.hpp", + "external/sources/boost/python/cast.hpp", + "external/sources/boost/python/class.hpp", + "external/sources/boost/python/class_fwd.hpp", + "external/sources/boost/python/converter/arg_from_python.hpp", + "external/sources/boost/python/converter/arg_to_python.hpp", + "external/sources/boost/python/converter/arg_to_python_base.hpp", + "external/sources/boost/python/converter/as_to_python_function.hpp", + "external/sources/boost/python/converter/builtin_converters.hpp", + "external/sources/boost/python/converter/constructor_function.hpp", + "external/sources/boost/python/converter/context_result_converter.hpp", + "external/sources/boost/python/converter/convertible_function.hpp", + "external/sources/boost/python/converter/from_python.hpp", + "external/sources/boost/python/converter/implicit.hpp", + "external/sources/boost/python/converter/obj_mgr_arg_from_python.hpp", + "external/sources/boost/python/converter/object_manager.hpp", + "external/sources/boost/python/converter/pointer_type_id.hpp", + "external/sources/boost/python/converter/pyobject_traits.hpp", + "external/sources/boost/python/converter/pyobject_type.hpp", + "external/sources/boost/python/converter/pytype_function.hpp", + "external/sources/boost/python/converter/pytype_object_mgr_traits.hpp", + "external/sources/boost/python/converter/registered.hpp", + "external/sources/boost/python/converter/registered_pointee.hpp", + "external/sources/boost/python/converter/registrations.hpp", + "external/sources/boost/python/converter/registry.hpp", + "external/sources/boost/python/converter/return_from_python.hpp", + "external/sources/boost/python/converter/rvalue_from_python_data.hpp", + "external/sources/boost/python/converter/shared_ptr_deleter.hpp", + "external/sources/boost/python/converter/shared_ptr_from_python.hpp", + "external/sources/boost/python/converter/shared_ptr_to_python.hpp", + "external/sources/boost/python/converter/to_python_function_type.hpp", + "external/sources/boost/python/copy_const_reference.hpp", + "external/sources/boost/python/copy_non_const_reference.hpp", + "external/sources/boost/python/data_members.hpp", + "external/sources/boost/python/def.hpp", + "external/sources/boost/python/def_visitor.hpp", + "external/sources/boost/python/default_call_policies.hpp", + "external/sources/boost/python/detail/aix_init_module.hpp", + "external/sources/boost/python/detail/api_placeholder.hpp", + "external/sources/boost/python/detail/borrowed_ptr.hpp", + "external/sources/boost/python/detail/caller.hpp", + "external/sources/boost/python/detail/config.hpp", + "external/sources/boost/python/detail/construct.hpp", + "external/sources/boost/python/detail/convertible.hpp", + "external/sources/boost/python/detail/copy_ctor_mutates_rhs.hpp", + "external/sources/boost/python/detail/cv_category.hpp", + "external/sources/boost/python/detail/dealloc.hpp", + "external/sources/boost/python/detail/decorated_type_id.hpp", + "external/sources/boost/python/detail/decref_guard.hpp", + "external/sources/boost/python/detail/def_helper.hpp", + "external/sources/boost/python/detail/def_helper_fwd.hpp", + "external/sources/boost/python/detail/defaults_def.hpp", + "external/sources/boost/python/detail/defaults_gen.hpp", + "external/sources/boost/python/detail/dependent.hpp", + "external/sources/boost/python/detail/destroy.hpp", + "external/sources/boost/python/detail/enable_if.hpp", + "external/sources/boost/python/detail/exception_handler.hpp", + "external/sources/boost/python/detail/force_instantiate.hpp", + "external/sources/boost/python/detail/if_else.hpp", + "external/sources/boost/python/detail/indirect_traits.hpp", + "external/sources/boost/python/detail/invoke.hpp", + "external/sources/boost/python/detail/is_auto_ptr.hpp", + "external/sources/boost/python/detail/is_shared_ptr.hpp", + "external/sources/boost/python/detail/is_wrapper.hpp", + "external/sources/boost/python/detail/is_xxx.hpp", + "external/sources/boost/python/detail/make_keyword_range_fn.hpp", + "external/sources/boost/python/detail/make_tuple.hpp", + "external/sources/boost/python/detail/map_entry.hpp", + "external/sources/boost/python/detail/mpl_lambda.hpp", + "external/sources/boost/python/detail/msvc_typeinfo.hpp", + "external/sources/boost/python/detail/none.hpp", + "external/sources/boost/python/detail/not_specified.hpp", + "external/sources/boost/python/detail/nullary_function_adaptor.hpp", + "external/sources/boost/python/detail/operator_id.hpp", + "external/sources/boost/python/detail/overloads_fwd.hpp", + "external/sources/boost/python/detail/pointee.hpp", + "external/sources/boost/python/detail/prefix.hpp", + "external/sources/boost/python/detail/preprocessor.hpp", + "external/sources/boost/python/detail/python22_fixed.h", + "external/sources/boost/python/detail/python_type.hpp", + "external/sources/boost/python/detail/raw_pyobject.hpp", + "external/sources/boost/python/detail/referent_storage.hpp", + "external/sources/boost/python/detail/result.hpp", + "external/sources/boost/python/detail/scope.hpp", + "external/sources/boost/python/detail/sfinae.hpp", + "external/sources/boost/python/detail/signature.hpp", + "external/sources/boost/python/detail/string_literal.hpp", + "external/sources/boost/python/detail/target.hpp", + "external/sources/boost/python/detail/translate_exception.hpp", + "external/sources/boost/python/detail/type_list.hpp", + "external/sources/boost/python/detail/type_list_impl.hpp", + "external/sources/boost/python/detail/type_traits.hpp", + "external/sources/boost/python/detail/unwind_type.hpp", + "external/sources/boost/python/detail/unwrap_type_id.hpp", + "external/sources/boost/python/detail/unwrap_wrapper.hpp", + "external/sources/boost/python/detail/value_arg.hpp", + "external/sources/boost/python/detail/value_is_shared_ptr.hpp", + "external/sources/boost/python/detail/value_is_xxx.hpp", + "external/sources/boost/python/detail/void_ptr.hpp", + "external/sources/boost/python/detail/void_return.hpp", + "external/sources/boost/python/detail/wrap_python.hpp", + "external/sources/boost/python/detail/wrapper_base.hpp", + "external/sources/boost/python/dict.hpp", + "external/sources/boost/python/docstring_options.hpp", + "external/sources/boost/python/enum.hpp", + "external/sources/boost/python/errors.hpp", + "external/sources/boost/python/exception_translator.hpp", + "external/sources/boost/python/exec.hpp", + "external/sources/boost/python/extract.hpp", + "external/sources/boost/python/handle.hpp", + "external/sources/boost/python/handle_fwd.hpp", + "external/sources/boost/python/has_back_reference.hpp", + "external/sources/boost/python/implicit.hpp", + "external/sources/boost/python/import.hpp", + "external/sources/boost/python/init.hpp", + "external/sources/boost/python/instance_holder.hpp", + "external/sources/boost/python/iterator.hpp", + "external/sources/boost/python/list.hpp", + "external/sources/boost/python/long.hpp", + "external/sources/boost/python/lvalue_from_pytype.hpp", + "external/sources/boost/python/make_constructor.hpp", + "external/sources/boost/python/make_function.hpp", + "external/sources/boost/python/manage_new_object.hpp", + "external/sources/boost/python/module.hpp", + "external/sources/boost/python/module_init.hpp", + "external/sources/boost/python/numpy.hpp", + "external/sources/boost/python/numpy/config.hpp", + "external/sources/boost/python/numpy/dtype.hpp", + "external/sources/boost/python/numpy/internal.hpp", + "external/sources/boost/python/numpy/invoke_matching.hpp", + "external/sources/boost/python/numpy/matrix.hpp", + "external/sources/boost/python/numpy/ndarray.hpp", + "external/sources/boost/python/numpy/numpy_object_mgr_traits.hpp", + "external/sources/boost/python/numpy/scalars.hpp", + "external/sources/boost/python/numpy/ufunc.hpp", + "external/sources/boost/python/object.hpp", + "external/sources/boost/python/object/add_to_namespace.hpp", + "external/sources/boost/python/object/class.hpp", + "external/sources/boost/python/object/class_detail.hpp", + "external/sources/boost/python/object/class_metadata.hpp", + "external/sources/boost/python/object/class_wrapper.hpp", + "external/sources/boost/python/object/enum_base.hpp", + "external/sources/boost/python/object/find_instance.hpp", + "external/sources/boost/python/object/forward.hpp", + "external/sources/boost/python/object/function.hpp", + "external/sources/boost/python/object/function_doc_signature.hpp", + "external/sources/boost/python/object/function_handle.hpp", + "external/sources/boost/python/object/function_object.hpp", + "external/sources/boost/python/object/inheritance.hpp", + "external/sources/boost/python/object/inheritance_query.hpp", + "external/sources/boost/python/object/instance.hpp", + "external/sources/boost/python/object/iterator.hpp", + "external/sources/boost/python/object/iterator_core.hpp", + "external/sources/boost/python/object/life_support.hpp", + "external/sources/boost/python/object/make_holder.hpp", + "external/sources/boost/python/object/make_instance.hpp", + "external/sources/boost/python/object/make_ptr_instance.hpp", + "external/sources/boost/python/object/pickle_support.hpp", + "external/sources/boost/python/object/pointer_holder.hpp", + "external/sources/boost/python/object/py_function.hpp", + "external/sources/boost/python/object/stl_iterator_core.hpp", + "external/sources/boost/python/object/value_holder.hpp", + "external/sources/boost/python/object/value_holder_fwd.hpp", + "external/sources/boost/python/object_attributes.hpp", + "external/sources/boost/python/object_call.hpp", + "external/sources/boost/python/object_core.hpp", + "external/sources/boost/python/object_fwd.hpp", + "external/sources/boost/python/object_items.hpp", + "external/sources/boost/python/object_operators.hpp", + "external/sources/boost/python/object_protocol.hpp", + "external/sources/boost/python/object_protocol_core.hpp", + "external/sources/boost/python/object_slices.hpp", + "external/sources/boost/python/opaque_pointer_converter.hpp", + "external/sources/boost/python/operators.hpp", + "external/sources/boost/python/other.hpp", + "external/sources/boost/python/overloads.hpp", + "external/sources/boost/python/override.hpp", + "external/sources/boost/python/pointee.hpp", + "external/sources/boost/python/proxy.hpp", + "external/sources/boost/python/ptr.hpp", + "external/sources/boost/python/pure_virtual.hpp", + "external/sources/boost/python/raw_function.hpp", + "external/sources/boost/python/refcount.hpp", + "external/sources/boost/python/reference_existing_object.hpp", + "external/sources/boost/python/register_ptr_to_python.hpp", + "external/sources/boost/python/return_arg.hpp", + "external/sources/boost/python/return_by_value.hpp", + "external/sources/boost/python/return_internal_reference.hpp", + "external/sources/boost/python/return_opaque_pointer.hpp", + "external/sources/boost/python/return_value_policy.hpp", + "external/sources/boost/python/scope.hpp", + "external/sources/boost/python/self.hpp", + "external/sources/boost/python/signature.hpp", + "external/sources/boost/python/slice.hpp", + "external/sources/boost/python/slice_nil.hpp", + "external/sources/boost/python/ssize_t.hpp", + "external/sources/boost/python/stl_iterator.hpp", + "external/sources/boost/python/str.hpp", + "external/sources/boost/python/suite/indexing/container_utils.hpp", + "external/sources/boost/python/suite/indexing/detail/indexing_suite_detail.hpp", + "external/sources/boost/python/suite/indexing/indexing_suite.hpp", + "external/sources/boost/python/suite/indexing/map_indexing_suite.hpp", + "external/sources/boost/python/suite/indexing/vector_indexing_suite.hpp", + "external/sources/boost/python/tag.hpp", + "external/sources/boost/python/to_python_converter.hpp", + "external/sources/boost/python/to_python_indirect.hpp", + "external/sources/boost/python/to_python_value.hpp", + "external/sources/boost/python/tuple.hpp", + "external/sources/boost/python/type_id.hpp", + "external/sources/boost/python/with_custodian_and_ward.hpp", + "external/sources/boost/python/wrapper.hpp", + "external/sources/boost/qvm/all.hpp", + "external/sources/boost/qvm/assert.hpp", + "external/sources/boost/qvm/deduce_mat.hpp", + "external/sources/boost/qvm/deduce_quat.hpp", + "external/sources/boost/qvm/deduce_scalar.hpp", + "external/sources/boost/qvm/deduce_vec.hpp", + "external/sources/boost/qvm/detail/cofactor_impl.hpp", + "external/sources/boost/qvm/detail/determinant_impl.hpp", + "external/sources/boost/qvm/detail/mat_assign.hpp", + "external/sources/boost/qvm/detail/quat_assign.hpp", + "external/sources/boost/qvm/detail/remove_const.hpp", + "external/sources/boost/qvm/detail/swizzle_traits.hpp", + "external/sources/boost/qvm/detail/transp_impl.hpp", + "external/sources/boost/qvm/detail/vec_assign.hpp", + "external/sources/boost/qvm/detail/vec_register_impl.hpp", + "external/sources/boost/qvm/enable_if.hpp", + "external/sources/boost/qvm/error.hpp", + "external/sources/boost/qvm/inline.hpp", + "external/sources/boost/qvm/map.hpp", + "external/sources/boost/qvm/map_mat_mat.hpp", + "external/sources/boost/qvm/map_mat_vec.hpp", + "external/sources/boost/qvm/map_vec_mat.hpp", + "external/sources/boost/qvm/mat.hpp", + "external/sources/boost/qvm/mat_access.hpp", + "external/sources/boost/qvm/mat_operations.hpp", + "external/sources/boost/qvm/mat_operations2.hpp", + "external/sources/boost/qvm/mat_operations3.hpp", + "external/sources/boost/qvm/mat_operations4.hpp", + "external/sources/boost/qvm/mat_traits.hpp", + "external/sources/boost/qvm/mat_traits_array.hpp", + "external/sources/boost/qvm/mat_traits_defaults.hpp", + "external/sources/boost/qvm/math.hpp", + "external/sources/boost/qvm/operations.hpp", + "external/sources/boost/qvm/quat.hpp", + "external/sources/boost/qvm/quat_access.hpp", + "external/sources/boost/qvm/quat_operations.hpp", + "external/sources/boost/qvm/quat_traits.hpp", + "external/sources/boost/qvm/quat_traits_array.hpp", + "external/sources/boost/qvm/quat_traits_defaults.hpp", + "external/sources/boost/qvm/quat_vec_operations.hpp", + "external/sources/boost/qvm/scalar_traits.hpp", + "external/sources/boost/qvm/static_assert.hpp", + "external/sources/boost/qvm/swizzle.hpp", + "external/sources/boost/qvm/swizzle2.hpp", + "external/sources/boost/qvm/swizzle3.hpp", + "external/sources/boost/qvm/swizzle4.hpp", + "external/sources/boost/qvm/throw_exception.hpp", + "external/sources/boost/qvm/to_string.hpp", + "external/sources/boost/qvm/vec.hpp", + "external/sources/boost/qvm/vec_access.hpp", + "external/sources/boost/qvm/vec_mat_operations.hpp", + "external/sources/boost/qvm/vec_mat_operations2.hpp", + "external/sources/boost/qvm/vec_mat_operations3.hpp", + "external/sources/boost/qvm/vec_mat_operations4.hpp", + "external/sources/boost/qvm/vec_operations.hpp", + "external/sources/boost/qvm/vec_operations2.hpp", + "external/sources/boost/qvm/vec_operations3.hpp", + "external/sources/boost/qvm/vec_operations4.hpp", + "external/sources/boost/qvm/vec_register.hpp", + "external/sources/boost/qvm/vec_register2.hpp", + "external/sources/boost/qvm/vec_register3.hpp", + "external/sources/boost/qvm/vec_register4.hpp", + "external/sources/boost/qvm/vec_traits.hpp", + "external/sources/boost/qvm/vec_traits_array.hpp", + "external/sources/boost/qvm/vec_traits_defaults.hpp", + "external/sources/boost/random.hpp", + "external/sources/boost/random/additive_combine.hpp", + "external/sources/boost/random/bernoulli_distribution.hpp", + "external/sources/boost/random/beta_distribution.hpp", + "external/sources/boost/random/binomial_distribution.hpp", + "external/sources/boost/random/cauchy_distribution.hpp", + "external/sources/boost/random/chi_squared_distribution.hpp", + "external/sources/boost/random/detail/auto_link.hpp", + "external/sources/boost/random/detail/config.hpp", + "external/sources/boost/random/detail/const_mod.hpp", + "external/sources/boost/random/detail/disable_warnings.hpp", + "external/sources/boost/random/detail/enable_warnings.hpp", + "external/sources/boost/random/detail/generator_bits.hpp", + "external/sources/boost/random/detail/generator_seed_seq.hpp", + "external/sources/boost/random/detail/gray_coded_qrng.hpp", + "external/sources/boost/random/detail/int_float_pair.hpp", + "external/sources/boost/random/detail/integer_log2.hpp", + "external/sources/boost/random/detail/iterator_mixin.hpp", + "external/sources/boost/random/detail/large_arithmetic.hpp", + "external/sources/boost/random/detail/niederreiter_base2_table.hpp", + "external/sources/boost/random/detail/operators.hpp", + "external/sources/boost/random/detail/polynomial.hpp", + "external/sources/boost/random/detail/ptr_helper.hpp", + "external/sources/boost/random/detail/qrng_base.hpp", + "external/sources/boost/random/detail/seed.hpp", + "external/sources/boost/random/detail/seed_impl.hpp", + "external/sources/boost/random/detail/signed_unsigned_tools.hpp", + "external/sources/boost/random/detail/sobol_table.hpp", + "external/sources/boost/random/detail/uniform_int_float.hpp", + "external/sources/boost/random/detail/vector_io.hpp", + "external/sources/boost/random/discard_block.hpp", + "external/sources/boost/random/discrete_distribution.hpp", + "external/sources/boost/random/exponential_distribution.hpp", + "external/sources/boost/random/extreme_value_distribution.hpp", + "external/sources/boost/random/faure.hpp", + "external/sources/boost/random/fisher_f_distribution.hpp", + "external/sources/boost/random/gamma_distribution.hpp", + "external/sources/boost/random/generate_canonical.hpp", + "external/sources/boost/random/geometric_distribution.hpp", + "external/sources/boost/random/hyperexponential_distribution.hpp", + "external/sources/boost/random/independent_bits.hpp", + "external/sources/boost/random/inversive_congruential.hpp", + "external/sources/boost/random/lagged_fibonacci.hpp", + "external/sources/boost/random/laplace_distribution.hpp", + "external/sources/boost/random/linear_congruential.hpp", + "external/sources/boost/random/linear_feedback_shift.hpp", + "external/sources/boost/random/lognormal_distribution.hpp", + "external/sources/boost/random/mersenne_twister.hpp", + "external/sources/boost/random/negative_binomial_distribution.hpp", + "external/sources/boost/random/niederreiter_base2.hpp", + "external/sources/boost/random/non_central_chi_squared_distribution.hpp", + "external/sources/boost/random/normal_distribution.hpp", + "external/sources/boost/random/piecewise_constant_distribution.hpp", + "external/sources/boost/random/piecewise_linear_distribution.hpp", + "external/sources/boost/random/poisson_distribution.hpp", + "external/sources/boost/random/random_device.hpp", + "external/sources/boost/random/random_number_generator.hpp", + "external/sources/boost/random/ranlux.hpp", + "external/sources/boost/random/seed_seq.hpp", + "external/sources/boost/random/shuffle_order.hpp", + "external/sources/boost/random/shuffle_output.hpp", + "external/sources/boost/random/sobol.hpp", + "external/sources/boost/random/student_t_distribution.hpp", + "external/sources/boost/random/subtract_with_carry.hpp", + "external/sources/boost/random/taus88.hpp", + "external/sources/boost/random/traits.hpp", + "external/sources/boost/random/triangle_distribution.hpp", + "external/sources/boost/random/uniform_01.hpp", + "external/sources/boost/random/uniform_int.hpp", + "external/sources/boost/random/uniform_int_distribution.hpp", + "external/sources/boost/random/uniform_on_sphere.hpp", + "external/sources/boost/random/uniform_real.hpp", + "external/sources/boost/random/uniform_real_distribution.hpp", + "external/sources/boost/random/uniform_smallint.hpp", + "external/sources/boost/random/variate_generator.hpp", + "external/sources/boost/random/weibull_distribution.hpp", + "external/sources/boost/random/xor_combine.hpp", + "external/sources/boost/range.hpp", + "external/sources/boost/range/adaptor/adjacent_filtered.hpp", + "external/sources/boost/range/adaptor/argument_fwd.hpp", + "external/sources/boost/range/adaptor/copied.hpp", + "external/sources/boost/range/adaptor/define_adaptor.hpp", + "external/sources/boost/range/adaptor/filtered.hpp", + "external/sources/boost/range/adaptor/formatted.hpp", + "external/sources/boost/range/adaptor/indexed.hpp", + "external/sources/boost/range/adaptor/indirected.hpp", + "external/sources/boost/range/adaptor/map.hpp", + "external/sources/boost/range/adaptor/ref_unwrapped.hpp", + "external/sources/boost/range/adaptor/replaced.hpp", + "external/sources/boost/range/adaptor/replaced_if.hpp", + "external/sources/boost/range/adaptor/reversed.hpp", + "external/sources/boost/range/adaptor/sliced.hpp", + "external/sources/boost/range/adaptor/strided.hpp", + "external/sources/boost/range/adaptor/tokenized.hpp", + "external/sources/boost/range/adaptor/transformed.hpp", + "external/sources/boost/range/adaptor/type_erased.hpp", + "external/sources/boost/range/adaptor/uniqued.hpp", + "external/sources/boost/range/adaptors.hpp", + "external/sources/boost/range/algorithm.hpp", + "external/sources/boost/range/algorithm/adjacent_find.hpp", + "external/sources/boost/range/algorithm/binary_search.hpp", + "external/sources/boost/range/algorithm/copy.hpp", + "external/sources/boost/range/algorithm/copy_backward.hpp", + "external/sources/boost/range/algorithm/count.hpp", + "external/sources/boost/range/algorithm/count_if.hpp", + "external/sources/boost/range/algorithm/equal.hpp", + "external/sources/boost/range/algorithm/equal_range.hpp", + "external/sources/boost/range/algorithm/fill.hpp", + "external/sources/boost/range/algorithm/fill_n.hpp", + "external/sources/boost/range/algorithm/find.hpp", + "external/sources/boost/range/algorithm/find_end.hpp", + "external/sources/boost/range/algorithm/find_first_of.hpp", + "external/sources/boost/range/algorithm/find_if.hpp", + "external/sources/boost/range/algorithm/for_each.hpp", + "external/sources/boost/range/algorithm/generate.hpp", + "external/sources/boost/range/algorithm/heap_algorithm.hpp", + "external/sources/boost/range/algorithm/inplace_merge.hpp", + "external/sources/boost/range/algorithm/lexicographical_compare.hpp", + "external/sources/boost/range/algorithm/lower_bound.hpp", + "external/sources/boost/range/algorithm/max_element.hpp", + "external/sources/boost/range/algorithm/merge.hpp", + "external/sources/boost/range/algorithm/min_element.hpp", + "external/sources/boost/range/algorithm/mismatch.hpp", + "external/sources/boost/range/algorithm/nth_element.hpp", + "external/sources/boost/range/algorithm/partial_sort.hpp", + "external/sources/boost/range/algorithm/partial_sort_copy.hpp", + "external/sources/boost/range/algorithm/partition.hpp", + "external/sources/boost/range/algorithm/permutation.hpp", + "external/sources/boost/range/algorithm/random_shuffle.hpp", + "external/sources/boost/range/algorithm/remove.hpp", + "external/sources/boost/range/algorithm/remove_copy.hpp", + "external/sources/boost/range/algorithm/remove_copy_if.hpp", + "external/sources/boost/range/algorithm/remove_if.hpp", + "external/sources/boost/range/algorithm/replace.hpp", + "external/sources/boost/range/algorithm/replace_copy.hpp", + "external/sources/boost/range/algorithm/replace_copy_if.hpp", + "external/sources/boost/range/algorithm/replace_if.hpp", + "external/sources/boost/range/algorithm/reverse.hpp", + "external/sources/boost/range/algorithm/reverse_copy.hpp", + "external/sources/boost/range/algorithm/rotate.hpp", + "external/sources/boost/range/algorithm/rotate_copy.hpp", + "external/sources/boost/range/algorithm/search.hpp", + "external/sources/boost/range/algorithm/search_n.hpp", + "external/sources/boost/range/algorithm/set_algorithm.hpp", + "external/sources/boost/range/algorithm/sort.hpp", + "external/sources/boost/range/algorithm/stable_partition.hpp", + "external/sources/boost/range/algorithm/stable_sort.hpp", + "external/sources/boost/range/algorithm/swap_ranges.hpp", + "external/sources/boost/range/algorithm/transform.hpp", + "external/sources/boost/range/algorithm/unique.hpp", + "external/sources/boost/range/algorithm/unique_copy.hpp", + "external/sources/boost/range/algorithm/upper_bound.hpp", + "external/sources/boost/range/algorithm_ext.hpp", + "external/sources/boost/range/algorithm_ext/copy_n.hpp", + "external/sources/boost/range/algorithm_ext/erase.hpp", + "external/sources/boost/range/algorithm_ext/for_each.hpp", + "external/sources/boost/range/algorithm_ext/insert.hpp", + "external/sources/boost/range/algorithm_ext/iota.hpp", + "external/sources/boost/range/algorithm_ext/is_sorted.hpp", + "external/sources/boost/range/algorithm_ext/overwrite.hpp", + "external/sources/boost/range/algorithm_ext/push_back.hpp", + "external/sources/boost/range/algorithm_ext/push_front.hpp", + "external/sources/boost/range/any_range.hpp", + "external/sources/boost/range/as_array.hpp", + "external/sources/boost/range/as_literal.hpp", + "external/sources/boost/range/atl.hpp", + "external/sources/boost/range/begin.hpp", + "external/sources/boost/range/category.hpp", + "external/sources/boost/range/combine.hpp", + "external/sources/boost/range/concepts.hpp", + "external/sources/boost/range/config.hpp", + "external/sources/boost/range/const_iterator.hpp", + "external/sources/boost/range/const_reverse_iterator.hpp", + "external/sources/boost/range/counting_range.hpp", + "external/sources/boost/range/detail/any_iterator.hpp", + "external/sources/boost/range/detail/any_iterator_buffer.hpp", + "external/sources/boost/range/detail/any_iterator_interface.hpp", + "external/sources/boost/range/detail/any_iterator_wrapper.hpp", + "external/sources/boost/range/detail/collection_traits.hpp", + "external/sources/boost/range/detail/collection_traits_detail.hpp", + "external/sources/boost/range/detail/combine_cxx03.hpp", + "external/sources/boost/range/detail/combine_cxx11.hpp", + "external/sources/boost/range/detail/combine_no_rvalue.hpp", + "external/sources/boost/range/detail/combine_rvalue.hpp", + "external/sources/boost/range/detail/common.hpp", + "external/sources/boost/range/detail/default_constructible_unary_fn.hpp", + "external/sources/boost/range/detail/demote_iterator_traversal_tag.hpp", + "external/sources/boost/range/detail/difference_type.hpp", + "external/sources/boost/range/detail/empty.hpp", + "external/sources/boost/range/detail/extract_optional_type.hpp", + "external/sources/boost/range/detail/has_member_size.hpp", + "external/sources/boost/range/detail/implementation_help.hpp", + "external/sources/boost/range/detail/join_iterator.hpp", + "external/sources/boost/range/detail/less.hpp", + "external/sources/boost/range/detail/microsoft.hpp", + "external/sources/boost/range/detail/misc_concept.hpp", + "external/sources/boost/range/detail/msvc_has_iterator_workaround.hpp", + "external/sources/boost/range/detail/range_return.hpp", + "external/sources/boost/range/detail/safe_bool.hpp", + "external/sources/boost/range/detail/sfinae.hpp", + "external/sources/boost/range/detail/sizer.hpp", + "external/sources/boost/range/detail/str_types.hpp", + "external/sources/boost/range/difference_type.hpp", + "external/sources/boost/range/distance.hpp", + "external/sources/boost/range/empty.hpp", + "external/sources/boost/range/end.hpp", + "external/sources/boost/range/functions.hpp", + "external/sources/boost/range/has_range_iterator.hpp", + "external/sources/boost/range/irange.hpp", + "external/sources/boost/range/istream_range.hpp", + "external/sources/boost/range/iterator.hpp", + "external/sources/boost/range/iterator_range.hpp", + "external/sources/boost/range/iterator_range_core.hpp", + "external/sources/boost/range/iterator_range_hash.hpp", + "external/sources/boost/range/iterator_range_io.hpp", + "external/sources/boost/range/join.hpp", + "external/sources/boost/range/metafunctions.hpp", + "external/sources/boost/range/mfc.hpp", + "external/sources/boost/range/mfc_map.hpp", + "external/sources/boost/range/mutable_iterator.hpp", + "external/sources/boost/range/numeric.hpp", + "external/sources/boost/range/pointer.hpp", + "external/sources/boost/range/range_fwd.hpp", + "external/sources/boost/range/rbegin.hpp", + "external/sources/boost/range/reference.hpp", + "external/sources/boost/range/rend.hpp", + "external/sources/boost/range/result_iterator.hpp", + "external/sources/boost/range/reverse_iterator.hpp", + "external/sources/boost/range/reverse_result_iterator.hpp", + "external/sources/boost/range/size.hpp", + "external/sources/boost/range/size_type.hpp", + "external/sources/boost/range/sub_range.hpp", + "external/sources/boost/range/traversal.hpp", + "external/sources/boost/range/value_type.hpp", + "external/sources/boost/ratio.hpp", + "external/sources/boost/ratio/config.hpp", + "external/sources/boost/ratio/detail/mpl/abs.hpp", + "external/sources/boost/ratio/detail/mpl/gcd.hpp", + "external/sources/boost/ratio/detail/mpl/lcm.hpp", + "external/sources/boost/ratio/detail/mpl/sign.hpp", + "external/sources/boost/ratio/detail/overflow_helpers.hpp", + "external/sources/boost/ratio/detail/ratio_io.hpp", + "external/sources/boost/ratio/include.hpp", + "external/sources/boost/ratio/mpl/abs.hpp", + "external/sources/boost/ratio/mpl/arithmetic.hpp", + "external/sources/boost/ratio/mpl/comparison.hpp", + "external/sources/boost/ratio/mpl/divides.hpp", + "external/sources/boost/ratio/mpl/equal_to.hpp", + "external/sources/boost/ratio/mpl/gcd.hpp", + "external/sources/boost/ratio/mpl/greater.hpp", + "external/sources/boost/ratio/mpl/greater_equal.hpp", + "external/sources/boost/ratio/mpl/lcm.hpp", + "external/sources/boost/ratio/mpl/less.hpp", + "external/sources/boost/ratio/mpl/less_equal.hpp", + "external/sources/boost/ratio/mpl/minus.hpp", + "external/sources/boost/ratio/mpl/negate.hpp", + "external/sources/boost/ratio/mpl/not_equal_to.hpp", + "external/sources/boost/ratio/mpl/numeric_cast.hpp", + "external/sources/boost/ratio/mpl/plus.hpp", + "external/sources/boost/ratio/mpl/rational_c_tag.hpp", + "external/sources/boost/ratio/mpl/rational_constant.hpp", + "external/sources/boost/ratio/mpl/sign.hpp", + "external/sources/boost/ratio/mpl/times.hpp", + "external/sources/boost/ratio/ratio.hpp", + "external/sources/boost/ratio/ratio_fwd.hpp", + "external/sources/boost/ratio/ratio_io.hpp", + "external/sources/boost/rational.hpp", + "external/sources/boost/ref.hpp", + "external/sources/boost/regex.h", + "external/sources/boost/regex.hpp", + "external/sources/boost/regex/concepts.hpp", + "external/sources/boost/regex/config.hpp", + "external/sources/boost/regex/config/borland.hpp", + "external/sources/boost/regex/config/cwchar.hpp", + "external/sources/boost/regex/icu.hpp", + "external/sources/boost/regex/mfc.hpp", + "external/sources/boost/regex/pattern_except.hpp", + "external/sources/boost/regex/pending/object_cache.hpp", + "external/sources/boost/regex/pending/static_mutex.hpp", + "external/sources/boost/regex/pending/unicode_iterator.hpp", + "external/sources/boost/regex/regex_traits.hpp", + "external/sources/boost/regex/user.hpp", + "external/sources/boost/regex/v4/basic_regex.hpp", + "external/sources/boost/regex/v4/basic_regex_creator.hpp", + "external/sources/boost/regex/v4/basic_regex_parser.hpp", + "external/sources/boost/regex/v4/c_regex_traits.hpp", + "external/sources/boost/regex/v4/char_regex_traits.hpp", + "external/sources/boost/regex/v4/cpp_regex_traits.hpp", + "external/sources/boost/regex/v4/cregex.hpp", + "external/sources/boost/regex/v4/error_type.hpp", + "external/sources/boost/regex/v4/fileiter.hpp", + "external/sources/boost/regex/v4/indexed_bit_flag.hpp", + "external/sources/boost/regex/v4/instances.hpp", + "external/sources/boost/regex/v4/iterator_category.hpp", + "external/sources/boost/regex/v4/iterator_traits.hpp", + "external/sources/boost/regex/v4/match_flags.hpp", + "external/sources/boost/regex/v4/match_results.hpp", + "external/sources/boost/regex/v4/mem_block_cache.hpp", + "external/sources/boost/regex/v4/perl_matcher.hpp", + "external/sources/boost/regex/v4/perl_matcher_common.hpp", + "external/sources/boost/regex/v4/perl_matcher_non_recursive.hpp", + "external/sources/boost/regex/v4/perl_matcher_recursive.hpp", + "external/sources/boost/regex/v4/primary_transform.hpp", + "external/sources/boost/regex/v4/protected_call.hpp", + "external/sources/boost/regex/v4/regbase.hpp", + "external/sources/boost/regex/v4/regex.hpp", + "external/sources/boost/regex/v4/regex_format.hpp", + "external/sources/boost/regex/v4/regex_fwd.hpp", + "external/sources/boost/regex/v4/regex_grep.hpp", + "external/sources/boost/regex/v4/regex_iterator.hpp", + "external/sources/boost/regex/v4/regex_match.hpp", + "external/sources/boost/regex/v4/regex_merge.hpp", + "external/sources/boost/regex/v4/regex_raw_buffer.hpp", + "external/sources/boost/regex/v4/regex_replace.hpp", + "external/sources/boost/regex/v4/regex_search.hpp", + "external/sources/boost/regex/v4/regex_split.hpp", + "external/sources/boost/regex/v4/regex_token_iterator.hpp", + "external/sources/boost/regex/v4/regex_traits.hpp", + "external/sources/boost/regex/v4/regex_traits_defaults.hpp", + "external/sources/boost/regex/v4/regex_workaround.hpp", + "external/sources/boost/regex/v4/states.hpp", + "external/sources/boost/regex/v4/sub_match.hpp", + "external/sources/boost/regex/v4/syntax_type.hpp", + "external/sources/boost/regex/v4/u32regex_iterator.hpp", + "external/sources/boost/regex/v4/u32regex_token_iterator.hpp", + "external/sources/boost/regex/v4/w32_regex_traits.hpp", + "external/sources/boost/regex_fwd.hpp", + "external/sources/boost/safe_numerics/CMakeLists.txt", + "external/sources/boost/safe_numerics/automatic.hpp", + "external/sources/boost/safe_numerics/checked_default.hpp", + "external/sources/boost/safe_numerics/checked_float.hpp", + "external/sources/boost/safe_numerics/checked_integer.hpp", + "external/sources/boost/safe_numerics/checked_result.hpp", + "external/sources/boost/safe_numerics/checked_result_operations.hpp", + "external/sources/boost/safe_numerics/concept/CMakeLists.txt", + "external/sources/boost/safe_numerics/concept/exception_policy.hpp", + "external/sources/boost/safe_numerics/concept/integer.hpp", + "external/sources/boost/safe_numerics/concept/numeric.hpp", + "external/sources/boost/safe_numerics/concept/promotion_policy.hpp", + "external/sources/boost/safe_numerics/concept/safe_numeric.hpp", + "external/sources/boost/safe_numerics/cpp.hpp", + "external/sources/boost/safe_numerics/exception.hpp", + "external/sources/boost/safe_numerics/exception_policies.hpp", + "external/sources/boost/safe_numerics/interval.hpp", + "external/sources/boost/safe_numerics/native.hpp", + "external/sources/boost/safe_numerics/range_value.hpp", + "external/sources/boost/safe_numerics/safe_base.hpp", + "external/sources/boost/safe_numerics/safe_base_operations.hpp", + "external/sources/boost/safe_numerics/safe_common.hpp", + "external/sources/boost/safe_numerics/safe_compare.hpp", + "external/sources/boost/safe_numerics/safe_integer.hpp", + "external/sources/boost/safe_numerics/safe_integer_literal.hpp", + "external/sources/boost/safe_numerics/safe_integer_range.hpp", + "external/sources/boost/safe_numerics/utility.hpp", + "external/sources/boost/scope_exit.hpp", + "external/sources/boost/scoped_array.hpp", + "external/sources/boost/scoped_ptr.hpp", + "external/sources/boost/serialization/access.hpp", + "external/sources/boost/serialization/archive_input_unordered_map.hpp", + "external/sources/boost/serialization/archive_input_unordered_set.hpp", + "external/sources/boost/serialization/array.hpp", + "external/sources/boost/serialization/array_optimization.hpp", + "external/sources/boost/serialization/array_wrapper.hpp", + "external/sources/boost/serialization/assume_abstract.hpp", + "external/sources/boost/serialization/base_object.hpp", + "external/sources/boost/serialization/binary_object.hpp", + "external/sources/boost/serialization/bitset.hpp", + "external/sources/boost/serialization/boost_array.hpp", + "external/sources/boost/serialization/boost_unordered_map.hpp", + "external/sources/boost/serialization/boost_unordered_set.hpp", + "external/sources/boost/serialization/collection_size_type copy.hpp", + "external/sources/boost/serialization/collection_size_type.hpp", + "external/sources/boost/serialization/collection_traits.hpp", + "external/sources/boost/serialization/collections_load_imp.hpp", + "external/sources/boost/serialization/collections_save_imp.hpp", + "external/sources/boost/serialization/complex.hpp", + "external/sources/boost/serialization/config.hpp", + "external/sources/boost/serialization/deque.hpp", + "external/sources/boost/serialization/detail/is_default_constructible.hpp", + "external/sources/boost/serialization/detail/shared_count_132.hpp", + "external/sources/boost/serialization/detail/shared_ptr_132.hpp", + "external/sources/boost/serialization/detail/shared_ptr_nmt_132.hpp", + "external/sources/boost/serialization/detail/stack_constructor.hpp", + "external/sources/boost/serialization/export.hpp", + "external/sources/boost/serialization/extended_type_info.hpp", + "external/sources/boost/serialization/extended_type_info_no_rtti.hpp", + "external/sources/boost/serialization/extended_type_info_typeid.hpp", + "external/sources/boost/serialization/factory.hpp", + "external/sources/boost/serialization/force_include.hpp", + "external/sources/boost/serialization/forward_list.hpp", + "external/sources/boost/serialization/hash_collections_load_imp.hpp", + "external/sources/boost/serialization/hash_collections_save_imp.hpp", + "external/sources/boost/serialization/hash_map.hpp", + "external/sources/boost/serialization/hash_set.hpp", + "external/sources/boost/serialization/is_bitwise_serializable.hpp", + "external/sources/boost/serialization/item_version_type.hpp", + "external/sources/boost/serialization/level.hpp", + "external/sources/boost/serialization/level_enum.hpp", + "external/sources/boost/serialization/library_version_type.hpp", + "external/sources/boost/serialization/list.hpp", + "external/sources/boost/serialization/map.hpp", + "external/sources/boost/serialization/nvp.hpp", + "external/sources/boost/serialization/optional.hpp", + "external/sources/boost/serialization/priority_queue.hpp", + "external/sources/boost/serialization/queue.hpp", + "external/sources/boost/serialization/scoped_ptr.hpp", + "external/sources/boost/serialization/serialization.hpp", + "external/sources/boost/serialization/set.hpp", + "external/sources/boost/serialization/shared_ptr.hpp", + "external/sources/boost/serialization/shared_ptr_132.hpp", + "external/sources/boost/serialization/shared_ptr_helper.hpp", + "external/sources/boost/serialization/singleton.hpp", + "external/sources/boost/serialization/slist.hpp", + "external/sources/boost/serialization/smart_cast.hpp", + "external/sources/boost/serialization/split_free.hpp", + "external/sources/boost/serialization/split_member.hpp", + "external/sources/boost/serialization/stack.hpp", + "external/sources/boost/serialization/state_saver.hpp", + "external/sources/boost/serialization/static_warning.hpp", + "external/sources/boost/serialization/string.hpp", + "external/sources/boost/serialization/strong_typedef.hpp", + "external/sources/boost/serialization/throw_exception.hpp", + "external/sources/boost/serialization/tracking.hpp", + "external/sources/boost/serialization/tracking_enum.hpp", + "external/sources/boost/serialization/traits.hpp", + "external/sources/boost/serialization/type_info_implementation.hpp", + "external/sources/boost/serialization/unique_ptr.hpp", + "external/sources/boost/serialization/unordered_collections_load_imp.hpp", + "external/sources/boost/serialization/unordered_collections_save_imp.hpp", + "external/sources/boost/serialization/unordered_map.hpp", + "external/sources/boost/serialization/unordered_set.hpp", + "external/sources/boost/serialization/utility.hpp", + "external/sources/boost/serialization/valarray.hpp", + "external/sources/boost/serialization/variant.hpp", + "external/sources/boost/serialization/vector.hpp", + "external/sources/boost/serialization/vector_135.hpp", + "external/sources/boost/serialization/version.hpp", + "external/sources/boost/serialization/void_cast.hpp", + "external/sources/boost/serialization/void_cast_fwd.hpp", + "external/sources/boost/serialization/weak_ptr.hpp", + "external/sources/boost/serialization/wrapper.hpp", + "external/sources/boost/shared_array.hpp", + "external/sources/boost/shared_container_iterator.hpp", + "external/sources/boost/shared_ptr.hpp", + "external/sources/boost/signals2.hpp", + "external/sources/boost/signals2/connection.hpp", + "external/sources/boost/signals2/deconstruct.hpp", + "external/sources/boost/signals2/deconstruct_ptr.hpp", + "external/sources/boost/signals2/detail/auto_buffer.hpp", + "external/sources/boost/signals2/detail/foreign_ptr.hpp", + "external/sources/boost/signals2/detail/lwm_nop.hpp", + "external/sources/boost/signals2/detail/lwm_pthreads.hpp", + "external/sources/boost/signals2/detail/lwm_win32_cs.hpp", + "external/sources/boost/signals2/detail/null_output_iterator.hpp", + "external/sources/boost/signals2/detail/preprocessed_arg_type.hpp", + "external/sources/boost/signals2/detail/preprocessed_arg_type_template.hpp", + "external/sources/boost/signals2/detail/replace_slot_function.hpp", + "external/sources/boost/signals2/detail/result_type_wrapper.hpp", + "external/sources/boost/signals2/detail/scope_guard.hpp", + "external/sources/boost/signals2/detail/signal_template.hpp", + "external/sources/boost/signals2/detail/signals_common.hpp", + "external/sources/boost/signals2/detail/signals_common_macros.hpp", + "external/sources/boost/signals2/detail/slot_call_iterator.hpp", + "external/sources/boost/signals2/detail/slot_groups.hpp", + "external/sources/boost/signals2/detail/slot_template.hpp", + "external/sources/boost/signals2/detail/tracked_objects_visitor.hpp", + "external/sources/boost/signals2/detail/unique_lock.hpp", + "external/sources/boost/signals2/detail/variadic_arg_type.hpp", + "external/sources/boost/signals2/detail/variadic_slot_invoker.hpp", + "external/sources/boost/signals2/dummy_mutex.hpp", + "external/sources/boost/signals2/expired_slot.hpp", + "external/sources/boost/signals2/last_value.hpp", + "external/sources/boost/signals2/mutex.hpp", + "external/sources/boost/signals2/optional_last_value.hpp", + "external/sources/boost/signals2/postconstructible.hpp", + "external/sources/boost/signals2/predestructible.hpp", + "external/sources/boost/signals2/preprocessed_signal.hpp", + "external/sources/boost/signals2/preprocessed_slot.hpp", + "external/sources/boost/signals2/shared_connection_block.hpp", + "external/sources/boost/signals2/signal.hpp", + "external/sources/boost/signals2/signal_base.hpp", + "external/sources/boost/signals2/signal_type.hpp", + "external/sources/boost/signals2/slot.hpp", + "external/sources/boost/signals2/slot_base.hpp", + "external/sources/boost/signals2/trackable.hpp", + "external/sources/boost/signals2/variadic_signal.hpp", + "external/sources/boost/signals2/variadic_slot.hpp", + "external/sources/boost/smart_ptr.hpp", + "external/sources/boost/smart_ptr/allocate_local_shared_array.hpp", + "external/sources/boost/smart_ptr/allocate_shared_array.hpp", + "external/sources/boost/smart_ptr/allocate_unique.hpp", + "external/sources/boost/smart_ptr/atomic_shared_ptr.hpp", + "external/sources/boost/smart_ptr/bad_weak_ptr.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_gcc.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_nt.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_pt.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_spin.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_std_atomic.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_sync.hpp", + "external/sources/boost/smart_ptr/detail/atomic_count_win32.hpp", + "external/sources/boost/smart_ptr/detail/lightweight_mutex.hpp", + "external/sources/boost/smart_ptr/detail/lightweight_thread.hpp", + "external/sources/boost/smart_ptr/detail/local_counted_base.hpp", + "external/sources/boost/smart_ptr/detail/local_sp_deleter.hpp", + "external/sources/boost/smart_ptr/detail/lwm_pthreads.hpp", + "external/sources/boost/smart_ptr/detail/lwm_std_mutex.hpp", + "external/sources/boost/smart_ptr/detail/lwm_win32_cs.hpp", + "external/sources/boost/smart_ptr/detail/operator_bool.hpp", + "external/sources/boost/smart_ptr/detail/quick_allocator.hpp", + "external/sources/boost/smart_ptr/detail/shared_count.hpp", + "external/sources/boost/smart_ptr/detail/sp_convertible.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_aix.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_nt.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_pt.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_spin.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_sync.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_base_w32.hpp", + "external/sources/boost/smart_ptr/detail/sp_counted_impl.hpp", + "external/sources/boost/smart_ptr/detail/sp_disable_deprecated.hpp", + "external/sources/boost/smart_ptr/detail/sp_forward.hpp", + "external/sources/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp", + "external/sources/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp", + "external/sources/boost/smart_ptr/detail/sp_interlocked.hpp", + "external/sources/boost/smart_ptr/detail/sp_noexcept.hpp", + "external/sources/boost/smart_ptr/detail/sp_nullptr_t.hpp", + "external/sources/boost/smart_ptr/detail/sp_obsolete.hpp", + "external/sources/boost/smart_ptr/detail/sp_thread_pause.hpp", + "external/sources/boost/smart_ptr/detail/sp_thread_sleep.hpp", + "external/sources/boost/smart_ptr/detail/sp_thread_yield.hpp", + "external/sources/boost/smart_ptr/detail/sp_typeinfo_.hpp", + "external/sources/boost/smart_ptr/detail/sp_win32_sleep.hpp", + "external/sources/boost/smart_ptr/detail/spinlock.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_gcc_arm.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_nt.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_pool.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_pt.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_std_atomic.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_sync.hpp", + "external/sources/boost/smart_ptr/detail/spinlock_w32.hpp", + "external/sources/boost/smart_ptr/detail/yield_k.hpp", + "external/sources/boost/smart_ptr/enable_shared_from.hpp", + "external/sources/boost/smart_ptr/enable_shared_from_raw.hpp", + "external/sources/boost/smart_ptr/enable_shared_from_this.hpp", + "external/sources/boost/smart_ptr/intrusive_ptr.hpp", + "external/sources/boost/smart_ptr/intrusive_ref_counter.hpp", + "external/sources/boost/smart_ptr/local_shared_ptr.hpp", + "external/sources/boost/smart_ptr/make_local_shared.hpp", + "external/sources/boost/smart_ptr/make_local_shared_array.hpp", + "external/sources/boost/smart_ptr/make_local_shared_object.hpp", + "external/sources/boost/smart_ptr/make_shared.hpp", + "external/sources/boost/smart_ptr/make_shared_array.hpp", + "external/sources/boost/smart_ptr/make_shared_object.hpp", + "external/sources/boost/smart_ptr/make_unique.hpp", + "external/sources/boost/smart_ptr/owner_equal_to.hpp", + "external/sources/boost/smart_ptr/owner_hash.hpp", + "external/sources/boost/smart_ptr/owner_less.hpp", + "external/sources/boost/smart_ptr/scoped_array.hpp", + "external/sources/boost/smart_ptr/scoped_ptr.hpp", + "external/sources/boost/smart_ptr/shared_array.hpp", + "external/sources/boost/smart_ptr/shared_ptr.hpp", + "external/sources/boost/smart_ptr/weak_ptr.hpp", + "external/sources/boost/sort/block_indirect_sort/blk_detail/backbone.hpp", + "external/sources/boost/sort/block_indirect_sort/blk_detail/block.hpp", + "external/sources/boost/sort/block_indirect_sort/blk_detail/constants.hpp", + "external/sources/boost/sort/block_indirect_sort/blk_detail/merge_blocks.hpp", + "external/sources/boost/sort/block_indirect_sort/blk_detail/move_blocks.hpp", + "external/sources/boost/sort/block_indirect_sort/blk_detail/parallel_sort.hpp", + "external/sources/boost/sort/block_indirect_sort/block_indirect_sort.hpp", + "external/sources/boost/sort/common/deque_cnc.hpp", + "external/sources/boost/sort/common/file_vector.hpp", + "external/sources/boost/sort/common/indirect.hpp", + "external/sources/boost/sort/common/int_array.hpp", + "external/sources/boost/sort/common/merge_block.hpp", + "external/sources/boost/sort/common/merge_four.hpp", + "external/sources/boost/sort/common/merge_vector.hpp", + "external/sources/boost/sort/common/pivot.hpp", + "external/sources/boost/sort/common/range.hpp", + "external/sources/boost/sort/common/rearrange.hpp", + "external/sources/boost/sort/common/scheduler.hpp", + "external/sources/boost/sort/common/sort_basic.hpp", + "external/sources/boost/sort/common/spinlock.hpp", + "external/sources/boost/sort/common/stack_cnc.hpp", + "external/sources/boost/sort/common/time_measure.hpp", + "external/sources/boost/sort/common/util/algorithm.hpp", + "external/sources/boost/sort/common/util/atomic.hpp", + "external/sources/boost/sort/common/util/circular_buffer.hpp", + "external/sources/boost/sort/common/util/insert.hpp", + "external/sources/boost/sort/common/util/merge.hpp", + "external/sources/boost/sort/common/util/search.hpp", + "external/sources/boost/sort/common/util/traits.hpp", + "external/sources/boost/sort/flat_stable_sort/flat_stable_sort.hpp", + "external/sources/boost/sort/heap_sort/heap_sort.hpp", + "external/sources/boost/sort/insert_sort/insert_sort.hpp", + "external/sources/boost/sort/parallel_stable_sort/parallel_stable_sort.hpp", + "external/sources/boost/sort/pdqsort/pdqsort.hpp", + "external/sources/boost/sort/sample_sort/sample_sort.hpp", + "external/sources/boost/sort/sort.hpp", + "external/sources/boost/sort/spinsort/spinsort.hpp", + "external/sources/boost/sort/spreadsort/detail/constants.hpp", + "external/sources/boost/sort/spreadsort/detail/float_sort.hpp", + "external/sources/boost/sort/spreadsort/detail/integer_sort.hpp", + "external/sources/boost/sort/spreadsort/detail/spreadsort_common.hpp", + "external/sources/boost/sort/spreadsort/detail/string_sort.hpp", + "external/sources/boost/sort/spreadsort/float_sort.hpp", + "external/sources/boost/sort/spreadsort/integer_sort.hpp", + "external/sources/boost/sort/spreadsort/spreadsort.hpp", + "external/sources/boost/sort/spreadsort/string_sort.hpp", + "external/sources/boost/spirit.hpp", + "external/sources/boost/spirit/home/classic.hpp", + "external/sources/boost/spirit/home/classic/actor.hpp", + "external/sources/boost/spirit/home/classic/actor/assign_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/assign_key_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/clear_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/decrement_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/erase_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/increment_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/insert_at_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/insert_key_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/push_back_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/push_front_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/ref_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/ref_const_ref_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp", + "external/sources/boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/ref_value_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/swap_actor.hpp", + "external/sources/boost/spirit/home/classic/actor/typeof.hpp", + "external/sources/boost/spirit/home/classic/attribute.hpp", + "external/sources/boost/spirit/home/classic/attribute/closure.hpp", + "external/sources/boost/spirit/home/classic/attribute/closure_context.hpp", + "external/sources/boost/spirit/home/classic/attribute/closure_fwd.hpp", + "external/sources/boost/spirit/home/classic/attribute/parametric.hpp", + "external/sources/boost/spirit/home/classic/attribute/typeof.hpp", + "external/sources/boost/spirit/home/classic/core.hpp", + "external/sources/boost/spirit/home/classic/core/assert.hpp", + "external/sources/boost/spirit/home/classic/core/composite/actions.hpp", + "external/sources/boost/spirit/home/classic/core/composite/alternative.hpp", + "external/sources/boost/spirit/home/classic/core/composite/composite.hpp", + "external/sources/boost/spirit/home/classic/core/composite/difference.hpp", + "external/sources/boost/spirit/home/classic/core/composite/directives.hpp", + "external/sources/boost/spirit/home/classic/core/composite/epsilon.hpp", + "external/sources/boost/spirit/home/classic/core/composite/exclusive_or.hpp", + "external/sources/boost/spirit/home/classic/core/composite/impl/alternative.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/difference.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/directives.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/exclusive_or.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/intersection.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/kleene_star.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/list.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/optional.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/positive.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/sequence.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/sequential_and.ipp", + "external/sources/boost/spirit/home/classic/core/composite/impl/sequential_or.ipp", + "external/sources/boost/spirit/home/classic/core/composite/intersection.hpp", + "external/sources/boost/spirit/home/classic/core/composite/kleene_star.hpp", + "external/sources/boost/spirit/home/classic/core/composite/list.hpp", + "external/sources/boost/spirit/home/classic/core/composite/no_actions.hpp", + "external/sources/boost/spirit/home/classic/core/composite/operators.hpp", + "external/sources/boost/spirit/home/classic/core/composite/optional.hpp", + "external/sources/boost/spirit/home/classic/core/composite/positive.hpp", + "external/sources/boost/spirit/home/classic/core/composite/sequence.hpp", + "external/sources/boost/spirit/home/classic/core/composite/sequential_and.hpp", + "external/sources/boost/spirit/home/classic/core/composite/sequential_or.hpp", + "external/sources/boost/spirit/home/classic/core/config.hpp", + "external/sources/boost/spirit/home/classic/core/impl/match.ipp", + "external/sources/boost/spirit/home/classic/core/impl/match_attr_traits.ipp", + "external/sources/boost/spirit/home/classic/core/impl/parser.ipp", + "external/sources/boost/spirit/home/classic/core/match.hpp", + "external/sources/boost/spirit/home/classic/core/nil.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/grammar.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp", + "external/sources/boost/spirit/home/classic/core/non_terminal/impl/object_with_id.ipp", + "external/sources/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp", + "external/sources/boost/spirit/home/classic/core/non_terminal/impl/static.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp", + "external/sources/boost/spirit/home/classic/core/non_terminal/parser_context.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/parser_id.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/rule.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/subrule.hpp", + "external/sources/boost/spirit/home/classic/core/non_terminal/subrule_fwd.hpp", + "external/sources/boost/spirit/home/classic/core/parser.hpp", + "external/sources/boost/spirit/home/classic/core/primitives/impl/numerics.ipp", + "external/sources/boost/spirit/home/classic/core/primitives/impl/primitives.ipp", + "external/sources/boost/spirit/home/classic/core/primitives/numerics.hpp", + "external/sources/boost/spirit/home/classic/core/primitives/numerics_fwd.hpp", + "external/sources/boost/spirit/home/classic/core/primitives/primitives.hpp", + "external/sources/boost/spirit/home/classic/core/safe_bool.hpp", + "external/sources/boost/spirit/home/classic/core/scanner/impl/skipper.ipp", + "external/sources/boost/spirit/home/classic/core/scanner/scanner.hpp", + "external/sources/boost/spirit/home/classic/core/scanner/scanner_fwd.hpp", + "external/sources/boost/spirit/home/classic/core/scanner/skipper.hpp", + "external/sources/boost/spirit/home/classic/core/scanner/skipper_fwd.hpp", + "external/sources/boost/spirit/home/classic/core/typeof.hpp", + "external/sources/boost/spirit/home/classic/debug.hpp", + "external/sources/boost/spirit/home/classic/dynamic.hpp", + "external/sources/boost/spirit/home/classic/dynamic/for.hpp", + "external/sources/boost/spirit/home/classic/dynamic/if.hpp", + "external/sources/boost/spirit/home/classic/dynamic/impl/conditions.ipp", + "external/sources/boost/spirit/home/classic/dynamic/impl/select.ipp", + "external/sources/boost/spirit/home/classic/dynamic/impl/switch.ipp", + "external/sources/boost/spirit/home/classic/dynamic/lazy.hpp", + "external/sources/boost/spirit/home/classic/dynamic/rule_alias.hpp", + "external/sources/boost/spirit/home/classic/dynamic/select.hpp", + "external/sources/boost/spirit/home/classic/dynamic/stored_rule.hpp", + "external/sources/boost/spirit/home/classic/dynamic/stored_rule_fwd.hpp", + "external/sources/boost/spirit/home/classic/dynamic/switch.hpp", + "external/sources/boost/spirit/home/classic/dynamic/typeof.hpp", + "external/sources/boost/spirit/home/classic/dynamic/while.hpp", + "external/sources/boost/spirit/home/classic/error_handling.hpp", + "external/sources/boost/spirit/home/classic/error_handling/exceptions.hpp", + "external/sources/boost/spirit/home/classic/error_handling/exceptions_fwd.hpp", + "external/sources/boost/spirit/home/classic/error_handling/impl/exceptions.ipp", + "external/sources/boost/spirit/home/classic/error_handling/typeof.hpp", + "external/sources/boost/spirit/home/classic/iterator.hpp", + "external/sources/boost/spirit/home/classic/iterator/file_iterator.hpp", + "external/sources/boost/spirit/home/classic/iterator/file_iterator_fwd.hpp", + "external/sources/boost/spirit/home/classic/iterator/fixed_size_queue.hpp", + "external/sources/boost/spirit/home/classic/iterator/impl/file_iterator.ipp", + "external/sources/boost/spirit/home/classic/iterator/impl/position_iterator.ipp", + "external/sources/boost/spirit/home/classic/iterator/multi_pass.hpp", + "external/sources/boost/spirit/home/classic/iterator/multi_pass_fwd.hpp", + "external/sources/boost/spirit/home/classic/iterator/position_iterator.hpp", + "external/sources/boost/spirit/home/classic/iterator/position_iterator_fwd.hpp", + "external/sources/boost/spirit/home/classic/iterator/typeof.hpp", + "external/sources/boost/spirit/home/classic/meta.hpp", + "external/sources/boost/spirit/home/classic/meta/as_parser.hpp", + "external/sources/boost/spirit/home/classic/meta/fundamental.hpp", + "external/sources/boost/spirit/home/classic/meta/impl/fundamental.ipp", + "external/sources/boost/spirit/home/classic/meta/impl/parser_traits.ipp", + "external/sources/boost/spirit/home/classic/meta/impl/refactoring.ipp", + "external/sources/boost/spirit/home/classic/meta/impl/traverse.ipp", + "external/sources/boost/spirit/home/classic/meta/parser_traits.hpp", + "external/sources/boost/spirit/home/classic/meta/refactoring.hpp", + "external/sources/boost/spirit/home/classic/meta/traverse.hpp", + "external/sources/boost/spirit/home/classic/namespace.hpp", + "external/sources/boost/spirit/home/classic/phoenix.hpp", + "external/sources/boost/spirit/home/classic/phoenix/actor.hpp", + "external/sources/boost/spirit/home/classic/phoenix/binders.hpp", + "external/sources/boost/spirit/home/classic/phoenix/casts.hpp", + "external/sources/boost/spirit/home/classic/phoenix/closures.hpp", + "external/sources/boost/spirit/home/classic/phoenix/composite.hpp", + "external/sources/boost/spirit/home/classic/phoenix/functions.hpp", + "external/sources/boost/spirit/home/classic/phoenix/new.hpp", + "external/sources/boost/spirit/home/classic/phoenix/operators.hpp", + "external/sources/boost/spirit/home/classic/phoenix/primitives.hpp", + "external/sources/boost/spirit/home/classic/phoenix/special_ops.hpp", + "external/sources/boost/spirit/home/classic/phoenix/statements.hpp", + "external/sources/boost/spirit/home/classic/phoenix/tuple_helpers.hpp", + "external/sources/boost/spirit/home/classic/phoenix/tuples.hpp", + "external/sources/boost/spirit/home/classic/symbols.hpp", + "external/sources/boost/spirit/home/classic/symbols/impl/symbols.ipp", + "external/sources/boost/spirit/home/classic/symbols/impl/tst.ipp", + "external/sources/boost/spirit/home/classic/symbols/symbols.hpp", + "external/sources/boost/spirit/home/classic/symbols/symbols_fwd.hpp", + "external/sources/boost/spirit/home/classic/symbols/typeof.hpp", + "external/sources/boost/spirit/home/classic/tree/ast.hpp", + "external/sources/boost/spirit/home/classic/tree/ast_fwd.hpp", + "external/sources/boost/spirit/home/classic/tree/common.hpp", + "external/sources/boost/spirit/home/classic/tree/common_fwd.hpp", + "external/sources/boost/spirit/home/classic/tree/impl/parse_tree_utils.ipp", + "external/sources/boost/spirit/home/classic/tree/impl/tree_to_xml.ipp", + "external/sources/boost/spirit/home/classic/tree/parse_tree.hpp", + "external/sources/boost/spirit/home/classic/tree/parse_tree_fwd.hpp", + "external/sources/boost/spirit/home/classic/tree/parse_tree_utils.hpp", + "external/sources/boost/spirit/home/classic/tree/parsetree.dtd", + "external/sources/boost/spirit/home/classic/tree/tree_to_xml.hpp", + "external/sources/boost/spirit/home/classic/tree/typeof.hpp", + "external/sources/boost/spirit/home/classic/utility.hpp", + "external/sources/boost/spirit/home/classic/utility/chset.hpp", + "external/sources/boost/spirit/home/classic/utility/chset_operators.hpp", + "external/sources/boost/spirit/home/classic/utility/confix.hpp", + "external/sources/boost/spirit/home/classic/utility/confix_fwd.hpp", + "external/sources/boost/spirit/home/classic/utility/distinct.hpp", + "external/sources/boost/spirit/home/classic/utility/distinct_fwd.hpp", + "external/sources/boost/spirit/home/classic/utility/escape_char.hpp", + "external/sources/boost/spirit/home/classic/utility/escape_char_fwd.hpp", + "external/sources/boost/spirit/home/classic/utility/flush_multi_pass.hpp", + "external/sources/boost/spirit/home/classic/utility/functor_parser.hpp", + "external/sources/boost/spirit/home/classic/utility/grammar_def.hpp", + "external/sources/boost/spirit/home/classic/utility/grammar_def_fwd.hpp", + "external/sources/boost/spirit/home/classic/utility/impl/chset.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp", + "external/sources/boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/chset/range_run.hpp", + "external/sources/boost/spirit/home/classic/utility/impl/chset/range_run.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/chset_operators.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/confix.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/escape_char.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/lists.ipp", + "external/sources/boost/spirit/home/classic/utility/impl/regex.ipp", + "external/sources/boost/spirit/home/classic/utility/lists.hpp", + "external/sources/boost/spirit/home/classic/utility/lists_fwd.hpp", + "external/sources/boost/spirit/home/classic/utility/loops.hpp", + "external/sources/boost/spirit/home/classic/utility/regex.hpp", + "external/sources/boost/spirit/home/classic/utility/rule_parser.hpp", + "external/sources/boost/spirit/home/classic/utility/scoped_lock.hpp", + "external/sources/boost/spirit/home/classic/utility/typeof.hpp", + "external/sources/boost/spirit/home/classic/version.hpp", + "external/sources/boost/spirit/home/karma.hpp", + "external/sources/boost/spirit/home/karma/action.hpp", + "external/sources/boost/spirit/home/karma/action/action.hpp", + "external/sources/boost/spirit/home/karma/auto.hpp", + "external/sources/boost/spirit/home/karma/auto/auto.hpp", + "external/sources/boost/spirit/home/karma/auto/create_generator.hpp", + "external/sources/boost/spirit/home/karma/auto/meta_create.hpp", + "external/sources/boost/spirit/home/karma/auxiliary.hpp", + "external/sources/boost/spirit/home/karma/auxiliary/attr_cast.hpp", + "external/sources/boost/spirit/home/karma/auxiliary/eol.hpp", + "external/sources/boost/spirit/home/karma/auxiliary/eps.hpp", + "external/sources/boost/spirit/home/karma/auxiliary/lazy.hpp", + "external/sources/boost/spirit/home/karma/binary.hpp", + "external/sources/boost/spirit/home/karma/binary/binary.hpp", + "external/sources/boost/spirit/home/karma/binary/padding.hpp", + "external/sources/boost/spirit/home/karma/char.hpp", + "external/sources/boost/spirit/home/karma/char/char.hpp", + "external/sources/boost/spirit/home/karma/char/char_class.hpp", + "external/sources/boost/spirit/home/karma/char/char_generator.hpp", + "external/sources/boost/spirit/home/karma/delimit_flag.hpp", + "external/sources/boost/spirit/home/karma/delimit_out.hpp", + "external/sources/boost/spirit/home/karma/detail/alternative_function.hpp", + "external/sources/boost/spirit/home/karma/detail/as.hpp", + "external/sources/boost/spirit/home/karma/detail/attributes.hpp", + "external/sources/boost/spirit/home/karma/detail/default_width.hpp", + "external/sources/boost/spirit/home/karma/detail/enable_lit.hpp", + "external/sources/boost/spirit/home/karma/detail/extract_from.hpp", + "external/sources/boost/spirit/home/karma/detail/fail_function.hpp", + "external/sources/boost/spirit/home/karma/detail/generate.hpp", + "external/sources/boost/spirit/home/karma/detail/generate_auto.hpp", + "external/sources/boost/spirit/home/karma/detail/generate_to.hpp", + "external/sources/boost/spirit/home/karma/detail/get_casetag.hpp", + "external/sources/boost/spirit/home/karma/detail/get_stricttag.hpp", + "external/sources/boost/spirit/home/karma/detail/indirect_iterator.hpp", + "external/sources/boost/spirit/home/karma/detail/output_iterator.hpp", + "external/sources/boost/spirit/home/karma/detail/pass_container.hpp", + "external/sources/boost/spirit/home/karma/detail/string_compare.hpp", + "external/sources/boost/spirit/home/karma/detail/string_generate.hpp", + "external/sources/boost/spirit/home/karma/detail/unused_delimiter.hpp", + "external/sources/boost/spirit/home/karma/directive.hpp", + "external/sources/boost/spirit/home/karma/directive/as.hpp", + "external/sources/boost/spirit/home/karma/directive/buffer.hpp", + "external/sources/boost/spirit/home/karma/directive/center_alignment.hpp", + "external/sources/boost/spirit/home/karma/directive/columns.hpp", + "external/sources/boost/spirit/home/karma/directive/delimit.hpp", + "external/sources/boost/spirit/home/karma/directive/duplicate.hpp", + "external/sources/boost/spirit/home/karma/directive/encoding.hpp", + "external/sources/boost/spirit/home/karma/directive/left_alignment.hpp", + "external/sources/boost/spirit/home/karma/directive/maxwidth.hpp", + "external/sources/boost/spirit/home/karma/directive/no_delimit.hpp", + "external/sources/boost/spirit/home/karma/directive/omit.hpp", + "external/sources/boost/spirit/home/karma/directive/repeat.hpp", + "external/sources/boost/spirit/home/karma/directive/right_alignment.hpp", + "external/sources/boost/spirit/home/karma/directive/strict_relaxed.hpp", + "external/sources/boost/spirit/home/karma/directive/upper_lower_case.hpp", + "external/sources/boost/spirit/home/karma/directive/verbatim.hpp", + "external/sources/boost/spirit/home/karma/domain.hpp", + "external/sources/boost/spirit/home/karma/format.hpp", + "external/sources/boost/spirit/home/karma/format_auto.hpp", + "external/sources/boost/spirit/home/karma/generate.hpp", + "external/sources/boost/spirit/home/karma/generate_attr.hpp", + "external/sources/boost/spirit/home/karma/generator.hpp", + "external/sources/boost/spirit/home/karma/meta_compiler.hpp", + "external/sources/boost/spirit/home/karma/nonterminal.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/debug_handler.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/debug_handler_state.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/detail/fcall.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/detail/parameterized.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/grammar.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/nonterminal_fwd.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/rule.hpp", + "external/sources/boost/spirit/home/karma/nonterminal/simple_trace.hpp", + "external/sources/boost/spirit/home/karma/numeric.hpp", + "external/sources/boost/spirit/home/karma/numeric/bool.hpp", + "external/sources/boost/spirit/home/karma/numeric/bool_policies.hpp", + "external/sources/boost/spirit/home/karma/numeric/detail/bool_utils.hpp", + "external/sources/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp", + "external/sources/boost/spirit/home/karma/numeric/detail/real_utils.hpp", + "external/sources/boost/spirit/home/karma/numeric/int.hpp", + "external/sources/boost/spirit/home/karma/numeric/real.hpp", + "external/sources/boost/spirit/home/karma/numeric/real_policies.hpp", + "external/sources/boost/spirit/home/karma/numeric/uint.hpp", + "external/sources/boost/spirit/home/karma/operator.hpp", + "external/sources/boost/spirit/home/karma/operator/alternative.hpp", + "external/sources/boost/spirit/home/karma/operator/and_predicate.hpp", + "external/sources/boost/spirit/home/karma/operator/kleene.hpp", + "external/sources/boost/spirit/home/karma/operator/list.hpp", + "external/sources/boost/spirit/home/karma/operator/not_predicate.hpp", + "external/sources/boost/spirit/home/karma/operator/optional.hpp", + "external/sources/boost/spirit/home/karma/operator/plus.hpp", + "external/sources/boost/spirit/home/karma/operator/sequence.hpp", + "external/sources/boost/spirit/home/karma/phoenix_attributes.hpp", + "external/sources/boost/spirit/home/karma/reference.hpp", + "external/sources/boost/spirit/home/karma/stream.hpp", + "external/sources/boost/spirit/home/karma/stream/detail/format_manip.hpp", + "external/sources/boost/spirit/home/karma/stream/detail/format_manip_auto.hpp", + "external/sources/boost/spirit/home/karma/stream/format_manip.hpp", + "external/sources/boost/spirit/home/karma/stream/format_manip_attr.hpp", + "external/sources/boost/spirit/home/karma/stream/ostream_iterator.hpp", + "external/sources/boost/spirit/home/karma/stream/stream.hpp", + "external/sources/boost/spirit/home/karma/string.hpp", + "external/sources/boost/spirit/home/karma/string/lit.hpp", + "external/sources/boost/spirit/home/karma/string/symbols.hpp", + "external/sources/boost/spirit/home/karma/what.hpp", + "external/sources/boost/spirit/home/lex.hpp", + "external/sources/boost/spirit/home/lex/argument.hpp", + "external/sources/boost/spirit/home/lex/argument_phoenix.hpp", + "external/sources/boost/spirit/home/lex/detail/sequence_function.hpp", + "external/sources/boost/spirit/home/lex/domain.hpp", + "external/sources/boost/spirit/home/lex/lexer.hpp", + "external/sources/boost/spirit/home/lex/lexer/action.hpp", + "external/sources/boost/spirit/home/lex/lexer/char_token_def.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexer.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/functor.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/iterator.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/lexer.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/position_token.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/static_version.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/token.hpp", + "external/sources/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp", + "external/sources/boost/spirit/home/lex/lexer/pass_flags.hpp", + "external/sources/boost/spirit/home/lex/lexer/sequence.hpp", + "external/sources/boost/spirit/home/lex/lexer/string_token_def.hpp", + "external/sources/boost/spirit/home/lex/lexer/support_functions.hpp", + "external/sources/boost/spirit/home/lex/lexer/support_functions_expression.hpp", + "external/sources/boost/spirit/home/lex/lexer/terminals.hpp", + "external/sources/boost/spirit/home/lex/lexer/token_def.hpp", + "external/sources/boost/spirit/home/lex/lexer_lexertl.hpp", + "external/sources/boost/spirit/home/lex/lexer_static_lexertl.hpp", + "external/sources/boost/spirit/home/lex/lexer_type.hpp", + "external/sources/boost/spirit/home/lex/meta_compiler.hpp", + "external/sources/boost/spirit/home/lex/primitives.hpp", + "external/sources/boost/spirit/home/lex/qi.hpp", + "external/sources/boost/spirit/home/lex/qi/in_state.hpp", + "external/sources/boost/spirit/home/lex/qi/plain_raw_token.hpp", + "external/sources/boost/spirit/home/lex/qi/plain_token.hpp", + "external/sources/boost/spirit/home/lex/qi/plain_tokenid.hpp", + "external/sources/boost/spirit/home/lex/qi/plain_tokenid_mask.hpp", + "external/sources/boost/spirit/home/lex/qi/state_switcher.hpp", + "external/sources/boost/spirit/home/lex/reference.hpp", + "external/sources/boost/spirit/home/lex/tokenize_and_parse.hpp", + "external/sources/boost/spirit/home/lex/tokenize_and_parse_attr.hpp", + "external/sources/boost/spirit/home/qi.hpp", + "external/sources/boost/spirit/home/qi/action.hpp", + "external/sources/boost/spirit/home/qi/action/action.hpp", + "external/sources/boost/spirit/home/qi/auto.hpp", + "external/sources/boost/spirit/home/qi/auto/auto.hpp", + "external/sources/boost/spirit/home/qi/auto/create_parser.hpp", + "external/sources/boost/spirit/home/qi/auto/meta_create.hpp", + "external/sources/boost/spirit/home/qi/auxiliary.hpp", + "external/sources/boost/spirit/home/qi/auxiliary/attr.hpp", + "external/sources/boost/spirit/home/qi/auxiliary/attr_cast.hpp", + "external/sources/boost/spirit/home/qi/auxiliary/eoi.hpp", + "external/sources/boost/spirit/home/qi/auxiliary/eol.hpp", + "external/sources/boost/spirit/home/qi/auxiliary/eps.hpp", + "external/sources/boost/spirit/home/qi/auxiliary/lazy.hpp", + "external/sources/boost/spirit/home/qi/binary.hpp", + "external/sources/boost/spirit/home/qi/binary/binary.hpp", + "external/sources/boost/spirit/home/qi/char.hpp", + "external/sources/boost/spirit/home/qi/char/char.hpp", + "external/sources/boost/spirit/home/qi/char/char_class.hpp", + "external/sources/boost/spirit/home/qi/char/char_parser.hpp", + "external/sources/boost/spirit/home/qi/copy.hpp", + "external/sources/boost/spirit/home/qi/detail/alternative_function.hpp", + "external/sources/boost/spirit/home/qi/detail/assign_to.hpp", + "external/sources/boost/spirit/home/qi/detail/attributes.hpp", + "external/sources/boost/spirit/home/qi/detail/construct.hpp", + "external/sources/boost/spirit/home/qi/detail/enable_lit.hpp", + "external/sources/boost/spirit/home/qi/detail/expect_function.hpp", + "external/sources/boost/spirit/home/qi/detail/expectation_failure.hpp", + "external/sources/boost/spirit/home/qi/detail/fail_function.hpp", + "external/sources/boost/spirit/home/qi/detail/parse.hpp", + "external/sources/boost/spirit/home/qi/detail/parse_auto.hpp", + "external/sources/boost/spirit/home/qi/detail/pass_container.hpp", + "external/sources/boost/spirit/home/qi/detail/pass_function.hpp", + "external/sources/boost/spirit/home/qi/detail/permute_function.hpp", + "external/sources/boost/spirit/home/qi/detail/string_parse.hpp", + "external/sources/boost/spirit/home/qi/detail/unused_skipper.hpp", + "external/sources/boost/spirit/home/qi/directive.hpp", + "external/sources/boost/spirit/home/qi/directive/as.hpp", + "external/sources/boost/spirit/home/qi/directive/encoding.hpp", + "external/sources/boost/spirit/home/qi/directive/expect.hpp", + "external/sources/boost/spirit/home/qi/directive/hold.hpp", + "external/sources/boost/spirit/home/qi/directive/lexeme.hpp", + "external/sources/boost/spirit/home/qi/directive/matches.hpp", + "external/sources/boost/spirit/home/qi/directive/no_case.hpp", + "external/sources/boost/spirit/home/qi/directive/no_skip.hpp", + "external/sources/boost/spirit/home/qi/directive/omit.hpp", + "external/sources/boost/spirit/home/qi/directive/raw.hpp", + "external/sources/boost/spirit/home/qi/directive/repeat.hpp", + "external/sources/boost/spirit/home/qi/directive/skip.hpp", + "external/sources/boost/spirit/home/qi/domain.hpp", + "external/sources/boost/spirit/home/qi/match.hpp", + "external/sources/boost/spirit/home/qi/match_auto.hpp", + "external/sources/boost/spirit/home/qi/meta_compiler.hpp", + "external/sources/boost/spirit/home/qi/nonterminal.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/debug_handler.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/debug_handler_state.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/detail/fcall.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/error_handler.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/grammar.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/nonterminal_fwd.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/rule.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/simple_trace.hpp", + "external/sources/boost/spirit/home/qi/nonterminal/success_handler.hpp", + "external/sources/boost/spirit/home/qi/numeric.hpp", + "external/sources/boost/spirit/home/qi/numeric/bool.hpp", + "external/sources/boost/spirit/home/qi/numeric/bool_policies.hpp", + "external/sources/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp", + "external/sources/boost/spirit/home/qi/numeric/detail/real_impl.hpp", + "external/sources/boost/spirit/home/qi/numeric/int.hpp", + "external/sources/boost/spirit/home/qi/numeric/numeric_utils.hpp", + "external/sources/boost/spirit/home/qi/numeric/real.hpp", + "external/sources/boost/spirit/home/qi/numeric/real_policies.hpp", + "external/sources/boost/spirit/home/qi/numeric/uint.hpp", + "external/sources/boost/spirit/home/qi/operator.hpp", + "external/sources/boost/spirit/home/qi/operator/alternative.hpp", + "external/sources/boost/spirit/home/qi/operator/and_predicate.hpp", + "external/sources/boost/spirit/home/qi/operator/difference.hpp", + "external/sources/boost/spirit/home/qi/operator/expect.hpp", + "external/sources/boost/spirit/home/qi/operator/kleene.hpp", + "external/sources/boost/spirit/home/qi/operator/list.hpp", + "external/sources/boost/spirit/home/qi/operator/not_predicate.hpp", + "external/sources/boost/spirit/home/qi/operator/optional.hpp", + "external/sources/boost/spirit/home/qi/operator/permutation.hpp", + "external/sources/boost/spirit/home/qi/operator/plus.hpp", + "external/sources/boost/spirit/home/qi/operator/sequence.hpp", + "external/sources/boost/spirit/home/qi/operator/sequence_base.hpp", + "external/sources/boost/spirit/home/qi/operator/sequential_or.hpp", + "external/sources/boost/spirit/home/qi/parse.hpp", + "external/sources/boost/spirit/home/qi/parse_attr.hpp", + "external/sources/boost/spirit/home/qi/parser.hpp", + "external/sources/boost/spirit/home/qi/reference.hpp", + "external/sources/boost/spirit/home/qi/skip_flag.hpp", + "external/sources/boost/spirit/home/qi/skip_over.hpp", + "external/sources/boost/spirit/home/qi/stream.hpp", + "external/sources/boost/spirit/home/qi/stream/detail/match_manip.hpp", + "external/sources/boost/spirit/home/qi/stream/detail/match_manip_auto.hpp", + "external/sources/boost/spirit/home/qi/stream/match_manip.hpp", + "external/sources/boost/spirit/home/qi/stream/match_manip_attr.hpp", + "external/sources/boost/spirit/home/qi/stream/stream.hpp", + "external/sources/boost/spirit/home/qi/string.hpp", + "external/sources/boost/spirit/home/qi/string/detail/tst.hpp", + "external/sources/boost/spirit/home/qi/string/lit.hpp", + "external/sources/boost/spirit/home/qi/string/symbols.hpp", + "external/sources/boost/spirit/home/qi/string/tst.hpp", + "external/sources/boost/spirit/home/qi/string/tst_map.hpp", + "external/sources/boost/spirit/home/qi/what.hpp", + "external/sources/boost/spirit/home/support.hpp", + "external/sources/boost/spirit/home/support/action_dispatch.hpp", + "external/sources/boost/spirit/home/support/adapt_adt_attributes.hpp", + "external/sources/boost/spirit/home/support/algorithm/any.hpp", + "external/sources/boost/spirit/home/support/algorithm/any_if.hpp", + "external/sources/boost/spirit/home/support/algorithm/any_if_ns.hpp", + "external/sources/boost/spirit/home/support/algorithm/any_if_ns_so.hpp", + "external/sources/boost/spirit/home/support/algorithm/any_ns.hpp", + "external/sources/boost/spirit/home/support/algorithm/any_ns_so.hpp", + "external/sources/boost/spirit/home/support/argument.hpp", + "external/sources/boost/spirit/home/support/argument_expression.hpp", + "external/sources/boost/spirit/home/support/assert_msg.hpp", + "external/sources/boost/spirit/home/support/attributes.hpp", + "external/sources/boost/spirit/home/support/attributes_fwd.hpp", + "external/sources/boost/spirit/home/support/auto.hpp", + "external/sources/boost/spirit/home/support/auto/meta_create.hpp", + "external/sources/boost/spirit/home/support/auxiliary/attr_cast.hpp", + "external/sources/boost/spirit/home/support/char_class.hpp", + "external/sources/boost/spirit/home/support/char_encoding/ascii.hpp", + "external/sources/boost/spirit/home/support/char_encoding/iso8859_1.hpp", + "external/sources/boost/spirit/home/support/char_encoding/standard.hpp", + "external/sources/boost/spirit/home/support/char_encoding/standard_wide.hpp", + "external/sources/boost/spirit/home/support/char_encoding/unicode.hpp", + "external/sources/boost/spirit/home/support/char_encoding/unicode/category_table.hpp", + "external/sources/boost/spirit/home/support/char_encoding/unicode/lowercase_table.hpp", + "external/sources/boost/spirit/home/support/char_encoding/unicode/query.hpp", + "external/sources/boost/spirit/home/support/char_encoding/unicode/script_table.hpp", + "external/sources/boost/spirit/home/support/char_encoding/unicode/uppercase_table.hpp", + "external/sources/boost/spirit/home/support/char_set/basic_chset.hpp", + "external/sources/boost/spirit/home/support/char_set/range.hpp", + "external/sources/boost/spirit/home/support/char_set/range_functions.hpp", + "external/sources/boost/spirit/home/support/char_set/range_run.hpp", + "external/sources/boost/spirit/home/support/char_set/range_run_impl.hpp", + "external/sources/boost/spirit/home/support/common_terminals.hpp", + "external/sources/boost/spirit/home/support/container.hpp", + "external/sources/boost/spirit/home/support/context.hpp", + "external/sources/boost/spirit/home/support/detail/as_variant.hpp", + "external/sources/boost/spirit/home/support/detail/endian.hpp", + "external/sources/boost/spirit/home/support/detail/get_encoding.hpp", + "external/sources/boost/spirit/home/support/detail/hold_any.hpp", + "external/sources/boost/spirit/home/support/detail/is_spirit_tag.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/char_traits.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/consts.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/containers/ptr_list.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/containers/ptr_vector.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/conversion/char_state_machine.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/debug.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/file_input.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/generate_cpp.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/generate_re2c.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/generator.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/input.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/internals.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/parser.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tokeniser/num_token.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tree/end_node.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tree/iteration_node.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tree/leaf_node.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tree/node.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tree/selection_node.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/parser/tree/sequence_node.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/partition/charset.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/partition/equivset.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/rules.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/runtime_error.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/size_t.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/state_machine.hpp", + "external/sources/boost/spirit/home/support/detail/lexer/string_token.hpp", + "external/sources/boost/spirit/home/support/detail/make_cons.hpp", + "external/sources/boost/spirit/home/support/detail/make_vector.hpp", + "external/sources/boost/spirit/home/support/detail/pow10.hpp", + "external/sources/boost/spirit/home/support/detail/scoped_enum_emulation.hpp", + "external/sources/boost/spirit/home/support/detail/sign.hpp", + "external/sources/boost/spirit/home/support/detail/what_function.hpp", + "external/sources/boost/spirit/home/support/extended_variant.hpp", + "external/sources/boost/spirit/home/support/handles_container.hpp", + "external/sources/boost/spirit/home/support/has_semantic_action.hpp", + "external/sources/boost/spirit/home/support/info.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/buffering_input_iterator_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/combine_policies.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/istream_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/multi_pass.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/no_check_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp", + "external/sources/boost/spirit/home/support/iterators/istream_iterator.hpp", + "external/sources/boost/spirit/home/support/iterators/line_pos_iterator.hpp", + "external/sources/boost/spirit/home/support/iterators/look_ahead.hpp", + "external/sources/boost/spirit/home/support/iterators/multi_pass.hpp", + "external/sources/boost/spirit/home/support/iterators/multi_pass_fwd.hpp", + "external/sources/boost/spirit/home/support/iterators/ostream_iterator.hpp", + "external/sources/boost/spirit/home/support/lazy.hpp", + "external/sources/boost/spirit/home/support/limits.hpp", + "external/sources/boost/spirit/home/support/make_component.hpp", + "external/sources/boost/spirit/home/support/meta_compiler.hpp", + "external/sources/boost/spirit/home/support/modify.hpp", + "external/sources/boost/spirit/home/support/multi_pass.hpp", + "external/sources/boost/spirit/home/support/multi_pass_wrapper.hpp", + "external/sources/boost/spirit/home/support/nonterminal/expand_arg.hpp", + "external/sources/boost/spirit/home/support/nonterminal/extract_param.hpp", + "external/sources/boost/spirit/home/support/nonterminal/locals.hpp", + "external/sources/boost/spirit/home/support/numeric_traits.hpp", + "external/sources/boost/spirit/home/support/sequence_base_id.hpp", + "external/sources/boost/spirit/home/support/string_traits.hpp", + "external/sources/boost/spirit/home/support/terminal.hpp", + "external/sources/boost/spirit/home/support/terminal_expression.hpp", + "external/sources/boost/spirit/home/support/unused.hpp", + "external/sources/boost/spirit/home/support/utf8.hpp", + "external/sources/boost/spirit/home/support/utree.hpp", + "external/sources/boost/spirit/home/support/utree/detail/utree_detail1.hpp", + "external/sources/boost/spirit/home/support/utree/detail/utree_detail2.hpp", + "external/sources/boost/spirit/home/support/utree/operators.hpp", + "external/sources/boost/spirit/home/support/utree/utree.hpp", + "external/sources/boost/spirit/home/support/utree/utree_traits.hpp", + "external/sources/boost/spirit/home/support/utree/utree_traits_fwd.hpp", + "external/sources/boost/spirit/home/x3.hpp", + "external/sources/boost/spirit/home/x3/auxiliary.hpp", + "external/sources/boost/spirit/home/x3/auxiliary/any_parser.hpp", + "external/sources/boost/spirit/home/x3/auxiliary/attr.hpp", + "external/sources/boost/spirit/home/x3/auxiliary/eoi.hpp", + "external/sources/boost/spirit/home/x3/auxiliary/eol.hpp", + "external/sources/boost/spirit/home/x3/auxiliary/eps.hpp", + "external/sources/boost/spirit/home/x3/auxiliary/guard.hpp", + "external/sources/boost/spirit/home/x3/binary.hpp", + "external/sources/boost/spirit/home/x3/binary/binary.hpp", + "external/sources/boost/spirit/home/x3/char.hpp", + "external/sources/boost/spirit/home/x3/char/any_char.hpp", + "external/sources/boost/spirit/home/x3/char/char.hpp", + "external/sources/boost/spirit/home/x3/char/char_class.hpp", + "external/sources/boost/spirit/home/x3/char/char_class_tags.hpp", + "external/sources/boost/spirit/home/x3/char/char_parser.hpp", + "external/sources/boost/spirit/home/x3/char/char_set.hpp", + "external/sources/boost/spirit/home/x3/char/detail/cast_char.hpp", + "external/sources/boost/spirit/home/x3/char/literal_char.hpp", + "external/sources/boost/spirit/home/x3/char/negated_char_parser.hpp", + "external/sources/boost/spirit/home/x3/char/unicode.hpp", + "external/sources/boost/spirit/home/x3/core.hpp", + "external/sources/boost/spirit/home/x3/core/action.hpp", + "external/sources/boost/spirit/home/x3/core/call.hpp", + "external/sources/boost/spirit/home/x3/core/detail/parse_into_container.hpp", + "external/sources/boost/spirit/home/x3/core/parse.hpp", + "external/sources/boost/spirit/home/x3/core/parser.hpp", + "external/sources/boost/spirit/home/x3/core/proxy.hpp", + "external/sources/boost/spirit/home/x3/core/skip_over.hpp", + "external/sources/boost/spirit/home/x3/directive.hpp", + "external/sources/boost/spirit/home/x3/directive/confix.hpp", + "external/sources/boost/spirit/home/x3/directive/expect.hpp", + "external/sources/boost/spirit/home/x3/directive/lexeme.hpp", + "external/sources/boost/spirit/home/x3/directive/matches.hpp", + "external/sources/boost/spirit/home/x3/directive/no_case.hpp", + "external/sources/boost/spirit/home/x3/directive/no_skip.hpp", + "external/sources/boost/spirit/home/x3/directive/omit.hpp", + "external/sources/boost/spirit/home/x3/directive/raw.hpp", + "external/sources/boost/spirit/home/x3/directive/repeat.hpp", + "external/sources/boost/spirit/home/x3/directive/seek.hpp", + "external/sources/boost/spirit/home/x3/directive/skip.hpp", + "external/sources/boost/spirit/home/x3/directive/with.hpp", + "external/sources/boost/spirit/home/x3/nonterminal.hpp", + "external/sources/boost/spirit/home/x3/nonterminal/debug_handler_state.hpp", + "external/sources/boost/spirit/home/x3/nonterminal/detail/rule.hpp", + "external/sources/boost/spirit/home/x3/nonterminal/detail/transform_attribute.hpp", + "external/sources/boost/spirit/home/x3/nonterminal/rule.hpp", + "external/sources/boost/spirit/home/x3/nonterminal/simple_trace.hpp", + "external/sources/boost/spirit/home/x3/numeric.hpp", + "external/sources/boost/spirit/home/x3/numeric/bool.hpp", + "external/sources/boost/spirit/home/x3/numeric/bool_policies.hpp", + "external/sources/boost/spirit/home/x3/numeric/int.hpp", + "external/sources/boost/spirit/home/x3/numeric/real.hpp", + "external/sources/boost/spirit/home/x3/numeric/real_policies.hpp", + "external/sources/boost/spirit/home/x3/numeric/uint.hpp", + "external/sources/boost/spirit/home/x3/operator.hpp", + "external/sources/boost/spirit/home/x3/operator/alternative.hpp", + "external/sources/boost/spirit/home/x3/operator/and_predicate.hpp", + "external/sources/boost/spirit/home/x3/operator/detail/alternative.hpp", + "external/sources/boost/spirit/home/x3/operator/detail/sequence.hpp", + "external/sources/boost/spirit/home/x3/operator/difference.hpp", + "external/sources/boost/spirit/home/x3/operator/kleene.hpp", + "external/sources/boost/spirit/home/x3/operator/list.hpp", + "external/sources/boost/spirit/home/x3/operator/not_predicate.hpp", + "external/sources/boost/spirit/home/x3/operator/optional.hpp", + "external/sources/boost/spirit/home/x3/operator/plus.hpp", + "external/sources/boost/spirit/home/x3/operator/sequence.hpp", + "external/sources/boost/spirit/home/x3/string.hpp", + "external/sources/boost/spirit/home/x3/string/detail/no_case_string_parse.hpp", + "external/sources/boost/spirit/home/x3/string/detail/string_parse.hpp", + "external/sources/boost/spirit/home/x3/string/detail/tst.hpp", + "external/sources/boost/spirit/home/x3/string/literal_string.hpp", + "external/sources/boost/spirit/home/x3/string/symbols.hpp", + "external/sources/boost/spirit/home/x3/string/tst.hpp", + "external/sources/boost/spirit/home/x3/string/tst_map.hpp", + "external/sources/boost/spirit/home/x3/support/ast/position_tagged.hpp", + "external/sources/boost/spirit/home/x3/support/ast/variant.hpp", + "external/sources/boost/spirit/home/x3/support/context.hpp", + "external/sources/boost/spirit/home/x3/support/no_case.hpp", + "external/sources/boost/spirit/home/x3/support/numeric_utils/detail/extract_int.hpp", + "external/sources/boost/spirit/home/x3/support/numeric_utils/extract_int.hpp", + "external/sources/boost/spirit/home/x3/support/numeric_utils/extract_real.hpp", + "external/sources/boost/spirit/home/x3/support/numeric_utils/pow10.hpp", + "external/sources/boost/spirit/home/x3/support/numeric_utils/sign.hpp", + "external/sources/boost/spirit/home/x3/support/subcontext.hpp", + "external/sources/boost/spirit/home/x3/support/traits/attribute_category.hpp", + "external/sources/boost/spirit/home/x3/support/traits/attribute_of.hpp", + "external/sources/boost/spirit/home/x3/support/traits/attribute_of_binary.hpp", + "external/sources/boost/spirit/home/x3/support/traits/attribute_type.hpp", + "external/sources/boost/spirit/home/x3/support/traits/container_traits.hpp", + "external/sources/boost/spirit/home/x3/support/traits/handles_container.hpp", + "external/sources/boost/spirit/home/x3/support/traits/has_attribute.hpp", + "external/sources/boost/spirit/home/x3/support/traits/is_parser.hpp", + "external/sources/boost/spirit/home/x3/support/traits/is_range.hpp", + "external/sources/boost/spirit/home/x3/support/traits/is_substitute.hpp", + "external/sources/boost/spirit/home/x3/support/traits/is_variant.hpp", + "external/sources/boost/spirit/home/x3/support/traits/move_to.hpp", + "external/sources/boost/spirit/home/x3/support/traits/numeric_traits.hpp", + "external/sources/boost/spirit/home/x3/support/traits/optional_traits.hpp", + "external/sources/boost/spirit/home/x3/support/traits/print_attribute.hpp", + "external/sources/boost/spirit/home/x3/support/traits/print_token.hpp", + "external/sources/boost/spirit/home/x3/support/traits/pseudo_attribute.hpp", + "external/sources/boost/spirit/home/x3/support/traits/string_traits.hpp", + "external/sources/boost/spirit/home/x3/support/traits/transform_attribute.hpp", + "external/sources/boost/spirit/home/x3/support/traits/tuple_traits.hpp", + "external/sources/boost/spirit/home/x3/support/traits/variant_find_substitute.hpp", + "external/sources/boost/spirit/home/x3/support/traits/variant_has_substitute.hpp", + "external/sources/boost/spirit/home/x3/support/unused.hpp", + "external/sources/boost/spirit/home/x3/support/utility/annotate_on_success.hpp", + "external/sources/boost/spirit/home/x3/support/utility/error_reporting.hpp", + "external/sources/boost/spirit/home/x3/support/utility/is_callable.hpp", + "external/sources/boost/spirit/home/x3/support/utility/lambda_visitor.hpp", + "external/sources/boost/spirit/home/x3/support/utility/sfinae.hpp", + "external/sources/boost/spirit/home/x3/support/utility/utf8.hpp", + "external/sources/boost/spirit/home/x3/version.hpp", + "external/sources/boost/spirit/include/classic.hpp", + "external/sources/boost/spirit/include/classic_actions.hpp", + "external/sources/boost/spirit/include/classic_actor.hpp", + "external/sources/boost/spirit/include/classic_alternative.hpp", + "external/sources/boost/spirit/include/classic_as_parser.hpp", + "external/sources/boost/spirit/include/classic_assert.hpp", + "external/sources/boost/spirit/include/classic_assign_actor.hpp", + "external/sources/boost/spirit/include/classic_assign_key_actor.hpp", + "external/sources/boost/spirit/include/classic_ast.hpp", + "external/sources/boost/spirit/include/classic_ast_fwd.hpp", + "external/sources/boost/spirit/include/classic_attribute.hpp", + "external/sources/boost/spirit/include/classic_basic_chset.hpp", + "external/sources/boost/spirit/include/classic_chset.hpp", + "external/sources/boost/spirit/include/classic_chset_operators.hpp", + "external/sources/boost/spirit/include/classic_clear_actor.hpp", + "external/sources/boost/spirit/include/classic_closure.hpp", + "external/sources/boost/spirit/include/classic_closure_context.hpp", + "external/sources/boost/spirit/include/classic_closure_fwd.hpp", + "external/sources/boost/spirit/include/classic_common.hpp", + "external/sources/boost/spirit/include/classic_common_fwd.hpp", + "external/sources/boost/spirit/include/classic_composite.hpp", + "external/sources/boost/spirit/include/classic_config.hpp", + "external/sources/boost/spirit/include/classic_confix.hpp", + "external/sources/boost/spirit/include/classic_confix_fwd.hpp", + "external/sources/boost/spirit/include/classic_core.hpp", + "external/sources/boost/spirit/include/classic_debug.hpp", + "external/sources/boost/spirit/include/classic_debug_node.hpp", + "external/sources/boost/spirit/include/classic_decrement_actor.hpp", + "external/sources/boost/spirit/include/classic_difference.hpp", + "external/sources/boost/spirit/include/classic_directives.hpp", + "external/sources/boost/spirit/include/classic_distinct.hpp", + "external/sources/boost/spirit/include/classic_distinct_fwd.hpp", + "external/sources/boost/spirit/include/classic_dynamic.hpp", + "external/sources/boost/spirit/include/classic_epsilon.hpp", + "external/sources/boost/spirit/include/classic_erase_actor.hpp", + "external/sources/boost/spirit/include/classic_error_handling.hpp", + "external/sources/boost/spirit/include/classic_escape_char.hpp", + "external/sources/boost/spirit/include/classic_escape_char_fwd.hpp", + "external/sources/boost/spirit/include/classic_exceptions.hpp", + "external/sources/boost/spirit/include/classic_exceptions_fwd.hpp", + "external/sources/boost/spirit/include/classic_exclusive_or.hpp", + "external/sources/boost/spirit/include/classic_file_iterator.hpp", + "external/sources/boost/spirit/include/classic_file_iterator_fwd.hpp", + "external/sources/boost/spirit/include/classic_fixed_size_queue.hpp", + "external/sources/boost/spirit/include/classic_flush_multi_pass.hpp", + "external/sources/boost/spirit/include/classic_for.hpp", + "external/sources/boost/spirit/include/classic_functor_parser.hpp", + "external/sources/boost/spirit/include/classic_fundamental.hpp", + "external/sources/boost/spirit/include/classic_grammar.hpp", + "external/sources/boost/spirit/include/classic_grammar_def.hpp", + "external/sources/boost/spirit/include/classic_grammar_def_fwd.hpp", + "external/sources/boost/spirit/include/classic_if.hpp", + "external/sources/boost/spirit/include/classic_increment_actor.hpp", + "external/sources/boost/spirit/include/classic_insert_at_actor.hpp", + "external/sources/boost/spirit/include/classic_insert_key_actor.hpp", + "external/sources/boost/spirit/include/classic_intersection.hpp", + "external/sources/boost/spirit/include/classic_iterator.hpp", + "external/sources/boost/spirit/include/classic_kleene_star.hpp", + "external/sources/boost/spirit/include/classic_lazy.hpp", + "external/sources/boost/spirit/include/classic_list.hpp", + "external/sources/boost/spirit/include/classic_lists.hpp", + "external/sources/boost/spirit/include/classic_lists_fwd.hpp", + "external/sources/boost/spirit/include/classic_loops.hpp", + "external/sources/boost/spirit/include/classic_match.hpp", + "external/sources/boost/spirit/include/classic_meta.hpp", + "external/sources/boost/spirit/include/classic_minimal.hpp", + "external/sources/boost/spirit/include/classic_multi_pass.hpp", + "external/sources/boost/spirit/include/classic_multi_pass_fwd.hpp", + "external/sources/boost/spirit/include/classic_nil.hpp", + "external/sources/boost/spirit/include/classic_no_actions.hpp", + "external/sources/boost/spirit/include/classic_numerics.hpp", + "external/sources/boost/spirit/include/classic_numerics_fwd.hpp", + "external/sources/boost/spirit/include/classic_operators.hpp", + "external/sources/boost/spirit/include/classic_optional.hpp", + "external/sources/boost/spirit/include/classic_parametric.hpp", + "external/sources/boost/spirit/include/classic_parse_tree.hpp", + "external/sources/boost/spirit/include/classic_parse_tree_fwd.hpp", + "external/sources/boost/spirit/include/classic_parse_tree_utils.hpp", + "external/sources/boost/spirit/include/classic_parser.hpp", + "external/sources/boost/spirit/include/classic_parser_context.hpp", + "external/sources/boost/spirit/include/classic_parser_id.hpp", + "external/sources/boost/spirit/include/classic_parser_names.hpp", + "external/sources/boost/spirit/include/classic_parser_traits.hpp", + "external/sources/boost/spirit/include/classic_position_iterator.hpp", + "external/sources/boost/spirit/include/classic_position_iterator_fwd.hpp", + "external/sources/boost/spirit/include/classic_positive.hpp", + "external/sources/boost/spirit/include/classic_primitives.hpp", + "external/sources/boost/spirit/include/classic_push_back_actor.hpp", + "external/sources/boost/spirit/include/classic_push_front_actor.hpp", + "external/sources/boost/spirit/include/classic_range_run.hpp", + "external/sources/boost/spirit/include/classic_ref_actor.hpp", + "external/sources/boost/spirit/include/classic_ref_const_ref_actor.hpp", + "external/sources/boost/spirit/include/classic_ref_const_ref_const_ref_a.hpp", + "external/sources/boost/spirit/include/classic_ref_const_ref_value_actor.hpp", + "external/sources/boost/spirit/include/classic_ref_value_actor.hpp", + "external/sources/boost/spirit/include/classic_refactoring.hpp", + "external/sources/boost/spirit/include/classic_regex.hpp", + "external/sources/boost/spirit/include/classic_rule.hpp", + "external/sources/boost/spirit/include/classic_rule_alias.hpp", + "external/sources/boost/spirit/include/classic_rule_parser.hpp", + "external/sources/boost/spirit/include/classic_safe_bool.hpp", + "external/sources/boost/spirit/include/classic_scanner.hpp", + "external/sources/boost/spirit/include/classic_scanner_fwd.hpp", + "external/sources/boost/spirit/include/classic_scoped_lock.hpp", + "external/sources/boost/spirit/include/classic_select.hpp", + "external/sources/boost/spirit/include/classic_sequence.hpp", + "external/sources/boost/spirit/include/classic_sequential_and.hpp", + "external/sources/boost/spirit/include/classic_sequential_or.hpp", + "external/sources/boost/spirit/include/classic_skipper.hpp", + "external/sources/boost/spirit/include/classic_skipper_fwd.hpp", + "external/sources/boost/spirit/include/classic_spirit.hpp", + "external/sources/boost/spirit/include/classic_static.hpp", + "external/sources/boost/spirit/include/classic_stored_rule.hpp", + "external/sources/boost/spirit/include/classic_stored_rule_fwd.hpp", + "external/sources/boost/spirit/include/classic_subrule.hpp", + "external/sources/boost/spirit/include/classic_subrule_fwd.hpp", + "external/sources/boost/spirit/include/classic_swap_actor.hpp", + "external/sources/boost/spirit/include/classic_switch.hpp", + "external/sources/boost/spirit/include/classic_symbols.hpp", + "external/sources/boost/spirit/include/classic_symbols_fwd.hpp", + "external/sources/boost/spirit/include/classic_traverse.hpp", + "external/sources/boost/spirit/include/classic_tree_to_xml.hpp", + "external/sources/boost/spirit/include/classic_typeof.hpp", + "external/sources/boost/spirit/include/classic_utility.hpp", + "external/sources/boost/spirit/include/classic_version.hpp", + "external/sources/boost/spirit/include/classic_while.hpp", + "external/sources/boost/spirit/include/karma.hpp", + "external/sources/boost/spirit/include/karma_action.hpp", + "external/sources/boost/spirit/include/karma_alternative.hpp", + "external/sources/boost/spirit/include/karma_and_predicate.hpp", + "external/sources/boost/spirit/include/karma_as.hpp", + "external/sources/boost/spirit/include/karma_attr_cast.hpp", + "external/sources/boost/spirit/include/karma_auto.hpp", + "external/sources/boost/spirit/include/karma_auxiliary.hpp", + "external/sources/boost/spirit/include/karma_binary.hpp", + "external/sources/boost/spirit/include/karma_bool.hpp", + "external/sources/boost/spirit/include/karma_buffer.hpp", + "external/sources/boost/spirit/include/karma_center_alignment.hpp", + "external/sources/boost/spirit/include/karma_char.hpp", + "external/sources/boost/spirit/include/karma_char_.hpp", + "external/sources/boost/spirit/include/karma_char_class.hpp", + "external/sources/boost/spirit/include/karma_columns.hpp", + "external/sources/boost/spirit/include/karma_delimit.hpp", + "external/sources/boost/spirit/include/karma_directive.hpp", + "external/sources/boost/spirit/include/karma_domain.hpp", + "external/sources/boost/spirit/include/karma_duplicate.hpp", + "external/sources/boost/spirit/include/karma_eol.hpp", + "external/sources/boost/spirit/include/karma_eps.hpp", + "external/sources/boost/spirit/include/karma_format.hpp", + "external/sources/boost/spirit/include/karma_format_attr.hpp", + "external/sources/boost/spirit/include/karma_format_auto.hpp", + "external/sources/boost/spirit/include/karma_generate.hpp", + "external/sources/boost/spirit/include/karma_generate_attr.hpp", + "external/sources/boost/spirit/include/karma_generate_auto.hpp", + "external/sources/boost/spirit/include/karma_grammar.hpp", + "external/sources/boost/spirit/include/karma_int.hpp", + "external/sources/boost/spirit/include/karma_kleene.hpp", + "external/sources/boost/spirit/include/karma_lazy.hpp", + "external/sources/boost/spirit/include/karma_left_alignment.hpp", + "external/sources/boost/spirit/include/karma_list.hpp", + "external/sources/boost/spirit/include/karma_maxwidth.hpp", + "external/sources/boost/spirit/include/karma_no_delimit.hpp", + "external/sources/boost/spirit/include/karma_nonterminal.hpp", + "external/sources/boost/spirit/include/karma_not_predicate.hpp", + "external/sources/boost/spirit/include/karma_numeric.hpp", + "external/sources/boost/spirit/include/karma_omit.hpp", + "external/sources/boost/spirit/include/karma_operator.hpp", + "external/sources/boost/spirit/include/karma_optional.hpp", + "external/sources/boost/spirit/include/karma_phoenix_attributes.hpp", + "external/sources/boost/spirit/include/karma_plus.hpp", + "external/sources/boost/spirit/include/karma_real.hpp", + "external/sources/boost/spirit/include/karma_repeat.hpp", + "external/sources/boost/spirit/include/karma_right_alignment.hpp", + "external/sources/boost/spirit/include/karma_rule.hpp", + "external/sources/boost/spirit/include/karma_sequence.hpp", + "external/sources/boost/spirit/include/karma_stream.hpp", + "external/sources/boost/spirit/include/karma_strict_relaxed.hpp", + "external/sources/boost/spirit/include/karma_string.hpp", + "external/sources/boost/spirit/include/karma_symbols.hpp", + "external/sources/boost/spirit/include/karma_uint.hpp", + "external/sources/boost/spirit/include/karma_upper_lower_case.hpp", + "external/sources/boost/spirit/include/karma_verbatim.hpp", + "external/sources/boost/spirit/include/karma_what.hpp", + "external/sources/boost/spirit/include/lex.hpp", + "external/sources/boost/spirit/include/lex_char_token_def.hpp", + "external/sources/boost/spirit/include/lex_domain.hpp", + "external/sources/boost/spirit/include/lex_generate_static_lexertl.hpp", + "external/sources/boost/spirit/include/lex_lexer.hpp", + "external/sources/boost/spirit/include/lex_lexertl.hpp", + "external/sources/boost/spirit/include/lex_lexertl_position_token.hpp", + "external/sources/boost/spirit/include/lex_lexertl_token.hpp", + "external/sources/boost/spirit/include/lex_plain_token.hpp", + "external/sources/boost/spirit/include/lex_primitives.hpp", + "external/sources/boost/spirit/include/lex_static_lexertl.hpp", + "external/sources/boost/spirit/include/lex_tokenize_and_parse.hpp", + "external/sources/boost/spirit/include/lex_tokenize_and_parse_attr.hpp", + "external/sources/boost/spirit/include/phoenix.hpp", + "external/sources/boost/spirit/include/phoenix1.hpp", + "external/sources/boost/spirit/include/phoenix1_actor.hpp", + "external/sources/boost/spirit/include/phoenix1_binders.hpp", + "external/sources/boost/spirit/include/phoenix1_casts.hpp", + "external/sources/boost/spirit/include/phoenix1_closures.hpp", + "external/sources/boost/spirit/include/phoenix1_composite.hpp", + "external/sources/boost/spirit/include/phoenix1_functions.hpp", + "external/sources/boost/spirit/include/phoenix1_new.hpp", + "external/sources/boost/spirit/include/phoenix1_operators.hpp", + "external/sources/boost/spirit/include/phoenix1_primitives.hpp", + "external/sources/boost/spirit/include/phoenix1_special_ops.hpp", + "external/sources/boost/spirit/include/phoenix1_statements.hpp", + "external/sources/boost/spirit/include/phoenix1_tuple_helpers.hpp", + "external/sources/boost/spirit/include/phoenix1_tuples.hpp", + "external/sources/boost/spirit/include/phoenix_algorithm.hpp", + "external/sources/boost/spirit/include/phoenix_bind.hpp", + "external/sources/boost/spirit/include/phoenix_container.hpp", + "external/sources/boost/spirit/include/phoenix_core.hpp", + "external/sources/boost/spirit/include/phoenix_function.hpp", + "external/sources/boost/spirit/include/phoenix_fusion.hpp", + "external/sources/boost/spirit/include/phoenix_limits.hpp", + "external/sources/boost/spirit/include/phoenix_object.hpp", + "external/sources/boost/spirit/include/phoenix_operator.hpp", + "external/sources/boost/spirit/include/phoenix_scope.hpp", + "external/sources/boost/spirit/include/phoenix_statement.hpp", + "external/sources/boost/spirit/include/phoenix_stl.hpp", + "external/sources/boost/spirit/include/phoenix_version.hpp", + "external/sources/boost/spirit/include/qi.hpp", + "external/sources/boost/spirit/include/qi_action.hpp", + "external/sources/boost/spirit/include/qi_alternative.hpp", + "external/sources/boost/spirit/include/qi_and_predicate.hpp", + "external/sources/boost/spirit/include/qi_as.hpp", + "external/sources/boost/spirit/include/qi_as_string.hpp", + "external/sources/boost/spirit/include/qi_attr.hpp", + "external/sources/boost/spirit/include/qi_attr_cast.hpp", + "external/sources/boost/spirit/include/qi_auto.hpp", + "external/sources/boost/spirit/include/qi_auxiliary.hpp", + "external/sources/boost/spirit/include/qi_binary.hpp", + "external/sources/boost/spirit/include/qi_bool.hpp", + "external/sources/boost/spirit/include/qi_char.hpp", + "external/sources/boost/spirit/include/qi_char_.hpp", + "external/sources/boost/spirit/include/qi_char_class.hpp", + "external/sources/boost/spirit/include/qi_copy.hpp", + "external/sources/boost/spirit/include/qi_core.hpp", + "external/sources/boost/spirit/include/qi_difference.hpp", + "external/sources/boost/spirit/include/qi_directive.hpp", + "external/sources/boost/spirit/include/qi_domain.hpp", + "external/sources/boost/spirit/include/qi_eoi.hpp", + "external/sources/boost/spirit/include/qi_eol.hpp", + "external/sources/boost/spirit/include/qi_eps.hpp", + "external/sources/boost/spirit/include/qi_expect.hpp", + "external/sources/boost/spirit/include/qi_grammar.hpp", + "external/sources/boost/spirit/include/qi_hold.hpp", + "external/sources/boost/spirit/include/qi_int.hpp", + "external/sources/boost/spirit/include/qi_kleene.hpp", + "external/sources/boost/spirit/include/qi_lazy.hpp", + "external/sources/boost/spirit/include/qi_lexeme.hpp", + "external/sources/boost/spirit/include/qi_list.hpp", + "external/sources/boost/spirit/include/qi_lit.hpp", + "external/sources/boost/spirit/include/qi_match.hpp", + "external/sources/boost/spirit/include/qi_match_attr.hpp", + "external/sources/boost/spirit/include/qi_match_auto.hpp", + "external/sources/boost/spirit/include/qi_matches.hpp", + "external/sources/boost/spirit/include/qi_no_case.hpp", + "external/sources/boost/spirit/include/qi_no_skip.hpp", + "external/sources/boost/spirit/include/qi_nonterminal.hpp", + "external/sources/boost/spirit/include/qi_not_predicate.hpp", + "external/sources/boost/spirit/include/qi_numeric.hpp", + "external/sources/boost/spirit/include/qi_omit.hpp", + "external/sources/boost/spirit/include/qi_operator.hpp", + "external/sources/boost/spirit/include/qi_optional.hpp", + "external/sources/boost/spirit/include/qi_parse.hpp", + "external/sources/boost/spirit/include/qi_parse_attr.hpp", + "external/sources/boost/spirit/include/qi_parse_auto.hpp", + "external/sources/boost/spirit/include/qi_permutation.hpp", + "external/sources/boost/spirit/include/qi_plus.hpp", + "external/sources/boost/spirit/include/qi_raw.hpp", + "external/sources/boost/spirit/include/qi_real.hpp", + "external/sources/boost/spirit/include/qi_repeat.hpp", + "external/sources/boost/spirit/include/qi_rule.hpp", + "external/sources/boost/spirit/include/qi_sequence.hpp", + "external/sources/boost/spirit/include/qi_sequential_or.hpp", + "external/sources/boost/spirit/include/qi_skip.hpp", + "external/sources/boost/spirit/include/qi_stream.hpp", + "external/sources/boost/spirit/include/qi_string.hpp", + "external/sources/boost/spirit/include/qi_symbols.hpp", + "external/sources/boost/spirit/include/qi_uint.hpp", + "external/sources/boost/spirit/include/qi_what.hpp", + "external/sources/boost/spirit/include/support.hpp", + "external/sources/boost/spirit/include/support_adapt_adt_attributes.hpp", + "external/sources/boost/spirit/include/support_any.hpp", + "external/sources/boost/spirit/include/support_any_if.hpp", + "external/sources/boost/spirit/include/support_any_if_ns.hpp", + "external/sources/boost/spirit/include/support_any_if_ns_so.hpp", + "external/sources/boost/spirit/include/support_any_ns.hpp", + "external/sources/boost/spirit/include/support_any_ns_so.hpp", + "external/sources/boost/spirit/include/support_argument.hpp", + "external/sources/boost/spirit/include/support_ascii.hpp", + "external/sources/boost/spirit/include/support_attributes.hpp", + "external/sources/boost/spirit/include/support_attributes_fwd.hpp", + "external/sources/boost/spirit/include/support_auto.hpp", + "external/sources/boost/spirit/include/support_char_class.hpp", + "external/sources/boost/spirit/include/support_container.hpp", + "external/sources/boost/spirit/include/support_extended_variant.hpp", + "external/sources/boost/spirit/include/support_info.hpp", + "external/sources/boost/spirit/include/support_iso8859_1.hpp", + "external/sources/boost/spirit/include/support_istream_iterator.hpp", + "external/sources/boost/spirit/include/support_line_pos_iterator.hpp", + "external/sources/boost/spirit/include/support_locals.hpp", + "external/sources/boost/spirit/include/support_look_ahead.hpp", + "external/sources/boost/spirit/include/support_modify.hpp", + "external/sources/boost/spirit/include/support_multi_pass.hpp", + "external/sources/boost/spirit/include/support_multi_pass_fwd.hpp", + "external/sources/boost/spirit/include/support_ostream_iterator.hpp", + "external/sources/boost/spirit/include/support_standard.hpp", + "external/sources/boost/spirit/include/support_standard_wide.hpp", + "external/sources/boost/spirit/include/support_string_traits.hpp", + "external/sources/boost/spirit/include/support_unused.hpp", + "external/sources/boost/spirit/include/support_utree.hpp", + "external/sources/boost/spirit/include/version.hpp", + "external/sources/boost/spirit/repository/home/karma.hpp", + "external/sources/boost/spirit/repository/home/karma/directive.hpp", + "external/sources/boost/spirit/repository/home/karma/directive/confix.hpp", + "external/sources/boost/spirit/repository/home/karma/nonterminal.hpp", + "external/sources/boost/spirit/repository/home/karma/nonterminal/subrule.hpp", + "external/sources/boost/spirit/repository/home/qi.hpp", + "external/sources/boost/spirit/repository/home/qi/directive.hpp", + "external/sources/boost/spirit/repository/home/qi/directive/confix.hpp", + "external/sources/boost/spirit/repository/home/qi/directive/distinct.hpp", + "external/sources/boost/spirit/repository/home/qi/directive/kwd.hpp", + "external/sources/boost/spirit/repository/home/qi/directive/seek.hpp", + "external/sources/boost/spirit/repository/home/qi/nonterminal.hpp", + "external/sources/boost/spirit/repository/home/qi/nonterminal/subrule.hpp", + "external/sources/boost/spirit/repository/home/qi/operator.hpp", + "external/sources/boost/spirit/repository/home/qi/operator/detail/keywords.hpp", + "external/sources/boost/spirit/repository/home/qi/operator/keywords.hpp", + "external/sources/boost/spirit/repository/home/qi/primitive.hpp", + "external/sources/boost/spirit/repository/home/qi/primitive/advance.hpp", + "external/sources/boost/spirit/repository/home/qi/primitive/flush_multi_pass.hpp", + "external/sources/boost/spirit/repository/home/qi/primitive/iter_pos.hpp", + "external/sources/boost/spirit/repository/home/support/confix.hpp", + "external/sources/boost/spirit/repository/home/support/distinct.hpp", + "external/sources/boost/spirit/repository/home/support/flush_multi_pass.hpp", + "external/sources/boost/spirit/repository/home/support/kwd.hpp", + "external/sources/boost/spirit/repository/home/support/seek.hpp", + "external/sources/boost/spirit/repository/home/support/subrule_context.hpp", + "external/sources/boost/spirit/repository/include/karma.hpp", + "external/sources/boost/spirit/repository/include/karma_confix.hpp", + "external/sources/boost/spirit/repository/include/karma_directive.hpp", + "external/sources/boost/spirit/repository/include/karma_nonterminal.hpp", + "external/sources/boost/spirit/repository/include/karma_subrule.hpp", + "external/sources/boost/spirit/repository/include/qi.hpp", + "external/sources/boost/spirit/repository/include/qi_advance.hpp", + "external/sources/boost/spirit/repository/include/qi_confix.hpp", + "external/sources/boost/spirit/repository/include/qi_directive.hpp", + "external/sources/boost/spirit/repository/include/qi_distinct.hpp", + "external/sources/boost/spirit/repository/include/qi_flush_multi_pass.hpp", + "external/sources/boost/spirit/repository/include/qi_iter_pos.hpp", + "external/sources/boost/spirit/repository/include/qi_keywords.hpp", + "external/sources/boost/spirit/repository/include/qi_kwd.hpp", + "external/sources/boost/spirit/repository/include/qi_nonterminal.hpp", + "external/sources/boost/spirit/repository/include/qi_primitive.hpp", + "external/sources/boost/spirit/repository/include/qi_seek.hpp", + "external/sources/boost/spirit/repository/include/qi_subrule.hpp", + "external/sources/boost/spirit/version.hpp", + "external/sources/boost/stacktrace.hpp", + "external/sources/boost/stacktrace/detail/addr2line_impls.hpp", + "external/sources/boost/stacktrace/detail/collect_msvc.ipp", + "external/sources/boost/stacktrace/detail/collect_noop.ipp", + "external/sources/boost/stacktrace/detail/collect_unwind.ipp", + "external/sources/boost/stacktrace/detail/frame_decl.hpp", + "external/sources/boost/stacktrace/detail/frame_msvc.ipp", + "external/sources/boost/stacktrace/detail/frame_noop.ipp", + "external/sources/boost/stacktrace/detail/frame_unwind.ipp", + "external/sources/boost/stacktrace/detail/libbacktrace_impls.hpp", + "external/sources/boost/stacktrace/detail/location_from_symbol.hpp", + "external/sources/boost/stacktrace/detail/pop_options.h", + "external/sources/boost/stacktrace/detail/push_options.h", + "external/sources/boost/stacktrace/detail/safe_dump_noop.ipp", + "external/sources/boost/stacktrace/detail/safe_dump_posix.ipp", + "external/sources/boost/stacktrace/detail/safe_dump_win.ipp", + "external/sources/boost/stacktrace/detail/to_dec_array.hpp", + "external/sources/boost/stacktrace/detail/to_hex_array.hpp", + "external/sources/boost/stacktrace/detail/try_dec_convert.hpp", + "external/sources/boost/stacktrace/detail/unwind_base_impls.hpp", + "external/sources/boost/stacktrace/detail/void_ptr_cast.hpp", + "external/sources/boost/stacktrace/frame.hpp", + "external/sources/boost/stacktrace/safe_dump_to.hpp", + "external/sources/boost/stacktrace/stacktrace.hpp", + "external/sources/boost/stacktrace/stacktrace_fwd.hpp", + "external/sources/boost/statechart/asynchronous_state_machine.hpp", + "external/sources/boost/statechart/custom_reaction.hpp", + "external/sources/boost/statechart/deep_history.hpp", + "external/sources/boost/statechart/deferral.hpp", + "external/sources/boost/statechart/detail/avoid_unused_warning.hpp", + "external/sources/boost/statechart/detail/constructor.hpp", + "external/sources/boost/statechart/detail/counted_base.hpp", + "external/sources/boost/statechart/detail/leaf_state.hpp", + "external/sources/boost/statechart/detail/memory.hpp", + "external/sources/boost/statechart/detail/node_state.hpp", + "external/sources/boost/statechart/detail/reaction_dispatcher.hpp", + "external/sources/boost/statechart/detail/rtti_policy.hpp", + "external/sources/boost/statechart/detail/state_base.hpp", + "external/sources/boost/statechart/event.hpp", + "external/sources/boost/statechart/event_base.hpp", + "external/sources/boost/statechart/event_processor.hpp", + "external/sources/boost/statechart/exception_translator.hpp", + "external/sources/boost/statechart/fifo_scheduler.hpp", + "external/sources/boost/statechart/fifo_worker.hpp", + "external/sources/boost/statechart/history.hpp", + "external/sources/boost/statechart/in_state_reaction.hpp", + "external/sources/boost/statechart/null_exception_translator.hpp", + "external/sources/boost/statechart/processor_container.hpp", + "external/sources/boost/statechart/result.hpp", + "external/sources/boost/statechart/shallow_history.hpp", + "external/sources/boost/statechart/simple_state.hpp", + "external/sources/boost/statechart/state.hpp", + "external/sources/boost/statechart/state_machine.hpp", + "external/sources/boost/statechart/termination.hpp", + "external/sources/boost/statechart/transition.hpp", + "external/sources/boost/static_assert.hpp", + "external/sources/boost/static_string.hpp", + "external/sources/boost/static_string/config.hpp", + "external/sources/boost/static_string/static_string.hpp", + "external/sources/boost/stl_interfaces/fwd.hpp", + "external/sources/boost/stl_interfaces/iterator_interface.hpp", + "external/sources/boost/stl_interfaces/reverse_iterator.hpp", + "external/sources/boost/stl_interfaces/sequence_container_interface.hpp", + "external/sources/boost/stl_interfaces/view_interface.hpp", + "external/sources/boost/swap.hpp", + "external/sources/boost/system/api_config.hpp", + "external/sources/boost/system/config.hpp", + "external/sources/boost/system/cygwin_error.hpp", + "external/sources/boost/system/detail/config.hpp", + "external/sources/boost/system/detail/generic_category.hpp", + "external/sources/boost/system/detail/std_interoperability.hpp", + "external/sources/boost/system/detail/system_category_posix.hpp", + "external/sources/boost/system/detail/system_category_win32.hpp", + "external/sources/boost/system/error_code.hpp", + "external/sources/boost/system/linux_error.hpp", + "external/sources/boost/system/system_error.hpp", + "external/sources/boost/system/windows_error.hpp", + "external/sources/boost/test/auto_unit_test.hpp", + "external/sources/boost/test/data/config.hpp", + "external/sources/boost/test/data/dataset.hpp", + "external/sources/boost/test/data/for_each_sample.hpp", + "external/sources/boost/test/data/index_sequence.hpp", + "external/sources/boost/test/data/monomorphic.hpp", + "external/sources/boost/test/data/monomorphic/array.hpp", + "external/sources/boost/test/data/monomorphic/collection.hpp", + "external/sources/boost/test/data/monomorphic/delayed.hpp", + "external/sources/boost/test/data/monomorphic/fwd.hpp", + "external/sources/boost/test/data/monomorphic/generate.hpp", + "external/sources/boost/test/data/monomorphic/generators.hpp", + "external/sources/boost/test/data/monomorphic/generators/keywords.hpp", + "external/sources/boost/test/data/monomorphic/generators/random.hpp", + "external/sources/boost/test/data/monomorphic/generators/xrange.hpp", + "external/sources/boost/test/data/monomorphic/grid.hpp", + "external/sources/boost/test/data/monomorphic/initializer_list.hpp", + "external/sources/boost/test/data/monomorphic/join.hpp", + "external/sources/boost/test/data/monomorphic/sample_merge.hpp", + "external/sources/boost/test/data/monomorphic/singleton.hpp", + "external/sources/boost/test/data/monomorphic/zip.hpp", + "external/sources/boost/test/data/size.hpp", + "external/sources/boost/test/data/test_case.hpp", + "external/sources/boost/test/debug.hpp", + "external/sources/boost/test/debug_config.hpp", + "external/sources/boost/test/detail/config.hpp", + "external/sources/boost/test/detail/enable_warnings.hpp", + "external/sources/boost/test/detail/fwd_decl.hpp", + "external/sources/boost/test/detail/global_typedef.hpp", + "external/sources/boost/test/detail/log_level.hpp", + "external/sources/boost/test/detail/pp_variadic.hpp", + "external/sources/boost/test/detail/suppress_warnings.hpp", + "external/sources/boost/test/detail/throw_exception.hpp", + "external/sources/boost/test/execution_monitor.hpp", + "external/sources/boost/test/floating_point_comparison.hpp", + "external/sources/boost/test/framework.hpp", + "external/sources/boost/test/impl/compiler_log_formatter.ipp", + "external/sources/boost/test/impl/cpp_main.ipp", + "external/sources/boost/test/impl/debug.ipp", + "external/sources/boost/test/impl/decorator.ipp", + "external/sources/boost/test/impl/execution_monitor.ipp", + "external/sources/boost/test/impl/framework.ipp", + "external/sources/boost/test/impl/junit_log_formatter.ipp", + "external/sources/boost/test/impl/plain_report_formatter.ipp", + "external/sources/boost/test/impl/progress_monitor.ipp", + "external/sources/boost/test/impl/results_collector.ipp", + "external/sources/boost/test/impl/results_reporter.ipp", + "external/sources/boost/test/impl/test_framework_init_observer.ipp", + "external/sources/boost/test/impl/test_main.ipp", + "external/sources/boost/test/impl/test_tools.ipp", + "external/sources/boost/test/impl/test_tree.ipp", + "external/sources/boost/test/impl/unit_test_log.ipp", + "external/sources/boost/test/impl/unit_test_main.ipp", + "external/sources/boost/test/impl/unit_test_monitor.ipp", + "external/sources/boost/test/impl/unit_test_parameters.ipp", + "external/sources/boost/test/impl/xml_log_formatter.ipp", + "external/sources/boost/test/impl/xml_report_formatter.ipp", + "external/sources/boost/test/included/execution_monitor.hpp", + "external/sources/boost/test/included/prg_exec_monitor.hpp", + "external/sources/boost/test/included/test_exec_monitor.hpp", + "external/sources/boost/test/included/unit_test.hpp", + "external/sources/boost/test/included/unit_test_framework.hpp", + "external/sources/boost/test/minimal.hpp", + "external/sources/boost/test/output/compiler_log_formatter.hpp", + "external/sources/boost/test/output/junit_log_formatter.hpp", + "external/sources/boost/test/output/plain_report_formatter.hpp", + "external/sources/boost/test/output/xml_log_formatter.hpp", + "external/sources/boost/test/output/xml_report_formatter.hpp", + "external/sources/boost/test/output_test_stream.hpp", + "external/sources/boost/test/parameterized_test.hpp", + "external/sources/boost/test/predicate_result.hpp", + "external/sources/boost/test/prg_exec_monitor.hpp", + "external/sources/boost/test/progress_monitor.hpp", + "external/sources/boost/test/results_collector.hpp", + "external/sources/boost/test/results_reporter.hpp", + "external/sources/boost/test/test_case_template.hpp", + "external/sources/boost/test/test_exec_monitor.hpp", + "external/sources/boost/test/test_framework_init_observer.hpp", + "external/sources/boost/test/test_tools.hpp", + "external/sources/boost/test/tools/assertion.hpp", + "external/sources/boost/test/tools/assertion_result.hpp", + "external/sources/boost/test/tools/collection_comparison_op.hpp", + "external/sources/boost/test/tools/context.hpp", + "external/sources/boost/test/tools/cstring_comparison_op.hpp", + "external/sources/boost/test/tools/detail/bitwise_manip.hpp", + "external/sources/boost/test/tools/detail/fwd.hpp", + "external/sources/boost/test/tools/detail/indirections.hpp", + "external/sources/boost/test/tools/detail/it_pair.hpp", + "external/sources/boost/test/tools/detail/lexicographic_manip.hpp", + "external/sources/boost/test/tools/detail/per_element_manip.hpp", + "external/sources/boost/test/tools/detail/print_helper.hpp", + "external/sources/boost/test/tools/detail/tolerance_manip.hpp", + "external/sources/boost/test/tools/floating_point_comparison.hpp", + "external/sources/boost/test/tools/fpc_op.hpp", + "external/sources/boost/test/tools/fpc_tolerance.hpp", + "external/sources/boost/test/tools/interface.hpp", + "external/sources/boost/test/tools/old/impl.hpp", + "external/sources/boost/test/tools/old/interface.hpp", + "external/sources/boost/test/tools/output_test_stream.hpp", + "external/sources/boost/test/tree/auto_registration.hpp", + "external/sources/boost/test/tree/decorator.hpp", + "external/sources/boost/test/tree/fixture.hpp", + "external/sources/boost/test/tree/global_fixture.hpp", + "external/sources/boost/test/tree/observer.hpp", + "external/sources/boost/test/tree/test_case_counter.hpp", + "external/sources/boost/test/tree/test_case_template.hpp", + "external/sources/boost/test/tree/test_unit.hpp", + "external/sources/boost/test/tree/traverse.hpp", + "external/sources/boost/test/tree/visitor.hpp", + "external/sources/boost/test/unit_test.hpp", + "external/sources/boost/test/unit_test_log.hpp", + "external/sources/boost/test/unit_test_log_formatter.hpp", + "external/sources/boost/test/unit_test_monitor.hpp", + "external/sources/boost/test/unit_test_parameters.hpp", + "external/sources/boost/test/unit_test_suite.hpp", + "external/sources/boost/test/utils/algorithm.hpp", + "external/sources/boost/test/utils/assign_op.hpp", + "external/sources/boost/test/utils/basic_cstring/basic_cstring.hpp", + "external/sources/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp", + "external/sources/boost/test/utils/basic_cstring/bcs_char_traits.hpp", + "external/sources/boost/test/utils/basic_cstring/compare.hpp", + "external/sources/boost/test/utils/basic_cstring/io.hpp", + "external/sources/boost/test/utils/class_properties.hpp", + "external/sources/boost/test/utils/custom_manip.hpp", + "external/sources/boost/test/utils/foreach.hpp", + "external/sources/boost/test/utils/is_cstring.hpp", + "external/sources/boost/test/utils/is_forward_iterable.hpp", + "external/sources/boost/test/utils/iterator/input_iterator_facade.hpp", + "external/sources/boost/test/utils/iterator/token_iterator.hpp", + "external/sources/boost/test/utils/lazy_ostream.hpp", + "external/sources/boost/test/utils/named_params.hpp", + "external/sources/boost/test/utils/nullstream.hpp", + "external/sources/boost/test/utils/rtti.hpp", + "external/sources/boost/test/utils/runtime/argument.hpp", + "external/sources/boost/test/utils/runtime/argument_factory.hpp", + "external/sources/boost/test/utils/runtime/cla/argv_traverser.hpp", + "external/sources/boost/test/utils/runtime/cla/parser.hpp", + "external/sources/boost/test/utils/runtime/env/fetch.hpp", + "external/sources/boost/test/utils/runtime/errors.hpp", + "external/sources/boost/test/utils/runtime/finalize.hpp", + "external/sources/boost/test/utils/runtime/fwd.hpp", + "external/sources/boost/test/utils/runtime/modifier.hpp", + "external/sources/boost/test/utils/runtime/parameter.hpp", + "external/sources/boost/test/utils/setcolor.hpp", + "external/sources/boost/test/utils/string_cast.hpp", + "external/sources/boost/test/utils/timer.hpp", + "external/sources/boost/test/utils/wrap_stringstream.hpp", + "external/sources/boost/test/utils/xml_printer.hpp", + "external/sources/boost/thread.hpp", + "external/sources/boost/thread/barrier.hpp", + "external/sources/boost/thread/caller_context.hpp", + "external/sources/boost/thread/completion_latch.hpp", + "external/sources/boost/thread/concurrent_queues/deque_adaptor.hpp", + "external/sources/boost/thread/concurrent_queues/deque_base.hpp", + "external/sources/boost/thread/concurrent_queues/deque_views.hpp", + "external/sources/boost/thread/concurrent_queues/detail/sync_deque_base.hpp", + "external/sources/boost/thread/concurrent_queues/detail/sync_queue_base.hpp", + "external/sources/boost/thread/concurrent_queues/queue_adaptor.hpp", + "external/sources/boost/thread/concurrent_queues/queue_base.hpp", + "external/sources/boost/thread/concurrent_queues/queue_op_status.hpp", + "external/sources/boost/thread/concurrent_queues/queue_views.hpp", + "external/sources/boost/thread/concurrent_queues/sync_bounded_queue.hpp", + "external/sources/boost/thread/concurrent_queues/sync_deque.hpp", + "external/sources/boost/thread/concurrent_queues/sync_priority_queue.hpp", + "external/sources/boost/thread/concurrent_queues/sync_queue.hpp", + "external/sources/boost/thread/concurrent_queues/sync_timed_queue.hpp", + "external/sources/boost/thread/condition.hpp", + "external/sources/boost/thread/condition_variable.hpp", + "external/sources/boost/thread/csbl/deque.hpp", + "external/sources/boost/thread/csbl/devector.hpp", + "external/sources/boost/thread/csbl/functional.hpp", + "external/sources/boost/thread/csbl/list.hpp", + "external/sources/boost/thread/csbl/memory.hpp", + "external/sources/boost/thread/csbl/memory/allocator_arg.hpp", + "external/sources/boost/thread/csbl/memory/allocator_traits.hpp", + "external/sources/boost/thread/csbl/memory/config.hpp", + "external/sources/boost/thread/csbl/memory/default_delete.hpp", + "external/sources/boost/thread/csbl/memory/pointer_traits.hpp", + "external/sources/boost/thread/csbl/memory/scoped_allocator.hpp", + "external/sources/boost/thread/csbl/memory/shared_ptr.hpp", + "external/sources/boost/thread/csbl/memory/unique_ptr.hpp", + "external/sources/boost/thread/csbl/queue.hpp", + "external/sources/boost/thread/csbl/tuple.hpp", + "external/sources/boost/thread/csbl/vector.hpp", + "external/sources/boost/thread/cv_status.hpp", + "external/sources/boost/thread/detail/atomic_redef_macros.hpp", + "external/sources/boost/thread/detail/atomic_undef_macros.hpp", + "external/sources/boost/thread/detail/config.hpp", + "external/sources/boost/thread/detail/counter.hpp", + "external/sources/boost/thread/detail/delete.hpp", + "external/sources/boost/thread/detail/force_cast.hpp", + "external/sources/boost/thread/detail/function_wrapper.hpp", + "external/sources/boost/thread/detail/invoke.hpp", + "external/sources/boost/thread/detail/invoker.hpp", + "external/sources/boost/thread/detail/is_convertible.hpp", + "external/sources/boost/thread/detail/lockable_wrapper.hpp", + "external/sources/boost/thread/detail/log.hpp", + "external/sources/boost/thread/detail/make_tuple_indices.hpp", + "external/sources/boost/thread/detail/memory.hpp", + "external/sources/boost/thread/detail/move.hpp", + "external/sources/boost/thread/detail/nullary_function.hpp", + "external/sources/boost/thread/detail/platform.hpp", + "external/sources/boost/thread/detail/platform_time.hpp", + "external/sources/boost/thread/detail/singleton.hpp", + "external/sources/boost/thread/detail/thread.hpp", + "external/sources/boost/thread/detail/thread_group.hpp", + "external/sources/boost/thread/detail/thread_heap_alloc.hpp", + "external/sources/boost/thread/detail/thread_interruption.hpp", + "external/sources/boost/thread/detail/thread_safety.hpp", + "external/sources/boost/thread/detail/tss_hooks.hpp", + "external/sources/boost/thread/detail/variadic_footer.hpp", + "external/sources/boost/thread/detail/variadic_header.hpp", + "external/sources/boost/thread/exceptional_ptr.hpp", + "external/sources/boost/thread/exceptions.hpp", + "external/sources/boost/thread/executor.hpp", + "external/sources/boost/thread/executors/basic_thread_pool.hpp", + "external/sources/boost/thread/executors/detail/priority_executor_base.hpp", + "external/sources/boost/thread/executors/detail/scheduled_executor_base.hpp", + "external/sources/boost/thread/executors/executor.hpp", + "external/sources/boost/thread/executors/executor_adaptor.hpp", + "external/sources/boost/thread/executors/generic_executor_ref.hpp", + "external/sources/boost/thread/executors/inline_executor.hpp", + "external/sources/boost/thread/executors/loop_executor.hpp", + "external/sources/boost/thread/executors/scheduled_thread_pool.hpp", + "external/sources/boost/thread/executors/scheduler.hpp", + "external/sources/boost/thread/executors/scheduling_adaptor.hpp", + "external/sources/boost/thread/executors/serial_executor.hpp", + "external/sources/boost/thread/executors/serial_executor_cont.hpp", + "external/sources/boost/thread/executors/thread_executor.hpp", + "external/sources/boost/thread/executors/work.hpp", + "external/sources/boost/thread/experimental/config/inline_namespace.hpp", + "external/sources/boost/thread/experimental/exception_list.hpp", + "external/sources/boost/thread/experimental/parallel/v1/exception_list.hpp", + "external/sources/boost/thread/experimental/parallel/v1/inline_namespace.hpp", + "external/sources/boost/thread/experimental/parallel/v2/inline_namespace.hpp", + "external/sources/boost/thread/experimental/parallel/v2/task_region.hpp", + "external/sources/boost/thread/experimental/task_region.hpp", + "external/sources/boost/thread/externally_locked.hpp", + "external/sources/boost/thread/externally_locked_stream.hpp", + "external/sources/boost/thread/future.hpp", + "external/sources/boost/thread/futures/future_error.hpp", + "external/sources/boost/thread/futures/future_error_code.hpp", + "external/sources/boost/thread/futures/future_status.hpp", + "external/sources/boost/thread/futures/is_future_type.hpp", + "external/sources/boost/thread/futures/launch.hpp", + "external/sources/boost/thread/futures/wait_for_all.hpp", + "external/sources/boost/thread/futures/wait_for_any.hpp", + "external/sources/boost/thread/interruption.hpp", + "external/sources/boost/thread/is_locked_by_this_thread.hpp", + "external/sources/boost/thread/latch.hpp", + "external/sources/boost/thread/lock_algorithms.hpp", + "external/sources/boost/thread/lock_concepts.hpp", + "external/sources/boost/thread/lock_factories.hpp", + "external/sources/boost/thread/lock_guard.hpp", + "external/sources/boost/thread/lock_options.hpp", + "external/sources/boost/thread/lock_traits.hpp", + "external/sources/boost/thread/lock_types.hpp", + "external/sources/boost/thread/lockable_adapter.hpp", + "external/sources/boost/thread/lockable_concepts.hpp", + "external/sources/boost/thread/lockable_traits.hpp", + "external/sources/boost/thread/locks.hpp", + "external/sources/boost/thread/mutex.hpp", + "external/sources/boost/thread/null_mutex.hpp", + "external/sources/boost/thread/once.hpp", + "external/sources/boost/thread/ostream_buffer.hpp", + "external/sources/boost/thread/poly_lockable.hpp", + "external/sources/boost/thread/poly_lockable_adapter.hpp", + "external/sources/boost/thread/poly_shared_lockable.hpp", + "external/sources/boost/thread/poly_shared_lockable_adapter.hpp", + "external/sources/boost/thread/pthread/condition_variable.hpp", + "external/sources/boost/thread/pthread/condition_variable_fwd.hpp", + "external/sources/boost/thread/pthread/mutex.hpp", + "external/sources/boost/thread/pthread/once.hpp", + "external/sources/boost/thread/pthread/once_atomic.hpp", + "external/sources/boost/thread/pthread/pthread_helpers.hpp", + "external/sources/boost/thread/pthread/pthread_mutex_scoped_lock.hpp", + "external/sources/boost/thread/pthread/recursive_mutex.hpp", + "external/sources/boost/thread/pthread/shared_mutex.hpp", + "external/sources/boost/thread/pthread/thread_data.hpp", + "external/sources/boost/thread/pthread/thread_heap_alloc.hpp", + "external/sources/boost/thread/recursive_mutex.hpp", + "external/sources/boost/thread/reverse_lock.hpp", + "external/sources/boost/thread/scoped_thread.hpp", + "external/sources/boost/thread/shared_lock_guard.hpp", + "external/sources/boost/thread/shared_mutex.hpp", + "external/sources/boost/thread/strict_lock.hpp", + "external/sources/boost/thread/sync_bounded_queue.hpp", + "external/sources/boost/thread/sync_queue.hpp", + "external/sources/boost/thread/synchronized_value.hpp", + "external/sources/boost/thread/testable_mutex.hpp", + "external/sources/boost/thread/thread.hpp", + "external/sources/boost/thread/thread_functors.hpp", + "external/sources/boost/thread/thread_guard.hpp", + "external/sources/boost/thread/thread_only.hpp", + "external/sources/boost/thread/thread_pool.hpp", + "external/sources/boost/thread/thread_time.hpp", + "external/sources/boost/thread/tss.hpp", + "external/sources/boost/thread/user_scheduler.hpp", + "external/sources/boost/thread/v2/shared_mutex.hpp", + "external/sources/boost/thread/win32/basic_recursive_mutex.hpp", + "external/sources/boost/thread/win32/basic_timed_mutex.hpp", + "external/sources/boost/thread/win32/condition_variable.hpp", + "external/sources/boost/thread/win32/interlocked_read.hpp", + "external/sources/boost/thread/win32/mfc_thread_init.hpp", + "external/sources/boost/thread/win32/mutex.hpp", + "external/sources/boost/thread/win32/once.hpp", + "external/sources/boost/thread/win32/recursive_mutex.hpp", + "external/sources/boost/thread/win32/shared_mutex.hpp", + "external/sources/boost/thread/win32/thread_data.hpp", + "external/sources/boost/thread/win32/thread_heap_alloc.hpp", + "external/sources/boost/thread/win32/thread_primitives.hpp", + "external/sources/boost/thread/with_lock_guard.hpp", + "external/sources/boost/thread/xtime.hpp", + "external/sources/boost/throw_exception.hpp", + "external/sources/boost/timer.hpp", + "external/sources/boost/timer/config.hpp", + "external/sources/boost/timer/progress_display.hpp", + "external/sources/boost/timer/timer.hpp", + "external/sources/boost/token_functions.hpp", + "external/sources/boost/token_iterator.hpp", + "external/sources/boost/tokenizer.hpp", + "external/sources/boost/tti/detail/dclass.hpp", + "external/sources/boost/tti/detail/dcomp_mem_fun.hpp", + "external/sources/boost/tti/detail/dcomp_mem_fun_template.hpp", + "external/sources/boost/tti/detail/ddata.hpp", + "external/sources/boost/tti/detail/ddeftype.hpp", + "external/sources/boost/tti/detail/denclosing_type.hpp", + "external/sources/boost/tti/detail/denum.hpp", + "external/sources/boost/tti/detail/dftclass.hpp", + "external/sources/boost/tti/detail/dfunction.hpp", + "external/sources/boost/tti/detail/dfunction_template.hpp", + "external/sources/boost/tti/detail/dlambda.hpp", + "external/sources/boost/tti/detail/dmacro_fun_template.hpp", + "external/sources/boost/tti/detail/dmacro_fve.hpp", + "external/sources/boost/tti/detail/dmacro_sunfix.hpp", + "external/sources/boost/tti/detail/dmem_data.hpp", + "external/sources/boost/tti/detail/dmem_fun.hpp", + "external/sources/boost/tti/detail/dmem_fun_template.hpp", + "external/sources/boost/tti/detail/dmem_type.hpp", + "external/sources/boost/tti/detail/dmetafunc.hpp", + "external/sources/boost/tti/detail/dnotype.hpp", + "external/sources/boost/tti/detail/dnullptr.hpp", + "external/sources/boost/tti/detail/dplaceholder.hpp", + "external/sources/boost/tti/detail/dptmf.hpp", + "external/sources/boost/tti/detail/dstatic_function_tags.hpp", + "external/sources/boost/tti/detail/dstatic_function_type.hpp", + "external/sources/boost/tti/detail/dstatic_mem_data.hpp", + "external/sources/boost/tti/detail/dstatic_mem_fun.hpp", + "external/sources/boost/tti/detail/dstatic_mem_fun_template.hpp", + "external/sources/boost/tti/detail/dtclass.hpp", + "external/sources/boost/tti/detail/dtemplate.hpp", + "external/sources/boost/tti/detail/dtemplate_params.hpp", + "external/sources/boost/tti/detail/dtfunction.hpp", + "external/sources/boost/tti/detail/dtype.hpp", + "external/sources/boost/tti/detail/dunion.hpp", + "external/sources/boost/tti/detail/dvm_template_params.hpp", + "external/sources/boost/tti/has_class.hpp", + "external/sources/boost/tti/has_data.hpp", + "external/sources/boost/tti/has_enum.hpp", + "external/sources/boost/tti/has_function.hpp", + "external/sources/boost/tti/has_function_template.hpp", + "external/sources/boost/tti/has_member_data.hpp", + "external/sources/boost/tti/has_member_function.hpp", + "external/sources/boost/tti/has_member_function_template.hpp", + "external/sources/boost/tti/has_static_member_data.hpp", + "external/sources/boost/tti/has_static_member_function.hpp", + "external/sources/boost/tti/has_static_member_function_template.hpp", + "external/sources/boost/tti/has_template.hpp", + "external/sources/boost/tti/has_type.hpp", + "external/sources/boost/tti/has_union.hpp", + "external/sources/boost/tti/member_type.hpp", + "external/sources/boost/tti/tti.hpp", + "external/sources/boost/tuple/detail/tuple_basic.hpp", + "external/sources/boost/tuple/tuple.hpp", + "external/sources/boost/tuple/tuple_comparison.hpp", + "external/sources/boost/tuple/tuple_io.hpp", + "external/sources/boost/type.hpp", + "external/sources/boost/type_erasure/any.hpp", + "external/sources/boost/type_erasure/any_cast.hpp", + "external/sources/boost/type_erasure/binding.hpp", + "external/sources/boost/type_erasure/binding_of.hpp", + "external/sources/boost/type_erasure/builtin.hpp", + "external/sources/boost/type_erasure/call.hpp", + "external/sources/boost/type_erasure/callable.hpp", + "external/sources/boost/type_erasure/check_match.hpp", + "external/sources/boost/type_erasure/concept_interface.hpp", + "external/sources/boost/type_erasure/concept_of.hpp", + "external/sources/boost/type_erasure/config.hpp", + "external/sources/boost/type_erasure/constructible.hpp", + "external/sources/boost/type_erasure/deduced.hpp", + "external/sources/boost/type_erasure/derived.hpp", + "external/sources/boost/type_erasure/detail/access.hpp", + "external/sources/boost/type_erasure/detail/adapt_to_vtable.hpp", + "external/sources/boost/type_erasure/detail/any_base.hpp", + "external/sources/boost/type_erasure/detail/auto_link.hpp", + "external/sources/boost/type_erasure/detail/check_call.hpp", + "external/sources/boost/type_erasure/detail/check_map.hpp", + "external/sources/boost/type_erasure/detail/const.hpp", + "external/sources/boost/type_erasure/detail/construct.hpp", + "external/sources/boost/type_erasure/detail/dynamic_vtable.hpp", + "external/sources/boost/type_erasure/detail/extract_concept.hpp", + "external/sources/boost/type_erasure/detail/get_placeholders.hpp", + "external/sources/boost/type_erasure/detail/get_signature.hpp", + "external/sources/boost/type_erasure/detail/instantiate.hpp", + "external/sources/boost/type_erasure/detail/macro.hpp", + "external/sources/boost/type_erasure/detail/member11.hpp", + "external/sources/boost/type_erasure/detail/meta.hpp", + "external/sources/boost/type_erasure/detail/normalize.hpp", + "external/sources/boost/type_erasure/detail/normalize_deduced.hpp", + "external/sources/boost/type_erasure/detail/null.hpp", + "external/sources/boost/type_erasure/detail/rebind_placeholders.hpp", + "external/sources/boost/type_erasure/detail/storage.hpp", + "external/sources/boost/type_erasure/detail/vtable.hpp", + "external/sources/boost/type_erasure/dynamic_any_cast.hpp", + "external/sources/boost/type_erasure/dynamic_binding.hpp", + "external/sources/boost/type_erasure/exception.hpp", + "external/sources/boost/type_erasure/free.hpp", + "external/sources/boost/type_erasure/is_empty.hpp", + "external/sources/boost/type_erasure/is_placeholder.hpp", + "external/sources/boost/type_erasure/is_subconcept.hpp", + "external/sources/boost/type_erasure/iterator.hpp", + "external/sources/boost/type_erasure/member.hpp", + "external/sources/boost/type_erasure/operators.hpp", + "external/sources/boost/type_erasure/param.hpp", + "external/sources/boost/type_erasure/placeholder.hpp", + "external/sources/boost/type_erasure/placeholder_of.hpp", + "external/sources/boost/type_erasure/rebind_any.hpp", + "external/sources/boost/type_erasure/register_binding.hpp", + "external/sources/boost/type_erasure/relaxed.hpp", + "external/sources/boost/type_erasure/require_match.hpp", + "external/sources/boost/type_erasure/same_type.hpp", + "external/sources/boost/type_erasure/static_binding.hpp", + "external/sources/boost/type_erasure/tuple.hpp", + "external/sources/boost/type_erasure/typeid_of.hpp", + "external/sources/boost/type_index.hpp", + "external/sources/boost/type_index/ctti_type_index.hpp", + "external/sources/boost/type_index/detail/compile_time_type_info.hpp", + "external/sources/boost/type_index/detail/ctti_register_class.hpp", + "external/sources/boost/type_index/detail/stl_register_class.hpp", + "external/sources/boost/type_index/runtime_cast.hpp", + "external/sources/boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp", + "external/sources/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp", + "external/sources/boost/type_index/runtime_cast/pointer_cast.hpp", + "external/sources/boost/type_index/runtime_cast/reference_cast.hpp", + "external/sources/boost/type_index/runtime_cast/register_runtime_class.hpp", + "external/sources/boost/type_index/runtime_cast/std_shared_ptr_cast.hpp", + "external/sources/boost/type_index/stl_type_index.hpp", + "external/sources/boost/type_index/type_index_facade.hpp", + "external/sources/boost/type_traits.hpp", + "external/sources/boost/type_traits/add_const.hpp", + "external/sources/boost/type_traits/add_cv.hpp", + "external/sources/boost/type_traits/add_lvalue_reference.hpp", + "external/sources/boost/type_traits/add_pointer.hpp", + "external/sources/boost/type_traits/add_reference.hpp", + "external/sources/boost/type_traits/add_rvalue_reference.hpp", + "external/sources/boost/type_traits/add_volatile.hpp", + "external/sources/boost/type_traits/aligned_storage.hpp", + "external/sources/boost/type_traits/alignment_of.hpp", + "external/sources/boost/type_traits/alignment_traits.hpp", + "external/sources/boost/type_traits/arithmetic_traits.hpp", + "external/sources/boost/type_traits/array_traits.hpp", + "external/sources/boost/type_traits/broken_compiler_spec.hpp", + "external/sources/boost/type_traits/common_type.hpp", + "external/sources/boost/type_traits/composite_traits.hpp", + "external/sources/boost/type_traits/conditional.hpp", + "external/sources/boost/type_traits/config.hpp", + "external/sources/boost/type_traits/conjunction.hpp", + "external/sources/boost/type_traits/conversion_traits.hpp", + "external/sources/boost/type_traits/copy_cv.hpp", + "external/sources/boost/type_traits/copy_cv_ref.hpp", + "external/sources/boost/type_traits/copy_reference.hpp", + "external/sources/boost/type_traits/cv_traits.hpp", + "external/sources/boost/type_traits/decay.hpp", + "external/sources/boost/type_traits/declval.hpp", + "external/sources/boost/type_traits/detail/bool_trait_def.hpp", + "external/sources/boost/type_traits/detail/bool_trait_undef.hpp", + "external/sources/boost/type_traits/detail/common_arithmetic_type.hpp", + "external/sources/boost/type_traits/detail/common_type_impl.hpp", + "external/sources/boost/type_traits/detail/composite_member_pointer_type.hpp", + "external/sources/boost/type_traits/detail/composite_pointer_type.hpp", + "external/sources/boost/type_traits/detail/config.hpp", + "external/sources/boost/type_traits/detail/detector.hpp", + "external/sources/boost/type_traits/detail/has_binary_operator.hpp", + "external/sources/boost/type_traits/detail/has_postfix_operator.hpp", + "external/sources/boost/type_traits/detail/has_prefix_operator.hpp", + "external/sources/boost/type_traits/detail/ice_and.hpp", + "external/sources/boost/type_traits/detail/ice_eq.hpp", + "external/sources/boost/type_traits/detail/ice_not.hpp", + "external/sources/boost/type_traits/detail/ice_or.hpp", + "external/sources/boost/type_traits/detail/is_function_cxx_03.hpp", + "external/sources/boost/type_traits/detail/is_function_cxx_11.hpp", + "external/sources/boost/type_traits/detail/is_function_msvc10_fix.hpp", + "external/sources/boost/type_traits/detail/is_function_ptr_helper.hpp", + "external/sources/boost/type_traits/detail/is_function_ptr_tester.hpp", + "external/sources/boost/type_traits/detail/is_likely_lambda.hpp", + "external/sources/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp", + "external/sources/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp", + "external/sources/boost/type_traits/detail/is_member_function_pointer_cxx_03.hpp", + "external/sources/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp", + "external/sources/boost/type_traits/detail/is_rvalue_reference_msvc10_fix.hpp", + "external/sources/boost/type_traits/detail/mp_defer.hpp", + "external/sources/boost/type_traits/detail/template_arity_spec.hpp", + "external/sources/boost/type_traits/detail/yes_no_type.hpp", + "external/sources/boost/type_traits/detected.hpp", + "external/sources/boost/type_traits/detected_or.hpp", + "external/sources/boost/type_traits/disjunction.hpp", + "external/sources/boost/type_traits/enable_if.hpp", + "external/sources/boost/type_traits/extent.hpp", + "external/sources/boost/type_traits/floating_point_promotion.hpp", + "external/sources/boost/type_traits/function_traits.hpp", + "external/sources/boost/type_traits/has_bit_and.hpp", + "external/sources/boost/type_traits/has_bit_and_assign.hpp", + "external/sources/boost/type_traits/has_bit_or.hpp", + "external/sources/boost/type_traits/has_bit_or_assign.hpp", + "external/sources/boost/type_traits/has_bit_xor.hpp", + "external/sources/boost/type_traits/has_bit_xor_assign.hpp", + "external/sources/boost/type_traits/has_complement.hpp", + "external/sources/boost/type_traits/has_dereference.hpp", + "external/sources/boost/type_traits/has_divides.hpp", + "external/sources/boost/type_traits/has_divides_assign.hpp", + "external/sources/boost/type_traits/has_equal_to.hpp", + "external/sources/boost/type_traits/has_greater.hpp", + "external/sources/boost/type_traits/has_greater_equal.hpp", + "external/sources/boost/type_traits/has_left_shift.hpp", + "external/sources/boost/type_traits/has_left_shift_assign.hpp", + "external/sources/boost/type_traits/has_less.hpp", + "external/sources/boost/type_traits/has_less_equal.hpp", + "external/sources/boost/type_traits/has_logical_and.hpp", + "external/sources/boost/type_traits/has_logical_not.hpp", + "external/sources/boost/type_traits/has_logical_or.hpp", + "external/sources/boost/type_traits/has_minus.hpp", + "external/sources/boost/type_traits/has_minus_assign.hpp", + "external/sources/boost/type_traits/has_modulus.hpp", + "external/sources/boost/type_traits/has_modulus_assign.hpp", + "external/sources/boost/type_traits/has_multiplies.hpp", + "external/sources/boost/type_traits/has_multiplies_assign.hpp", + "external/sources/boost/type_traits/has_negate.hpp", + "external/sources/boost/type_traits/has_new_operator.hpp", + "external/sources/boost/type_traits/has_not_equal_to.hpp", + "external/sources/boost/type_traits/has_nothrow_assign.hpp", + "external/sources/boost/type_traits/has_nothrow_constructor.hpp", + "external/sources/boost/type_traits/has_nothrow_copy.hpp", + "external/sources/boost/type_traits/has_nothrow_destructor.hpp", + "external/sources/boost/type_traits/has_operator.hpp", + "external/sources/boost/type_traits/has_plus.hpp", + "external/sources/boost/type_traits/has_plus_assign.hpp", + "external/sources/boost/type_traits/has_post_decrement.hpp", + "external/sources/boost/type_traits/has_post_increment.hpp", + "external/sources/boost/type_traits/has_pre_decrement.hpp", + "external/sources/boost/type_traits/has_pre_increment.hpp", + "external/sources/boost/type_traits/has_right_shift.hpp", + "external/sources/boost/type_traits/has_right_shift_assign.hpp", + "external/sources/boost/type_traits/has_trivial_assign.hpp", + "external/sources/boost/type_traits/has_trivial_constructor.hpp", + "external/sources/boost/type_traits/has_trivial_copy.hpp", + "external/sources/boost/type_traits/has_trivial_destructor.hpp", + "external/sources/boost/type_traits/has_trivial_move_assign.hpp", + "external/sources/boost/type_traits/has_trivial_move_constructor.hpp", + "external/sources/boost/type_traits/has_unary_minus.hpp", + "external/sources/boost/type_traits/has_unary_plus.hpp", + "external/sources/boost/type_traits/has_virtual_destructor.hpp", + "external/sources/boost/type_traits/ice.hpp", + "external/sources/boost/type_traits/integral_constant.hpp", + "external/sources/boost/type_traits/integral_promotion.hpp", + "external/sources/boost/type_traits/intrinsics.hpp", + "external/sources/boost/type_traits/is_abstract.hpp", + "external/sources/boost/type_traits/is_arithmetic.hpp", + "external/sources/boost/type_traits/is_array.hpp", + "external/sources/boost/type_traits/is_assignable.hpp", + "external/sources/boost/type_traits/is_base_and_derived.hpp", + "external/sources/boost/type_traits/is_base_of.hpp", + "external/sources/boost/type_traits/is_base_of_tr1.hpp", + "external/sources/boost/type_traits/is_bounded_array.hpp", + "external/sources/boost/type_traits/is_class.hpp", + "external/sources/boost/type_traits/is_complete.hpp", + "external/sources/boost/type_traits/is_complex.hpp", + "external/sources/boost/type_traits/is_compound.hpp", + "external/sources/boost/type_traits/is_const.hpp", + "external/sources/boost/type_traits/is_constructible.hpp", + "external/sources/boost/type_traits/is_convertible.hpp", + "external/sources/boost/type_traits/is_copy_assignable.hpp", + "external/sources/boost/type_traits/is_copy_constructible.hpp", + "external/sources/boost/type_traits/is_default_constructible.hpp", + "external/sources/boost/type_traits/is_destructible.hpp", + "external/sources/boost/type_traits/is_detected.hpp", + "external/sources/boost/type_traits/is_detected_convertible.hpp", + "external/sources/boost/type_traits/is_detected_exact.hpp", + "external/sources/boost/type_traits/is_empty.hpp", + "external/sources/boost/type_traits/is_enum.hpp", + "external/sources/boost/type_traits/is_final.hpp", + "external/sources/boost/type_traits/is_float.hpp", + "external/sources/boost/type_traits/is_floating_point.hpp", + "external/sources/boost/type_traits/is_function.hpp", + "external/sources/boost/type_traits/is_fundamental.hpp", + "external/sources/boost/type_traits/is_integral.hpp", + "external/sources/boost/type_traits/is_list_constructible.hpp", + "external/sources/boost/type_traits/is_lvalue_reference.hpp", + "external/sources/boost/type_traits/is_member_function_pointer.hpp", + "external/sources/boost/type_traits/is_member_object_pointer.hpp", + "external/sources/boost/type_traits/is_member_pointer.hpp", + "external/sources/boost/type_traits/is_noncopyable.hpp", + "external/sources/boost/type_traits/is_nothrow_move_assignable.hpp", + "external/sources/boost/type_traits/is_nothrow_move_constructible.hpp", + "external/sources/boost/type_traits/is_nothrow_swappable.hpp", + "external/sources/boost/type_traits/is_object.hpp", + "external/sources/boost/type_traits/is_pod.hpp", + "external/sources/boost/type_traits/is_pointer.hpp", + "external/sources/boost/type_traits/is_polymorphic.hpp", + "external/sources/boost/type_traits/is_reference.hpp", + "external/sources/boost/type_traits/is_rvalue_reference.hpp", + "external/sources/boost/type_traits/is_same.hpp", + "external/sources/boost/type_traits/is_scalar.hpp", + "external/sources/boost/type_traits/is_scoped_enum.hpp", + "external/sources/boost/type_traits/is_signed.hpp", + "external/sources/boost/type_traits/is_stateless.hpp", + "external/sources/boost/type_traits/is_trivially_copyable.hpp", + "external/sources/boost/type_traits/is_unbounded_array.hpp", + "external/sources/boost/type_traits/is_union.hpp", + "external/sources/boost/type_traits/is_unscoped_enum.hpp", + "external/sources/boost/type_traits/is_unsigned.hpp", + "external/sources/boost/type_traits/is_virtual_base_of.hpp", + "external/sources/boost/type_traits/is_void.hpp", + "external/sources/boost/type_traits/is_volatile.hpp", + "external/sources/boost/type_traits/make_signed.hpp", + "external/sources/boost/type_traits/make_unsigned.hpp", + "external/sources/boost/type_traits/make_void.hpp", + "external/sources/boost/type_traits/negation.hpp", + "external/sources/boost/type_traits/nonesuch.hpp", + "external/sources/boost/type_traits/object_traits.hpp", + "external/sources/boost/type_traits/promote.hpp", + "external/sources/boost/type_traits/rank.hpp", + "external/sources/boost/type_traits/reference_traits.hpp", + "external/sources/boost/type_traits/remove_all_extents.hpp", + "external/sources/boost/type_traits/remove_bounds.hpp", + "external/sources/boost/type_traits/remove_const.hpp", + "external/sources/boost/type_traits/remove_cv.hpp", + "external/sources/boost/type_traits/remove_cv_ref.hpp", + "external/sources/boost/type_traits/remove_extent.hpp", + "external/sources/boost/type_traits/remove_pointer.hpp", + "external/sources/boost/type_traits/remove_reference.hpp", + "external/sources/boost/type_traits/remove_volatile.hpp", + "external/sources/boost/type_traits/same_traits.hpp", + "external/sources/boost/type_traits/transform_traits.hpp", + "external/sources/boost/type_traits/type_identity.hpp", + "external/sources/boost/type_traits/type_with_alignment.hpp", + "external/sources/boost/typeof/constant.hpp", + "external/sources/boost/typeof/decltype.hpp", + "external/sources/boost/typeof/dmc/typeof_impl.hpp", + "external/sources/boost/typeof/encode_decode.hpp", + "external/sources/boost/typeof/encode_decode_params.hpp", + "external/sources/boost/typeof/incr_registration_group.hpp", + "external/sources/boost/typeof/int_encoding.hpp", + "external/sources/boost/typeof/integral_template_param.hpp", + "external/sources/boost/typeof/message.hpp", + "external/sources/boost/typeof/modifiers.hpp", + "external/sources/boost/typeof/msvc/typeof_impl.hpp", + "external/sources/boost/typeof/native.hpp", + "external/sources/boost/typeof/pointers_data_members.hpp", + "external/sources/boost/typeof/register_functions.hpp", + "external/sources/boost/typeof/register_functions_iterate.hpp", + "external/sources/boost/typeof/register_fundamental.hpp", + "external/sources/boost/typeof/register_mem_functions.hpp", + "external/sources/boost/typeof/std/bitset.hpp", + "external/sources/boost/typeof/std/complex.hpp", + "external/sources/boost/typeof/std/deque.hpp", + "external/sources/boost/typeof/std/fstream.hpp", + "external/sources/boost/typeof/std/functional.hpp", + "external/sources/boost/typeof/std/iostream.hpp", + "external/sources/boost/typeof/std/istream.hpp", + "external/sources/boost/typeof/std/iterator.hpp", + "external/sources/boost/typeof/std/list.hpp", + "external/sources/boost/typeof/std/locale.hpp", + "external/sources/boost/typeof/std/map.hpp", + "external/sources/boost/typeof/std/memory.hpp", + "external/sources/boost/typeof/std/ostream.hpp", + "external/sources/boost/typeof/std/queue.hpp", + "external/sources/boost/typeof/std/set.hpp", + "external/sources/boost/typeof/std/sstream.hpp", + "external/sources/boost/typeof/std/stack.hpp", + "external/sources/boost/typeof/std/streambuf.hpp", + "external/sources/boost/typeof/std/string.hpp", + "external/sources/boost/typeof/std/utility.hpp", + "external/sources/boost/typeof/std/valarray.hpp", + "external/sources/boost/typeof/std/vector.hpp", + "external/sources/boost/typeof/template_encoding.hpp", + "external/sources/boost/typeof/template_template_param.hpp", + "external/sources/boost/typeof/type_encoding.hpp", + "external/sources/boost/typeof/type_template_param.hpp", + "external/sources/boost/typeof/typeof.hpp", + "external/sources/boost/typeof/typeof_impl.hpp", + "external/sources/boost/typeof/unsupported.hpp", + "external/sources/boost/typeof/vector.hpp", + "external/sources/boost/typeof/vector100.hpp", + "external/sources/boost/typeof/vector150.hpp", + "external/sources/boost/typeof/vector200.hpp", + "external/sources/boost/typeof/vector50.hpp", + "external/sources/boost/units/absolute.hpp", + "external/sources/boost/units/base_dimension.hpp", + "external/sources/boost/units/base_unit.hpp", + "external/sources/boost/units/base_units/angle/arcminute.hpp", + "external/sources/boost/units/base_units/angle/arcsecond.hpp", + "external/sources/boost/units/base_units/angle/degree.hpp", + "external/sources/boost/units/base_units/angle/gradian.hpp", + "external/sources/boost/units/base_units/angle/radian.hpp", + "external/sources/boost/units/base_units/angle/revolution.hpp", + "external/sources/boost/units/base_units/angle/steradian.hpp", + "external/sources/boost/units/base_units/astronomical/astronomical_unit.hpp", + "external/sources/boost/units/base_units/astronomical/light_day.hpp", + "external/sources/boost/units/base_units/astronomical/light_hour.hpp", + "external/sources/boost/units/base_units/astronomical/light_minute.hpp", + "external/sources/boost/units/base_units/astronomical/light_second.hpp", + "external/sources/boost/units/base_units/astronomical/light_year.hpp", + "external/sources/boost/units/base_units/astronomical/parsec.hpp", + "external/sources/boost/units/base_units/cgs/biot.hpp", + "external/sources/boost/units/base_units/cgs/centimeter.hpp", + "external/sources/boost/units/base_units/cgs/gram.hpp", + "external/sources/boost/units/base_units/imperial/conversions.hpp", + "external/sources/boost/units/base_units/imperial/drachm.hpp", + "external/sources/boost/units/base_units/imperial/fluid_ounce.hpp", + "external/sources/boost/units/base_units/imperial/foot.hpp", + "external/sources/boost/units/base_units/imperial/furlong.hpp", + "external/sources/boost/units/base_units/imperial/gallon.hpp", + "external/sources/boost/units/base_units/imperial/gill.hpp", + "external/sources/boost/units/base_units/imperial/grain.hpp", + "external/sources/boost/units/base_units/imperial/hundredweight.hpp", + "external/sources/boost/units/base_units/imperial/inch.hpp", + "external/sources/boost/units/base_units/imperial/league.hpp", + "external/sources/boost/units/base_units/imperial/mile.hpp", + "external/sources/boost/units/base_units/imperial/ounce.hpp", + "external/sources/boost/units/base_units/imperial/pint.hpp", + "external/sources/boost/units/base_units/imperial/pound.hpp", + "external/sources/boost/units/base_units/imperial/quart.hpp", + "external/sources/boost/units/base_units/imperial/quarter.hpp", + "external/sources/boost/units/base_units/imperial/stone.hpp", + "external/sources/boost/units/base_units/imperial/thou.hpp", + "external/sources/boost/units/base_units/imperial/ton.hpp", + "external/sources/boost/units/base_units/imperial/yard.hpp", + "external/sources/boost/units/base_units/information/bit.hpp", + "external/sources/boost/units/base_units/information/byte.hpp", + "external/sources/boost/units/base_units/information/hartley.hpp", + "external/sources/boost/units/base_units/information/nat.hpp", + "external/sources/boost/units/base_units/information/shannon.hpp", + "external/sources/boost/units/base_units/metric/angstrom.hpp", + "external/sources/boost/units/base_units/metric/are.hpp", + "external/sources/boost/units/base_units/metric/atmosphere.hpp", + "external/sources/boost/units/base_units/metric/bar.hpp", + "external/sources/boost/units/base_units/metric/barn.hpp", + "external/sources/boost/units/base_units/metric/day.hpp", + "external/sources/boost/units/base_units/metric/fermi.hpp", + "external/sources/boost/units/base_units/metric/hectare.hpp", + "external/sources/boost/units/base_units/metric/hour.hpp", + "external/sources/boost/units/base_units/metric/knot.hpp", + "external/sources/boost/units/base_units/metric/liter.hpp", + "external/sources/boost/units/base_units/metric/micron.hpp", + "external/sources/boost/units/base_units/metric/minute.hpp", + "external/sources/boost/units/base_units/metric/mmHg.hpp", + "external/sources/boost/units/base_units/metric/nautical_mile.hpp", + "external/sources/boost/units/base_units/metric/ton.hpp", + "external/sources/boost/units/base_units/metric/torr.hpp", + "external/sources/boost/units/base_units/metric/year.hpp", + "external/sources/boost/units/base_units/si/ampere.hpp", + "external/sources/boost/units/base_units/si/candela.hpp", + "external/sources/boost/units/base_units/si/kelvin.hpp", + "external/sources/boost/units/base_units/si/kilogram.hpp", + "external/sources/boost/units/base_units/si/meter.hpp", + "external/sources/boost/units/base_units/si/mole.hpp", + "external/sources/boost/units/base_units/si/second.hpp", + "external/sources/boost/units/base_units/temperature/celsius.hpp", + "external/sources/boost/units/base_units/temperature/conversions.hpp", + "external/sources/boost/units/base_units/temperature/fahrenheit.hpp", + "external/sources/boost/units/base_units/us/cup.hpp", + "external/sources/boost/units/base_units/us/dram.hpp", + "external/sources/boost/units/base_units/us/fluid_dram.hpp", + "external/sources/boost/units/base_units/us/fluid_ounce.hpp", + "external/sources/boost/units/base_units/us/foot.hpp", + "external/sources/boost/units/base_units/us/gallon.hpp", + "external/sources/boost/units/base_units/us/gill.hpp", + "external/sources/boost/units/base_units/us/grain.hpp", + "external/sources/boost/units/base_units/us/hundredweight.hpp", + "external/sources/boost/units/base_units/us/inch.hpp", + "external/sources/boost/units/base_units/us/mil.hpp", + "external/sources/boost/units/base_units/us/mile.hpp", + "external/sources/boost/units/base_units/us/minim.hpp", + "external/sources/boost/units/base_units/us/ounce.hpp", + "external/sources/boost/units/base_units/us/pint.hpp", + "external/sources/boost/units/base_units/us/pound.hpp", + "external/sources/boost/units/base_units/us/pound_force.hpp", + "external/sources/boost/units/base_units/us/quart.hpp", + "external/sources/boost/units/base_units/us/tablespoon.hpp", + "external/sources/boost/units/base_units/us/teaspoon.hpp", + "external/sources/boost/units/base_units/us/ton.hpp", + "external/sources/boost/units/base_units/us/yard.hpp", + "external/sources/boost/units/cmath.hpp", + "external/sources/boost/units/config.hpp", + "external/sources/boost/units/conversion.hpp", + "external/sources/boost/units/derived_dimension.hpp", + "external/sources/boost/units/detail/absolute_impl.hpp", + "external/sources/boost/units/detail/cmath_impl.hpp", + "external/sources/boost/units/detail/conversion_impl.hpp", + "external/sources/boost/units/detail/dim_impl.hpp", + "external/sources/boost/units/detail/dimension_impl.hpp", + "external/sources/boost/units/detail/dimension_list.hpp", + "external/sources/boost/units/detail/dimensionless_unit.hpp", + "external/sources/boost/units/detail/heterogeneous_conversion.hpp", + "external/sources/boost/units/detail/linear_algebra.hpp", + "external/sources/boost/units/detail/one.hpp", + "external/sources/boost/units/detail/ordinal.hpp", + "external/sources/boost/units/detail/prevent_redefinition.hpp", + "external/sources/boost/units/detail/push_front_if.hpp", + "external/sources/boost/units/detail/push_front_or_add.hpp", + "external/sources/boost/units/detail/sort.hpp", + "external/sources/boost/units/detail/static_rational_power.hpp", + "external/sources/boost/units/detail/unscale.hpp", + "external/sources/boost/units/detail/utility.hpp", + "external/sources/boost/units/dim.hpp", + "external/sources/boost/units/dimension.hpp", + "external/sources/boost/units/dimensionless_quantity.hpp", + "external/sources/boost/units/dimensionless_type.hpp", + "external/sources/boost/units/dimensionless_unit.hpp", + "external/sources/boost/units/get_dimension.hpp", + "external/sources/boost/units/get_system.hpp", + "external/sources/boost/units/heterogeneous_system.hpp", + "external/sources/boost/units/homogeneous_system.hpp", + "external/sources/boost/units/io.hpp", + "external/sources/boost/units/is_dim.hpp", + "external/sources/boost/units/is_dimension_list.hpp", + "external/sources/boost/units/is_dimensionless.hpp", + "external/sources/boost/units/is_dimensionless_quantity.hpp", + "external/sources/boost/units/is_dimensionless_unit.hpp", + "external/sources/boost/units/is_quantity.hpp", + "external/sources/boost/units/is_quantity_of_dimension.hpp", + "external/sources/boost/units/is_quantity_of_system.hpp", + "external/sources/boost/units/is_unit.hpp", + "external/sources/boost/units/is_unit_of_dimension.hpp", + "external/sources/boost/units/is_unit_of_system.hpp", + "external/sources/boost/units/lambda.hpp", + "external/sources/boost/units/limits.hpp", + "external/sources/boost/units/make_scaled_unit.hpp", + "external/sources/boost/units/make_system.hpp", + "external/sources/boost/units/operators.hpp", + "external/sources/boost/units/physical_dimensions.hpp", + "external/sources/boost/units/physical_dimensions/absorbed_dose.hpp", + "external/sources/boost/units/physical_dimensions/acceleration.hpp", + "external/sources/boost/units/physical_dimensions/action.hpp", + "external/sources/boost/units/physical_dimensions/activity.hpp", + "external/sources/boost/units/physical_dimensions/amount.hpp", + "external/sources/boost/units/physical_dimensions/angular_acceleration.hpp", + "external/sources/boost/units/physical_dimensions/angular_momentum.hpp", + "external/sources/boost/units/physical_dimensions/angular_velocity.hpp", + "external/sources/boost/units/physical_dimensions/area.hpp", + "external/sources/boost/units/physical_dimensions/capacitance.hpp", + "external/sources/boost/units/physical_dimensions/conductance.hpp", + "external/sources/boost/units/physical_dimensions/conductivity.hpp", + "external/sources/boost/units/physical_dimensions/current.hpp", + "external/sources/boost/units/physical_dimensions/dose_equivalent.hpp", + "external/sources/boost/units/physical_dimensions/dynamic_viscosity.hpp", + "external/sources/boost/units/physical_dimensions/electric_charge.hpp", + "external/sources/boost/units/physical_dimensions/electric_potential.hpp", + "external/sources/boost/units/physical_dimensions/energy.hpp", + "external/sources/boost/units/physical_dimensions/energy_density.hpp", + "external/sources/boost/units/physical_dimensions/force.hpp", + "external/sources/boost/units/physical_dimensions/frequency.hpp", + "external/sources/boost/units/physical_dimensions/heat_capacity.hpp", + "external/sources/boost/units/physical_dimensions/illuminance.hpp", + "external/sources/boost/units/physical_dimensions/impedance.hpp", + "external/sources/boost/units/physical_dimensions/inductance.hpp", + "external/sources/boost/units/physical_dimensions/information.hpp", + "external/sources/boost/units/physical_dimensions/kinematic_viscosity.hpp", + "external/sources/boost/units/physical_dimensions/length.hpp", + "external/sources/boost/units/physical_dimensions/luminance.hpp", + "external/sources/boost/units/physical_dimensions/luminous_flux.hpp", + "external/sources/boost/units/physical_dimensions/luminous_intensity.hpp", + "external/sources/boost/units/physical_dimensions/magnetic_field_intensity.hpp", + "external/sources/boost/units/physical_dimensions/magnetic_flux.hpp", + "external/sources/boost/units/physical_dimensions/magnetic_flux_density.hpp", + "external/sources/boost/units/physical_dimensions/mass.hpp", + "external/sources/boost/units/physical_dimensions/mass_density.hpp", + "external/sources/boost/units/physical_dimensions/molar_energy.hpp", + "external/sources/boost/units/physical_dimensions/molar_heat_capacity.hpp", + "external/sources/boost/units/physical_dimensions/moment_of_inertia.hpp", + "external/sources/boost/units/physical_dimensions/momentum.hpp", + "external/sources/boost/units/physical_dimensions/permeability.hpp", + "external/sources/boost/units/physical_dimensions/permittivity.hpp", + "external/sources/boost/units/physical_dimensions/plane_angle.hpp", + "external/sources/boost/units/physical_dimensions/power.hpp", + "external/sources/boost/units/physical_dimensions/pressure.hpp", + "external/sources/boost/units/physical_dimensions/reluctance.hpp", + "external/sources/boost/units/physical_dimensions/resistance.hpp", + "external/sources/boost/units/physical_dimensions/resistivity.hpp", + "external/sources/boost/units/physical_dimensions/solid_angle.hpp", + "external/sources/boost/units/physical_dimensions/specific_energy.hpp", + "external/sources/boost/units/physical_dimensions/specific_heat_capacity.hpp", + "external/sources/boost/units/physical_dimensions/specific_volume.hpp", + "external/sources/boost/units/physical_dimensions/stress.hpp", + "external/sources/boost/units/physical_dimensions/surface_density.hpp", + "external/sources/boost/units/physical_dimensions/surface_tension.hpp", + "external/sources/boost/units/physical_dimensions/temperature.hpp", + "external/sources/boost/units/physical_dimensions/thermal_conductivity.hpp", + "external/sources/boost/units/physical_dimensions/time.hpp", + "external/sources/boost/units/physical_dimensions/torque.hpp", + "external/sources/boost/units/physical_dimensions/velocity.hpp", + "external/sources/boost/units/physical_dimensions/volume.hpp", + "external/sources/boost/units/physical_dimensions/wavenumber.hpp", + "external/sources/boost/units/pow.hpp", + "external/sources/boost/units/quantity.hpp", + "external/sources/boost/units/reduce_unit.hpp", + "external/sources/boost/units/scale.hpp", + "external/sources/boost/units/scaled_base_unit.hpp", + "external/sources/boost/units/static_constant.hpp", + "external/sources/boost/units/static_rational.hpp", + "external/sources/boost/units/systems/abstract.hpp", + "external/sources/boost/units/systems/angle/degrees.hpp", + "external/sources/boost/units/systems/angle/gradians.hpp", + "external/sources/boost/units/systems/angle/revolutions.hpp", + "external/sources/boost/units/systems/cgs.hpp", + "external/sources/boost/units/systems/cgs/acceleration.hpp", + "external/sources/boost/units/systems/cgs/area.hpp", + "external/sources/boost/units/systems/cgs/base.hpp", + "external/sources/boost/units/systems/cgs/current.hpp", + "external/sources/boost/units/systems/cgs/dimensionless.hpp", + "external/sources/boost/units/systems/cgs/dynamic_viscosity.hpp", + "external/sources/boost/units/systems/cgs/energy.hpp", + "external/sources/boost/units/systems/cgs/force.hpp", + "external/sources/boost/units/systems/cgs/frequency.hpp", + "external/sources/boost/units/systems/cgs/io.hpp", + "external/sources/boost/units/systems/cgs/kinematic_viscosity.hpp", + "external/sources/boost/units/systems/cgs/length.hpp", + "external/sources/boost/units/systems/cgs/mass.hpp", + "external/sources/boost/units/systems/cgs/mass_density.hpp", + "external/sources/boost/units/systems/cgs/momentum.hpp", + "external/sources/boost/units/systems/cgs/power.hpp", + "external/sources/boost/units/systems/cgs/pressure.hpp", + "external/sources/boost/units/systems/cgs/time.hpp", + "external/sources/boost/units/systems/cgs/velocity.hpp", + "external/sources/boost/units/systems/cgs/volume.hpp", + "external/sources/boost/units/systems/cgs/wavenumber.hpp", + "external/sources/boost/units/systems/detail/constants.hpp", + "external/sources/boost/units/systems/information.hpp", + "external/sources/boost/units/systems/information/bit.hpp", + "external/sources/boost/units/systems/information/byte.hpp", + "external/sources/boost/units/systems/information/hartley.hpp", + "external/sources/boost/units/systems/information/nat.hpp", + "external/sources/boost/units/systems/information/prefixes.hpp", + "external/sources/boost/units/systems/information/shannon.hpp", + "external/sources/boost/units/systems/si.hpp", + "external/sources/boost/units/systems/si/absorbed_dose.hpp", + "external/sources/boost/units/systems/si/acceleration.hpp", + "external/sources/boost/units/systems/si/action.hpp", + "external/sources/boost/units/systems/si/activity.hpp", + "external/sources/boost/units/systems/si/amount.hpp", + "external/sources/boost/units/systems/si/angular_acceleration.hpp", + "external/sources/boost/units/systems/si/angular_momentum.hpp", + "external/sources/boost/units/systems/si/angular_velocity.hpp", + "external/sources/boost/units/systems/si/area.hpp", + "external/sources/boost/units/systems/si/base.hpp", + "external/sources/boost/units/systems/si/capacitance.hpp", + "external/sources/boost/units/systems/si/catalytic_activity.hpp", + "external/sources/boost/units/systems/si/codata/alpha_constants.hpp", + "external/sources/boost/units/systems/si/codata/atomic-nuclear_constants.hpp", + "external/sources/boost/units/systems/si/codata/deuteron_constants.hpp", + "external/sources/boost/units/systems/si/codata/electromagnetic_constants.hpp", + "external/sources/boost/units/systems/si/codata/electron_constants.hpp", + "external/sources/boost/units/systems/si/codata/helion_constants.hpp", + "external/sources/boost/units/systems/si/codata/muon_constants.hpp", + "external/sources/boost/units/systems/si/codata/neutron_constants.hpp", + "external/sources/boost/units/systems/si/codata/physico-chemical_constants.hpp", + "external/sources/boost/units/systems/si/codata/proton_constants.hpp", + "external/sources/boost/units/systems/si/codata/tau_constants.hpp", + "external/sources/boost/units/systems/si/codata/triton_constants.hpp", + "external/sources/boost/units/systems/si/codata/typedefs.hpp", + "external/sources/boost/units/systems/si/codata/universal_constants.hpp", + "external/sources/boost/units/systems/si/codata_constants.hpp", + "external/sources/boost/units/systems/si/conductance.hpp", + "external/sources/boost/units/systems/si/conductivity.hpp", + "external/sources/boost/units/systems/si/current.hpp", + "external/sources/boost/units/systems/si/dimensionless.hpp", + "external/sources/boost/units/systems/si/dose_equivalent.hpp", + "external/sources/boost/units/systems/si/dynamic_viscosity.hpp", + "external/sources/boost/units/systems/si/electric_charge.hpp", + "external/sources/boost/units/systems/si/electric_potential.hpp", + "external/sources/boost/units/systems/si/energy.hpp", + "external/sources/boost/units/systems/si/force.hpp", + "external/sources/boost/units/systems/si/frequency.hpp", + "external/sources/boost/units/systems/si/illuminance.hpp", + "external/sources/boost/units/systems/si/impedance.hpp", + "external/sources/boost/units/systems/si/inductance.hpp", + "external/sources/boost/units/systems/si/io.hpp", + "external/sources/boost/units/systems/si/kinematic_viscosity.hpp", + "external/sources/boost/units/systems/si/length.hpp", + "external/sources/boost/units/systems/si/luminous_flux.hpp", + "external/sources/boost/units/systems/si/luminous_intensity.hpp", + "external/sources/boost/units/systems/si/magnetic_field_intensity.hpp", + "external/sources/boost/units/systems/si/magnetic_flux.hpp", + "external/sources/boost/units/systems/si/magnetic_flux_density.hpp", + "external/sources/boost/units/systems/si/mass.hpp", + "external/sources/boost/units/systems/si/mass_density.hpp", + "external/sources/boost/units/systems/si/moment_of_inertia.hpp", + "external/sources/boost/units/systems/si/momentum.hpp", + "external/sources/boost/units/systems/si/permeability.hpp", + "external/sources/boost/units/systems/si/permittivity.hpp", + "external/sources/boost/units/systems/si/plane_angle.hpp", + "external/sources/boost/units/systems/si/power.hpp", + "external/sources/boost/units/systems/si/prefixes.hpp", + "external/sources/boost/units/systems/si/pressure.hpp", + "external/sources/boost/units/systems/si/reluctance.hpp", + "external/sources/boost/units/systems/si/resistance.hpp", + "external/sources/boost/units/systems/si/resistivity.hpp", + "external/sources/boost/units/systems/si/solid_angle.hpp", + "external/sources/boost/units/systems/si/surface_density.hpp", + "external/sources/boost/units/systems/si/surface_tension.hpp", + "external/sources/boost/units/systems/si/temperature.hpp", + "external/sources/boost/units/systems/si/time.hpp", + "external/sources/boost/units/systems/si/torque.hpp", + "external/sources/boost/units/systems/si/velocity.hpp", + "external/sources/boost/units/systems/si/volume.hpp", + "external/sources/boost/units/systems/si/wavenumber.hpp", + "external/sources/boost/units/systems/temperature/celsius.hpp", + "external/sources/boost/units/systems/temperature/fahrenheit.hpp", + "external/sources/boost/units/unit.hpp", + "external/sources/boost/units/units_fwd.hpp", + "external/sources/boost/unordered/detail/fwd.hpp", + "external/sources/boost/unordered/detail/implementation.hpp", + "external/sources/boost/unordered/detail/map.hpp", + "external/sources/boost/unordered/detail/set.hpp", + "external/sources/boost/unordered/unordered_map.hpp", + "external/sources/boost/unordered/unordered_map_fwd.hpp", + "external/sources/boost/unordered/unordered_set.hpp", + "external/sources/boost/unordered/unordered_set_fwd.hpp", + "external/sources/boost/unordered_map.hpp", + "external/sources/boost/unordered_set.hpp", + "external/sources/boost/utility.hpp", + "external/sources/boost/utility/addressof.hpp", + "external/sources/boost/utility/base_from_member.hpp", + "external/sources/boost/utility/binary.hpp", + "external/sources/boost/utility/compare_pointees.hpp", + "external/sources/boost/utility/declval.hpp", + "external/sources/boost/utility/detail/in_place_factory_prefix.hpp", + "external/sources/boost/utility/detail/in_place_factory_suffix.hpp", + "external/sources/boost/utility/detail/minstd_rand.hpp", + "external/sources/boost/utility/detail/result_of_iterate.hpp", + "external/sources/boost/utility/enable_if.hpp", + "external/sources/boost/utility/explicit_operator_bool.hpp", + "external/sources/boost/utility/identity_type.hpp", + "external/sources/boost/utility/in_place_factory.hpp", + "external/sources/boost/utility/result_of.hpp", + "external/sources/boost/utility/string_ref.hpp", + "external/sources/boost/utility/string_ref_fwd.hpp", + "external/sources/boost/utility/string_view.hpp", + "external/sources/boost/utility/string_view_fwd.hpp", + "external/sources/boost/utility/swap.hpp", + "external/sources/boost/utility/typed_in_place_factory.hpp", + "external/sources/boost/utility/value_init.hpp", + "external/sources/boost/uuid/basic_name_generator.hpp", + "external/sources/boost/uuid/detail/config.hpp", + "external/sources/boost/uuid/detail/md5.hpp", + "external/sources/boost/uuid/detail/random_provider.hpp", + "external/sources/boost/uuid/detail/random_provider_arc4random.ipp", + "external/sources/boost/uuid/detail/random_provider_bcrypt.ipp", + "external/sources/boost/uuid/detail/random_provider_detect_platform.hpp", + "external/sources/boost/uuid/detail/random_provider_getentropy.ipp", + "external/sources/boost/uuid/detail/random_provider_getrandom.ipp", + "external/sources/boost/uuid/detail/random_provider_include_platform.hpp", + "external/sources/boost/uuid/detail/random_provider_posix.ipp", + "external/sources/boost/uuid/detail/random_provider_wincrypt.ipp", + "external/sources/boost/uuid/detail/sha1.hpp", + "external/sources/boost/uuid/detail/uuid_generic.ipp", + "external/sources/boost/uuid/detail/uuid_x86.ipp", + "external/sources/boost/uuid/entropy_error.hpp", + "external/sources/boost/uuid/name_generator.hpp", + "external/sources/boost/uuid/name_generator_md5.hpp", + "external/sources/boost/uuid/name_generator_sha1.hpp", + "external/sources/boost/uuid/nil_generator.hpp", + "external/sources/boost/uuid/random_generator.hpp", + "external/sources/boost/uuid/string_generator.hpp", + "external/sources/boost/uuid/uuid.hpp", + "external/sources/boost/uuid/uuid_generators.hpp", + "external/sources/boost/uuid/uuid_hash.hpp", + "external/sources/boost/uuid/uuid_io.hpp", + "external/sources/boost/uuid/uuid_serialize.hpp", + "external/sources/boost/variant.hpp", + "external/sources/boost/variant/apply_visitor.hpp", + "external/sources/boost/variant/bad_visit.hpp", + "external/sources/boost/variant/detail/apply_visitor_binary.hpp", + "external/sources/boost/variant/detail/apply_visitor_delayed.hpp", + "external/sources/boost/variant/detail/apply_visitor_unary.hpp", + "external/sources/boost/variant/detail/backup_holder.hpp", + "external/sources/boost/variant/detail/cast_storage.hpp", + "external/sources/boost/variant/detail/config.hpp", + "external/sources/boost/variant/detail/element_index.hpp", + "external/sources/boost/variant/detail/enable_recursive.hpp", + "external/sources/boost/variant/detail/enable_recursive_fwd.hpp", + "external/sources/boost/variant/detail/forced_return.hpp", + "external/sources/boost/variant/detail/has_result_type.hpp", + "external/sources/boost/variant/detail/hash_variant.hpp", + "external/sources/boost/variant/detail/initializer.hpp", + "external/sources/boost/variant/detail/make_variant_list.hpp", + "external/sources/boost/variant/detail/move.hpp", + "external/sources/boost/variant/detail/multivisitors_cpp11_based.hpp", + "external/sources/boost/variant/detail/multivisitors_cpp14_based.hpp", + "external/sources/boost/variant/detail/multivisitors_preprocessor_based.hpp", + "external/sources/boost/variant/detail/over_sequence.hpp", + "external/sources/boost/variant/detail/std_hash.hpp", + "external/sources/boost/variant/detail/substitute.hpp", + "external/sources/boost/variant/detail/substitute_fwd.hpp", + "external/sources/boost/variant/detail/variant_io.hpp", + "external/sources/boost/variant/detail/visitation_impl.hpp", + "external/sources/boost/variant/get.hpp", + "external/sources/boost/variant/multivisitors.hpp", + "external/sources/boost/variant/polymorphic_get.hpp", + "external/sources/boost/variant/recursive_variant.hpp", + "external/sources/boost/variant/recursive_wrapper.hpp", + "external/sources/boost/variant/recursive_wrapper_fwd.hpp", + "external/sources/boost/variant/static_visitor.hpp", + "external/sources/boost/variant/variant.hpp", + "external/sources/boost/variant/variant_fwd.hpp", + "external/sources/boost/variant/visitor_ptr.hpp", + "external/sources/boost/variant2/variant.hpp", + "external/sources/boost/version.hpp", + "external/sources/boost/visit_each.hpp", + "external/sources/boost/vmd/array.hpp", + "external/sources/boost/vmd/array/to_seq.hpp", + "external/sources/boost/vmd/array/to_tuple.hpp", + "external/sources/boost/vmd/assert.hpp", + "external/sources/boost/vmd/assert_is_array.hpp", + "external/sources/boost/vmd/assert_is_empty.hpp", + "external/sources/boost/vmd/assert_is_identifier.hpp", + "external/sources/boost/vmd/assert_is_list.hpp", + "external/sources/boost/vmd/assert_is_number.hpp", + "external/sources/boost/vmd/assert_is_seq.hpp", + "external/sources/boost/vmd/assert_is_tuple.hpp", + "external/sources/boost/vmd/assert_is_type.hpp", + "external/sources/boost/vmd/detail/adjust_tuple_type.hpp", + "external/sources/boost/vmd/detail/array.hpp", + "external/sources/boost/vmd/detail/assert.hpp", + "external/sources/boost/vmd/detail/data_equal.hpp", + "external/sources/boost/vmd/detail/data_equal_common.hpp", + "external/sources/boost/vmd/detail/empty_result.hpp", + "external/sources/boost/vmd/detail/equal.hpp", + "external/sources/boost/vmd/detail/equal_common.hpp", + "external/sources/boost/vmd/detail/equal_type.hpp", + "external/sources/boost/vmd/detail/identifier.hpp", + "external/sources/boost/vmd/detail/identifier_concat.hpp", + "external/sources/boost/vmd/detail/identifier_type.hpp", + "external/sources/boost/vmd/detail/idprefix.hpp", + "external/sources/boost/vmd/detail/is_array.hpp", + "external/sources/boost/vmd/detail/is_array_common.hpp", + "external/sources/boost/vmd/detail/is_empty.hpp", + "external/sources/boost/vmd/detail/is_empty_array.hpp", + "external/sources/boost/vmd/detail/is_empty_tuple.hpp", + "external/sources/boost/vmd/detail/is_entire.hpp", + "external/sources/boost/vmd/detail/is_identifier.hpp", + "external/sources/boost/vmd/detail/is_list.hpp", + "external/sources/boost/vmd/detail/is_number.hpp", + "external/sources/boost/vmd/detail/is_seq.hpp", + "external/sources/boost/vmd/detail/is_tuple.hpp", + "external/sources/boost/vmd/detail/is_type.hpp", + "external/sources/boost/vmd/detail/is_type_type.hpp", + "external/sources/boost/vmd/detail/list.hpp", + "external/sources/boost/vmd/detail/match_identifier.hpp", + "external/sources/boost/vmd/detail/match_identifier_common.hpp", + "external/sources/boost/vmd/detail/match_single_identifier.hpp", + "external/sources/boost/vmd/detail/modifiers.hpp", + "external/sources/boost/vmd/detail/mods.hpp", + "external/sources/boost/vmd/detail/nil_registration.hpp", + "external/sources/boost/vmd/detail/not_empty.hpp", + "external/sources/boost/vmd/detail/number_registration.hpp", + "external/sources/boost/vmd/detail/only_after.hpp", + "external/sources/boost/vmd/detail/parens.hpp", + "external/sources/boost/vmd/detail/parens_common.hpp", + "external/sources/boost/vmd/detail/parens_split.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_1.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_10.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_11.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_12.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_13.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_14.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_15.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_16.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_2.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_3.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_4.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_5.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_6.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_7.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_8.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_9.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_headers.hpp", + "external/sources/boost/vmd/detail/recurse/data_equal/data_equal_specific.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_1.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_10.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_11.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_12.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_13.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_14.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_15.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_16.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_2.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_3.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_4.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_5.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_6.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_7.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_8.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_9.hpp", + "external/sources/boost/vmd/detail/recurse/equal/equal_headers.hpp", + "external/sources/boost/vmd/detail/seq.hpp", + "external/sources/boost/vmd/detail/sequence_arity.hpp", + "external/sources/boost/vmd/detail/sequence_common.hpp", + "external/sources/boost/vmd/detail/sequence_elem.hpp", + "external/sources/boost/vmd/detail/sequence_enum.hpp", + "external/sources/boost/vmd/detail/sequence_size.hpp", + "external/sources/boost/vmd/detail/sequence_to_array.hpp", + "external/sources/boost/vmd/detail/sequence_to_list.hpp", + "external/sources/boost/vmd/detail/sequence_to_seq.hpp", + "external/sources/boost/vmd/detail/sequence_to_tuple.hpp", + "external/sources/boost/vmd/detail/sequence_type.hpp", + "external/sources/boost/vmd/detail/setup.hpp", + "external/sources/boost/vmd/detail/tuple.hpp", + "external/sources/boost/vmd/detail/type_registration.hpp", + "external/sources/boost/vmd/detail/variadic_pop_front.hpp", + "external/sources/boost/vmd/elem.hpp", + "external/sources/boost/vmd/empty.hpp", + "external/sources/boost/vmd/enum.hpp", + "external/sources/boost/vmd/equal.hpp", + "external/sources/boost/vmd/get_type.hpp", + "external/sources/boost/vmd/identity.hpp", + "external/sources/boost/vmd/is_array.hpp", + "external/sources/boost/vmd/is_empty.hpp", + "external/sources/boost/vmd/is_empty_array.hpp", + "external/sources/boost/vmd/is_empty_list.hpp", + "external/sources/boost/vmd/is_identifier.hpp", + "external/sources/boost/vmd/is_list.hpp", + "external/sources/boost/vmd/is_multi.hpp", + "external/sources/boost/vmd/is_number.hpp", + "external/sources/boost/vmd/is_parens_empty.hpp", + "external/sources/boost/vmd/is_seq.hpp", + "external/sources/boost/vmd/is_tuple.hpp", + "external/sources/boost/vmd/is_type.hpp", + "external/sources/boost/vmd/is_unary.hpp", + "external/sources/boost/vmd/list.hpp", + "external/sources/boost/vmd/list/to_seq.hpp", + "external/sources/boost/vmd/list/to_tuple.hpp", + "external/sources/boost/vmd/not_equal.hpp", + "external/sources/boost/vmd/seq.hpp", + "external/sources/boost/vmd/seq/is_vmd_seq.hpp", + "external/sources/boost/vmd/seq/pop_back.hpp", + "external/sources/boost/vmd/seq/pop_front.hpp", + "external/sources/boost/vmd/seq/push_back.hpp", + "external/sources/boost/vmd/seq/push_front.hpp", + "external/sources/boost/vmd/seq/remove.hpp", + "external/sources/boost/vmd/seq/size.hpp", + "external/sources/boost/vmd/seq/to_array.hpp", + "external/sources/boost/vmd/seq/to_list.hpp", + "external/sources/boost/vmd/seq/to_tuple.hpp", + "external/sources/boost/vmd/size.hpp", + "external/sources/boost/vmd/to_array.hpp", + "external/sources/boost/vmd/to_list.hpp", + "external/sources/boost/vmd/to_seq.hpp", + "external/sources/boost/vmd/to_tuple.hpp", + "external/sources/boost/vmd/tuple.hpp", + "external/sources/boost/vmd/tuple/is_vmd_tuple.hpp", + "external/sources/boost/vmd/tuple/pop_back.hpp", + "external/sources/boost/vmd/tuple/pop_front.hpp", + "external/sources/boost/vmd/tuple/push_back.hpp", + "external/sources/boost/vmd/tuple/push_front.hpp", + "external/sources/boost/vmd/tuple/remove.hpp", + "external/sources/boost/vmd/tuple/size.hpp", + "external/sources/boost/vmd/tuple/to_array.hpp", + "external/sources/boost/vmd/tuple/to_list.hpp", + "external/sources/boost/vmd/tuple/to_seq.hpp", + "external/sources/boost/vmd/vmd.hpp", + "external/sources/boost/wave.hpp", + "external/sources/boost/wave/cpp_context.hpp", + "external/sources/boost/wave/cpp_exceptions.hpp", + "external/sources/boost/wave/cpp_iteration_context.hpp", + "external/sources/boost/wave/cpp_throw.hpp", + "external/sources/boost/wave/cpplexer/convert_trigraphs.hpp", + "external/sources/boost/wave/cpplexer/cpp_lex_interface.hpp", + "external/sources/boost/wave/cpplexer/cpp_lex_interface_generator.hpp", + "external/sources/boost/wave/cpplexer/cpp_lex_iterator.hpp", + "external/sources/boost/wave/cpplexer/cpp_lex_token.hpp", + "external/sources/boost/wave/cpplexer/cpplexer_exceptions.hpp", + "external/sources/boost/wave/cpplexer/detect_include_guards.hpp", + "external/sources/boost/wave/cpplexer/re2clex/aq.hpp", + "external/sources/boost/wave/cpplexer/re2clex/cpp.re", + "external/sources/boost/wave/cpplexer/re2clex/cpp_re.hpp", + "external/sources/boost/wave/cpplexer/re2clex/cpp_re.inc", + "external/sources/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp", + "external/sources/boost/wave/cpplexer/re2clex/scanner.hpp", + "external/sources/boost/wave/cpplexer/re2clex/strict_cpp.re", + "external/sources/boost/wave/cpplexer/re2clex/strict_cpp_re.inc", + "external/sources/boost/wave/cpplexer/token_cache.hpp", + "external/sources/boost/wave/cpplexer/validate_universal_char.hpp", + "external/sources/boost/wave/grammars/cpp_chlit_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_defined_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_defined_grammar_gen.hpp", + "external/sources/boost/wave/grammars/cpp_expression_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_expression_grammar_gen.hpp", + "external/sources/boost/wave/grammars/cpp_expression_value.hpp", + "external/sources/boost/wave/grammars/cpp_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_grammar_gen.hpp", + "external/sources/boost/wave/grammars/cpp_has_include_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_has_include_grammar_gen.hpp", + "external/sources/boost/wave/grammars/cpp_intlit_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_literal_grammar_gen.hpp", + "external/sources/boost/wave/grammars/cpp_predef_macros_gen.hpp", + "external/sources/boost/wave/grammars/cpp_predef_macros_grammar.hpp", + "external/sources/boost/wave/grammars/cpp_value_error.hpp", + "external/sources/boost/wave/language_support.hpp", + "external/sources/boost/wave/preprocessing_hooks.hpp", + "external/sources/boost/wave/token_ids.hpp", + "external/sources/boost/wave/util/cpp_ifblock.hpp", + "external/sources/boost/wave/util/cpp_include_paths.hpp", + "external/sources/boost/wave/util/cpp_iterator.hpp", + "external/sources/boost/wave/util/cpp_macromap.hpp", + "external/sources/boost/wave/util/cpp_macromap_predef.hpp", + "external/sources/boost/wave/util/cpp_macromap_utils.hpp", + "external/sources/boost/wave/util/file_position.hpp", + "external/sources/boost/wave/util/filesystem_compatibility.hpp", + "external/sources/boost/wave/util/flex_string.hpp", + "external/sources/boost/wave/util/functor_input.hpp", + "external/sources/boost/wave/util/insert_whitespace_detection.hpp", + "external/sources/boost/wave/util/interpret_pragma.hpp", + "external/sources/boost/wave/util/iteration_context.hpp", + "external/sources/boost/wave/util/macro_definition.hpp", + "external/sources/boost/wave/util/macro_helpers.hpp", + "external/sources/boost/wave/util/pattern_parser.hpp", + "external/sources/boost/wave/util/symbol_table.hpp", + "external/sources/boost/wave/util/time_conversion_helper.hpp", + "external/sources/boost/wave/util/transform_iterator.hpp", + "external/sources/boost/wave/util/unput_queue_iterator.hpp", + "external/sources/boost/wave/wave_config.hpp", + "external/sources/boost/wave/wave_config_constant.hpp", + "external/sources/boost/wave/wave_version.hpp", + "external/sources/boost/wave/whitespace_handling.hpp", + "external/sources/boost/weak_ptr.hpp", + "external/sources/boost/winapi/access_rights.hpp", + "external/sources/boost/winapi/apc.hpp", + "external/sources/boost/winapi/basic_types.hpp", + "external/sources/boost/winapi/bcrypt.hpp", + "external/sources/boost/winapi/character_code_conversion.hpp", + "external/sources/boost/winapi/condition_variable.hpp", + "external/sources/boost/winapi/config.hpp", + "external/sources/boost/winapi/critical_section.hpp", + "external/sources/boost/winapi/crypt.hpp", + "external/sources/boost/winapi/dbghelp.hpp", + "external/sources/boost/winapi/debugapi.hpp", + "external/sources/boost/winapi/detail/cast_ptr.hpp", + "external/sources/boost/winapi/detail/footer.hpp", + "external/sources/boost/winapi/detail/header.hpp", + "external/sources/boost/winapi/directory_management.hpp", + "external/sources/boost/winapi/dll.hpp", + "external/sources/boost/winapi/environment.hpp", + "external/sources/boost/winapi/error_codes.hpp", + "external/sources/boost/winapi/error_handling.hpp", + "external/sources/boost/winapi/event.hpp", + "external/sources/boost/winapi/file_management.hpp", + "external/sources/boost/winapi/file_mapping.hpp", + "external/sources/boost/winapi/get_current_process.hpp", + "external/sources/boost/winapi/get_current_process_id.hpp", + "external/sources/boost/winapi/get_current_thread.hpp", + "external/sources/boost/winapi/get_current_thread_id.hpp", + "external/sources/boost/winapi/get_last_error.hpp", + "external/sources/boost/winapi/get_proc_address.hpp", + "external/sources/boost/winapi/get_process_times.hpp", + "external/sources/boost/winapi/get_system_directory.hpp", + "external/sources/boost/winapi/get_thread_times.hpp", + "external/sources/boost/winapi/handle_info.hpp", + "external/sources/boost/winapi/handles.hpp", + "external/sources/boost/winapi/heap_memory.hpp", + "external/sources/boost/winapi/init_once.hpp", + "external/sources/boost/winapi/jobs.hpp", + "external/sources/boost/winapi/limits.hpp", + "external/sources/boost/winapi/local_memory.hpp", + "external/sources/boost/winapi/memory.hpp", + "external/sources/boost/winapi/mutex.hpp", + "external/sources/boost/winapi/overlapped.hpp", + "external/sources/boost/winapi/page_protection_flags.hpp", + "external/sources/boost/winapi/pipes.hpp", + "external/sources/boost/winapi/priority_class.hpp", + "external/sources/boost/winapi/process.hpp", + "external/sources/boost/winapi/security.hpp", + "external/sources/boost/winapi/semaphore.hpp", + "external/sources/boost/winapi/shell.hpp", + "external/sources/boost/winapi/show_window.hpp", + "external/sources/boost/winapi/srw_lock.hpp", + "external/sources/boost/winapi/stack_backtrace.hpp", + "external/sources/boost/winapi/synchronization.hpp", + "external/sources/boost/winapi/system.hpp", + "external/sources/boost/winapi/thread.hpp", + "external/sources/boost/winapi/thread_pool.hpp", + "external/sources/boost/winapi/time.hpp", + "external/sources/boost/winapi/timers.hpp", + "external/sources/boost/winapi/tls.hpp", + "external/sources/boost/winapi/wait.hpp", + "external/sources/boost/winapi/wait_constants.hpp", + "external/sources/boost/winapi/wait_on_address.hpp", + "external/sources/boost/winapi/waitable_timer.hpp", + "external/sources/boost/xpressive/basic_regex.hpp", + "external/sources/boost/xpressive/detail/core/access.hpp", + "external/sources/boost/xpressive/detail/core/action.hpp", + "external/sources/boost/xpressive/detail/core/adaptor.hpp", + "external/sources/boost/xpressive/detail/core/finder.hpp", + "external/sources/boost/xpressive/detail/core/flow_control.hpp", + "external/sources/boost/xpressive/detail/core/icase.hpp", + "external/sources/boost/xpressive/detail/core/linker.hpp", + "external/sources/boost/xpressive/detail/core/list.hpp", + "external/sources/boost/xpressive/detail/core/matcher/action_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/alternate_end_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/alternate_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/any_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/assert_bol_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/assert_bos_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/assert_eol_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/assert_eos_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/assert_line_base.hpp", + "external/sources/boost/xpressive/detail/core/matcher/assert_word_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/attr_begin_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/attr_end_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/attr_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/charset_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/end_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/epsilon_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/keeper_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/literal_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/logical_newline_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/lookahead_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/lookbehind_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/mark_begin_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/mark_end_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/mark_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/optional_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/posix_charset_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/predicate_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/range_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/regex_byref_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/regex_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/repeat_begin_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/repeat_end_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/set_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/string_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matcher/true_matcher.hpp", + "external/sources/boost/xpressive/detail/core/matchers.hpp", + "external/sources/boost/xpressive/detail/core/optimize.hpp", + "external/sources/boost/xpressive/detail/core/peeker.hpp", + "external/sources/boost/xpressive/detail/core/quant_style.hpp", + "external/sources/boost/xpressive/detail/core/regex_domain.hpp", + "external/sources/boost/xpressive/detail/core/regex_impl.hpp", + "external/sources/boost/xpressive/detail/core/results_cache.hpp", + "external/sources/boost/xpressive/detail/core/state.hpp", + "external/sources/boost/xpressive/detail/core/sub_match_impl.hpp", + "external/sources/boost/xpressive/detail/core/sub_match_vector.hpp", + "external/sources/boost/xpressive/detail/detail_fwd.hpp", + "external/sources/boost/xpressive/detail/dynamic/dynamic.hpp", + "external/sources/boost/xpressive/detail/dynamic/matchable.hpp", + "external/sources/boost/xpressive/detail/dynamic/parse_charset.hpp", + "external/sources/boost/xpressive/detail/dynamic/parser.hpp", + "external/sources/boost/xpressive/detail/dynamic/parser_enum.hpp", + "external/sources/boost/xpressive/detail/dynamic/parser_traits.hpp", + "external/sources/boost/xpressive/detail/dynamic/sequence.hpp", + "external/sources/boost/xpressive/detail/static/compile.hpp", + "external/sources/boost/xpressive/detail/static/grammar.hpp", + "external/sources/boost/xpressive/detail/static/is_pure.hpp", + "external/sources/boost/xpressive/detail/static/modifier.hpp", + "external/sources/boost/xpressive/detail/static/placeholders.hpp", + "external/sources/boost/xpressive/detail/static/static.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_action.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_alternate.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_independent.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_inverse.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_marker.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_matcher.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_modifier.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_quantifier.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_sequence.hpp", + "external/sources/boost/xpressive/detail/static/transforms/as_set.hpp", + "external/sources/boost/xpressive/detail/static/transmogrify.hpp", + "external/sources/boost/xpressive/detail/static/type_traits.hpp", + "external/sources/boost/xpressive/detail/static/visitor.hpp", + "external/sources/boost/xpressive/detail/static/width_of.hpp", + "external/sources/boost/xpressive/detail/utility/algorithm.hpp", + "external/sources/boost/xpressive/detail/utility/any.hpp", + "external/sources/boost/xpressive/detail/utility/boyer_moore.hpp", + "external/sources/boost/xpressive/detail/utility/chset/basic_chset.hpp", + "external/sources/boost/xpressive/detail/utility/chset/basic_chset.ipp", + "external/sources/boost/xpressive/detail/utility/chset/chset.hpp", + "external/sources/boost/xpressive/detail/utility/chset/range_run.hpp", + "external/sources/boost/xpressive/detail/utility/chset/range_run.ipp", + "external/sources/boost/xpressive/detail/utility/cons.hpp", + "external/sources/boost/xpressive/detail/utility/counted_base.hpp", + "external/sources/boost/xpressive/detail/utility/dont_care.hpp", + "external/sources/boost/xpressive/detail/utility/hash_peek_bitset.hpp", + "external/sources/boost/xpressive/detail/utility/ignore_unused.hpp", + "external/sources/boost/xpressive/detail/utility/literals.hpp", + "external/sources/boost/xpressive/detail/utility/never_true.hpp", + "external/sources/boost/xpressive/detail/utility/save_restore.hpp", + "external/sources/boost/xpressive/detail/utility/sequence_stack.hpp", + "external/sources/boost/xpressive/detail/utility/symbols.hpp", + "external/sources/boost/xpressive/detail/utility/tracking_ptr.hpp", + "external/sources/boost/xpressive/detail/utility/traits_utils.hpp", + "external/sources/boost/xpressive/detail/utility/width.hpp", + "external/sources/boost/xpressive/match_results.hpp", + "external/sources/boost/xpressive/regex_actions.hpp", + "external/sources/boost/xpressive/regex_algorithms.hpp", + "external/sources/boost/xpressive/regex_compiler.hpp", + "external/sources/boost/xpressive/regex_constants.hpp", + "external/sources/boost/xpressive/regex_error.hpp", + "external/sources/boost/xpressive/regex_iterator.hpp", + "external/sources/boost/xpressive/regex_primitives.hpp", + "external/sources/boost/xpressive/regex_token_iterator.hpp", + "external/sources/boost/xpressive/regex_traits.hpp", + "external/sources/boost/xpressive/sub_match.hpp", + "external/sources/boost/xpressive/traits/c_regex_traits.hpp", + "external/sources/boost/xpressive/traits/cpp_regex_traits.hpp", + "external/sources/boost/xpressive/traits/detail/c_ctype.hpp", + "external/sources/boost/xpressive/traits/null_regex_traits.hpp", + "external/sources/boost/xpressive/xpressive.hpp", + "external/sources/boost/xpressive/xpressive_dynamic.hpp", + "external/sources/boost/xpressive/xpressive_fwd.hpp", + "external/sources/boost/xpressive/xpressive_static.hpp", + "external/sources/boost/xpressive/xpressive_typeof.hpp", + "external/sources/boost/yap/algorithm.hpp", + "external/sources/boost/yap/algorithm_fwd.hpp", + "external/sources/boost/yap/config.hpp", + "external/sources/boost/yap/detail/algorithm.hpp", + "external/sources/boost/yap/detail/transform.hpp", + "external/sources/boost/yap/expression.hpp", + "external/sources/boost/yap/print.hpp", + "external/sources/boost/yap/user_macros.hpp", + "external/sources/boost/yap/yap.hpp", + "external/sources/concurrentqueue/blockingconcurrentqueue.h", + "external/sources/concurrentqueue/concurrentqueue.h", + "external/sources/concurrentqueue/lightweightsemaphore.h", "external/sources/edtaa3func/CMakeLists.txt", "external/sources/edtaa3func/edtaa3func.cpp", "external/sources/edtaa3func/edtaa3func.h", + "external/sources/enoki/array.h", + "external/sources/enoki/array_avx.h", + "external/sources/enoki/array_avx2.h", + "external/sources/enoki/array_avx512.h", + "external/sources/enoki/array_base.h", + "external/sources/enoki/array_call.h", + "external/sources/enoki/array_enum.h", + "external/sources/enoki/array_fallbacks.h", + "external/sources/enoki/array_generic.h", + "external/sources/enoki/array_idiv.h", + "external/sources/enoki/array_intrin.h", + "external/sources/enoki/array_kmask.h", + "external/sources/enoki/array_macro.h", + "external/sources/enoki/array_masked.h", + "external/sources/enoki/array_math.h", + "external/sources/enoki/array_neon.h", + "external/sources/enoki/array_recursive.h", + "external/sources/enoki/array_round.h", + "external/sources/enoki/array_router.h", + "external/sources/enoki/array_sse42.h", + "external/sources/enoki/array_static.h", + "external/sources/enoki/array_struct.h", + "external/sources/enoki/array_traits.h", + "external/sources/enoki/array_utils.h", + "external/sources/enoki/autodiff.h", + "external/sources/enoki/color.h", + "external/sources/enoki/complex.h", + "external/sources/enoki/cuda.h", + "external/sources/enoki/dynamic.h", + "external/sources/enoki/fwd.h", + "external/sources/enoki/half.h", + "external/sources/enoki/matrix.h", + "external/sources/enoki/morton.h", + "external/sources/enoki/python.h", + "external/sources/enoki/quaternion.h", + "external/sources/enoki/random.h", + "external/sources/enoki/sh.h", + "external/sources/enoki/special.h", + "external/sources/enoki/stl.h", + "external/sources/enoki/transform.h", "external/sources/jemalloc/CMakeLists.txt", "external/sources/jemalloc/ChangeLog", "external/sources/jemalloc/include-linux/jemalloc/internal/arena.h", @@ -2483,7 +17863,9 @@ "external/sources/khronos/vulkan/vk_sdk_platform.h", "external/sources/khronos/vulkan/vulkan.h", "external/sources/khronos/vulkan/vulkan_android.h", + "external/sources/khronos/vulkan/vulkan_beta.h", "external/sources/khronos/vulkan/vulkan_core.h", + "external/sources/khronos/vulkan/vulkan_directfb.h", "external/sources/khronos/vulkan/vulkan_fuchsia.h", "external/sources/khronos/vulkan/vulkan_ggp.h", "external/sources/khronos/vulkan/vulkan_ios.h", @@ -2572,6 +17954,227 @@ "external/sources/pvmp3dec/src/s_mp3bits.h", "external/sources/pvmp3dec/src/s_tmp3dec_chan.h", "external/sources/pvmp3dec/src/s_tmp3dec_file.h", + "external/sources/rtm/constants.h", + "external/sources/rtm/impl/compiler_utils.h", + "external/sources/rtm/impl/error.h", + "external/sources/rtm/impl/mask_common.h", + "external/sources/rtm/impl/matrix_affine_common.h", + "external/sources/rtm/impl/matrix_cast.h", + "external/sources/rtm/impl/matrix_common.h", + "external/sources/rtm/impl/memory_utils.h", + "external/sources/rtm/impl/quat_common.h", + "external/sources/rtm/impl/qvv_common.h", + "external/sources/rtm/impl/scalar_common.h", + "external/sources/rtm/impl/type_args.h", + "external/sources/rtm/impl/vector_common.h", + "external/sources/rtm/macros.h", + "external/sources/rtm/mask4d.h", + "external/sources/rtm/mask4f.h", + "external/sources/rtm/mask4i.h", + "external/sources/rtm/mask4q.h", + "external/sources/rtm/math.h", + "external/sources/rtm/matrix3x3d.h", + "external/sources/rtm/matrix3x3f.h", + "external/sources/rtm/matrix3x4d.h", + "external/sources/rtm/matrix3x4f.h", + "external/sources/rtm/matrix4x4d.h", + "external/sources/rtm/matrix4x4f.h", + "external/sources/rtm/packing/quatd.h", + "external/sources/rtm/packing/quatf.h", + "external/sources/rtm/quatd.h", + "external/sources/rtm/quatf.h", + "external/sources/rtm/qvvd.h", + "external/sources/rtm/qvvf.h", + "external/sources/rtm/scalard.h", + "external/sources/rtm/scalarf.h", + "external/sources/rtm/type_traits.h", + "external/sources/rtm/types.h", + "external/sources/rtm/vector4d.h", + "external/sources/rtm/vector4f.h", + "external/sources/taskflow/core/algorithm/critical.hpp", + "external/sources/taskflow/core/algorithm/for_each.hpp", + "external/sources/taskflow/core/algorithm/reduce.hpp", + "external/sources/taskflow/core/algorithm/sort.hpp", + "external/sources/taskflow/core/declarations.hpp", + "external/sources/taskflow/core/error.hpp", + "external/sources/taskflow/core/executor.hpp", + "external/sources/taskflow/core/flow_builder.hpp", + "external/sources/taskflow/core/graph.hpp", + "external/sources/taskflow/core/notifier.hpp", + "external/sources/taskflow/core/observer.hpp", + "external/sources/taskflow/core/semaphore.hpp", + "external/sources/taskflow/core/task.hpp", + "external/sources/taskflow/core/taskflow.hpp", + "external/sources/taskflow/core/topology.hpp", + "external/sources/taskflow/core/tsq.hpp", + "external/sources/taskflow/core/worker.hpp", + "external/sources/taskflow/cublasflow.hpp", + "external/sources/taskflow/cuda/cublas/cublas_error.hpp", + "external/sources/taskflow/cuda/cublas/cublas_flow.hpp", + "external/sources/taskflow/cuda/cublas/cublas_handle.hpp", + "external/sources/taskflow/cuda/cublas/cublas_helper.hpp", + "external/sources/taskflow/cuda/cublas/cublas_level1.hpp", + "external/sources/taskflow/cuda/cublas/cublas_level2.hpp", + "external/sources/taskflow/cuda/cublas/cublas_level3.hpp", + "external/sources/taskflow/cuda/cuda_algorithm/cuda_blaf.hpp", + "external/sources/taskflow/cuda/cuda_algorithm/cuda_for_each.hpp", + "external/sources/taskflow/cuda/cuda_algorithm/cuda_matmul.hpp", + "external/sources/taskflow/cuda/cuda_algorithm/cuda_reduce.hpp", + "external/sources/taskflow/cuda/cuda_algorithm/cuda_transform.hpp", + "external/sources/taskflow/cuda/cuda_algorithm/cuda_transpose.hpp", + "external/sources/taskflow/cuda/cuda_capturer.hpp", + "external/sources/taskflow/cuda/cuda_device.hpp", + "external/sources/taskflow/cuda/cuda_error.hpp", + "external/sources/taskflow/cuda/cuda_flow.hpp", + "external/sources/taskflow/cuda/cuda_graph.hpp", + "external/sources/taskflow/cuda/cuda_memory.hpp", + "external/sources/taskflow/cuda/cuda_pool.hpp", + "external/sources/taskflow/cuda/cuda_stream.hpp", + "external/sources/taskflow/cuda/cuda_task.hpp", + "external/sources/taskflow/cudaflow.hpp", + "external/sources/taskflow/dsl/connection.hpp", + "external/sources/taskflow/dsl/dsl.hpp", + "external/sources/taskflow/dsl/meta_macro.hpp", + "external/sources/taskflow/dsl/task_analyzer.hpp", + "external/sources/taskflow/dsl/task_dsl.hpp", + "external/sources/taskflow/dsl/task_trait.hpp", + "external/sources/taskflow/dsl/tuple_utils.hpp", + "external/sources/taskflow/dsl/type_list.hpp", + "external/sources/taskflow/taskflow.hpp", + "external/sources/taskflow/tensorframe/tensor.hpp", + "external/sources/taskflow/tensorframe/tensor_expr.hpp", + "external/sources/taskflow/tensorframe/tensor_graph.hpp", + "external/sources/taskflow/tensorframe/tensor_ops.hpp", + "external/sources/taskflow/tensorframe/tensorframe.hpp", + "external/sources/taskflow/utility/iterator.hpp", + "external/sources/taskflow/utility/math.hpp", + "external/sources/taskflow/utility/object_pool.hpp", + "external/sources/taskflow/utility/os.hpp", + "external/sources/taskflow/utility/passive_vector.hpp", + "external/sources/taskflow/utility/singleton.hpp", + "external/sources/taskflow/utility/stream.hpp", + "external/sources/taskflow/utility/traits.hpp", + "external/sources/taskflow/utility/uuid.hpp", + "external/sources/tbb/aggregator.h", + "external/sources/tbb/aligned_space.h", + "external/sources/tbb/atomic.h", + "external/sources/tbb/blocked_range.h", + "external/sources/tbb/blocked_range2d.h", + "external/sources/tbb/blocked_range3d.h", + "external/sources/tbb/blocked_rangeNd.h", + "external/sources/tbb/cache_aligned_allocator.h", + "external/sources/tbb/combinable.h", + "external/sources/tbb/compat/condition_variable", + "external/sources/tbb/compat/ppl.h", + "external/sources/tbb/compat/thread", + "external/sources/tbb/compat/tuple", + "external/sources/tbb/concurrent_hash_map.h", + "external/sources/tbb/concurrent_lru_cache.h", + "external/sources/tbb/concurrent_map.h", + "external/sources/tbb/concurrent_priority_queue.h", + "external/sources/tbb/concurrent_queue.h", + "external/sources/tbb/concurrent_set.h", + "external/sources/tbb/concurrent_unordered_map.h", + "external/sources/tbb/concurrent_unordered_set.h", + "external/sources/tbb/concurrent_vector.h", + "external/sources/tbb/critical_section.h", + "external/sources/tbb/enumerable_thread_specific.h", + "external/sources/tbb/flow_graph.h", + "external/sources/tbb/flow_graph_abstractions.h", + "external/sources/tbb/flow_graph_opencl_node.h", + "external/sources/tbb/global_control.h", + "external/sources/tbb/index.html", + "external/sources/tbb/info.h", + "external/sources/tbb/internal/_aggregator_impl.h", + "external/sources/tbb/internal/_allocator_traits.h", + "external/sources/tbb/internal/_concurrent_queue_impl.h", + "external/sources/tbb/internal/_concurrent_skip_list_impl.h", + "external/sources/tbb/internal/_concurrent_unordered_impl.h", + "external/sources/tbb/internal/_deprecated_header_message_guard.h", + "external/sources/tbb/internal/_flow_graph_async_msg_impl.h", + "external/sources/tbb/internal/_flow_graph_body_impl.h", + "external/sources/tbb/internal/_flow_graph_cache_impl.h", + "external/sources/tbb/internal/_flow_graph_impl.h", + "external/sources/tbb/internal/_flow_graph_indexer_impl.h", + "external/sources/tbb/internal/_flow_graph_item_buffer_impl.h", + "external/sources/tbb/internal/_flow_graph_join_impl.h", + "external/sources/tbb/internal/_flow_graph_node_impl.h", + "external/sources/tbb/internal/_flow_graph_node_set_impl.h", + "external/sources/tbb/internal/_flow_graph_nodes_deduction.h", + "external/sources/tbb/internal/_flow_graph_streaming_node.h", + "external/sources/tbb/internal/_flow_graph_tagged_buffer_impl.h", + "external/sources/tbb/internal/_flow_graph_trace_impl.h", + "external/sources/tbb/internal/_flow_graph_types_impl.h", + "external/sources/tbb/internal/_mutex_padding.h", + "external/sources/tbb/internal/_node_handle_impl.h", + "external/sources/tbb/internal/_range_iterator.h", + "external/sources/tbb/internal/_tbb_hash_compare_impl.h", + "external/sources/tbb/internal/_tbb_strings.h", + "external/sources/tbb/internal/_tbb_trace_impl.h", + "external/sources/tbb/internal/_tbb_windef.h", + "external/sources/tbb/internal/_template_helpers.h", + "external/sources/tbb/internal/_warning_suppress_disable_notice.h", + "external/sources/tbb/internal/_warning_suppress_enable_notice.h", + "external/sources/tbb/internal/_x86_eliding_mutex_impl.h", + "external/sources/tbb/internal/_x86_rtm_rw_mutex_impl.h", + "external/sources/tbb/iterators.h", + "external/sources/tbb/machine/gcc_arm.h", + "external/sources/tbb/machine/gcc_generic.h", + "external/sources/tbb/machine/gcc_ia32_common.h", + "external/sources/tbb/machine/gcc_itsx.h", + "external/sources/tbb/machine/ibm_aix51.h", + "external/sources/tbb/machine/icc_generic.h", + "external/sources/tbb/machine/linux_common.h", + "external/sources/tbb/machine/linux_ia32.h", + "external/sources/tbb/machine/linux_ia64.h", + "external/sources/tbb/machine/linux_intel64.h", + "external/sources/tbb/machine/mac_ppc.h", + "external/sources/tbb/machine/macos_common.h", + "external/sources/tbb/machine/mic_common.h", + "external/sources/tbb/machine/msvc_armv7.h", + "external/sources/tbb/machine/msvc_ia32_common.h", + "external/sources/tbb/machine/sunos_sparc.h", + "external/sources/tbb/machine/windows_api.h", + "external/sources/tbb/machine/windows_ia32.h", + "external/sources/tbb/machine/windows_intel64.h", + "external/sources/tbb/memory_pool.h", + "external/sources/tbb/mutex.h", + "external/sources/tbb/null_mutex.h", + "external/sources/tbb/null_rw_mutex.h", + "external/sources/tbb/parallel_do.h", + "external/sources/tbb/parallel_for.h", + "external/sources/tbb/parallel_for_each.h", + "external/sources/tbb/parallel_invoke.h", + "external/sources/tbb/parallel_reduce.h", + "external/sources/tbb/parallel_scan.h", + "external/sources/tbb/parallel_sort.h", + "external/sources/tbb/parallel_while.h", + "external/sources/tbb/partitioner.h", + "external/sources/tbb/pipeline.h", + "external/sources/tbb/queuing_mutex.h", + "external/sources/tbb/queuing_rw_mutex.h", + "external/sources/tbb/reader_writer_lock.h", + "external/sources/tbb/recursive_mutex.h", + "external/sources/tbb/runtime_loader.h", + "external/sources/tbb/scalable_allocator.h", + "external/sources/tbb/spin_mutex.h", + "external/sources/tbb/spin_rw_mutex.h", + "external/sources/tbb/task.h", + "external/sources/tbb/task_arena.h", + "external/sources/tbb/task_group.h", + "external/sources/tbb/task_scheduler_init.h", + "external/sources/tbb/task_scheduler_observer.h", + "external/sources/tbb/tbb.h", + "external/sources/tbb/tbb_allocator.h", + "external/sources/tbb/tbb_config.h", + "external/sources/tbb/tbb_disable_exceptions.h", + "external/sources/tbb/tbb_exception.h", + "external/sources/tbb/tbb_machine.h", + "external/sources/tbb/tbb_profiling.h", + "external/sources/tbb/tbb_stddef.h", + "external/sources/tbb/tbb_thread.h", + "external/sources/tbb/tbbmalloc_proxy.h", + "external/sources/tbb/tick_count.h", "external/sources/tinydir/COPYING", "external/sources/tinydir/package.json", "external/sources/tinydir/tinydir.h", @@ -2864,6 +18467,7 @@ "external/win32/include/glslang/spirv-tools/optimizer.hpp", "external/win32/include/icon/iconv.h", "external/win32/include/jpeg/jconfig.h", + "external/win32/include/jpeg/jerror.h", "external/win32/include/jpeg/jmorecfg.h", "external/win32/include/jpeg/jpeglib.h", "external/win32/include/mpg123/mpg123.h", @@ -2875,36 +18479,52 @@ "external/win32/include/openssl/applink.c", "external/win32/include/openssl/asn1.h", "external/win32/include/openssl/asn1_mac.h", + "external/win32/include/openssl/asn1err.h", "external/win32/include/openssl/asn1t.h", "external/win32/include/openssl/async.h", + "external/win32/include/openssl/asyncerr.h", "external/win32/include/openssl/bio.h", + "external/win32/include/openssl/bioerr.h", "external/win32/include/openssl/blowfish.h", "external/win32/include/openssl/bn.h", + "external/win32/include/openssl/bnerr.h", "external/win32/include/openssl/buffer.h", + "external/win32/include/openssl/buffererr.h", "external/win32/include/openssl/camellia.h", "external/win32/include/openssl/cast.h", "external/win32/include/openssl/cmac.h", "external/win32/include/openssl/cms.h", + "external/win32/include/openssl/cmserr.h", "external/win32/include/openssl/comp.h", + "external/win32/include/openssl/comperr.h", "external/win32/include/openssl/conf.h", "external/win32/include/openssl/conf_api.h", + "external/win32/include/openssl/conferr.h", "external/win32/include/openssl/crypto.h", + "external/win32/include/openssl/cryptoerr.h", "external/win32/include/openssl/ct.h", + "external/win32/include/openssl/cterr.h", "external/win32/include/openssl/des.h", "external/win32/include/openssl/dh.h", + "external/win32/include/openssl/dherr.h", "external/win32/include/openssl/dsa.h", + "external/win32/include/openssl/dsaerr.h", "external/win32/include/openssl/dtls1.h", "external/win32/include/openssl/e_os2.h", "external/win32/include/openssl/ebcdic.h", "external/win32/include/openssl/ec.h", "external/win32/include/openssl/ecdh.h", "external/win32/include/openssl/ecdsa.h", + "external/win32/include/openssl/ecerr.h", "external/win32/include/openssl/engine.h", + "external/win32/include/openssl/engineerr.h", "external/win32/include/openssl/err.h", "external/win32/include/openssl/evp.h", + "external/win32/include/openssl/evperr.h", "external/win32/include/openssl/hmac.h", "external/win32/include/openssl/idea.h", "external/win32/include/openssl/kdf.h", + "external/win32/include/openssl/kdferr.h", "external/win32/include/openssl/lhash.h", "external/win32/include/openssl/md2.h", "external/win32/include/openssl/md4.h", @@ -2913,20 +18533,28 @@ "external/win32/include/openssl/modes.h", "external/win32/include/openssl/obj_mac.h", "external/win32/include/openssl/objects.h", + "external/win32/include/openssl/objectserr.h", "external/win32/include/openssl/ocsp.h", + "external/win32/include/openssl/ocsperr.h", "external/win32/include/openssl/opensslconf.h", "external/win32/include/openssl/opensslv.h", "external/win32/include/openssl/ossl_typ.h", "external/win32/include/openssl/pem.h", "external/win32/include/openssl/pem2.h", + "external/win32/include/openssl/pemerr.h", "external/win32/include/openssl/pkcs12.h", + "external/win32/include/openssl/pkcs12err.h", "external/win32/include/openssl/pkcs7.h", + "external/win32/include/openssl/pkcs7err.h", "external/win32/include/openssl/rand.h", + "external/win32/include/openssl/rand_drbg.h", + "external/win32/include/openssl/randerr.h", "external/win32/include/openssl/rc2.h", "external/win32/include/openssl/rc4.h", "external/win32/include/openssl/rc5.h", "external/win32/include/openssl/ripemd.h", "external/win32/include/openssl/rsa.h", + "external/win32/include/openssl/rsaerr.h", "external/win32/include/openssl/safestack.h", "external/win32/include/openssl/seed.h", "external/win32/include/openssl/sha.h", @@ -2935,16 +18563,23 @@ "external/win32/include/openssl/ssl.h", "external/win32/include/openssl/ssl2.h", "external/win32/include/openssl/ssl3.h", + "external/win32/include/openssl/sslerr.h", "external/win32/include/openssl/stack.h", + "external/win32/include/openssl/store.h", + "external/win32/include/openssl/storeerr.h", "external/win32/include/openssl/symhacks.h", "external/win32/include/openssl/tls1.h", "external/win32/include/openssl/ts.h", + "external/win32/include/openssl/tserr.h", "external/win32/include/openssl/txt_db.h", "external/win32/include/openssl/ui.h", + "external/win32/include/openssl/uierr.h", "external/win32/include/openssl/whrlpool.h", "external/win32/include/openssl/x509.h", "external/win32/include/openssl/x509_vfy.h", + "external/win32/include/openssl/x509err.h", "external/win32/include/openssl/x509v3.h", + "external/win32/include/openssl/x509v3err.h", "external/win32/include/png/png.h", "external/win32/include/png/pngconf.h", "external/win32/include/png/pnglibconf.h", @@ -3140,6 +18775,8 @@ "external/win32/libs/SDL2.dll", "external/win32/libs/SDL2.lib", "external/win32/libs/SDL2main.lib", + "external/win32/libs/dbgcore.dll", + "external/win32/libs/dbgeng.dll", "external/win32/libs/dbghelp.dll", "external/win32/libs/freetype.lib", "external/win32/libs/glew32.dll", @@ -3162,24 +18799,20 @@ "external/win32/libs/icuuc.dll", "external/win32/libs/icuuc.dll.lib", "external/win32/libs/libEGL.dll", - "external/win32/libs/libEGL.lib", "external/win32/libs/libGLES_CM.dll", - "external/win32/libs/libGLES_CM.lib", "external/win32/libs/libGLESv2.dll", - "external/win32/libs/libGLESv2.lib", "external/win32/libs/libcrypto-1_1.dll", "external/win32/libs/libcrypto.lib", "external/win32/libs/libcurl.dll", "external/win32/libs/libcurl.lib", "external/win32/libs/libiconv.lib", - "external/win32/libs/libjpeg-2015.lib", "external/win32/libs/libjpeg.lib", "external/win32/libs/libmpg123.dll", "external/win32/libs/libmpg123.lib", "external/win32/libs/libogg.dll", "external/win32/libs/libogg.lib", - "external/win32/libs/libpng-2015.lib", - "external/win32/libs/libpng.lib", + "external/win32/libs/libpng16.dll", + "external/win32/libs/libpng16.lib", "external/win32/libs/libssl-1_1.dll", "external/win32/libs/libssl.lib", "external/win32/libs/libuv.lib", @@ -3192,6 +18825,12 @@ "external/win32/libs/nspr4.dll", "external/win32/libs/sqlite3.dll", "external/win32/libs/sqlite3.lib", + "external/win32/libs/tbb/tbb_static.lib", + "external/win32/libs/tbb/tbb_static_debug.lib", + "external/win32/libs/tbb/tbbmalloc_proxy_static.lib", + "external/win32/libs/tbb/tbbmalloc_proxy_static_debug.lib", + "external/win32/libs/tbb/tbbmalloc_static.lib", + "external/win32/libs/tbb/tbbmalloc_static_debug.lib", "external/win32/libs/uv.dll", "external/win32/libs/v8.dll", "external/win32/libs/v8.dll.lib", @@ -3202,9 +18841,23 @@ "external/win32/libs/websockets.dll", "external/win32/libs/websockets.lib", "external/win32/libs/zlib.dll", - "external/win32/libs/zlib.dll.lib", "external/win32/libs/zlib1.dll", - "package-lock.json" + "package-lock.json", + "unit-test/CMakeLists.txt", + "unit-test/CMakeLists.txt.in", + "unit-test/README", + "unit-test/src/CMakeLists.txt", + "unit-test/src/main.cpp", + "unit-test/src/math_geometry_test.cpp", + "unit-test/src/math_mat3_test.cpp", + "unit-test/src/math_mat4_test.cpp", + "unit-test/src/math_quaternion_test.cpp", + "unit-test/src/math_utils_test.cpp", + "unit-test/src/math_vec2_test.cpp", + "unit-test/src/math_vec3_test.cpp", + "unit-test/src/math_vec4_test.cpp", + "unit-test/src/math_vertex_test.cpp", + "unit-test/src/utils.h" ], "js": [ "cocos/bindings/auto/jsb_audio_auto.cpp", @@ -3219,22 +18872,16 @@ "cocos/bindings/auto/jsb_extension_auto.h", "cocos/bindings/auto/jsb_gfx_auto.cpp", "cocos/bindings/auto/jsb_gfx_auto.h", - "cocos/bindings/auto/jsb_gles2_auto.cpp", - "cocos/bindings/auto/jsb_gles2_auto.h", - "cocos/bindings/auto/jsb_gles3_auto.cpp", - "cocos/bindings/auto/jsb_gles3_auto.h", - "cocos/bindings/auto/jsb_mtl_auto.cpp", - "cocos/bindings/auto/jsb_mtl_auto.h", "cocos/bindings/auto/jsb_network_auto.cpp", "cocos/bindings/auto/jsb_network_auto.h", + "cocos/bindings/auto/jsb_physics_auto.cpp", + "cocos/bindings/auto/jsb_physics_auto.h", "cocos/bindings/auto/jsb_pipeline_auto.cpp", "cocos/bindings/auto/jsb_pipeline_auto.h", "cocos/bindings/auto/jsb_spine_auto.cpp", "cocos/bindings/auto/jsb_spine_auto.h", "cocos/bindings/auto/jsb_video_auto.cpp", "cocos/bindings/auto/jsb_video_auto.h", - "cocos/bindings/auto/jsb_vk_auto.cpp", - "cocos/bindings/auto/jsb_vk_auto.h", "cocos/bindings/auto/jsb_webview_auto.cpp", "cocos/bindings/auto/jsb_webview_auto.h", "cocos/bindings/docs/JSB2.0-Architecture.png", @@ -3371,6 +19018,8 @@ "cocos/bindings/manual/jsb_gfx_manual.h", "cocos/bindings/manual/jsb_global.cpp", "cocos/bindings/manual/jsb_global.h", + "cocos/bindings/manual/jsb_global_init.cpp", + "cocos/bindings/manual/jsb_global_init.h", "cocos/bindings/manual/jsb_helper.cpp", "cocos/bindings/manual/jsb_helper.h", "cocos/bindings/manual/jsb_module_register.cpp", diff --git a/native/templates/common/CMakeLists.txt b/native/templates/common/CMakeLists.txt index 9fc5adac60..e26c1aceba 100755 --- a/native/templates/common/CMakeLists.txt +++ b/native/templates/common/CMakeLists.txt @@ -5,8 +5,8 @@ set(DEVELOPMENT_TEAM "" CACHE STRING "APPLE Developtment Team") set(RES_DIR "" CACHE STRING "Resource path") set(COCOS_X_PATH "" CACHE STRING "Path to cocos2d-x-lite/") -set(TARGET_OSX_VERSION "10.10" CACHE STRING "Target MacOSX version") -set(TARGET_IOS_VERSION "10.0" CACHE STRING "Target iOS version" ) +set(TARGET_OSX_VERSION "10.14" CACHE STRING "Target MacOSX version" FORCE) +set(TARGET_IOS_VERSION "12.0" CACHE STRING "Target iOS version" FORCE) set(CMAKE_CXX_STANDARD 14) option(USE_SE_V8 "USE V8 JavaScript Engine" ON) @@ -21,6 +21,7 @@ option(USE_MIDDLEWARE "Enable Middleware" ON) option(USE_DRAGONBONES "Enable Dragonbones" ON) option(USE_SPINE "Enable Spine" ON) option(USE_WEBSOCKET_SERVER "Enable WebSocket Server" OFF) +option(USE_PHYSICS_PHYSX "USE PhysX Physics" ON) if(NOT RES_DIR) message(FATAL_ERROR "RES_DIR is not set!") @@ -58,4 +59,4 @@ macro(include_resources ARG_RES_ROOT) list(APPEND ASSET_FILES ${res_abs}) endforeach() endforeach() -endmacro() \ No newline at end of file +endmacro() diff --git a/native/templates/win32/AppDelegate.h b/native/templates/win32/AppDelegate.h index 247ec0e8a9..d4e4218964 100644 --- a/native/templates/win32/AppDelegate.h +++ b/native/templates/win32/AppDelegate.h @@ -15,8 +15,8 @@ public: void start(); private: - std::shared_ptr _game; std::shared_ptr _view; - + std::shared_ptr _game; + bool _quit = false; -}; \ No newline at end of file +}; diff --git a/native/tools/bindings-generator/generator.py b/native/tools/bindings-generator/generator.py index ffcfaedc59..3f3dff2710 100755 --- a/native/tools/bindings-generator/generator.py +++ b/native/tools/bindings-generator/generator.py @@ -547,7 +547,7 @@ class NativeType(object): if re.search("(short|int|double|float|long|ssize_t)$", nt.name) is not None: nt.is_numeric = True - nt.kind = ntype.kind + nt.kind = ntype.kind return nt @staticmethod @@ -938,7 +938,7 @@ class NativeOverloadedFunction(object): config = gen.config static = self.implementations[0].static # loggger.info("NativeOverloadedFunction: " + current_class.namespaced_class_name + ':' + self.func_name + ", is_constructor:" + str(self.is_constructor) + ", is_ctor:" + str(self.is_ctor)) - + if not is_ctor: tpl = Template(file=os.path.join(gen.target, "templates", "function.h"), searchList=[current_class, self]) @@ -1031,8 +1031,8 @@ class NativeClass(object): if item["getter"] is None and item["setter"] is None: #logger.info("gettter %s, setter %s" % (field["getter"], field["setter"])) raise Exception("getter_setter for %s.%s both None" %(self.class_name, field_name)) - if item["getter"] is not None: - self.getter_list.append(item["getter"].func_name) + if item["getter"] is not None: + self.getter_list.append(item["getter"].func_name) if item["setter"] is not None: self.setter_list.append(item["setter"].func_name) self.getter_setter.append(item) @@ -1055,7 +1055,7 @@ class NativeClass(object): return method_name["name"] in self.generator.shadowed_methods_by_getter_setter[self.class_name] return False - def find_method(self, method_name): + def find_method(self, method_name): for m in self.methods : if self.methods[m].signature_name == method_name : return self.methods[m] @@ -1341,7 +1341,7 @@ class NativeEnum(object): field["name"] = node.displayname field["value"] = node.enum_value self.fields.append(field) - + def generate_code(self): ''' @@ -1474,19 +1474,19 @@ class Generator(object): for replace in list_of_replace_headers: header, replaced_header = replace.split("::") self.replace_headers[header] = replaced_header - + if "getter_setter" in opts : #logger.info(" getter_setter : %s" % opts["getter_setter"]) list_of_getter_setter = re.split(",\n?", opts['getter_setter']) for line in list_of_getter_setter: #logger.info(" line %s" % line) - if len(line) == 0: + if len(line) == 0: continue gs_kls, gs_fields_txt = line.split("::") gs_obj = self.getter_setter[gs_kls] = {} gs_sd = self.shadowed_methods_by_getter_setter[gs_kls] = [] match = re.match("\[([^]]+)\]",gs_fields_txt) - if match: + if match: list_of_fields = match.group(1).split(" ") for field in list_of_fields: field_component = field.split("/") @@ -1516,7 +1516,7 @@ class Generator(object): for fn in rename_map: if method_name == rename_map[fn]: return True - return False + return False def should_rename_function(self, class_name, method_name): if self.rename_functions.has_key(class_name) and self.rename_functions[class_name].has_key(method_name): @@ -1662,6 +1662,17 @@ class Generator(object): implfilepath = os.path.join(self.outdir, self.out_file + ".cpp") headfilepath = os.path.join(self.outdir, self.out_file + ".h") + headLicense = '' + implLicense = '' + + licensePattern = re.compile('\/\*{5,}.*?\*{5,}\/\s*', re.S) + with open(implfilepath) as implReader: + implMatch = licensePattern.search(implReader.read()) + if implMatch: implLicense = implMatch.group() + with open(headfilepath) as headReader: + headMatch = licensePattern.search(headReader.read()) + if headMatch: headLicense = headMatch.group() + self.impl_file = open(implfilepath, "wb+") self.head_file = open(headfilepath, "wb+") @@ -1669,8 +1680,8 @@ class Generator(object): searchList=[self]) layout_c = Template(file=os.path.join(self.target, "templates", "layout_head.c"), searchList=[self]) - self.head_file.write(str(layout_h)) - self.impl_file.write(str(layout_c)) + self.head_file.write(headLicense + str(layout_h)) + self.impl_file.write(implLicense + str(layout_c)) self._parse_headers() @@ -1873,6 +1884,7 @@ class Generator(object): return "func" else: return namespace_class_name + def main(): from optparse import OptionParser @@ -1954,7 +1966,7 @@ def main(): 'prefix': config.get(s, 'prefix'), 'headers': (config.get(s, 'headers' , 0, dict(userconfig.items('DEFAULT')))), 'replace_headers': config.get(s, 'replace_headers') if config.has_option(s, 'replace_headers') else None, - 'classes': config.get(s, 'classes').split(' '), + 'classes': re.split('[\s,]+', re.sub('[#;].*', '', config.get(s, 'classes'))), 'classes_need_extend': config.get(s, 'classes_need_extend').split(' ') if config.has_option(s, 'classes_need_extend') else [], 'clang_args': (config.get(s, 'extra_arguments', 0, dict(userconfig.items('DEFAULT'))) or "").split(" "), 'target': os.path.join(workingdir, "targets", t), diff --git a/native/tools/bindings-generator/targets/spidermonkey/templates/register.c b/native/tools/bindings-generator/targets/spidermonkey/templates/register.c index 456c1ed653..751b9f4f8b 100644 --- a/native/tools/bindings-generator/targets/spidermonkey/templates/register.c +++ b/native/tools/bindings-generator/targets/spidermonkey/templates/register.c @@ -3,13 +3,13 @@ #set methods = $current_class.methods_clean() #set st_methods = $current_class.static_methods_clean() #set public_fields = $current_class.public_fields -#if $current_class.methods.has_key('constructor') +#if $current_class.is_struct +#set has_constructor = True +${current_class.generate_struct_constructor()} +#elif $current_class.methods.has_key('constructor') #set has_constructor = True #set constructor = $current_class.methods.constructor ${current_class.methods.constructor.generate_code($current_class)} -#elif $current_class.is_struct -#set has_constructor = True -${current_class.generate_struct_constructor()} #end if #if $generator.in_listed_extend_classed($current_class.class_name) and $has_constructor @@ -136,4 +136,3 @@ bool js_register_${generator.prefix}_${current_class.class_name}(se::Object* obj se::ScriptEngine::getInstance()->clearException(); return true; } - diff --git a/native/tools/gfx-define-generator/.gitignore b/native/tools/gfx-define-generator/.gitignore new file mode 100644 index 0000000000..80ca3016ad --- /dev/null +++ b/native/tools/gfx-define-generator/.gitignore @@ -0,0 +1,3 @@ +define.ts +engine_root_cache.txt +node_modules diff --git a/native/tools/gfx-define-generator/generate.js b/native/tools/gfx-define-generator/generate.js new file mode 100644 index 0000000000..8706bfc549 --- /dev/null +++ b/native/tools/gfx-define-generator/generate.js @@ -0,0 +1,280 @@ +const ps = require('path'); +const fs = require('fs'); +const yaml = require('js-yaml'); + +const options = { + engineRoot: '', + clear: false, + nonVerbatimCopy: false, + debug: false, +}; +const argc = process.argv.length; +for (let i = 2; i < argc; i++) { + const arg = process.argv[i]; + if (arg === '--engine' && i < argc - 1) { + options.engineRoot = ps.resolve(process.argv[++i]); + } else if (arg === '--default-engine') { + options.engineRoot = 'default'; + } else if (arg === '--clear') { + options.clear = true; + } else if (arg === '--non-verbatim-copy') { + options.nonVerbatimCopy = true; + } else if (arg === '--debug') { + options.debug = true; + } +} + +const defaultEngineRoot = ps.join(__dirname, '../../../engine'); +const cacheFile = ps.join(__dirname, 'engine_root_cache.txt'); +if (options.engineRoot) { + if (options.engineRoot === 'default') options.engineRoot = defaultEngineRoot; + if (fs.existsSync(options.engineRoot)) fs.writeFileSync(cacheFile, options.engineRoot); +} else { + if (fs.existsSync(cacheFile)) options.engineRoot = fs.readFileSync(cacheFile); + if (!options.engineRoot) options.engineRoot = defaultEngineRoot; +} + +// TODO: remove this after state info refactor +const ignoreList = { PipelineStateInfo: true, BlendTarget: true, BlendState: true, DepthStencilState: true, RasterizerState: true }; + +let header = fs.readFileSync(ps.join(__dirname, '/../../cocos/renderer/gfx-base/GFXDef-common.h')).toString(); +header = header.replace(/\r\n/g, '\n'); + +const enumRE = /enum\s+class\s+(\w+).*?{\s*?\n(.+?)};/gs; +const enumValueRE = /(\w+).*?(?:=\s*(.*?))?,/g; +const enumMap = {}; +let enumCap = enumRE.exec(header); +while (enumCap) { + const e = enumMap[enumCap[1]] = {}; + e.keys = {}; + + if (options.nonVerbatimCopy) { + let values = enumCap[2].replace(/\s*\/\/.*$/gm, ''); + let valueCap = enumValueRE.exec(values); + let val = -1; + while (valueCap) { + if (valueCap[2]) { + val = Number.parseInt(valueCap[2]); + if (Number.isNaN(val)) val = valueCap[2]; + else val = `0x${val.toString(16)}`; + e.customKey = true; + } else { + val++; + } + e.keys[valueCap[1]] = val; + + valueCap = enumValueRE.exec(values); + } + } else { + e.fullContent = enumCap[2]; + } + + enumCap = enumRE.exec(header); +} + +// now discard all block comments +header = header.replace(/\/\*.*?\*\//gs, ''); +header = header.replace(/\s*[*&](.)/g, (_, c) => (c === '>' ? '' : ' ') + c); +header = header.replace(/(?:\w*::)?vector<(.+?)>/g, '$1[]'); + +const typedefRE = /using\s+(.+?)\s*=\s*(.+?);/gs; +const typedefMap = { lists: {}, others: [] }; +let typedefCap = typedefRE.exec(header); +while (typedefCap) { + const alias = typedefCap[1]; + const source = typedefCap[2]; + if (source.endsWith('[]')) { + typedefMap.lists[alias] = source; + } else { + typedefMap.others.push({ alias, source }); + } + typedefCap = typedefRE.exec(header); +} + +const getMemberList = (() => { + const getMatchingPair = (string, startIdx, begSymbol, endSymbol) => { + if (string[startIdx] !== begSymbol) return startIdx; + let depth = 1; + let i = startIdx + 1; + for (; i < string.length; i++) { + if (string[i] === begSymbol) depth++; + if (string[i] === endSymbol) depth--; + if (depth === 0) break; + } + return i; + }; + return (string, startIdx) => { + let begIdx = startIdx; + let endIdx = string.length; + let scopeReady = false; + for (let i = startIdx; i < endIdx; ++i) { + if (string[i] === '/' && string[i+1] === '/') { // skip comments + i = string.indexOf('\n', i); + } else if (!scopeReady && string[i] === '{') { + begIdx = i + 1; + endIdx = getMatchingPair(string, i, '{', '}') - 1; + scopeReady = true; + } else if (string[i] === '(') { // end with any function declarations // TODO: fragile dependency on parenthesis + endIdx = i; + } + } + return string.slice(begIdx, endIdx); + }; +})(); + +const structRE = /struct\s+(\w+).*?{\s*(.+?)\s*};/gs; +const structMemberRE = /^\s*(const\w*\s*)?([\w\[\]]+)\s+?(\w+)(?:\s*=?\s*(.*?))?;(?:\s*\/\/\s*@ts-(.*?)$)?/gm; +const structMap = {}; +let structCap = structRE.exec(header); +while (structCap) { + const struct = structMap[structCap[1]] = {}; + struct.member = {}; + // structRE can not reliably extract the corrent member declaration range + const memberList = getMemberList(header, structCap.index); + + let memberCap = structMemberRE.exec(memberList); + while (memberCap) { + + let type = memberCap[2]; + let readonly = false; + if (typedefMap.lists[type]) { + type = typedefMap.lists[type]; + } else { + type = type.replace(/(\b)(?:uintptr_t|uint|int|float)(\b)/, '$1number$1'); + type = type.replace(/(\b)(?:bool)(\b)/, '$1boolean$2'); + type = type.replace(/(\b)(?:String)(\b)/, '$1string$2'); + } + if (memberCap[1]) readonly = true; + const isArray = type.endsWith('[]'); + const decayedType = isArray ? type.slice(0, -2) : type; + + let value = memberCap[4]; + let n = Number.parseInt(value); + if (!Number.isNaN(n)) { + if (!value.startsWith('0x')) value = n; // keep hexadecimal numbers + } else if (value) { + value = value.replace(/GFX_MAX_ATTACHMENTS/, '4'); + value = value.replace(/GFX_INVALID_BINDING/, '-1'); + value = value.replace(/nullptr/, 'null!'); + value = value.replace('::', '.'); + value = value.replace(/{(.*?)}/, (_, value) => { + const count = Number.parseInt(value); + if (Number.isNaN(count)) return `[${value}]`; + const ctorStr = `new ${type.slice(0, -2)}(), `; + return `[${ctorStr.repeat(count).slice(0, -2)}]`; + }); + } else { + if (isArray) value = '[]'; + else if (type === 'string') value = '\'\''; + else value = `new ${type}()`; + } + + const info = struct.member[memberCap[3]] = { + // all the overridable values + readonly, type, value, isArray, decayedType + }; + + const directives = memberCap[5]; + if (directives) { + if (directives.startsWith('nullable')) { + info.type += ' | null'; + info.value = 'null'; + } else if (directives.startsWith('overrides')) { + let overrides = {}; + try { overrides = yaml.load(memberCap[5].slice(9)); } + catch (e) { console.warn(e); } + Object.assign(info, overrides); + } + } + + memberCap = structMemberRE.exec(memberList); + } + + structCap = structRE.exec(header); +} + + +let output = ''; + +for (const name of Object.keys(enumMap)) { + const e = enumMap[name]; + output += `export enum ${name} {\n`; + + if (options.nonVerbatimCopy) { + for (const key in e.keys) { + if (e.customKey) { + output += ` ${key} = ${e.keys[key]},\n`; + } else { + output += ` ${key},\n`; + } + } + } else { + output += e.fullContent; + } + + output += `}\n\n`; +} + +for (const typedef of typedefMap.others) { + output += `export type ${typedef.alias} = ${typedef.source};\n`; +} +output += `\n`; + +for (const name of Object.keys(structMap)) { + if (name in ignoreList) continue; + + output += `export class ${name} {\n declare private _token: never; `; + output += `// to make sure all usages must be an instance of this exact class, not assembled from plain object`; + output += `\n\n constructor (\n`; + + const struct = structMap[name]; + for (const key in struct.member) { + const { readonly, type, value } = struct.member[key]; + const decl = readonly ? `readonly ${key}` : key; + if (value || value === 0) { + output += ` public ${decl}: ${type} = ${value},\n`; + } else { + output += ` public ${decl}: ${type},\n`; + } + } + + output += ` ) {}\n`; + + if (!Object.keys(struct.member).some((k) => struct.member[k].readonly)) { + output += `\n public copy (info: ${name}) {\n`; + for (const key in struct.member) { + const { decayedType, isArray } = struct.member[key]; + if (isArray) { + if (structMap[decayedType]) { // nested object + output += ` deepCopy(this.${key}, info.${key}, ${decayedType});\n` + } else { + output += ` this.${key} = info.${key}.slice();\n`; + } + } else if (structMap[decayedType]) { // nested object + output += ` this.${key}.copy(info.${key});\n`; + } else { + output += ` this.${key} = info.${key};\n`; + } + } + output += ` return this;\n`; + output += ` }\n`; + } + + output += `}\n\n`; +} + +if (options.clear) output = ''; + +const outputFile = options.debug ? `${__dirname}/define.ts` : ps.join(options.engineRoot, 'cocos/core/gfx/base/define.ts'); +let source = fs.readFileSync(outputFile).toString(); + +const begGuardRE = /![A-Z ]+!\s*=+\s*\*\//; +const begGuardCap = source.match(begGuardRE); +const begIdx = begGuardCap ? begGuardCap.index + begGuardCap[0].length : undefined; + +const endGuardRE = /\/\*\*\s*\*\s*=+\s*![A-Z ]+!/g; +let endGuardCap = endGuardRE.exec(source); +if (endGuardCap) endGuardCap = endGuardRE.exec(source); +const endIdx = endGuardCap ? endGuardCap.index : undefined; + +fs.writeFileSync(outputFile, `${source.slice(0, begIdx)}\n\n${output}${source.slice(endIdx)}`); diff --git a/native/tools/gfx-define-generator/package-lock.json b/native/tools/gfx-define-generator/package-lock.json new file mode 100644 index 0000000000..4dc83b33ae --- /dev/null +++ b/native/tools/gfx-define-generator/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "gfx-define-generator", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "requires": { + "argparse": "^2.0.1" + } + } + } +} diff --git a/native/tools/gfx-define-generator/package.json b/native/tools/gfx-define-generator/package.json new file mode 100644 index 0000000000..0345b9eef7 --- /dev/null +++ b/native/tools/gfx-define-generator/package.json @@ -0,0 +1,14 @@ +{ + "name": "gfx-define-generator", + "version": "1.0.0", + "description": "GFX layer definition generator", + "main": "generate.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "YunHsiao", + "license": "MIT", + "dependencies": { + "js-yaml": "^4.0.0" + } +} diff --git a/native/tools/gles-wrangler-generator/.gitignore b/native/tools/gles-wrangler-generator/.gitignore new file mode 100644 index 0000000000..d59fbc8996 --- /dev/null +++ b/native/tools/gles-wrangler-generator/.gitignore @@ -0,0 +1,3 @@ +node_modules +specs +output diff --git a/native/tools/gles-wrangler-generator/generate.js b/native/tools/gles-wrangler-generator/generate.js new file mode 100644 index 0000000000..fe7fd1aeec --- /dev/null +++ b/native/tools/gles-wrangler-generator/generate.js @@ -0,0 +1,140 @@ +const fs = require('fs'); +const parser = require('fast-xml-parser'); +const axios = require('axios'); + +const eglRegistry = { local: `${__dirname}/specs/egl.xml`, remote: 'https://www.khronos.org/registry/EGL/api/egl.xml' }; +const glRegistry = { local: `${__dirname}/specs/gl.xml`, remote: 'https://www.khronos.org/registry/OpenGL/xml/gl.xml' }; + +const downloadSpec = async (specInfo) => { + if (fs.existsSync(specInfo.local)) return; + fs.writeFileSync(specInfo.local, (await axios.get(specInfo.remote)).data); +} + +const options = { + clear: false, +}; +const argc = process.argv.length; +for (let i = 2; i < argc; i++) { + const arg = process.argv[i]; + if (arg === '--clear') { + options.clear = true; + } +} + +(async () => { + if (!fs.existsSync('specs')) fs.mkdirSync('specs'); + await downloadSpec(eglRegistry); + await downloadSpec(glRegistry); + const parseOpt = { + attributeNamePrefix : '', + ignoreAttributes : false, + ignoreNameSpace : false, + allowBooleanAttributes : true, + parseNodeValue : true, + parseAttributeValue : true, + trimValues: true, + parseTrueNumberOnly: false, + arrayMode: true, + }; + + const glSpec = parser.parse(fs.readFileSync(glRegistry.local).toString(), parseOpt).registry[0]; + const eglSpec = parser.parse(fs.readFileSync(eglRegistry.local).toString(), parseOpt).registry[0]; + + const generate = (spec, featureNames, moduleName, bootstraps = [], noExtension = false) => { + const nameRecord = new Set(); + let headerDecl = ''; + let sourceDef = ''; + let sourceLoad = ''; + const writeCommand = (name) => { + headerDecl += `extern PFN${name.toUpperCase()}PROC ${name};\n`; + sourceDef += `PFN${name.toUpperCase()}PROC ${name};\n`; + sourceLoad += ` ${name} = (PFN${name.toUpperCase()}PROC)${moduleName}Load("${name}");\n`; + nameRecord.add(name); + }; + const append = (content) => { + headerDecl += content; + sourceDef += content; + sourceLoad += content; + }; + for (const bootstrap of bootstraps) { + writeCommand(bootstrap); + append(`\n`); + } + for (const featureName of featureNames) { + sourceLoad += ` `; + append(`/* ${featureName} */\n`); + const feature = spec.feature.find((f) => f.name === featureName); + for (const manifest of feature.require) { + if (!manifest.command) continue; + for (const command of manifest.command) { + if (nameRecord.has(command.name)) continue; + writeCommand(command.name); + } + append(`\n`); + } + append(`\n`); + } + if (!noExtension) { + const featureAPI = spec.feature.find((f) => f.name === featureNames[0]).api; + for (const extension of spec.extensions[0].extension) { + if (!extension.supported.includes(featureAPI) || !extension.require) continue; + let needDeclare = false; + for (const require of extension.require) { + if (require.api && !require.api.includes(featureAPI) || + !require.command || !require.command.length || + require.command.every((cmd) => nameRecord.has(cmd.name))) continue; + if (!needDeclare) { + append(`#if defined(${extension.name})\n`); + needDeclare = true; + } else { + append(`\n`); + } + for (const command of require.command) { + if (nameRecord.has(command.name)) continue; + writeCommand(command.name); + } + } + if (needDeclare) { + append(`#endif /* defined(${extension.name}) */\n\n`); + } + } + } + return { headerDecl, sourceDef, sourceLoad }; + } + + const eglSrc = generate(eglSpec, ['EGL_VERSION_1_0', 'EGL_VERSION_1_1', 'EGL_VERSION_1_2', 'EGL_VERSION_1_3', 'EGL_VERSION_1_4', 'EGL_VERSION_1_5'], 'eglw', ['eglGetProcAddress']); + const es2Src = generate(glSpec, ['GL_ES_VERSION_2_0'], 'gles2w'); + const es3Src = generate(glSpec, ['GL_ES_VERSION_3_0', 'GL_ES_VERSION_3_1', 'GL_ES_VERSION_3_2'], 'gles3w', [], true); + + const updateBlock = (source, moduleName, keyword, content, indentEnd) => { + const flag = `/\\* ${moduleName.toUpperCase()}_GENERATE_${keyword} \\*/\n`; + const flagRE = new RegExp(flag, 'g'); + const indices = []; + while (flagRE.exec(source)) indices.push(flagRE.lastIndex); + if (indices.length !== 2) return source; + indices[1] -= flag.length - 2; // two escape characters + if (options.clear) content = ''; + if (indentEnd) content += ' '; + return source.slice(0, indices[0]) + content + source.slice(indices[1]); + }; + + const update = (path, moduleName, generatedSrc) => { + let header = fs.readFileSync(`${path}.h`); + let source = fs.readFileSync(`${path}.cpp`); + + header = updateBlock(header, moduleName, 'EGL_DECLARATION', eglSrc.headerDecl); + header = updateBlock(header, moduleName, 'GLES_DECLARATION', generatedSrc.headerDecl); + + source = updateBlock(source, moduleName, 'EGL_DEFINITION', eglSrc.sourceDef); + source = updateBlock(source, moduleName, 'GLES_DEFINITION', generatedSrc.sourceDef); + source = updateBlock(source, moduleName, 'EGL_LOAD', eglSrc.sourceLoad.replace(/eglwLoad/g, `${moduleName}Load`), true); + source = updateBlock(source, moduleName, 'GLES_LOAD', generatedSrc.sourceLoad, true); + + fs.writeFileSync(`${path}.h`, header); + fs.writeFileSync(`${path}.cpp`, source); + }; + + update(`${__dirname}/../../cocos/renderer/gfx-gles-common/eglw`, 'eglw', eglSrc); + update(`${__dirname}/../../cocos/renderer/gfx-gles-common/gles2w`, 'gles2w', es2Src); + update(`${__dirname}/../../cocos/renderer/gfx-gles-common/gles3w`, 'gles3w', es3Src); +})(); diff --git a/native/tools/gles-wrangler-generator/package-lock.json b/native/tools/gles-wrangler-generator/package-lock.json new file mode 100644 index 0000000000..03d5514fcc --- /dev/null +++ b/native/tools/gles-wrangler-generator/package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "gles-wrangler-generator", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, + "fast-xml-parser": { + "version": "3.17.6", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.17.6.tgz", + "integrity": "sha512-40WHI/5d2MOzf1sD2bSaTXlPn1lueJLAX6j1xH5dSAr6tNeut8B9ktEL6sjAK9yVON4uNj9//axOdBJUuruCzw==" + }, + "follow-redirects": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", + "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" + } + } +} diff --git a/native/tools/gles-wrangler-generator/package.json b/native/tools/gles-wrangler-generator/package.json new file mode 100644 index 0000000000..9827990fd5 --- /dev/null +++ b/native/tools/gles-wrangler-generator/package.json @@ -0,0 +1,15 @@ +{ + "name": "gles-wrangler-generator", + "version": "1.0.0", + "description": "EGL/GLES loader code generator", + "main": "generate.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "YunHsiao", + "license": "MIT", + "dependencies": { + "axios": "^0.21.1", + "fast-xml-parser": "^3.17.6" + } +} diff --git a/native/tools/license-upgrader/generate.js b/native/tools/license-upgrader/generate.js new file mode 100644 index 0000000000..a29c39cea3 --- /dev/null +++ b/native/tools/license-upgrader/generate.js @@ -0,0 +1,108 @@ +const fs = require('fs'); +const fsJetpack = require('fs-jetpack'); + +const ignoreList = [ + 'cocos/renderer/gfx-vulkan/volk.h', + 'cocos/renderer/gfx-vulkan/volk.c', + 'cocos/renderer/gfx-vulkan/thsvs_simpler_vulkan_synchronization.h', + 'cocos/renderer/gfx-vulkan/vk_mem_alloc.h', + 'cocos/network/Uri.h', + 'cocos/network/Uri.cpp', + 'cocos/platform/win32/inet_pton_mingw.h', + 'cocos/platform/win32/inet_pton_mingw.cpp', + // directories + 'cocos/editor-support/dragonbones', + 'cocos/editor-support/spine', + 'cocos/audio/android/', + 'cocos/math/', + 'cocos/renderer/pipeline/deferred/', + 'cocos/bindings/jswrapper/v8/debugger/', +]; + +const genHeader = (history) => { + let output = `/****************************************************************************\n`; + + for (const info of history) { + const period = info.period[1] ? `${info.period[0]}-${info.period[1]}` : info.period[0]; + output += ` Copyright (c) ${period} ${info.owner}\n`; + } + + output += ` + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + 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. +****************************************************************************/\n\n`; + + return output; +} + + +const headerRE = /\/\*{5,}.*?\*{5,}\/\s*/s; +const ownerRE = /^\s*Copyright\s*\(c\)\s*([0-9]+)(?:-([0-9]+))?\s*(.*)/gm; +const curYear = new Date().getFullYear(); +const companyName = 'Xiamen Yaji Software Co., Ltd.'; +const update = (path) => { + const cmpPath = path.replace(/\\/g, '/'); + if (ignoreList.some((p) => cmpPath.includes(p))) return; + + let content = fs.readFileSync(path, { encoding: 'utf8' }); + const history = []; + + let hasLicense = false; + const headerCap = content.match(headerRE); + if (headerCap) { + content = content.slice(headerCap.index + headerCap[0].length); + // extract + let ownerCap = ownerRE.exec(headerCap[0]); + while (ownerCap) { + history.push({ period: [ownerCap[1], ownerCap[2]], owner: ownerCap[3] }); + ownerCap = ownerRE.exec(headerCap[0]); + } + if (history.length) { + // update + hasLicense = true; + let ownerUpToDate = false; + for (const info of history) { + if (info.owner === companyName) { + if (Number.parseInt(info.period[0]) !== curYear) { + info.period[1] = curYear; + } + ownerUpToDate = true; + } + } + if (!ownerUpToDate) { + const lastValidYear = history[history.length - 1].period[1]; + history.push({ period: [lastValidYear, curYear], owner: companyName }); + } + } + } + + // caveat: we don't actually know when exactly these files are created + // so the beginning year may not be accurate + // can be overriden manually anytime + if (!hasLicense) { + history.push({ period: [curYear], owner: companyName }); + } + + fs.writeFileSync(path, genHeader(history) + content.replace(/\r\n/g, '\n')); +}; + +const files = fsJetpack.find(`${__dirname}/../../cocos`, { matching: ['**/*.h', '**/*.cpp', '**/*.mm'] }); +for (const path of files) update(path); diff --git a/native/tools/simulator/frameworks/runtime-src/CMakeLists.txt b/native/tools/simulator/frameworks/runtime-src/CMakeLists.txt index 4d66d559c3..4d82c2448b 100644 --- a/native/tools/simulator/frameworks/runtime-src/CMakeLists.txt +++ b/native/tools/simulator/frameworks/runtime-src/CMakeLists.txt @@ -8,7 +8,7 @@ if(APPLE) enable_language(OBJC OBJCXX) endif() -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) option(USE_SE_V8 "USE V8 JavaScript Engine" ON) option(USE_V8_DEBUGGER "Enable Chrome Remote inspector" ON) option(USE_SOCKET "Enable WebSocket & SocketIO" ON) @@ -20,6 +20,7 @@ option(USE_WEBVIEW "Enable WebView Component" OFF) option(USE_MIDDLEWARE "Enable Middleware" ON) option(USE_DRAGONBONES "Enable Dragonbones" ON) option(USE_SPINE "Enable Spine" ON) +option(USE_PHYSICS_PHYSX "USE PhysX Physics" ON) if(USE_SE_JSC AND APPLE) set(USE_SE_V8 OFF) @@ -31,7 +32,7 @@ if(CMAKE_OSX_SYSROOT STREQUAL "iphonesimulator") else() set(TARGET_IOS_VERSION "8.0") endif() -set(TARGET_OSX_VERSION "10.10") +set(TARGET_OSX_VERSION "10.14") set(cocosdir ${CMAKE_CURRENT_LIST_DIR}/../../../..) if(NOT cocosdir) diff --git a/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp b/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp index c17129f719..228a14afb0 100755 --- a/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp +++ b/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp @@ -29,6 +29,12 @@ // // +// NOTE: fix the conflict typedef 'byte' between C++17 and one Windows header named 'rpcndr.h' +// reference: https://studiofreya.com/2018/01/06/visual-studio-2017-with-cpp17-and-boost/#stdbyte-ambiguous-symbol-and-rpcndr.h +#ifdef WIN32 +#define _HAS_STD_BYTE 0 +#endif + #include "RuntimeJsImpl.h" #if (CC_CODE_IDE_DEBUG_SUPPORT > 0) diff --git a/native/tools/tojs/genbindings.py b/native/tools/tojs/genbindings.py index 5992ecc4f0..7c5ba31c51 100755 --- a/native/tools/tojs/genbindings.py +++ b/native/tools/tojs/genbindings.py @@ -144,37 +144,35 @@ def main(): output_dir = '%s/cocos/bindings/auto' % project_root cmd_args = { - 'cocos.ini' : ('cocos', 'jsb_cocos_auto'), - 'video.ini': ('video', 'jsb_video_auto'), - 'webview.ini': ('webview', 'jsb_webview_auto'), - 'audio.ini' : ('audio', 'jsb_audio_auto'), - 'extension.ini' : ('extension', 'jsb_extension_auto'), - 'network.ini' : ('network', 'jsb_network_auto'), - 'gfx.ini': ('gfx', 'jsb_gfx_auto'), - 'gles2.ini': ('gles2', 'jsb_gles2_auto'), - 'gles3.ini': ('gles3', 'jsb_gles3_auto'), - 'metal.ini': ('metal', 'jsb_mtl_auto'), - 'vulkan.ini': ('vulkan', 'jsb_vk_auto'), - 'pipeline.ini': ('pipeline', 'jsb_pipeline_auto'), - 'spine.ini': ('spine','jsb_spine_auto'), - 'editor_support.ini': ('editor_support','jsb_editor_support_auto'), - 'dragonbones.ini': ('dragonbones','jsb_dragonbones_auto') - } + 'cocos.ini' : ('cocos', 'jsb_cocos_auto'), + 'video.ini': ('video', 'jsb_video_auto'), + 'webview.ini': ('webview', 'jsb_webview_auto'), + 'audio.ini' : ('audio', 'jsb_audio_auto'), + 'extension.ini' : ('extension', 'jsb_extension_auto'), + 'network.ini' : ('network', 'jsb_network_auto'), + 'gfx.ini': ('gfx', 'jsb_gfx_auto'), + 'pipeline.ini': ('pipeline', 'jsb_pipeline_auto'), + 'spine.ini': ('spine','jsb_spine_auto'), + 'editor_support.ini': ('editor_support','jsb_editor_support_auto'), + 'dragonbones.ini': ('dragonbones','jsb_dragonbones_auto'), + 'physics.ini': ('physics','jsb_physics_auto') + } + target = 'spidermonkey' generator_py = '%s/generator.py' % cxx_generator_root tasks = [] for key in cmd_args.keys(): - args = cmd_args[key] - cfg = '%s/%s' % (tojs_root, key) - print '!!----------Generating bindings for %s----------!!' % (key[:-4]) - command = '%s -W ignore %s %s -s %s -t %s -o %s -n %s' % (python_bin, generator_py, cfg, args[0], target, output_dir, args[1]) - # tasks.append(_run_cmd(command)) - _run_cmd(command).communicate() - + if len(sys.argv) <= 1 or any(key[:-4] in s for s in sys.argv[1:]): + args = cmd_args[key] + cfg = '%s/%s' % (tojs_root, key) + print '!!----------Generating bindings for %s----------!!' % (key[:-4]) + command = '%s -W ignore %s %s -s %s -t %s -o %s -n %s' % (python_bin, generator_py, cfg, args[0], target, output_dir, args[1]) + # tasks.append(_run_cmd(command)) + _run_cmd(command).communicate() + # for t in tasks: # t.communicate() - print '----------------------------------------' print 'Generating javascript bindings succeeds.' print '----------------------------------------' diff --git a/native/tools/tojs/gfx.ini b/native/tools/tojs/gfx.ini index 767ce55367..f03e4b22d7 100644 --- a/native/tools/tojs/gfx.ini +++ b/native/tools/tojs/gfx.ini @@ -16,7 +16,7 @@ android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILIT clang_headers = clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__ -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core-I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core-I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 @@ -26,14 +26,25 @@ cxxgenerator_headers = extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s # what headers to parse -headers = %(cocosdir)s/cocos/renderer/core/Core.h +headers = %(cocosdir)s/cocos/renderer/gfx-base/GFXBase.h replace_headers = # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu.*$". -classes = GFXObject Device Buffer CommandBuffer Framebuffer InputAssembler DescriptorSet DescriptorSetLayout PipelineLayout PipelineState Fence Queue RenderPass Sampler Shader Texture TextureLayout ContextInfo TextureViewInfo ShaderMacro PushConstantRange InputState PipelineStateInfo FormatInfo MemoryStatus FenceInfo Attribute DeviceInfo BindingMappingInfo RasterizerState DepthStencilState BlendState PrimitiveMode Color DepthStencilAttachment SubPassInfo UniformBlock UniformSampler Uniform ShaderStage DescriptorSetLayoutBinding Format Context BlendTarget FramebufferInfo RenderPassInfo ColorAttachment SamplerInfo DescriptorSetLayoutInfo DescriptorSetInfo InputAssemblerInfo PipelineLayoutInfo ShaderInfo Rect TextureInfo BufferTextureCopy Offset Extent TextureSubres BufferInfo BufferViewInfo +classes = + # classes + GFXObject Context DescriptorSet DescriptorSetLayout Device Buffer CommandBuffer Framebuffer GlobalBarrier InputAssembler, + PipelineLayout PipelineState Queue RenderPass Sampler Shader Texture TextureBarrier, + # structs + Attribute BindingMappingInfo BlendState BlendTarget BufferInfo BufferTextureCopy BufferViewInfo Color ColorAttachment CommandBufferInfo, + DepthStencilAttachment DepthStencilState DescriptorSetInfo DescriptorSetLayoutBinding DescriptorSetLayoutInfo DeviceCaps DeviceInfo, + DispatchInfo DrawInfo Extent FramebufferInfo GlobalBarrierInfo IndirectBuffer InputAssemblerInfo InputState, + MemoryStatus Offset PipelineLayoutInfo QueueInfo RasterizerState Rect RenderPassInfo SamplerInfo ShaderInfo ShaderStage Size SubpassInfo, + TextureBarrierInfo TextureBlit TextureCopy TextureInfo TextureSubresLayers TextureSubresRange TextureViewInfo Uniform, + UniformBlock UniformInputAttachment UniformSampler UniformSamplerTexture UniformStorageBuffer UniformStorageImage UniformTexture Viewport + ; FormatInfo classes_need_extend = @@ -45,40 +56,41 @@ classes_need_extend = # functions from all classes. skip = Buffer::[Buffer getDevice initialize update], - CommandBuffer::[CommandBuffer getDevice execute updateBuffer copyBuffersToTexture bindDescriptorSet$], + CommandBuffer::[CommandBuffer getDevice execute updateBuffer copyBuffersToTexture bindDescriptorSet$ beginRenderPass$], Framebuffer::[Framebuffer getDevice], InputAssembler::[InputAssembler getDevice extractDrawInfo], DescriptorSet::[DescriptorSet getDevice], DescriptorSetLayout::[DescriptorSetLayout getDevice getBindingIndices descriptorIndices getDescriptorIndices], PipelineLayout::[PipelineLayout getDevice], PipelineState::[PipelineState getDevice], - Fence::[Fence getDevice], - Queue::[Queue getDevice], + Queue::[Queue getDevice submit$], RenderPass::[RenderPass getDevice getColorAttachments getBindings getBindingIndices], Sampler::[Sampler getDevice], Shader::[Shader getDevice], Texture::[Texture getDevice initialize], - Device::[copyBuffersToTexture createBuffer createTexture getInstance], + Device::[Device copyBuffersToTexture createBuffer createTexture getInstance flushCommands$], Context::[Context] -getter_setter = Device::[gfxAPI surfaceTransform deviceName width height nativeWidth nativeHeight memoryStatus context queue commandBuffer renderer vendor numDrawCalls numInstances numTris maxVertexAttributes maxVertexUniformVectors maxFragmentUniformVectors maxTextureUnits maxVertexTextureUnits maxUniformBufferBindings maxUniformBlockSize maxTextureSize maxCubeMapTextureSize depthBits stencilBits colorFormat depthStencilFormat clipSpaceMinZ screenSpaceSignY UVSpaceSignY], +getter_setter = Device::[gfxAPI surfaceTransform deviceName width height nativeWidth nativeHeight memoryStatus queue commandBuffer renderer vendor numDrawCalls numInstances numTris colorFormat depthStencilFormat capabilities], Shader::[name shaderID/getID stages attributes blocks samplers], - Texture::[type usage format width height depth layerCount levelCount size samples flags buffer], + Texture::[type usage format width height depth layerCount levelCount size samples flags], Queue::[type], RenderPass::[hash], - PipelineState::[shader primitive inputState rasterizerState depthStencilState blendState renderPass], + PipelineState::[shader primitive bindPoint inputState rasterizerState depthStencilState blendState renderPass], InputAssembler::[vertexBuffers attributes indexBuffer indirectBuffer vertexCount firstVertex indexCount firstIndex vertexOffset instanceCount firstInstance attributesHash], Commanduffer::[type queue numDrawCalls numInstances numTris], Context::[sharedContext/getSharedContext vsyncMode colorFormat depthStencilFormat], Framebuffer::[renderPass colorTextures depthStencilTexture], Buffer::[usage memUsage stride count size flags], - Sampler::[minFilter magFilter mipFilter addressU addressV addressW maxAnisotropy cmpFunc borderColor minLOD maxLOD mipLODBias], + Sampler::[minFilter magFilter mipFilter addressU addressV addressW maxAnisotropy cmpFunc borderColor mipLODBias], GFXObject::[gfxType/getType] rename_functions = DepthStencilState::[getHash=hash], BlendState::[getHash=hash], RasterizerState::[getHash=hash], - CommandBuffer::[bindDescriptorSetForJS=bindDescriptorSet] + CommandBuffer::[bindDescriptorSetForJS=bindDescriptorSet beginRenderPassForJS=beginRenderPass], + Queue::[submitForJS=submit], + Device::[flushCommandsForJS=flushCommands] rename_classes = Device::GFXDevice diff --git a/native/tools/tojs/gles2.ini b/native/tools/tojs/gles2.ini deleted file mode 100644 index b4e8b61ab8..0000000000 --- a/native/tools/tojs/gles2.ini +++ /dev/null @@ -1,71 +0,0 @@ -[gles2] -# the prefix to be added to the generated functions. You might or might not use this in your own -# templates -prefix = gles2 - -# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) -# all classes will be embedded in that namespace -target_namespace = gfx - -macro_judgement = - -android_headers = - -android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include - -clang_headers = -clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__ - -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-gles2 -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source -cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 - - -cxxgenerator_headers = - -# extra arguments for clang -extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s - -# what headers to parse -headers = %(cocosdir)s/cocos/renderer/gfx-gles2/GFXGLES2.h - -replace_headers = - -# what classes to produce code for. You can use regular expressions here. When testing the regular -# expression, it will be enclosed in "^$", like this: "^Menu.*$". - -classes = GLES2Device - -classes_need_extend = - -# what should we skip? in the format ClassName::[function function] -# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also -# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just -# add a single "*" as functions. See bellow for several examples. A special class name is "*", which -# will apply to all class names. This is a convenience wildcard to be able to skip similar named -# functions from all classes. - -skip = GLES2Device::[copyBuffersToTexture stateCache cmdAllocator stagingBufferPool useVAO useDrawInstanced useInstancedArrays useDiscardFramebuffer] - -getter_setter = - -rename_functions = - -rename_classes = - -# for all class names, should we remove something when registering in the target VM? -remove_prefix = - -# classes for which there will be no "parent" lookup -classes_have_no_parents = - -# base classes which will be skipped when their sub-classes found them. -base_classes_to_skip = Ref Clonable Object - -# classes that create no constructor -# Set is special and we will use a hand-written constructor - -abstract_classes = GFXDevice - -persistent_classes = - -classes_owned_by_cpp = diff --git a/native/tools/tojs/metal.ini b/native/tools/tojs/metal.ini deleted file mode 100644 index 19e0c2502b..0000000000 --- a/native/tools/tojs/metal.ini +++ /dev/null @@ -1,72 +0,0 @@ -[metal] -# the prefix to be added to the generated functions. You might or might not use this in your own -# templates -prefix = mtl - -# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) -# all classes will be embedded in that namespace -target_namespace = gfx - -macro_judgement = - -android_headers = - -android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include - -clang_headers = -clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__ - -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-metal -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source -cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 - - -cxxgenerator_headers = - -# extra arguments for clang -extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s - -# what headers to parse -headers = %(cocosdir)s/cocos/renderer/gfx-metal/GFXMTL.h - -replace_headers = - -# what classes to produce code for. You can use regular expressions here. When testing the regular -# expression, it will be enclosed in "^$", like this: "^Menu.*$". - -classes = CCMTLDevice - -classes_need_extend = - -# what should we skip? in the format ClassName::[function function] -# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also -# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just -# add a single "*" as functions. See bellow for several examples. A special class name is "*", which -# will apply to all class names. This is a convenience wildcard to be able to skip similar named -# functions from all classes. - -skip = CCMTLDevice::[copyBuffersToTexture cmdAllocator gpuStagingBufferPool getMTLCommandQueue getMTKView getMTLDevice getMaximumSamplerUnits getMaximumColorRenderTargets getMaximumBufferBindingIndex isIndirectCommandBufferSupported isIndirectDrawSupported gpuStagingBufferPool isSamplerDescriptorCompareFunctionSupported getInFlightSemaphore currentFrameIndex] - - -getter_setter = - -rename_functions = - -rename_classes = - -# for all class names, should we remove something when registering in the target VM? -remove_prefix = - -# classes for which there will be no "parent" lookup -classes_have_no_parents = - -# base classes which will be skipped when their sub-classes found them. -base_classes_to_skip = Ref Clonable Object - -# classes that create no constructor -# Set is special and we will use a hand-written constructor - -abstract_classes = GFXDevice - -persistent_classes = - -classes_owned_by_cpp = diff --git a/native/tools/tojs/gles3.ini b/native/tools/tojs/physics.ini similarity index 66% rename from native/tools/tojs/gles3.ini rename to native/tools/tojs/physics.ini index bc8d9edafe..e8ae43401e 100644 --- a/native/tools/tojs/gles3.ini +++ b/native/tools/tojs/physics.ini @@ -1,41 +1,38 @@ -[gles3] +[physics] # the prefix to be added to the generated functions. You might or might not use this in your own # templates -prefix = gles3 +prefix = physics # create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) # all classes will be embedded in that namespace -target_namespace = gfx +target_namespace = jsb.physics -macro_judgement = +macro_judgement = -android_headers = +android_headers = android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -clang_headers = -clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__ +clang_headers = +clang_flags = -nostdinc -x c++ -std=c++14 -fsigned-char -U__SSE__ -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-gles3 -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source +cocos_headers = -I%(cocosdir)s -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/external/android/armeabi-v7a/include/v8 cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 -cxxgenerator_headers = +cxxgenerator_headers = # extra arguments for clang -extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s +extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s # what headers to parse -headers = %(cocosdir)s/cocos/renderer/gfx-gles3/GFXGLES3.h +headers = %(cocosdir)s/cocos/physics/PhysicsSDK.h -replace_headers = +replace_headers = # what classes to produce code for. You can use regular expressions here. When testing the regular -# expression, it will be enclosed in "^$", like this: "^Menu.*$". - -classes = GLES3Device - -classes_need_extend = +# expression, it will be enclosed in "^$", like this: "^Menu*$". +classes = PhysXBindings World RigidBody SphereShape BoxShape PlaneShape CapsuleShape TrimeshShape TerrainShape CylinderShape ConeShape RevoluteJoint DistanceJoint # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -44,28 +41,26 @@ classes_need_extend = # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = GLES3Device::[copyBuffersToTexture stateCache cmdAllocator stagingBufferPool] +skip = -getter_setter = +field = -rename_functions = +rename_functions = rename_classes = # for all class names, should we remove something when registering in the target VM? -remove_prefix = +remove_prefix = # classes for which there will be no "parent" lookup -classes_have_no_parents = +classes_have_no_parents = PhysXBindings World RigidBody SphereShape BoxShape PlaneShape CapsuleShape TrimeshShape TerrainShape CylinderShape ConeShape RevoluteJoint DistanceJoint # base classes which will be skipped when their sub-classes found them. -base_classes_to_skip = Ref Clonable Object +base_classes_to_skip = # classes that create no constructor # Set is special and we will use a hand-written constructor +abstract_classes = -abstract_classes = GFXDevice +classes_owned_by_cpp = -persistent_classes = - -classes_owned_by_cpp = diff --git a/native/tools/tojs/pipeline.ini b/native/tools/tojs/pipeline.ini index 8193b2a91c..3cb1a5e96f 100644 --- a/native/tools/tojs/pipeline.ini +++ b/native/tools/tojs/pipeline.ini @@ -3,7 +3,7 @@ # templates prefix = pipeline -cpp_headers= cocos/renderer/core/Core.h cocos/renderer/core/gfx/GFXDescriptorSet.h +cpp_headers = cocos/renderer/gfx-base/GFXBase.h # create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) # all classes will be embedded in that namespace @@ -16,7 +16,7 @@ android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILIT clang_headers = clang_flags = -nostdinc -x c++ -std=c++14 -fsigned-char -U__SSE__ -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/external/ios/include/v8 +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/external/ios/include/v8 cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 @@ -26,13 +26,13 @@ cxxgenerator_headers = extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s # what headers to parse -headers = %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardPipeline.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardFlow.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardStage.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowFlow.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowStage.h %(cocosdir)s/cocos/renderer/pipeline/RenderPipeline.h %(cocosdir)s/cocos/renderer/pipeline/RenderFlow.h %(cocosdir)s/cocos/renderer/pipeline/RenderStage.h %(cocosdir)s/cocos/renderer/pipeline/Define.h %(cocosdir)s/cocos/renderer/pipeline/helper/SharedMemory.h %(cocosdir)s/cocos/renderer/pipeline/InstancedBuffer.h +headers = %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardPipeline.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardFlow.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardStage.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowFlow.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowStage.h %(cocosdir)s/cocos/renderer/pipeline/RenderPipeline.h %(cocosdir)s/cocos/renderer/pipeline/RenderFlow.h %(cocosdir)s/cocos/renderer/pipeline/RenderStage.h %(cocosdir)s/cocos/renderer/pipeline/Define.h %(cocosdir)s/cocos/renderer/pipeline/helper/SharedMemory.h %(cocosdir)s/cocos/renderer/pipeline/InstancedBuffer.h %(cocosdir)s/cocos/renderer/pipeline/deferred/DeferredPipeline.h %(cocosdir)s/cocos/renderer/pipeline/deferred/GbufferFlow.h %(cocosdir)s/cocos/renderer/pipeline/deferred/GbufferStage.h %(cocosdir)s/cocos/renderer/pipeline/deferred/LightingFlow.h %(cocosdir)s/cocos/renderer/pipeline/deferred/LightingStage.h %(cocosdir)s/cocos/renderer/pipeline/deferred/PostprocessStage.h hpp_headers = cocos/bindings/auto/jsb_gfx_auto.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = RenderPipeline ForwardPipeline ForwardFlow ForwardStage ShadowFlow ShadowStage RenderPipelineInfo RenderFlowInfo RenderStageInfo RenderQueueDesc RenderFlow RenderStage RenderWindow InstancedBuffer Light PassView +classes = RenderPipeline ForwardPipeline ForwardFlow ForwardStage ShadowFlow ShadowStage RenderPipelineInfo RenderFlowInfo RenderStageInfo RenderQueueDesc RenderFlow RenderStage RenderWindow InstancedBuffer Light PassView DeferredPipeline GbufferStage GbufferFlow LightingStage LightingFlow PostprocessStage # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -40,19 +40,26 @@ classes = RenderPipeline ForwardPipeline ForwardFlow ForwardStage ShadowFlow Sha # add a single "*" as functions. See bellow for several examples. A special class name is "*", which # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = ForwardPipeline::[updateUBOs setHDR getOrCreateRenderPass getLightsUBO getValidLights getLightBuffers getLightIndexOffsets getLightIndices getRenderObjects getShadowObjects getCommandBuffers getShadingScale getFpScale isHDR setRenderObjects setShadowObjects getFog getAmbient getSkybox getShadows getShadowUBO setShadowFramebuffer getShadowFramebufferMap destroyShadowFrameBuffers updateShadowUBO updateCameraUBO updateGlobalUBO], - RenderPipeline::[getFlows getTag getGlobalBindings getMacros getDefaultTexture], +skip = ForwardPipeline::[getOrCreateRenderPass getLightsUBO getValidLights getLightBuffers getLightIndexOffsets getLightIndices getCommandBuffers], + RenderPipeline::[getFlows getTag getGlobalBindings getMacros getDefaultTexture getPipelineSceneData getPipelineUBO getCommandBuffers], RenderFlow::[render destroy getPriority getName], RenderStage::[render destroy getPriority getName], ForwardFlow::[initialize activate destroy render], ForwardStage::[initialize activate destroy render], ShadowFlow::[initialize activate destroy render], - ShadowStage::[ShadowStage initialize activate destroy render clearFramebuffer], + ShadowStage::[initialize activate destroy render clearFramebuffer], + InstancedBuffer::[merge uploadBuffers clear getInstances getPass hasPendingModels dynamicOffsets], + DeferredPipeline::[getOrCreateRenderPass getLightsUBO getValidLights getLightBuffers getLightIndexOffsets getLightIndices getQuadIAOnScreen getQuadIAOffScreen setDepth getDepth getRenderArea createQuadInputAssembler destroyQuadInputAssembler getDeferredRenderData updateQuadVertexData genQuadVertexData], + GbufferFlow::[initialize activate destroy render getFrameBuffer createRenderPass createRenderTargets], + GbufferStage::[initialize activate destroy render], + LightingFlow::[initialize activate destroy render createRenderPass createFrameBuffer getLightingFrameBuffer], + LightingStage::[initialize activate destroy render initLightingBuffer gatherLights], + PostprocessStage::[initialize activate destroy render], InstancedBuffer::[merge uploadBuffers clear getInstances getPass hasPendingModels dynamicOffsets] -rename_functions = +rename_functions = -getter_setter= RenderPipeline::[descriptorSet descriptorSetLayout] +getter_setter= RenderPipeline::[descriptorSet descriptorSetLayout constantMacros] rename_classes = @@ -60,11 +67,10 @@ rename_classes = remove_prefix = # classes for which there will be no "parent" lookup -classes_have_no_parents = +classes_have_no_parents = # base classes which will be skipped when their sub-classes found them. base_classes_to_skip = Clonable Object # classes that create no constructor # Set is special and we will use a hand-written constructor abstract_classes = RenderStage RenderFlow RenderPipeline - diff --git a/native/tools/tojs/vulkan.ini b/native/tools/tojs/vulkan.ini deleted file mode 100644 index 6d685f786d..0000000000 --- a/native/tools/tojs/vulkan.ini +++ /dev/null @@ -1,71 +0,0 @@ -[vulkan] -# the prefix to be added to the generated functions. You might or might not use this in your own -# templates -prefix = vk - -# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) -# all classes will be embedded in that namespace -target_namespace = gfx - -macro_judgement = - -android_headers = - -android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include - -clang_headers = -clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__ - -cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/renderer/core -I%(cocosdir)s/cocos/renderer/gfx-vulkan -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source -cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3 - - -cxxgenerator_headers = - -# extra arguments for clang -extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s - -# what headers to parse -headers = %(cocosdir)s/cocos/renderer/gfx-vulkan/GFXVulkan.h - -replace_headers = - -# what classes to produce code for. You can use regular expressions here. When testing the regular -# expression, it will be enclosed in "^$", like this: "^Menu.*$". - -classes = CCVKDevice - -classes_need_extend = - -# what should we skip? in the format ClassName::[function function] -# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also -# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just -# add a single "*" as functions. See bellow for several examples. A special class name is "*", which -# will apply to all class names. This is a convenience wildcard to be able to skip similar named -# functions from all classes. - -skip = CCVKDevice::[copyBuffersToTexture gpuContext gpuDevice gpuSwapchain gpuBufferHub gpuTransportHub gpuDescriptorHub gpuSemaphorePool gpuDescriptorSetHub gpuFencePool gpuRecycleBin gpuStagingBufferPool] - -getter_setter = - -rename_functions = - -rename_classes = - -# for all class names, should we remove something when registering in the target VM? -remove_prefix = - -# classes for which there will be no "parent" lookup -classes_have_no_parents = - -# base classes which will be skipped when their sub-classes found them. -base_classes_to_skip = Ref Clonable Object - -# classes that create no constructor -# Set is special and we will use a hand-written constructor - -abstract_classes = GFXDevice - -persistent_classes = - -classes_owned_by_cpp = diff --git a/native/tools/travis-scripts/generate-pr.sh b/native/tools/travis-scripts/generate-pr.sh index ac732a65a9..f9f8bad4ce 100644 --- a/native/tools/travis-scripts/generate-pr.sh +++ b/native/tools/travis-scripts/generate-pr.sh @@ -23,7 +23,7 @@ COMMITTAG="[ci skip][AUTO]: updating jsbinding automatically: ${TRAVIS_COMMIT:0: ELAPSEDSECS=`date +%s` COCOS_BRANCH="update_js_bindings_$ELAPSEDSECS" COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x-lite.git" -PULL_REQUEST_REPO="https://api.github.com/repos/cocos-creator/cocos2d-x-lite/pulls" +PULL_REQUEST_REPO="https://api.github.com/repos/cocos-creator/engine-native/pulls" FETCH_REMOTE_BRANCH=$1 JS_COMMIT_PATH="cocos/bindings/auto" JS_COMMIT_CCFILES="templates/cocos2dx_files.json" @@ -133,6 +133,9 @@ git commit -m "$COMMITTAG" #Set remotes git remote add upstream "$COCOS_ROBOT_REMOTE" 2> /dev/null > /dev/null +if $(git rev-parse --is-shallow-repository); then + git fetch --unshallow +fi git fetch upstream --no-recurse-submodules echo "Pushing to Robot's repo ..." @@ -144,8 +147,9 @@ echo " finish push ..." # set +x # 7. +ENCODED_MESSAGE=$(python -c "import urllib; print urllib.quote('''$TRAVIS_COMMIT_MESSAGE''')") echo "Sending Pull Request to base repo ..." -curl -H "Authorization: token $GH_TOKEN" --request POST --data "{ \"title\": \"$COMMITTAG\", \"body\": \"> $TRAVIS_COMMIT_MESSAGE\", \"head\": \"${GH_USER}:${COCOS_BRANCH}\", \"base\": \"${TRAVIS_BRANCH}\"}" "${PULL_REQUEST_REPO}" # 2> /dev/null > /dev/null +curl -H "Authorization: token $GH_TOKEN" --request POST --data "{ \"title\": \"$COMMITTAG\", \"body\": \"> $ENCODED_MESSAGE\", \"head\": \"${GH_USER}:${COCOS_BRANCH}\", \"base\": \"${TRAVIS_BRANCH}\"}" "${PULL_REQUEST_REPO}" # 2> /dev/null > /dev/null echo " finish sending PR ..." diff --git a/native/tools/travis-scripts/run-script.sh b/native/tools/travis-scripts/run-script.sh index 7cf3a4d080..fea2d1b89a 100755 --- a/native/tools/travis-scripts/run-script.sh +++ b/native/tools/travis-scripts/run-script.sh @@ -69,7 +69,7 @@ function build_android() echo "set(CC_USE_VULKAN ON)" >> build-android/proj/cfg.cmake echo "set(CC_USE_GLES2 ON)" >> build-android/proj/cfg.cmake echo "set(USE_WEBSOCKET_SERVER ON)" >> build-android/proj/cfg.cmake - + mkdir -p build-android/assets ASSET_DIR=$COCOS2DX_ROOT/templates/android/build/build-android/ @@ -139,13 +139,12 @@ function build_macosx() cd build-mac cmake ../ -GXcode -DCC_USE_GLES3=ON -DCMAKE_OSX_ARCHITECTURES=x86_64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch x86_64 - echo "Compile MacOSX X86_64 Release Done!" - cd .. - mkdir build-mac-apple-silicon - cd build-mac-apple-silicon - cmake ../ -GXcode -DCC_USE_GLES3=OFF -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT - cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch arm64 - echo "Compile MacOSX ARM64 Release Done!" + # cd .. + # mkdir build-mac-apple-silicon + # cd build-mac-apple-silicon + # cmake ../ -GXcode -DCC_USE_GLES3=OFF -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT + # cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch arm64 + # echo "Compile MacOSX ARM64 Release Done!" } function build_ios() diff --git a/native/unit-test/src/math_geometry_test.cpp b/native/unit-test/src/math_geometry_test.cpp new file mode 100644 index 0000000000..45edf40f15 --- /dev/null +++ b/native/unit-test/src/math_geometry_test.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +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 "gtest/gtest.h" +#include "cocos/math/Vec2.h" +#include "cocos/math/Math.h" +#include "cocos/math/Geometry.h" +#include "utils.h" +#include + +TEST(mathGeometryTest, test7) { + // setSize + logLabel = "test the geometry_size setSize function"; + cc::Size size(100, 80); + size.setSize(20, 10); + ExpectEq(size.width == 20 && size.height == 10, true); + // equals size + logLabel = "test the geometry_size equals function"; + cc::Size target(20, 10); + ExpectEq(size.equals(target), true); + // Rect getMinX + logLabel = "test the geometry_rect getMinX function"; + cc::Rect rect; + rect.setRect(0, 0, 100, 70); + ExpectEq(rect.getMinX() == 0, true); + // Rect getMidX + logLabel = "test the geometry_rect getMidX function"; + ExpectEq(rect.getMidX() == 50, true); + // Rect getMaxX + logLabel = "test the geometry_rect getMaxX function"; + ExpectEq(rect.getMaxX() == 100, true); + // Rect getMinY + logLabel = "test the geometry_rect getMinY function"; + ExpectEq(rect.getMinY() == 0, true); + // Rect getMidY + logLabel = "test the geometry_rect getMidY function"; + ExpectEq(rect.getMidY() == 35, true); + // Rect getMaxY + logLabel = "test the geometry_rect getMaxY function"; + ExpectEq(rect.getMaxY() == 70, true); + // Rect equals + logLabel = "test the geometry_rect equals function"; + cc::Rect equalTarget(0, 0, 100, 70); + ExpectEq(rect.equals(equalTarget), true); + // containsPoint + logLabel = "test the geometry_rect containsPoint function"; + cc::Vec2 point(10, 10); + ExpectEq(rect.containsPoint(point), true); + // intersectsRect + logLabel = "test the geometry_rect intersectsRect function"; + cc::Rect intersectRect(10, 10, 50, 40); + ExpectEq(rect.intersectsRect(intersectRect), true); + // intersectsCircle + logLabel = "test the geometry_rect intersectsCircle function"; + cc::Vec2 intersectsCircle(50, 10); + ExpectEq(rect.intersectsCircle(intersectsCircle, 50), true); + // unionWithRect + logLabel = "test the geometry_rect unionWithRect function"; + cc::Rect unionWithRect(10, 10, 150, 40); + rect = rect.unionWithRect(unionWithRect); + cc::Vec2 equalTar(0, 0); + size.setSize(160, 70); + ExpectEq(rect.origin.equals(equalTar) && rect.size.equals(size), true); + // merge + logLabel = "test the geometry_rect merge function"; + cc::Rect merge(30, 10, 200, 180); + rect.merge(merge); + size.setSize(230, 190); + ExpectEq(rect.size.equals(size), true); +} + diff --git a/native/unit-test/src/math_mat3_test.cpp b/native/unit-test/src/math_mat3_test.cpp new file mode 100644 index 0000000000..7c34393cea --- /dev/null +++ b/native/unit-test/src/math_mat3_test.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +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 "gtest/gtest.h" +#include "cocos/math/Vec2.h" +#include "cocos/math/Mat3.h" +#include "cocos/math/Mat4.h" +#include "cocos/math/Math.h" +#include "cocos/math/Quaternion.h" +#include "utils.h" +#include + +TEST(mathMat3Test, test4) { + cc::Mat3 mat3(0,2,3, 4,5,6, 7,8,9); + // identity + logLabel = "test the mat3 identity function"; + cc::Mat3::identity(mat3); + ExpectEq(mat3.m[0] == 1 && mat3.m[4] == 1 && mat3.m[8] == 1, true); + // transpose + logLabel = "test the mat3 transpose function"; + mat3.set(11,21,31, 12,22,32, 13,23,33); + mat3.transpose(); + ExpectEq(mat3.m[1] == 21 && mat3.m[4] == 22 && mat3.m[7] == 23, true); + cc::Mat3 matTemp(11,21,31, 12,22,32, 13,23,33); + cc::Mat3::transpose(mat3, matTemp); + ExpectEq(mat3.m[1] == 21 && mat3.m[4] == 22 && mat3.m[7] == 23, true); + // inverse + logLabel = "test the mat3 inverse function"; + mat3.set(0, 2, 0, 3, 0, 0, 2, 0, 1); + mat3.inverse(); + ExpectEq(mat3.m[1] == 0.5f && mat3.m[8] == 1, true); + // adjoint + logLabel = "test the mat3 adjoint function"; + cc::Mat3 matAdj(0, 2, 0, 3, 0, 0, 2, 0, 1); + cc::Mat3::adjoint(mat3, matAdj); + ExpectEq(mat3.m[1] == -3 && mat3.m[3] == -2 && mat3.m[8] == -6, true); + // determinant + logLabel = "test the mat3 determinant function"; + mat3.set(1, 0, 3, 2, 1, 0, 4, 0, 2); + float det = mat3.determinant(); + ExpectEq(det == -10, true); + // multiply + logLabel = "test the mat3 multiply function"; + cc::Mat3 lm(2, 3, 1, 4, 7, 3, 8, 2, 0); + cc::Mat3 rm(5, 2, 6, 8, 1, 0, 6, 5, 4); + cc::Mat3::multiply(mat3, lm, rm); + ExpectEq(mat3.m[0] == 40 && mat3.m[4] == 30 && mat3.m[8] == 48, true); + // translate + logLabel = "test the mat3 translate function"; + cc::Mat3 translate; + translate.m[6] = 3; + translate.m[7] = 2; + cc::Vec2 pos(1, 2); + cc::Mat3 transOut; + cc::Mat3::translate(transOut, translate, pos); + ExpectEq(transOut.m[6] == 4 && transOut.m[7] == 4, true); + cc::Mat3::fromTranslation(transOut, pos); + ExpectEq(transOut.m[7] == 2, true); + // rotate + logLabel = "test the mat3 rotate function"; + cc::Mat3 rotate; + cc::Mat3 rotateOut; + cc::Mat3::rotate(rotateOut, rotate, cc::math::PI_DIV2); + ExpectEq(rotateOut.m[1] == 1 && rotateOut.m[3] == -1, true); + cc::Mat3::fromRotation(rotateOut, cc::math::PI_DIV2); + ExpectEq(rotateOut.m[1] == 1 && rotateOut.m[3] == -1, true); + // scale + logLabel = "test the mat3 scale function"; + cc::Mat3 scale; + cc::Mat3 scaleOut; + cc::Vec2 scaleVec(2, 1); + cc::Mat3::scale(scaleOut, scale, scaleVec); + ExpectEq(scaleOut.m[0] == 2, true); + cc::Mat3::fromScaling(scaleOut, scaleVec); + ExpectEq(scaleOut.m[0] == 2, true); + // fromMat4 + logLabel = "test the mat3 fromMat4 function"; + cc::Mat4 fromMat4; + fromMat4.m[0] = 3; + fromMat4.m[4] = 6; + fromMat4.m[5] = 7; + cc::Mat3 copyMat; + cc::Mat3::fromMat4(copyMat, fromMat4); + ExpectEq(copyMat.m[0] == 3 && copyMat.m[3] == 6 && copyMat.m[4] == 7, true); + // fromQuat + logLabel = "test the mat3 fromQuat function"; + cc::Mat3 fromQuat; + cc::Quaternion quat(0, 0, 3, 1); + cc::Mat3::fromQuat(fromQuat, quat); + ExpectEq(copyMat.m[0] == 3 && copyMat.m[3] == 6 && copyMat.m[4] == 7, true); + // add + logLabel = "test the mat3 add function"; + cc::Mat3 lAdd(9,0,0, 3,8,0, 9,0,0); + cc::Mat3 rAdd(1,0,0, 5,2,0, 1,0,0); + cc::Mat3 addOut; + cc::Mat3::add(addOut, lAdd, rAdd); + ExpectEq(addOut.m[0] == 10 && addOut.m[2] == 10 && addOut.m[4] == 10, true); + // subtract + logLabel = "test the mat3 subtract function"; + cc::Mat3 subOut; + cc::Mat3::subtract(subOut, lAdd, rAdd); + ExpectEq(subOut.m[0] == 8 && subOut.m[2] == 8 && subOut.m[4] == 6, true); +} + diff --git a/native/unit-test/src/math_mat4_test.cpp b/native/unit-test/src/math_mat4_test.cpp new file mode 100644 index 0000000000..3b60dbce80 --- /dev/null +++ b/native/unit-test/src/math_mat4_test.cpp @@ -0,0 +1,271 @@ +/**************************************************************************** +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +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 "gtest/gtest.h" +#include "cocos/math/Vec3.h" +#include "cocos/math/Vec4.h" +#include "cocos/math/Mat3.h" +#include "cocos/math/Mat4.h" +#include "cocos/math/Math.h" +#include "cocos/math/Quaternion.h" +#include "utils.h" +#include + +TEST(mathMat4Test, test5) { + cc::Mat4 mat4; + // createLookAt + logLabel = "test the mat4 createLookAt function"; + cc::Vec3 eyePos(0, 0, -10); + cc::Vec3 tarPos(0, 0, 0); + cc::Vec3 up(0, 1, 0); + cc::Mat4 outMat; + cc::Mat4::createLookAt(eyePos, tarPos, up, &outMat); + ExpectEq(outMat.m[0] == -1 && outMat.m[10] == -1 && outMat.m[14] == -10, true); + cc::Mat4::createLookAt(eyePos.x, eyePos.y, eyePos.z, tarPos.x, tarPos.y, tarPos.z, up.x, up.y, up.z, &outMat); + ExpectEq(outMat.m[0] == -1 && outMat.m[10] == -1 && outMat.m[14] == -10, true); + // createPerspective + logLabel = "test the mat4 createPerspective function"; + cc::Mat4::createPerspective(60, 1, 0, 100, &outMat); + ExpectEq(outMat.m[10] == -1 && outMat.m[11] == -1, true); + // createOrthographic + logLabel = "test the mat4 createOrthographic function"; + cc::Mat4::createOrthographic(20, 40, 100, 200, 10, 100, &outMat); + ExpectEq(outMat.m[12] == -3 && outMat.m[13] == -3, true); + // createOrthographicOffCenter + logLabel = "test the mat4 createOrthographicOffCenter function"; + cc::Mat4::createOrthographicOffCenter(20, 40, 100, 200, 10, 100, &outMat); + ExpectEq(outMat.m[12] == -3 && outMat.m[13] == -3, true); + cc::Mat4::createOrthographicOffCenter(20, 40, 100, 200, 10, 100, 0, 1, &outMat); + ExpectEq(outMat.m[12] == -3 && outMat.m[13] == -3, true); + // createBillboard + logLabel = "test the mat4 createBillboard function"; + cc::Vec3 objectPosition(0, 0, 6); + cc::Mat4::createBillboard(objectPosition, eyePos, up, &outMat); + ExpectEq(outMat.m[10] == 1 && outMat.m[11] == 6, true); + cc::Mat4::createBillboard(objectPosition, eyePos, up, &outMat); + cc::Vec3 camForward(0, 0, 1); + cc::Mat4::createBillboard(objectPosition, eyePos, up, camForward, &outMat); + ExpectEq(outMat.m[10] == 1 && outMat.m[11] == 6, true); + // createScale + logLabel = "test the mat4 createScale function"; + cc::Vec3 scale(2, 3, 1); + cc::Mat4::createScale(scale, &outMat); + ExpectEq(outMat.m[0] == 2 && outMat.m[5] == 3, true); + cc::Mat4::createScale(scale.x, scale.y, scale.z, &outMat); + ExpectEq(outMat.m[0] == 2 && outMat.m[5] == 3, true); + // createRotation + logLabel = "test the mat4 createRotation function"; + cc::Quaternion rot(0, 0, 5, 1); + cc::Mat4::createRotation(rot, &outMat); + ExpectEq(outMat.m[4] == -10 && outMat.m[5] == -49, true); + cc::Vec3 axis(0, 1, 0); + cc::Mat4::createRotation(axis, cc::math::PI_DIV2, &outMat); + ExpectEq(outMat.m[2] == -1 && outMat.m[8] == 1, true); + // createRotationX + logLabel = "test the mat4 createRotationX function"; + cc::Mat4::createRotationX(cc::math::PI, &outMat); + ExpectEq(outMat.m[5] == -1 && outMat.m[10] == -1, true); + // createRotationY + logLabel = "test the mat4 createRotationY function"; + cc::Mat4::createRotationY(cc::math::PI, &outMat); + ExpectEq(outMat.m[0] == -1 && outMat.m[10] == -1, true); + // createRotationZ + logLabel = "test the mat4 createRotationZ function"; + cc::Mat4::createRotationZ(cc::math::PI, &outMat); + ExpectEq(outMat.m[0] == -1 && outMat.m[5] == -1, true); + // createTranslation + logLabel = "test the mat4 createTranslation function"; + cc::Vec3 trans(3, 2, 4); + cc::Mat4::createTranslation(trans, &outMat); + ExpectEq(outMat.m[12] == 3 && outMat.m[13] == 2 && outMat.m[14] == 4, true); + cc::Mat4::createTranslation(trans.x, trans.y, trans.z, &outMat); + ExpectEq(outMat.m[12] == 3 && outMat.m[13] == 2 && outMat.m[14] == 4, true); + // add + logLabel = "test the mat4 add function"; + cc::Mat4 addMat; + addMat.add(5); + ExpectEq(addMat.m[0] == 6 && addMat.m[5] == 6 && addMat.m[10] == 6, true); + addMat.setIdentity(); + addMat.add(6, &addMat); + ExpectEq(addMat.m[0] == 7 && addMat.m[5] == 7 && addMat.m[10] == 7, true); + cc::Mat4 m1; + m1.m[0] = 2; + cc::Mat4 m2; + m2.m[0] = 3; + cc::Mat4::add(m1, m2, &outMat); + ExpectEq(outMat.m[0] == 5, true); + // fromRT + logLabel = "test the mat4 fromRT function"; + cc::Vec4 rotVec(1, 0, 1, 1); + cc::Vec3 transVec(1, 1, 2); + cc::Mat4::fromRT(rotVec, transVec, &outMat); + ExpectEq(outMat.m[5] == -3 && outMat.m[9] == -2 && outMat.m[14] == 2, true); + // decompose + logLabel = "test the mat4 decompose function"; + outMat.decompose(&scale, &rot, &transVec); + ExpectEq(transVec.x == 1 && transVec.y == 1 && transVec.z == 2, true); + // determinant + logLabel = "test the mat4 determinant function"; + cc::Mat4 det; + det.m[0] = 5; + det.m[1] = 7; + det.m[6] = 2; + float detVal = det.determinant(); + ExpectEq(detVal == 5, true); + // getScale + logLabel = "test the mat4 getScale function"; + cc::Mat4 getScaleMat; + getScaleMat.m[0] = 5; + getScaleMat.m[5] = 7; + getScaleMat.m[10] = 2; + cc::Vec3 scaleOut; + getScaleMat.getScale(&scaleOut); + ExpectEq(scaleOut.x == 5 && scaleOut.y == 7 && scaleOut.z == 2, true); + // getRotation + logLabel = "test the mat4 getRotation function"; + cc::Quaternion quat; + outMat.getRotation(&quat); + ExpectEq(IsEqualF(quat.x, 0.507208) && IsEqualF(quat.y, -0.06908) && IsEqualF(quat.z, 0.657192), true); + // getTranslation + logLabel = "test the mat4 getTranslation function"; + outMat.getTranslation(&transVec); + ExpectEq(transVec.x == 1 && transVec.y == 1 && transVec.z == 2, true); + // getUpVector + logLabel = "test the mat4 getUpVector function"; + cc::Vec3 upVec3; + outMat.getUpVector(&upVec3); + ExpectEq(upVec3.x == -2 && upVec3.y == -3 && upVec3.z == 2, true); + // getDownVector + logLabel = "test the mat4 getDownVector function"; + cc::Vec3 downVec3; + outMat.getDownVector(&downVec3); + ExpectEq(downVec3.x == 2 && downVec3.y == 3 && downVec3.z == -2, true); + // getLeftVector + logLabel = "test the mat4 getLeftVector function"; + cc::Vec3 leftVec3; + outMat.getLeftVector(&leftVec3); + ExpectEq(leftVec3.x == 1 && leftVec3.y == -2 && leftVec3.z == -2, true); + // getRightVector + logLabel = "test the mat4 getRightVector function"; + cc::Vec3 rightVec3; + outMat.getRightVector(&rightVec3); + ExpectEq(rightVec3.x == -1 && rightVec3.y == 2 && rightVec3.z == 2, true); + // getForwardVector + logLabel = "test the mat4 getForwardVector function"; + cc::Vec3 forwardVec3; + outMat.getForwardVector(&forwardVec3); + ExpectEq(forwardVec3.x == -2 && forwardVec3.y == 2 && forwardVec3.z == 1, true); + // getBackVector + logLabel = "test the mat4 getBackVector function"; + cc::Vec3 backVec3; + outMat.getBackVector(&backVec3); + ExpectEq(backVec3.x == 2 && backVec3.y == -2 && backVec3.z == -1, true); + // inverse + logLabel = "test the mat4 inverse function"; + bool isInverse = outMat.inverse(); + ExpectEq(isInverse == true, true); + // getInversed + logLabel = "test the mat4 getInversed function"; + cc::Mat4 inversed; + inversed.m[1] = 10; + inversed.m[2] = 13; + inversed.m[4] = 2; + cc::Mat4 inversedMat = inversed.getInversed(); + ExpectEq(IsEqualF(inversedMat.m[6], -1.36842108), true); + // identity + logLabel = "test the mat4 isIdentity function"; + ExpectEq(outMat.isIdentity(), false); + outMat.setIdentity(); + ExpectEq(outMat.isIdentity(), true); + // multiply + logLabel = "test the mat4 multiply function"; + outMat.multiply(7); + ExpectEq(outMat.m[0] == 7, true); + outMat.setIdentity(); + outMat.multiply(6, &outMat); + ExpectEq(outMat.m[0] == 6, true); + // negate + logLabel = "test the mat4 negate function"; + outMat.negate(); + ExpectEq(outMat.m[0] == -6, true); + outMat.multiply(2); + outMat = outMat.getNegated(); + ExpectEq(outMat.m[0] == 12, true); + // rotate + logLabel = "test the mat4 rotate function"; + outMat.setIdentity(); + cc::Quaternion rotateQuat(3, 0, 0, 1); + outMat.rotate(rotateQuat); + ExpectEq(outMat.m[5] == -17 && outMat.m[9] == -6, true); + outMat.setIdentity(); + cc::Vec3 rAxis(1, 0, 0); + outMat.rotate(rAxis, cc::math::PI_DIV2); + ExpectEq(IsEqualF(outMat.m[0], 1) && outMat.m[9] == -1, true); + outMat.setIdentity(); + outMat.rotateX(cc::math::PI_DIV2); + ExpectEq(IsEqualF(outMat.m[0], 1) && outMat.m[9] == -1, true); + outMat.setIdentity(); + outMat.rotateY(cc::math::PI_DIV2); + ExpectEq(IsEqualF(outMat.m[2], -1), true); + outMat.setIdentity(); + outMat.rotateZ(cc::math::PI_DIV2); + ExpectEq(outMat.m[4] == -1, true); + // scale + logLabel = "test the mat4 scale function"; + outMat.setIdentity(); + outMat.scale(6); + ExpectEq(outMat.m[0] == 6 && outMat.m[5] == 6, true); + outMat.setIdentity(); + outMat.scale(6, 4, 2); + ExpectEq(outMat.m[0] == 6 && outMat.m[5] == 4, true); + // setZero + logLabel = "test the mat4 setZero function"; + outMat.setZero(); + ExpectEq(outMat.m[0] == 0 && outMat.m[5] == 0, true); + // subtract + logLabel = "test the mat4 subtract function"; + cc::Mat4::subtract(m1, m2, &outMat); + ExpectEq(outMat.m[0] == -1, true); + // transformPoint + logLabel = "test the mat4 transformPoint function"; + cc::Vec3 transformPot(0, 3, 0); + outMat.setIdentity(); + outMat.m[13] = 2; + outMat.transformPoint(&transformPot); + ExpectEq(transformPot.y == 5, true); + // translate + logLabel = "test the mat4 translate function"; + cc::Mat4 translate; + translate.m[13] = 3; + translate.m[14] = 2; + cc::Vec3 pos(1, 2, 0); + cc::Mat4 transOut; + translate.translate(2, 3, 0); + ExpectEq(translate.m[12] = 2 && translate.m[13] == 6, true); + // transpose + logLabel = "test the mat4 transpose function"; + cc::Mat4 matTranspose(11,21,31,2, 12,22,32,4, 13,23,33,5, 0,0,0,1); + matTranspose.transpose(); + ExpectEq(matTranspose.m[1] == 21 && matTranspose.m[4] == 12 && matTranspose.m[7] == 4, true); +} + diff --git a/native/unit-test/src/math_quaternion_test.cpp b/native/unit-test/src/math_quaternion_test.cpp new file mode 100644 index 0000000000..cc24225bdd --- /dev/null +++ b/native/unit-test/src/math_quaternion_test.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +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 "gtest/gtest.h" +#include "cocos/math/Vec3.h" +#include "cocos/math/Vec4.h" +#include "cocos/math/Mat3.h" +#include "cocos/math/Mat4.h" +#include "cocos/math/Math.h" +#include "cocos/math/Quaternion.h" +#include "utils.h" +#include + +TEST(mathQuaternionTest, test6) { + // identity + logLabel = "test the quaternion identity function"; + cc::Quaternion quat(1,2,1,1); + quat = cc::Quaternion::identity(); + ExpectEq(quat.x == 0 && quat.y == 0 && quat.z == 0 && quat.w == 1, true); + // isIdentity + logLabel = "test the quaternion isIdentity function"; + quat.set(5, 10, 10, 2); + quat.setIdentity(); + ExpectEq(quat.isIdentity(), true); + // zero + logLabel = "test the quaternion zero function"; + cc::Quaternion zero(1,2,1,1); + zero = cc::Quaternion::zero(); + ExpectEq(zero.x == 0 && zero.y == 0 && zero.z == 0 && zero.w == 0, true); + // isZero + logLabel = "test the quaternion isZero function"; + ExpectEq(zero.isZero(), true); + // createFromRotationMatrix + logLabel = "test the quaternion createFromRotationMatrix function"; + cc::Mat4 rotMat; + rotMat.m[0] = cos(cc::math::PI_DIV2); + rotMat.m[2] = sin(cc::math::PI_DIV2); + rotMat.m[8] = -sin(cc::math::PI_DIV2); + rotMat.m[10] = cos(cc::math::PI_DIV2); + cc::Quaternion::createFromRotationMatrix(rotMat, &quat); + ExpectEq(IsEqualF(-0.707106, quat.y), true); + // createFromAxisAngle + logLabel = "test the quaternion createFromAxisAngle function"; + cc::Vec3 axis(0, 1, 0); + cc::Quaternion::createFromAxisAngle(axis, cc::math::PI_DIV2, &quat); + ExpectEq(IsEqualF(0.707106, quat.y), true); + // conjugate + logLabel = "test the quaternion conjugate function"; + quat.set(1, 2, 1, 1); + quat.conjugate(); + ExpectEq(quat.x == -1 && quat.y == -2 && quat.z == -1, true); + quat = quat.getConjugated(); + ExpectEq(quat.x == 1 && quat.y == 2 && quat.z == 1, true); + // inverse + logLabel = "test the quaternion inverse function"; + quat.inverse(); + ExpectEq(IsEqualF(-0.142857149, quat.x) && IsEqualF(-0.142857149, quat.z), true); + quat = quat.getInversed(); + ExpectEq(IsEqualF(1, quat.x) && IsEqualF(1, quat.z), true); + // multiply + logLabel = "test the quaternion multiply function"; + cc::Quaternion mul(3, 2, 0, 1); + quat.multiply(mul); + ExpectEq(IsEqualF(2, quat.x) && IsEqualF(-3, quat.z), true); + // normalize + logLabel = "test the quaternion normalize function"; + quat.normalize(); + ExpectEq(IsEqualF(0.20203051, quat.x) && IsEqualF(-0.30304575, quat.z), true); + quat = quat.getNormalized(); + ExpectEq(IsEqualF(0.20203051, quat.x) && IsEqualF(-0.30304575, quat.z), true); + // toAxisAngle + logLabel = "test the quaternion toAxisAngle function"; + cc::Vec3 e; + quat.toAxisAngle(&e); + ExpectEq(IsEqualF(0.254000247, e.x) && IsEqualF(-0.38100034, e.z), true); + // lerp + logLabel = "test the quaternion lerp function"; + cc::Quaternion q1(5, 2, 1, 1); + cc::Quaternion q2(10, 0, 0, 1); + cc::Quaternion::lerp(q1, q2, 0.5, &quat); + ExpectEq(IsEqualF(7.5, quat.x) && IsEqualF(0.5, quat.z), true); + // slerp + logLabel = "test the quaternion slerp function"; + q1.set(1, 2, 10, 1); + q2.set(30, 10, 20, 1); + cc::Quaternion::slerp(q1, q2, 0, &quat); + ExpectEq(IsEqualF(1, quat.x) && IsEqualF(10, quat.z), true); + + +} + diff --git a/native/cocos/renderer/gfx-gles2/GLES2Fence.h b/native/unit-test/src/math_utils_test.cpp similarity index 63% rename from native/cocos/renderer/gfx-gles2/GLES2Fence.h rename to native/unit-test/src/math_utils_test.cpp index 5371712681..229fc9900e 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Fence.h +++ b/native/unit-test/src/math_utils_test.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -21,30 +21,24 @@ 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 CC_GFXGLES2_FENCE_H_ -#define CC_GFXGLES2_FENCE_H_ +#include "gtest/gtest.h" +#include "cocos/math/Vec2.h" +#include "cocos/math/Math.h" +#include "cocos/math/MathUtil.h" +#include "utils.h" +#include +#include -namespace cc { -namespace gfx { - -class GLES2GPUFence; - -class CC_GLES2_API GLES2Fence final : public Fence { -public: - GLES2Fence(Device *device); - ~GLES2Fence(); - -public: - virtual bool initialize(const FenceInfo &info) override; - virtual void destroy() override; - virtual void wait() override; - virtual void reset() override; - -private: - GLES2GPUFence *_gpuFence = nullptr; -}; - -} // namespace gfx -} // namespace cc - -#endif +TEST(mathUtilsTest, test9) { + // smooth + logLabel = "test the MathUtil smooth function"; + float startP = 3; + cc::MathUtil::smooth(&startP, 10, 0.3, 0.7); + ExpectEq(IsEqualF(startP, 5.1), true); + cc::MathUtil::smooth(&startP, 10, 0.6, 0.4, 0.9); + ExpectEq(IsEqualF(startP, 8.039999), true); + // lerp + logLabel = "test the MathUtil lerp function"; + float res = cc::MathUtil::lerp(2, 15, 0.8); + ExpectEq(IsEqualF(res, 12.3999996), true); +} \ No newline at end of file diff --git a/native/unit-test/src/math_vec2_test.cpp b/native/unit-test/src/math_vec2_test.cpp index 2e3bd94a05..12a2e3489a 100644 --- a/native/unit-test/src/math_vec2_test.cpp +++ b/native/unit-test/src/math_vec2_test.cpp @@ -23,9 +23,117 @@ THE SOFTWARE. ****************************************************************************/ #include "gtest/gtest.h" #include "cocos/math/Vec2.h" +#include "utils.h" +#include TEST(mathVec2Test, test1) { - cc::Vec2 vec2(1, 2); + cc::Vec2 vec2(1, 2); - EXPECT_EQ(vec2.isZero(), false); + EXPECT_EQ(vec2.isZero(), false); + // isZero + logLabel = "test whether vec2 is 0"; + ExpectEq(vec2.isZero(), false); + vec2.set(0, 0); + ExpectEq(vec2.isZero(), true); + vec2.set(1, 1); + vec2.setZero(); + ExpectEq(vec2.isZero(), true); + // isOne + logLabel = "test whether vec2 is 1"; + ExpectEq(vec2.isOne(), false); + vec2.set(1, 1); + ExpectEq(vec2.isOne(), true); + vec2.set(1.1f, 1.0f); + ExpectEq(vec2.isOne(), false); + // angle + logLabel = "test the vec2 angle function"; + ExpectEq(IsEqualF(vec2.angle(cc::Vec2(2, 0), cc::Vec2(-2, 0)), M_PI), true); + ExpectEq(IsEqualF(vec2.angle(cc::Vec2(2, 0), cc::Vec2(0, 2)), M_PI * 0.5f), true); + ExpectEq(IsEqualF(vec2.angle(cc::Vec2(2, 0), cc::Vec2(0, -2)), M_PI * 0.5f), true); + vec2.set(2, 0); + ExpectEq(IsEqualF(vec2.getAngle(), 0), true); + ExpectEq(IsEqualF(vec2.getAngle(cc::Vec2(0, 2)), M_PI * 0.5f), true); + cc::Vec2 rtVec = vec2.rotateByAngle(cc::Vec2(0, 0), M_PI * 0.5); + ExpectEq(IsEqualF(rtVec.x, 0) && IsEqualF(rtVec.y, 2), true); + // add + logLabel = "test the vec2 add function"; + vec2.set(3.9, 1.3); + vec2.add(cc::Vec2(2.1f, 1.7f)); + ExpectEq(vec2 == cc::Vec2(6, 3), true); + cc::Vec2::add(cc::Vec2(6, 3), cc::Vec2(2, 1), &vec2); + ExpectEq(vec2 == cc::Vec2(8, 4), true); + // clamp + logLabel = "test the vec2 clamp function"; + vec2.clamp(cc::Vec2(3, 1), cc::Vec2(6, 2)); + ExpectEq(vec2 == cc::Vec2(6, 2), true); + cc::Vec2::clamp(cc::Vec2(6, 2), cc::Vec2(7, 1), cc::Vec2(11, 3), &vec2); + ExpectEq(vec2 == cc::Vec2(7, 2), true); + // distance + logLabel = "test the vec2 distance function"; + cc::Vec2 distVec(10, 2); + float dist = vec2.distance(distVec); + ExpectEq(IsEqualF(dist, 3), true); + dist = vec2.getDistance(distVec); + ExpectEq(IsEqualF(dist, 3), true); + dist = vec2.distanceSquared(distVec); + ExpectEq(IsEqualF(dist, 9), true); + dist = vec2.getDistanceSq(distVec); + ExpectEq(IsEqualF(dist, 9), true); + // dot + logLabel = "test the vec2 dot function"; + cc::Vec2 dotVec2(2, 3); + float dotRes = vec2.dot(dotVec2); + ExpectEq(IsEqualF(dotRes, 20), true); + dotRes = cc::Vec2::dot(vec2, dotVec2); + ExpectEq(IsEqualF(dotRes, 20), true); + // length + logLabel = "test the vec2 length function"; + vec2.set(8, 6); + ExpectEq(IsEqualF(vec2.length(), 10), true); + // normalize + logLabel = "test whether vec2 is normalized"; + vec2.normalize(); + ExpectEq(IsEqualF(vec2.length(), 1.0f), true); + vec2.set(1, 0); + ExpectEq(IsEqualF(vec2.length(), 1.0f), true); + vec2.set(0.345, 123.34); + vec2.normalize(); + ExpectEq(IsEqualF(vec2.length(), 1.0f), true); + // rotate + logLabel = "test whether vec2 rotate function"; + vec2.set(3, 0); + vec2.rotate(cc::Vec2(0, 0), M_PI * 0.5f); + ExpectEq(IsEqualF(vec2.x, 0) && IsEqualF(vec2.y, 3), true); + // subtract + logLabel = "test whether vec2 subtract function"; + vec2.set(4, 5); + vec2.subtract(cc::Vec2(1, 2)); + ExpectEq(vec2 == cc::Vec2(3, 3), true); + cc::Vec2::subtract(cc::Vec2(4, 5), cc::Vec2(1, 2), &vec2); + ExpectEq(vec2 == cc::Vec2(3, 3), true); + // equals + logLabel = "test whether vec2 equals function"; + vec2.set(4, 5); + ExpectEq(vec2.equals(cc::Vec2(4, 5)), true); + ExpectEq(vec2.fuzzyEquals(cc::Vec2(3.2, 4.3), 1), true); + // isLineIntersect + logLabel = "test whether vec2 isLineIntersect function"; + ExpectEq(cc::Vec2::isLineIntersect(cc::Vec2(0, 1), cc::Vec2(3, 1), cc::Vec2(0, 0), cc::Vec2(1, -1)), true); + // isSegmentIntersect + logLabel = "test whether vec2 isSegmentIntersect function"; + ExpectEq(cc::Vec2::isSegmentIntersect(cc::Vec2(0, 1), cc::Vec2(3, 1), cc::Vec2(0, 1), cc::Vec2(1, -1)), true); + // isLineParallel + logLabel = "test whether vec2 isLineParallel function"; + ExpectEq(cc::Vec2::isLineParallel(cc::Vec2(0, 1), cc::Vec2(3, 1), cc::Vec2(0, -1), cc::Vec2(2, -1)), true); + // isLineOverlap + logLabel = "test whether vec2 isLineOverlap function"; + ExpectEq(cc::Vec2::isLineOverlap(cc::Vec2(0, 1), cc::Vec2(3, 1), cc::Vec2(-1, 1), cc::Vec2(0, 1)), true); + // isSegmentOverlap + logLabel = "test whether vec2 isSegmentOverlap function"; + cc::Vec2 s(0, 0); + cc::Vec2 t(0, 0); + ExpectEq(cc::Vec2::isSegmentOverlap(cc::Vec2(0, 1), cc::Vec2(3, 1), cc::Vec2(-1, 1), cc::Vec2(0, 1), &s, &t), true); + // getIntersectPoint + logLabel = "test whether vec2 getIntersectPoint function"; + ExpectEq(cc::Vec2::getIntersectPoint(cc::Vec2(0, 1), cc::Vec2(3, 1), cc::Vec2(0, 1), cc::Vec2(1, -1)) == cc::Vec2(0, 1), true); } diff --git a/native/unit-test/src/math_vec3_test.cpp b/native/unit-test/src/math_vec3_test.cpp new file mode 100644 index 0000000000..5306ead391 --- /dev/null +++ b/native/unit-test/src/math_vec3_test.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +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 "gtest/gtest.h" +#include "cocos/math/Vec3.h" +#include "cocos/math/Mat3.h" +#include "cocos/math/Mat4.h" +#include "cocos/math/Quaternion.h" +#include "utils.h" +#include + +TEST(mathVec3Test, test2) { + cc::Vec3 vec3(1, 2, 3); + // isZero + logLabel = "test whether vec3 is 0"; + ExpectEq(vec3.isZero(), false); + vec3.set(0, 0, 0); + ExpectEq(vec3.isZero(), true); + vec3.set(1, 1, 1); + vec3.setZero(); + ExpectEq(vec3.isZero(), true); + // isOne + logLabel = "test whether vec3 is 1"; + ExpectEq(vec3.isOne(), false); + vec3.set(1, 1, 1); + ExpectEq(vec3.isOne(), true); + vec3.set(1.1f, 1.0f, 1.0f); + ExpectEq(vec3.isOne(), false); + // angle + logLabel = "test the vec3 angle function"; + ExpectEq(IsEqualF(vec3.angle(cc::Vec3(2, 0, 0), cc::Vec3(-2, 0, 0)), M_PI), true); + ExpectEq(IsEqualF(vec3.angle(cc::Vec3(2, 0, 0), cc::Vec3(0, 2, 0)), M_PI * 0.5f), true); + ExpectEq(IsEqualF(vec3.angle(cc::Vec3(2, 0, 0), cc::Vec3(0, -2, 0)), M_PI * 0.5f), true); + // add + logLabel = "test the vec3 add function"; + vec3.set(3.9, 1.3, 0); + vec3.add(cc::Vec3(2.1f, 1.7f, 0)); + ExpectEq(vec3 == cc::Vec3(6, 3, 0), true); + cc::Vec3::add(cc::Vec3(6, 3, 0), cc::Vec3(2, 1, 0), &vec3); + ExpectEq(vec3 == cc::Vec3(8, 4, 0), true); + // clamp + logLabel = "test the vec3 clamp function"; + vec3.clamp(cc::Vec3(3, 1, 0), cc::Vec3(6, 2, 0)); + ExpectEq(vec3 == cc::Vec3(6, 2, 0), true); + cc::Vec3::clamp(cc::Vec3(6, 2, 0), cc::Vec3(7, 1, 0), cc::Vec3(11, 3, 0), &vec3); + ExpectEq(vec3 == cc::Vec3(7, 2, 0), true); + // cross + logLabel = "test the vec3 cross function"; + vec3.set(1, 2, 3); + vec3.cross(cc::Vec3(3, 2, 1)); + ExpectEq(vec3 == cc::Vec3(-4, 8, -4), true); + vec3.set(0, 0, 0); + cc::Vec3::cross(cc::Vec3(1, 2, 3), cc::Vec3(3, 2, 1), &vec3); + ExpectEq(vec3 == cc::Vec3(-4, 8, -4), true); + // multiply + logLabel = "test the vec3 multiply function"; + vec3.set(1, 3, 2); + vec3.multiply(cc::Vec3(4, 7, 9)); + ExpectEq(vec3 == cc::Vec3(4, 21, 18), true); + cc::Vec3::multiply(cc::Vec3(1, 3, 2), cc::Vec3(4, 7, 9), &vec3); + ExpectEq(vec3 == cc::Vec3(4, 21, 18), true); + // transformMat3 + logLabel = "test the vec3 transformMat3 function"; + cc::Mat3 matScale; + matScale.m[0] = 2; + matScale.m[4] = 1; + matScale.m[8] = 2; + vec3.transformMat3(cc::Vec3(1, 1, 2), matScale); + ExpectEq(vec3 == cc::Vec3(2, 1, 4), true); + // transformMat4 + logLabel = "test the vec3 transformMat4 function"; + cc::Mat4 matTranslate; + matTranslate.m[12] = 2; + matTranslate.m[13] = 1; + matTranslate.m[14] = 2; + vec3.transformMat4(cc::Vec3(1, 1, 2), matTranslate); + ExpectEq(vec3 == cc::Vec3(3, 2, 4), true); + // transformQuat + logLabel = "test the vec3 transformQuat function"; + cc::Quaternion quaternion(10, 0, 0, 0); + vec3.transformQuat(quaternion); + ExpectEq(vec3 == cc::Vec3(300, -200, -400), true); + // distance + logLabel = "test the vec3 distance function"; + vec3.set(7, 2, 0); + cc::Vec3 distVec(10, 2, 0); + float dist = vec3.distance(distVec); + ExpectEq(IsEqualF(dist, 3), true); + dist = vec3.distanceSquared(distVec); + ExpectEq(IsEqualF(dist, 9), true); + // dot + logLabel = "test the vec3 dot function"; + cc::Vec3 dotVec3(2, 3, 0); + float dotRes = vec3.dot(dotVec3); + ExpectEq(IsEqualF(dotRes, 20), true); + dotRes = cc::Vec3::dot(vec3, dotVec3); + ExpectEq(IsEqualF(dotRes, 20), true); + // length + logLabel = "test the vec3 length function"; + vec3.set(8, 6, 0); + ExpectEq(IsEqualF(vec3.length(), 10), true); + // normalize + logLabel = "test whether vec3 is normalized"; + vec3.normalize(); + ExpectEq(IsEqualF(vec3.length(), 1.0f), true); + vec3.set(1, 0, 0); + ExpectEq(IsEqualF(vec3.length(), 1.0f), true); + vec3.set(0.345, 123.34, 0); + vec3.normalize(); + ExpectEq(IsEqualF(vec3.length(), 1.0f), true); + vec3.set(10.345, 12.675, 20.231); + vec3 = vec3.getNormalized(); + ExpectEq(IsEqualF(vec3.length(), 1.0f), true); + // subtract + logLabel = "test whether vec3 subtract function"; + vec3.set(4, 5, 0); + vec3.subtract(cc::Vec3(1, 2, 0)); + ExpectEq(vec3 == cc::Vec3(3, 3, 0), true); + cc::Vec3::subtract(cc::Vec3(4, 5, 0), cc::Vec3(1, 2, 0), &vec3); + ExpectEq(vec3 == cc::Vec3(3, 3, 0), true); + // max + logLabel = "test whether vec3 max function"; + cc::Vec3::max(cc::Vec3(10, 1, 5), cc::Vec3(11, 3, 2), &vec3); + ExpectEq(vec3 == cc::Vec3(11, 3, 5), true); + // min + logLabel = "test whether vec3 min function"; + cc::Vec3::min(cc::Vec3(10, 1, 5), cc::Vec3(11, 3, 2), &vec3); + ExpectEq(vec3 == cc::Vec3(10, 1, 2), true); + // smooth + logLabel = "test whether vec3 smooth function"; + vec3.set(2, 0, 0); + vec3.smooth(cc::Vec3(-1, 0, 0), 0.5, 0.5); + ExpectEq(vec3 == cc::Vec3(0.5, 0, 0), true); + // fromColor + logLabel = "test whether vec3 fromColor function"; + vec3 = cc::Vec3::fromColor(255); + ExpectEq(vec3.z == 1, true); +} + diff --git a/native/unit-test/src/math_vec4_test.cpp b/native/unit-test/src/math_vec4_test.cpp new file mode 100644 index 0000000000..7ae41df1b4 --- /dev/null +++ b/native/unit-test/src/math_vec4_test.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +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 "gtest/gtest.h" +#include "cocos/math/Vec4.h" +#include "utils.h" +#include + +TEST(mathVec4Test, test3) { + cc::Vec4 vec4(1, 2, 3, 1); + // isZero + logLabel = "test whether vec4 is 0"; + ExpectEq(vec4.isZero(), false); + vec4.set(0, 0, 0, 0); + ExpectEq(vec4.isZero(), true); + vec4.set(1, 2, 1, 1); + ExpectEq(vec4.isZero(), false); + // isOne + logLabel = "test whether vec4 is 1"; + vec4.set(2, 1, 1, 1); + ExpectEq(vec4.isOne(), false); + vec4.set(1, 1, 1, 1); + ExpectEq(vec4.isOne(), true); + vec4.set(1.1f, 1.0f, 1.0f, 1.0f); + ExpectEq(vec4.isOne(), false); + // angle + logLabel = "test the vec4 angle function"; + ExpectEq(IsEqualF(vec4.angle(cc::Vec4(2, 0, 0, 0), cc::Vec4(-2, 0, 0, 0)), M_PI), true); + ExpectEq(IsEqualF(vec4.angle(cc::Vec4(2, 0, 0, 0), cc::Vec4(0, 2, 0, 0)), M_PI * 0.5f), true); + ExpectEq(IsEqualF(vec4.angle(cc::Vec4(2, 0, 0, 0), cc::Vec4(0, -2, 0, 0)), M_PI * 0.5f), true); + // add + logLabel = "test the vec4 add function"; + vec4.set(3.9, 1.3, 0, 0); + vec4.add(cc::Vec4(2.1f, 1.7f, 0, 0)); + ExpectEq(vec4 == cc::Vec4(6, 3, 0, 0), true); + cc::Vec4::add(cc::Vec4(6, 3, 0, 0), cc::Vec4(2, 1, 0, 1), &vec4); + ExpectEq(vec4 == cc::Vec4(8, 4, 0, 1), true); + // clamp + logLabel = "test the vec4 clamp function"; + vec4.clamp(cc::Vec4(3, 1, 0, 1), cc::Vec4(6, 2, 0, 1)); + ExpectEq(vec4 == cc::Vec4(6, 2, 0, 1), true); + cc::Vec4::clamp(cc::Vec4(6, 2, 0, 1), cc::Vec4(7, 1, 0, 1), cc::Vec4(11, 3, 0, 1), &vec4); + ExpectEq(vec4 == cc::Vec4(7, 2, 0, 1), true); + // distance + logLabel = "test the vec4 distance function"; + vec4.set(7, 2, 0, 1); + cc::Vec4 distVec(10, 2, 0, 1); + float dist = vec4.distance(distVec); + ExpectEq(IsEqualF(dist, 3), true); + dist = vec4.distanceSquared(distVec); + ExpectEq(IsEqualF(dist, 9), true); + // dot + logLabel = "test the vec4 dot function"; + vec4.set(3, 5, 0, 0); + cc::Vec4 dotVec4(2, 3, 0, 0); + float dotRes = vec4.dot(dotVec4); + ExpectEq(IsEqualF(dotRes, 21), true); + dotRes = cc::Vec4::dot(vec4, dotVec4); + ExpectEq(IsEqualF(dotRes, 21), true); + // length + logLabel = "test the vec4 length function"; + vec4.set(8, 6, 0, 0); + ExpectEq(IsEqualF(vec4.length(), 10), true); + // normalize + logLabel = "test whether vec4 is normalized"; + vec4.normalize(); + ExpectEq(IsEqualF(vec4.length(), 1.0f), true); + vec4.set(1, 0, 0, 1); + vec4.normalize(); + ExpectEq(IsEqualF(vec4.length(), 1.0f), true); + vec4.set(0.345, 123.34, 0, 1); + vec4.normalize(); + ExpectEq(IsEqualF(vec4.length(), 1.0f), true); + vec4.set(10.345, 12.675, 20.231, 1); + vec4 = vec4.getNormalized(); + ExpectEq(IsEqualF(vec4.length(), 1.0f), true); + // subtract + logLabel = "test whether vec4 subtract function"; + vec4.set(4, 5, 0, 1); + vec4.subtract(cc::Vec4(1, 2, 0, 1)); + ExpectEq(vec4 == cc::Vec4(3, 3, 0, 0), true); + cc::Vec4::subtract(cc::Vec4(4, 5, 0, 1), cc::Vec4(1, 2, 0, 1), &vec4); + ExpectEq(vec4 == cc::Vec4(3, 3, 0, 0), true); + // fromColor + logLabel = "test whether vec3 fromColor function"; + vec4 = cc::Vec4::fromColor(255); + ExpectEq(vec4.w == 1, true); +} + diff --git a/native/cocos/renderer/core/CoreStd.h b/native/unit-test/src/math_vertex_test.cpp similarity index 58% rename from native/cocos/renderer/core/CoreStd.h rename to native/unit-test/src/math_vertex_test.cpp index b995c76bd5..8d5e800b58 100644 --- a/native/cocos/renderer/core/CoreStd.h +++ b/native/unit-test/src/math_vertex_test.cpp @@ -1,5 +1,5 @@ /**************************************************************************** -Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -21,45 +21,34 @@ 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 CC_CORE_CORE_STD_H_ -#define CC_CORE_CORE_STD_H_ - -#include "base/Macros.h" - -// STD including -#include -#include -#include +#include "gtest/gtest.h" +#include "cocos/math/Vec2.h" +#include "cocos/math/Math.h" +#include "cocos/math/Vertex.h" +#include "utils.h" #include -#include -#include -#include -#include - -// STL including -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "base/TypeDef.h" -#include "base/memory/Memory.h" -#include "math/Math.h" -#include "base/Log.h" -#include "base/Object.h" -#include "gfx/GFXObject.h" +TEST(mathVertexTest, test8) { + // ccVertexLineToPolygon + logLabel = "test the vertex ccVertexLineToPolygon function"; + cc::Vec2 points[4]; + cc::Vec2 p1(1, 1); + points[0] = p1; + cc::Vec2 p2(10, 10); + points[1] = p2; + cc::Vec2 p3(0, -10); + points[2] = p3; + cc::Vec2 p4(20, 70); + points[3] = p4; + cc::Vec2 outP[6]; + cc::ccVertexLineToPolygon(points, 1, outP, 0, 5); + ExpectEq(IsEqualF(outP[5].x, -0.468942523) && IsEqualF(outP[5].y, -9.82652664), true); + // ccVertexLineIntersect + logLabel = "test the vertex ccVertexLineIntersect function"; + float res; + bool isFind = cc::ccVertexLineIntersect(5, 5, 1, 10, 12, 20, 12, 40, &res); + ExpectEq(isFind, true); + +} -#endif // CC_CORE_CORE_STD_H_ diff --git a/native/cocos/base/Random.cpp b/native/unit-test/src/utils.h similarity index 80% rename from native/cocos/base/Random.cpp rename to native/unit-test/src/utils.h index 97b35770cf..de56c7fe26 100644 --- a/native/cocos/base/Random.cpp +++ b/native/unit-test/src/utils.h @@ -1,7 +1,5 @@ /**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2021 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -23,5 +21,12 @@ 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 "base/Random.h" +#pragma once +#include "cocos/math/Math.h" +static std::string logLabel; +static bool IsEqualF(float l, float r) { + return cc::math::IsEqualF(l, r); +}; +static void ExpectEq(bool lf, bool rt) { + EXPECT_EQ(lf, rt) << "ERROR in: " < CMakeLists.txt +cmake -Bbuild -DCC_USE_GLES2=ON -DCC_USE_VULKAN=ON -DCC_USE_GLES3=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_TOOLCHAIN_FILE="$ndk_path/build/cmake/android.toolchain.cmake" -DANDROID_PLATFORM=android-21 -G"Unix Makefiles" +mv CMakeLists-bak.txt CMakeLists.txt +cp build/compile_commands.json . diff --git a/native/utils/generate_compile_commands_android_windows.sh b/native/utils/generate_compile_commands_android_windows.sh new file mode 100755 index 0000000000..74a01514a0 --- /dev/null +++ b/native/utils/generate_compile_commands_android_windows.sh @@ -0,0 +1,17 @@ +if [ $# -ne 0 ]; then + ndk_path=$1 +elif [ -n "$ANDROID_NDK_HOME" ]; then + ndk_path=$ANDROID_NDK_HOME +elif [ -n "$ANDROID_NDK_ROOT" ]; then + ndk_path=$ANDROID_NDK_ROOT +elif [ -n "$NDK_ROOT" ]; then + ndk_path=$NDK_ROOT +else + echo "Cannot find NDK root path" + exit 1 +fi +cp CMakeLists.txt CMakeLists-bak.txt +cat utils/CMakeLists.header.txt CMakeLists-bak.txt > CMakeLists.txt +cmake -Bbuild -DCC_USE_GLES2=ON -DCC_USE_VULKAN=ON -DCC_USE_GLES3=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_TOOLCHAIN_FILE="$ndk_path/build/cmake/android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM="$ndk_path/prebuilt/windows-x86_64/bin/make" -DANDROID_PLATFORM=android-21 -G"Unix Makefiles" +mv CMakeLists-bak.txt CMakeLists.txt +cp build/compile_commands.json . diff --git a/native/utils/tidy-fix-commit.sh b/native/utils/tidy-fix-commit.sh new file mode 100755 index 0000000000..1aedaac23e --- /dev/null +++ b/native/utils/tidy-fix-commit.sh @@ -0,0 +1,12 @@ +if [ $# -ne 0 ]; then + commit=$1 # can also pass ranges: HEAD~3..HEAD +else + commit=HEAD +fi +changes=`git diff-tree --no-commit-id --name-only -r $commit` +filtered=`node .github/workflows/filter_by_cdb.js $changes` +if [[ "$filtered-xxx" == "-xxx" ]]; then + echo "No source to be fixed" +else + clang-tidy --format-style=file --fix $2 $filtered +fi