fix crash when using compressed pixel format (#19794)

This commit is contained in:
coulsonwang 2019-06-05 09:30:16 +08:00 committed by minggo
parent 46ffa8e03d
commit 9bea7a3255
2 changed files with 2 additions and 20 deletions

View File

@ -397,9 +397,6 @@ const char* DeviceInfoMTL::getExtension() const
bool DeviceInfoMTL::checkForFeatureSupported(FeatureType feature)
{
//TODO coulsonwang, removed it later.
return false;
bool featureSupported = false;
switch (feature)
{

View File

@ -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)
{
for (uint32_t i = 0; i < length; ++i)
@ -157,8 +142,8 @@ namespace
MTLPixelFormat pixelFormat = Utils::toMTLPixelFormat(textureFormat);
uint32_t bytesPerRow = 0;
if(textureFormat >= PixelFormat::PVRTC2 &&
textureFormat <= PixelFormat::PVRTC4A)
if(textureFormat >= PixelFormat::PVRTC4 &&
textureFormat <= PixelFormat::PVRTC2A)
{
bytesPerRow = 0;
}