mirror of https://github.com/bjornbytes/lovr.git
Compare commits
3 Commits
756b184306
...
24fd9e0c04
Author | SHA1 | Date |
---|---|---|
|
24fd9e0c04 | |
|
ae4d7156fd | |
|
7f22e18533 |
|
@ -324,6 +324,7 @@ static void luax_checkbufferformat(lua_State* L, int index, BufferInfo* info) {
|
|||
lua_rawgeti(L, index, i + 1);
|
||||
if (lua_istable(L, -1)) {
|
||||
lua_getfield(L, -1, "type");
|
||||
lovrAssert(lua_type(L, -1) == LUA_TSTRING, "When given as a table, Buffer fields must have a 'type' key.");
|
||||
field->type = luax_checkfieldtype(L, -1, &field->hash);
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
@ -554,21 +555,26 @@ static int l_lovrGraphicsInit(lua_State* L) {
|
|||
|
||||
static int l_lovrGraphicsSubmit(lua_State* L) {
|
||||
bool table = lua_istable(L, 1);
|
||||
int count = table ? luax_len(L, 1) : lua_gettop(L);
|
||||
int length = table ? luax_len(L, 1) : lua_gettop(L);
|
||||
uint32_t count = 0;
|
||||
|
||||
Pass* stack[8];
|
||||
Pass** passes = (size_t) count > COUNTOF(stack) ? malloc(count * sizeof(Pass*)) : stack;
|
||||
Pass** passes = (size_t) length > COUNTOF(stack) ? malloc(length * sizeof(Pass*)) : stack;
|
||||
lovrAssert(passes, "Out of memory");
|
||||
|
||||
if (table) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
lua_rawgeti(L, 1, i + 1);
|
||||
passes[i] = luax_checktype(L, -1, Pass);
|
||||
if (lua_toboolean(L, -1)) {
|
||||
passes[count++] = luax_checktype(L, -1, Pass);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < count; i++) {
|
||||
passes[i] = luax_checktype(L, i + 1, Pass);
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (lua_toboolean(L, i + 1)) {
|
||||
passes[count++] = luax_checktype(L, i + 1, Pass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1870,7 +1870,7 @@ bool gpu_init(gpu_config* config) {
|
|||
};
|
||||
|
||||
if (state.config.vk.createDevice) {
|
||||
VK(state.config.vk.createDevice(state.instance, &deviceInfo, NULL, &state.device, (void*) vkGetInstanceProcAddr), "Device creation failed") return gpu_destroy(), false;
|
||||
VK(state.config.vk.createDevice(state.instance, &deviceInfo, NULL, (uintptr_t) &state.device, (void*) vkGetInstanceProcAddr), "Device creation failed") return gpu_destroy(), false;
|
||||
} else {
|
||||
VK(vkCreateDevice(state.adapter, &deviceInfo, NULL, &state.device), "Device creation failed") return gpu_destroy(), false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue