fix ci error

This commit is contained in:
halx99 2020-02-15 03:10:01 +08:00
parent 78f9dfa8ef
commit 8aee15f7c0
2 changed files with 9 additions and 7 deletions

View File

@ -53,7 +53,7 @@ struct TextureInfoMTL
id<MTLTexture> ensure(int index, int target); id<MTLTexture> ensure(int index, int target);
void destroy(); void destroy();
id<MTLTexture> createTexture(id<MTLDevice> mtlDevice, const TextureDescriptor& descriptor, int target) id<MTLTexture> createTexture(id<MTLDevice> mtlDevice, const TextureDescriptor& descriptor, int target);
void recreateSampler(const SamplerDescriptor &descriptor); void recreateSampler(const SamplerDescriptor &descriptor);
MTLSamplerAddressMode _sAddressMode; MTLSamplerAddressMode _sAddressMode;
@ -165,7 +165,7 @@ public:
* Get MTLSamplerState object * Get MTLSamplerState object
* @return A MTLSamplerState object. * @return A MTLSamplerState object.
*/ */
inline id<MTLSamplerState> getMTLSamplerState() const { return _mtlSamplerState; } inline id<MTLSamplerState> getMTLSamplerState() const { return _textureInfo._mtlSamplerState; }
private: private:
@ -230,7 +230,7 @@ public:
* Get MTLSamplerState object * Get MTLSamplerState object
* @return A MTLSamplerState object. * @return A MTLSamplerState object.
*/ */
inline id<MTLSamplerState> getMTLSamplerState() const { return _mtlSamplerState; } inline id<MTLSamplerState> getMTLSamplerState() const { return _textureInfo._mtlSamplerState; }
private: private:

View File

@ -121,8 +121,9 @@ Texture2DGL::Texture2DGL(const TextureDescriptor& descriptor)
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
// Listen this event to restored texture id after coming to foreground on Android. // Listen this event to restored texture id after coming to foreground on Android.
_backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*){ _backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*){
glGenTextures(1, &(this->_textureInfo.textures[0])); glGenTextures(1, &(_textureInfo.textures[0]));
_textureInfo.setTexParameters(GL_TEXTURE_2D); _textureInfo.apply(0);
_textureInfo.setCurrentTexParameters(GL_TEXTURE_2D);
// this->initWithZeros(); // this->initWithZeros();
}); });
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1); Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
@ -340,8 +341,9 @@ TextureCubeGL::TextureCubeGL(const TextureDescriptor& descriptor)
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
// Listen this event to restored texture id after coming to foreground on Android. // Listen this event to restored texture id after coming to foreground on Android.
_backToForegroundListener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom*){ _backToForegroundListener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom*){
glGenTextures(1, &(this->_textureInfo.textures[0])); glGenTextures(1, &(_textureInfo.textures[0]));
_textureInfo.setTexParameters(GL_TEXTURE_CUBE_MAP); _textureInfo.apply(0);
_textureInfo.setCurrentTexParameters(GL_TEXTURE_CUBE_MAP);
}); });
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1); Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
#endif #endif