Route Shape mesh operations through renderer GL
This commit is contained in:
@@ -168,6 +168,52 @@ struct OpenGlActiveUniformInfo {
|
||||
std::uint32_t type = 0;
|
||||
};
|
||||
|
||||
struct OpenGlVertexAttribute {
|
||||
std::uint32_t index = 0;
|
||||
std::int32_t component_count = 0;
|
||||
std::uint32_t component_type = 0;
|
||||
std::uint8_t normalized = 0;
|
||||
std::int32_t stride = 0;
|
||||
std::uintptr_t offset = 0;
|
||||
};
|
||||
|
||||
struct OpenGlMeshUpload {
|
||||
const void* vertex_data = nullptr;
|
||||
std::intptr_t vertex_byte_count = 0;
|
||||
const void* index_data = nullptr;
|
||||
std::intptr_t index_byte_count = 0;
|
||||
bool indexed = false;
|
||||
std::span<const OpenGlVertexAttribute> attributes;
|
||||
};
|
||||
|
||||
struct OpenGlMeshObjects {
|
||||
std::uint32_t vertex_buffer = 0;
|
||||
std::uint32_t index_buffer = 0;
|
||||
std::array<std::uint32_t, 2> vertex_arrays {};
|
||||
};
|
||||
|
||||
struct OpenGlBufferUpload {
|
||||
std::uint32_t target = 0;
|
||||
std::uint32_t buffer_id = 0;
|
||||
const void* data = nullptr;
|
||||
std::intptr_t byte_count = 0;
|
||||
std::uint32_t usage = 0;
|
||||
};
|
||||
|
||||
struct OpenGlMeshDraw {
|
||||
std::uint32_t vertex_array = 0;
|
||||
std::uint32_t mode = 0;
|
||||
std::int32_t count = 0;
|
||||
bool indexed = false;
|
||||
std::uint32_t index_type = 0;
|
||||
const void* index_offset = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlMeshDelete {
|
||||
std::array<std::uint32_t, 2> buffers {};
|
||||
std::array<std::uint32_t, 2> vertex_arrays {};
|
||||
};
|
||||
|
||||
struct OpenGlFramebufferRect {
|
||||
std::int32_t x0 = 0;
|
||||
std::int32_t y0 = 0;
|
||||
@@ -306,6 +352,30 @@ using OpenGlSamplerParameterfvFn = void (*)(
|
||||
const float* values) noexcept;
|
||||
using OpenGlGenObjectsFn = void (*)(std::uint32_t count, std::uint32_t* ids) noexcept;
|
||||
using OpenGlDeleteObjectsFn = void (*)(std::uint32_t count, const std::uint32_t* ids) noexcept;
|
||||
using OpenGlBindBufferFn = void (*)(std::uint32_t target, std::uint32_t buffer) noexcept;
|
||||
using OpenGlBufferDataFn = void (*)(
|
||||
std::uint32_t target,
|
||||
std::intptr_t byte_count,
|
||||
const void* data,
|
||||
std::uint32_t usage) noexcept;
|
||||
using OpenGlBindVertexArrayFn = void (*)(std::uint32_t vertex_array) noexcept;
|
||||
using OpenGlEnableVertexAttribArrayFn = void (*)(std::uint32_t index) noexcept;
|
||||
using OpenGlVertexAttribPointerFn = void (*)(
|
||||
std::uint32_t index,
|
||||
std::int32_t component_count,
|
||||
std::uint32_t component_type,
|
||||
std::uint8_t normalized,
|
||||
std::int32_t stride,
|
||||
const void* offset) noexcept;
|
||||
using OpenGlDrawElementsFn = void (*)(
|
||||
std::uint32_t mode,
|
||||
std::int32_t count,
|
||||
std::uint32_t index_type,
|
||||
const void* index_offset) noexcept;
|
||||
using OpenGlDrawArraysFn = void (*)(
|
||||
std::uint32_t mode,
|
||||
std::int32_t first,
|
||||
std::int32_t count) noexcept;
|
||||
using OpenGlTexImage2DFn = void (*)(
|
||||
std::uint32_t target,
|
||||
std::int32_t level,
|
||||
@@ -578,6 +648,32 @@ struct OpenGlUniformLocationDispatch {
|
||||
OpenGlGetUniformLocationFn get_uniform_location = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlMeshCreateDispatch {
|
||||
OpenGlGenObjectsFn gen_buffers = nullptr;
|
||||
OpenGlBindBufferFn bind_buffer = nullptr;
|
||||
OpenGlBufferDataFn buffer_data = nullptr;
|
||||
OpenGlGenObjectsFn gen_vertex_arrays = nullptr;
|
||||
OpenGlBindVertexArrayFn bind_vertex_array = nullptr;
|
||||
OpenGlEnableVertexAttribArrayFn enable_vertex_attrib_array = nullptr;
|
||||
OpenGlVertexAttribPointerFn vertex_attrib_pointer = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlBufferUploadDispatch {
|
||||
OpenGlBindBufferFn bind_buffer = nullptr;
|
||||
OpenGlBufferDataFn buffer_data = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlMeshDrawDispatch {
|
||||
OpenGlBindVertexArrayFn bind_vertex_array = nullptr;
|
||||
OpenGlDrawElementsFn draw_elements = nullptr;
|
||||
OpenGlDrawArraysFn draw_arrays = nullptr;
|
||||
};
|
||||
|
||||
struct OpenGlMeshDeleteDispatch {
|
||||
OpenGlDeleteObjectsFn delete_buffers = nullptr;
|
||||
OpenGlDeleteObjectsFn delete_vertex_arrays = nullptr;
|
||||
};
|
||||
|
||||
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
|
||||
std::span<const std::string_view> extensions,
|
||||
OpenGlRuntime runtime) noexcept;
|
||||
@@ -729,6 +825,18 @@ struct OpenGlUniformLocationDispatch {
|
||||
std::uint32_t program_id,
|
||||
const char* uniform_name,
|
||||
OpenGlUniformLocationDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Result<OpenGlMeshObjects> create_opengl_mesh_objects(
|
||||
OpenGlMeshUpload upload,
|
||||
OpenGlMeshCreateDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status upload_opengl_buffer_data(
|
||||
OpenGlBufferUpload upload,
|
||||
OpenGlBufferUploadDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status draw_opengl_mesh(
|
||||
OpenGlMeshDraw draw,
|
||||
OpenGlMeshDrawDispatch dispatch) noexcept;
|
||||
[[nodiscard]] pp::foundation::Status delete_opengl_mesh_objects(
|
||||
OpenGlMeshDelete objects,
|
||||
OpenGlMeshDeleteDispatch dispatch) noexcept;
|
||||
|
||||
[[nodiscard]] std::uint32_t extension_count_query() noexcept;
|
||||
[[nodiscard]] std::uint32_t extension_string_name() noexcept;
|
||||
|
||||
Reference in New Issue
Block a user