Route shader runtime calls through renderer GL

This commit is contained in:
2026-06-03 06:53:51 +02:00
parent f20595aff6
commit acdaf3bb8e
6 changed files with 717 additions and 17 deletions

View File

@@ -220,6 +220,18 @@ using OpenGlScissorFn = void (*)(std::int32_t x, std::int32_t y, std::int32_t wi
using OpenGlBlendFuncFn = void (*)(std::uint32_t source_factor, std::uint32_t destination_factor) noexcept;
using OpenGlBlendEquationSeparateFn = void (*)(std::uint32_t color_equation, std::uint32_t alpha_equation) noexcept;
using OpenGlUseProgramFn = void (*)(std::uint32_t program) noexcept;
using OpenGlDeleteProgramFn = void (*)(std::uint32_t program) noexcept;
using OpenGlUniform4fvFn = void (*)(std::int32_t location, std::int32_t count, const float* values) noexcept;
using OpenGlUniform3fvFn = void (*)(std::int32_t location, std::int32_t count, const float* values) noexcept;
using OpenGlUniform2fvFn = void (*)(std::int32_t location, std::int32_t count, const float* values) noexcept;
using OpenGlUniformMatrix4fvFn = void (*)(
std::int32_t location,
std::int32_t count,
std::uint8_t transpose,
const float* values) noexcept;
using OpenGlUniform1iFn = void (*)(std::int32_t location, std::int32_t value) noexcept;
using OpenGlUniform1fFn = void (*)(std::int32_t location, float value) noexcept;
using OpenGlGetAttribLocationFn = std::int32_t (*)(std::uint32_t program, const char* name) noexcept;
using OpenGlBindFramebufferFn = void (*)(std::uint32_t target, std::uint32_t framebuffer) noexcept;
using OpenGlBindTextureFn = void (*)(std::uint32_t target, std::uint32_t texture) noexcept;
using OpenGlBindSamplerFn = void (*)(std::uint32_t unit, std::uint32_t sampler) noexcept;
@@ -433,6 +445,43 @@ struct OpenGlSamplerBindDispatch {
OpenGlBindSamplerFn bind_sampler = nullptr;
};
struct OpenGlProgramUseDispatch {
OpenGlUseProgramFn use_program = nullptr;
};
struct OpenGlProgramDeleteDispatch {
OpenGlUseProgramFn use_program = nullptr;
OpenGlDeleteProgramFn delete_program = nullptr;
};
struct OpenGlUniformVec4Dispatch {
OpenGlUniform4fvFn uniform_4fv = nullptr;
};
struct OpenGlUniformVec3Dispatch {
OpenGlUniform3fvFn uniform_3fv = nullptr;
};
struct OpenGlUniformVec2Dispatch {
OpenGlUniform2fvFn uniform_2fv = nullptr;
};
struct OpenGlUniformMat4Dispatch {
OpenGlUniformMatrix4fvFn uniform_matrix_4fv = nullptr;
};
struct OpenGlUniformIntDispatch {
OpenGlUniform1iFn uniform_1i = nullptr;
};
struct OpenGlUniformFloatDispatch {
OpenGlUniform1fFn uniform_1f = nullptr;
};
struct OpenGlAttributeLocationDispatch {
OpenGlGetAttribLocationFn get_attrib_location = nullptr;
};
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
std::span<const std::string_view> extensions,
OpenGlRuntime runtime) noexcept;
@@ -520,6 +569,40 @@ struct OpenGlSamplerBindDispatch {
std::uint32_t unit,
std::uint32_t sampler_id,
OpenGlSamplerBindDispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status use_opengl_program(
std::uint32_t program_id,
OpenGlProgramUseDispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status delete_opengl_program(
std::uint32_t program_id,
OpenGlProgramDeleteDispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status set_opengl_uniform_vec4(
std::int32_t location,
const float* values,
OpenGlUniformVec4Dispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status set_opengl_uniform_vec3(
std::int32_t location,
const float* values,
OpenGlUniformVec3Dispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status set_opengl_uniform_vec2(
std::int32_t location,
const float* values,
OpenGlUniformVec2Dispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status set_opengl_uniform_mat4(
std::int32_t location,
const float* values,
OpenGlUniformMat4Dispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status set_opengl_uniform_int(
std::int32_t location,
std::int32_t value,
OpenGlUniformIntDispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Status set_opengl_uniform_float(
std::int32_t location,
float value,
OpenGlUniformFloatDispatch dispatch) noexcept;
[[nodiscard]] pp::foundation::Result<std::int32_t> get_opengl_attribute_location(
std::uint32_t program_id,
const char* attribute_name,
OpenGlAttributeLocationDispatch dispatch) noexcept;
[[nodiscard]] std::uint32_t extension_count_query() noexcept;
[[nodiscard]] std::uint32_t extension_string_name() noexcept;