mirror of https://github.com/bjornbytes/lovr.git
Fix gcc warnings;
This commit is contained in:
parent
5d5c79b5b1
commit
fb1447503b
|
@ -16,6 +16,11 @@ CFLAGS += -I$(ROOT)/src/lib/stdatomic
|
||||||
CFLAGS += -fvisibility=hidden
|
CFLAGS += -fvisibility=hidden
|
||||||
CFLAGS += -Wall -Wextra
|
CFLAGS += -Wall -Wextra
|
||||||
CFLAGS += -Wno-unused-parameter
|
CFLAGS += -Wno-unused-parameter
|
||||||
|
CFLAGS_glad.c += -Wno-pedantic
|
||||||
|
CFLAGS_os_android.c += -Wno-format-pedantic
|
||||||
|
CFLAGS_headset_openvr.c += -Wno-unused-variable -Wno-typedef-redefinition -Wno-pedantic
|
||||||
|
CFLAGS_headset_vrapi.c += -Wno-c11-extensions -Wno-gnu-empty-initializer -Wno-pedantic
|
||||||
|
CFLAGS_miniaudio.c += -Wno-unused-function
|
||||||
CFLAGS_@(STRICT) += -Werror
|
CFLAGS_@(STRICT) += -Werror
|
||||||
FLAGS_@(DEBUG) += -g
|
FLAGS_@(DEBUG) += -g
|
||||||
FLAGS_@(OPTIMIZE) += -Oz
|
FLAGS_@(OPTIMIZE) += -Oz
|
||||||
|
@ -247,7 +252,7 @@ CFLAGS += $(FLAGS) $(FLAGS_y) $(DISABLE_n) $(CFLAGS_y) @(EXTRA_CFLAGS)
|
||||||
LDFLAGS += $(FLAGS) $(FLAGS_y) $(LDFLAGS_y) $(LDFLAGS_y_y) @(EXTRA_LDFLAGS)
|
LDFLAGS += $(FLAGS) $(FLAGS_y) $(LDFLAGS_y) $(LDFLAGS_y_y) @(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
## Macros
|
## Macros
|
||||||
!cc = |> ^o CC %b^ $(CC) $(CFLAGS) -o %o -c %f |>
|
!cc = |> ^o CC %b^ $(CC) $(CFLAGS) $(CFLAGS_%b) -o %o -c %f |>
|
||||||
!ld = |> ^ LD %o^ $(CC) -o %o %f $(LDFLAGS) |>
|
!ld = |> ^ LD %o^ $(CC) -o %o %f $(LDFLAGS) |>
|
||||||
!xd = |> ^ XD %f^ xxd -i %f > %o |>
|
!xd = |> ^ XD %f^ xxd -i %f > %o |>
|
||||||
!cp = |> ^ CP %b^ cp %f %o |>
|
!cp = |> ^ CP %b^ cp %f %o |>
|
||||||
|
|
|
@ -10,8 +10,9 @@ typedef void destructorFn(void*);
|
||||||
|
|
||||||
// Object names are lightuserdata because Variants need a non-Lua string due to threads.
|
// Object names are lightuserdata because Variants need a non-Lua string due to threads.
|
||||||
static int luax_meta__tostring(lua_State* L) {
|
static int luax_meta__tostring(lua_State* L) {
|
||||||
lua_getfield(L, -1, "__name");
|
lua_getfield(L, -1, "__info");
|
||||||
lua_pushstring(L, (const char*) lua_touserdata(L, -1));
|
TypeInfo* info = lua_touserdata(L, -1);
|
||||||
|
lua_pushstring(L, info->name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +20,10 @@ static int luax_meta__gc(lua_State* L) {
|
||||||
Proxy* p = lua_touserdata(L, 1);
|
Proxy* p = lua_touserdata(L, 1);
|
||||||
if (p) {
|
if (p) {
|
||||||
lua_getmetatable(L, 1);
|
lua_getmetatable(L, 1);
|
||||||
lua_getfield(L, -1, "__destructor");
|
lua_getfield(L, -1, "__info");
|
||||||
destructorFn* destructor = (destructorFn*) lua_tocfunction(L, -1);
|
TypeInfo* info = lua_touserdata(L, -1);
|
||||||
if (destructor) {
|
if (info->destructor) {
|
||||||
lovrRelease(p->object, destructor);
|
lovrRelease(p->object, info->destructor);
|
||||||
p->object = NULL;
|
p->object = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,18 +51,16 @@ void _luax_registertype(lua_State* L, const char* name, const luaL_Reg* function
|
||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
lua_setfield(L, -1, "__index");
|
lua_setfield(L, -1, "__index");
|
||||||
|
|
||||||
|
// m.__info = info
|
||||||
|
TypeInfo* info = lua_newuserdata(L, sizeof(TypeInfo));
|
||||||
|
info->name = name;
|
||||||
|
info->destructor = destructor;
|
||||||
|
lua_setfield(L, -2, "__info");
|
||||||
|
|
||||||
// m.__gc = gc
|
// m.__gc = gc
|
||||||
lua_pushcfunction(L, luax_meta__gc);
|
lua_pushcfunction(L, luax_meta__gc);
|
||||||
lua_setfield(L, -2, "__gc");
|
lua_setfield(L, -2, "__gc");
|
||||||
|
|
||||||
// m.__destructor = destructor (used to release reference)
|
|
||||||
lua_pushcfunction(L, (lua_CFunction) destructor);
|
|
||||||
lua_setfield(L, -2, "__destructor");
|
|
||||||
|
|
||||||
// m.__name = name
|
|
||||||
lua_pushlightuserdata(L, (void*) name);
|
|
||||||
lua_setfield(L, -2, "__name");
|
|
||||||
|
|
||||||
// m.__tostring
|
// m.__tostring
|
||||||
lua_pushcfunction(L, luax_meta__tostring);
|
lua_pushcfunction(L, luax_meta__tostring);
|
||||||
lua_setfield(L, -2, "__tostring");
|
lua_setfield(L, -2, "__tostring");
|
||||||
|
|
|
@ -110,6 +110,11 @@ extern StringEntry lovrWrapMode[];
|
||||||
|
|
||||||
// General helpers
|
// General helpers
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char* name;
|
||||||
|
void (*destructor)(void*);
|
||||||
|
} TypeInfo;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t hash;
|
uint64_t hash;
|
||||||
void* object;
|
void* object;
|
||||||
|
|
|
@ -111,7 +111,7 @@ static int l_lovrSoundGetFrames(lua_State* L) {
|
||||||
case LUA_TNONE:
|
case LUA_TNONE:
|
||||||
lua_settop(L, index - 1);
|
lua_settop(L, index - 1);
|
||||||
lua_createtable(L, count * lovrSoundGetChannelCount(sound), 0);
|
lua_createtable(L, count * lovrSoundGetChannelCount(sound), 0);
|
||||||
// fallthrough;
|
// fallthrough
|
||||||
case LUA_TTABLE:
|
case LUA_TTABLE:
|
||||||
dstOffset = luaL_optinteger(L, index + 1, 1);
|
dstOffset = luaL_optinteger(L, index + 1, 1);
|
||||||
lua_settop(L, index);
|
lua_settop(L, index);
|
||||||
|
@ -162,7 +162,7 @@ static int l_lovrSoundGetFrames(lua_State* L) {
|
||||||
lua_pushinteger(L, frames);
|
lua_pushinteger(L, frames);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
// fallthrough;
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
return luax_typeerror(L, index, "nil, table, Blob, or Sound");
|
return luax_typeerror(L, index, "nil, table, Blob, or Sound");
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,14 +150,11 @@ void luax_checkvariant(lua_State* L, int index, Variant* variant) {
|
||||||
Proxy* proxy = lua_touserdata(L, index);
|
Proxy* proxy = lua_touserdata(L, index);
|
||||||
lua_getmetatable(L, index);
|
lua_getmetatable(L, index);
|
||||||
|
|
||||||
lua_pushliteral(L, "__name");
|
lua_pushliteral(L, "__info");
|
||||||
lua_rawget(L, -2);
|
lua_rawget(L, -2);
|
||||||
variant->value.object.type = (const char*) lua_touserdata(L, -1);
|
TypeInfo* info = lua_touserdata(L, -1);
|
||||||
lua_pop(L, 1);
|
variant->value.object.type = info->name;
|
||||||
|
variant->value.object.destructor = info->destructor;
|
||||||
lua_pushliteral(L, "__destructor");
|
|
||||||
lua_rawget(L, -2);
|
|
||||||
variant->value.object.destructor = (void (*)(void*)) lua_tocfunction(L, -1);
|
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
variant->value.object.pointer = proxy->object;
|
variant->value.object.pointer = proxy->object;
|
||||||
|
|
|
@ -66,7 +66,7 @@ static int l_lovrCurveGetPointCount(lua_State* L) {
|
||||||
static int l_lovrCurveGetPoint(lua_State* L) {
|
static int l_lovrCurveGetPoint(lua_State* L) {
|
||||||
Curve* curve = luax_checktype(L, 1, Curve);
|
Curve* curve = luax_checktype(L, 1, Curve);
|
||||||
size_t index = luaL_checkinteger(L, 2) - 1;
|
size_t index = luaL_checkinteger(L, 2) - 1;
|
||||||
lovrAssert(index >= 0 && index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
lovrAssert(index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
||||||
float point[4];
|
float point[4];
|
||||||
lovrCurveGetPoint(curve, index, point);
|
lovrCurveGetPoint(curve, index, point);
|
||||||
lua_pushnumber(L, point[0]);
|
lua_pushnumber(L, point[0]);
|
||||||
|
@ -78,7 +78,7 @@ static int l_lovrCurveGetPoint(lua_State* L) {
|
||||||
static int l_lovrCurveSetPoint(lua_State* L) {
|
static int l_lovrCurveSetPoint(lua_State* L) {
|
||||||
Curve* curve = luax_checktype(L, 1, Curve);
|
Curve* curve = luax_checktype(L, 1, Curve);
|
||||||
size_t index = luaL_checkinteger(L, 2) - 1;
|
size_t index = luaL_checkinteger(L, 2) - 1;
|
||||||
lovrAssert(index >= 0 && index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
lovrAssert(index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
||||||
float point[4];
|
float point[4];
|
||||||
luax_readvec3(L, 3, point, NULL);
|
luax_readvec3(L, 3, point, NULL);
|
||||||
lovrCurveSetPoint(curve, index, point);
|
lovrCurveSetPoint(curve, index, point);
|
||||||
|
@ -89,8 +89,8 @@ static int l_lovrCurveAddPoint(lua_State* L) {
|
||||||
Curve* curve = luax_checktype(L, 1, Curve);
|
Curve* curve = luax_checktype(L, 1, Curve);
|
||||||
float point[4];
|
float point[4];
|
||||||
int i = luax_readvec3(L, 2, point, NULL);
|
int i = luax_readvec3(L, 2, point, NULL);
|
||||||
size_t index = lua_isnoneornil(L, i) ? lovrCurveGetPointCount(curve) : luaL_checkinteger(L, i) - 1;
|
size_t index = lua_isnoneornil(L, i) ? lovrCurveGetPointCount(curve) : (size_t) luaL_checkinteger(L, i) - 1;
|
||||||
lovrAssert(index >= 0 && index <= lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
lovrAssert(index <= lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
||||||
lovrCurveAddPoint(curve, point, index);
|
lovrCurveAddPoint(curve, point, index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ static int l_lovrCurveAddPoint(lua_State* L) {
|
||||||
static int l_lovrCurveRemovePoint(lua_State* L) {
|
static int l_lovrCurveRemovePoint(lua_State* L) {
|
||||||
Curve* curve = luax_checktype(L, 1, Curve);
|
Curve* curve = luax_checktype(L, 1, Curve);
|
||||||
size_t index = luaL_checkinteger(L, 2) - 1;
|
size_t index = luaL_checkinteger(L, 2) - 1;
|
||||||
lovrAssert(index >= 0 && index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
lovrAssert(index < lovrCurveGetPointCount(curve), "Invalid Curve point index: %d", index + 1);
|
||||||
lovrCurveRemovePoint(curve, index);
|
lovrCurveRemovePoint(curve, index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ typedef enum {
|
||||||
AUDIO_CAPTURE_PERMISSION
|
AUDIO_CAPTURE_PERMISSION
|
||||||
} Permission;
|
} Permission;
|
||||||
|
|
||||||
|
typedef void (*os_proc)(void);
|
||||||
typedef void (*quitCallback)(void);
|
typedef void (*quitCallback)(void);
|
||||||
typedef void (*windowFocusCallback)(bool focused);
|
typedef void (*windowFocusCallback)(bool focused);
|
||||||
typedef void (*windowResizeCallback)(int width, int height);
|
typedef void (*windowResizeCallback)(int width, int height);
|
||||||
|
@ -160,7 +161,7 @@ void lovrPlatformGetWindowSize(int* width, int* height);
|
||||||
void lovrPlatformGetFramebufferSize(int* width, int* height);
|
void lovrPlatformGetFramebufferSize(int* width, int* height);
|
||||||
void lovrPlatformSetSwapInterval(int interval);
|
void lovrPlatformSetSwapInterval(int interval);
|
||||||
void lovrPlatformSwapBuffers(void);
|
void lovrPlatformSwapBuffers(void);
|
||||||
void* lovrPlatformGetProcAddress(const char* function);
|
os_proc lovrPlatformGetProcAddress(const char* function);
|
||||||
void lovrPlatformOnQuitRequest(quitCallback callback);
|
void lovrPlatformOnQuitRequest(quitCallback callback);
|
||||||
void lovrPlatformOnWindowFocus(windowFocusCallback callback);
|
void lovrPlatformOnWindowFocus(windowFocusCallback callback);
|
||||||
void lovrPlatformOnWindowResize(windowResizeCallback callback);
|
void lovrPlatformOnWindowResize(windowResizeCallback callback);
|
||||||
|
|
|
@ -7,10 +7,7 @@
|
||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
|
|
||||||
// This is probably bad, but makes things easier to build
|
// This is probably bad, but makes things easier to build
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wformat-pedantic"
|
|
||||||
#include <android_native_app_glue.c>
|
#include <android_native_app_glue.c>
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
struct android_app* app;
|
struct android_app* app;
|
||||||
|
|
|
@ -305,8 +305,8 @@ void lovrPlatformSwapBuffers() {
|
||||||
glfwSwapBuffers(glfwState.window);
|
glfwSwapBuffers(glfwState.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* lovrPlatformGetProcAddress(const char* function) {
|
os_proc lovrPlatformGetProcAddress(const char* function) {
|
||||||
return (void*) glfwGetProcAddress(function);
|
return (os_proc) glfwGetProcAddress(function);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrPlatformOnQuitRequest(quitCallback callback) {
|
void lovrPlatformOnQuitRequest(quitCallback callback) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ void lovrLog(int level, const char* tag, const char* format, ...) {
|
||||||
|
|
||||||
// Refcounting
|
// Refcounting
|
||||||
#if ATOMIC_INT_LOCK_FREE != 2
|
#if ATOMIC_INT_LOCK_FREE != 2
|
||||||
#error "Lock-free integer atomics are not supported on this platform, but are required for refcounting
|
#error "Lock-free integer atomics are not supported on this platform, but are required for refcounting"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lovrRetain(void* object) {
|
void lovrRetain(void* object) {
|
||||||
|
|
|
@ -73,12 +73,12 @@ void* zip_load(zip_state* zip, size_t offset, bool* compressed) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t compression;
|
uint16_t compression = readu16(p + 8);
|
||||||
*compressed = compression = readu16(p + 8);
|
|
||||||
if (compression != 0 && compression != 8) {
|
if (compression != 0 && compression != 8) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*compressed = (compression == 8);
|
||||||
uint32_t skip = readu16(p + 26) + readu16(p + 28);
|
uint32_t skip = readu16(p + 26) + readu16(p + 28);
|
||||||
return p + 30 + skip;
|
return p + 30 + skip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,4 @@
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#define MA_NO_RUNTIME_LINKING
|
#define MA_NO_RUNTIME_LINKING
|
||||||
#endif
|
#endif
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wunused-function"
|
|
||||||
#include "miniaudio.h"
|
#include "miniaudio.h"
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
|
@ -4,8 +4,4 @@
|
||||||
#define STBI_ONLY_PNG
|
#define STBI_ONLY_PNG
|
||||||
#define STBI_ONLY_HDR
|
#define STBI_ONLY_HDR
|
||||||
#define STBI_ASSERT(x)
|
#define STBI_ASSERT(x)
|
||||||
#define STBI_FAILURE_USERMSG
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wsign-compare"
|
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
|
@ -4120,7 +4120,7 @@ static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z)
|
||||||
if (s >= 16) return -1; // invalid code!
|
if (s >= 16) return -1; // invalid code!
|
||||||
// code size is s, so:
|
// code size is s, so:
|
||||||
b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
|
b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
|
||||||
if (b >= sizeof (z->size)) return -1; // some data was corrupt somewhere!
|
if (b >= (int) sizeof (z->size)) return -1; // some data was corrupt somewhere!
|
||||||
if (z->size[b] != s) return -1; // was originally an assert, but report failure instead.
|
if (z->size[b] != s) return -1; // was originally an assert, but report failure instead.
|
||||||
a->code_buffer >>= s;
|
a->code_buffer >>= s;
|
||||||
a->num_bits -= s;
|
a->num_bits -= s;
|
||||||
|
|
|
@ -528,7 +528,7 @@ Image* lovrImageCreateFromBlob(Blob* blob, bool flip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image->blob->data) {
|
if (!image->blob->data) {
|
||||||
lovrThrow("Could not load image from '%s': %s", blob->name, stbi_failure_reason());
|
lovrThrow("Could not load image from '%s'", blob->name);
|
||||||
lovrRelease(image->blob, lovrBlobDestroy);
|
lovrRelease(image->blob, lovrBlobDestroy);
|
||||||
free(image);
|
free(image);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -39,7 +39,7 @@ static void parseMtl(char* path, char* base, ModelDataIO* io, arr_image_t* image
|
||||||
if (*data == '#') goto next;
|
if (*data == '#') goto next;
|
||||||
|
|
||||||
char line[1024];
|
char line[1024];
|
||||||
size_t length = newline ? newline - data : size;
|
size_t length = newline ? (size_t) (newline - data) : size;
|
||||||
while (length > 0 && (data[length - 1] == '\r' || data[length - 1] == '\t' || data[length - 1] == ' ')) length--;
|
while (length > 0 && (data[length - 1] == '\r' || data[length - 1] == '\t' || data[length - 1] == ' ')) length--;
|
||||||
lovrAssert(length < sizeof(line), "OBJ MTL line length is too long (max is %d)", sizeof(line) - 1);
|
lovrAssert(length < sizeof(line), "OBJ MTL line length is too long (max is %d)", sizeof(line) - 1);
|
||||||
memcpy(line, data, length);
|
memcpy(line, data, length);
|
||||||
|
@ -135,7 +135,7 @@ ModelData* lovrModelDataInitObj(ModelData* model, Blob* source, ModelDataIO* io)
|
||||||
if (*data == '#') goto next;
|
if (*data == '#') goto next;
|
||||||
|
|
||||||
char line[1024];
|
char line[1024];
|
||||||
size_t length = newline ? newline - data : size;
|
size_t length = newline ? (size_t) (newline - data) : size;
|
||||||
while (length > 0 && (data[length - 1] == '\r' || data[length - 1] == '\t' || data[length - 1] == ' ')) length--;
|
while (length > 0 && (data[length - 1] == '\r' || data[length - 1] == '\t' || data[length - 1] == ' ')) length--;
|
||||||
lovrAssert(length < sizeof(line), "OBJ line length is too long (max is %d)", sizeof(line) - 1);
|
lovrAssert(length < sizeof(line), "OBJ line length is too long (max is %d)", sizeof(line) - 1);
|
||||||
memcpy(line, data, length);
|
memcpy(line, data, length);
|
||||||
|
@ -218,7 +218,7 @@ ModelData* lovrModelDataInitObj(ModelData* model, Blob* source, ModelDataIO* io)
|
||||||
parseMtl(path, base, io, &images, &materials, &materialMap);
|
parseMtl(path, base, io, &images, &materials, &materialMap);
|
||||||
} else if (STARTS_WITH(line, "usemtl ")) {
|
} else if (STARTS_WITH(line, "usemtl ")) {
|
||||||
uint64_t index = map_get(&materialMap, hash64(line + 7, length - 7));
|
uint64_t index = map_get(&materialMap, hash64(line + 7, length - 7));
|
||||||
int material = index == MAP_NIL ? -1 : index;
|
uint32_t material = index == MAP_NIL ? ~0u : index;
|
||||||
objGroup* group = &groups.data[groups.length - 1];
|
objGroup* group = &groups.data[groups.length - 1];
|
||||||
if (group->count > 0) {
|
if (group->count > 0) {
|
||||||
objGroup next = { .material = material, .start = group->start + group->count };
|
objGroup next = { .material = material, .start = group->start + group->count };
|
||||||
|
|
|
@ -168,8 +168,8 @@ Sound* lovrSoundCreateFromFile(struct Blob* blob, bool decode) {
|
||||||
char guid[16];
|
char guid[16];
|
||||||
} wavHeader;
|
} wavHeader;
|
||||||
|
|
||||||
char guidi16[16] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
|
uint8_t guidi16[16] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
|
||||||
char guidf32[16] = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
|
uint8_t guidf32[16] = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
|
||||||
|
|
||||||
wavHeader* wav = blob->data;
|
wavHeader* wav = blob->data;
|
||||||
lovrAssert(wav->size == blob->size - 8, "Invalid WAV");
|
lovrAssert(wav->size == blob->size - 8, "Invalid WAV");
|
||||||
|
|
|
@ -213,7 +213,7 @@ typedef struct {
|
||||||
uint32_t instances;
|
uint32_t instances;
|
||||||
} DrawCommand;
|
} DrawCommand;
|
||||||
|
|
||||||
void lovrGpuInit(void* (*getProcAddress)(const char*), bool debug);
|
void lovrGpuInit(void (*getProcAddress(const char*))(void), bool debug);
|
||||||
void lovrGpuDestroy(void);
|
void lovrGpuDestroy(void);
|
||||||
void lovrGpuClear(struct Canvas* canvas, Color* color, float* depth, int* stencil);
|
void lovrGpuClear(struct Canvas* canvas, Color* color, float* depth, int* stencil);
|
||||||
void lovrGpuCompute(struct Shader* shader, int x, int y, int z);
|
void lovrGpuCompute(struct Shader* shader, int x, int y, int z);
|
||||||
|
|
|
@ -274,7 +274,7 @@ void lovrModelAnimate(Model* model, uint32_t animationIndex, float time, float a
|
||||||
float* (*lerp)(float* a, float* b, float t) = rotate ? quat_slerp : vec3_lerp;
|
float* (*lerp)(float* a, float* b, float t) = rotate ? quat_slerp : vec3_lerp;
|
||||||
|
|
||||||
if (keyframe == 0 || keyframe >= channel->keyframeCount) {
|
if (keyframe == 0 || keyframe >= channel->keyframeCount) {
|
||||||
size_t index = CLAMP(keyframe, 0, channel->keyframeCount - 1);
|
size_t index = MIN(keyframe, channel->keyframeCount - 1);
|
||||||
|
|
||||||
// For cubic interpolation, each keyframe has 3 parts, and the actual data is in the middle (*3, +1)
|
// For cubic interpolation, each keyframe has 3 parts, and the actual data is in the middle (*3, +1)
|
||||||
if (channel->smoothing == SMOOTH_CUBIC) {
|
if (channel->smoothing == SMOOTH_CUBIC) {
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ static void GLAPIENTRY onMessage(GLenum source, GLenum type, GLuint id, GLenum s
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void lovrGpuInit(void* (*getProcAddress)(const char*), bool debug) {
|
void lovrGpuInit(void (*getProcAddress(const char*))(void), bool debug) {
|
||||||
#ifdef LOVR_GL
|
#ifdef LOVR_GL
|
||||||
gladLoadGLLoader((GLADloadproc) getProcAddress);
|
gladLoadGLLoader((GLADloadproc) getProcAddress);
|
||||||
#elif defined(LOVR_GLES)
|
#elif defined(LOVR_GLES)
|
||||||
|
|
|
@ -30,10 +30,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#undef EXTERN_C
|
#undef EXTERN_C
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wtypedef-redefinition"
|
|
||||||
#include <openvr_capi.h>
|
#include <openvr_capi.h>
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
// From openvr_capi.h
|
// From openvr_capi.h
|
||||||
extern intptr_t VR_InitInternal(EVRInitError *peError, EVRApplicationType eType);
|
extern intptr_t VR_InitInternal(EVRInitError *peError, EVRApplicationType eType);
|
||||||
|
|
|
@ -12,14 +12,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <android_native_app_glue.h>
|
#include <android_native_app_glue.h>
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wc11-extensions"
|
|
||||||
#pragma clang diagnostic ignored "-Wgnu-empty-initializer"
|
|
||||||
#pragma clang diagnostic ignored "-Wpedantic"
|
|
||||||
#include <VrApi.h>
|
#include <VrApi.h>
|
||||||
#include <VrApi_Helpers.h>
|
#include <VrApi_Helpers.h>
|
||||||
#include <VrApi_Input.h>
|
#include <VrApi_Input.h>
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
#define GL_SRGB8_ALPHA8 0x8C43
|
#define GL_SRGB8_ALPHA8 0x8C43
|
||||||
#define VRAPI_DEVICE_TYPE_OCULUSGO 64
|
#define VRAPI_DEVICE_TYPE_OCULUSGO 64
|
||||||
|
|
Loading…
Reference in New Issue