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

Unified Diff: ui/gl/gl_image_io_surface.mm

Issue 2831733003: Fix blits from multisampled renderbuffers to alpha:false WebGL back buffer. (Closed)
Patch Set: Add PLATFORM_EXPORT to fix link failure on Windows. Created 3 years, 8 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 | « ui/gl/gl_image_io_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8e208301e57902cad93055c22c1eff6bcc0ef8f7..fc4df49f478ff007cbbfd681ce8c63cd8493582d 100644
--- a/ui/gl/gl_image_io_surface.mm
+++ b/ui/gl/gl_image_io_surface.mm
@@ -168,8 +168,9 @@ GLenum DataType(gfx::BufferFormat format) {
}
// 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.
+// OpenGL operations are broken. Therefore, don't allow an IOSurface to be bound
+// with GL_RGB unless overridden via BindTexImageWithInternalformat.
+// crbug.com/595948, crbug.com/699566.
GLenum ConvertRequestedInternalFormat(GLenum internalformat) {
if (internalformat == GL_RGB)
return GL_RGBA;
@@ -237,6 +238,11 @@ unsigned GLImageIOSurface::GetInternalFormat() {
}
bool GLImageIOSurface::BindTexImage(unsigned target) {
+ return BindTexImageWithInternalformat(target, 0);
+}
+
+bool GLImageIOSurface::BindTexImageWithInternalformat(unsigned target,
+ unsigned internalformat) {
DCHECK(thread_checker_.CalledOnValidThread());
TRACE_EVENT0("gpu", "GLImageIOSurface::BindTexImage");
base::TimeTicks start_time = base::TimeTicks::Now();
@@ -258,10 +264,12 @@ bool GLImageIOSurface::BindTexImage(unsigned target) {
static_cast<CGLContextObj>(GLContext::GetCurrent()->GetHandle());
DCHECK(io_surface_);
- CGLError cgl_error =
- CGLTexImageIOSurface2D(cgl_context, target, TextureFormat(format_),
- size_.width(), size_.height(), DataFormat(format_),
- DataType(format_), io_surface_.get(), 0);
+
+ GLenum texture_format =
+ internalformat ? internalformat : TextureFormat(format_);
+ CGLError cgl_error = CGLTexImageIOSurface2D(
+ cgl_context, target, texture_format, size_.width(), size_.height(),
+ DataFormat(format_), DataType(format_), io_surface_.get(), 0);
if (cgl_error != kCGLNoError) {
LOG(ERROR) << "Error in CGLTexImageIOSurface2D: "
<< CGLErrorString(cgl_error);
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698