GL: Remove configAttributes from createFocusedPlaceholderEglSurface.

PiperOrigin-RevId: 540901189
This commit is contained in:
huangdarwin 2023-06-16 17:17:04 +01:00 committed by Marc Baechinger
parent af69d5822a
commit daa42322d7
14 changed files with 24 additions and 44 deletions

View File

@ -58,10 +58,8 @@ public interface GlObjectsProvider {
@Override
@RequiresApi(17)
public EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes)
throws GlException {
return GlUtil.createFocusedPlaceholderEglSurface(
eglContext, eglDisplay, configAttributes);
EGLContext eglContext, EGLDisplay eglDisplay) throws GlException {
return GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
}
@Override
@ -109,15 +107,14 @@ public interface GlObjectsProvider {
*
* @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)
EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException;
EGLSurface createFocusedPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay)
throws GlException;
/**
* Returns a {@link GlTextureInfo} containing the identifiers of the newly created buffers.

View File

@ -213,7 +213,7 @@ public final class GlUtil {
try {
EGLDisplay eglDisplay = createEglDisplay();
EGLContext eglContext = createEglContext(eglDisplay);
focusPlaceholderEglSurface(eglContext, eglDisplay);
createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
glExtensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);
destroyEglContext(eglDisplay, eglContext);
} catch (GlException e) {
@ -355,29 +355,12 @@ public final class GlUtil {
* @return {@link EGL14#EGL_NO_SURFACE} if supported and a 1x1 pixel buffer surface otherwise.
*/
@RequiresApi(17)
public static EGLSurface focusPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay)
throws GlException {
return createFocusedPlaceholderEglSurface(
eglContext, eglDisplay, EGL_CONFIG_ATTRIBUTES_RGBA_8888);
}
/**
* Creates and focuses a placeholder {@link EGLSurface}.
*
* <p>This makes a {@link EGLContext} current when reading and writing to a surface is not
* required.
*
* @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. Accepts {@link
* #EGL_CONFIG_ATTRIBUTES_RGBA_1010102} and {@link #EGL_CONFIG_ATTRIBUTES_RGBA_8888}.
* @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.
*/
@RequiresApi(17)
public static EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes) throws GlException {
EGLContext eglContext, EGLDisplay eglDisplay) throws GlException {
// EGL_CONFIG_ATTRIBUTES_RGBA_1010102 could be used for HDR input, but
// EGL14.EGL_NO_SURFACE support was added before EGL 2, so HDR-capable devices should have
// support for EGL_NO_SURFACE and therefore configAttributes shouldn't matter for HDR.
int[] configAttributes = EGL_CONFIG_ATTRIBUTES_RGBA_8888;
EGLSurface eglSurface =
isSurfacelessContextExtensionSupported()
? EGL14.EGL_NO_SURFACE

View File

@ -80,7 +80,7 @@ public class ContrastPixelTest {
public void createGlObjects() throws Exception {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -73,7 +73,7 @@ public final class CropPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -73,7 +73,8 @@ public final class DefaultShaderProgramPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
EGLSurface placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
EGLSurface placeholderEglSurface =
GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -85,7 +85,7 @@ public final class HslAdjustmentPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -92,7 +92,7 @@ public class OverlayShaderProgramPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -82,7 +82,7 @@ public final class PresentationPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -79,7 +79,7 @@ public final class RgbAdjustmentPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -74,7 +74,7 @@ public final class RgbFilterPixelTest {
public void createGlObjects() throws IOException, GlUtil.GlException {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -79,7 +79,7 @@ public class SingleColorLutPixelTest {
public void createGlObjects() throws Exception {
eglDisplay = GlUtil.createEglDisplay();
eglContext = GlUtil.createEglContext(eglDisplay);
placeholderEglSurface = GlUtil.focusPlaceholderEglSurface(eglContext, eglDisplay);
placeholderEglSurface = GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
Bitmap inputBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
inputWidth = inputBitmap.getWidth();

View File

@ -65,10 +65,9 @@ public final class DefaultGlObjectsProvider implements GlObjectsProvider {
}
@Override
public EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay, int[] configAttributes)
public EGLSurface createFocusedPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay)
throws GlUtil.GlException {
return GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay, configAttributes);
return GlUtil.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
}
@Override

View File

@ -616,7 +616,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
ColorInfo.isTransferHdr(inputColorInfo) || ColorInfo.isTransferHdr(outputColorInfo) ? 3 : 2;
EGLContext eglContext =
glObjectsProvider.createEglContext(eglDisplay, openGlVersion, configAttributes);
glObjectsProvider.createFocusedPlaceholderEglSurface(eglContext, eglDisplay, configAttributes);
glObjectsProvider.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
// Not renderFramesAutomatically means outputting to a display surface. HDR display surfaces
// require the BT2020 PQ GL extension.

View File

@ -565,7 +565,7 @@ public final class AndroidTestUtil {
new DefaultGlObjectsProvider(/* sharedEglContext= */ null);
EGLContext eglContext =
glObjectsProvider.createEglContext(eglDisplay, /* openGlVersion= */ 2, configAttributes);
glObjectsProvider.createFocusedPlaceholderEglSurface(eglContext, eglDisplay, configAttributes);
glObjectsProvider.createFocusedPlaceholderEglSurface(eglContext, eglDisplay);
return eglContext;
}