mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Added love.graphics.getStats. It returns a table with performance-related graphics statistics. Currently it contains these fields:
drawcalls: The number of internal draw calls made so far in the current frame. canvasswitches: The number of times the active Canvas has been changed so far in the current frame. texturememory: The approximate amount of video memory (in bytes) used by OpenGL textures created by Images, Canvases, and Fonts. images: The number of active Image objects. canvases: The number of active Canvas objects. fonts: The number of active Font objects.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "image/ImageData.h"
|
||||
#include "common/Matrix.h"
|
||||
#include "common/StringMap.h"
|
||||
#include "common/int.h"
|
||||
#include "Texture.h"
|
||||
#include "OpenGL.h"
|
||||
|
||||
@@ -127,6 +128,9 @@ public:
|
||||
// Whether the main screen should have linear -> sRGB conversions enabled.
|
||||
static bool screenHasSRGB;
|
||||
|
||||
static int switchCount;
|
||||
static int canvasCount;
|
||||
|
||||
static bool getConstant(const char *in, Format &out);
|
||||
static bool getConstant(Format in, const char *&out);
|
||||
|
||||
@@ -136,6 +140,7 @@ private:
|
||||
|
||||
static Format getSizedFormat(Format format);
|
||||
static void convertFormat(Format format, GLenum &internalformat, GLenum &externalformat, GLenum &type);
|
||||
static size_t getFormatBitsPerPixel(Format format);
|
||||
|
||||
GLuint fbo;
|
||||
GLuint resolve_fbo;
|
||||
@@ -153,6 +158,8 @@ private:
|
||||
int msaa_samples;
|
||||
bool msaa_dirty;
|
||||
|
||||
size_t texture_memory;
|
||||
|
||||
void setupGrab();
|
||||
void drawv(const Matrix &t, const Vertex *v);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user