mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Merge default into minor.
--HG-- branch : minor
This commit is contained in:
@@ -521,7 +521,8 @@ void Canvas::stopGrab(bool switchingToOtherCanvas)
|
||||
// Make sure the canvas texture is up to date if we're using MSAA.
|
||||
resolveMSAA(false);
|
||||
|
||||
gl.matrices.projection.pop_back();
|
||||
if (gl.matrices.projection.size() > 1)
|
||||
gl.matrices.projection.pop_back();
|
||||
|
||||
if (!switchingToOtherCanvas)
|
||||
{
|
||||
|
||||
@@ -252,8 +252,6 @@ bool Graphics::setMode(int width, int height)
|
||||
|
||||
created = true;
|
||||
|
||||
setViewportSize(width, height);
|
||||
|
||||
// Enable blending
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
@@ -310,6 +308,8 @@ bool Graphics::setMode(int width, int height)
|
||||
if (quadIndices == nullptr)
|
||||
quadIndices = new QuadIndices(20);
|
||||
|
||||
setViewportSize(width, height);
|
||||
|
||||
// Restore the graphics state.
|
||||
restoreState(states.back());
|
||||
|
||||
@@ -1658,13 +1658,10 @@ Graphics::Stats Graphics::getStats() const
|
||||
|
||||
double Graphics::getSystemLimit(SystemLimit limittype) const
|
||||
{
|
||||
GLfloat limits[2];
|
||||
|
||||
switch (limittype)
|
||||
{
|
||||
case Graphics::LIMIT_POINT_SIZE:
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, limits);
|
||||
return (double) limits[1];
|
||||
return (double) gl.getMaxPointSize();
|
||||
case Graphics::LIMIT_TEXTURE_SIZE:
|
||||
return (double) gl.getMaxTextureSize();
|
||||
case Graphics::LIMIT_MULTI_CANVAS:
|
||||
|
||||
@@ -289,6 +289,10 @@ void OpenGL::initMaxValues()
|
||||
maxRenderbufferSamples = 0;
|
||||
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
|
||||
GLfloat limits[2];
|
||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, limits);
|
||||
maxPointSize = limits[1];
|
||||
}
|
||||
|
||||
void OpenGL::initMatrices()
|
||||
@@ -656,6 +660,11 @@ int OpenGL::getMaxTextureUnits() const
|
||||
return maxTextureUnits;
|
||||
}
|
||||
|
||||
float OpenGL::getMaxPointSize() const
|
||||
{
|
||||
return maxPointSize;
|
||||
}
|
||||
|
||||
void OpenGL::updateTextureMemorySize(size_t oldsize, size_t newsize)
|
||||
{
|
||||
int64 memsize = (int64) stats.textureMemory + ((int64) newsize - (int64) oldsize);
|
||||
|
||||
@@ -377,6 +377,12 @@ public:
|
||||
**/
|
||||
int getMaxTextureUnits() const;
|
||||
|
||||
/**
|
||||
* Returns the maximum point size.
|
||||
**/
|
||||
float getMaxPointSize() const;
|
||||
|
||||
|
||||
void updateTextureMemorySize(size_t oldsize, size_t newsize);
|
||||
|
||||
/**
|
||||
@@ -408,6 +414,7 @@ private:
|
||||
int maxRenderTargets;
|
||||
int maxRenderbufferSamples;
|
||||
int maxTextureUnits;
|
||||
float maxPointSize;
|
||||
|
||||
Vendor vendor;
|
||||
|
||||
|
||||
@@ -26,20 +26,35 @@
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#elif defined(LOVE_IOS)
|
||||
#include "common/ios.h"
|
||||
#elif defined(LOVE_ANDROID)
|
||||
#include "common/android.h"
|
||||
#elif defined(LOVE_LINUX)
|
||||
#include <spawn.h>
|
||||
//#include <stdlib.h>
|
||||
//#include <unistd.h>
|
||||
#elif defined(LOVE_LINUX) || defined(LOVE_ANDROID)
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#elif defined(LOVE_WINDOWS)
|
||||
#include "common/utf8.h"
|
||||
#include <shlobj.h>
|
||||
#include <shellapi.h>
|
||||
#pragma comment(lib, "shell32.lib")
|
||||
#endif
|
||||
#if defined(LOVE_ANDROID)
|
||||
#include "common/android.h"
|
||||
#elif defined(LOVE_LINUX)
|
||||
#include <spawn.h>
|
||||
#endif
|
||||
|
||||
#if defined(LOVE_LINUX)
|
||||
static void sigchld_handler(int sig)
|
||||
{
|
||||
// Because waitpid can set errno, we need to save it.
|
||||
auto old = errno;
|
||||
|
||||
// Reap whilst there are children waiting to be reaped.
|
||||
while (waitpid(-1, nullptr, WNOHANG) > 0)
|
||||
;
|
||||
|
||||
errno = old;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -50,12 +65,14 @@ System::System()
|
||||
{
|
||||
#if defined(LOVE_LINUX)
|
||||
// Enable automatic cleanup of zombie processes
|
||||
// NOTE: We're using our own handler, instead of SA_NOCLDWAIT because the
|
||||
// latter breaks wait, and thus os.execute.
|
||||
// NOTE: This isn't perfect, due to multithreading our SIGCHLD can happen
|
||||
// on a different thread than the one calling wait(), thus causing a race.
|
||||
struct sigaction act = {0};
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_handler = SIG_DFL;
|
||||
act.sa_flags = SA_NOCLDWAIT;
|
||||
|
||||
// Requires linux 2.6 or higher, so anything remotely modern
|
||||
act.sa_handler = sigchld_handler;
|
||||
act.sa_flags = SA_RESTART;
|
||||
sigaction(SIGCHLD, &act, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
// LOVE
|
||||
#include "common/config.h"
|
||||
#include "common/int.h"
|
||||
#include "common/delay.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#if defined(LOVE_WINDOWS)
|
||||
@@ -85,6 +86,12 @@ void Timer::step()
|
||||
}
|
||||
}
|
||||
|
||||
void Timer::sleep(double seconds) const
|
||||
{
|
||||
if (seconds > 0)
|
||||
love::sleep((unsigned int)(seconds*1000));
|
||||
}
|
||||
|
||||
double Timer::getDelta() const
|
||||
{
|
||||
return dt;
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
* usually 1ms.
|
||||
* @param seconds The number of seconds to sleep for.
|
||||
**/
|
||||
virtual void sleep(double seconds) const = 0;
|
||||
virtual void sleep(double seconds) const;
|
||||
|
||||
/**
|
||||
* Gets the time between the last two frames, assuming step is called
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
|
||||
// LOVE
|
||||
#include "Timer.h"
|
||||
#include "common/delay.h"
|
||||
|
||||
// SDL
|
||||
#include <SDL.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -34,15 +30,12 @@ namespace sdl
|
||||
|
||||
Timer::Timer()
|
||||
{
|
||||
// Init the SDL timer system (needed for SDL_Delay.)
|
||||
if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
|
||||
throw love::Exception("Could not initialize SDL timer subsystem (%s)", SDL_GetError());
|
||||
// We don't need to initialize the SDL timer subsystem for SDL_Delay to
|
||||
// function - and doing so causes SDL to create a worker thread.
|
||||
}
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
// Quit SDL timer.
|
||||
SDL_QuitSubSystem(SDL_INIT_TIMER);
|
||||
}
|
||||
|
||||
const char *Timer::getName() const
|
||||
@@ -50,12 +43,6 @@ const char *Timer::getName() const
|
||||
return "love.timer.sdl";
|
||||
}
|
||||
|
||||
void Timer::sleep(double seconds) const
|
||||
{
|
||||
if (seconds > 0)
|
||||
love::sleep((unsigned int)(seconds*1000));
|
||||
}
|
||||
|
||||
} // sdl
|
||||
} // timer
|
||||
} // love
|
||||
|
||||
@@ -37,11 +37,8 @@ public:
|
||||
|
||||
Timer();
|
||||
virtual ~Timer();
|
||||
|
||||
const char *getName() const override;
|
||||
|
||||
void sleep(double seconds) const override;
|
||||
|
||||
}; // Timer
|
||||
|
||||
} // sdl
|
||||
|
||||
Reference in New Issue
Block a user