Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5018)

Unified Diff: cc/resources/texture_compressor.cc

Issue 1096703002: Reland: Add ETC1 powered SSE encoder for tile texture compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding unit test for texture compression Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/texture_compressor.cc
diff --git a/cc/resources/texture_compressor.cc b/cc/resources/texture_compressor.cc
index 186a47d04b65a7d9539b033a61b5c8d35c1d01f9..bd84ac6b5cbe83823d2ad570f6a6979c7128de17 100644
--- a/cc/resources/texture_compressor.cc
+++ b/cc/resources/texture_compressor.cc
@@ -4,19 +4,31 @@
#include "cc/resources/texture_compressor.h"
+#include <stdio.h>
+
+#include "base/cpu.h"
#include "base/logging.h"
#include "cc/resources/texture_compressor_etc1.h"
+#include "cc/resources/texture_compressor_etc1_sse.h"
namespace cc {
scoped_ptr<TextureCompressor> TextureCompressor::Create(Format format) {
switch (format) {
- case kFormatETC1:
- return make_scoped_ptr(new TextureCompressorETC1());
+ case kFormatETC1: {
+ scoped_ptr<TextureCompressor> compressor(new TextureCompressorETC1());
christiank 2015/04/29 12:25:45 Nit-pick, but we could avoid unnecessary allocatio
+#if defined(__i386__) || defined(__x86_x64__)
+ base::CPU cpu;
+ if (cpu.has_sse2()) {
+ compressor.reset(new TextureCompressorETC1SSE());
+ }
+#endif
+ return compressor;
+ }
+ default:
+ NOTREACHED();
+ return nullptr;
}
-
- NOTREACHED();
- return nullptr;
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698