Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metal support for cocos2d-x #19305

Merged
merged 232 commits into from Jan 18, 2019
Merged

metal support for cocos2d-x #19305

merged 232 commits into from Jan 18, 2019

Conversation

minggo
Copy link
Contributor

@minggo minggo commented Jan 18, 2019

Thanks @Mee-gu , @PatriceJiang and @drelaptop 's great work, we make cocos2d-x support metal. Currently not all features are supported, we will continue to complete it. Will create issues for missing features and known issues.

minggo and others added 30 commits October 24, 2018 16:47
【Feature】add back-end project file
…ure wrap mode, and no mipmapping for non-power-of-two texture
[Feature] according to es2.0 spec, you must use clamp-to-edge as  tex…
minggo and others added 25 commits January 9, 2019 17:00
* update cmake

* fix compile error

* update 3rd libs version
* pick: modern cmake, compile definitions improvement (cocos2d#19139)

* modern cmake, use target_compile_definitions partly

* simplify macro define, remove USE_*

* modern cmake, macro define

* add physics 2d macro define into ccConfig.h

* remove USE_CHIPMUNK macro in build.gradle

* remove CocosSelectModule.cmake

* shrink useless define

* simplify compile options config, re-add if necessary

* update external for tmp CI test

* un-quote target_compile_options value

* add "-g" parameter only when debug mode

* keep single build type when generator Xcode & VS projecy

* update external for tmp CI tes

* add static_cast<char>(-1), fix -Wc++11-narrowing

* simplify win32 compile define

* not modify code, only improve compile options

# Conflicts:
#	.gitignore
#	cmake/Modules/CocosConfigDepend.cmake
#	cocos/CMakeLists.txt
#	external/config.json
#	tests/cpp-tests/CMakeLists.txt

* modern cmake, improve cmake_compiler_flags (cocos2d#19145)

* cmake_compiler_flags

* Fix typo

* Fix typo2

* Remove chanages from Android.mk

*  correct lua template cmake build (cocos2d#19149)

* don't add -Wno-deprecated into jsb target

* correct lua template cmake build

* fix win32 lua template compile error

* prevent cmake in-source-build friendly (cocos2d#19151)

* pick: Copy resources to "Resources/" on win32 like in linux configuration

* add "/Z7" for cpp-tests on windows

* [cmake] fix iOS xcode property setting failed (cocos2d#19208)

* fix iOS xcode property setting failed

* use search_depend_libs_recursive at dlls collect

* fix typo

* [cmake] add find_host_library into iOS toolchain file (cocos2d#19230)

* pick: [lua android] use luajit & template cmake update (cocos2d#19239)

* increase cmake stability ,  remove tests/CMakeLists.txt (cocos2d#19261)

* cmake win32 Precompiled header (cocos2d#19273)

* Precompiled header

* Fix

* Precompiled header for cocos

* Precompiled header jscocos2d

* Fix for COCOS2D_DEBUG is always 1 on Android (cocos2d#19291)

Related cocos2d#19289

* little build fix, tests cpp-tests works on mac
* strict initialization for std::array

* remove proj.win32 project configs

* modern cmake, cmake_cleanup_remove_unused_variables (cocos2d#19146)

* Switch travis CI to xenial (cocos2d#19207)

* Switch travis CI to xenial

* Remove language: android

* Set language: cpp

* Fix java problem

* Update sdkmanager

* Fix sdkmanger

* next sdkmanager fix

* Remove xenial from android

* revert to sdk-tools-{system}-3859397

* Remove linux cmake install

* Update before-install.sh

* Update .travis.yml

* Simplify install-deps-linux.sh, tested on Ubuntu 16.04 (cocos2d#19212)

* Simplify install-deps-linux.sh

* Cleanup

* pick: install ninja

* update cocos2d-console submodule

* for metal-support alpha release, we only test cpp

* add HelloCpp into project(Cocos2d-x) for tmp test

* update extenal metal-support-4
* [Feature] update BindGroup

* [Feature] empty-test

* [Feature] cpp-test

* [Feature] fix GL compiler error

* [Feature] fix GL crash

* [Feature] empty-test

* [Feature] cpp-tests

* [feature] improve frameRate

* [feature] fix opengl compile error

* [feature] fix opengl compile error

* [BugFix] fix compute maxLocation error

* [Feature] update setting unifrom

* [Feature] fix namespace

* [Feature] remove unneeded code

* [Bugfix] fix project file

* [Feature] update review
* texture update

* update

* update texture

* commit

* compile on windows

* ddd

* rename

* rename methods

* no crash

* save gl

* save

* save

* rename

* move out pixel format convert functions

* metal crash

* update

* update android

* support gles compressed texture format

* support more compress format

* add more conversion methods

* ss

* save

* update conversion methods

* add PVRTC format support

* reformat

* add marco linux

* fix GL marcro

* pvrtc supported only by ios 8.0+

* remove unused cmake

* revert change

* refactor Texture2D::initWithData

* fix conversion log

* refactor Texture2D::initWithData

* remove some OpenGL constants for PVRTC

* add todo

* fix typo
* review cpp-tests, and fix part issues on start auto test

* sync png format fix: Node:Particle3D abnormal texture effects cocos2d#19204

* fix cpp-tests SpritePolygon crash, wrong png format (cocos2d#19170)

* fix wrong png convert format from sRGB to Gray

* erase plist index if all frames was erased

* test_A8.png have I8 format, fix it

* [CCSpriteCache] allow re-add plist & add testcase (cocos2d#19175)

* allow re-add plist & add testcase

* remove comments/rename method/update testcase

* fix isSpriteFramesWithFileLoaded & add testcase

* remove used variable

* remove unused variable

* fix double free issues when js/lua-tests exit on iOS (cocos2d#19236)

* disable part cases, AutoTest works without crash on mac

* update cocos2dx files json, to test cocos new next

* fix spritecache plist parsing issue (cocos2d#19269)

* [linux] Fix FileUtils::getContents with folder (cocos2d#19157)

* fix FileUtils::getContents on linux/mac

* use stat.st_mode

* simplify

* [CCFileUtils] win32 getFileSize (cocos2d#19176)

* win32 getFileSize

* fix stat

* [cpp test-Android]20:FileUtils/2 change title (cocos2d#19197)

* sync cocos2d#19200

* sync cocos2d#19231

* [android lua] improve performance of lua loader (cocos2d#19234)

* [lua] improve performance of lua loader

* remove cache fix

* Revert "fix spritecache plist parsing issue (cocos2d#19269)"

This reverts commit f3a85ec.

* remove win32 project files ref in template.json

* add metal framework lnk ref into cpp template

* test on iOS, and disable part cases

* alBufferData instead of alBufferDataStatic for small audio file on Apple (cocos2d#19227)

* changes AudioCache to use alBufferData instead of alBufferDataStatic

(also makes test 19 faster to trigger openal bugs faster)

The original problem: CrashIfClientProvidedBogusAudioBufferList
cocos2d#18948
is not happening anymore, but there's still a not very frequent issue
that makes OpenAL crash with a call stack like this.
AudioCache::readDataTask > alBufferData > CleanUpDeadBufferList

It happes more frequently when the device is "cold", which means after
half an hour of not using the device (locked).

I could not find the actual source code for iOS OpenAL, so I used the
macOS versions:
https://opensource.apple.com/source/OpenAL/OpenAL-48.7/Source/OpenAL/oalImp.cpp.auto.html

They seem to use CAGuard.h to make sure the dead buffer list
has no threading issues. I'm worried because the CAGuard code I found
has macos and win32 define but no iOS, so I'm not sure. I guess the
iOS version is different and has the guard.

I could not find a place in the code that's unprotected by the locks
except the InitializeBufferMap() which should not be called more than
once from cocos, and there's a workaround in AudioEngine-impl for it.

I reduced the occurence of the CleanUpDeadBufferList crash by moving
the guard in ~AudioCache to cover the alDeleteBuffers call.

* remove hack method "setTimeout" on audio

* AutoTest works on iOS

* support set ios deployment target for root project

* enable all texture2d cases, since Jiang have fixed
* re-add SpriteFrameCache cases

* update template file json

* Update SpriteFrameCacheTest.cpp
@minggo
Copy link
Contributor Author

minggo commented Jan 18, 2019

Known issues are here: https://github.com/cocos2d/cocos2d-x/milestone/41

@minggo
Copy link
Contributor Author

minggo commented Jan 18, 2019

Modification list:

  • support metal on mac/iOS
  • remove deprecated codes
  • remove cocosbuilder support
  • remove NDK build on Android
  • remove visual studio project files on windows

@minggo minggo merged commit 8d9bd92 into cocos2d:metal-support Jan 18, 2019
@minggo minggo added this to the metal-support milestone Jan 23, 2019
@minggo minggo deleted the metal-support branch July 22, 2019 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants