Browse Source

Revert Shader:send to cause a Lua error instead of returning false,

if the given variable doesn't exist or is optimized out in the shader.
Alex Szpakowski 3 years ago
parent
commit
041aa2fc23
1 changed files with 3 additions and 9 deletions
  1. 3 9
      src/modules/graphics/wrap_Shader.cpp

+ 3 - 9
src/modules/graphics/wrap_Shader.cpp

@@ -447,18 +447,12 @@ int w_Shader_send(lua_State *L)
 
 	const Shader::UniformInfo *info = shader->getUniformInfo(name);
 	if (info == nullptr)
-	{
-		luax_pushboolean(L, false);
-		return 1;
-	}
+		return luaL_error(L, "Shader uniform '%s' does not exist.\nA common error is to define but not use the variable.", name);
 
 	if (luax_istype(L, 3, Data::type) || (info->baseType == Shader::UNIFORM_MATRIX && luax_istype(L, 4, Data::type)))
-		w_Shader_sendData(L, 3, shader, info, false);
+		return w_Shader_sendData(L, 3, shader, info, false);
 	else
-		w_Shader_sendLuaValues(L, 3, shader, info, name);
-
-	luax_pushboolean(L, true);
-	return 1;
+		return w_Shader_sendLuaValues(L, 3, shader, info, name);
 }
 
 int w_Shader_sendColors(lua_State *L)