lovr.graphics.getSupported;

This commit is contained in:
bjorn 2018-08-03 11:43:15 -07:00
parent f6f322fc7f
commit 1b7261de5c
3 changed files with 24 additions and 0 deletions

View File

@ -327,6 +327,14 @@ int l_lovrGraphicsGetDimensions(lua_State* L) {
return 2;
}
int l_lovrGraphicsGetSupported(lua_State* L) {
GraphicsFeatures features = lovrGraphicsGetSupported();
lua_newtable(L);
lua_pushboolean(L, features.writableBlocks);
lua_setfield(L, -2, "writableBlocks");
return 1;
}
int l_lovrGraphicsGetSystemLimits(lua_State* L) {
GraphicsLimits limits = lovrGraphicsGetLimits();
lua_newtable(L);
@ -1202,6 +1210,7 @@ const luaL_Reg lovrGraphics[] = {
{ "getWidth", l_lovrGraphicsGetWidth },
{ "getHeight", l_lovrGraphicsGetHeight },
{ "getDimensions", l_lovrGraphicsGetDimensions },
{ "getSupported", l_lovrGraphicsGetSupported },
{ "getSystemLimits", l_lovrGraphicsGetSystemLimits },
{ "getStats", l_lovrGraphicsGetStats },

View File

@ -67,6 +67,10 @@ typedef enum {
WINDING_COUNTERCLOCKWISE
} Winding;
typedef struct {
bool writableBlocks;
} GraphicsFeatures;
typedef struct {
bool initialized;
float pointSizes[2];
@ -165,6 +169,7 @@ void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const cha
void lovrGraphicsGetDimensions(int* width, int* height);
int lovrGraphicsGetMSAA();
void lovrGraphicsSetCamera(Camera* camera, bool clear);
GraphicsFeatures lovrGraphicsGetSupported();
GraphicsLimits lovrGraphicsGetLimits();
GraphicsStats lovrGraphicsGetStats();

View File

@ -801,6 +801,16 @@ void lovrGpuPresent() {
#endif
}
GraphicsFeatures lovrGraphicsGetSupported() {
return (GraphicsFeatures) {
#ifdef EMSCRIPTEN
.writableBlocks = GLAD_GL_ARB_shader_storage_blocks
#else
.writableBlocks = false
#endif
};
}
GraphicsLimits lovrGraphicsGetLimits() {
if (!state.limits.initialized) {
#ifdef EMSCRIPTEN