diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index f53524761d86..2d441c94ef06 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -226,6 +226,19 @@ void RasterizerGLES2::initialize() { print_line("OpenGL debugging not supported!"); } } + if (GLAD_GL_KHR_debug) { + push_label_func = glPushDebugGroup; + pop_label_func = glPopDebugGroup; + khr_debug_enabled = true; + } + if (GLAD_GL_ARB_timer_query) { + gen_queries_func = glGenQueries; + del_queries_func = glGenQueries; + query_counter_func = glQueryCounter; + get_query_func = glGetQueryObjectui64v; + enable_frame_timings(); + } +#else #endif // GLAD_ENABLED // For debugging diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index de4d2806dd99..a15e50fdd3af 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -3542,13 +3542,19 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const } // render opaque things first + SECTION_START("OPAQUE"); + TIMESTAMP("opaque"); render_list.sort_by_key(false); _render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_eye, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false); + SECTION_END(); // then draw the sky after if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) { if (sky && sky->panorama.is_valid()) { + SECTION_START("SKY"); + TIMESTAMP("sky"); _draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation); + SECTION_END(); } } @@ -3596,7 +3602,10 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const render_list.sort_by_reverse_depth_and_priority(true); + SECTION_START("ALPHA"); + TIMESTAMP("alpha"); _render_render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, cam_transform, p_cam_projection, p_eye, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, true, false); + SECTION_END(); if (p_reflection_probe.is_valid()) { // Rendering to a probe so no need for post_processing @@ -3604,8 +3613,11 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const } //post process + SECTION_START("POST PROCESS"); + TIMESTAMP("post_process"); _post_process(env, p_cam_projection); - + SECTION_END(); + TIMESTAMP_END(); //#define GLES2_SHADOW_ATLAS_DEBUG_VIEW #ifdef GLES2_SHADOW_ATLAS_DEBUG_VIEW diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 1d34c085f768..ac1e83cc2ffc 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -33,6 +33,11 @@ #include "core/os/os.h" #include "core/project_settings.h" +#ifdef ANDROID_ENABLED +#include +#include +#endif + RasterizerStorage *RasterizerGLES3::get_storage() { return storage; } @@ -168,7 +173,50 @@ void RasterizerGLES3::initialize() { print_line("OpenGL debugging not supported!"); } } -#endif // GLAD_ENABLED + if (GLAD_GL_KHR_debug) { + push_label_func = glPushDebugGroup; + pop_label_func = glPopDebugGroup; + khr_debug_enabled = true; + } + if (GLAD_GL_ARB_timer_query) { + gen_queries_func = glGenQueries; + del_queries_func = glGenQueries; + query_counter_func = glQueryCounter; + get_query_func = glGetQueryObjectui64v; + enable_frame_timings(); + } +#else // GLAD_ENABLED + +// While we use GLAD for the desktop platforms we have to do this manually for mobile. +#ifdef ANDROID_ENABLED + + GLint extension_count = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &extension_count); + + bool found_arb_timer_query = false; + + for (int i = 0; i < extension_count; ++i) { + if (strcmp((const char *)glGetStringi(GL_EXTENSIONS, i), "GL_KHR_debug") == 0) { + khr_debug_enabled = true; + } else if (strcmp((const char *)glGetStringi(GL_EXTENSIONS, i), "GL_ARB_timer_query") == 0) { + found_arb_timer_query = true; + } + } + if (khr_debug_enabled) { + //These might need a KHR suffix, see https://registry.khronos.org/OpenGL/extensions/KHR/KHR_debug.txt + push_label_func = (void (*)(unsigned int, unsigned int, int, const char *))eglGetProcAddress("glPushDebugGroup"); + pop_label_func = eglGetProcAddress("glPopDebugGroup"); + } + if (found_arb_timer_query) { + gen_queries_func = (void (*)(int, unsigned int *))eglGetProcAddress("glGenQueries"); + del_queries_func = (void (*)(int, unsigned int *))eglGetProcAddress("glDeleteQueries"); + query_counter_func = (void (*)(unsigned int, unsigned int))eglGetProcAddress("glQueryCounter"); + get_query_func = (void (*)(unsigned int, unsigned int, uint64_t *))eglGetProcAddress("glGetQueryObjectui64v"); + enable_frame_timings(); + } + +#endif +#endif // not GLAD_ENABLED /* // For debugging if (GLAD_GL_ARB_debug_output) { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index dd602bd39f51..0e0bf51ed46d 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4188,6 +4188,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const if (use_depth_prepass) { //pre z pass + SECTION_START("DEPTH PREPASS"); + TIMESTAMP("depth_prepass"); glDisable(GL_BLEND); glDepthMask(GL_TRUE); @@ -4216,6 +4218,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const _bind_depth_texture(); } + SECTION_END(); fb_cleared = true; render_pass++; state.used_depth_prepass = true; @@ -4483,6 +4486,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const render_list.sort_by_key(false); + SECTION_START("OPAQUE"); + TIMESTAMP("opaque"); if (state.directional_light_count == 0) { directional_light = nullptr; _render_list(render_list.elements, render_list.element_count, p_cam_transform, p_cam_projection, sky, false, false, false, false, use_shadows); @@ -4496,6 +4501,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const _render_list(render_list.elements, render_list.element_count, p_cam_transform, p_cam_projection, sky, false, false, false, i > 0, use_shadows); } } + SECTION_END(); state.scene_shader.set_conditional(SceneShaderGLES3::USE_MULTIPLE_RENDER_TARGETS, false); @@ -4511,7 +4517,10 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const */ if (sky && sky->panorama.is_valid()) { + SECTION_START("SKY"); + TIMESTAMP("sky"); _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation); + SECTION_END(); } } @@ -4568,6 +4577,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const render_list.sort_by_reverse_depth_and_priority(true); + SECTION_START("ALPHA"); + TIMESTAMP("alpha"); if (state.directional_light_count <= 1) { if (state.directional_light_count == 1) { directional_light = directional_lights[0]; @@ -4614,6 +4625,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const } } } + SECTION_END(); if (probe) { //rendering a probe, do no more! @@ -4623,7 +4635,12 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const if (env && (env->dof_blur_far_enabled || env->dof_blur_near_enabled) && storage->frame.current_rt && storage->frame.current_rt->buffers.active) { _prepare_depth_texture(); } + SECTION_START("POST PROCESS"); + TIMESTAMP("post_process"); _post_process(env, p_cam_projection); + SECTION_END(); + TIMESTAMP_END(); + // Needed only for debugging /* if (shadow_atlas && storage->frame.current_rt) { diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp index 18c70c01d33f..adcdf7f99f5b 100644 --- a/servers/visual/rasterizer.cpp +++ b/servers/visual/rasterizer.cpp @@ -39,10 +39,123 @@ Rasterizer *(*Rasterizer::_create_func)() = nullptr; +bool Rasterizer::khr_debug_enabled = false; +void (*Rasterizer::push_label_func)(unsigned int source, unsigned int id, int length, const char *message) = nullptr; +void (*Rasterizer::pop_label_func)() = nullptr; + +void (*Rasterizer::gen_queries_func)(int n, unsigned int *ids) = nullptr; +void (*Rasterizer::del_queries_func)(int n, unsigned int *ids) = nullptr; +void (*Rasterizer::query_counter_func)(unsigned int id, unsigned int target) = nullptr; +void (*Rasterizer::get_query_func)(unsigned int id, unsigned int pname, uint64_t *params) = nullptr; + Rasterizer *Rasterizer::create() { return _create_func(); } +void Rasterizer::push_label(String p_label) { + if (khr_debug_enabled) { + push_label_func(0x824A, 1, p_label.length(), p_label.utf8().get_data()); + } +} + +void Rasterizer::pop_label() { + if (khr_debug_enabled) { + pop_label_func(); + } +} + +bool Rasterizer::frame_timing_enabled = false; + +void Rasterizer::enable_frame_timings() { + if (!frame_timing_enabled) { + // Setup the frame timing querys + for (int i = 0; i < FRAME_TIMING_COUNT; i++) { + frame_timings[i].query_count = 0; + gen_queries_func(MAX_QUERIES, frame_timings[i].queries); + frame_timings[i].query_names.resize(MAX_QUERIES); + frame_timings[i].query_results.resize(MAX_QUERIES); + } + frame_timing_enabled = true; + } +} + +void Rasterizer::begin_frame_timings() { + if (!frame_timing_enabled) + return; + + frame = (frame + 1) % FRAME_TIMING_COUNT; + if (frame_timings[frame].query_count) { + //We have written to this struct before, by now the results should be ready + frame_timings[frame].result_count = frame_timings[frame].query_count; + + uint64_t prev_time = 0; + uint64_t cur_time = 0; + for (uint32_t i = 0; i < frame_timings[frame].query_count; i++) { + //get_query_func(frame_timings[frame].queries[i], GL_QUERY_RESULT, &frame_timings[frame].query_results[i]); + get_query_func(frame_timings[frame].queries[i], GL_QUERY_RESULT, &cur_time); + //frame_timings[frame].query_results[i] = result; + if (i > 0) { + //turn the timestamps into durations + frame_timings[frame].query_results[i - 1] = cur_time - prev_time; + } + + prev_time = cur_time; + } + + //Send the data to the profiler +#ifdef DEBUG_ENABLED + if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) { + Array values; + + // sum results based on name (since parts of the render pipeline may run more than once due to viewports) + for (uint32_t i = 0; i < frame_timings[frame].query_count - 1; i++) { + String name = frame_timings[frame].query_names[i]; + if (name == "END_TIMESTAMP") + continue; + + uint64_t time = frame_timings[frame].query_results[i]; + + if (time != 0) { + for (uint32_t j = i + 1; j < frame_timings[frame].query_count - 1; j++) { + if (frame_timings[frame].query_names[j] == name) { + time += frame_timings[frame].query_results[j]; + frame_timings[frame].query_results[j] = 0; + } + } + float time_ms = USEC_TO_SEC(time / 1000); + values.push_back(name); + values.push_back(time_ms); + } + } + + ScriptDebugger::get_singleton()->add_profiling_frame_data("rendering", values); + } +#endif + } + frame_timings[frame].query_count = 0; +} + +void Rasterizer::timestamp(const String &p_name) { + if (!frame_timing_enabled) + return; + + int query_index = frame_timings[frame].query_count; + + ERR_FAIL_COND_MSG(query_index >= MAX_QUERIES, "Attempting to take too many rendering timestamp: increase MAX_QUERIES"); + + query_counter_func(frame_timings[frame].queries[query_index], GL_TIMESTAMP); + frame_timings[frame].query_names[query_index] = p_name; + frame_timings[frame].query_count++; +} + +Rasterizer::~Rasterizer() { + if (frame_timing_enabled) { + for (int i = 0; i < FRAME_TIMING_COUNT; i++) { + del_queries_func(MAX_QUERIES, frame_timings[i].queries); + } + } +} + RasterizerStorage *RasterizerStorage::base_singleton = nullptr; RasterizerStorage::RasterizerStorage() { diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index ce71698a77b1..d632942a417b 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -37,6 +37,22 @@ #include "core/self_list.h" +#ifdef DEBUG_ENABLED +#define SECTION_START(X) VSG::rasterizer->push_label(X) +#define SECTION_END() VSG::rasterizer->pop_label() + +#define TIMESTAMP_FRAME_START() VSG::rasterizer->begin_frame_timings() +#define TIMESTAMP(X) VSG::rasterizer->timestamp(X) +#define TIMESTAMP_END() VSG::rasterizer->timestamp("END_TIMESTAMP") // necessary to calculate the time of the previous timestamp +#else +#define SECTION_START(X) +#define SECTION_END() + +#define TIMESTAMP_FRAME_START() +#define TIMESTAMP(X) +#define TIMESTAMP_END() +#endif + class RasterizerScene { public: /* SHADOW ATLAS API */ @@ -1256,6 +1272,34 @@ class RasterizerCanvas { class Rasterizer { protected: static Rasterizer *(*_create_func)(); + static bool khr_debug_enabled; + + //Profiling Information + //Labels + static void (*push_label_func)(unsigned int source, unsigned int id, int length, const char *message); + static void (*pop_label_func)(); + + //Timing stuff +#define FRAME_TIMING_COUNT 3 +#define MAX_QUERIES 128 +#define GL_QUERY_RESULT 0x8866 +#define GL_TIMESTAMP 0x8E28 + + static bool frame_timing_enabled; + struct FrameTimings { + unsigned int queries[MAX_QUERIES]; + uint32_t result_count; + uint32_t query_count; + LocalVector query_results; + LocalVector query_names; + }; + FrameTimings frame_timings[FRAME_TIMING_COUNT]; + int frame = 0; + + static void (*gen_queries_func)(int n, unsigned int *ids); + static void (*del_queries_func)(int n, unsigned int *ids); + static void (*query_counter_func)(unsigned int id, unsigned int target); + static void (*get_query_func)(unsigned int id, unsigned int pname, uint64_t *params); public: static Rasterizer *create(); @@ -1277,9 +1321,17 @@ class Rasterizer { virtual void end_frame(bool p_swap_buffers) = 0; virtual void finalize() = 0; + virtual void push_label(String p_label); + virtual void pop_label(); + + void enable_frame_timings(); + void begin_frame_timings(); + void timestamp(const String &p_name); + virtual bool is_low_end() const = 0; - virtual ~Rasterizer() {} + //Rasterizer(); + virtual ~Rasterizer(); }; // Use float rather than real_t as cheaper and no need for 64 bit. diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index d0e7b76bb610..60f1decc4da1 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -101,12 +101,14 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) { changes[0] = 0; changes[1] = 0; + TIMESTAMP_FRAME_START(); VSG::rasterizer->begin_frame(frame_step); VSG::scene->update_dirty_instances(); //update scene stuff VSG::viewport->draw_viewports(); VSG::scene->render_probes(); + TIMESTAMP_END(); _draw_margins(); VSG::rasterizer->end_frame(p_swap_buffers); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 676b2f830d71..2926ff79806a 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -3133,6 +3133,9 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca // directional lights { + SECTION_START("DIRECTIONAL SHADOWS"); + TIMESTAMP("directional_shadows"); + Instance **lights_with_shadow = (Instance **)alloca(sizeof(Instance *) * scenario->directional_lights.size()); int directional_shadow_count = 0; @@ -3161,11 +3164,17 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca VSG::scene_render->set_directional_shadow_count(directional_shadow_count); for (int i = 0; i < directional_shadow_count; i++) { + SECTION_START(vformat("Directional Light #%d", i + 1)); _light_instance_update_shadow(lights_with_shadow[i], p_cam_transform, p_cam_projection, p_cam_orthogonal, p_shadow_atlas, scenario); + SECTION_END(); } + + SECTION_END(); } { //setup shadow maps + SECTION_START("NON-DIRECTIONAL SHADOWS"); + TIMESTAMP("non_directional_shadows"); //SortArray sorter; //sorter.sort(light_cull_result,light_cull_count); @@ -3191,6 +3200,8 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca switch (VSG::storage->light_get_type(ins->base)) { case VS::LIGHT_OMNI: { + SECTION_START("Omni Light"); + float radius = VSG::storage->light_get_param(ins->base, VS::LIGHT_PARAM_RANGE); //get two points parallel to near plane @@ -3214,6 +3225,8 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca coverage = screen_diameter / (vp_half_extents.x + vp_half_extents.y); } break; case VS::LIGHT_SPOT: { + SECTION_START("Spot Light"); + float radius = VSG::storage->light_get_param(ins->base, VS::LIGHT_PARAM_RANGE); float angle = VSG::storage->light_get_param(ins->base, VS::LIGHT_PARAM_SPOT_ANGLE); @@ -3244,6 +3257,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca } break; default: { ERR_PRINT("Invalid Light Type"); + SECTION_START("Invalid Light Type"); } } } @@ -3259,7 +3273,9 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca //must redraw! light->shadow_dirty = _light_instance_update_shadow(ins, p_cam_transform, p_cam_projection, p_cam_orthogonal, p_shadow_atlas, scenario); } + SECTION_END(); } + SECTION_END(); } // Calculate instance->depth from the camera, after shadow calculation has stopped overwriting instance->depth @@ -4228,112 +4244,123 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) { } void VisualServerScene::render_probes() { + SECTION_START("PROBES"); /* REFLECTION PROBES */ SelfList *ref_probe = reflection_probe_render_list.first(); bool busy = false; + if (ref_probe) { + SECTION_START("Reflection Probes"); + TIMESTAMP("reflection_probes"); + while (ref_probe) { + SelfList *next = ref_probe->next(); + RID base = ref_probe->self()->owner->base; + + switch (VSG::storage->reflection_probe_get_update_mode(base)) { + case VS::REFLECTION_PROBE_UPDATE_ONCE: { + if (busy) { //already rendering something + break; + } - while (ref_probe) { - SelfList *next = ref_probe->next(); - RID base = ref_probe->self()->owner->base; + bool done = _render_reflection_probe_step(ref_probe->self()->owner, ref_probe->self()->render_step); + if (done) { + reflection_probe_render_list.remove(ref_probe); + } else { + ref_probe->self()->render_step++; + } - switch (VSG::storage->reflection_probe_get_update_mode(base)) { - case VS::REFLECTION_PROBE_UPDATE_ONCE: { - if (busy) { //already rendering something - break; - } + busy = true; //do not render another one of this kind + } break; + case VS::REFLECTION_PROBE_UPDATE_ALWAYS: { + int step = 0; + bool done = false; + while (!done) { + done = _render_reflection_probe_step(ref_probe->self()->owner, step); + step++; + } - bool done = _render_reflection_probe_step(ref_probe->self()->owner, ref_probe->self()->render_step); - if (done) { reflection_probe_render_list.remove(ref_probe); - } else { - ref_probe->self()->render_step++; - } - - busy = true; //do not render another one of this kind - } break; - case VS::REFLECTION_PROBE_UPDATE_ALWAYS: { - int step = 0; - bool done = false; - while (!done) { - done = _render_reflection_probe_step(ref_probe->self()->owner, step); - step++; - } + } break; + } - reflection_probe_render_list.remove(ref_probe); - } break; + ref_probe = next; } - - ref_probe = next; + SECTION_END(); } /* GI PROBES */ SelfList *gi_probe = gi_probe_update_list.first(); - while (gi_probe) { - SelfList *next = gi_probe->next(); + if (gi_probe) { + SECTION_START("GI Probes"); + TIMESTAMP("gi_probes"); + while (gi_probe) { + SelfList *next = gi_probe->next(); - InstanceGIProbeData *probe = gi_probe->self(); - Instance *instance_probe = probe->owner; + InstanceGIProbeData *probe = gi_probe->self(); + Instance *instance_probe = probe->owner; - //check if probe must be setup, but don't do if on the lighting thread + //check if probe must be setup, but don't do if on the lighting thread - bool force_lighting = false; + bool force_lighting = false; - if (probe->invalid || (probe->dynamic.updating_stage == GI_UPDATE_STAGE_CHECK && probe->base_version != VSG::storage->gi_probe_get_version(instance_probe->base))) { - _setup_gi_probe(instance_probe); - force_lighting = true; - } + if (probe->invalid || (probe->dynamic.updating_stage == GI_UPDATE_STAGE_CHECK && probe->base_version != VSG::storage->gi_probe_get_version(instance_probe->base))) { + _setup_gi_probe(instance_probe); + force_lighting = true; + } - float propagate = VSG::storage->gi_probe_get_propagation(instance_probe->base); + float propagate = VSG::storage->gi_probe_get_propagation(instance_probe->base); - if (probe->dynamic.propagate != propagate) { - probe->dynamic.propagate = propagate; - force_lighting = true; - } + if (probe->dynamic.propagate != propagate) { + probe->dynamic.propagate = propagate; + force_lighting = true; + } - if (!probe->invalid && probe->dynamic.enabled) { - switch (probe->dynamic.updating_stage) { - case GI_UPDATE_STAGE_CHECK: { - if (_check_gi_probe(instance_probe) || force_lighting) { //send to lighting thread + if (!probe->invalid && probe->dynamic.enabled) { + switch (probe->dynamic.updating_stage) { + case GI_UPDATE_STAGE_CHECK: { + if (_check_gi_probe(instance_probe) || force_lighting) { //send to lighting thread #ifndef NO_THREADS - probe_bake_mutex.lock(); - probe->dynamic.updating_stage = GI_UPDATE_STAGE_LIGHTING; - probe_bake_list.push_back(instance_probe); - probe_bake_mutex.unlock(); - probe_bake_sem.post(); + probe_bake_mutex.lock(); + probe->dynamic.updating_stage = GI_UPDATE_STAGE_LIGHTING; + probe_bake_list.push_back(instance_probe); + probe_bake_mutex.unlock(); + probe_bake_sem.post(); #else - _bake_gi_probe(instance_probe); + _bake_gi_probe(instance_probe); #endif - } - } break; - case GI_UPDATE_STAGE_LIGHTING: { - //do none, wait til done! + } + } break; + case GI_UPDATE_STAGE_LIGHTING: { + //do none, wait til done! - } break; - case GI_UPDATE_STAGE_UPLOADING: { - //uint64_t us = OS::get_singleton()->get_ticks_usec(); + } break; + case GI_UPDATE_STAGE_UPLOADING: { + //uint64_t us = OS::get_singleton()->get_ticks_usec(); - for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) { - PoolVector::Read r = probe->dynamic.mipmaps_3d[i].read(); - VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data, 0, probe->dynamic.grid_size[2] >> i, i, r.ptr()); - } + for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) { + PoolVector::Read r = probe->dynamic.mipmaps_3d[i].read(); + VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data, 0, probe->dynamic.grid_size[2] >> i, i, r.ptr()); + } - probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK; + probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK; - //print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); - } break; + //print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); + } break; + } } - } - //_update_gi_probe(gi_probe->self()->owner); + //_update_gi_probe(gi_probe->self()->owner); - gi_probe = next; + gi_probe = next; + } + SECTION_END(); } + SECTION_END(); } void VisualServerScene::_update_dirty_instance(Instance *p_instance) { diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 2474fdbdfadb..63837d39d754 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -298,6 +298,7 @@ void VisualServerViewport::draw_viewports() { if (!visible) { continue; } + SECTION_START(vformat("VIEWPORT #%d", i)); VSG::storage->render_target_clear_used(vp->render_target); @@ -362,6 +363,7 @@ void VisualServerViewport::draw_viewports() { vp->update_mode = VS::VIEWPORT_UPDATE_DISABLED; } VSG::scene_render->set_debug_draw_mode(VS::VIEWPORT_DEBUG_DRAW_DISABLED); + SECTION_END(); } } diff --git a/thirdparty/glad/KHR/khrplatform.h b/thirdparty/glad/KHR/khrplatform.h index dd22d9270188..01646449caed 100644 --- a/thirdparty/glad/KHR/khrplatform.h +++ b/thirdparty/glad/KHR/khrplatform.h @@ -153,6 +153,20 @@ typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 +/* + * To support platform where unsigned long cannot be used interchangeably with + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. + * Ideally, we could just use (u)intptr_t everywhere, but this could result in + * ABI breakage if khronos_uintptr_t is changed from unsigned long to + * unsigned long long or similar (this results in different C++ name mangling). + * To avoid changes for existing platforms, we restrict usage of intptr_t to + * platforms where the size of a pointer is larger than the size of long. + */ +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ +#define KHRONOS_USE_INTPTR_T +#endif +#endif #elif defined(__VMS ) || defined(__sgi) @@ -235,14 +249,21 @@ typedef unsigned short int khronos_uint16_t; * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ -#ifdef _WIN64 +#ifdef KHRONOS_USE_INTPTR_T +typedef intptr_t khronos_intptr_t; +typedef uintptr_t khronos_uintptr_t; +#elif defined(_WIN64) typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; +#endif + +#if defined(_WIN64) +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c index 836fbee09bef..26a2d88c664a 100644 --- a/thirdparty/glad/glad.c +++ b/thirdparty/glad/glad.c @@ -1,6 +1,6 @@ /* - OpenGL loader generated by glad 0.1.34 on Fri Feb 19 21:01:51 2021. + OpenGL loader generated by glad 0.1.36 on Mon Mar 6 09:00:20 2023. Language/Generator: C/C++ Specification: gl @@ -11,9 +11,11 @@ GL_ARB_framebuffer_object, GL_ARB_get_program_binary, GL_ARB_parallel_shader_compile, + GL_ARB_timer_query, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample, GL_EXT_framebuffer_object, + GL_KHR_debug, GL_KHR_parallel_shader_compile Loader: True Local files: False @@ -21,9 +23,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_ARB_get_program_binary,GL_ARB_parallel_shader_compile,GL_EXT_framebuffer_blit,GL_EXT_framebuffer_multisample,GL_EXT_framebuffer_object,GL_KHR_parallel_shader_compile" + --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_ARB_get_program_binary,GL_ARB_parallel_shader_compile,GL_ARB_timer_query,GL_EXT_framebuffer_blit,GL_EXT_framebuffer_multisample,GL_EXT_framebuffer_object,GL_KHR_debug,GL_KHR_parallel_shader_compile" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_get_program_binary&extensions=GL_ARB_parallel_shader_compile&extensions=GL_EXT_framebuffer_blit&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_framebuffer_object&extensions=GL_KHR_parallel_shader_compile + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_get_program_binary&extensions=GL_ARB_parallel_shader_compile&extensions=GL_ARB_timer_query&extensions=GL_EXT_framebuffer_blit&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_framebuffer_object&extensions=GL_KHR_debug&extensions=GL_KHR_parallel_shader_compile */ #include @@ -1002,9 +1004,11 @@ int GLAD_GL_ARB_debug_output = 0; int GLAD_GL_ARB_framebuffer_object = 0; int GLAD_GL_ARB_get_program_binary = 0; int GLAD_GL_ARB_parallel_shader_compile = 0; +int GLAD_GL_ARB_timer_query = 0; int GLAD_GL_EXT_framebuffer_blit = 0; int GLAD_GL_EXT_framebuffer_multisample = 0; int GLAD_GL_EXT_framebuffer_object = 0; +int GLAD_GL_KHR_debug = 0; int GLAD_GL_KHR_parallel_shader_compile = 0; PFNGLDEBUGMESSAGECONTROLARBPROC glad_glDebugMessageControlARB = NULL; PFNGLDEBUGMESSAGEINSERTARBPROC glad_glDebugMessageInsertARB = NULL; @@ -1033,6 +1037,27 @@ PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glad_glFramebufferTexture3DEXT = NULL; PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glad_glFramebufferRenderbufferEXT = NULL; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glad_glGetFramebufferAttachmentParameterivEXT = NULL; PFNGLGENERATEMIPMAPEXTPROC glad_glGenerateMipmapEXT = NULL; +PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl = NULL; +PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert = NULL; +PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback = NULL; +PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog = NULL; +PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup = NULL; +PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup = NULL; +PFNGLOBJECTLABELPROC glad_glObjectLabel = NULL; +PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel = NULL; +PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel = NULL; +PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel = NULL; +PFNGLDEBUGMESSAGECONTROLKHRPROC glad_glDebugMessageControlKHR = NULL; +PFNGLDEBUGMESSAGEINSERTKHRPROC glad_glDebugMessageInsertKHR = NULL; +PFNGLDEBUGMESSAGECALLBACKKHRPROC glad_glDebugMessageCallbackKHR = NULL; +PFNGLGETDEBUGMESSAGELOGKHRPROC glad_glGetDebugMessageLogKHR = NULL; +PFNGLPUSHDEBUGGROUPKHRPROC glad_glPushDebugGroupKHR = NULL; +PFNGLPOPDEBUGGROUPKHRPROC glad_glPopDebugGroupKHR = NULL; +PFNGLOBJECTLABELKHRPROC glad_glObjectLabelKHR = NULL; +PFNGLGETOBJECTLABELKHRPROC glad_glGetObjectLabelKHR = NULL; +PFNGLOBJECTPTRLABELKHRPROC glad_glObjectPtrLabelKHR = NULL; +PFNGLGETOBJECTPTRLABELKHRPROC glad_glGetObjectPtrLabelKHR = NULL; +PFNGLGETPOINTERVKHRPROC glad_glGetPointervKHR = NULL; PFNGLMAXSHADERCOMPILERTHREADSKHRPROC glad_glMaxShaderCompilerThreadsKHR = NULL; static void load_GL_VERSION_1_0(GLADloadproc load) { if(!GLAD_GL_VERSION_1_0) return; @@ -1837,6 +1862,12 @@ static void load_GL_ARB_parallel_shader_compile(GLADloadproc load) { if(!GLAD_GL_ARB_parallel_shader_compile) return; glad_glMaxShaderCompilerThreadsARB = (PFNGLMAXSHADERCOMPILERTHREADSARBPROC)load("glMaxShaderCompilerThreadsARB"); } +static void load_GL_ARB_timer_query(GLADloadproc load) { + if(!GLAD_GL_ARB_timer_query) return; + glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load("glQueryCounter"); + glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load("glGetQueryObjecti64v"); + glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load("glGetQueryObjectui64v"); +} static void load_GL_EXT_framebuffer_blit(GLADloadproc load) { if(!GLAD_GL_EXT_framebuffer_blit) return; glad_glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)load("glBlitFramebufferEXT"); @@ -1865,6 +1896,31 @@ static void load_GL_EXT_framebuffer_object(GLADloadproc load) { glad_glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)load("glGetFramebufferAttachmentParameterivEXT"); glad_glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)load("glGenerateMipmapEXT"); } +static void load_GL_KHR_debug(GLADloadproc load) { + if(!GLAD_GL_KHR_debug) return; + glad_glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)load("glDebugMessageControl"); + glad_glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)load("glDebugMessageInsert"); + glad_glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)load("glDebugMessageCallback"); + glad_glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)load("glGetDebugMessageLog"); + glad_glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)load("glPushDebugGroup"); + glad_glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC)load("glPopDebugGroup"); + glad_glObjectLabel = (PFNGLOBJECTLABELPROC)load("glObjectLabel"); + glad_glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)load("glGetObjectLabel"); + glad_glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)load("glObjectPtrLabel"); + glad_glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)load("glGetObjectPtrLabel"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); + glad_glDebugMessageControlKHR = (PFNGLDEBUGMESSAGECONTROLKHRPROC)load("glDebugMessageControlKHR"); + glad_glDebugMessageInsertKHR = (PFNGLDEBUGMESSAGEINSERTKHRPROC)load("glDebugMessageInsertKHR"); + glad_glDebugMessageCallbackKHR = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)load("glDebugMessageCallbackKHR"); + glad_glGetDebugMessageLogKHR = (PFNGLGETDEBUGMESSAGELOGKHRPROC)load("glGetDebugMessageLogKHR"); + glad_glPushDebugGroupKHR = (PFNGLPUSHDEBUGGROUPKHRPROC)load("glPushDebugGroupKHR"); + glad_glPopDebugGroupKHR = (PFNGLPOPDEBUGGROUPKHRPROC)load("glPopDebugGroupKHR"); + glad_glObjectLabelKHR = (PFNGLOBJECTLABELKHRPROC)load("glObjectLabelKHR"); + glad_glGetObjectLabelKHR = (PFNGLGETOBJECTLABELKHRPROC)load("glGetObjectLabelKHR"); + glad_glObjectPtrLabelKHR = (PFNGLOBJECTPTRLABELKHRPROC)load("glObjectPtrLabelKHR"); + glad_glGetObjectPtrLabelKHR = (PFNGLGETOBJECTPTRLABELKHRPROC)load("glGetObjectPtrLabelKHR"); + glad_glGetPointervKHR = (PFNGLGETPOINTERVKHRPROC)load("glGetPointervKHR"); +} static void load_GL_KHR_parallel_shader_compile(GLADloadproc load) { if(!GLAD_GL_KHR_parallel_shader_compile) return; glad_glMaxShaderCompilerThreadsKHR = (PFNGLMAXSHADERCOMPILERTHREADSKHRPROC)load("glMaxShaderCompilerThreadsKHR"); @@ -1875,9 +1931,11 @@ static int find_extensionsGL(void) { GLAD_GL_ARB_framebuffer_object = has_ext("GL_ARB_framebuffer_object"); GLAD_GL_ARB_get_program_binary = has_ext("GL_ARB_get_program_binary"); GLAD_GL_ARB_parallel_shader_compile = has_ext("GL_ARB_parallel_shader_compile"); + GLAD_GL_ARB_timer_query = has_ext("GL_ARB_timer_query"); GLAD_GL_EXT_framebuffer_blit = has_ext("GL_EXT_framebuffer_blit"); GLAD_GL_EXT_framebuffer_multisample = has_ext("GL_EXT_framebuffer_multisample"); GLAD_GL_EXT_framebuffer_object = has_ext("GL_EXT_framebuffer_object"); + GLAD_GL_KHR_debug = has_ext("GL_KHR_debug"); GLAD_GL_KHR_parallel_shader_compile = has_ext("GL_KHR_parallel_shader_compile"); free_exts(); return 1; @@ -1961,9 +2019,12 @@ int gladLoadGLLoader(GLADloadproc load) { load_GL_ARB_framebuffer_object(load); load_GL_ARB_get_program_binary(load); load_GL_ARB_parallel_shader_compile(load); + load_GL_ARB_timer_query(load); load_GL_EXT_framebuffer_blit(load); load_GL_EXT_framebuffer_multisample(load); load_GL_EXT_framebuffer_object(load); + load_GL_KHR_debug(load); load_GL_KHR_parallel_shader_compile(load); return GLVersion.major != 0 || GLVersion.minor != 0; } + diff --git a/thirdparty/glad/glad/glad.h b/thirdparty/glad/glad/glad.h index b328522e1271..04ed9057d5d7 100644 --- a/thirdparty/glad/glad/glad.h +++ b/thirdparty/glad/glad/glad.h @@ -1,6 +1,6 @@ /* - OpenGL loader generated by glad 0.1.34 on Fri Feb 19 21:01:51 2021. + OpenGL loader generated by glad 0.1.36 on Mon Mar 6 09:00:20 2023. Language/Generator: C/C++ Specification: gl @@ -11,9 +11,11 @@ GL_ARB_framebuffer_object, GL_ARB_get_program_binary, GL_ARB_parallel_shader_compile, + GL_ARB_timer_query, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample, GL_EXT_framebuffer_object, + GL_KHR_debug, GL_KHR_parallel_shader_compile Loader: True Local files: False @@ -21,9 +23,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_ARB_get_program_binary,GL_ARB_parallel_shader_compile,GL_EXT_framebuffer_blit,GL_EXT_framebuffer_multisample,GL_EXT_framebuffer_object,GL_KHR_parallel_shader_compile" + --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_ARB_get_program_binary,GL_ARB_parallel_shader_compile,GL_ARB_timer_query,GL_EXT_framebuffer_blit,GL_EXT_framebuffer_multisample,GL_EXT_framebuffer_object,GL_KHR_debug,GL_KHR_parallel_shader_compile" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_get_program_binary&extensions=GL_ARB_parallel_shader_compile&extensions=GL_EXT_framebuffer_blit&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_framebuffer_object&extensions=GL_KHR_parallel_shader_compile + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_get_program_binary&extensions=GL_ARB_parallel_shader_compile&extensions=GL_ARB_timer_query&extensions=GL_EXT_framebuffer_blit&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_framebuffer_object&extensions=GL_KHR_debug&extensions=GL_KHR_parallel_shader_compile */ @@ -3696,6 +3698,84 @@ GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 +#define GL_DEBUG_SOURCE_API_KHR 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A +#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B +#define GL_DEBUG_TYPE_ERROR_KHR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 +#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 +#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D +#define GL_BUFFER_KHR 0x82E0 +#define GL_SHADER_KHR 0x82E1 +#define GL_PROGRAM_KHR 0x82E2 +#define GL_VERTEX_ARRAY_KHR 0x8074 +#define GL_QUERY_KHR 0x82E3 +#define GL_PROGRAM_PIPELINE_KHR 0x82E4 +#define GL_SAMPLER_KHR 0x82E6 +#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 +#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 +#define GL_DEBUG_OUTPUT_KHR 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 +#define GL_STACK_OVERFLOW_KHR 0x0503 +#define GL_STACK_UNDERFLOW_KHR 0x0504 +#define GL_DISPLAY_LIST 0x82E7 #define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 #define GL_COMPLETION_STATUS_KHR 0x91B1 #ifndef GL_ARB_debug_output @@ -3738,6 +3818,10 @@ typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC)(GLuint count); GLAPI PFNGLMAXSHADERCOMPILERTHREADSARBPROC glad_glMaxShaderCompilerThreadsARB; #define glMaxShaderCompilerThreadsARB glad_glMaxShaderCompilerThreadsARB #endif +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 +GLAPI int GLAD_GL_ARB_timer_query; +#endif #ifndef GL_EXT_framebuffer_blit #define GL_EXT_framebuffer_blit 1 GLAPI int GLAD_GL_EXT_framebuffer_blit; @@ -3807,6 +3891,73 @@ typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC)(GLenum target); GLAPI PFNGLGENERATEMIPMAPEXTPROC glad_glGenerateMipmapEXT; #define glGenerateMipmapEXT glad_glGenerateMipmapEXT #endif +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +GLAPI int GLAD_GL_KHR_debug; +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl; +#define glDebugMessageControl glad_glDebugMessageControl +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert; +#define glDebugMessageInsert glad_glDebugMessageInsert +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC callback, const void *userParam); +GLAPI PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback; +#define glDebugMessageCallback glad_glDebugMessageCallback +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC)(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog; +#define glGetDebugMessageLog glad_glGetDebugMessageLog +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC)(GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup; +#define glPushDebugGroup glad_glPushDebugGroup +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC)(void); +GLAPI PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup; +#define glPopDebugGroup glad_glPopDebugGroup +typedef void (APIENTRYP PFNGLOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI PFNGLOBJECTLABELPROC glad_glObjectLabel; +#define glObjectLabel glad_glObjectLabel +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel; +#define glGetObjectLabel glad_glGetObjectLabel +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC)(const void *ptr, GLsizei length, const GLchar *label); +GLAPI PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel; +#define glObjectPtrLabel glad_glObjectPtrLabel +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC)(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel; +#define glGetObjectPtrLabel glad_glGetObjectPtrLabel +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI PFNGLDEBUGMESSAGECONTROLKHRPROC glad_glDebugMessageControlKHR; +#define glDebugMessageControlKHR glad_glDebugMessageControlKHR +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI PFNGLDEBUGMESSAGEINSERTKHRPROC glad_glDebugMessageInsertKHR; +#define glDebugMessageInsertKHR glad_glDebugMessageInsertKHR +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC)(GLDEBUGPROCKHR callback, const void *userParam); +GLAPI PFNGLDEBUGMESSAGECALLBACKKHRPROC glad_glDebugMessageCallbackKHR; +#define glDebugMessageCallbackKHR glad_glDebugMessageCallbackKHR +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI PFNGLGETDEBUGMESSAGELOGKHRPROC glad_glGetDebugMessageLogKHR; +#define glGetDebugMessageLogKHR glad_glGetDebugMessageLogKHR +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC)(GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI PFNGLPUSHDEBUGGROUPKHRPROC glad_glPushDebugGroupKHR; +#define glPushDebugGroupKHR glad_glPushDebugGroupKHR +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC)(void); +GLAPI PFNGLPOPDEBUGGROUPKHRPROC glad_glPopDebugGroupKHR; +#define glPopDebugGroupKHR glad_glPopDebugGroupKHR +typedef void (APIENTRYP PFNGLOBJECTLABELKHRPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI PFNGLOBJECTLABELKHRPROC glad_glObjectLabelKHR; +#define glObjectLabelKHR glad_glObjectLabelKHR +typedef void (APIENTRYP PFNGLGETOBJECTLABELKHRPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI PFNGLGETOBJECTLABELKHRPROC glad_glGetObjectLabelKHR; +#define glGetObjectLabelKHR glad_glGetObjectLabelKHR +typedef void (APIENTRYP PFNGLOBJECTPTRLABELKHRPROC)(const void *ptr, GLsizei length, const GLchar *label); +GLAPI PFNGLOBJECTPTRLABELKHRPROC glad_glObjectPtrLabelKHR; +#define glObjectPtrLabelKHR glad_glObjectPtrLabelKHR +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC)(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI PFNGLGETOBJECTPTRLABELKHRPROC glad_glGetObjectPtrLabelKHR; +#define glGetObjectPtrLabelKHR glad_glGetObjectPtrLabelKHR +typedef void (APIENTRYP PFNGLGETPOINTERVKHRPROC)(GLenum pname, void **params); +GLAPI PFNGLGETPOINTERVKHRPROC glad_glGetPointervKHR; +#define glGetPointervKHR glad_glGetPointervKHR +#endif #ifndef GL_KHR_parallel_shader_compile #define GL_KHR_parallel_shader_compile 1 GLAPI int GLAD_GL_KHR_parallel_shader_compile;