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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl.cc

Issue 916083002: Add support for compressed GPU memory buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ozone Created 5 years, 10 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: content/common/gpu/client/gpu_memory_buffer_impl.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.cc b/content/common/gpu/client/gpu_memory_buffer_impl.cc
index 4b05bbff2aa1c4ce67da55713b3d020a4a9d8f0a..e2a48beeef2854d870e46c040be833dcc15b1b57 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
@@ -8,6 +8,7 @@
#include "base/numerics/safe_math.h"
#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_image_memory.h"
#if defined(OS_MACOSX)
#include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h"
@@ -33,6 +34,7 @@ GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
callback_(callback),
mapped_(false),
destruction_sync_point_(0) {
+ DCHECK(gfx::GLImageMemory::ValidSize(size, format));
}
GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
@@ -82,6 +84,20 @@ bool GpuMemoryBufferImpl::StrideInBytes(size_t width,
size_t* stride_in_bytes) {
base::CheckedNumeric<size_t> s = width;
switch (format) {
+ case ATCIA:
+ case DXT5:
+ *stride_in_bytes = width;
+ return true;
+ case ATC:
+ case DXT1:
+ case ETC1:
+ DCHECK_EQ(width % 2, 0U);
+ s /= 2;
+ if (!s.IsValid())
+ return false;
+
+ *stride_in_bytes = s.ValueOrDie();
+ return true;
case RGBA_8888:
case RGBX_8888:
case BGRA_8888:
« no previous file with comments | « cc/test/test_gpu_memory_buffer_manager.cc ('k') | content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698