| 4965 | } |
| 4966 | |
| 4967 | void imageDecodeToRgba8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) |
| 4968 | { |
| 4969 | switch (_srcFormat) |
| 4970 | { |
| 4971 | case TextureFormat::RGBA8: |
| 4972 | { |
| 4973 | const uint32_t srcPitch = _width * 4; |
| 4974 | const uint32_t size = bx::uint32_min(srcPitch, _dstPitch); |
| 4975 | bx::memCopy(_dst, _dstPitch, _src, srcPitch, size, _height); |
| 4976 | } |
| 4977 | break; |
| 4978 | |
| 4979 | case TextureFormat::BGRA8: |
| 4980 | { |
| 4981 | const uint32_t srcPitch = _width * 4; |
| 4982 | imageSwizzleBgra8(_dst, _dstPitch, _width, _height, _src, srcPitch); |
| 4983 | } |
| 4984 | break; |
| 4985 | |
| 4986 | case TextureFormat::ASTC4x4: |
| 4987 | case TextureFormat::ASTC5x4: |
| 4988 | case TextureFormat::ASTC5x5: |
| 4989 | case TextureFormat::ASTC6x5: |
| 4990 | case TextureFormat::ASTC6x6: |
| 4991 | case TextureFormat::ASTC8x5: |
| 4992 | case TextureFormat::ASTC8x6: |
| 4993 | case TextureFormat::ASTC8x8: |
| 4994 | case TextureFormat::ASTC10x5: |
| 4995 | case TextureFormat::ASTC10x6: |
| 4996 | case TextureFormat::ASTC10x8: |
| 4997 | case TextureFormat::ASTC10x10: |
| 4998 | case TextureFormat::ASTC12x10: |
| 4999 | case TextureFormat::ASTC12x12: |
| 5000 | if (BX_ENABLED(BIMG_DECODE_ASTC) ) |
| 5001 | { |
| 5002 | const bimg::ImageBlockInfo& astcBlockInfo = bimg::getBlockInfo(_srcFormat); |
| 5003 | |
| 5004 | astcenc_config config{}; |
| 5005 | |
| 5006 | astcenc_error status = astcenc_config_init( |
| 5007 | ASTCENC_PRF_LDR |
| 5008 | , astcBlockInfo.blockWidth |
| 5009 | , astcBlockInfo.blockHeight |
| 5010 | , 1 |
| 5011 | , ASTCENC_PRE_MEDIUM |
| 5012 | , ASTCENC_FLG_DECOMPRESS_ONLY |
| 5013 | , &config |
| 5014 | ); |
| 5015 | |
| 5016 | if (status != ASTCENC_SUCCESS) |
| 5017 | { |
| 5018 | BX_TRACE("astc error in config init %s", astcenc_get_error_string(status)); |
| 5019 | imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00) ); |
| 5020 | break; |
| 5021 | } |
| 5022 | |
| 5023 | astcenc_context* context; |
| 5024 | status = astcenc_context_alloc(&config, 1, &context); |
no test coverage detected