blitter: Move linking outside of vrend_renderer_blit_gl

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Elie Tournier 4 years ago
parent 534868e150
commit 5dc1aaef5a
  1. 30
      src/vrend_blitter.c

@ -100,6 +100,24 @@ static GLint build_and_check(GLenum shader_type, const char *buf)
return id; return id;
} }
static bool link_and_check(GLuint prog_id)
{
GLint lret;
glLinkProgram(prog_id);
glGetProgramiv(prog_id, GL_LINK_STATUS, &lret);
if (lret == GL_FALSE) {
char infolog[65536];
int len;
glGetProgramInfoLog(prog_id, 65536, &len, infolog);
vrend_printf("got error linking\n%s\n", infolog);
/* dump shaders */
glDeleteProgram(prog_id);
return false;
}
return true;
}
static void create_dest_swizzle_snippet(const uint8_t swizzle[4], static void create_dest_swizzle_snippet(const uint8_t swizzle[4],
char snippet[DEST_SWIZZLE_SNIPPET_SIZE]) char snippet[DEST_SWIZZLE_SNIPPET_SIZE])
{ {
@ -629,7 +647,6 @@ void vrend_renderer_blit_gl(MAYBE_UNUSED struct vrend_context *ctx,
GLuint buffers; GLuint buffers;
GLuint prog_id; GLuint prog_id;
GLuint fs_id; GLuint fs_id;
GLint lret;
GLuint pos_loc, tc_loc; GLuint pos_loc, tc_loc;
bool has_depth, has_stencil; bool has_depth, has_stencil;
bool blit_stencil, blit_depth; bool blit_stencil, blit_depth;
@ -692,17 +709,8 @@ void vrend_renderer_blit_gl(MAYBE_UNUSED struct vrend_context *ctx,
} }
glAttachShader(prog_id, fs_id); glAttachShader(prog_id, fs_id);
glLinkProgram(prog_id); if(!link_and_check(prog_id))
glGetProgramiv(prog_id, GL_LINK_STATUS, &lret);
if (lret == GL_FALSE) {
char infolog[65536];
int len;
glGetProgramInfoLog(prog_id, 65536, &len, infolog);
vrend_printf("got error linking\n%s\n", infolog);
/* dump shaders */
glDeleteProgram(prog_id);
return; return;
}
glUseProgram(prog_id); glUseProgram(prog_id);

Loading…
Cancel
Save