mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3782 from ricardoquesada/software_decoder
[ci skip]Software decoder
This commit is contained in:
commit
1db4ab9b8b
|
@ -1,3 +1,7 @@
|
|||
cocos2d-x-3.0alpha1 @??? 2013
|
||||
[all platforms]
|
||||
[FIX] Texture: use CCLOG to log when a texture is being decoded in software
|
||||
|
||||
cocos2d-x-3.0alpha0 @Sep.19 2013
|
||||
[all platforms]
|
||||
[FIX] TargetAction::reverse() works as expected
|
||||
|
|
|
@ -44,7 +44,7 @@ Configuration::Configuration()
|
|||
: _maxTextureSize(0)
|
||||
, _maxModelviewStackDepth(0)
|
||||
, _supportsPVRTC(false)
|
||||
, _supportsETC(false)
|
||||
, _supportsETC1(false)
|
||||
, _supportsS3TC(false)
|
||||
, _supportsATITC(false)
|
||||
, _supportsNPOT(false)
|
||||
|
@ -128,8 +128,8 @@ void Configuration::gatherGPUInfo()
|
|||
_valueDict->setObject(Integer::create((int)_maxSamplesAllowed), "gl.max_samples_allowed");
|
||||
#endif
|
||||
|
||||
_supportsETC = checkForGLExtension("GL_OES_compressed_ETC1_RGB8_texture");
|
||||
_valueDict->setObject(Bool::create(_supportsETC), "gl.supports_ETC");
|
||||
_supportsETC1 = checkForGLExtension("GL_OES_compressed_ETC1_RGB8_texture");
|
||||
_valueDict->setObject(Bool::create(_supportsETC1), "gl.supports_ETC1");
|
||||
|
||||
_supportsS3TC = checkForGLExtension("GL_EXT_texture_compression_s3tc");
|
||||
_valueDict->setObject(Bool::create(_supportsS3TC), "gl.supports_S3TC");
|
||||
|
@ -231,7 +231,7 @@ bool Configuration::supportsETC() const
|
|||
{
|
||||
//GL_ETC1_RGB8_OES is not defined in old opengl version
|
||||
#ifdef GL_ETC1_RGB8_OES
|
||||
return _supportsETC;
|
||||
return _supportsETC1;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -152,7 +152,7 @@ protected:
|
|||
GLint _maxTextureSize;
|
||||
GLint _maxModelviewStackDepth;
|
||||
bool _supportsPVRTC;
|
||||
bool _supportsETC;
|
||||
bool _supportsETC1;
|
||||
bool _supportsS3TC;
|
||||
bool _supportsATITC;
|
||||
bool _supportsNPOT;
|
||||
|
|
|
@ -1443,6 +1443,8 @@ bool Image::initWithETCData(const unsigned char * data, int dataLen)
|
|||
}
|
||||
else
|
||||
{
|
||||
CCLOG("cocos2d: Hardware ETC1 decoder not present. Using software decoder");
|
||||
|
||||
//if it is not gles or device do not support ETC, decode texture by software
|
||||
int bytePerPixel = 3;
|
||||
unsigned int stride = _width * bytePerPixel;
|
||||
|
@ -1533,8 +1535,6 @@ bool Image::initWithS3TCData(const unsigned char * data, int dataLen)
|
|||
if (Configuration::getInstance()->supportsS3TC())
|
||||
{ //decode texture throught hardware
|
||||
|
||||
CCLOG("this is s3tc H decode");
|
||||
|
||||
if (FOURCC_DXT1 == header->ddsd.DUMMYUNIONNAMEN4.ddpfPixelFormat.fourCC)
|
||||
{
|
||||
_renderFormat = Texture2D::PixelFormat::S3TC_DXT1;
|
||||
|
@ -1553,6 +1553,9 @@ bool Image::initWithS3TCData(const unsigned char * data, int dataLen)
|
|||
}
|
||||
else
|
||||
{ //if it is not gles or device do not support S3TC, decode texture by software
|
||||
|
||||
CCLOG("cocos2d: Hardware S3TC decoder not present. Using software decoder");
|
||||
|
||||
int bytePerPixel = 4;
|
||||
unsigned int stride = width * bytePerPixel;
|
||||
_renderFormat = Texture2D::PixelFormat::RGBA8888;
|
||||
|
@ -1682,6 +1685,8 @@ bool Image::initWithATITCData(const unsigned char *data, int dataLen)
|
|||
{
|
||||
/* if it is not gles or device do not support ATITC, decode texture by software */
|
||||
|
||||
CCLOG("cocos2d: Hardware ATITC decoder not present. Using software decoder");
|
||||
|
||||
int bytePerPixel = 4;
|
||||
unsigned int stride = width * bytePerPixel;
|
||||
_renderFormat = Texture2D::PixelFormat::RGBA8888;
|
||||
|
|
Loading…
Reference in New Issue