增加一些注释说明,部分来自AI

This commit is contained in:
hyzboy 2025-06-24 13:10:42 +08:00
parent fa7a0fca62
commit c3d9e26cde
2 changed files with 40 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include<hgl/type/DataType.h>
#include<hgl/type/SortedSet.h>
@ -32,7 +32,6 @@
* RenderComponent是可渲染组件的基类
*
* MeshComponent是静态网格组件RenderComponent实现
*
*/
#define COMPONENT_NAMESPACE hgl::graph
@ -65,6 +64,14 @@ public:
using ComponentDataPtr=SharedPtr<ComponentData>;
/**
* ComponentData与Component分离
*
* ComponentData是Component的一个数据载体
* Component使用
* Component也可以在运行时更换ComponentData
*/
/**
* <br>
*

View File

@ -44,7 +44,38 @@ void *DeviceMemory::Map()
void *result;
if(vkMapMemory(device,memory,0,req.size,0,&result)==VK_SUCCESS)
{
/** 只要是MAP成功那么数据就可以直接访问
1. HOST_VISIBLE HOST_COHERENT
integrated GPUstaging buffer+
RAMCPU内存
CPU直接读写
2. HOST_VISIBLE HOST_COHERENT
vkFlushMappedMemoryRangesvkInvalidateMappedMemoryRanges
CPU和GPU看到的数据可能不同步
3. GPU本地内存DEVICE_LOCALHOST_VISIBLE
vkMapMemory
staging bufferCPU缓存友好的区域
CPU内存准备好数据buffer
GPU且只在GPU用CPU端读取
CPU写入staging buffer flush GPU拷贝到本地显存
GPU拷贝到staging bufferCPU读取
CPU端准备好后一次性上传
*/
return result;
}
return(nullptr);
}