Commit ad68c7cc by tofunmi Committed by microkatz

Remove glUtil.clearOutputFrame from GLObjectsProvider.

https://github.com/google/ExoPlayer/commit/ddbad570311fec7df635b0b6da9083be82291b50 added clearing depth buffers to GLUtil, so there is no need to have allow apps to have a custom clearOutputFrame.
Also removes default implementations in GLObjectsProvider know that these methods have been implemented.

PiperOrigin-RevId: 517156304
parent 927105ed
......@@ -16,6 +16,7 @@
package com.google.android.exoplayer2.util;
import android.opengl.EGL14;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
......@@ -66,11 +67,6 @@ public interface GlObjectsProvider {
int fboId = GlUtil.createFboForTexture(texId);
return new GlTextureInfo(texId, fboId, /* rboId= */ C.INDEX_UNSET, width, height);
}
@Override
public void clearOutputFrame() throws GlException {
GlUtil.clearOutputFrame();
}
};
/**
......@@ -87,22 +83,38 @@ public interface GlObjectsProvider {
EGLDisplay eglDisplay, @IntRange(from = 2, to = 3) int openGlVersion, int[] configAttributes)
throws GlException;
// TODO(b/271433904): Remove default implementations once photos have implemented these methods.
/**
* Creates a new {@link EGLSurface} wrapping the specified {@code surface}.
*
* @param eglDisplay The {@link EGLDisplay} to attach the surface to.
* @param surface The surface to wrap; must be a surface, surface texture or surface holder.
* @param colorTransfer The {@linkplain C.ColorTransfer color transfer characteristics} to which
* the {@code surface} is configured.
* @param isEncoderInputSurface Whether the {@code surface} is the input surface of an encoder.
* @throws GlException If an error occurs during creation.
*/
@RequiresApi(17)
default EGLSurface createEglSurface(
EGLSurface createEglSurface(
EGLDisplay eglDisplay,
Object surface,
@C.ColorTransfer int colorTransfer,
boolean isEncoderInputSurface)
throws GlException {
return GlUtil.createEglSurface(eglDisplay, surface, colorTransfer, isEncoderInputSurface);
}
throws GlException;
/**
* Creates and focuses a placeholder {@link EGLSurface}.
*
* @param eglContext The {@link EGLContext} to make current.
* @param eglDisplay The {@link EGLDisplay} to attach the surface to.
* @param configAttributes The attributes to configure EGL with.
* @return A placeholder {@link EGLSurface} that has been focused to allow rendering to take
* place, or {@link EGL14#EGL_NO_SURFACE} if the current context supports rendering without a
* surface.
* @throws GlException If an error occurs during creation.
*/
@RequiresApi(17)
default EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException {
return GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay, configAttributes);
}
EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException;
/**
* Returns a {@link GlTextureInfo} containing the identifiers of the newly created buffers.
......@@ -113,11 +125,4 @@ public interface GlObjectsProvider {
* @throws GlException If an error occurs during creation.
*/
GlTextureInfo createBuffersForTexture(int texId, int width, int height) throws GlException;
/**
* Clears the current render target.
*
* @throws GlException If an error occurs during clearing.
*/
void clearOutputFrame() throws GlException;
}
......@@ -324,7 +324,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
outputEglSurface,
outputSurfaceInfo.width,
outputSurfaceInfo.height);
glObjectsProvider.clearOutputFrame();
GlUtil.clearOutputFrame();
defaultShaderProgram.drawFrame(inputTexture.texId, presentationTimeUs);
EGLExt.eglPresentationTimeANDROID(
......@@ -466,7 +466,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
try {
debugSurfaceViewWrapper.maybeRenderToSurfaceView(
() -> {
glObjectsProvider.clearOutputFrame();
GlUtil.clearOutputFrame();
@C.ColorTransfer
int configuredColorTransfer = defaultShaderProgram.getOutputColorTransfer();
defaultShaderProgram.setOutputColorTransfer(
......
......@@ -137,7 +137,7 @@ import java.util.concurrent.Executor;
// Copy frame to fbo.
GlUtil.focusFramebufferUsingCurrentContext(
outputTexture.fboId, outputTexture.width, outputTexture.height);
glObjectsProvider.clearOutputFrame();
GlUtil.clearOutputFrame();
drawFrame(inputTexture.texId);
inputListener.onInputFrameProcessed(inputTexture);
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
......
......@@ -142,7 +142,7 @@ public abstract class SingleFrameGlShaderProgram implements GlShaderProgram {
outputTextureInUse = true;
GlUtil.focusFramebufferUsingCurrentContext(
outputTexture.fboId, outputTexture.width, outputTexture.height);
glObjectsProvider.clearOutputFrame();
GlUtil.clearOutputFrame();
drawFrame(inputTexture.texId, presentationTimeUs);
inputListener.onInputFrameProcessed(inputTexture);
outputListener.onOutputFrameAvailable(outputTexture, presentationTimeUs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment