Move extension query mapping to renderer gl
This commit is contained in:
@@ -160,7 +160,8 @@ Known local toolchain state:
|
||||
render-target RGBA8 format tokens are cataloged and tested here too, including
|
||||
the legacy convert command and resize path. App clear color-buffer masks,
|
||||
default framebuffer binding, scissor state, and sampler filter/wrap tokens
|
||||
also consume the backend mapping.
|
||||
also consume the backend mapping. OpenGL extension enumeration query tokens
|
||||
used before runtime capability detection are cataloged here.
|
||||
- `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test
|
||||
for the current headless component matrix; see DEBT-0007 for remaining app
|
||||
and platform triplet migration.
|
||||
|
||||
@@ -425,7 +425,8 @@ and UI render-target RGBA8 format tokens are now also cataloged and tested in
|
||||
`pp_renderer_gl`; the legacy convert command and resize path consume the same
|
||||
backend-owned mapping. App clear color-buffer masks, default framebuffer
|
||||
binding, scissor state, and sampler filter/wrap tokens now share that backend
|
||||
mapping too. The existing renderer classes are not yet fully
|
||||
mapping too. OpenGL extension enumeration query tokens used before runtime
|
||||
capability detection also live in `pp_renderer_gl`. The existing renderer classes are not yet fully
|
||||
behind the renderer interfaces.
|
||||
|
||||
Implementation tasks:
|
||||
|
||||
@@ -4,6 +4,20 @@
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "shader.h"
|
||||
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] GLenum extension_count_query() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::extension_count_query());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum extension_string_name() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::extension_string_name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void App::initShaders()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@@ -13,14 +27,14 @@ void App::initShaders()
|
||||
|
||||
render_task([] {
|
||||
GLint n_exts;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &n_exts);
|
||||
glGetIntegerv(extension_count_query(), &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++)
|
||||
{
|
||||
extension_storage.emplace_back((const char*)glGetStringi(GL_EXTENSIONS, i));
|
||||
extension_storage.emplace_back((const char*)glGetStringi(extension_string_name(), i));
|
||||
extension_views.push_back(extension_storage.back());
|
||||
LOG("EXT: %s", extension_storage.back().c_str());
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ constexpr std::uint32_t gl_vertex_shader = 0x8B31U;
|
||||
constexpr std::uint32_t gl_compile_status = 0x8B81U;
|
||||
constexpr std::uint32_t gl_link_status = 0x8B82U;
|
||||
constexpr std::uint32_t gl_active_uniforms = 0x8B86U;
|
||||
constexpr std::uint32_t gl_extensions = 0x1F03U;
|
||||
constexpr std::uint32_t gl_num_extensions = 0x821DU;
|
||||
constexpr std::uint32_t gl_version = 0x1F02U;
|
||||
constexpr std::uint32_t gl_vendor = 0x1F00U;
|
||||
constexpr std::uint32_t gl_renderer = 0x1F01U;
|
||||
@@ -140,6 +142,16 @@ OpenGlCapabilities detect_opengl_capabilities(
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
std::uint32_t extension_count_query() noexcept
|
||||
{
|
||||
return gl_num_extensions;
|
||||
}
|
||||
|
||||
std::uint32_t extension_string_name() noexcept
|
||||
{
|
||||
return gl_extensions;
|
||||
}
|
||||
|
||||
std::uint32_t texture_upload_type_for_internal_format(std::uint32_t internal_format) noexcept
|
||||
{
|
||||
switch (internal_format) {
|
||||
|
||||
@@ -42,6 +42,8 @@ struct OpenGlReadbackFormat {
|
||||
std::span<const std::string_view> extensions,
|
||||
OpenGlRuntime runtime) noexcept;
|
||||
|
||||
[[nodiscard]] std::uint32_t extension_count_query() noexcept;
|
||||
[[nodiscard]] std::uint32_t extension_string_name() noexcept;
|
||||
[[nodiscard]] std::uint32_t texture_upload_type_for_internal_format(std::uint32_t internal_format) noexcept;
|
||||
[[nodiscard]] std::uint32_t unsigned_byte_component_type() noexcept;
|
||||
[[nodiscard]] std::uint32_t rgba_pixel_format() noexcept;
|
||||
|
||||
@@ -16,6 +16,9 @@ void detects_common_extension_capabilities(pp::tests::Harness& h)
|
||||
"GL_ARB_map_buffer_alignment",
|
||||
};
|
||||
|
||||
PP_EXPECT(h, pp::renderer::gl::extension_count_query() == 0x821DU);
|
||||
PP_EXPECT(h, pp::renderer::gl::extension_string_name() == 0x1F03U);
|
||||
|
||||
const auto capabilities = pp::renderer::gl::detect_opengl_capabilities(
|
||||
extensions,
|
||||
pp::renderer::gl::OpenGlRuntime {});
|
||||
|
||||
Reference in New Issue
Block a user