| Index: ui/gl/gl_image_io_surface.mm
|
| diff --git a/ui/gl/gl_image_io_surface.mm b/ui/gl/gl_image_io_surface.mm
|
| index 3059333cc8896feb96c15f2b4147e3e927a3f417..b0d848e2b536ccc3c88f732e23248a4a11aa6329 100644
|
| --- a/ui/gl/gl_image_io_surface.mm
|
| +++ b/ui/gl/gl_image_io_surface.mm
|
| @@ -84,6 +84,7 @@ bool ValidFormat(BufferFormat format) {
|
| switch (format) {
|
| case BufferFormat::R_8:
|
| case BufferFormat::BGRA_8888:
|
| + case BufferFormat::BGRX_8888:
|
| case BufferFormat::RGBA_8888:
|
| case BufferFormat::UYVY_422:
|
| case BufferFormat::YUV_420_BIPLANAR:
|
| @@ -95,7 +96,6 @@ bool ValidFormat(BufferFormat format) {
|
| case BufferFormat::ETC1:
|
| case BufferFormat::RGBA_4444:
|
| case BufferFormat::RGBX_8888:
|
| - case BufferFormat::BGRX_8888:
|
| case BufferFormat::YUV_420:
|
| return false;
|
| }
|
| @@ -109,6 +109,7 @@ GLenum TextureFormat(BufferFormat format) {
|
| case BufferFormat::R_8:
|
| return GL_RED;
|
| case BufferFormat::BGRA_8888:
|
| + case BufferFormat::BGRX_8888:
|
| case BufferFormat::RGBA_8888:
|
| return GL_RGBA;
|
| case BufferFormat::UYVY_422:
|
| @@ -122,7 +123,6 @@ GLenum TextureFormat(BufferFormat format) {
|
| case BufferFormat::ETC1:
|
| case BufferFormat::RGBA_4444:
|
| case BufferFormat::RGBX_8888:
|
| - case BufferFormat::BGRX_8888:
|
| case BufferFormat::YUV_420:
|
| NOTREACHED();
|
| return 0;
|
| @@ -137,6 +137,7 @@ GLenum DataFormat(BufferFormat format) {
|
| case BufferFormat::R_8:
|
| return GL_RED;
|
| case BufferFormat::BGRA_8888:
|
| + case BufferFormat::BGRX_8888:
|
| case BufferFormat::RGBA_8888:
|
| return GL_BGRA;
|
| case BufferFormat::UYVY_422:
|
| @@ -148,7 +149,6 @@ GLenum DataFormat(BufferFormat format) {
|
| case BufferFormat::ETC1:
|
| case BufferFormat::RGBA_4444:
|
| case BufferFormat::RGBX_8888:
|
| - case BufferFormat::BGRX_8888:
|
| case BufferFormat::YUV_420:
|
| case BufferFormat::YUV_420_BIPLANAR:
|
| NOTREACHED();
|
| @@ -164,6 +164,7 @@ GLenum DataType(BufferFormat format) {
|
| case BufferFormat::R_8:
|
| return GL_UNSIGNED_BYTE;
|
| case BufferFormat::BGRA_8888:
|
| + case BufferFormat::BGRX_8888:
|
| case BufferFormat::RGBA_8888:
|
| return GL_UNSIGNED_INT_8_8_8_8_REV;
|
| case BufferFormat::UYVY_422:
|
| @@ -176,7 +177,6 @@ GLenum DataType(BufferFormat format) {
|
| case BufferFormat::ETC1:
|
| case BufferFormat::RGBA_4444:
|
| case BufferFormat::RGBX_8888:
|
| - case BufferFormat::BGRX_8888:
|
| case BufferFormat::YUV_420:
|
| case BufferFormat::YUV_420_BIPLANAR:
|
| NOTREACHED();
|
| @@ -187,12 +187,22 @@ GLenum DataType(BufferFormat format) {
|
| return 0;
|
| }
|
|
|
| +// When an IOSurface is bound to a texture with internalformat "GL_RGB", many
|
| +// OpenGL operations are broken. Therefore, never allow an IOSurface to be bound
|
| +// with GL_RGB. https://crbug.com/595948.
|
| +GLenum ConvertRequestedInternalFormat(GLenum internalformat) {
|
| + if (internalformat == GL_RGB)
|
| + return GL_RGBA;
|
| + return internalformat;
|
| +}
|
| +
|
| } // namespace
|
|
|
| GLImageIOSurface::GLImageIOSurface(const gfx::Size& size,
|
| unsigned internalformat)
|
| : size_(size),
|
| - internalformat_(internalformat),
|
| + internalformat_(ConvertRequestedInternalFormat(internalformat)),
|
| + client_internalformat_(internalformat),
|
| format_(BufferFormat::RGBA_8888) {}
|
|
|
| GLImageIOSurface::~GLImageIOSurface() {
|
| @@ -405,6 +415,10 @@ void GLImageIOSurface::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
|
| pmd->AddOwnershipEdge(dump->guid(), guid);
|
| }
|
|
|
| +bool GLImageIOSurface::EmulatingRGB() const {
|
| + return client_internalformat_ == GL_RGB;
|
| +}
|
| +
|
| base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() {
|
| return io_surface_;
|
| }
|
|
|