Skip to content
Permalink
Browse files
GraphicsContextGLOpenGL: Rename IOSurfaceTextureTarget to drawingBuff…
…erTextureTarget

https://bugs.webkit.org/show_bug.cgi?id=219475

Reviewed by Don Olmstead.

Cocoa port has IOSurfaceTextureTarget method to switch a buffer
target type. Non-Cocoa ports also need a similar method.

Rename IOSurfaceTextureTarget, IOSurfaceTextureTargetQuery and
EGLIOSurfaceTextureTarget to drawingBufferTextureTarget,
drawingBufferTextureTargetQuery and EGLDrawingBufferTextureTarget.

* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::drawingBufferTextureTarget):
(WebCore::GraphicsContextGLOpenGL::drawingBufferTextureTargetQuery):
(WebCore::GraphicsContextGLOpenGL::EGLDrawingBufferTextureTarget):
(WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
(WebCore::GraphicsContextGLOpenGL::bindDisplayBufferBacking):
(WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget): Deleted.
(WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery): Deleted.
(WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget): Deleted.
* platform/graphics/cv/GraphicsContextGLCVANGLE.cpp:
(WebCore::GraphicsContextGLCVANGLE::initializeUVContextObjects):
(WebCore::GraphicsContextGLCVANGLE::attachIOSurfaceToTexture):
(WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:

Canonical link: https://commits.webkit.org/232086@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fujii committed Dec 3, 2020
1 parent 38b9510 commit ee6d99c7393b1f7b9a8e767ad0b12978bb6c230b
Showing 5 changed files with 47 additions and 15 deletions.
@@ -1,3 +1,35 @@
2020-12-03 Fujii Hironori <Hironori.Fujii@sony.com>

GraphicsContextGLOpenGL: Rename IOSurfaceTextureTarget to drawingBufferTextureTarget
https://bugs.webkit.org/show_bug.cgi?id=219475

Reviewed by Don Olmstead.

Cocoa port has IOSurfaceTextureTarget method to switch a buffer
target type. Non-Cocoa ports also need a similar method.

Rename IOSurfaceTextureTarget, IOSurfaceTextureTargetQuery and
EGLIOSurfaceTextureTarget to drawingBufferTextureTarget,
drawingBufferTextureTargetQuery and EGLDrawingBufferTextureTarget.

* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::drawingBufferTextureTarget):
(WebCore::GraphicsContextGLOpenGL::drawingBufferTextureTargetQuery):
(WebCore::GraphicsContextGLOpenGL::EGLDrawingBufferTextureTarget):
(WebCore::GraphicsContextGLOpenGL::reshapeDisplayBufferBacking):
(WebCore::GraphicsContextGLOpenGL::bindDisplayBufferBacking):
(WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTarget): Deleted.
(WebCore::GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery): Deleted.
(WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget): Deleted.
* platform/graphics/cv/GraphicsContextGLCVANGLE.cpp:
(WebCore::GraphicsContextGLCVANGLE::initializeUVContextObjects):
(WebCore::GraphicsContextGLCVANGLE::attachIOSurfaceToTexture):
(WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:

2020-12-03 Kimmo Kinnunen <kkinnunen@apple.com>

GraphicsContextGL has a couple non-robust getters and other small API problems preventing GPU process implementation
@@ -231,10 +231,10 @@ bool GraphicsContextGLOpenGL::reshapeFBOs(const IntSize& size)
gl::BindTexture(GL_TEXTURE_2D, texture2DBinding);
// Attach m_texture to m_preserveDrawingBufferFBO for later blitting.
gl::BindFramebuffer(GL_FRAMEBUFFER, m_preserveDrawingBufferFBO);
gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, IOSurfaceTextureTarget(), m_texture, 0);
gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, drawingBufferTextureTarget(), m_texture, 0);
gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
} else
gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, IOSurfaceTextureTarget(), m_texture, 0);
gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, drawingBufferTextureTarget(), m_texture, 0);
#elif PLATFORM(GTK)
gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_texture);
gl::TexImage2D(GL_TEXTURE_RECTANGLE_ANGLE, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
@@ -342,7 +342,7 @@ static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixel
END_BLOCK_OBJC_EXCEPTIONS

// Create the texture that will be used for the framebuffer.
GLenum textureTarget = IOSurfaceTextureTarget();
GLenum textureTarget = drawingBufferTextureTarget();

gl::GenTextures(1, &m_texture);
gl::BindTexture(textureTarget, m_texture);
@@ -426,7 +426,7 @@ static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixel
LOG(WebGL, "Destroyed a GraphicsContextGLOpenGL (%p).", this);
}

GCGLenum GraphicsContextGLOpenGL::IOSurfaceTextureTarget()
GCGLenum GraphicsContextGLOpenGL::drawingBufferTextureTarget()
{
#if PLATFORM(MACCATALYST)
if (needsEAGLOnMac())
@@ -439,7 +439,7 @@ static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixel
#endif
}

GCGLenum GraphicsContextGLOpenGL::IOSurfaceTextureTargetQuery()
GCGLenum GraphicsContextGLOpenGL::drawingBufferTextureTargetQuery()
{
#if PLATFORM(MACCATALYST)
if (needsEAGLOnMac())
@@ -452,7 +452,7 @@ static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixel
#endif
}

GCGLint GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget()
GCGLint GraphicsContextGLOpenGL::EGLDrawingBufferTextureTarget()
{
#if PLATFORM(MACCATALYST)
if (needsEAGLOnMac())
@@ -594,7 +594,7 @@ static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixel
EGL_WIDTH, size.width(),
EGL_HEIGHT, size.height(),
EGL_IOSURFACE_PLANE_ANGLE, 0,
EGL_TEXTURE_TARGET, WebCore::GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget(),
EGL_TEXTURE_TARGET, WebCore::GraphicsContextGLOpenGL::EGLDrawingBufferTextureTarget(),
EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, usingAlpha ? GL_BGRA_EXT : GL_RGB,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
EGL_TEXTURE_TYPE_ANGLE, GL_UNSIGNED_BYTE,
@@ -610,8 +610,8 @@ static void setGPUByRegistryID(CGLContextObj contextObj, CGLPixelFormatObj pixel

bool GraphicsContextGLOpenGL::bindDisplayBufferBacking(std::unique_ptr<IOSurface> backing, void* pbuffer)
{
GCGLenum textureTarget = IOSurfaceTextureTarget();
ScopedRestoreTextureBinding restoreBinding(IOSurfaceTextureTargetQuery(), textureTarget, textureTarget != TEXTURE_RECTANGLE_ARB);
GCGLenum textureTarget = drawingBufferTextureTarget();
ScopedRestoreTextureBinding restoreBinding(drawingBufferTextureTargetQuery(), textureTarget, textureTarget != TEXTURE_RECTANGLE_ARB);
gl::BindTexture(textureTarget, m_texture);
if (!EGL_BindTexImage(m_displayObj, pbuffer, EGL_BACK_BUFFER)) {
EGL_DestroySurface(m_displayObj, pbuffer);
@@ -456,7 +456,7 @@ GraphicsContextGLCVANGLE::~GraphicsContextGLCVANGLE()

bool GraphicsContextGLCVANGLE::initializeUVContextObjects()
{
const bool useTexture2D = GraphicsContextGLOpenGL::IOSurfaceTextureTarget() == GraphicsContextGL::TEXTURE_2D;
const bool useTexture2D = GraphicsContextGLOpenGL::drawingBufferTextureTarget() == GraphicsContextGL::TEXTURE_2D;

PlatformGLObject vertexShader = m_context->createShader(GraphicsContextGL::VERTEX_SHADER);
if (useTexture2D)
@@ -541,7 +541,7 @@ void* GraphicsContextGLCVANGLE::attachIOSurfaceToTexture(GCGLenum target, GCGLen
LOG(WebGL, "Unknown texture target %d.", static_cast<int>(target));
return nullptr;
}
if (eglTextureTarget != GraphicsContextGLOpenGL::EGLIOSurfaceTextureTarget()) {
if (eglTextureTarget != GraphicsContextGLOpenGL::EGLDrawingBufferTextureTarget()) {
LOG(WebGL, "Mismatch in EGL texture target %d.", static_cast<int>(target));
return nullptr;
}
@@ -639,7 +639,7 @@ bool GraphicsContextGLCVANGLE::copyPixelBufferToTexture(CVPixelBufferRef image,
auto uvPlaneWidth = IOSurfaceGetWidthOfPlane(surface, 1);
auto uvPlaneHeight = IOSurfaceGetHeightOfPlane(surface, 1);

GCGLenum videoTextureTarget = GraphicsContextGLOpenGL::IOSurfaceTextureTarget();
GCGLenum videoTextureTarget = GraphicsContextGLOpenGL::drawingBufferTextureTarget();

auto uvTexture = m_context->createTexture();
m_context->activeTexture(GraphicsContextGL::TEXTURE1);
@@ -97,9 +97,9 @@ class GraphicsContextGLOpenGL final : public GraphicsContextGL
CALayer* platformLayer() const final { return reinterpret_cast<CALayer*>(m_webGLLayer.get()); }
PlatformGraphicsContextGLDisplay platformDisplay() const { return m_displayObj; }
PlatformGraphicsContextGLConfig platformConfig() const { return m_configObj; }
static GCGLenum IOSurfaceTextureTarget();
static GCGLenum IOSurfaceTextureTargetQuery();
static GCGLint EGLIOSurfaceTextureTarget();
static GCGLenum drawingBufferTextureTarget();
static GCGLenum drawingBufferTextureTargetQuery();
static GCGLint EGLDrawingBufferTextureTarget();
#else
PlatformLayer* platformLayer() const final;
#endif

0 comments on commit ee6d99c

Please sign in to comment.