mirror of https://github.com/axmolengine/axmol.git
commit
363dab75c9
|
@ -112,7 +112,7 @@ std::string Configuration::getInfo() const
|
|||
void Configuration::gatherGPUInfo()
|
||||
{
|
||||
auto _deviceInfo = backend::Device::getInstance()->getDeviceInfo();
|
||||
CCLOG("weichao %s",_deviceInfo->getExtension());
|
||||
CCLOG("Supported extensions: %s",_deviceInfo->getExtension());
|
||||
|
||||
_valueDict["vendor"] = Value(_deviceInfo->getVendor());
|
||||
_valueDict["renderer"] = Value(_deviceInfo->getRenderer());
|
||||
|
|
|
@ -278,6 +278,8 @@ bool Texture2D::updateWithImage(Image* image, backend::PixelFormat format, int i
|
|||
case PixelFormat::PVRTC2:
|
||||
case PixelFormat::A8:
|
||||
case PixelFormat::ETC:
|
||||
case PixelFormat::ASTC4:
|
||||
case PixelFormat::ASTC8:
|
||||
renderFormat = imagePixelFormat;
|
||||
default:
|
||||
break;
|
||||
|
@ -324,6 +326,14 @@ bool Texture2D::updateWithImage(Image* image, backend::PixelFormat format, int i
|
|||
}
|
||||
else if (image->isCompressed())
|
||||
{
|
||||
switch (imagePixelFormat) {
|
||||
case PixelFormat::ASTC4:
|
||||
case PixelFormat::ASTC8:
|
||||
case PixelFormat::ETC:
|
||||
renderFormat = imagePixelFormat;
|
||||
default:;
|
||||
}
|
||||
|
||||
if (renderFormat != image->getPixelFormat())
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: This image is compressed and we can't convert it for now");
|
||||
|
|
|
@ -85,7 +85,7 @@ Texture2DGL::Texture2DGL(const TextureDescriptor& descriptor) : Texture2DBackend
|
|||
// Listen this event to restored texture id after coming to foreground on Android.
|
||||
_backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*){
|
||||
glGenTextures(1, &(this->_textureInfo.textures[0]));
|
||||
this->initWithZeros();
|
||||
// this->initWithZeros();
|
||||
});
|
||||
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
|
||||
#endif
|
||||
|
@ -116,7 +116,8 @@ void Texture2DGL::updateTextureDescriptor(const cocos2d::backend::TextureDescrip
|
|||
|
||||
// Update data here because `updateData()` may not be invoked later.
|
||||
// For example, a texture used as depth buffer will not invoke updateData().
|
||||
initWithZeros();
|
||||
// FIXME, Don't call, now it's unused, when the texture is compressed, initWithZeros will cause GL Error: 0x501
|
||||
// initWithZeros();
|
||||
}
|
||||
|
||||
Texture2DGL::~Texture2DGL()
|
||||
|
@ -157,6 +158,8 @@ void Texture2DGL::updateSamplerDescriptor(const SamplerDescriptor &sampler, int
|
|||
|
||||
void Texture2DGL::updateData(uint8_t* data, std::size_t width , std::size_t height, std::size_t level, int index)
|
||||
{
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
//Set the row align only when mipmapsNum == 1 and the data is uncompressed
|
||||
auto mipmapEnalbed = isMipmapEnabled(_textureInfo.minFilterGL) || isMipmapEnabled(_textureInfo.magFilterGL);
|
||||
if(!mipmapEnalbed)
|
||||
|
@ -192,6 +195,7 @@ void Texture2DGL::updateData(uint8_t* data, std::size_t width , std::size_t heig
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _textureInfo.sAddressModeGL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _textureInfo.tAddressModeGL);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
level,
|
||||
|
|
|
@ -259,6 +259,7 @@ void UtilsGL::toGLTypes(PixelFormat textureFormat, GLint &internalFormat, GLuint
|
|||
internalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
|
||||
format = 0xFFFFFFFF;
|
||||
type = 0xFFFFFFFF;
|
||||
isCompressed = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_COMPRESSED_RGBA_ASTC_8x8_KHR
|
||||
|
@ -266,6 +267,7 @@ void UtilsGL::toGLTypes(PixelFormat textureFormat, GLint &internalFormat, GLuint
|
|||
internalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
|
||||
format = 0xFFFFFFFF;
|
||||
type = 0xFFFFFFFF;
|
||||
isCompressed = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ETC1_RGB8_OES
|
||||
|
|
Loading…
Reference in New Issue