render/gles2: remove matrix transposition in shaders

master
emersion 7 years ago
parent 7894fca224
commit f1cbbac636
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -181,7 +181,7 @@ static bool wlr_gles2_render_texture_with_matrix(
} }
wlr_texture_bind(texture); wlr_texture_bind(texture);
GL_CALL(glUniformMatrix3fv(0, 1, GL_FALSE, matrix)); GL_CALL(glUniformMatrix3fv(0, 1, GL_TRUE, matrix));
GL_CALL(glUniform1i(1, texture->inverted_y)); GL_CALL(glUniform1i(1, texture->inverted_y));
GL_CALL(glUniform1f(3, alpha)); GL_CALL(glUniform1f(3, alpha));
draw_quad(); draw_quad();
@ -192,7 +192,7 @@ static bool wlr_gles2_render_texture_with_matrix(
static void wlr_gles2_render_quad(struct wlr_renderer *wlr_renderer, static void wlr_gles2_render_quad(struct wlr_renderer *wlr_renderer,
const float color[static 4], const float matrix[static 9]) { const float color[static 4], const float matrix[static 9]) {
GL_CALL(glUseProgram(shaders.quad)); GL_CALL(glUseProgram(shaders.quad));
GL_CALL(glUniformMatrix3fv(0, 1, GL_FALSE, matrix)); GL_CALL(glUniformMatrix3fv(0, 1, GL_TRUE, matrix));
GL_CALL(glUniform4f(1, color[0], color[1], color[2], color[3])); GL_CALL(glUniform4f(1, color[0], color[1], color[2], color[3]));
draw_quad(); draw_quad();
} }

@ -10,20 +10,8 @@ const GLchar quad_vertex_src[] =
"varying vec4 v_color;" "varying vec4 v_color;"
"varying vec2 v_texcoord;" "varying vec2 v_texcoord;"
"" ""
"mat3 transpose(in mat3 inMatrix) {"
" vec3 i0 = inMatrix[0];"
" vec3 i1 = inMatrix[1];"
" vec3 i2 = inMatrix[2];"
" mat3 outMatrix = mat3("
" vec3(i0.x, i1.x, i2.x),"
" vec3(i0.y, i1.y, i2.y),"
" vec3(i0.z, i1.z, i2.z)"
" );"
" return outMatrix;"
"}"
""
"void main() {" "void main() {"
" gl_Position = vec4(transpose(proj) * vec3(pos, 1.0), 1.0);" " gl_Position = vec4(proj * vec3(pos, 1.0), 1.0);"
" v_color = color;" " v_color = color;"
" v_texcoord = texcoord;" " v_texcoord = texcoord;"
"}"; "}";
@ -57,20 +45,8 @@ const GLchar vertex_src[] =
"attribute vec2 texcoord;" "attribute vec2 texcoord;"
"varying vec2 v_texcoord;" "varying vec2 v_texcoord;"
"" ""
"mat3 transpose(in mat3 inMatrix) {"
" vec3 i0 = inMatrix[0];"
" vec3 i1 = inMatrix[1];"
" vec3 i2 = inMatrix[2];"
" mat3 outMatrix = mat3("
" vec3(i0.x, i1.x, i2.x),"
" vec3(i0.y, i1.y, i2.y),"
" vec3(i0.z, i1.z, i2.z)"
" );"
" return outMatrix;"
"}"
""
"void main() {" "void main() {"
" gl_Position = vec4(transpose(proj) * vec3(pos, 1.0), 1.0);" " gl_Position = vec4(proj * vec3(pos, 1.0), 1.0);"
" if (invert_y) {" " if (invert_y) {"
" v_texcoord = vec2(texcoord.s, 1.0 - texcoord.t);" " v_texcoord = vec2(texcoord.s, 1.0 - texcoord.t);"
" } else {" " } else {"

Loading…
Cancel
Save