summaryrefslogtreecommitdiffstats
path: root/cc/raster/texture_compressor.cc
blob: b8992bb9eefc87013dcefba93aa1f49b24bac5de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2015 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/raster/texture_compressor.h"

#include "base/logging.h"
#include "cc/raster/texture_compressor_etc1.h"

#if defined(ARCH_CPU_X86_FAMILY)
#include "base/cpu.h"
#include "cc/raster/texture_compressor_etc1_sse.h"
#endif

namespace cc {

scoped_ptr<TextureCompressor> TextureCompressor::Create(Format format) {
  switch (format) {
    case kFormatETC1: {
#if defined(ARCH_CPU_X86_FAMILY)
      base::CPU cpu;
      if (cpu.has_sse2()) {
        return make_scoped_ptr(new TextureCompressorETC1SSE());
      }
#endif
      return make_scoped_ptr(new TextureCompressorETC1());
    }
  }

  NOTREACHED();
  return nullptr;
}

}  // namespace cc