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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 916083002: Add support for compressed GPU memory buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ATC and DXT feature detection and checking 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/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 6503c679b07d4ea263806db03e53d4a18038d9b2..e7962a5dafa02202df6f43b598e4c15876792a75 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -956,6 +956,41 @@ void GpuCommandBufferStub::OnCreateImage(int32 id,
return;
}
+ bool supported_format = true;
+
+ gpu::Capabilities capabilities = decoder_->GetCapabilities();
+ switch (format) {
+ case gfx::GpuMemoryBuffer::ATC:
+ case gfx::GpuMemoryBuffer::ATCIA:
+ if (!capabilities.texture_format_atc)
+ supported_format = false;
+ break;
+ case gfx::GpuMemoryBuffer::BGRA_8888:
+ if (!capabilities.texture_format_bgra8888)
+ supported_format = false;
+ break;
+ case gfx::GpuMemoryBuffer::DXT1:
+ if (!capabilities.texture_format_dxt1)
+ supported_format = false;
+ break;
+ case gfx::GpuMemoryBuffer::DXT5:
+ if (!capabilities.texture_format_dxt5)
+ supported_format = false;
+ break;
+ case gfx::GpuMemoryBuffer::ETC1:
+ if (!capabilities.texture_format_etc1)
+ supported_format = false;
+ break;
+ case gfx::GpuMemoryBuffer::RGBA_8888:
+ case gfx::GpuMemoryBuffer::RGBX_8888:
+ break;
+ }
reveman 2015/02/13 23:51:25 Looks good. Can you just move this into a IsSuppor
christiank 2015/02/18 14:38:25 Sure! I'll fix this.
+
+ if (!supported_format) {
+ LOG(ERROR) << "Image format is not supported.";
+ return;
+ }
+
scoped_refptr<gfx::GLImage> image = channel()->CreateImageForGpuMemoryBuffer(
handle, size, format, internalformat);
if (!image.get())

Powered by Google App Engine
This is Rietveld 408576698