const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup() { #ifdef RW_GRAPHICS_STATS if (ogl_ext_KHR_debug) { glPopDebugGroup(); currentDebugDepth--; RW_ASSERT(currentDebugDepth >= 0); ProfileInfo& prof = profileInfo[currentDebugDepth]; glQueryCounter(debugQuery, GL_TIMESTAMP); GLuint64 current_time; glGetQueryObjectui64v(debugQuery, GL_QUERY_RESULT, ¤t_time); prof.duration = current_time - prof.timerStart; // Add counters to the parent group if (currentDebugDepth > 0) { ProfileInfo& p = profileInfo[currentDebugDepth - 1]; p.draws += prof.draws; p.buffers += prof.buffers; p.primitives += prof.primitives; p.textures += prof.textures; p.uploads += prof.uploads; } return prof; } #endif return profileInfo[0]; }
inline void gl_pop_group() { if (GLEW_KHR_debug) { glPopDebugGroup(); } }
void wzSceneEnd(const char *descr) { ASSERT(descr == nullptr || strcmp(descr, sceneActive) == 0, "Out of order scenes: Wanted to stop %s, was in %s", descr, sceneActive); if (khr_debug) { glPopDebugGroup(); } sceneActive = NULL; }
void wzPerfEnd(PERF_POINT pp) { ASSERT(queryActive == pp, "Mismatched wzPerfBegin...End"); queryActive = PERF_COUNT; if (khr_debug) { glPopDebugGroup(); } if (!perfStarted) { return; } glEndQuery(GL_TIME_ELAPSED); }
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_pop_debug_group() { if (GLAD_GL_KHR_debug) { glPopDebugGroup(); } }
void pop_debug_group () { glPopDebugGroup(); }
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_glPopDebugGroup(JNIEnv *__env, jclass clazz) { glPopDebugGroupPROC glPopDebugGroup = (glPopDebugGroupPROC)tlsGetFunction(322); UNUSED_PARAM(clazz) glPopDebugGroup(); }
static void GLAPIENTRY khrPopDebugGroup(void) { glPopDebugGroup(); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL43_nglPopDebugGroup(JNIEnv *env, jclass clazz, jlong function_pointer) { glPopDebugGroupPROC glPopDebugGroup = (glPopDebugGroupPROC)((intptr_t)function_pointer); glPopDebugGroup(); }