GL: Remove redundant use() call.
This is already called in GlUtil.Program(). Tested by confirming that the demo-gl target still runs as expected. Refactoring change only. No intended functional changes. PiperOrigin-RevId: 412308564
This commit is contained in:
parent
a7d7c7b73a
commit
f0fcad16a9
@ -42,7 +42,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.microedition.khronos.egl.EGL10;
|
import javax.microedition.khronos.egl.EGL10;
|
||||||
|
|
||||||
/** GL utilities. */
|
/** OpenGL ES 2.0 utilities. */
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class GlUtil {
|
public final class GlUtil {
|
||||||
|
|
||||||
@ -86,7 +86,10 @@ public final class GlUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles a GL shader program from vertex and fragment shader GLSL GLES20 code.
|
* Creates a GL shader program from vertex and fragment shader GLSL GLES20 code.
|
||||||
|
*
|
||||||
|
* <p>This involves slow steps, like compiling, linking, and switching the GL program, so do not
|
||||||
|
* call this in fast rendering loops.
|
||||||
*
|
*
|
||||||
* @param vertexShaderGlsl The vertex shader program.
|
* @param vertexShaderGlsl The vertex shader program.
|
||||||
* @param fragmentShaderGlsl The fragment shader program.
|
* @param fragmentShaderGlsl The fragment shader program.
|
||||||
@ -129,8 +132,14 @@ public final class GlUtil {
|
|||||||
checkGlError();
|
checkGlError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Uses the program. */
|
/**
|
||||||
|
* Uses the program.
|
||||||
|
*
|
||||||
|
* <p>Call this in the rendering loop to switch between different programs.
|
||||||
|
*/
|
||||||
public void use() {
|
public void use() {
|
||||||
|
// TODO(http://b/205002913): When multiple GL programs are supported by Transformer, make sure
|
||||||
|
// to call use() to switch between programs.
|
||||||
GLES20.glUseProgram(programId);
|
GLES20.glUseProgram(programId);
|
||||||
checkGlError();
|
checkGlError();
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,6 @@ public final class VideoDecoderGLSurfaceView extends GLSurfaceView
|
|||||||
@Override
|
@Override
|
||||||
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
|
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
|
||||||
program = new GlUtil.Program(VERTEX_SHADER, FRAGMENT_SHADER);
|
program = new GlUtil.Program(VERTEX_SHADER, FRAGMENT_SHADER);
|
||||||
program.use();
|
|
||||||
int posLocation = program.getAttributeArrayLocationAndEnable("in_pos");
|
int posLocation = program.getAttributeArrayLocationAndEnable("in_pos");
|
||||||
GLES20.glVertexAttribPointer(
|
GLES20.glVertexAttribPointer(
|
||||||
posLocation,
|
posLocation,
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.exoplayer.video.spherical;
|
package androidx.media3.exoplayer.video.spherical;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
|
||||||
import static androidx.media3.common.util.GlUtil.checkGlError;
|
import static androidx.media3.common.util.GlUtil.checkGlError;
|
||||||
|
|
||||||
import android.opengl.GLES11Ext;
|
import android.opengl.GLES11Ext;
|
||||||
@ -139,9 +138,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure shader.
|
// Configure shader.
|
||||||
checkNotNull(program).use();
|
|
||||||
checkGlError();
|
|
||||||
|
|
||||||
float[] texMatrix;
|
float[] texMatrix;
|
||||||
if (stereoMode == C.STEREO_MODE_TOP_BOTTOM) {
|
if (stereoMode == C.STEREO_MODE_TOP_BOTTOM) {
|
||||||
texMatrix = rightEye ? TEX_MATRIX_BOTTOM : TEX_MATRIX_TOP;
|
texMatrix = rightEye ? TEX_MATRIX_BOTTOM : TEX_MATRIX_TOP;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user