aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-03-15 21:30:31 +0100
committeremersion <contact@emersion.fr>2018-03-15 21:30:31 +0100
commitf1cbbac636d59d22373883f6bc85f8863e01c8c5 (patch)
treed3271199d12dad21d07ecae5bf640c1949f0c30b /render
parent7894fca22498f79f73b8f3c5853dd22a1727cd1c (diff)
render/gles2: remove matrix transposition in shaders
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c4
-rw-r--r--render/gles2/shaders.c28
2 files changed, 4 insertions, 28 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 0324ad64..a212e908 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -181,7 +181,7 @@ static bool wlr_gles2_render_texture_with_matrix(
}
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(glUniform1f(3, alpha));
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,
const float color[static 4], const float matrix[static 9]) {
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]));
draw_quad();
}
diff --git a/render/gles2/shaders.c b/render/gles2/shaders.c
index a64b941e..2e9386d0 100644
--- a/render/gles2/shaders.c
+++ b/render/gles2/shaders.c
@@ -10,20 +10,8 @@ const GLchar quad_vertex_src[] =
"varying vec4 v_color;"
"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() {"
-" 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_texcoord = texcoord;"
"}";
@@ -57,20 +45,8 @@ const GLchar vertex_src[] =
"attribute vec2 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() {"
-" gl_Position = vec4(transpose(proj) * vec3(pos, 1.0), 1.0);"
+" gl_Position = vec4(proj * vec3(pos, 1.0), 1.0);"
" if (invert_y) {"
" v_texcoord = vec2(texcoord.s, 1.0 - texcoord.t);"
" } else {"