From b97765b16935f9c7339686e372f245ec16ba97ec Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 18 Jan 2013 00:29:01 +0100 Subject: [PATCH 1/4] Check for OpenGL 2.0 in NPOT check (issue #538) --- src/modules/graphics/opengl/Image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index c85b1b5ba..81f17d376 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -357,7 +357,7 @@ void Image::drawv(const Matrix &t, const vertex *v) const bool Image::hasNpot() { - return GLEE_ARB_texture_non_power_of_two != 0; + return GLEE_VERSION_2_0 || GLEE_ARB_texture_non_power_of_two; } bool Image::hasMipmapSupport() From 49961d66c737a2c9b50e319e869f21f2c7fb2a77 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 18 Jan 2013 00:32:25 +0100 Subject: [PATCH 2/4] Fix setVolumeLimits (issue #537) --- src/modules/audio/wrap_Source.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/audio/wrap_Source.cpp b/src/modules/audio/wrap_Source.cpp index 291d28b14..34a5afd3b 100644 --- a/src/modules/audio/wrap_Source.cpp +++ b/src/modules/audio/wrap_Source.cpp @@ -232,7 +232,7 @@ int w_Source_setVolumeLimits(lua_State *L) if (vmin < .0f || vmin > 1.f || vmax < .0f || vmax > 1.f) return luaL_error(L, "Invalid volume limits: [%f:%f]. Must be in [0:1]", vmin, vmax); t->setMinVolume(vmin); - t->setMaxVolume(vmin); + t->setMaxVolume(vmax); return 0; } From 501beb7d023caffc425b39aeb20f30c7c370a4ec Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 18 Jan 2013 00:48:36 +0100 Subject: [PATCH 3/4] Add blend mode 'none' (issue #536) --- src/modules/graphics/Graphics.cpp | 1 + src/modules/graphics/Graphics.h | 1 + src/modules/graphics/opengl/Graphics.cpp | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 58019c017..c29896bad 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -124,6 +124,7 @@ StringMap::Entry Graphics::blendM { "subtractive", Graphics::BLEND_SUBTRACTIVE }, { "multiplicative", Graphics::BLEND_MULTIPLICATIVE }, { "premultiplied", Graphics::BLEND_PREMULTIPLIED }, + { "none", Graphics::BLEND_NONE }, }; StringMap Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries)); diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index 4926aa90a..2480184f9 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -57,6 +57,7 @@ public: BLEND_SUBTRACTIVE, BLEND_MULTIPLICATIVE, BLEND_PREMULTIPLIED, + BLEND_NONE, BLEND_MAX_ENUM }; diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 182deccc4..f33cb3eb0 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -549,6 +549,8 @@ void Graphics::setBlendMode(Graphics::BlendMode mode) glBlendFunc(GL_DST_COLOR, GL_ZERO); else if (mode == BLEND_PREMULTIPLIED) glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + else if (mode == BLEND_NONE) + glBlendFunc(GL_ONE, GL_ZERO); else // mode == BLEND_ADDITIVE || mode == BLEND_SUBTRACTIVE glBlendFunc(GL_SRC_ALPHA, GL_ONE); } @@ -584,6 +586,8 @@ Graphics::BlendMode Graphics::getBlendMode() return BLEND_MULTIPLICATIVE; else if (src == GL_ONE && dst == GL_ONE_MINUS_SRC_ALPHA) // && equation == GL_FUNC_ADD return BLEND_PREMULTIPLIED; + else if (src == GL_ONE && dst == GL_ZERO) + return BLEND_NONE; return BLEND_MAX_ENUM; // Should never be reached. } From a72c981c3215dc8419508f74daee1c37eaa303eb Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 18 Jan 2013 00:55:28 +0100 Subject: [PATCH 4/4] Make sure love.errhand gets a local reference to print as well, and find the error handler at errortime (partial #390) --- src/scripts/boot.lua | 11 ++++++++--- src/scripts/boot.lua.h | 26 ++++++++++++++++---------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 5fed6e914..9603ca741 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -682,7 +682,7 @@ end -- Error screen. ----------------------------------------------------------- -local debug = debug +local debug, print = debug, print local function error_printer(msg, layer) print((debug.traceback("Error: " .. tostring(msg), 1+(layer or 1)):gsub("\n[^\n]+$", ""))) @@ -801,6 +801,11 @@ function love.releaseerrhand(msg) end end +local function deferErrhand(...) + local handler = ((love._release and love.releaseerrhand) or love.errhand or error_printer) + return handler(...) +end + ----------------------------------------------------------- -- The root of all calls. @@ -809,9 +814,9 @@ end return function() local result = xpcall(love.boot, error_printer) if not result then return 1 end - local result = xpcall(love.init, love._release and love.releaseerrhand or love.errhand) + local result = xpcall(love.init, deferErrhand) if not result then return 1 end - local result, retval = xpcall(love.run, love._release and love.releaseerrhand or love.errhand) + local result, retval = xpcall(love.run, deferErrhand) if not result then return 1 end return tonumber(retval) or 0 diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 9156b20f3..f1b0244be 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -1667,8 +1667,8 @@ const unsigned char boot_lua[] = 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, - 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x64, 0x65, 0x62, 0x75, 0x67, 0x20, 0x3d, 0x20, 0x64, 0x65, 0x62, 0x75, - 0x67, 0x0a, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2c, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, + 0x20, 0x3d, 0x20, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2c, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x28, 0x6d, 0x73, 0x67, 0x2c, 0x20, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x29, 0x0a, @@ -1845,6 +1845,17 @@ const unsigned char boot_lua[] = 0x09, 0x09, 0x64, 0x72, 0x61, 0x77, 0x28, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x65, 0x6e, 0x64, 0x0a, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x65, 0x66, + 0x65, 0x72, 0x45, 0x72, 0x72, 0x68, 0x61, 0x6e, 0x64, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a, + 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x28, + 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x61, 0x6e, 0x64, + 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x65, 0x72, 0x72, 0x68, 0x61, + 0x6e, 0x64, 0x29, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x72, 0x72, 0x68, 0x61, 0x6e, + 0x64, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x29, 0x0a, + 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x28, 0x2e, 0x2e, + 0x2e, 0x29, 0x0a, + 0x65, 0x6e, 0x64, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, @@ -1862,18 +1873,13 @@ const unsigned char boot_lua[] = 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x31, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x3d, 0x20, 0x78, 0x70, - 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2c, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x65, 0x72, 0x72, 0x68, 0x61, 0x6e, 0x64, 0x20, - 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x72, 0x72, 0x68, 0x61, 0x6e, 0x64, 0x29, 0x0a, + 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2c, 0x20, 0x64, 0x65, + 0x66, 0x65, 0x72, 0x45, 0x72, 0x72, 0x68, 0x61, 0x6e, 0x64, 0x29, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x31, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2c, 0x20, 0x72, 0x65, 0x74, 0x76, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x78, 0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, - 0x72, 0x75, 0x6e, 0x2c, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x65, - 0x72, 0x72, 0x68, 0x61, 0x6e, 0x64, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x72, 0x72, - 0x68, 0x61, 0x6e, 0x64, 0x29, 0x0a, + 0x72, 0x75, 0x6e, 0x2c, 0x20, 0x64, 0x65, 0x66, 0x65, 0x72, 0x45, 0x72, 0x72, 0x68, 0x61, 0x6e, 0x64, 0x29, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x31, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x6f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x28, 0x72,