style: unify identifier naming per updated conventions

Automated with clang-tidy readability-identifier-naming (config added to
.clang-tidy) plus scripted passes, per the updated rules now documented
in CONTRIBUTING.md:

- types (class/struct/enum/alias/template params): PascalCase
- functions, variables, members: snake_case (incl. rational -> Rational)
- private/protected members: trailing underscore; static member
  variables likewise (instance_, available_themes_)
- constants and enum values: snake_case (kLinear -> k_linear,
  F32P -> f32p); ALL_CAPS reserved for macros
- macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG ->
  OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE,
  include guards -> OAK_*)
- file names: all lowercase (Current/Plugin/OliveHost/OliveClip/
  OlivePluginInstance -> current/plugin/olivehost/oliveclip/
  oliveplugininstance)
- getters share the member name sans underscore, setters set_foo()
- Qt and third-party (OpenFX) virtual overrides and framework callbacks
  keep their original names (exempt in .clang-tidy)

Manual follow-ups required where automation could not reach:
- string-based QMetaObject/SIGNAL/SLOT references updated to renamed
  methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...)
- macro bodies referencing renamed methods (OLIVE_CONFIG,
  NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*)
- self-shadowing locals renamed where signals/methods became same-named
  (size_changed, worker_count, selected_items, import param, filters)
- third_party OFX member/namespace usages restored (OFX::Host::*,
  _created, _clipPrefsDirty, createInstance, clearPersistentMessage)
- STL protocol aliases restored (const_iterator) with .clang-tidy
  ignore rules; qHash overloads restored

Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
2026-07-19 16:10:54 +08:00
parent cb1718a103
commit bb40b4923e
1014 changed files with 44257 additions and 44220 deletions
+37 -37
View File
@@ -21,8 +21,8 @@ DynamicRenderer::DynamicRenderer(const QString &backend, QObject *parent)
// resources, destroy the opaque backend object, then unload the shared library.
DynamicRenderer::~DynamicRenderer()
{
Destroy();
PostDestroy();
destroy();
post_destroy();
if (handle_ && destroy_) {
destroy_(handle_);
handle_ = nullptr;
@@ -35,7 +35,7 @@ DynamicRenderer::~DynamicRenderer()
// Builds the private backend library path for the current platform.
// The search is intentionally restricted to Oak-controlled directories so a
// system libGL/libvulkan loader is never mistaken for an Oak render backend.
QString DynamicRenderer::LibraryFilename() const
QString DynamicRenderer::library_filename() const
{
QString base;
if (backend_ == QStringLiteral("opengl")) {
@@ -78,20 +78,20 @@ QString DynamicRenderer::LibraryFilename() const
// Loads the selected backend, resolves its C ABI table, creates the opaque
// backend object, and optionally falls back from Vulkan to OpenGL when runtime
// availability checks fail.
bool DynamicRenderer::Load()
bool DynamicRenderer::load()
{
if (handle_) {
return true;
}
library_.setFileName(LibraryFilename());
library_.setFileName(library_filename());
if (!library_.load()) {
if (backend_ == QStringLiteral("vulkan")) {
qWarning()
<< "Failed to load Vulkan render backend" << library_.fileName()
<< library_.errorString() << "falling back to OpenGL backend";
backend_ = QStringLiteral("opengl");
library_.setFileName(LibraryFilename());
library_.setFileName(library_filename());
}
if (!library_.load()) {
@@ -101,7 +101,7 @@ bool DynamicRenderer::Load()
}
}
if (!ResolveFunctions()) {
if (!resolve_functions()) {
qWarning() << "Render backend is missing required symbols" << backend_;
library_.unload();
return false;
@@ -121,7 +121,7 @@ bool DynamicRenderer::Load()
qWarning() << "Render backend is not available" << backend_
<< library_.fileName();
if (backend_ == QStringLiteral("vulkan")) {
return FallbackToOpenGL();
return fallback_to_open_gl();
}
destroy_(handle_);
handle_ = nullptr;
@@ -133,9 +133,9 @@ bool DynamicRenderer::Load()
// Resolves the mandatory C ABI entry points from the loaded shared library.
// Optional information probes are resolved after the required render interface.
bool DynamicRenderer::ResolveFunctions()
bool DynamicRenderer::resolve_functions()
{
ResetFunctions();
reset_functions();
#define RESOLVE(member, type, symbol) \
member = reinterpret_cast<type>(library_.resolve(symbol)); \
if (!member) \
@@ -185,7 +185,7 @@ bool DynamicRenderer::ResolveFunctions()
// Discards a partially-created backend and restarts loading with the OpenGL
// backend. This keeps RenderManager's fallback path inside the adapter.
bool DynamicRenderer::FallbackToOpenGL()
bool DynamicRenderer::fallback_to_open_gl()
{
if (handle_ && destroy_) {
destroy_(handle_);
@@ -194,14 +194,14 @@ bool DynamicRenderer::FallbackToOpenGL()
if (library_.isLoaded()) {
library_.unload();
}
ResetFunctions();
reset_functions();
backend_ = QStringLiteral("opengl");
return Load();
return load();
}
// Clears all cached C function pointers so a failed backend cannot leave stale
// call targets behind for a later fallback load.
void DynamicRenderer::ResetFunctions()
void DynamicRenderer::reset_functions()
{
create_ = nullptr;
destroy_ = nullptr;
@@ -228,22 +228,22 @@ void DynamicRenderer::ResetFunctions()
}
// Returns backend metadata exposed by the dynamic library when available.
bool DynamicRenderer::GetBackendInfo(OakRenderBackendInfo *out_info) const
bool DynamicRenderer::get_backend_info(OakRenderBackendInfo *out_info) const
{
return handle_ && get_info_ && out_info && get_info_(handle_, out_info);
}
// Initializes the loaded backend using its own context/device creation path.
bool DynamicRenderer::Init()
bool DynamicRenderer::init()
{
return Load() && init_(handle_);
return load() && init_(handle_);
}
// Initializes an OpenGL backend against an existing widget context; non-OpenGL
// backends may ignore the context on the library side.
bool DynamicRenderer::InitWithOpenGLContext(QOpenGLContext *context)
bool DynamicRenderer::init_with_open_gl_context(QOpenGLContext *context)
{
if (!Load()) {
if (!load()) {
return false;
}
init_with_context_(handle_, context);
@@ -252,7 +252,7 @@ bool DynamicRenderer::InitWithOpenGLContext(QOpenGLContext *context)
// Forwards post-destroy cleanup to the backend while the library is still
// loaded and its symbols are still valid.
void DynamicRenderer::PostDestroy()
void DynamicRenderer::post_destroy()
{
if (handle_ && post_destroy_) {
post_destroy_(handle_);
@@ -261,7 +261,7 @@ void DynamicRenderer::PostDestroy()
// Runs backend post-initialization after Init/InitWithOpenGLContext has
// established the device or GL context.
void DynamicRenderer::PostInit()
void DynamicRenderer::post_init()
{
if (handle_) {
post_init_(handle_);
@@ -269,7 +269,7 @@ void DynamicRenderer::PostInit()
}
// Forwards render target clearing through the C ABI.
void DynamicRenderer::ClearDestination(Texture *texture, double r, double g,
void DynamicRenderer::clear_destination(Texture *texture, double r, double g,
double b, double a)
{
clear_destination_(handle_, texture, r, g, b, a);
@@ -277,7 +277,7 @@ void DynamicRenderer::ClearDestination(Texture *texture, double r, double g,
// Creates a backend-native shader and receives the result as an opaque QVariant
// because this first-generation ABI still shares C++/Qt types between modules.
QVariant DynamicRenderer::CreateNativeShader(ShaderCode code)
QVariant DynamicRenderer::create_native_shader(ShaderCode code)
{
QVariant out;
create_native_shader_(handle_, &code, &out);
@@ -285,13 +285,13 @@ QVariant DynamicRenderer::CreateNativeShader(ShaderCode code)
}
// Releases a backend-native shader handle.
void DynamicRenderer::DestroyNativeShader(QVariant shader)
void DynamicRenderer::destroy_native_shader(QVariant shader)
{
destroy_native_shader_(handle_, &shader);
}
// Uploads CPU pixel data into a backend texture through the dynamic ABI.
void DynamicRenderer::UploadToTexture(const QVariant &handle,
void DynamicRenderer::upload_to_texture(const QVariant &handle,
const VideoParams &params,
const void *data, int linesize)
{
@@ -299,7 +299,7 @@ void DynamicRenderer::UploadToTexture(const QVariant &handle,
}
// Downloads backend texture data into a caller-provided CPU buffer.
void DynamicRenderer::DownloadFromTexture(const QVariant &handle,
void DynamicRenderer::download_from_texture(const QVariant &handle,
const VideoParams &params, void *data,
int linesize)
{
@@ -307,13 +307,13 @@ void DynamicRenderer::DownloadFromTexture(const QVariant &handle,
}
// Waits for backend work to become visible to subsequent CPU or GPU consumers.
void DynamicRenderer::Flush()
void DynamicRenderer::flush()
{
flush_(handle_);
}
// Reads a single pixel through the backend-provided readback hook.
Color DynamicRenderer::GetPixelFromTexture(Texture *texture, const QPointF &pt)
Color DynamicRenderer::get_pixel_from_texture(Texture *texture, const QPointF &pt)
{
Color out;
get_pixel_from_texture_(handle_, texture, &pt, &out);
@@ -322,7 +322,7 @@ Color DynamicRenderer::GetPixelFromTexture(Texture *texture, const QPointF &pt)
// Exposes the wrapped OpenGL context when the backend is OpenGL; Vulkan returns
// null so callers can avoid GL-only paths.
QOpenGLContext *DynamicRenderer::OpenGLContext() const
QOpenGLContext *DynamicRenderer::open_gl_context() const
{
return opengl_context_ && handle_ ?
static_cast<QOpenGLContext *>(opengl_context_(handle_)) :
@@ -330,18 +330,18 @@ QOpenGLContext *DynamicRenderer::OpenGLContext() const
}
// Reports the effective backend after any load-time fallback has completed.
bool DynamicRenderer::IsOpenGL() const
bool DynamicRenderer::is_open_gl() const
{
return backend_ == QStringLiteral("opengl");
}
bool DynamicRenderer::IsVulkan() const
bool DynamicRenderer::is_vulkan() const
{
return backend_ == QStringLiteral("vulkan");
}
// Dispatches a shader blit to the loaded backend.
void DynamicRenderer::Blit(QVariant shader, AcceleratedJob &job,
void DynamicRenderer::blit(QVariant shader, AcceleratedJob &job,
Texture *destination, VideoParams destination_params,
bool clear_destination)
{
@@ -350,7 +350,7 @@ void DynamicRenderer::Blit(QVariant shader, AcceleratedJob &job,
}
// Allocates a backend-native texture and wraps its opaque handle in QVariant.
QVariant DynamicRenderer::CreateNativeTexture(int width, int height, int depth,
QVariant DynamicRenderer::create_native_texture(int width, int height, int depth,
PixelFormat format,
int channel_count,
const void *data, int linesize)
@@ -362,14 +362,14 @@ QVariant DynamicRenderer::CreateNativeTexture(int width, int height, int depth,
}
// Releases a backend-native texture handle.
void DynamicRenderer::DestroyNativeTexture(QVariant texture)
void DynamicRenderer::destroy_native_texture(QVariant texture)
{
destroy_native_texture_(handle_, &texture);
}
// Releases renderer-owned backend resources before the backend object itself is
// destroyed.
void DynamicRenderer::DestroyInternal()
void DynamicRenderer::destroy_internal()
{
if (handle_) {
destroy_internal_(handle_);
@@ -377,7 +377,7 @@ void DynamicRenderer::DestroyInternal()
}
// Exposes OFX OpenGL output binding through the dynamic backend when supported.
void DynamicRenderer::AttachOutputTexture(Texture *texture)
void DynamicRenderer::attach_output_texture(Texture *texture)
{
if (attach_output_texture_ && texture) {
QVariant id = texture->id();
@@ -386,7 +386,7 @@ void DynamicRenderer::AttachOutputTexture(Texture *texture)
}
// Clears any OFX output texture binding owned by the backend.
void DynamicRenderer::DetachOutputTexture()
void DynamicRenderer::detach_output_texture()
{
if (detach_output_texture_) {
detach_output_texture_(handle_);
+30 -30
View File
@@ -1,5 +1,5 @@
#ifndef DYNAMICRENDERER_H
#define DYNAMICRENDERER_H
#ifndef OAK_DYNAMICRENDERER_H
#define OAK_DYNAMICRENDERER_H
#include <QLibrary>
#include <QString>
@@ -21,14 +21,14 @@ public:
// Destroys backend resources and unloads the dynamic library.
virtual ~DynamicRenderer() override;
using Renderer::Blit;
using Renderer::blit;
// Loads the backend library, resolves C ABI symbols, and creates the handle.
bool Load();
bool load();
// Initializes an OpenGL backend with a caller-owned viewer context.
bool InitWithOpenGLContext(QOpenGLContext *context);
bool init_with_open_gl_context(QOpenGLContext *context);
// Retrieves backend metadata through the optional info entry point.
bool GetBackendInfo(OakRenderBackendInfo *out_info) const;
bool get_backend_info(OakRenderBackendInfo *out_info) const;
// Returns the effective backend after any load-time fallback.
QString backend_name() const
{
@@ -36,70 +36,70 @@ public:
}
// Initializes the backend using its default device/context path.
virtual bool Init() override;
virtual bool init() override;
// Runs backend post-destroy cleanup.
virtual void PostDestroy() override;
virtual void post_destroy() override;
// Runs backend post-init setup.
virtual void PostInit() override;
virtual void post_init() override;
// Clears either a native texture destination or the backend output target.
virtual void ClearDestination(Texture *texture = nullptr, double r = 0.0,
virtual void clear_destination(Texture *texture = nullptr, double r = 0.0,
double g = 0.0, double b = 0.0,
double a = 0.0) override;
// Creates a native shader through the dynamic backend.
virtual QVariant CreateNativeShader(ShaderCode code) override;
virtual QVariant create_native_shader(ShaderCode code) override;
// Destroys a native shader through the dynamic backend.
virtual void DestroyNativeShader(QVariant shader) override;
virtual void destroy_native_shader(QVariant shader) override;
// Uploads CPU pixels to a backend texture.
virtual void UploadToTexture(const QVariant &handle,
virtual void upload_to_texture(const QVariant &handle,
const VideoParams &params, const void *data,
int linesize) override;
// Downloads backend texture pixels to CPU memory.
virtual void DownloadFromTexture(const QVariant &handle,
virtual void download_from_texture(const QVariant &handle,
const VideoParams &params, void *data,
int linesize) override;
// Waits for backend work to complete.
virtual void Flush() override;
virtual void flush() override;
// Reads one pixel from a backend texture.
virtual Color GetPixelFromTexture(Texture *texture,
virtual Color get_pixel_from_texture(Texture *texture,
const QPointF &pt) override;
// Returns the wrapped OpenGL context for OpenGL backends.
virtual QOpenGLContext *OpenGLContext() const override;
virtual QOpenGLContext *open_gl_context() const override;
// Reports whether the effective backend is OpenGL.
virtual bool IsOpenGL() const override;
virtual bool is_open_gl() const override;
// Reports whether the effective backend is Vulkan.
virtual bool IsVulkan() const override;
virtual bool is_vulkan() const override;
// Attaches a texture for OFX OpenGL output when supported.
virtual void AttachOutputTexture(Texture *texture) override;
virtual void attach_output_texture(Texture *texture) override;
// Detaches any OFX output texture binding when supported.
virtual void DetachOutputTexture() override;
virtual void detach_output_texture() override;
protected:
// Dispatches a shader blit through the dynamic backend.
virtual void Blit(QVariant shader, AcceleratedJob &job,
virtual void blit(QVariant shader, AcceleratedJob &job,
Texture *destination, VideoParams destination_params,
bool clear_destination) override;
// Allocates a native texture through the dynamic backend.
virtual QVariant CreateNativeTexture(int width, int height, int depth,
virtual QVariant create_native_texture(int width, int height, int depth,
PixelFormat format, int channel_count,
const void *data = nullptr,
int linesize = 0) override;
// Releases a native texture through the dynamic backend.
virtual void DestroyNativeTexture(QVariant texture) override;
virtual void destroy_native_texture(QVariant texture) override;
// Releases backend-owned renderer resources.
virtual void DestroyInternal() override;
virtual void destroy_internal() override;
private:
// Resolves required backend C ABI symbols.
bool ResolveFunctions();
bool resolve_functions();
// Replaces a failed Vulkan backend with OpenGL.
bool FallbackToOpenGL();
bool fallback_to_open_gl();
// Clears all cached function pointers.
void ResetFunctions();
void reset_functions();
// Resolves the private backend library path.
QString LibraryFilename() const;
QString library_filename() const;
QString backend_;
QLibrary library_;
@@ -131,4 +131,4 @@ private:
}
#endif // DYNAMICRENDERER_H
#endif // OAK_DYNAMICRENDERER_H
+13 -13
View File
@@ -1,5 +1,5 @@
#ifndef RENDERBACKEND_C_H
#define RENDERBACKEND_C_H
#ifndef OAK_RENDERBACKEND_C_H
#define OAK_RENDERBACKEND_C_H
#include <stdbool.h>
#include <stdint.h>
@@ -20,20 +20,20 @@ typedef void *OakRenderBackendHandle;
/* Identifies the concrete backend behind a dynamically loaded library. */
enum OakRenderBackendKind {
OAK_RENDER_BACKEND_UNKNOWN = 0,
OAK_RENDER_BACKEND_OPENGL = 1,
OAK_RENDER_BACKEND_VULKAN = 2
oak_render_backend_unknown = 0,
oak_render_backend_opengl = 1,
oak_render_backend_vulkan = 2
};
/* Capability bits advertised by a backend through oak_renderer_get_info(). */
enum OakRenderBackendCapability {
OAK_RENDER_BACKEND_CAP_TEXTURES = 1ULL << 0,
OAK_RENDER_BACKEND_CAP_SHADERS = 1ULL << 1,
OAK_RENDER_BACKEND_CAP_BLIT = 1ULL << 2,
OAK_RENDER_BACKEND_CAP_READBACK = 1ULL << 3,
OAK_RENDER_BACKEND_CAP_VIEWER_CONTEXT = 1ULL << 4,
OAK_RENDER_BACKEND_CAP_INSTANCE = 1ULL << 5,
OAK_RENDER_BACKEND_CAP_DEVICE = 1ULL << 6
oak_render_backend_cap_textures = 1ULL << 0,
oak_render_backend_cap_shaders = 1ULL << 1,
oak_render_backend_cap_blit = 1ULL << 2,
oak_render_backend_cap_readback = 1ULL << 3,
oak_render_backend_cap_viewer_context = 1ULL << 4,
oak_render_backend_cap_instance = 1ULL << 5,
oak_render_backend_cap_device = 1ULL << 6
};
/* Static and runtime metadata returned by the backend. */
@@ -118,4 +118,4 @@ typedef void *(*OakBackendOpenGLContextFn)(OakRenderBackendHandle handle);
}
#endif
#endif // RENDERBACKEND_C_H
#endif // OAK_RENDERBACKEND_C_H