inline void gl_push_group(const std::string& name) { if (GLEW_KHR_debug) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, name.c_str() ); } }
void wzSceneBegin(const char *descr) { ASSERT(sceneActive == NULL, "Out of order scenes: Wanted to start %s, was in %s", descr, sceneActive); if (khr_debug) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, descr); } sceneActive = descr; }
void wzPerfBegin(PERF_POINT pp, const char *descr) { ASSERT(queryActive == PERF_COUNT || pp > queryActive, "Out of order timer query call"); queryActive = pp; if (khr_debug) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, pp, -1, descr); } if (!perfStarted) { return; } glBeginQuery(GL_TIME_ELAPSED, perfpos[pp]); }
void OpenGLRenderer::pushDebugGroup(const std::string& title) { #ifdef RW_GRAPHICS_STATS if (ogl_ext_KHR_debug) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title.c_str()); ProfileInfo& prof = profileInfo[currentDebugDepth]; prof.buffers = prof.draws = prof.textures = prof.uploads = prof.primitives = 0; glQueryCounter(debugQuery, GL_TIMESTAMP); glGetQueryObjectui64v(debugQuery, GL_QUERY_RESULT, &prof.timerStart); currentDebugDepth++; RW_ASSERT(currentDebugDepth < MAX_DEBUG_DEPTH); } #else RW_UNUSED(title); #endif }
void display() { glPushDebugGroup( GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Frame"); // Update of the uniform buffer { glBindBuffer(GL_UNIFORM_BUFFER, BufferName[buffer::TRANSFORM]); glm::mat4* Pointer = (glm::mat4*)glMapBufferRange( GL_UNIFORM_BUFFER, 0, sizeof(glm::mat4), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); glm::mat4 Projection = glm::perspectiveFov(45.f, 640.f, 480.f, 0.1f, 100.0f); //glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f); glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Window.TranlationCurrent.y)); glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Window.RotationCurrent.y, glm::vec3(1.f, 0.f, 0.f)); glm::mat4 View = glm::rotate(ViewRotateX, Window.RotationCurrent.x, glm::vec3(0.f, 1.f, 0.f)); glm::mat4 Model = glm::mat4(1.0f); *Pointer = Projection * View * Model; // Make sure the uniform buffer is uploaded glUnmapBuffer(GL_UNIFORM_BUFFER); } glViewportIndexedf(0, 0, 0, GLfloat(Window.Size.x), GLfloat(Window.Size.y)); glClearBufferfv(GL_COLOR, 0, &glm::vec4(1.0f, 0.5f, 0.0f, 1.0f)[0]); // Bind rendering objects glBindProgramPipeline(PipelineName); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, TextureName); glBindVertexArray(VertexArrayName); glBindBufferBase(GL_UNIFORM_BUFFER, glf::semantic::uniform::TRANSFORM0, BufferName[buffer::TRANSFORM]); glDrawElementsInstancedBaseVertexBaseInstance( GL_TRIANGLES, ElementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); glPopDebugGroup(); glf::swapBuffers(); }
void gr_opengl_push_debug_group(const char* name) { if (GLAD_GL_KHR_debug) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION_KHR, 0, -1, name); } }
void push_debug_group(GLenum source, GLuint id, const std::string& message) { glPushDebugGroup(source, id, static_cast<GLsizei>(message.size()), message.data()); }
void window::render() { if (graphics::is_debug_supported()) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, get_title().c_str()); } auto&& old_window = SDL_GL_GetCurrentWindow(); auto&& old_context = SDL_GL_GetCurrentContext(); // Need to flush here before the context change for macOS OpenGL to // finish rendering the framebuffers (on Intel at least)! glFlush(); SDL_GL_MakeCurrent(handle.get(), get_graphics_context().handle.get()); // Draw each viewport. Layer them on top of each other and use blending // for transparency. Disable depth mask so that transparent views don't // block each other from rendering. // The viewport contains colour already multiplied with the alpha // channel, so instead of doing that again with GL_SRC_ALPHA, it is // drawn with GL_ONE. The destination colour is attenuated normally with // GL_ONE_MINUS_SRC_ALPHA. GLboolean old_blend, old_depth_mask; GLint old_source_rgb, old_source_alpha, old_destination_rgb, old_destination_alpha; glGetBooleanv(GL_BLEND, &old_blend); glGetBooleanv(GL_DEPTH_WRITEMASK, &old_depth_mask); glGetIntegerv(GL_BLEND_SRC_RGB, &old_source_rgb); glGetIntegerv(GL_BLEND_SRC_ALPHA, &old_source_alpha); glGetIntegerv(GL_BLEND_DST_RGB, &old_destination_rgb); glGetIntegerv(GL_BLEND_DST_ALPHA, &old_destination_alpha); glDepthMask(GL_FALSE); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glViewport(0, 0, get_backbuffer_width(), get_backbuffer_height()); glClearColor(get_background_color().get_r(), get_background_color().get_g(), get_background_color().get_b(), get_background_color().get_a()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); for (auto&& iterator = graphics::viewport::viewports.rbegin(); iterator != graphics::viewport::viewports.rend(); iterator++) { auto&& viewport = **iterator; if (viewport.get_window() != this) { continue; } viewport.draw(); } glBlendFuncSeparate(old_source_rgb, old_destination_rgb, old_source_alpha, old_destination_alpha); if (not old_blend) { glDisable(GL_BLEND); } if (old_depth_mask) { glDepthMask(GL_TRUE); } SDL_GL_SwapWindow(handle.get()); SDL_GL_MakeCurrent(old_window, old_context); if (graphics::is_debug_supported()) { glPopDebugGroup(); } }
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLES32_nglPushDebugGroup(JNIEnv *__env, jclass clazz, jint source, jint id, jint length, jlong messageAddress) { glPushDebugGroupPROC glPushDebugGroup = (glPushDebugGroupPROC)tlsGetFunction(321); intptr_t message = (intptr_t)messageAddress; UNUSED_PARAM(clazz) glPushDebugGroup(source, id, length, message); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL43_nglPushDebugGroup(JNIEnv *__env, jclass clazz, jint source, jint id, jint length, jlong messageAddress, jlong __functionAddress) { const GLchar *message = (const GLchar *)(intptr_t)messageAddress; glPushDebugGroupPROC glPushDebugGroup = (glPushDebugGroupPROC)(intptr_t)__functionAddress; UNUSED_PARAMS(__env, clazz) glPushDebugGroup(source, id, length, message); }
static void GLAPIENTRY khrPushDebugGroup(GLsizei length, const char *message) { glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION_ARB, 0, length, message); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL43_nglPushDebugGroup(JNIEnv *env, jclass clazz, jint source, jint id, jint length, jlong message, jlong function_pointer) { const GLchar *message_address = (const GLchar *)(intptr_t)message; glPushDebugGroupPROC glPushDebugGroup = (glPushDebugGroupPROC)((intptr_t)function_pointer); glPushDebugGroup(source, id, length, message_address); }