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 c108a999454b15af174e6adb857fc7c1e2fe48e5..e14cf986092b9c8817dcd3024e2474890734c368 100644 |
--- a/content/common/gpu/gpu_command_buffer_stub.cc |
+++ b/content/common/gpu/gpu_command_buffer_stub.cc |
@@ -27,6 +27,7 @@ |
#include "gpu/command_buffer/common/mailbox.h" |
#include "gpu/command_buffer/service/gl_context_virtual.h" |
#include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
+#include "gpu/command_buffer/service/image_factory.h" |
#include "gpu/command_buffer/service/image_manager.h" |
#include "gpu/command_buffer/service/logger.h" |
#include "gpu/command_buffer/service/mailbox_manager.h" |
@@ -140,29 +141,6 @@ DevToolsChannelData::CreateForChannel(GpuChannel* channel) { |
return new DevToolsChannelData(res.release()); |
} |
-bool IsSupportedImageFormat(const gpu::Capabilities& capabilities, |
- gfx::GpuMemoryBuffer::Format format) { |
- 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; |
-} |
- |
} // namespace |
GpuCommandBufferStub::GpuCommandBufferStub( |
@@ -979,8 +957,21 @@ void GpuCommandBufferStub::OnCreateImage(int32 id, |
return; |
} |
- if (!IsSupportedImageFormat(decoder_->GetCapabilities(), format)) { |
- LOG(ERROR) << "Image format is not supported."; |
+ if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( |
+ format, decoder_->GetCapabilities())) { |
+ LOG(ERROR) << "Format is not supported."; |
+ return; |
+ } |
+ |
+ if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(size, |
+ format)) { |
+ LOG(ERROR) << "Invalid image size for format."; |
+ return; |
+ } |
+ |
+ if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
+ internalformat, format)) { |
+ LOG(ERROR) << "Incompatible image format."; |
return; |
} |