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

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

Issue 1051503003: Add R_8 GPU memory buffers format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix validation problem in StrideInBytes. Deals with GL_RED/GL_LUMINANCE. 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
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 9a2d458abd8cf9bf3673dcc2ab43e4e69895ee41..ec67a82604db031e813417c83a4672a738d38f1b 100644
--- a/gpu/command_buffer/service/image_factory.cc
+++ b/gpu/command_buffer/service/image_factory.cc
@@ -19,6 +19,9 @@ ImageFactory::~ImageFactory() {
gfx::GpuMemoryBuffer::Format ImageFactory::ImageFormatToGpuMemoryBufferFormat(
unsigned internalformat) {
switch (internalformat) {
+ case GL_LUMINANCE:
+ case GL_R8:
+ return gfx::GpuMemoryBuffer::R_8;
case GL_RGB:
return gfx::GpuMemoryBuffer::RGBX_8888;
case GL_RGBA:
@@ -67,6 +70,7 @@ bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
case gfx::GpuMemoryBuffer::ETC1:
case gfx::GpuMemoryBuffer::RGBX_8888:
return true;
+ case gfx::GpuMemoryBuffer::R_8:
case gfx::GpuMemoryBuffer::RGBA_8888:
case gfx::GpuMemoryBuffer::BGRA_8888:
return false;
@@ -75,6 +79,7 @@ bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
return false;
case GL_RGBA:
switch (format) {
+ case gfx::GpuMemoryBuffer::R_8:
case gfx::GpuMemoryBuffer::RGBX_8888:
return false;
case gfx::GpuMemoryBuffer::ATC:
@@ -86,8 +91,9 @@ bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
case gfx::GpuMemoryBuffer::BGRA_8888:
return true;
}
- NOTREACHED();
reveman 2015/04/01 13:14:33 please keep this NOTREACHED
Daniele Castagna 2015/04/01 21:58:34 Done.
- return false;
+ case GL_LUMINANCE:
+ case GL_R8:
+ return format == gfx::GpuMemoryBuffer::R_8;
default:
NOTREACHED();
return false;
@@ -110,6 +116,7 @@ bool ImageFactory::IsGpuMemoryBufferFormatSupported(
return capabilities.texture_format_dxt5;
case gfx::GpuMemoryBuffer::ETC1:
return capabilities.texture_format_etc1;
+ case gfx::GpuMemoryBuffer::R_8:
case gfx::GpuMemoryBuffer::RGBA_8888:
case gfx::GpuMemoryBuffer::RGBX_8888:
return true;
@@ -132,6 +139,7 @@ bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
// 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::R_8:
case gfx::GpuMemoryBuffer::RGBA_8888:
case gfx::GpuMemoryBuffer::BGRA_8888:
case gfx::GpuMemoryBuffer::RGBX_8888:

Powered by Google App Engine
This is Rietveld 408576698