refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency - Fix OpenGL unit test GLAD initialization by using gladLoadGL() instead of gladLoadGLLoader(wglGetProcAddress) for fallback support - Migrate remaining tests to use gtest_discover_tests for granular test discovery (math, core, containers, memory, threading, debug, components, scene, resources, input, opengl) - Remove obsolete TEST_RESOURCES_DIR and copy_directory commands from OpenGL unit test CMakeLists (minimal/Res doesn't exist) - Update TEST_SPEC.md with performance metrics and per-module build/test commands for faster development workflow - Update CMake path references to use lowercase paths
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# TaskSystemConfig::enableTaskProfiling
|
||||
|
||||
```cpp
|
||||
bool enableTaskProfiling = true
|
||||
```
|
||||
|
||||
是否启用任务性能分析。启用后系统会记录任务的执行时间、等待时间等统计信息,可用于性能调试。
|
||||
|
||||
**类型:** `bool`
|
||||
|
||||
**默认值:** `true`
|
||||
|
||||
**当前状态:** 此配置项当前未实际使用,任务系统不会记录性能分析数据。
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
TaskSystemConfig config;
|
||||
config.workerThreadCount = 4;
|
||||
config.enableTaskProfiling = true; // 预留配置项
|
||||
|
||||
#ifdef NDEBUG
|
||||
config.enableTaskProfiling = false; // 预留配置项
|
||||
#endif
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TaskSystemConfig 总览](tasksystemconfig.md) - 返回类总览
|
||||
24
docs/api/threading/task-system-config/max-task-queue-size.md
Normal file
24
docs/api/threading/task-system-config/max-task-queue-size.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# TaskSystemConfig::maxTaskQueueSize
|
||||
|
||||
```cpp
|
||||
uint32_t maxTaskQueueSize = 1024
|
||||
```
|
||||
|
||||
任务队列的最大容量。当队列满时,新提交的任务将阻塞直到有空间。
|
||||
|
||||
**类型:** `uint32_t`
|
||||
|
||||
**默认值:** `1024`
|
||||
|
||||
**当前状态:** 此配置项当前未实际强制限制,任务队列可以无限增长(受系统内存限制)。
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
TaskSystemConfig config;
|
||||
config.maxTaskQueueSize = 4096; // 预留配置项(当前未强制限制)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TaskSystemConfig 总览](tasksystemconfig.md) - 返回类总览
|
||||
25
docs/api/threading/task-system-config/steal-tasks.md
Normal file
25
docs/api/threading/task-system-config/steal-tasks.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# TaskSystemConfig::stealTasks
|
||||
|
||||
```cpp
|
||||
bool stealTasks = true
|
||||
```
|
||||
|
||||
是否启用工作窃取。当启用时,空闲的工作线程可以从其他繁忙线程的任务队列中窃取任务,提高整体吞吐率。
|
||||
|
||||
**类型:** `bool`
|
||||
|
||||
**默认值:** `true`
|
||||
|
||||
**当前状态:** 此配置项当前未实际实现,工作窃取功能不可用。所有工作线程仅从全局任务队列获取任务。
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
TaskSystemConfig config;
|
||||
config.workerThreadCount = 8;
|
||||
config.stealTasks = true; // 预留配置项(当前未实现)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TaskSystemConfig 总览](tasksystemconfig.md) - 返回类总览
|
||||
36
docs/api/threading/task-system-config/task-system-config.md
Normal file
36
docs/api/threading/task-system-config/task-system-config.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# TaskSystemConfig
|
||||
|
||||
**命名空间**: `XCEngine::Threading`
|
||||
|
||||
**类型**: `struct`
|
||||
|
||||
**头文件**: `XCEngine/Threading/TaskSystemConfig.h`
|
||||
|
||||
**描述**: 任务系统配置结构体,用于初始化 TaskSystem 的行为参数。
|
||||
|
||||
## 结构体成员
|
||||
|
||||
| 成员 | 类型 | 描述 | 默认值 |
|
||||
|------|------|------|--------|
|
||||
| [`workerThreadCount`](worker-thread-count.md) | `uint32_t` | 工作线程数量(0=自动检测 CPU 核心数) | 0 |
|
||||
| [`enableTaskProfiling`](enable-task-profiling.md) | `bool` | 启用任务性能分析(当前未使用) | true |
|
||||
| [`stealTasks`](steal-tasks.md) | `bool` | 启用工作窃取(当前未实现) | true |
|
||||
| [`maxTaskQueueSize`](max-task-queue-size.md) | `uint32_t` | 最大任务队列大小(当前未强制限制) | 1024 |
|
||||
| [`threadStackSize`](thread-stack-size.md) | `uint32_t` | 线程栈大小(当前未使用,0=系统默认) | 0 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
TaskSystemConfig config;
|
||||
config.workerThreadCount = std::thread::hardware_concurrency();
|
||||
config.enableTaskProfiling = true;
|
||||
config.stealTasks = true;
|
||||
config.maxTaskQueueSize = 2048;
|
||||
|
||||
TaskSystem::Get().Initialize(config);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TaskSystem](../task-system/task-system.md) - 任务系统
|
||||
- [../threading/threading.md](../threading.md) - 模块总览
|
||||
28
docs/api/threading/task-system-config/thread-stack-size.md
Normal file
28
docs/api/threading/task-system-config/thread-stack-size.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# TaskSystemConfig::threadStackSize
|
||||
|
||||
```cpp
|
||||
uint32_t threadStackSize = 0
|
||||
```
|
||||
|
||||
工作线程的栈大小(字节)。值为 0 时使用系统默认值。
|
||||
|
||||
**类型:** `uint32_t`
|
||||
|
||||
**默认值:** `0`(使用系统默认)
|
||||
|
||||
**当前状态:** 此配置项当前未实际使用,工作线程始终使用系统默认栈大小。
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
TaskSystemConfig config;
|
||||
config.workerThreadCount = 4;
|
||||
config.threadStackSize = 1024 * 1024; // 预留配置项(当前未实现)
|
||||
|
||||
TaskSystemConfig defaultConfig;
|
||||
defaultConfig.threadStackSize = 0; // 使用系统默认
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TaskSystemConfig 总览](tasksystemconfig.md) - 返回类总览
|
||||
25
docs/api/threading/task-system-config/worker-thread-count.md
Normal file
25
docs/api/threading/task-system-config/worker-thread-count.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# TaskSystemConfig::workerThreadCount
|
||||
|
||||
```cpp
|
||||
uint32_t workerThreadCount = 0
|
||||
```
|
||||
|
||||
工作线程数量。当值为 0 时,任务系统自动检测 `std::thread::hardware_concurrency()` 并使用该值。
|
||||
|
||||
**类型:** `uint32_t`
|
||||
|
||||
**默认值:** `0`(自动检测)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
TaskSystemConfig config;
|
||||
config.workerThreadCount = 4; // 使用 4 个工作线程
|
||||
|
||||
TaskSystemConfig autoConfig;
|
||||
autoConfig.workerThreadCount = 0; // 自动检测(推荐)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TaskSystemConfig 总览](tasksystemconfig.md) - 返回类总览
|
||||
Reference in New Issue
Block a user