From 41f4cb607c962fc5c5e348d9643cad164dcbbf94 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 13 May 2017 01:44:32 -0400 Subject: add CONTEXT_DEBUG_FLAG --- main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 35f55bc..66f4395 100644 --- a/main.c +++ b/main.c @@ -28,7 +28,7 @@ #define EVENT_CODE_TIMER 0 // use compute shader to update particles? -#define USE_COMPUTE_SHADER false +#define USE_COMPUTE_SHADER true // enable gl debug #define USE_GL_DEBUG false @@ -78,7 +78,9 @@ verts[] = { static const char cs_src[] = "#version 320 es\n" - // "#pragma debug(on)\n" +#if USE_GL_DEBUG + "#pragma debug(on)\n" +#endif /* USE_GL_DEBUG */ "\n" "layout(local_size_x = " S(WORKGROUP_SIZE) ") in;\n" "\n" @@ -397,6 +399,14 @@ ctx_init(context_t * const ctx) { exit(EXIT_FAILURE); } + if (USE_GL_DEBUG) { + // set debug context + if (SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG) < 0) { + LOG_C("SDL_GL_SetAttribute() failed: %s", SDL_GetError()); + exit(EXIT_FAILURE); + } + } + // create GL context SDL_GLContext context = SDL_GL_CreateContext(ctx->win); if (!context) { -- cgit v1.2.3