mirror of https://github.com/axmolengine/axmol.git
fix crash when using compressed pixel format (#19794)
This commit is contained in:
parent
46ffa8e03d
commit
9bea7a3255
|
@ -397,9 +397,6 @@ const char* DeviceInfoMTL::getExtension() const
|
||||||
|
|
||||||
bool DeviceInfoMTL::checkForFeatureSupported(FeatureType feature)
|
bool DeviceInfoMTL::checkForFeatureSupported(FeatureType feature)
|
||||||
{
|
{
|
||||||
//TODO coulsonwang, removed it later.
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool featureSupported = false;
|
bool featureSupported = false;
|
||||||
switch (feature)
|
switch (feature)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,21 +41,6 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MTLSamplerMipFilter toMTLSamplerMipFilter(SamplerFilter mode) {
|
|
||||||
switch (mode) {
|
|
||||||
case SamplerFilter::NEAREST:
|
|
||||||
case SamplerFilter::LINEAR_MIPMAP_NEAREST:
|
|
||||||
case SamplerFilter::NEAREST_MIPMAP_NEAREST:
|
|
||||||
return MTLSamplerMipFilterNearest;
|
|
||||||
case SamplerFilter::LINEAR:
|
|
||||||
case SamplerFilter::LINEAR_MIPMAP_LINEAR:
|
|
||||||
case SamplerFilter::NEAREST_MIPMAP_LINEAR:
|
|
||||||
return MTLSamplerMipFilterLinear;
|
|
||||||
case SamplerFilter::DONT_CARE:
|
|
||||||
return MTLSamplerMipFilterNearest;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void convertRGB2RGBA(uint8_t* src, uint8_t* dst, uint32_t length)
|
void convertRGB2RGBA(uint8_t* src, uint8_t* dst, uint32_t length)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < length; ++i)
|
for (uint32_t i = 0; i < length; ++i)
|
||||||
|
@ -157,8 +142,8 @@ namespace
|
||||||
MTLPixelFormat pixelFormat = Utils::toMTLPixelFormat(textureFormat);
|
MTLPixelFormat pixelFormat = Utils::toMTLPixelFormat(textureFormat);
|
||||||
uint32_t bytesPerRow = 0;
|
uint32_t bytesPerRow = 0;
|
||||||
|
|
||||||
if(textureFormat >= PixelFormat::PVRTC2 &&
|
if(textureFormat >= PixelFormat::PVRTC4 &&
|
||||||
textureFormat <= PixelFormat::PVRTC4A)
|
textureFormat <= PixelFormat::PVRTC2A)
|
||||||
{
|
{
|
||||||
bytesPerRow = 0;
|
bytesPerRow = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue