Struct cleanup;

This commit is contained in:
bjorn 2018-12-10 15:18:42 -08:00
parent 24ba340929
commit eaf26ce4b8
5 changed files with 11 additions and 13 deletions

View File

@ -9,8 +9,8 @@
typedef struct {
Ref ref;
ALCdevice* device;
bool isRecording;
const char* name;
bool isRecording;
int sampleRate;
int bitDepth;
int channelCount;

View File

@ -10,11 +10,11 @@
typedef struct {
Buffer* buffer;
AttributeType type;
int components;
size_t offset;
int stride;
int divisor;
size_t stride;
AttributeType type;
uint8_t components;
uint8_t divisor;
bool enabled;
} MeshAttribute;

View File

@ -84,8 +84,8 @@ struct Buffer {
Ref ref;
void* data;
size_t size;
uint32_t id;
GLsync lock;
uint32_t id;
BufferUsage usage;
};
@ -94,8 +94,8 @@ struct ShaderBlock {
BlockType type;
vec_uniform_t uniforms;
map_int_t uniformMap;
GLenum target;
Buffer* buffer;
GLenum target;
uint8_t incoherent;
};

View File

@ -30,7 +30,7 @@ void lovrThrow(const char* format, ...) {
void* _lovrAlloc(const char* type, size_t size, void (*destructor)(void*)) {
void* object = calloc(1, size);
if (!object) return NULL;
*((Ref*) object) = (Ref) { 1, type, destructor };
*((Ref*) object) = (Ref) { .free = destructor, .type = type, .count = 1 };
return object;
}

View File

@ -16,14 +16,12 @@
#define ALIGN(p, n) ((uintptr_t) p & -n)
typedef struct ref {
int count;
const char* type;
void (*free)(void*);
const char* type;
int count;
} Ref;
typedef struct {
float r, g, b, a;
} Color;
typedef struct { float r, g, b, a; } Color;
typedef void (*lovrErrorHandler)(void* userdata, const char* format, va_list args);
extern _Thread_local lovrErrorHandler lovrErrorCallback;