From 346aa7d839230a578135478c776529e6e6c2ee86 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 4 Sep 2014 13:33:18 -0300 Subject: [PATCH 1/6] Fixed a memory leak in Sources created from SoundData. --- src/modules/audio/openal/Source.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/audio/openal/Source.cpp b/src/modules/audio/openal/Source.cpp index 20d2daf09..1415048e4 100644 --- a/src/modules/audio/openal/Source.cpp +++ b/src/modules/audio/openal/Source.cpp @@ -68,7 +68,10 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData) , toLoop(0) { ALenum fmt = getFormat(soundData->getChannels(), soundData->getBitDepth()); - staticBuffer = new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate()); + staticBuffer.set(new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate())); + + // The buffer has a +2 retain count right now, but we want it to have +1. + staticBuffer->release(); float z[3] = {0, 0, 0}; From f972c9923f2796589454422d5e0aa5415c2de1f0 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 11 Sep 2014 02:42:56 -0300 Subject: [PATCH 2/6] Fixed love.graphics.reset reverting the current font to nil and breaking love.graphics.print. --- src/modules/graphics/opengl/Graphics.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index f44d2b7e6..e98dec6a2 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -615,6 +615,12 @@ Color Graphics::getBackgroundColor() const void Graphics::setFont(Font *font) { + // Hack: the Lua-facing love.graphics.print function will set the current + // font if needed, but only on its first call... we want to make sure a nil + // font is never accidentally set (e.g. via love.graphics.reset.) + if (font == nullptr) + return; + DisplayState &state = states.back(); state.font.set(font); } @@ -1289,11 +1295,6 @@ void Graphics::pop() { DisplayState &newstate = states[states.size() - 2]; - // Hack: the Lua-facing love.graphics.print function will set the current - // font if needed, but only on its first call... we always want a font. - if (newstate.font.get() == nullptr) - newstate.font.set(states.back().font.get()); - restoreStateChecked(newstate); // The last two states in the stack should be equal now. From 00944c5f5de658958ceccd84b8da67f4c68ef2b6 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 14 Sep 2014 15:58:37 -0300 Subject: [PATCH 3/6] =?UTF-8?q?Added=20love.window.toPixels(x=20[,=20y])?= =?UTF-8?q?=20and=20love.window.fromPixels(x=20[,=20y]),=20for=20easier=20?= =?UTF-8?q?conversion=20between=20window-space=20and=20pixel-space=20value?= =?UTF-8?q?s=20when=20highdpi=20mode=20is=20enabled=20on=20a=20retina=20di?= =?UTF-8?q?splay=20in=20OS=20X=20(and=20in=20the=20iOS=20and=20Android=20p?= =?UTF-8?q?orts=20of=20L=C3=96VE.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/window/Window.h | 5 ++++ src/modules/window/sdl/Window.cpp | 24 ++++++++++++++++ src/modules/window/sdl/Window.h | 5 ++++ src/modules/window/wrap_Window.cpp | 44 ++++++++++++++++++++++++++++++ src/modules/window/wrap_Window.h | 2 ++ src/scripts/boot.lua | 9 +++--- src/scripts/boot.lua.h | 27 ++++++++---------- 7 files changed, 96 insertions(+), 20 deletions(-) diff --git a/src/modules/window/Window.h b/src/modules/window/Window.h index b7988f313..d1e8a1688 100644 --- a/src/modules/window/Window.h +++ b/src/modules/window/Window.h @@ -148,6 +148,11 @@ public: virtual double getPixelScale() const = 0; + virtual double toPixels(double x) const = 0; + virtual void toPixels(double wx, double wy, double &px, double &py) const = 0; + virtual double fromPixels(double x) const = 0; + virtual void fromPixels(double px, double py, double &wx, double &wy) const = 0; + virtual const void *getHandle() const = 0; virtual bool showMessageBox(MessageBoxType type, const std::string &title, const std::string &message, bool attachtowindow) = 0; diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 8bc0d1935..5a18cf6cb 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -682,6 +682,30 @@ double Window::getPixelScale() const return scale; } +double Window::toPixels(double x) const +{ + return x * getPixelScale(); +} + +void Window::toPixels(double wx, double wy, double &px, double &py) const +{ + double scale = getPixelScale(); + px = wx * scale; + py = wy * scale; +} + +double Window::fromPixels(double x) const +{ + return x / getPixelScale(); +} + +void Window::fromPixels(double px, double py, double &wx, double &wy) const +{ + double scale = getPixelScale(); + wx = px / scale; + wy = py / scale; +} + const void *Window::getHandle() const { return window; diff --git a/src/modules/window/sdl/Window.h b/src/modules/window/sdl/Window.h index 495dd6870..3f3df0a05 100644 --- a/src/modules/window/sdl/Window.h +++ b/src/modules/window/sdl/Window.h @@ -85,6 +85,11 @@ public: double getPixelScale() const; + double toPixels(double x) const; + void toPixels(double wx, double wy, double &px, double &py) const; + double fromPixels(double x) const; + void fromPixels(double px, double py, double &wx, double &wy) const; + const void *getHandle() const; bool showMessageBox(MessageBoxType type, const std::string &title, const std::string &message, bool attachtowindow); diff --git a/src/modules/window/wrap_Window.cpp b/src/modules/window/wrap_Window.cpp index c828c1379..2e91c39c5 100644 --- a/src/modules/window/wrap_Window.cpp +++ b/src/modules/window/wrap_Window.cpp @@ -333,6 +333,48 @@ int w_getPixelScale(lua_State *L) return 1; } +int w_toPixels(lua_State *L) +{ + double wx = luaL_checknumber(L, 1); + + if (lua_isnoneornil(L, 2)) + { + lua_pushnumber(L, instance()->toPixels(wx)); + return 1; + } + + double wy = luaL_checknumber(L, 2); + double px = 0.0, py = 0.0; + + instance()->toPixels(wx, wy, px, py); + + lua_pushnumber(L, px); + lua_pushnumber(L, py); + + return 2; +} + +int w_fromPixels(lua_State *L) +{ + double px = luaL_checknumber(L, 1); + + if (lua_isnoneornil(L, 2)) + { + lua_pushnumber(L, instance()->fromPixels(px)); + return 1; + } + + double py = luaL_checknumber(L, 2); + double wx = 0.0, wy = 0.0; + + instance()->fromPixels(px, py, wx, wy); + + lua_pushnumber(L, wx); + lua_pushnumber(L, wy); + + return 2; +} + int w_minimize(lua_State* /*L*/) { instance()->minimize(); @@ -421,6 +463,8 @@ static const luaL_Reg functions[] = { "hasMouseFocus", w_hasMouseFocus }, { "isVisible", w_isVisible }, { "getPixelScale", w_getPixelScale }, + { "toPixels", w_toPixels }, + { "fromPixels", w_fromPixels }, { "minimize", w_minimize }, { "showMessageBox", w_showMessageBox }, { 0, 0 } diff --git a/src/modules/window/wrap_Window.h b/src/modules/window/wrap_Window.h index ea7383aac..1f784d09c 100644 --- a/src/modules/window/wrap_Window.h +++ b/src/modules/window/wrap_Window.h @@ -49,6 +49,8 @@ int w_hasFocus(lua_State *L); int w_hasMouseFocus(lua_State *L); int w_isVisible(lua_State *L); int w_getPixelScale(lua_State *L); +int w_toPixels(lua_State *L); +int w_fromPixels(lua_State *L); int w_minimize(lua_State *L); int w_showMessageBox(lua_State *L); extern "C" LOVE_EXPORT int luaopen_love_window(lua_State *L); diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 90d8d14ad..424779d57 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -1427,9 +1427,8 @@ function love.nogame() g_time = g_time + dt / 2 local int, frac = math.modf(g_time) update_rain(frac) - local scale = love.window.getPixelScale() - inspector.x = love.graphics.getWidth() * 0.45 / scale - inspector.y = love.graphics.getHeight() * 0.55 / scale + inspector.x = love.window.fromPixels(love.graphics.getWidth() * 0.45) + inspector.y = love.window.fromPixels(love.graphics.getHeight() * 0.55) end local function draw_grid() @@ -1565,7 +1564,7 @@ function love.errhand(msg) end if love.audio then love.audio.stop() end love.graphics.reset() - local font = love.graphics.setNewFont(math.floor(14 * love.window.getPixelScale())) + local font = love.graphics.setNewFont(math.floor(love.window.toPixels(14))) local sRGB = select(3, love.window.getMode()).srgb if sRGB and love.math then @@ -1599,7 +1598,7 @@ function love.errhand(msg) p = string.gsub(p, "%[string \"(.-)\"%]", "%1") local function draw() - local pos = 70 * love.window.getPixelScale() + local pos = love.window.toPixels(70) love.graphics.clear() love.graphics.printf(p, pos, pos, love.graphics.getWidth() - pos) love.graphics.present() diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index ea01b84db..0c67f66c5 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -5027,17 +5027,14 @@ const unsigned char boot_lua[] = 0x29, 0x0a, 0x09, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x28, 0x66, 0x72, 0x61, 0x63, 0x29, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, 0x78, 0x65, 0x6c, - 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x57, 0x69, 0x64, - 0x74, 0x68, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x20, 0x2f, 0x20, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x0a, + 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x69, 0x78, 0x65, + 0x6c, 0x73, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, + 0x65, 0x74, 0x57, 0x69, 0x64, 0x74, 0x68, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x48, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x35, 0x20, 0x2f, 0x20, 0x73, 0x63, 0x61, - 0x6c, 0x65, 0x0a, + 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x69, 0x78, 0x65, + 0x6c, 0x73, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, + 0x65, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x35, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x72, 0x61, 0x77, 0x5f, 0x67, 0x72, 0x69, 0x64, 0x28, 0x29, 0x0a, @@ -5293,9 +5290,9 @@ const unsigned char boot_lua[] = 0x65, 0x74, 0x28, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x46, 0x6f, - 0x6e, 0x74, 0x28, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x28, 0x31, 0x34, 0x20, 0x2a, - 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, - 0x78, 0x65, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x29, 0x29, 0x0a, + 0x6e, 0x74, 0x28, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x28, 0x6c, 0x6f, 0x76, 0x65, + 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x74, 0x6f, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x28, 0x31, + 0x34, 0x29, 0x29, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x28, 0x33, 0x2c, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x29, 0x29, 0x2e, 0x73, 0x72, 0x67, 0x62, 0x0a, @@ -5348,9 +5345,9 @@ const unsigned char boot_lua[] = 0x5c, 0x22, 0x25, 0x5d, 0x22, 0x2c, 0x20, 0x22, 0x25, 0x31, 0x22, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x72, 0x61, 0x77, 0x28, 0x29, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x70, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x37, 0x30, 0x20, 0x2a, - 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, - 0x78, 0x65, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x0a, + 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x70, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, + 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x74, 0x6f, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x28, 0x37, + 0x30, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x28, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, From 793ef5db014cc8e4100e136b904b15bc7b23c0eb Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 15 Sep 2014 17:43:31 +0200 Subject: [PATCH 4/6] Apply foo0's patch to disable mpg123 in cmake megasource builds (issues #931 and #404) --- CMakeLists.txt | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff68c49f9..007b00087 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ else() endif() option(LOVE_JIT "Use LuaJIT" TRUE) +option(LOVE_MPG123 "Use mpg123" TRUE) if(LOVE_JIT) message(STATUS "LuaJIT: Enabled") @@ -53,6 +54,10 @@ else() message(STATUS "LuaJIT: Disabled") endif() +if(NOT LOVE_MPG123) + add_definitions(-DLOVE_NOMPG123) +endif() + message(STATUS "Target platform: ${LOVE_TARGET_PLATFORM}") find_package(OpenGL) @@ -610,8 +615,6 @@ set(LOVE_SRC_MODULE_SOUND_LULLABY src/modules/sound/lullaby/GmeDecoder.h src/modules/sound/lullaby/ModPlugDecoder.cpp src/modules/sound/lullaby/ModPlugDecoder.h - src/modules/sound/lullaby/Mpg123Decoder.cpp - src/modules/sound/lullaby/Mpg123Decoder.h src/modules/sound/lullaby/Sound.cpp src/modules/sound/lullaby/Sound.h src/modules/sound/lullaby/VorbisDecoder.cpp @@ -620,6 +623,14 @@ set(LOVE_SRC_MODULE_SOUND_LULLABY src/modules/sound/lullaby/WaveDecoder.h ) +if(LOVE_MPG123) + set(LOVE_SRC_MODULE_SOUND_LULLABY + ${LOVE_SRC_MODULE_SOUND_LULLABY} + src/modules/sound/lullaby/Mpg123Decoder.cpp + src/modules/sound/lullaby/Mpg123Decoder.h + ) +endif() + set(LOVE_SRC_MODULE_SOUND ${LOVE_SRC_MODULE_SOUND_ROOT} ${LOVE_SRC_MODULE_SOUND_LULLABY} @@ -1096,7 +1107,6 @@ set(LOVE_MEGA_3P ${MEGA_LIBVORBIS} ${MEGA_LUA} ${MEGA_MODPLUG} - ${MEGA_MPEG123} ${MEGA_OPENAL} ${MEGA_PHYSFS} ${MEGA_SDL2MAIN} @@ -1105,6 +1115,14 @@ set(LOVE_MEGA_3P ${MEGA_ZLIB} ) +if(LOVE_MPG123) + set(LOVE_MEGA_3P + ${LOVE_MEGA_3P} + ${MEGA_MPEG123} + ) +endif() + + set(LOVE_LINK_LIBRARIES ${OPENGL_gl_LIBRARY} ${LOVE_MEGA_3P} @@ -1144,7 +1162,10 @@ target_link_libraries(love liblove) # Add post build steps to move the DLLs next to the binary. Otherwise # running/debugging the binary will not work from inside VS. -add_move_dll(love ${MEGA_MPEG123}) +if(LOVE_MPG123) + add_move_dll(love ${MEGA_MPEG123}) +endif() + add_move_dll(love ${MEGA_SDL2}) add_move_dll(love ${MEGA_OPENAL}) add_move_dll(love ${MEGA_DEVIL}) From 604bc3410671e667c7d31406c7523ad596f7d408 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 16 Sep 2014 14:24:04 -0300 Subject: [PATCH 5/6] Hopefully fixed the default filesystem identity when a game is fused to the executable in Windows. --- src/scripts/boot.lua | 2 ++ src/scripts/boot.lua.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 424779d57..c27337796 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -81,6 +81,8 @@ end -- Returns the leaf of a full path. function love.path.leaf(p) + p = love.path.normalslashes(p) + local a = 1 local last = p diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 0c67f66c5..e9b29a1b6 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -168,6 +168,8 @@ const unsigned char boot_lua[] = 0x66, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x0a, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x6c, 0x65, 0x61, 0x66, 0x28, 0x70, 0x29, 0x0a, + 0x09, 0x70, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x6e, 0x6f, 0x72, + 0x6d, 0x61, 0x6c, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x73, 0x28, 0x70, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x61, 0x20, 0x3d, 0x20, 0x31, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x3d, 0x20, 0x70, 0x0a, 0x09, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x20, 0x64, 0x6f, 0x0a, From 417173b43afd979fb26d948470e1aa226f78cdf1 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 16 Sep 2014 22:34:22 -0300 Subject: [PATCH 6/6] GLSL precision qualifiers (lowp, mediump, highp) can now be used for variables in shader code on desktops without causing a compile error, although they do nothing. --- src/scripts/graphics.lua | 3 +++ src/scripts/graphics.lua.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/scripts/graphics.lua b/src/scripts/graphics.lua index 7d83c5184..d80cc30db 100644 --- a/src/scripts/graphics.lua +++ b/src/scripts/graphics.lua @@ -1292,6 +1292,9 @@ do local GLSL_VERSION = "#version 120" local GLSL_SYNTAX = [[ +#define lowp +#define mediump +#define highp #define number float #define Image sampler2D #define extern uniform diff --git a/src/scripts/graphics.lua.h b/src/scripts/graphics.lua.h index d2218faaa..761236a4c 100644 --- a/src/scripts/graphics.lua.h +++ b/src/scripts/graphics.lua.h @@ -6269,6 +6269,9 @@ const unsigned char graphics_lua[] = 0x09, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x5f, 0x53, 0x59, 0x4e, 0x54, 0x41, 0x58, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a, + 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x0a, + 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x0a, + 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x70,