aboutsummaryrefslogtreecommitdiff
path: root/src/GPU3D_OpenGL.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GPU3D_OpenGL.cpp')
-rw-r--r--src/GPU3D_OpenGL.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/GPU3D_OpenGL.cpp b/src/GPU3D_OpenGL.cpp
index 95243d1..1fd266f 100644
--- a/src/GPU3D_OpenGL.cpp
+++ b/src/GPU3D_OpenGL.cpp
@@ -148,9 +148,6 @@ bool BuildRenderShader(u32 flags, const char* vs, const char* fs)
GLuint prog = RenderShader[flags][2];
- GLint uni_id = glGetUniformBlockIndex(prog, "uConfig");
- glUniformBlockBinding(prog, uni_id, 0);
-
glBindAttribLocation(prog, 0, "vPosition");
glBindAttribLocation(prog, 1, "vColor");
glBindAttribLocation(prog, 2, "vTexcoord");
@@ -158,6 +155,12 @@ bool BuildRenderShader(u32 flags, const char* vs, const char* fs)
glBindFragDataLocation(prog, 0, "oColor");
glBindFragDataLocation(prog, 1, "oAttr");
+ if (!OpenGL_LinkShaderProgram(RenderShader[flags]))
+ return false;
+
+ GLint uni_id = glGetUniformBlockIndex(prog, "uConfig");
+ glUniformBlockBinding(prog, uni_id, 0);
+
glUseProgram(prog);
uni_id = glGetUniformLocation(prog, "TexMem");
@@ -202,6 +205,10 @@ bool Init()
glBindAttribLocation(ClearShaderPlain[2], 0, "vPosition");
glBindFragDataLocation(ClearShaderPlain[2], 0, "oColor");
glBindFragDataLocation(ClearShaderPlain[2], 1, "oAttr");
+
+ if (!OpenGL_LinkShaderProgram(ClearShaderPlain))
+ return false;
+
ClearUniformLoc[0] = glGetUniformLocation(ClearShaderPlain[2], "uColor");
ClearUniformLoc[1] = glGetUniformLocation(ClearShaderPlain[2], "uDepth");
ClearUniformLoc[2] = glGetUniformLocation(ClearShaderPlain[2], "uOpaquePolyID");
@@ -226,12 +233,15 @@ bool Init()
if (!OpenGL_BuildShaderProgram(kFinalPassVS, kFinalPassFS, FinalPassShader, "FinalPassShader"))
return false;
- uni_id = glGetUniformBlockIndex(FinalPassShader[2], "uConfig");
- glUniformBlockBinding(FinalPassShader[2], uni_id, 0);
-
glBindAttribLocation(FinalPassShader[2], 0, "vPosition");
glBindFragDataLocation(FinalPassShader[2], 0, "oColor");
+ if (!OpenGL_LinkShaderProgram(FinalPassShader))
+ return false;
+
+ uni_id = glGetUniformBlockIndex(FinalPassShader[2], "uConfig");
+ glUniformBlockBinding(FinalPassShader[2], uni_id, 0);
+
glUseProgram(FinalPassShader[2]);
uni_id = glGetUniformLocation(FinalPassShader[2], "DepthBuffer");