From 870cb3116e7908d3acdb0d2b45fc95e28d576a79 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Thu, 19 Mar 2026 00:35:26 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=AD=A3=20API=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=87=86=E7=A1=AE=E6=80=A7=20(=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E8=BD=AE=E6=A3=80=E6=9F=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复问题: - containers: HashMap include 路径修复 - core: RefCounted 析构函数访问级别, Event::begin/end 返回值说明 - memory: LinearAllocator::GetMarker 返回偏移量非指针 - resources: LoadAsync 示例使用不存在的模板方法 - rhi: OpenGL 链接错误, ShaderType 枚举缺失8个类型, 链接修复 - threading: SpinLock STL 兼容方法说明, Mutex const 方法说明 --- docs/api/containers/hashmap/hashmap.md | 2 +- docs/api/core/event/begin.md | 2 +- docs/api/core/event/end.md | 2 +- docs/api/core/refcounted/refcounted.md | 2 +- docs/api/memory/linear-allocator/get-marker.md | 6 ++++-- docs/api/resources/resources.md | 9 ++++++--- docs/api/rhi/command-list/command-list.md | 2 +- .../unordered-access-view/unordered-access-view.md | 2 -- docs/api/rhi/descriptor-pool/descriptor-pool.md | 8 ++++---- docs/api/rhi/rhi.md | 2 +- docs/api/rhi/shader/shader.md | 14 +++++++++++--- docs/api/threading/mutex/mutex.md | 2 +- docs/api/threading/spinlock/spinlock.md | 4 ++++ 13 files changed, 36 insertions(+), 21 deletions(-) diff --git a/docs/api/containers/hashmap/hashmap.md b/docs/api/containers/hashmap/hashmap.md index 071a2e16..d67f04e5 100644 --- a/docs/api/containers/hashmap/hashmap.md +++ b/docs/api/containers/hashmap/hashmap.md @@ -79,7 +79,7 @@ ## 使用示例 ```cpp -#include "Containers/HashMap.h" +#include #include int main() { diff --git a/docs/api/core/event/begin.md b/docs/api/core/event/begin.md index 95818d9b..7f06f209 100644 --- a/docs/api/core/event/begin.md +++ b/docs/api/core/event/begin.md @@ -10,7 +10,7 @@ Iterator begin(); 返回订阅列表的开始迭代器,用于范围for循环遍历所有订阅的回调。 -**返回:** `Iterator` - 指向第一个监听器的迭代器 +**返回:** `Iterator` - 指向第一个监听器的迭代器(等价于 `std::vector::iterator`) **复杂度:** O(1) diff --git a/docs/api/core/event/end.md b/docs/api/core/event/end.md index 18cf0b73..47bf34e7 100644 --- a/docs/api/core/event/end.md +++ b/docs/api/core/event/end.md @@ -10,7 +10,7 @@ Iterator end(); 返回订阅列表的结束迭代器,用于范围for循环遍历所有订阅的回调。 -**返回:** `Iterator` - 指向末尾的迭代器 +**返回:** `Iterator` - 指向末尾的迭代器(等价于 `std::vector::iterator`) **复杂度:** O(1) diff --git a/docs/api/core/refcounted/refcounted.md b/docs/api/core/refcounted/refcounted.md index d71a18e1..15800225 100644 --- a/docs/api/core/refcounted/refcounted.md +++ b/docs/api/core/refcounted/refcounted.md @@ -17,7 +17,7 @@ | 方法 | 描述 | |------|------| | `RefCounted()` | 构造函数,初始引用计数为 1 | -| `protected virtual ~RefCounted()` | 虚析构函数(受保护,不允许直接删除) | +| `virtual ~RefCounted()` | 虚析构函数 | ### 引用计数 diff --git a/docs/api/memory/linear-allocator/get-marker.md b/docs/api/memory/linear-allocator/get-marker.md index 36fecb39..73bcf41e 100644 --- a/docs/api/memory/linear-allocator/get-marker.md +++ b/docs/api/memory/linear-allocator/get-marker.md @@ -4,11 +4,13 @@ void* GetMarker() const; ``` -获取当前分配位置的标记。标记是一个指向当前偏移量的指针,可用于 `SetMarker` 恢复到该位置。此方法用于实现临时分配的撤销功能。 +获取当前分配位置的标记。标记是内部偏移量(`m_offset`)的快照,可用于 `SetMarker` 恢复到该位置。此方法用于实现临时分配的撤销功能。 **参数:** 无 -**返回:** 当前分配位置的指针标记 +**返回:** 当前位置标记(偏移量值),类型为 `void*` + +**注意:** 返回值是偏移量数值,不是指针。将其传给 `SetMarker` 可恢复到此分配位置。 **复杂度:** O(1) diff --git a/docs/api/resources/resources.md b/docs/api/resources/resources.md index 3dd96050..aa3f2a39 100644 --- a/docs/api/resources/resources.md +++ b/docs/api/resources/resources.md @@ -67,9 +67,12 @@ ResourceHandle mesh = ResourceManager::Get().Load("models/player.fbx ResourceHandle mat = ResourceManager::Get().Load("materials/player.mat"); // 异步加载 -ResourceManager::Get().LoadAsync("textures/terrain.png", - [](ResourceHandle tex) { - // 加载完成回调 +ResourceManager::Get().LoadAsync("textures/terrain.png", ResourceType::Texture, + [](LoadResult result) { + if (result.success) { + ResourceHandle tex(result.resource); + // 加载完成回调 + } }); // 释放资源 diff --git a/docs/api/rhi/command-list/command-list.md b/docs/api/rhi/command-list/command-list.md index f9d0da9c..43a96f66 100644 --- a/docs/api/rhi/command-list/command-list.md +++ b/docs/api/rhi/command-list/command-list.md @@ -81,7 +81,7 @@ | 方法 | 文档 | |------|------| -| `Shutdown` | [详细文档](../../threading/task-system/shutdown.md) | +| `Shutdown` | [详细文档](methods.md) | ## 使用示例 diff --git a/docs/api/rhi/d3d12/unordered-access-view/unordered-access-view.md b/docs/api/rhi/d3d12/unordered-access-view/unordered-access-view.md index 98f7e743..3dd2dc4f 100644 --- a/docs/api/rhi/d3d12/unordered-access-view/unordered-access-view.md +++ b/docs/api/rhi/d3d12/unordered-access-view/unordered-access-view.md @@ -8,8 +8,6 @@ | 方法 | 文档 | |------|------| -| `Initialize` | [详细文档](../../../threading/task-system/initialize.md) | -| `Shutdown` | [详细文档](../../../threading/task-system/shutdown.md) | | `GetCPUDescriptorHandle` | [详细文档](get-cpu-descriptor-handle.md) | ## 相关文档 diff --git a/docs/api/rhi/descriptor-pool/descriptor-pool.md b/docs/api/rhi/descriptor-pool/descriptor-pool.md index b3ffd328..cbe7ab7e 100644 --- a/docs/api/rhi/descriptor-pool/descriptor-pool.md +++ b/docs/api/rhi/descriptor-pool/descriptor-pool.md @@ -12,16 +12,16 @@ | 方法 | 文档 | |------|------| -| `Initialize` | [详细文档](../../threading/task-system/initialize.md) | -| `Shutdown` | [详细文档](../../threading/task-system/shutdown.md) | +| `Initialize` | [详细文档](methods.md) | +| `Shutdown` | [详细文档](methods.md) | ### 属性访问 | 方法 | 文档 | |------|------| -| `GetNativeHandle` | [详细文档](../buffer/get-native-handle.md) | +| `GetNativeHandle` | [详细文档](methods.md) | | `GetDescriptorCount` | [详细文档](get-descriptor-count.md) | -| `GetType` | [详细文档](../shader/get-type.md) | +| `GetType` | [详细文档](methods.md) | ## 相关文档 diff --git a/docs/api/rhi/rhi.md b/docs/api/rhi/rhi.md index 3aa0e07a..742a1ebb 100644 --- a/docs/api/rhi/rhi.md +++ b/docs/api/rhi/rhi.md @@ -114,7 +114,7 @@ delete device; ## 后端文档 - [D3D12 后端](d3d12/overview.md) - DirectX 12 实现详情 -- [OpenGL 后端](d3d12/overview.md) - OpenGL 实现详情 +- [OpenGL 后端](opengl/overview.md) - OpenGL 实现详情 ## 相关文档 diff --git a/docs/api/rhi/shader/shader.md b/docs/api/rhi/shader/shader.md index 248781eb..c1bd9046 100644 --- a/docs/api/rhi/shader/shader.md +++ b/docs/api/rhi/shader/shader.md @@ -55,9 +55,17 @@ | 枚举值 | 描述 | |--------|------| -| `Vertex` | 顶点着色器 | -| `Fragment` | 片元着色器 | -| `Compute` | 计算着色器 | +| `ShaderType::Vertex` | 顶点着色器 | +| `ShaderType::Fragment` | 片元着色器 | +| `ShaderType::Geometry` | 几何着色器 | +| `ShaderType::Compute` | 计算着色器 | +| `ShaderType::TessControl` | 曲面细分控制着色器 | +| `ShaderType::TessEvaluation` | 曲面细分评估着色器 | +| `ShaderType::Hull` | Hull 着色器 (D3D12) | +| `ShaderType::Domain` | Domain 着色器 (D3D12) | +| `ShaderType::Amplification` | 放大着色器 (Mesh Shader) | +| `ShaderType::Mesh` | Mesh 着色器 | +| `ShaderType::Library` | 着色器库 | ## 使用示例 diff --git a/docs/api/threading/mutex/mutex.md b/docs/api/threading/mutex/mutex.md index c1326dc9..ead8d18f 100644 --- a/docs/api/threading/mutex/mutex.md +++ b/docs/api/threading/mutex/mutex.md @@ -22,7 +22,7 @@ ## STL 兼容方法 -支持 `lock()`、`unlock()`、`try_lock()` 以兼容 STL 的 lockable 概念。 +支持 `lock()`, `unlock()`, `try_lock()` 以兼容 STL 的 lockable 概念(**注意**:这些方法为 const 成员函数)。 ## 使用示例 diff --git a/docs/api/threading/spinlock/spinlock.md b/docs/api/threading/spinlock/spinlock.md index 784f7cda..b91168d9 100644 --- a/docs/api/threading/spinlock/spinlock.md +++ b/docs/api/threading/spinlock/spinlock.md @@ -20,6 +20,10 @@ | [`Unlock`](unlock.md) | 释放锁 | | [`TryLock`](trylock.md) | 尝试获取锁(非阻塞) | +## STL 兼容方法 + +支持 `lock()`, `unlock()`, `try_lock()` 以兼容 STL 的 lockable 概念。 + ## 使用示例 ```cpp