Skip to content

Commit

Permalink
Switch naming convention for shaders
Browse files Browse the repository at this point in the history
Switch to using sentence-case naming convention but with one character prefixes for different types.

This is a no-op change.

PiperOrigin-RevId: 417791624
  • Loading branch information
andrewlewis authored and tonihei committed Jan 4, 2022
1 parent 4240da5 commit ad7c9e2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.
#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES tex_sampler;
varying vec2 v_texcoord;
uniform samplerExternalOES uTexSampler;
varying vec2 vTexCoords;
void main() {
gl_FragColor = texture2D(tex_sampler, v_texcoord);
gl_FragColor = texture2D(uTexSampler, vTexCoords);
}
14 changes: 7 additions & 7 deletions library/transformer/src/main/assets/shaders/vertex_shader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
attribute vec4 a_position;
attribute vec4 a_texcoord;
uniform mat4 tex_transform;
uniform mat4 transformation_matrix;
varying vec2 v_texcoord;
attribute vec4 aPosition;
attribute vec4 aTexCoords;
uniform mat4 uTexTransform;
uniform mat4 uTransformationMatrix;
varying vec2 vTexCoords;
void main() {
gl_Position = transformation_matrix * a_position;
v_texcoord = (tex_transform * a_texcoord).xy;
gl_Position = uTransformationMatrix * aPosition;
vTexCoords = (uTexTransform * aTexCoords).xy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static FrameEditor create(
}

glProgram.setBufferAttribute(
"a_position",
"aPosition",
new float[] {
-1.0f, -1.0f, 0.0f, 1.0f,
1.0f, -1.0f, 0.0f, 1.0f,
Expand All @@ -83,18 +83,18 @@ public static FrameEditor create(
},
/* size= */ 4);
glProgram.setBufferAttribute(
"a_texcoord",
"aTexCoords",
new float[] {
0.0f, 0.0f, 0.0f, 1.0f,
1.0f, 0.0f, 0.0f, 1.0f,
0.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 0.0f, 1.0f,
},
/* size= */ 4);
glProgram.setSamplerTexIdUniform("tex_sampler", textureId, /* unit= */ 0);
glProgram.setSamplerTexIdUniform("uTexSampler", textureId, /* unit= */ 0);

float[] transformationMatrixArray = getGlMatrixArray(transformationMatrix);
glProgram.setFloatsUniform("transformation_matrix", transformationMatrixArray);
glProgram.setFloatsUniform("uTransformationMatrix", transformationMatrixArray);

@Nullable
SurfaceView debugSurfaceView =
Expand Down Expand Up @@ -230,7 +230,7 @@ public boolean hasInputData() {
public void processData() {
inputSurfaceTexture.updateTexImage();
inputSurfaceTexture.getTransformMatrix(textureTransformMatrix);
glProgram.setFloatsUniform("tex_transform", textureTransformMatrix);
glProgram.setFloatsUniform("uTexTransform", textureTransformMatrix);
glProgram.bindAttributesAndUniforms();

focusAndDrawQuad(eglSurface, outputWidth, outputHeight);
Expand Down

0 comments on commit ad7c9e2

Please sign in to comment.