From ec17811aa9a70ee6350e7b80544f7a0cb0bee7fa Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 24 Nov 2015 15:14:57 -0400 Subject: [PATCH] The 'dimension' field is no longer needed when passing matrices-as-flat-tables to Shader:sendMatrix. --- src/modules/graphics/opengl/wrap_Shader.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modules/graphics/opengl/wrap_Shader.cpp b/src/modules/graphics/opengl/wrap_Shader.cpp index 497f523d4..ccd1d3345 100644 --- a/src/modules/graphics/opengl/wrap_Shader.cpp +++ b/src/modules/graphics/opengl/wrap_Shader.cpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace love { @@ -242,6 +243,8 @@ int w_Shader_sendMatrix(lua_State *L) if (!lua_isnoneornil(L, -1)) dimension = (int) lua_tointeger(L, -1); + else + dimension = (int) sqrtf((float) luax_objlen(L, 3)); lua_pop(L, 1); } @@ -265,11 +268,7 @@ int w_Shader_sendMatrix(lua_State *L) lua_pop(L, 1); if (!table_of_tables) - { - lua_getfield(L, 3+i, "dimension"); - other_dimension = lua_tointeger(L, -1); - lua_pop(L, 1); - } + other_dimension = (int) sqrtf((float) luax_objlen(L, 3+i)); if (other_dimension != dimension) {