2021-06-27 20:44:35 +00:00
|
|
|
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 */
|
2021-07-13 20:23:20 +00:00
|
|
|
public c.o.a.o.b f1500c = new c.o.a.o.c();
|
2021-06-27 20:44:35 +00:00
|
|
|
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();
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1500c = this.d;
|
2021-06-27 20:44:35 +00:00
|
|
|
this.d = null;
|
|
|
|
}
|
|
|
|
if (this.e == -1) {
|
2021-07-13 20:23:20 +00:00
|
|
|
String c2 = this.f1500c.c();
|
|
|
|
String h = this.f1500c.h();
|
2021-06-27 20:44:35 +00:00
|
|
|
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;
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1500c.j(r0);
|
2021-06-27 20:44:35 +00:00
|
|
|
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();
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1500c.e(j, this.b);
|
2021-06-27 20:44:35 +00:00
|
|
|
this.a.b();
|
|
|
|
GLES20.glUseProgram(0);
|
|
|
|
d.b("glUseProgram(0)");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void b() {
|
|
|
|
if (this.e != -1) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1500c.f();
|
2021-06-27 20:44:35 +00:00
|
|
|
GLES20.glDeleteProgram(this.e);
|
|
|
|
this.e = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|