discord-jadx/app/src/main/java/c/o/a/r/c.java

83 lines
2.5 KiB
Java

package c.o.a.r;
import android.opengl.GLES20;
import androidx.annotation.NonNull;
import c.d.b.a.a;
import c.o.b.a.d;
import c.o.b.c.f;
import c.o.b.f.b;
import d0.p;
import d0.z.d.m;
/* compiled from: GlTextureDrawer */
public class c {
public final b a;
public float[] b = ((float[]) d.a.clone());
@NonNull
/* renamed from: c reason: collision with root package name */
public c.o.a.o.b f1503c = new c.o.a.o.c();
public c.o.a.o.b d = null;
public int e = -1;
public c(@NonNull b bVar) {
this.a = bVar;
}
public void a(long j) {
if (this.d != null) {
b();
this.f1503c = this.d;
this.d = null;
}
if (this.e == -1) {
String c2 = this.f1503c.c();
String h = this.f1503c.h();
m.checkNotNullParameter(c2, "vertexShaderSource");
m.checkNotNullParameter(h, "fragmentShaderSource");
c.o.b.d.c[] cVarArr = {new c.o.b.d.c(f.n, c2), new c.o.b.d.c(f.o, h)};
m.checkNotNullParameter(cVarArr, "shaders");
int r0 = p.m86constructorimpl(GLES20.glCreateProgram());
d.b("glCreateProgram");
if (r0 != 0) {
for (int i = 0; i < 2; i++) {
GLES20.glAttachShader(r0, p.m86constructorimpl(cVarArr[i].b));
d.b("glAttachShader");
}
GLES20.glLinkProgram(r0);
int[] iArr = new int[1];
GLES20.glGetProgramiv(r0, f.m, iArr, 0);
int i2 = iArr[0];
int i3 = f.a;
if (i2 == 1) {
this.e = r0;
this.f1503c.j(r0);
d.b("program creation");
} else {
StringBuilder L = a.L("Could not link program: ");
L.append(GLES20.glGetProgramInfoLog(r0));
String sb = L.toString();
GLES20.glDeleteProgram(r0);
throw new RuntimeException(sb);
}
} else {
throw new RuntimeException("Could not create program");
}
}
GLES20.glUseProgram(this.e);
d.b("glUseProgram(handle)");
this.a.a();
this.f1503c.e(j, this.b);
this.a.b();
GLES20.glUseProgram(0);
d.b("glUseProgram(0)");
}
public void b() {
if (this.e != -1) {
this.f1503c.f();
GLES20.glDeleteProgram(this.e);
this.e = -1;
}
}
}