OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/resources/texture_compress/texture_compress.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 #include "cc/resources/texture_compress/atc_dxt.h" |
| 10 #include "cc/resources/texture_compress/etc1.h" |
| 11 |
| 12 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 13 #include <cpu-features.h> |
| 14 #include "cc/resources/texture_compress/arm/atc_dxt_neon.h" |
| 15 #include "cc/resources/texture_compress/arm/etc1_neon.h" |
| 16 #endif |
| 17 |
| 18 namespace cc { |
| 19 namespace texture_compress { |
| 20 |
| 21 static void TextureCompressInit(); |
| 22 |
| 23 static void CompressATC_Uninitialized(const uint8_t* src, |
| 24 uint8_t* dst, |
| 25 int width, |
| 26 int height) { |
| 27 TextureCompressInit(); |
| 28 CompressATC(src, dst, width, height); |
| 29 } |
| 30 |
| 31 static void CompressATCIA_Uninitialized(const uint8_t* src, |
| 32 uint8_t* dst, |
| 33 int width, |
| 34 int height) { |
| 35 TextureCompressInit(); |
| 36 CompressATCIA(src, dst, width, height); |
| 37 } |
| 38 |
| 39 static void CompressDXT1_Uninitialized(const uint8_t* src, |
| 40 uint8_t* dst, |
| 41 int width, |
| 42 int height) { |
| 43 TextureCompressInit(); |
| 44 CompressDXT1(src, dst, width, height); |
| 45 } |
| 46 |
| 47 static void CompressDXT5_Uninitialized(const uint8_t* src, |
| 48 uint8_t* dst, |
| 49 int width, |
| 50 int height) { |
| 51 TextureCompressInit(); |
| 52 CompressDXT5(src, dst, width, height); |
| 53 } |
| 54 |
| 55 static void CompressETC1_Uninitialized(const uint8_t* src, |
| 56 uint8_t* dst, |
| 57 int width, |
| 58 int height) { |
| 59 TextureCompressInit(); |
| 60 CompressETC1(src, dst, width, height); |
| 61 } |
| 62 |
| 63 TextureCompressFunc CompressATC = CompressATC_Uninitialized; |
| 64 TextureCompressFunc CompressATCIA = CompressATCIA_Uninitialized; |
| 65 TextureCompressFunc CompressETC1 = CompressETC1_Uninitialized; |
| 66 TextureCompressFunc CompressDXT1 = CompressDXT1_Uninitialized; |
| 67 TextureCompressFunc CompressDXT5 = CompressDXT5_Uninitialized; |
| 68 |
| 69 static void TextureCompressInit() { |
| 70 Init_ATC_DXT(); |
| 71 |
| 72 CompressATC = CompressATC_Generic; |
| 73 CompressATCIA = CompressATCIA_Generic; |
| 74 CompressETC1 = etc1::CompressTexture; |
| 75 CompressDXT1 = CompressDXT1_Generic; |
| 76 CompressDXT5 = CompressDXT5_Generic; |
| 77 |
| 78 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 79 if ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) { |
| 80 CompressATC = CompressATC_NEON; |
| 81 CompressATCIA = CompressATCIA_NEON; |
| 82 CompressETC1 = etc1_neon::CompressTexture; |
| 83 CompressDXT1 = CompressDXT1_NEON; |
| 84 CompressDXT5 = CompressDXT5_NEON; |
| 85 } |
| 86 #endif |
| 87 } |
| 88 |
| 89 } // namespace texture_compress |
| 90 } // namespace cc |
OLD | NEW |