mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] all: replace assert with DEBUG_ASSERT
This commit is contained in:
parent
85a96d1e06
commit
579f998519
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "wayland.h"
|
#include "wayland.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -299,7 +298,7 @@ static void dataDeviceHandleEnter(void * data, struct wl_data_device * device,
|
|||||||
uint32_t serial, struct wl_surface * surface, wl_fixed_t sxW, wl_fixed_t syW,
|
uint32_t serial, struct wl_surface * surface, wl_fixed_t sxW, wl_fixed_t syW,
|
||||||
struct wl_data_offer * offer)
|
struct wl_data_offer * offer)
|
||||||
{
|
{
|
||||||
assert(wlCb.dndOffer == NULL);
|
DEBUG_ASSERT(wlCb.dndOffer == NULL);
|
||||||
wlCb.dndOffer = offer;
|
wlCb.dndOffer = offer;
|
||||||
|
|
||||||
struct DataOffer * extra = wl_data_offer_get_user_data(offer);
|
struct DataOffer * extra = wl_data_offer_get_user_data(offer);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
#include "common/debug.h"
|
||||||
|
|
||||||
typedef enum LG_ClipboardData
|
typedef enum LG_ClipboardData
|
||||||
{
|
{
|
||||||
@ -210,50 +211,50 @@ struct LG_DisplayServerOps
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_EGL
|
#ifdef ENABLE_EGL
|
||||||
#define ASSERT_EGL_FN(x) assert(x);
|
#define ASSERT_EGL_FN(x) DEBUG_ASSERT(x)
|
||||||
#else
|
#else
|
||||||
#define ASSERT_EGL_FN(x)
|
#define ASSERT_EGL_FN(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
#define ASSERT_OPENGL_FN(x) assert(x)
|
#define ASSERT_OPENGL_FN(x) DEBUG_ASSERT(x)
|
||||||
#else
|
#else
|
||||||
#define ASSERT_OPENGL_FN(x)
|
#define ASSERT_OPENGL_FN(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ASSERT_LG_DS_VALID(x) \
|
#define ASSERT_LG_DS_VALID(x) \
|
||||||
assert((x)->setup ); \
|
DEBUG_ASSERT((x)->setup ); \
|
||||||
assert((x)->probe ); \
|
DEBUG_ASSERT((x)->probe ); \
|
||||||
assert((x)->earlyInit ); \
|
DEBUG_ASSERT((x)->earlyInit); \
|
||||||
assert((x)->init ); \
|
DEBUG_ASSERT((x)->init ); \
|
||||||
assert((x)->startup ); \
|
DEBUG_ASSERT((x)->startup ); \
|
||||||
assert((x)->shutdown ); \
|
DEBUG_ASSERT((x)->shutdown ); \
|
||||||
assert((x)->free ); \
|
DEBUG_ASSERT((x)->free ); \
|
||||||
assert((x)->getProp ); \
|
DEBUG_ASSERT((x)->getProp ); \
|
||||||
ASSERT_EGL_FN((x)->getEGLDisplay ); \
|
ASSERT_EGL_FN((x)->getEGLDisplay ); \
|
||||||
ASSERT_EGL_FN((x)->getEGLNativeWindow ); \
|
ASSERT_EGL_FN((x)->getEGLNativeWindow); \
|
||||||
ASSERT_EGL_FN((x)->eglSwapBuffers ); \
|
ASSERT_EGL_FN((x)->eglSwapBuffers ); \
|
||||||
ASSERT_OPENGL_FN((x)->glCreateContext ); \
|
ASSERT_OPENGL_FN((x)->glCreateContext ); \
|
||||||
ASSERT_OPENGL_FN((x)->glDeleteContext ); \
|
ASSERT_OPENGL_FN((x)->glDeleteContext ); \
|
||||||
ASSERT_OPENGL_FN((x)->glMakeCurrent ); \
|
ASSERT_OPENGL_FN((x)->glMakeCurrent ); \
|
||||||
ASSERT_OPENGL_FN((x)->glSetSwapInterval); \
|
ASSERT_OPENGL_FN((x)->glSetSwapInterval); \
|
||||||
ASSERT_OPENGL_FN((x)->glSwapBuffers ); \
|
ASSERT_OPENGL_FN((x)->glSwapBuffers ); \
|
||||||
assert(!(x)->waitFrame == !(x)->stopWaitFrame); \
|
DEBUG_ASSERT(!(x)->waitFrame == !(x)->stopWaitFrame); \
|
||||||
assert((x)->guestPointerUpdated); \
|
DEBUG_ASSERT((x)->guestPointerUpdated); \
|
||||||
assert((x)->setPointer ); \
|
DEBUG_ASSERT((x)->setPointer ); \
|
||||||
assert((x)->grabPointer ); \
|
DEBUG_ASSERT((x)->grabPointer ); \
|
||||||
assert((x)->ungrabPointer ); \
|
DEBUG_ASSERT((x)->ungrabPointer ); \
|
||||||
assert((x)->capturePointer ); \
|
DEBUG_ASSERT((x)->capturePointer ); \
|
||||||
assert((x)->uncapturePointer ); \
|
DEBUG_ASSERT((x)->uncapturePointer ); \
|
||||||
assert((x)->warpPointer ); \
|
DEBUG_ASSERT((x)->warpPointer ); \
|
||||||
assert((x)->realignPointer ); \
|
DEBUG_ASSERT((x)->realignPointer ); \
|
||||||
assert((x)->isValidPointerPos ); \
|
DEBUG_ASSERT((x)->isValidPointerPos ); \
|
||||||
assert((x)->inhibitIdle ); \
|
DEBUG_ASSERT((x)->inhibitIdle ); \
|
||||||
assert((x)->uninhibitIdle ); \
|
DEBUG_ASSERT((x)->uninhibitIdle ); \
|
||||||
assert((x)->wait ); \
|
DEBUG_ASSERT((x)->wait ); \
|
||||||
assert((x)->setWindowSize ); \
|
DEBUG_ASSERT((x)->setWindowSize ); \
|
||||||
assert((x)->setFullscreen ); \
|
DEBUG_ASSERT((x)->setFullscreen ); \
|
||||||
assert((x)->getFullscreen ); \
|
DEBUG_ASSERT((x)->getFullscreen ); \
|
||||||
assert((x)->minimize );
|
DEBUG_ASSERT((x)->minimize );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#define _H_I_OVERLAY_
|
#define _H_I_OVERLAY_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
@ -64,9 +63,9 @@ struct LG_OverlayOps
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define ASSERT_LG_OVERLAY_VALID(x) \
|
#define ASSERT_LG_OVERLAY_VALID(x) \
|
||||||
assert((x)->name ); \
|
DEBUG_ASSERT((x)->name ); \
|
||||||
assert((x)->init ); \
|
DEBUG_ASSERT((x)->init ); \
|
||||||
assert((x)->free ); \
|
DEBUG_ASSERT((x)->free ); \
|
||||||
assert((x)->render );
|
DEBUG_ASSERT((x)->render);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,7 +119,7 @@ void egl_desktopRectsUpdate(EGL_DesktopRects * rects, const struct DamageRects *
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
rects->count = data->count;
|
rects->count = data->count;
|
||||||
assert(rects->count <= rects->maxCount);
|
DEBUG_ASSERT(rects->count <= rects->maxCount);
|
||||||
|
|
||||||
for (int i = 0; i < rects->count; ++i)
|
for (int i = 0; i < rects->count; ++i)
|
||||||
rectToVertices(vertices + i * 8, data->rects + i);
|
rectToVertices(vertices + i * 8, data->rects + i);
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
struct EGL_Model
|
struct EGL_Model
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "common/framebuffer.h"
|
#include "common/framebuffer.h"
|
||||||
@ -66,12 +65,12 @@ bool egl_textureInit(EGL_Texture ** texture_, EGLDisplay * display,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EGL_TEXTYPE_FRAMEBUFFER:
|
case EGL_TEXTYPE_FRAMEBUFFER:
|
||||||
assert(streaming);
|
DEBUG_ASSERT(streaming);
|
||||||
ops = &EGL_TextureFrameBuffer;
|
ops = &EGL_TextureFrameBuffer;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGL_TEXTYPE_DMABUF:
|
case EGL_TEXTYPE_DMABUF:
|
||||||
assert(streaming);
|
DEBUG_ASSERT(streaming);
|
||||||
ops = &EGL_TextureDMABUF;
|
ops = &EGL_TextureDMABUF;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "egldebug.h"
|
#include "egldebug.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
// forwards
|
// forwards
|
||||||
extern const EGL_TextureOps EGL_TextureBuffer;
|
extern const EGL_TextureOps EGL_TextureBuffer;
|
||||||
@ -109,7 +108,7 @@ bool egl_texBufferSetup(EGL_Texture * texture, const EGL_TexSetup * setup)
|
|||||||
static bool egl_texBufferUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
static bool egl_texBufferUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||||
{
|
{
|
||||||
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
||||||
assert(update->type == EGL_TEXTYPE_BUFFER);
|
DEBUG_ASSERT(update->type == EGL_TEXTYPE_BUFFER);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, this->tex[0]);
|
glBindTexture(GL_TEXTURE_2D, this->tex[0]);
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->format.pitch);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->format.pitch);
|
||||||
@ -164,7 +163,7 @@ static bool egl_texBufferStreamUpdate(EGL_Texture * texture,
|
|||||||
const EGL_TexUpdate * update)
|
const EGL_TexUpdate * update)
|
||||||
{
|
{
|
||||||
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
||||||
assert(update->type == EGL_TEXTYPE_BUFFER);
|
DEBUG_ASSERT(update->type == EGL_TEXTYPE_BUFFER);
|
||||||
|
|
||||||
LG_LOCK(this->copyLock);
|
LG_LOCK(this->copyLock);
|
||||||
memcpy(this->buf[this->bufIndex].map, update->buffer,
|
memcpy(this->buf[this->bufIndex].map, update->buffer,
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "texture_buffer.h"
|
#include "texture_buffer.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "egl_dynprocs.h"
|
#include "egl_dynprocs.h"
|
||||||
#include "egldebug.h"
|
#include "egldebug.h"
|
||||||
|
|
||||||
@ -101,7 +99,8 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
|||||||
{
|
{
|
||||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
||||||
assert(update->type == EGL_TEXTYPE_DMABUF);
|
|
||||||
|
DEBUG_ASSERT(update->type == EGL_TEXTYPE_DMABUF);
|
||||||
|
|
||||||
EGLImage image = EGL_NO_IMAGE;
|
EGLImage image = EGL_NO_IMAGE;
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "texture_buffer.h"
|
#include "texture_buffer.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/KVMFR.h"
|
#include "common/KVMFR.h"
|
||||||
@ -84,7 +82,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
|||||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
TexFB * this = UPCAST(TexFB , parent );
|
TexFB * this = UPCAST(TexFB , parent );
|
||||||
|
|
||||||
assert(update->type == EGL_TEXTYPE_FRAMEBUFFER);
|
DEBUG_ASSERT(update->type == EGL_TEXTYPE_FRAMEBUFFER);
|
||||||
|
|
||||||
LG_LOCK(parent->copyLock);
|
LG_LOCK(parent->copyLock);
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ int app_renderOverlay(struct Rect * rects, int maxRects)
|
|||||||
|
|
||||||
// It is an error to run out of rectangles, because we will not be able to
|
// It is an error to run out of rectangles, because we will not be able to
|
||||||
// correctly calculate the damage of the next frame.
|
// correctly calculate the damage of the next frame.
|
||||||
assert(written >= 0);
|
DEBUG_ASSERT(written >= 0);
|
||||||
|
|
||||||
const int toAdd = max(written, overlay->lastRectCount);
|
const int toAdd = max(written, overlay->lastRectCount);
|
||||||
totalDamage |= toAdd > maxRects;
|
totalDamage |= toAdd > maxRects;
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
|
|
||||||
|
#include "common/debug.h"
|
||||||
#include "common/locking.h"
|
#include "common/locking.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
struct ll_item
|
struct ll_item
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ struct ll * ll_new(void)
|
|||||||
void ll_free(struct ll * list)
|
void ll_free(struct ll * list)
|
||||||
{
|
{
|
||||||
// never free a list with items in it!
|
// never free a list with items in it!
|
||||||
assert(!list->head);
|
DEBUG_ASSERT(!list->head);
|
||||||
|
|
||||||
LG_LOCK_FREE(list->lock);
|
LG_LOCK_FREE(list->lock);
|
||||||
free(list);
|
free(list);
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
@ -854,7 +853,7 @@ static int lg_run(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(g_state.ds);
|
DEBUG_ASSERT(g_state.ds);
|
||||||
ASSERT_LG_DS_VALID(g_state.ds);
|
ASSERT_LG_DS_VALID(g_state.ds);
|
||||||
|
|
||||||
if (g_params.jitRender)
|
if (g_params.jitRender)
|
||||||
|
Loading…
Reference in New Issue
Block a user