mirror of https://github.com/bjornbytes/lovr.git
Refactor graphics stats;
This commit is contained in:
parent
0ee5d0b8f2
commit
4239bc46ea
|
@ -374,7 +374,7 @@ int l_lovrGraphicsGetStats(lua_State* L) {
|
||||||
lua_createtable(L, 0, 2);
|
lua_createtable(L, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpuStats stats = lovrGraphicsGetStats();
|
GraphicsStats stats = lovrGraphicsGetStats();
|
||||||
|
|
||||||
lua_pushinteger(L, stats.drawCalls);
|
lua_pushinteger(L, stats.drawCalls);
|
||||||
lua_setfield(L, 1, "drawcalls");
|
lua_setfield(L, 1, "drawcalls");
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int shaderSwitches;
|
int shaderSwitches;
|
||||||
int drawCalls;
|
int drawCalls;
|
||||||
} GpuStats;
|
} GraphicsStats;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BLEND_ALPHA,
|
BLEND_ALPHA,
|
||||||
|
@ -120,7 +120,6 @@ void gpuDestroy();
|
||||||
void gpuClear(Canvas** canvas, int canvasCount, Color* color, float* depth, int* stencil);
|
void gpuClear(Canvas** canvas, int canvasCount, Color* color, float* depth, int* stencil);
|
||||||
void gpuDraw(GpuDrawCommand* command);
|
void gpuDraw(GpuDrawCommand* command);
|
||||||
void gpuPresent();
|
void gpuPresent();
|
||||||
GpuStats gpuGetStats();
|
|
||||||
|
|
||||||
// Ephemeral
|
// Ephemeral
|
||||||
void gpuBindFramebuffer(uint32_t framebuffer);
|
void gpuBindFramebuffer(uint32_t framebuffer);
|
||||||
|
|
|
@ -144,10 +144,6 @@ void lovrGraphicsGetDimensions(int* width, int* height) {
|
||||||
glfwGetFramebufferSize(state.window, width, height);
|
glfwGetFramebufferSize(state.window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpuStats lovrGraphicsGetStats() {
|
|
||||||
return gpuGetStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
// State
|
// State
|
||||||
|
|
||||||
Color lovrGraphicsGetBackgroundColor() {
|
Color lovrGraphicsGetBackgroundColor() {
|
||||||
|
|
|
@ -72,7 +72,7 @@ void lovrGraphicsClear(Color* color, float* depth, int* stencil);
|
||||||
void lovrGraphicsPresent();
|
void lovrGraphicsPresent();
|
||||||
void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const char* title, const char* icon);
|
void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const char* title, const char* icon);
|
||||||
void lovrGraphicsGetDimensions(int* width, int* height);
|
void lovrGraphicsGetDimensions(int* width, int* height);
|
||||||
GpuStats lovrGraphicsGetStats();
|
GraphicsStats lovrGraphicsGetStats();
|
||||||
|
|
||||||
// State
|
// State
|
||||||
Color lovrGraphicsGetBackgroundColor();
|
Color lovrGraphicsGetBackgroundColor();
|
||||||
|
|
|
@ -29,7 +29,7 @@ static struct {
|
||||||
uint32_t vertexBuffer;
|
uint32_t vertexBuffer;
|
||||||
uint32_t viewport[4];
|
uint32_t viewport[4];
|
||||||
bool srgb;
|
bool srgb;
|
||||||
GpuStats stats;
|
GraphicsStats stats;
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
static void gammaCorrectColor(Color* color) {
|
static void gammaCorrectColor(Color* color) {
|
||||||
|
@ -353,7 +353,7 @@ void gpuPresent() {
|
||||||
memset(&state.stats, 0, sizeof(state.stats));
|
memset(&state.stats, 0, sizeof(state.stats));
|
||||||
}
|
}
|
||||||
|
|
||||||
GpuStats gpuGetStats() {
|
GraphicsStats lovrGraphicsGetStats() {
|
||||||
return state.stats;
|
return state.stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue