Add OpenGL renderer capability target

This commit is contained in:
2026-06-01 17:44:00 +02:00
parent d61c7f37c3
commit 9ab73a0354
10 changed files with 236 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
#include "pch.h"
#include "app.h"
#include "renderer_api/shader_catalog.h"
#include "renderer_gl/opengl_capabilities.h"
#include "shader.h"
void App::initShaders()
@@ -13,27 +14,33 @@ void App::initShaders()
render_task([] {
GLint n_exts;
glGetIntegerv(GL_NUM_EXTENSIONS, &n_exts);
std::vector<std::string> extension_storage;
std::vector<std::string_view> extension_views;
extension_storage.reserve(n_exts);
extension_views.reserve(n_exts);
for (int i = 0; i < n_exts; i++)
{
std::string ext = (const char*)glGetStringi(GL_EXTENSIONS, i);
if (ext.find("shader_framebuffer_fetch") != std::string::npos)
ShaderManager::ext_framebuffer_fetch = true;
if (ext.find("map_buffer_alignment") != std::string::npos)
ShaderManager::ext_map_aligned = true;
#if __GLES__ && !__WEB__
if (ext.find("texture_float") != std::string::npos)
ShaderManager::ext_float32 = true;
if (ext.find("texture_float_linear") != std::string::npos)
ShaderManager::ext_float32_linear = true;
if (ext.find("color_buffer_float") != std::string::npos)
ShaderManager::ext_float32 = true;
if (ext.find("texture_half_float") != std::string::npos)
ShaderManager::ext_float16 = true;
if (ext.find("color_buffer_half_float") != std::string::npos)
ShaderManager::ext_float16 = true;
#endif
LOG("EXT: %s", ext.c_str());
extension_storage.emplace_back((const char*)glGetStringi(GL_EXTENSIONS, i));
extension_views.push_back(extension_storage.back());
LOG("EXT: %s", extension_storage.back().c_str());
}
pp::renderer::gl::OpenGlRuntime runtime;
#if __GL__
runtime.desktop_gl = true;
#endif
#if __GLES__
runtime.gles = true;
#endif
#if __WEB__
runtime.web = true;
#endif
const auto capabilities = pp::renderer::gl::detect_opengl_capabilities(extension_views, runtime);
ShaderManager::ext_framebuffer_fetch = capabilities.framebuffer_fetch;
ShaderManager::ext_map_aligned = capabilities.map_buffer_alignment;
ShaderManager::ext_float32 = capabilities.float32_textures;
ShaderManager::ext_float32_linear = capabilities.float32_linear;
ShaderManager::ext_float16 = capabilities.float16_textures;
});
#if __GL__