diff --git a/cpp/apps/primitives_gallery/capture.cpp b/cpp/apps/primitives_gallery/capture.cpp index 5e58f59d..bc68f376 100644 --- a/cpp/apps/primitives_gallery/capture.cpp +++ b/cpp/apps/primitives_gallery/capture.cpp @@ -47,6 +47,10 @@ bool run_capture(const CaptureConfig& cfg, const std::vector& items return false; } + // Capture mode usa GL 3.3 deliberadamente: WSL Mesa no entrega contexto + // 4.3 offscreen (GLXBadFBConfig). Las pruebas visuales no necesitan + // compute/SSBO — ImGui+ImPlot funciona en 3.3 core. La build interactiva + // (app_base.cpp) si pide 4.3. glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); diff --git a/cpp/apps/primitives_gallery/demos.h b/cpp/apps/primitives_gallery/demos.h index 70a36c54..7f698409 100644 --- a/cpp/apps/primitives_gallery/demos.h +++ b/cpp/apps/primitives_gallery/demos.h @@ -50,5 +50,6 @@ void demo_voronoi(); // issue 0034 // --- Gfx --- void demo_shader_canvas(); void demo_gl_texture(); // wave 1, issue 0026 +void demo_gl_info(); // issue 0049b — runtime GL version + 4.3 caps } // namespace gallery diff --git a/cpp/apps/primitives_gallery/demos_gfx.cpp b/cpp/apps/primitives_gallery/demos_gfx.cpp index 60dcf6a6..b69e50a9 100644 --- a/cpp/apps/primitives_gallery/demos_gfx.cpp +++ b/cpp/apps/primitives_gallery/demos_gfx.cpp @@ -120,4 +120,77 @@ void demo_shader_canvas() { ); } +// Issue 0049b — Mostrar la version de OpenGL del contexto y un puñado de +// limites 4.3 que confirman que compute shaders / SSBO / image load-store +// estan disponibles. No es codigo del registry, solo introspeccion del +// driver — sin estado, sin side effects: solo glGetString + glGetIntegerv. + +#ifndef GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#endif +#ifndef GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#endif +#ifndef GL_MAX_COMPUTE_SHARED_MEMORY_SIZE +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#endif + +void demo_gl_info() { + demo_header("gl_info", "v1.0.0", + "Introspeccion del contexto OpenGL activo (issue 0049b). El framework " + "ahora pide GL 4.3 core, lo que habilita compute shaders, SSBOs, image " + "load/store y atomic counters — bloques esenciales del graph_renderer " + "GPU del proyecto osint_graph."); + + auto gl_str = [](GLenum e) -> const char* { + const GLubyte* s = glGetString(e); + return s ? reinterpret_cast(s) : "(null)"; + }; + + section("Driver"); + ImGui::Text("Vendor: %s", gl_str(GL_VENDOR)); + ImGui::Text("Renderer: %s", gl_str(GL_RENDERER)); + ImGui::Text("Version: %s", gl_str(GL_VERSION)); + ImGui::Text("GLSL: %s", gl_str(GL_SHADING_LANGUAGE_VERSION)); + + GLint major = 0, minor = 0; + glGetIntegerv(GL_MAJOR_VERSION, &major); + glGetIntegerv(GL_MINOR_VERSION, &minor); + + const bool has_43 = (major > 4) || (major == 4 && minor >= 3); + section("Capabilities"); + ImGui::Text("Context: %d.%d core", major, minor); + if (has_43) { + ImGui::TextColored(ImVec4(0.40f, 0.85f, 0.40f, 1.0f), + "OpenGL 4.3+ — compute shaders, SSBOs, image load/store, atomic counters: AVAILABLE"); + } else { + ImGui::TextColored(ImVec4(0.95f, 0.55f, 0.30f, 1.0f), + "OpenGL < 4.3 — compute shaders / SSBOs NOT available on this driver"); + } + + section("Limits"); + GLint v = 0; + auto row = [&](const char* label, GLenum e) { + v = 0; + glGetIntegerv(e, &v); + ImGui::Text("%-44s %d", label, v); + }; + row("GL_MAX_TEXTURE_SIZE", GL_MAX_TEXTURE_SIZE); + row("GL_MAX_VERTEX_ATTRIBS", GL_MAX_VERTEX_ATTRIBS); + row("GL_MAX_UNIFORM_BLOCK_SIZE", GL_MAX_UNIFORM_BLOCK_SIZE); + if (has_43) { + row("GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS", GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS); + row("GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS", GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS); + row("GL_MAX_COMPUTE_SHARED_MEMORY_SIZE", GL_MAX_COMPUTE_SHARED_MEMORY_SIZE); + } + + code_block( + "// Solo glGetString + glGetIntegerv — sin loader extra.\n" + "GLint major = 0, minor = 0;\n" + "glGetIntegerv(GL_MAJOR_VERSION, &major);\n" + "glGetIntegerv(GL_MINOR_VERSION, &minor);\n" + "bool has_compute = (major > 4) || (major == 4 && minor >= 3);" + ); +} + } // namespace gallery diff --git a/cpp/apps/primitives_gallery/main.cpp b/cpp/apps/primitives_gallery/main.cpp index 8b1af123..d2c513b0 100644 --- a/cpp/apps/primitives_gallery/main.cpp +++ b/cpp/apps/primitives_gallery/main.cpp @@ -78,6 +78,7 @@ static const DemoEntry k_demos[] = { // Gfx (shaders_lab core) {"shader_canvas", "shader_canvas", "Gfx", &gallery::demo_shader_canvas}, {"gl_texture", "gl_texture_load", "Gfx", &gallery::demo_gl_texture}, // wave 1 + {"gl_info", "gl_info", "Gfx", &gallery::demo_gl_info}, // issue 0049b }; static constexpr int k_demo_count = sizeof(k_demos) / sizeof(k_demos[0]); @@ -205,8 +206,8 @@ int main(int argc, char** argv) { .height = 900, .viewports = true, .about = {.name = "Primitives Gallery", - .version = "0.3.0", - .description = "Visual catalog of fn_registry C++ UI primitives. Modo --capture para golden screenshots, sidebar via tree_view, candlestick fix."}, + .version = "0.4.0", + .description = "Visual catalog of fn_registry C++ UI primitives. Now on OpenGL 4.3 core (compute, SSBOs, image load/store) — ver demo gl_info."}, .init_gl_loader = true}, render ); diff --git a/cpp/framework/app_base.cpp b/cpp/framework/app_base.cpp index 3ad3d74c..e141e172 100644 --- a/cpp/framework/app_base.cpp +++ b/cpp/framework/app_base.cpp @@ -33,13 +33,13 @@ int run_app(AppConfig config, std::function render_fn) { return 1; } - // OpenGL 3.3 core - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + // OpenGL 4.3 core (issue 0049b) — habilita compute shaders, SSBOs, image + // load/store, atomic counters y debug output. Backward-compatible con + // shaders #version 330 y con todo lo escrito para 3.3 core. + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); -#ifdef __APPLE__ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); -#endif GLFWwindow* window = glfwCreateWindow(config.width, config.height, config.title, nullptr, nullptr); if (!window) { diff --git a/cpp/tests/golden/gl_info.png b/cpp/tests/golden/gl_info.png new file mode 100644 index 00000000..9c4a4c57 Binary files /dev/null and b/cpp/tests/golden/gl_info.png differ diff --git a/cpp/tests/test_visual.cpp b/cpp/tests/test_visual.cpp index 78be40a6..c93f08d0 100644 --- a/cpp/tests/test_visual.cpp +++ b/cpp/tests/test_visual.cpp @@ -94,7 +94,12 @@ TEST_CASE("primitives_gallery visual goldens", "[visual]") { // Ejecutar binario en modo --capture desde la raiz del repo. Algunas // demos resuelven paths relativos (p.ej. sql_workbench busca registry.db); // correr desde la raiz garantiza determinismo entre maquinas. - std::string cmd = std::string("cd '") + FN_TEST_REPO_ROOT + "' && '" + // + // LIBGL_ALWAYS_SOFTWARE=1 fuerza llvmpipe igual que update_goldens.sh, asi + // demos que muestran strings del driver (gl_info) no fallan por diferencias + // entre llvmpipe / d3d12 / drivers vendor. + std::string cmd = std::string("cd '") + FN_TEST_REPO_ROOT + "' && " + + "LIBGL_ALWAYS_SOFTWARE=1 '" + gallery_bin + "' --capture '" + tmp_dir + "' 2>&1"; INFO("capture cmd: " << cmd); const int rc = std::system(cmd.c_str()); diff --git a/dev/issues/README.md b/dev/issues/README.md index 96296180..ba877452 100644 --- a/dev/issues/README.md +++ b/dev/issues/README.md @@ -56,7 +56,7 @@ | [0048](completed/0048-cpp-visual-tests-ci-gate.md) | Visual tests via primitives_gallery + CI gate tested:true | completado | media | feature | — | | [0049](0049-osint-graph-viewer.md) | OSINT graph viewer + GPU graph rendering system (multi-issue) | pendiente | alta | feature | — | | [0049a](completed/0049a-osint-graph-setup.md) | Setup proyecto osint_graph + sub-repo graph_explorer | completado | alta | infra | parte de 0049 | -| [0049b](0049b-cpp-bump-gl-43.md) | Bump OpenGL 3.3 → 4.3 core en cpp/framework | pendiente | alta | infra | parte de 0049 | +| [0049b](completed/0049b-cpp-bump-gl-43.md) | Bump OpenGL 3.3 → 4.3 core en cpp/framework | completado | alta | infra | parte de 0049 | | [0049c](0049c-graph-renderer-tier1.md) | graph_renderer Tier 1: RGBA8, orphan, frustum cull, auto-pause | pendiente | alta | perf | parte de 0049 | | [0049d](0049d-graph-edges-vertex-pulling.md) | Aristas via vertex pulling con TBO | pendiente | alta | perf | parte de 0049 | | [0049e](0049e-graph-types-extended.md) | graph_types modelo extendido + EntityType/RelationType | pendiente | alta | feature | parte de 0049 | diff --git a/dev/issues/0049b-cpp-bump-gl-43.md b/dev/issues/completed/0049b-cpp-bump-gl-43.md similarity index 100% rename from dev/issues/0049b-cpp-bump-gl-43.md rename to dev/issues/completed/0049b-cpp-bump-gl-43.md