From eaf26ce4b857c14e594bc385114fdbeab7b186d0 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 10 Dec 2018 15:18:42 -0800 Subject: [PATCH] Struct cleanup; --- src/audio/microphone.h | 2 +- src/graphics/mesh.h | 8 ++++---- src/graphics/opengl.c | 4 ++-- src/util.c | 2 +- src/util.h | 8 +++----- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/audio/microphone.h b/src/audio/microphone.h index 79484d99..e6ebb1a4 100644 --- a/src/audio/microphone.h +++ b/src/audio/microphone.h @@ -9,8 +9,8 @@ typedef struct { Ref ref; ALCdevice* device; - bool isRecording; const char* name; + bool isRecording; int sampleRate; int bitDepth; int channelCount; diff --git a/src/graphics/mesh.h b/src/graphics/mesh.h index c1972e54..8e28bc15 100644 --- a/src/graphics/mesh.h +++ b/src/graphics/mesh.h @@ -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; diff --git a/src/graphics/opengl.c b/src/graphics/opengl.c index c910a5a2..4ad12a23 100644 --- a/src/graphics/opengl.c +++ b/src/graphics/opengl.c @@ -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; }; diff --git a/src/util.c b/src/util.c index 4b030f59..88306a86 100644 --- a/src/util.c +++ b/src/util.c @@ -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; } diff --git a/src/util.h b/src/util.h index 3c493c28..c0b9bc6b 100644 --- a/src/util.h +++ b/src/util.h @@ -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;