Remove redundant attribute from matrix transformation vertex shader.
The texture coordinates can be derived from the frame coordinates. PiperOrigin-RevId: 446770538
This commit is contained in:
parent
3dec4266a3
commit
e9919f6da1
@ -16,9 +16,8 @@
|
|||||||
// ES 2 vertex shader that leaves the coordinates unchanged.
|
// ES 2 vertex shader that leaves the coordinates unchanged.
|
||||||
|
|
||||||
attribute vec4 aFramePosition;
|
attribute vec4 aFramePosition;
|
||||||
attribute vec4 aTexSamplingCoord;
|
|
||||||
varying vec2 vTexSamplingCoord;
|
varying vec2 vTexSamplingCoord;
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = aFramePosition;
|
gl_Position = aFramePosition;
|
||||||
vTexSamplingCoord = aTexSamplingCoord.xy;
|
vTexSamplingCoord = vec2(aFramePosition.x * 0.5 + 0.5, aFramePosition.y * 0.5 + 0.5);
|
||||||
}
|
}
|
||||||
|
@ -102,8 +102,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
||||||
glProgram.setBufferAttribute(
|
glProgram.setBufferAttribute(
|
||||||
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
||||||
glProgram.setBufferAttribute(
|
|
||||||
"aTexSamplingCoord", GlUtil.getTextureCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
|
||||||
glProgram.setSamplerTexIdUniform("uTexSampler0", inputTexId, /* texUnitIndex= */ 0);
|
glProgram.setSamplerTexIdUniform("uTexSampler0", inputTexId, /* texUnitIndex= */ 0);
|
||||||
glProgram.setSamplerTexIdUniform("uTexSampler1", bitmapTexId, /* texUnitIndex= */ 1);
|
glProgram.setSamplerTexIdUniform("uTexSampler1", bitmapTexId, /* texUnitIndex= */ 1);
|
||||||
glProgram.setFloatUniform("uScaleX", bitmapScaleX);
|
glProgram.setFloatUniform("uScaleX", bitmapScaleX);
|
||||||
|
@ -88,8 +88,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
||||||
glProgram.setBufferAttribute(
|
glProgram.setBufferAttribute(
|
||||||
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
||||||
glProgram.setBufferAttribute(
|
|
||||||
"aTexSamplingCoord", GlUtil.getTextureCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,10 +145,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
"aFramePosition",
|
"aFramePosition",
|
||||||
GlUtil.getNormalizedCoordinateBounds(),
|
GlUtil.getNormalizedCoordinateBounds(),
|
||||||
GlUtil.RECTANGLE_VERTICES_COUNT);
|
GlUtil.RECTANGLE_VERTICES_COUNT);
|
||||||
glProgram.setBufferAttribute(
|
|
||||||
"aTexSamplingCoord",
|
|
||||||
GlUtil.getTextureCoordinateBounds(),
|
|
||||||
GlUtil.RECTANGLE_VERTICES_COUNT);
|
|
||||||
glProgram.bindAttributesAndUniforms();
|
glProgram.bindAttributesAndUniforms();
|
||||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, /* first= */ 0, /* count= */ 4);
|
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, /* first= */ 0, /* count= */ 4);
|
||||||
GlUtil.checkGlError();
|
GlUtil.checkGlError();
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
// locations.
|
// locations.
|
||||||
|
|
||||||
attribute vec4 aFramePosition;
|
attribute vec4 aFramePosition;
|
||||||
attribute vec4 aTexSamplingCoord;
|
|
||||||
uniform mat4 uTexTransform;
|
uniform mat4 uTexTransform;
|
||||||
varying vec2 vTexSamplingCoord;
|
varying vec2 vTexSamplingCoord;
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = aFramePosition;
|
gl_Position = aFramePosition;
|
||||||
vTexSamplingCoord = (uTexTransform * aTexSamplingCoord).xy;
|
vec4 texturePosition = vec4(aFramePosition.x * 0.5 + 0.5, aFramePosition.y * 0.5 + 0.5, 0.0, 1.0);
|
||||||
|
vTexSamplingCoord = (uTexTransform * texturePosition).xy;
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
// locations.
|
// locations.
|
||||||
|
|
||||||
in vec4 aFramePosition;
|
in vec4 aFramePosition;
|
||||||
in vec4 aTexSamplingCoord;
|
|
||||||
uniform mat4 uTexTransform;
|
uniform mat4 uTexTransform;
|
||||||
out vec2 vTexSamplingCoord;
|
out vec2 vTexSamplingCoord;
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = aFramePosition;
|
gl_Position = aFramePosition;
|
||||||
vTexSamplingCoord = (uTexTransform * aTexSamplingCoord).xy;
|
vec4 texturePosition = vec4(aFramePosition.x * 0.5 + 0.5, aFramePosition.y * 0.5 + 0.5, 0.0, 1.0);
|
||||||
|
vTexSamplingCoord = (uTexTransform * texturePosition).xy;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,9 @@
|
|||||||
// uTransformationMatrix.
|
// uTransformationMatrix.
|
||||||
|
|
||||||
attribute vec4 aFramePosition;
|
attribute vec4 aFramePosition;
|
||||||
attribute vec4 aTexSamplingCoord;
|
|
||||||
uniform mat4 uTransformationMatrix;
|
uniform mat4 uTransformationMatrix;
|
||||||
varying vec2 vTexSamplingCoord;
|
varying vec2 vTexSamplingCoord;
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = uTransformationMatrix * aFramePosition;
|
gl_Position = uTransformationMatrix * aFramePosition;
|
||||||
vTexSamplingCoord = aTexSamplingCoord.xy;
|
vTexSamplingCoord = vec2(aFramePosition.x * 0.5 + 0.5, aFramePosition.y * 0.5 + 0.5);
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
||||||
glProgram.setBufferAttribute(
|
glProgram.setBufferAttribute(
|
||||||
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
||||||
glProgram.setBufferAttribute(
|
|
||||||
"aTexSamplingCoord", GlUtil.getTextureCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
|
||||||
if (enableExperimentalHdrEditing) {
|
if (enableExperimentalHdrEditing) {
|
||||||
// In HDR editing mode the decoder output is sampled in YUV.
|
// In HDR editing mode the decoder output is sampled in YUV.
|
||||||
glProgram.setFloatsUniform("uColorTransform", MATRIX_YUV_TO_BT2020_COLOR_TRANSFORM);
|
glProgram.setFloatsUniform("uColorTransform", MATRIX_YUV_TO_BT2020_COLOR_TRANSFORM);
|
||||||
|
@ -89,8 +89,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
// Draw the frame on the entire normalized device coordinate space, from -1 to 1, for x and y.
|
||||||
glProgram.setBufferAttribute(
|
glProgram.setBufferAttribute(
|
||||||
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
||||||
glProgram.setBufferAttribute(
|
|
||||||
"aTexSamplingCoord", GlUtil.getTextureCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user