Commit Graph

68 Commits

Author SHA1 Message Date
oahc09 0dd67aee0b fix:android activity jni global reference leak (#13631)
* fix:android activity jni global reference leak

* improve:only release jniObjectActivity,keep classloader
add nullptr check for classloader to avoid new global reference many times
2022-12-07 11:48:03 +08:00
江战 046a2b1378 Re-impl CC_ASSERT & CC_ASSERTF (#13588) 2022-12-05 17:12:30 +08:00
James Chen 62d8b4daae Remove unused swapWindow methods. (#13356)
The operation of swapping (presenting) buffers is done in gfx::Device::present. To swap multi-systemwindows, multiple gfx swapchains need be created, and relevant gfx backend will iterate each swapchain and present them. Therefore, `swap buffers` operation doesn't need to be in SystemWindow or SystemWindowManager.

```c++
void GLES3Device::present() {
    CC_PROFILE(GLES3DevicePresent);
    auto *queue = static_cast<GLES3Queue *>(_queue);
    _numDrawCalls = queue->_numDrawCalls;
    _numInstances = queue->_numInstances;
    _numTriangles = queue->_numTriangles;

    bool isGFXDeviceNeedsPresent = _xr ? _xr->isGFXDeviceNeedsPresent(_api) : true;
    for (auto *swapchain : _swapchains) { // We iterate each swapchain and do the present thing here.
        if (isGFXDeviceNeedsPresent) _gpuContext->present(swapchain);
    }
    if (_xr) _xr->postGFXDevicePresent(_api);

    // Clear queue stats
    queue->_numDrawCalls = 0;
    queue->_numInstances = 0;
    queue->_numTriangles = 0;
}
```

Besides, `SDL_GL_SwapWindow` invocation is doing nothing on Windows & Linux platforms, it will generate an SDL an error that `The specified window isn't an OpenGL window` because GL context is not created by SDL_GL_CreateContext. We create contexts in our gfx code.

https://github.com/libsdl-org/SDL/blob/main/src/video/SDL_video.c#L4192

```c++

#define NOT_AN_OPENGL_WINDOW "The specified window isn't an OpenGL window"
int
SDL_GL_SwapWindowWithResult(SDL_Window * window)
{
    CHECK_WINDOW_MAGIC(window, -1);

    if (!(window->flags & SDL_WINDOW_OPENGL)) {
        return SDL_SetError(NOT_AN_OPENGL_WINDOW);
    }

    if (SDL_GL_GetCurrentWindow() != window) {
        return SDL_SetError("The specified window has not been made current");
    }

    return _this->GL_SwapWindow(_this, window);
}

void
SDL_GL_SwapWindow(SDL_Window * window)
{
    SDL_GL_SwapWindowWithResult(window);
}
```

Also, SDL_GL_SwapWindow could not take any effect if running on gfx Vulkan backend.

```c++
void SDLHelper::swapWindow(SDL_Window *window) {
    SDL_GL_SwapWindow(window);
}
```
2022-11-14 11:46:58 +08:00
oahc09 70b81a9d8c [feature] xr remote preview (#13247)
* feat:add xr remote preview feature

send xr device's pose info to web browser or editor

* feat:add xr remote preview feature

* fix:clang tidy error
2022-11-09 15:02:12 +08:00
江战 280fd976bc Add EventTarget & EventBus (#13100) 2022-10-28 15:44:33 +08:00
ycg 4e545eb4cb Add Hindi language. (#13084) 2022-10-19 14:32:49 +08:00
林玮 eab2d646c6 Change windowHandle to windowId when EVENT_DESTROY_WINDOW (#12848)
* Change windowHandle to windowId when EVENT_DESTROY_WINDOW

* fix: resolution issue on iOS
2022-09-22 15:45:56 +08:00
bofeng-song 82cbdfb232 fix crash while dynamic call createSurface (#12829)
* fix crash while dynamic call createSurface

* Fix the application crash when returning from the background to the foreground
2022-09-22 10:57:12 +08:00
bofeng-song 6189898878 support create surfaceview dynamically at android platform (#12551)
* support create surfaceview dynamically at android platform
2022-09-20 11:38:42 +08:00
minggo bd0fcc67c4 move cocos/core/pipeline to cocos/rendering (#12797)
* move cocos/core/pipeline to cocos/rendering
2022-09-16 16:10:26 +08:00
林玮 785fd91511 Add multi-windows support (#12243)
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com>
2022-09-15 14:55:44 +08:00
minggo aba9fdb63f Merge branch 'v3.6.1' into merge_v3.6.1 2022-09-02 20:08:18 +08:00
timlyeee 88cdfd71e3 [android] Fix local reference table overflow when use callStaticStringMethod (#12621) 2022-08-31 11:13:20 +08:00
minggo 834cfa66af Merge branch 'v3.6.1' into merge_v3.6.1 2022-08-23 14:13:02 +08:00
QingliWang 6a8f53b186 Add features for XR developement. (#12413)
* Change Android mainloop, add global config and template projects for XR.

* Change gfx/gles device's process flow for XR, working with other PRs, waiting.

* Change gfx/Vulkan device's process flow for XR, working with other PRs, waiting.

* Change render process for XR.

* Develop XR input and events.

* Develop 3D feature of UI widgets and raycast effect for XR.

Co-authored-by: fqamic <fqamic@vip.qq.com>
2022-08-22 16:34:45 +08:00
bofeng-song 9c7df0123c context2d support shadow attribute at Android platform (#12332) 2022-08-08 10:14:59 +08:00
minggo d40b8739bc Merge branch 'v3.6.0' into develop_merge_v3.6 2022-07-18 10:38:14 +08:00
bofeng-song 113fad0259 refine: rename windowHanler to windowHandle, rename onDestory to onDestroy (#11907) 2022-07-09 13:54:18 +08:00
timlyeee b43de1af07 V3.6.0 exit (#11856) 2022-07-07 14:07:47 +08:00
qiuguohua 6e693451a5 deviceevent related issues (#11308)
* dispatchOrientationChangeEvent is not called
2022-06-01 14:47:18 +08:00
James Chen 024737aebc fixed #11195: Rename cc::optional, cc::any, cc::variant to ccstd::optional, ccstd::any, ccstd::variant (#11197)
* Move Any.h/Optional.h/Variant.h to base/std and rename them to lowercase.

* fixed #11195: Rename cc::optional, cc::any, cc::variant to ccstd::optional, ccstd::any, ccstd::variant

* Format code.
2022-05-24 18:47:16 +08:00
minggo 7814949998 Merge branch 'v3.5.1' into v3.6.0_merge_v3.5.1 2022-05-24 11:53:57 +08:00
bofeng-song a2afcd2cdb disable gametick after enter background(revert to logic to version 3.4.2) (#11095) 2022-05-14 18:33:36 +08:00
James Chen d8761f60a8 Fix the linking error if audio module is disabled in project configuration. (#10940) 2022-05-05 17:58:34 +08:00
minggo 271cc5cf23 Remove some format rule (#10919)
* remove some rules
* format all codes with new format rule
2022-05-04 13:09:24 +08:00
qiuguohua 3f8f8fd65e Define CanvasTextAlign and CanvasTextBaseline enumeration in ICanvasRenderingContext2D (#10856) 2022-04-26 13:33:21 +08:00
minggo 84c27e7f71 Merge branch 'v3.5.0' into v3.6.0_merge_v3.5 2022-04-24 13:41:27 +08:00
bofeng-song ef7d80f8ae integrate game-activity (#10794) 2022-04-22 13:48:43 +08:00
qiuguohua e20e4b889e V3.5.0 Distribute touch events independently (#10712)
* Distribute touch events independently

* remove  touch event cast

* Fix the error of clang-tidy

Co-authored-by: qiuguohua <862332094@qq.com>
2022-04-10 22:10:15 +08:00
minggo ef013fc8c3 Remove ssize_t (#10664) 2022-04-07 17:17:18 +08:00
bofeng-song d8bdec5162 fix android crash due to eglSurface unavailable (#10621)
* skip setRendererAvailable &  isRendererAvailable (#10482)

* fix android crash due to eglSurface unavailable
2022-04-01 14:52:46 +08:00
minggo e849e9cd7e fix compiling and crash error 2022-03-31 14:21:06 +08:00
minggo a6bf766170 Merge branch 'v3.5.0' into v3.6_merge_v3.5 2022-03-29 18:26:40 +08:00
minggo 1a9d49e4c6 replace std::list/std::array with ccstd::list/ccstd::array (#10560)
* replace std::list/std::array with ccstd::list/ccstd::array
2022-03-29 16:36:53 +08:00
qiuguohua b6af1ada02 V3.5.0 create window (#10481)
* 1. Modify the parameters of the creation window
2. Modify the relationship between platform and interface
3. Rename vibrate to vibrator in linux and QNX

* Fix empty platform implementation

* Fix empty platform implementation

* Modify mac and ios createwindow interface

* Create a centered window by default

* Mobile platforms do not require window creation
2022-03-25 18:43:17 +08:00
Zeqiang Li e64301ad34 3.5.0 swappy (#10327)
* gles2/3 swappy
* vk swappy
* manually fallback in GL

Co-authored-by: Zeqiang Li <zeqiang-li@outlook.com.com>
2022-03-24 15:37:38 +08:00
bofeng-song d419d41944 fix elg & gl error (#10473)
* skip rendering if renderer is not available
2022-03-24 15:04:36 +08:00
Cocos Robot a2df4e4dbd [ci skip][AUTO]: Automated clang-format update: 771de57fc2c1edbaaf3ae94e77f9801b0379cc6c (#10469) (#10472)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-24 13:50:39 +08:00
minggo 7f4cb9e3b1 Remove string (#10469)
* replace std::string with ccstd::string
2022-03-24 11:53:10 +08:00
Cocos Robot 322cb0664b [ci skip][AUTO]: Automated clang-format update: b779f0a2e81e2dab3194eff8e850d5a8910c7c7a (#10459) (#10464)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-23 16:56:31 +08:00
minggo ccc84b06b6 replace std::unordered_map with ccstd::unordered_map (#10459)
* replace std::unordered_map with ccstd::unordered_map
2022-03-23 16:44:06 +08:00
Cocos Robot 24d84664f8 [ci skip][AUTO]: Automated clang-format update: 3de15842004cba2142ec0fecd82876d8f6a28236 (#10402) (#10424)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-21 16:04:49 +08:00
minggo 34bf14269c unify stl (#10402)
* add ccstd::vector
* replace cc::vector with ccstd::vector 
* replace std::vector with ccstd::vector
* do not include <vector>
2022-03-21 15:55:02 +08:00
Cocos Robot f078686229 [ci skip][AUTO]: Automated clang-format update: 65cf4e5ef0f8b518442e457f69bf41e4fa994bed (#10393) (#10408)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-21 11:22:30 +08:00
qiuguohua 94f42b3c4b Add dynamic library export macro (#10393)
* Add dynamic library export macro
2022-03-21 11:17:11 +08:00
江战 cb0618f0d4 3.5 Android: okhttp impl websockets (#10384) 2022-03-21 09:46:49 +08:00
minggo 73c303f556 Merge branch 'v3.5.0' into merge_v3.5.0 2022-03-08 14:53:00 +08:00
bofeng-song 4b92dfd675 support audiofocuschange for android (#10246)
* support audiofocuschange for android
2022-03-08 10:20:46 +08:00
Cocos Robot 2cfc659779 [ci skip][AUTO]: Automated clang-format update: dc993f3861cb486d66fd4de1de2bf861b0d97b96 (#10211) (#10222)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-02 10:17:46 +08:00
bofeng-song 141128f148 refine context2d, reduce call from native to js (#10211)
* reduce c++ callback to js
2022-03-02 09:56:00 +08:00