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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc

Issue 1263043006: Implement the texture uploading of ASTC compression for WebGL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and Remove unnecessary enum/OES extensions. Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/numerics/safe_math.h" 8 #include "base/numerics/safe_math.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 handle.id, 89 handle.id,
90 size, 90 size,
91 format, 91 format,
92 callback, 92 callback,
93 shared_memory.Pass())); 93 shared_memory.Pass()));
94 } 94 }
95 95
96 // static 96 // static
97 bool GpuMemoryBufferImplSharedMemory::IsFormatSupported(Format format) { 97 bool GpuMemoryBufferImplSharedMemory::IsFormatSupported(Format format) {
98 switch (format) { 98 switch (format) {
99 case ASTC:
99 case ATC: 100 case ATC:
100 case ATCIA: 101 case ATCIA:
101 case DXT1: 102 case DXT1:
102 case DXT5: 103 case DXT5:
103 case ETC1: 104 case ETC1:
104 case R_8: 105 case R_8:
105 case RGBA_4444: 106 case RGBA_4444:
106 case RGBA_8888: 107 case RGBA_8888:
107 case BGRA_8888: 108 case BGRA_8888:
108 case YUV_420: 109 case YUV_420:
(...skipping 17 matching lines...) Expand all
126 } 127 }
127 NOTREACHED(); 128 NOTREACHED();
128 return false; 129 return false;
129 } 130 }
130 131
131 // static 132 // static
132 bool GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat( 133 bool GpuMemoryBufferImplSharedMemory::IsSizeValidForFormat(
133 const gfx::Size& size, 134 const gfx::Size& size,
134 Format format) { 135 Format format) {
135 switch (format) { 136 switch (format) {
137 case ASTC:
136 case ATC: 138 case ATC:
137 case ATCIA: 139 case ATCIA:
138 case DXT1: 140 case DXT1:
139 case DXT5: 141 case DXT5:
140 case ETC1: 142 case ETC1:
141 // Compressed images must have a width and height that's evenly divisible 143 // Compressed images must have a width and height that's evenly divisible
142 // by the block size. 144 // by the block size.
143 return size.width() % 4 == 0 && size.height() % 4 == 0; 145 return size.width() % 4 == 0 && size.height() % 4 == 0;
144 case R_8: 146 case R_8:
145 case RGBA_4444: 147 case RGBA_4444:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 199
198 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const { 200 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const {
199 gfx::GpuMemoryBufferHandle handle; 201 gfx::GpuMemoryBufferHandle handle;
200 handle.type = gfx::SHARED_MEMORY_BUFFER; 202 handle.type = gfx::SHARED_MEMORY_BUFFER;
201 handle.id = id_; 203 handle.id = id_;
202 handle.handle = shared_memory_->handle(); 204 handle.handle = shared_memory_->handle();
203 return handle; 205 return handle;
204 } 206 }
205 207
206 } // namespace content 208 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698