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

Unified Diff: gpu/command_buffer/service/image_factory.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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
« no previous file with comments | « gpu/command_buffer/service/image_factory.h ('k') | gpu/command_buffer/service/shader_translator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/image_factory.cc
diff --git a/gpu/command_buffer/service/image_factory.cc b/gpu/command_buffer/service/image_factory.cc
index 1665c1eea85ce316866569cbfe3d6adf5bec27b1..9a2d458abd8cf9bf3673dcc2ab43e4e69895ee41 100644
--- a/gpu/command_buffer/service/image_factory.cc
+++ b/gpu/command_buffer/service/image_factory.cc
@@ -4,6 +4,7 @@
#include "gpu/command_buffer/service/image_factory.h"
+#include "gpu/command_buffer/common/capabilities.h"
#include "ui/gl/gl_bindings.h"
namespace gpu {
@@ -93,4 +94,52 @@ bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
}
}
+// static
+bool ImageFactory::IsGpuMemoryBufferFormatSupported(
+ gfx::GpuMemoryBuffer::Format format,
+ const gpu::Capabilities& capabilities) {
+ switch (format) {
+ case gfx::GpuMemoryBuffer::ATC:
+ case gfx::GpuMemoryBuffer::ATCIA:
+ return capabilities.texture_format_atc;
+ case gfx::GpuMemoryBuffer::BGRA_8888:
+ return capabilities.texture_format_bgra8888;
+ case gfx::GpuMemoryBuffer::DXT1:
+ return capabilities.texture_format_dxt1;
+ case gfx::GpuMemoryBuffer::DXT5:
+ return capabilities.texture_format_dxt5;
+ case gfx::GpuMemoryBuffer::ETC1:
+ return capabilities.texture_format_etc1;
+ case gfx::GpuMemoryBuffer::RGBA_8888:
+ case gfx::GpuMemoryBuffer::RGBX_8888:
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
+// static
+bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
+ const gfx::Size& size,
+ gfx::GpuMemoryBuffer::Format format) {
+ switch (format) {
+ case gfx::GpuMemoryBuffer::ATC:
+ case gfx::GpuMemoryBuffer::ATCIA:
+ case gfx::GpuMemoryBuffer::DXT1:
+ case gfx::GpuMemoryBuffer::DXT5:
+ case gfx::GpuMemoryBuffer::ETC1:
+ // Compressed images must have a width and height that's evenly divisible
+ // by the block size.
+ return size.width() % 4 == 0 && size.height() % 4 == 0;
+ case gfx::GpuMemoryBuffer::RGBA_8888:
+ case gfx::GpuMemoryBuffer::BGRA_8888:
+ case gfx::GpuMemoryBuffer::RGBX_8888:
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/image_factory.h ('k') | gpu/command_buffer/service/shader_translator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698