mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
3.3 ohos fix compile error (#3586)
This commit is contained in:
@@ -70,7 +70,7 @@ int readCommand(int8_t &cmd) { //NOLINT(google-runtime-references)
|
||||
void handlePauseResume(int8_t cmd) {
|
||||
LOGV("activityState=%d", cmd);
|
||||
std::unique_lock<std::mutex> lk(cc::cocosApp.mutex);
|
||||
cc::cocosApp.activityState = cmd;
|
||||
cc::cocosApp.activityState = static_cast<uint8_t>(cmd);
|
||||
lk.unlock();
|
||||
cc::cocosApp.cond.notify_all();
|
||||
}
|
||||
@@ -138,7 +138,9 @@ void glThreadEntry() {
|
||||
postExecCmd(cmd);
|
||||
}
|
||||
|
||||
if (!cc::cocosApp.animating) continue;
|
||||
if (!cc::cocosApp.animating || APP_CMD_PAUSE == cc::cocosApp.activityState) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
if (game) {
|
||||
// Handle java events send by UI thread. Input events are handled here too.
|
||||
|
||||
@@ -73,14 +73,14 @@ bool setCanvasCallback(se::Object *global) { //NOLINT
|
||||
|
||||
namespace cc {
|
||||
|
||||
Application * Application::_instance = nullptr; //NOLINT
|
||||
std::shared_ptr<Scheduler> Application::_scheduler = nullptr; //NOLINT
|
||||
Application * Application::instance = nullptr;
|
||||
std::shared_ptr<Scheduler> Application::scheduler = nullptr;
|
||||
|
||||
Application::Application(int width, int height) {
|
||||
Application::_instance = this;
|
||||
_scheduler = std::make_shared<Scheduler>();
|
||||
_viewLogicalSize.x = static_cast<float>(width);
|
||||
_viewLogicalSize.y = static_cast<float>(height);
|
||||
Application::instance = this;
|
||||
scheduler = std::make_shared<Scheduler>();
|
||||
_viewLogicalSize.x = static_cast<float>(width);
|
||||
_viewLogicalSize.y = static_cast<float>(height);
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
@@ -95,7 +95,7 @@ Application::~Application() {
|
||||
|
||||
gfx::DeviceManager::destroy();
|
||||
|
||||
Application::_instance = nullptr;
|
||||
Application::instance = nullptr;
|
||||
}
|
||||
|
||||
bool Application::init() {
|
||||
@@ -113,6 +113,9 @@ void Application::onPause() {
|
||||
void Application::onResume() {
|
||||
}
|
||||
|
||||
void Application::onClose() {
|
||||
}
|
||||
|
||||
void Application::setPreferredFramesPerSecond(int fps) {
|
||||
if (fps == 0) {
|
||||
return;
|
||||
|
||||
@@ -151,7 +151,9 @@ void glThreadEntry() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!cc::cocosApp.animating) continue;
|
||||
if (!cc::cocosApp.animating || ABILITY_CMD_PAUSE == cc::cocosApp.activityState) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
if (game) {
|
||||
// Handle java events send by UI thread. Input events are handled here too.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,26 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS)
|
||||
#define EGL_EGL_PROTOTYPES 0
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <EGL/eglplatform.h>
|
||||
#endif
|
||||
|
||||
#define GL_GLES_PROTOTYPES 0
|
||||
#ifndef __OHOS__
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include <GLES2/gl2ext.h>
|
||||
#include <GLES2/gl2platform.h>
|
||||
#else
|
||||
#include <GLES3/gl32.h>
|
||||
#include <GLES3/gl3platform.h>
|
||||
#endif
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
bool gles2wInit();
|
||||
|
||||
#include "../gfx-gles-common/eglw.h"
|
||||
#include "../gfx-gles-common/gles2w.h"
|
||||
|
||||
bool gles2wInit();
|
||||
@@ -1943,7 +1943,9 @@ void cmdFuncGLES3BeginRenderPass(GLES3Device *device, uint subpassIdx, GLES3GPUR
|
||||
if (gpuFramebuffer->usesPLS || gpuFramebuffer->usesFBF) {
|
||||
if (subpassIdx == 0) {
|
||||
if (gpuFramebuffer->usesPLS) {
|
||||
#ifdef GL_SHADER_PIXEL_LOCAL_STORAGE_EXT //OHOS
|
||||
GL_CHECK(glEnable(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT));
|
||||
#endif
|
||||
cache->isPLSEnabled = true;
|
||||
}
|
||||
|
||||
@@ -2013,7 +2015,7 @@ void cmdFuncGLES3EndRenderPass(GLES3Device *device) {
|
||||
}
|
||||
}
|
||||
if (numAttachments) {
|
||||
GL_CHECK(glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER, numAttachments, invalidAttachments));
|
||||
GL_CHECK(glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER, numAttachments, invalidAttachments)); //NOLINT(bugprone-lambda-function-name)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2024,16 +2026,21 @@ void cmdFuncGLES3EndRenderPass(GLES3Device *device) {
|
||||
performStoreOp(attachmentIndex, glAttachmentIndex++);
|
||||
}
|
||||
performDepthStencilStoreOp();
|
||||
|
||||
#if defined(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT) //OHOS
|
||||
if (cache->isPLSEnabled) {
|
||||
GL_CHECK(glDisable(GL_SHADER_PIXEL_LOCAL_STORAGE_EXT));
|
||||
cache->isPLSEnabled = false;
|
||||
}
|
||||
#endif
|
||||
} else if (gpuFramebuffer->usesFBF) {
|
||||
if (device->extensionRegistry()->mFBF == FBFSupportLevel::NON_COHERENT_EXT) {
|
||||
#ifdef glFramebufferFetchBarrierEXT //OHOS
|
||||
GL_CHECK(glFramebufferFetchBarrierEXT());
|
||||
#endif
|
||||
} else if (device->extensionRegistry()->mFBF == FBFSupportLevel::NON_COHERENT_QCOM) {
|
||||
#ifdef glFramebufferFetchBarrierQCOM //OHOS
|
||||
GL_CHECK(glFramebufferFetchBarrierQCOM());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2046,6 +2053,7 @@ void cmdFuncGLES3EndRenderPass(GLES3Device *device) {
|
||||
}
|
||||
}
|
||||
|
||||
//NOLINTNEXTLINE
|
||||
void cmdFuncGLES3BindState(GLES3Device *device, GLES3GPUPipelineState *gpuPipelineState, GLES3GPUInputAssembler *gpuInputAssembler,
|
||||
const GLES3GPUDescriptorSet *const *gpuDescriptorSets, const uint *dynamicOffsets, const DynamicStates *dynamicStates) {
|
||||
GLES3ObjectCache &gfxStateCache = device->stateCache()->gfxStateCache;
|
||||
|
||||
@@ -611,10 +611,11 @@ bool GLES3Context::makeCurrent(bool bound) {
|
||||
GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0));
|
||||
GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0));
|
||||
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0));
|
||||
|
||||
#ifdef GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM // OHOS
|
||||
if (GLES3Device::getInstance()->extensionRegistry()->mFBF == FBFSupportLevel::NON_COHERENT_QCOM) {
|
||||
GL_CHECK(glEnable(GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM));
|
||||
}
|
||||
#endif
|
||||
|
||||
CC_LOG_DEBUG("eglMakeCurrent() - SUCCEEDED, Context: 0x%p", this);
|
||||
return true;
|
||||
|
||||
@@ -140,7 +140,9 @@ bool GLES3Device::doInit(const DeviceInfo &info) {
|
||||
} else if (*it == CC_TOSTR(GL_QCOM_shader_framebuffer_fetch_noncoherent)) {
|
||||
_gpuExtensionRegistry->mFBF = FBFSupportLevel::NON_COHERENT_QCOM;
|
||||
fbfLevelStr = "NON_COHERENT_QCOM";
|
||||
#ifdef GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM //OHOS
|
||||
GL_CHECK(glEnable(GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM));
|
||||
#endif
|
||||
}
|
||||
} else if (checkExtension(CC_TOSTR(GL_EXT_shader_framebuffer_fetch))) {
|
||||
// we only care about EXT_shader_framebuffer_fetch, the ARM version does not support MRT
|
||||
@@ -150,7 +152,7 @@ bool GLES3Device::doInit(const DeviceInfo &info) {
|
||||
}
|
||||
|
||||
// PVRVFrame has issues on their PLS support
|
||||
#if CC_PLATFORM != CC_PLATFORM_WINDOWS && CC_PLATFORM != CC_PLATFORM_MAC_OSX
|
||||
#if CC_PLATFORM != CC_PLATFORM_WINDOWS && CC_PLATFORM != CC_PLATFORM_MAC_OSX && defined(GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT) // OHOS
|
||||
if (checkExtension("pixel_local_storage")) {
|
||||
if (checkExtension("pixel_local_storage2")) {
|
||||
_gpuExtensionRegistry->mPLS = PLSSupportLevel::LEVEL2;
|
||||
|
||||
@@ -25,24 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if (CC_PLATFORM != CC_PLATFORM_MAC_IOS)
|
||||
#define EGL_EGL_PROTOTYPES 0
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <EGL/eglplatform.h>
|
||||
#endif
|
||||
|
||||
#define GL_GLES_PROTOTYPES 0
|
||||
#include <GLES3/gl32.h>
|
||||
|
||||
#ifndef __OHOS__
|
||||
#include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
#include <GLES3/gl3platform.h>
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
bool gles3wInit();
|
||||
|
||||
#include "../gfx-gles-common/eglw.h"
|
||||
#include "../gfx-gles-common/gles2w.h"
|
||||
#include "../gfx-gles-common/gles3w.h"
|
||||
|
||||
bool gles3wInit();
|
||||
Vendored
+2
-2
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"version": "v3d-gfx-45",
|
||||
"version": "v3d-gfx-47",
|
||||
"from": {
|
||||
"type": "github",
|
||||
"owner": "cocos-creator",
|
||||
"name": "engine-native-external",
|
||||
"checkout": "v3d-gfx-45"
|
||||
"checkout": "v3d-gfx-47"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user