GlProgram.smali

.class public Lcom/mmc/player/opengles/GlProgram;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/mmc/player/opengles/GlProgram$ProgramType;
    }
.end annotation


# static fields
.field private static final FRAGMENT_SHADER_2D:Ljava/lang/String; = "precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D sTexture;\nvoid main() {\n   gl_FragColor = texture2D(sTexture, vTextureCoord);\n}\n"

.field private static final FRAGMENT_SHADER_EXT:Ljava/lang/String; = "#extension GL_OES_EGL_image_external : require\nprecision highp float;\nvarying vec2 vTextureCoord;\nuniform samplerExternalOES sTexture;\nvoid main() {\n   gl_FragColor = texture2D(sTexture, vTextureCoord);\n}\n"

.field private static final FRAGMENT_SHADER_RGBA_TO_YUV420:Ljava/lang/String; = "precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D sTexture;\nuniform float width;\nconst vec3 COEF_Y = vec3( 0.257,  0.504,  0.114);\nconst vec3 COEF_U = vec3(-0.148, -0.289,  0.438);\nconst vec3 COEF_V = vec3( 0.438, -0.367, -0.070);\nconst float U_DIVIDE_LINE = 0.5;\nconst float V_DIVIDE_LINE = 0.75;\nvoid main()\n{\n   float offsetX = 1.0 / width;\n   if (vTextureCoord.y < U_DIVIDE_LINE) {\n       vec2 texCoord = vec2(vTextureCoord.x, vTextureCoord.y * 2.0);\n       vec4 color0 = texture2D(sTexture, vec2(texCoord.x,                 1.0 - texCoord.y));\n       vec4 color1 = texture2D(sTexture, vec2(texCoord.x + offsetX,       1.0 - texCoord.y));\n       vec4 color2 = texture2D(sTexture, vec2(texCoord.x + offsetX * 2.0, 1.0 - texCoord.y));\n       vec4 color3 = texture2D(sTexture, vec2(texCoord.x + offsetX * 3.0, 1.0 - texCoord.y));\n       float y0 = dot(color0.rgb, COEF_Y) + 16.0 / 256.0;\n       float y1 = dot(color1.rgb, COEF_Y) + 16.0 / 256.0;\n       float y2 = dot(color2.rgb, COEF_Y) + 16.0 / 256.0;\n       float y3 = dot(color3.rgb, COEF_Y) + 16.0 / 256.0;\n       gl_FragColor = vec4(y0, y1, y2, y3);\n   } else if (vTextureCoord.y < V_DIVIDE_LINE) {\n       if(vTextureCoord.x < 0.5) {\n           vec2 texCoord = vec2(vTextureCoord.x * 2.0, (vTextureCoord.y - U_DIVIDE_LINE) * 4.0);\n           vec4 color0 = texture2D(sTexture, vec2(texCoord.x,                 1.0 - texCoord.y));\n           vec4 color1 = texture2D(sTexture, vec2(texCoord.x + offsetX * 2.0, 1.0 - texCoord.y));\n           vec4 color2 = texture2D(sTexture, vec2(texCoord.x + offsetX * 4.0, 1.0 - texCoord.y));\n           vec4 color3 = texture2D(sTexture, vec2(texCoord.x + offsetX * 6.0, 1.0 - texCoord.y));\n           float u0 = dot(color0.rgb, COEF_U) + 0.5;\n           float u1 = dot(color1.rgb, COEF_U) + 0.5;\n           float u2 = dot(color2.rgb, COEF_U) + 0.5;\n           float u3 = dot(color3.rgb, COEF_U) + 0.5;\n           gl_FragColor = vec4(u0, u1, u2, u3);\n       } else {\n           gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n       }\n   } else {\n       if (vTextureCoord.x < 0.5) {\n           vec2 texCoord = vec2(vTextureCoord.x * 2.0, (vTextureCoord.y - V_DIVIDE_LINE) * 4.0);\n           vec4 color0 = texture2D(sTexture, vec2(texCoord.x,                 1.0 - texCoord.y));\n           vec4 color1 = texture2D(sTexture, vec2(texCoord.x + offsetX * 2.0, 1.0 - texCoord.y));\n           vec4 color2 = texture2D(sTexture, vec2(texCoord.x + offsetX * 4.0, 1.0 - texCoord.y));\n           vec4 color3 = texture2D(sTexture, vec2(texCoord.x + offsetX * 6.0, 1.0 - texCoord.y));\n           float v0 = dot(color0.rgb, COEF_V) + 0.5;\n           float v1 = dot(color1.rgb, COEF_V) + 0.5;\n           float v2 = dot(color2.rgb, COEF_V) + 0.5;\n           float v3 = dot(color3.rgb, COEF_V) + 0.5;\n           gl_FragColor = vec4(v0, v1, v2, v3);\n       } else {\n           gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n       }\n   }\n}\n"

.field private static final FRAGMENT_SHADER_YUV420:Ljava/lang/String; = "precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D yTexture;\nuniform sampler2D uTexture;\nuniform sampler2D vTexture;\nvoid main() {\nvec3 yuv = vec3(texture2D(yTexture, vTextureCoord).r - 0.0625,\ntexture2D(uTexture, vTextureCoord).r - 0.5,\ntexture2D(vTexture, vTextureCoord).r - 0.5);\nvec3 rgb = mat3(\n1.164, 1.164, 1.164,\n0.0, -0.392, 2.017,\n1.596, -0.813, 0.0\n) * yuv;\ngl_FragColor = vec4(rgb, 1.0);\n}\n"

.field private static final TAG:Ljava/lang/String; = "CorePlayerGlUtil"

.field private static final VERTEX_SHADER:Ljava/lang/String; = "uniform mat4 uMVPMatrix;\nuniform mat4 uTexMatrix;\nattribute vec4 aPosition;\nattribute vec4 aTextureCoord;\nvarying vec2 vTextureCoord;\nvoid main() {\n    gl_Position = uMVPMatrix * aPosition;\n    vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n}\n"


# instance fields
.field private mProgramHandle:I

.field private final mTextureTarget:I

.field private final mUTextureLoc:I

.field private final mVTextureLoc:I

.field private final mYTextureLoc:I

.field private final maPositionLoc:I

.field private final maTextureCoordLoc:I

.field private final muMVPMatrixLoc:I

.field private final muTexMatrixLoc:I


# direct methods
.method public constructor <init>(Lcom/mmc/player/opengles/GlProgram$ProgramType;)V
    .registers 6

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    sget-object v0, Lcom/mmc/player/opengles/GlProgram$1;->$SwitchMap$com$mmc$player$opengles$GlProgram$ProgramType:[I

    invoke-virtual {p1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    aget v0, v0, v1

    const/4 v1, 0x1

    const/16 v2, 0xde1

    const-string v3, "uniform mat4 uMVPMatrix;\nuniform mat4 uTexMatrix;\nattribute vec4 aPosition;\nattribute vec4 aTextureCoord;\nvarying vec2 vTextureCoord;\nvoid main() {\n    gl_Position = uMVPMatrix * aPosition;\n    vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n}\n"

    if-eq v0, v1, :cond_56

    const/4 v1, 0x2

    if-eq v0, v1, :cond_48

    const/4 v1, 0x3

    if-eq v0, v1, :cond_3d

    const/4 v1, 0x4

    if-ne v0, v1, :cond_26

    .line 3
    iput v2, p0, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    const-string v0, "precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D sTexture;\nuniform float width;\nconst vec3 COEF_Y = vec3( 0.257,  0.504,  0.114);\nconst vec3 COEF_U = vec3(-0.148, -0.289,  0.438);\nconst vec3 COEF_V = vec3( 0.438, -0.367, -0.070);\nconst float U_DIVIDE_LINE = 0.5;\nconst float V_DIVIDE_LINE = 0.75;\nvoid main()\n{\n   float offsetX = 1.0 / width;\n   if (vTextureCoord.y < U_DIVIDE_LINE) {\n       vec2 texCoord = vec2(vTextureCoord.x, vTextureCoord.y * 2.0);\n       vec4 color0 = texture2D(sTexture, vec2(texCoord.x,                 1.0 - texCoord.y));\n       vec4 color1 = texture2D(sTexture, vec2(texCoord.x + offsetX,       1.0 - texCoord.y));\n       vec4 color2 = texture2D(sTexture, vec2(texCoord.x + offsetX * 2.0, 1.0 - texCoord.y));\n       vec4 color3 = texture2D(sTexture, vec2(texCoord.x + offsetX * 3.0, 1.0 - texCoord.y));\n       float y0 = dot(color0.rgb, COEF_Y) + 16.0 / 256.0;\n       float y1 = dot(color1.rgb, COEF_Y) + 16.0 / 256.0;\n       float y2 = dot(color2.rgb, COEF_Y) + 16.0 / 256.0;\n       float y3 = dot(color3.rgb, COEF_Y) + 16.0 / 256.0;\n       gl_FragColor = vec4(y0, y1, y2, y3);\n   } else if (vTextureCoord.y < V_DIVIDE_LINE) {\n       if(vTextureCoord.x < 0.5) {\n           vec2 texCoord = vec2(vTextureCoord.x * 2.0, (vTextureCoord.y - U_DIVIDE_LINE) * 4.0);\n           vec4 color0 = texture2D(sTexture, vec2(texCoord.x,                 1.0 - texCoord.y));\n           vec4 color1 = texture2D(sTexture, vec2(texCoord.x + offsetX * 2.0, 1.0 - texCoord.y));\n           vec4 color2 = texture2D(sTexture, vec2(texCoord.x + offsetX * 4.0, 1.0 - texCoord.y));\n           vec4 color3 = texture2D(sTexture, vec2(texCoord.x + offsetX * 6.0, 1.0 - texCoord.y));\n           float u0 = dot(color0.rgb, COEF_U) + 0.5;\n           float u1 = dot(color1.rgb, COEF_U) + 0.5;\n           float u2 = dot(color2.rgb, COEF_U) + 0.5;\n           float u3 = dot(color3.rgb, COEF_U) + 0.5;\n           gl_FragColor = vec4(u0, u1, u2, u3);\n       } else {\n           gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n       }\n   } else {\n       if (vTextureCoord.x < 0.5) {\n           vec2 texCoord = vec2(vTextureCoord.x * 2.0, (vTextureCoord.y - V_DIVIDE_LINE) * 4.0);\n           vec4 color0 = texture2D(sTexture, vec2(texCoord.x,                 1.0 - texCoord.y));\n           vec4 color1 = texture2D(sTexture, vec2(texCoord.x + offsetX * 2.0, 1.0 - texCoord.y));\n           vec4 color2 = texture2D(sTexture, vec2(texCoord.x + offsetX * 4.0, 1.0 - texCoord.y));\n           vec4 color3 = texture2D(sTexture, vec2(texCoord.x + offsetX * 6.0, 1.0 - texCoord.y));\n           float v0 = dot(color0.rgb, COEF_V) + 0.5;\n           float v1 = dot(color1.rgb, COEF_V) + 0.5;\n           float v2 = dot(color2.rgb, COEF_V) + 0.5;\n           float v3 = dot(color3.rgb, COEF_V) + 0.5;\n           gl_FragColor = vec4(v0, v1, v2, v3);\n       } else {\n           gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n       }\n   }\n}\n"

    .line 4
    invoke-static {v3, v0}, Lcom/mmc/player/opengles/GlUtil;->createProgram(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    goto :goto_60

    .line 5
    :cond_26
    new-instance v0, Ljava/lang/RuntimeException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Unhandled type "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 6
    :cond_3d
    iput v2, p0, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    const-string v0, "precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D yTexture;\nuniform sampler2D uTexture;\nuniform sampler2D vTexture;\nvoid main() {\nvec3 yuv = vec3(texture2D(yTexture, vTextureCoord).r - 0.0625,\ntexture2D(uTexture, vTextureCoord).r - 0.5,\ntexture2D(vTexture, vTextureCoord).r - 0.5);\nvec3 rgb = mat3(\n1.164, 1.164, 1.164,\n0.0, -0.392, 2.017,\n1.596, -0.813, 0.0\n) * yuv;\ngl_FragColor = vec4(rgb, 1.0);\n}\n"

    .line 7
    invoke-static {v3, v0}, Lcom/mmc/player/opengles/GlUtil;->createProgram(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    goto :goto_60

    :cond_48
    const v0, 0x8d65

    .line 8
    iput v0, p0, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    const-string v0, "#extension GL_OES_EGL_image_external : require\nprecision highp float;\nvarying vec2 vTextureCoord;\nuniform samplerExternalOES sTexture;\nvoid main() {\n   gl_FragColor = texture2D(sTexture, vTextureCoord);\n}\n"

    .line 9
    invoke-static {v3, v0}, Lcom/mmc/player/opengles/GlUtil;->createProgram(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    goto :goto_60

    .line 10
    :cond_56
    iput v2, p0, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    const-string v0, "precision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D sTexture;\nvoid main() {\n   gl_FragColor = texture2D(sTexture, vTextureCoord);\n}\n"

    .line 11
    invoke-static {v3, v0}, Lcom/mmc/player/opengles/GlUtil;->createProgram(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    .line 12
    :goto_60
    iget v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    if-eqz v0, :cond_d8

    const-string v0, "Created program "

    .line 13
    invoke-static {v0}, Landroid/support/v4/media/c;->c(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 14
    iget v1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v1, " ("

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string p1, ")"

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    const-string v0, "CorePlayerGlUtil"

    invoke-static {v0, p1}, Lcom/mmc/player/log/MMCLogDelegate;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 15
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "aPosition"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetAttribLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    .line 16
    invoke-static {p1, v0}, Lcom/mmc/player/opengles/GlUtil;->checkLocation(ILjava/lang/String;)V

    .line 17
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "aTextureCoord"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetAttribLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    .line 18
    invoke-static {p1, v0}, Lcom/mmc/player/opengles/GlUtil;->checkLocation(ILjava/lang/String;)V

    .line 19
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "uMVPMatrix"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetUniformLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->muMVPMatrixLoc:I

    .line 20
    invoke-static {p1, v0}, Lcom/mmc/player/opengles/GlUtil;->checkLocation(ILjava/lang/String;)V

    .line 21
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "uTexMatrix"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetUniformLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->muTexMatrixLoc:I

    .line 22
    invoke-static {p1, v0}, Lcom/mmc/player/opengles/GlUtil;->checkLocation(ILjava/lang/String;)V

    .line 23
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "yTexture"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetUniformLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->mYTextureLoc:I

    .line 24
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "uTexture"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetUniformLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->mUTextureLoc:I

    .line 25
    iget p1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    const-string v0, "vTexture"

    invoke-static {p1, v0}, Landroid/opengl/GLES20;->glGetUniformLocation(ILjava/lang/String;)I

    move-result p1

    iput p1, p0, Lcom/mmc/player/opengles/GlProgram;->mVTextureLoc:I

    return-void

    .line 26
    :cond_d8
    new-instance p1, Ljava/lang/RuntimeException;

    const-string v0, "Unable to create program"

    invoke-direct {p1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p1
.end method

.method public static INVOKEVIRTUAL_com_mmc_player_opengles_GlProgram_com_shopee_app_asm_fix_printstack_PrintStackTraceShieldFix_printStackTrace(Ljava/lang/Exception;)V
    .registers 1

    return-void
.end method


# virtual methods
.method public draw([FLjava/nio/FloatBuffer;IIII[FLjava/nio/FloatBuffer;II)V
    .registers 24

    move-object v1, p0

    const-string v0, "glVertexAttribPointer"

    const-string v2, "glEnableVertexAttribArray"

    const-string v3, "glUniformMatrix4fv"

    :try_start_7
    const-string v4, "draw start"

    .line 1
    invoke-static {v4}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 2
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    invoke-static {v4}, Landroid/opengl/GLES20;->glUseProgram(I)V

    const-string v4, "glUseProgram"

    .line 3
    invoke-static {v4}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    const v4, 0x84c0

    .line 4
    invoke-static {v4}, Landroid/opengl/GLES20;->glActiveTexture(I)V

    .line 5
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    move/from16 v5, p9

    invoke-static {v4, v5}, Landroid/opengl/GLES20;->glBindTexture(II)V

    .line 6
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->muMVPMatrixLoc:I

    const/4 v5, 0x1

    const/4 v6, 0x0

    move-object v7, p1

    invoke-static {v4, v5, v6, p1, v6}, Landroid/opengl/GLES20;->glUniformMatrix4fv(IIZ[FI)V

    .line 7
    invoke-static {v3}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 8
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->muTexMatrixLoc:I

    move-object/from16 v7, p7

    invoke-static {v4, v5, v6, v7, v6}, Landroid/opengl/GLES20;->glUniformMatrix4fv(IIZ[FI)V

    .line 9
    invoke-static {v3}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 10
    iget v3, v1, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    invoke-static {v3}, Landroid/opengl/GLES20;->glEnableVertexAttribArray(I)V

    .line 11
    invoke-static {v2}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 12
    iget v7, v1, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    const/16 v9, 0x1406

    const/4 v10, 0x0

    move/from16 v8, p5

    move/from16 v11, p6

    move-object v12, p2

    invoke-static/range {v7 .. v12}, Landroid/opengl/GLES20;->glVertexAttribPointer(IIIZILjava/nio/Buffer;)V

    .line 13
    invoke-static {v0}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 14
    iget v3, v1, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    invoke-static {v3}, Landroid/opengl/GLES20;->glEnableVertexAttribArray(I)V

    .line 15
    invoke-static {v2}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 16
    iget v7, v1, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    const/4 v8, 0x2

    const/16 v9, 0x1406

    const/4 v10, 0x0

    move/from16 v11, p10

    move-object/from16 v12, p8

    invoke-static/range {v7 .. v12}, Landroid/opengl/GLES20;->glVertexAttribPointer(IIIZILjava/nio/Buffer;)V

    .line 17
    invoke-static {v0}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    const/4 v0, 0x5

    move/from16 v2, p3

    move/from16 v3, p4

    .line 18
    invoke-static {v0, v2, v3}, Landroid/opengl/GLES20;->glDrawArrays(III)V

    const-string v0, "glDrawArrays"

    .line 19
    invoke-static {v0}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 20
    iget v0, v1, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    invoke-static {v0}, Landroid/opengl/GLES20;->glDisableVertexAttribArray(I)V

    .line 21
    iget v0, v1, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    invoke-static {v0}, Landroid/opengl/GLES20;->glDisableVertexAttribArray(I)V

    .line 22
    iget v0, v1, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    invoke-static {v0, v6}, Landroid/opengl/GLES20;->glBindTexture(II)V

    .line 23
    invoke-static {v6}, Landroid/opengl/GLES20;->glUseProgram(I)V
    :try_end_87
    .catch Ljava/lang/Exception; {:try_start_7 .. :try_end_87} :catch_88

    goto :goto_a2

    :catch_88
    move-exception v0

    .line 24
    invoke-static {v0}, Lcom/mmc/player/opengles/GlProgram;->INVOKEVIRTUAL_com_mmc_player_opengles_GlProgram_com_shopee_app_asm_fix_printstack_PrintStackTraceShieldFix_printStackTrace(Ljava/lang/Exception;)V

    .line 25
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "draw: exception:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v2, "CorePlayerGlUtil"

    invoke-static {v2, v0}, Lcom/mmc/player/log/MMCLogDelegate;->e(Ljava/lang/String;Ljava/lang/String;)V

    :goto_a2
    return-void
.end method

.method public draw([FLjava/nio/FloatBuffer;IIII[FLjava/nio/FloatBuffer;IIII)V
    .registers 26

    move-object v1, p0

    const-string v0, "glVertexAttribPointer"

    const-string v2, "glEnableVertexAttribArray"

    const-string v3, "glUniformMatrix4fv"

    :try_start_7
    const-string v4, "draw start"

    .line 26
    invoke-static {v4}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 27
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    invoke-static {v4}, Landroid/opengl/GLES20;->glUseProgram(I)V

    const-string v4, "glUseProgram"

    .line 28
    invoke-static {v4}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 29
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mYTextureLoc:I

    const/4 v5, 0x1

    invoke-static {v4, v5}, Landroid/opengl/GLES20;->glUniform1i(II)V

    .line 30
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mUTextureLoc:I

    const/4 v6, 0x2

    invoke-static {v4, v6}, Landroid/opengl/GLES20;->glUniform1i(II)V

    .line 31
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mVTextureLoc:I

    const/4 v6, 0x3

    invoke-static {v4, v6}, Landroid/opengl/GLES20;->glUniform1i(II)V

    const v4, 0x84c1

    .line 32
    invoke-static {v4}, Landroid/opengl/GLES20;->glActiveTexture(I)V

    .line 33
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    move/from16 v6, p9

    invoke-static {v4, v6}, Landroid/opengl/GLES20;->glBindTexture(II)V

    const v4, 0x84c2

    .line 34
    invoke-static {v4}, Landroid/opengl/GLES20;->glActiveTexture(I)V

    .line 35
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    move/from16 v6, p10

    invoke-static {v4, v6}, Landroid/opengl/GLES20;->glBindTexture(II)V

    const v4, 0x84c3

    .line 36
    invoke-static {v4}, Landroid/opengl/GLES20;->glActiveTexture(I)V

    .line 37
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    move/from16 v6, p11

    invoke-static {v4, v6}, Landroid/opengl/GLES20;->glBindTexture(II)V

    .line 38
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->muMVPMatrixLoc:I

    const/4 v6, 0x0

    move-object v7, p1

    invoke-static {v4, v5, v6, p1, v6}, Landroid/opengl/GLES20;->glUniformMatrix4fv(IIZ[FI)V

    .line 39
    invoke-static {v3}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 40
    iget v4, v1, Lcom/mmc/player/opengles/GlProgram;->muTexMatrixLoc:I

    move-object/from16 v7, p7

    invoke-static {v4, v5, v6, v7, v6}, Landroid/opengl/GLES20;->glUniformMatrix4fv(IIZ[FI)V

    .line 41
    invoke-static {v3}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 42
    iget v3, v1, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    invoke-static {v3}, Landroid/opengl/GLES20;->glEnableVertexAttribArray(I)V

    .line 43
    invoke-static {v2}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 44
    iget v7, v1, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    const/16 v9, 0x1406

    const/4 v10, 0x0

    move/from16 v8, p5

    move/from16 v11, p6

    move-object v12, p2

    invoke-static/range {v7 .. v12}, Landroid/opengl/GLES20;->glVertexAttribPointer(IIIZILjava/nio/Buffer;)V

    .line 45
    invoke-static {v0}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 46
    iget v3, v1, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    invoke-static {v3}, Landroid/opengl/GLES20;->glEnableVertexAttribArray(I)V

    .line 47
    invoke-static {v2}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 48
    iget v7, v1, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    const/4 v8, 0x2

    const/16 v9, 0x1406

    const/4 v10, 0x0

    move/from16 v11, p12

    move-object/from16 v12, p8

    invoke-static/range {v7 .. v12}, Landroid/opengl/GLES20;->glVertexAttribPointer(IIIZILjava/nio/Buffer;)V

    .line 49
    invoke-static {v0}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    const/4 v0, 0x5

    move/from16 v2, p3

    move/from16 v3, p4

    .line 50
    invoke-static {v0, v2, v3}, Landroid/opengl/GLES20;->glDrawArrays(III)V

    const-string v0, "glDrawArrays"

    .line 51
    invoke-static {v0}, Lcom/mmc/player/opengles/GlUtil;->checkGlError(Ljava/lang/String;)V

    .line 52
    iget v0, v1, Lcom/mmc/player/opengles/GlProgram;->maPositionLoc:I

    invoke-static {v0}, Landroid/opengl/GLES20;->glDisableVertexAttribArray(I)V

    .line 53
    iget v0, v1, Lcom/mmc/player/opengles/GlProgram;->maTextureCoordLoc:I

    invoke-static {v0}, Landroid/opengl/GLES20;->glDisableVertexAttribArray(I)V

    .line 54
    iget v0, v1, Lcom/mmc/player/opengles/GlProgram;->mTextureTarget:I

    invoke-static {v0, v6}, Landroid/opengl/GLES20;->glBindTexture(II)V

    .line 55
    invoke-static {v6}, Landroid/opengl/GLES20;->glUseProgram(I)V
    :try_end_b2
    .catch Ljava/lang/Exception; {:try_start_7 .. :try_end_b2} :catch_b3

    goto :goto_cd

    :catch_b3
    move-exception v0

    .line 56
    invoke-static {v0}, Lcom/mmc/player/opengles/GlProgram;->INVOKEVIRTUAL_com_mmc_player_opengles_GlProgram_com_shopee_app_asm_fix_printstack_PrintStackTraceShieldFix_printStackTrace(Ljava/lang/Exception;)V

    .line 57
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "draw: exception:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v2, "CorePlayerGlUtil"

    invoke-static {v2, v0}, Lcom/mmc/player/log/MMCLogDelegate;->e(Ljava/lang/String;Ljava/lang/String;)V

    :goto_cd
    return-void
.end method

.method public release()V
    .registers 3

    const-string v0, "deleting program "

    .line 1
    invoke-static {v0}, Landroid/support/v4/media/c;->c(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 2
    iget v1, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "CorePlayerGlUtil"

    invoke-static {v1, v0}, Lcom/mmc/player/log/MMCLogDelegate;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 3
    iget v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    invoke-static {v0}, Landroid/opengl/GLES20;->glDeleteProgram(I)V

    const/4 v0, -0x1

    .line 4
    iput v0, p0, Lcom/mmc/player/opengles/GlProgram;->mProgramHandle:I

    return-void
.end method