summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2017-05-13 01:44:32 -0400
committerPaul Duncan <pabs@pablotron.org>2017-05-13 01:44:32 -0400
commit41f4cb607c962fc5c5e348d9643cad164dcbbf94 (patch)
tree09d273101a46693fa0cffda8ebb10ea95f1ca559
parent1d1e24212f73deef4d0c3ba33f7c213311345b60 (diff)
downloadcompute-test-41f4cb607c962fc5c5e348d9643cad164dcbbf94.tar.bz2
compute-test-41f4cb607c962fc5c5e348d9643cad164dcbbf94.zip
add CONTEXT_DEBUG_FLAG
-rw-r--r--main.c14
1 files changed, 12 insertions, 2 deletions
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) {