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