| Index: cc/resources/texture_compress/texture_compress.cc
|
| diff --git a/cc/resources/texture_compress/texture_compress.cc b/cc/resources/texture_compress/texture_compress.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..826b5c6811b8ba670d342fbe6ccef5a379d6d7da
|
| --- /dev/null
|
| +++ b/cc/resources/texture_compress/texture_compress.cc
|
| @@ -0,0 +1,90 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "cc/resources/texture_compress/texture_compress.h"
|
| +
|
| +#include "base/logging.h"
|
| +
|
| +#include "cc/resources/texture_compress/atc_dxt.h"
|
| +#include "cc/resources/texture_compress/etc1.h"
|
| +
|
| +#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
|
| +#include <cpu-features.h>
|
| +#include "cc/resources/texture_compress/arm/atc_dxt_neon.h"
|
| +#include "cc/resources/texture_compress/arm/etc1_neon.h"
|
| +#endif
|
| +
|
| +namespace cc {
|
| +namespace texture_compress {
|
| +
|
| +static void TextureCompressInit();
|
| +
|
| +static void CompressATC_Uninitialized(const uint8_t* src,
|
| + uint8_t* dst,
|
| + int width,
|
| + int height) {
|
| + TextureCompressInit();
|
| + CompressATC(src, dst, width, height);
|
| +}
|
| +
|
| +static void CompressATCIA_Uninitialized(const uint8_t* src,
|
| + uint8_t* dst,
|
| + int width,
|
| + int height) {
|
| + TextureCompressInit();
|
| + CompressATCIA(src, dst, width, height);
|
| +}
|
| +
|
| +static void CompressDXT1_Uninitialized(const uint8_t* src,
|
| + uint8_t* dst,
|
| + int width,
|
| + int height) {
|
| + TextureCompressInit();
|
| + CompressDXT1(src, dst, width, height);
|
| +}
|
| +
|
| +static void CompressDXT5_Uninitialized(const uint8_t* src,
|
| + uint8_t* dst,
|
| + int width,
|
| + int height) {
|
| + TextureCompressInit();
|
| + CompressDXT5(src, dst, width, height);
|
| +}
|
| +
|
| +static void CompressETC1_Uninitialized(const uint8_t* src,
|
| + uint8_t* dst,
|
| + int width,
|
| + int height) {
|
| + TextureCompressInit();
|
| + CompressETC1(src, dst, width, height);
|
| +}
|
| +
|
| +TextureCompressFunc CompressATC = CompressATC_Uninitialized;
|
| +TextureCompressFunc CompressATCIA = CompressATCIA_Uninitialized;
|
| +TextureCompressFunc CompressETC1 = CompressETC1_Uninitialized;
|
| +TextureCompressFunc CompressDXT1 = CompressDXT1_Uninitialized;
|
| +TextureCompressFunc CompressDXT5 = CompressDXT5_Uninitialized;
|
| +
|
| +static void TextureCompressInit() {
|
| + Init_ATC_DXT();
|
| +
|
| + CompressATC = CompressATC_Generic;
|
| + CompressATCIA = CompressATCIA_Generic;
|
| + CompressETC1 = etc1::CompressTexture;
|
| + CompressDXT1 = CompressDXT1_Generic;
|
| + CompressDXT5 = CompressDXT5_Generic;
|
| +
|
| +#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
|
| + if ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
|
| + CompressATC = CompressATC_NEON;
|
| + CompressATCIA = CompressATCIA_NEON;
|
| + CompressETC1 = etc1_neon::CompressTexture;
|
| + CompressDXT1 = CompressDXT1_NEON;
|
| + CompressDXT5 = CompressDXT5_NEON;
|
| + }
|
| +#endif
|
| +}
|
| +
|
| +} // namespace texture_compress
|
| +} // namespace cc
|
|
|