类 | |
| class | ComputeShader |
| Backend-agnostic compute program. Bind storage buffers then dispatch via Gpgpu::dispatch. Push constants: float[32] (same size as graphics::Shader). 更多... | |
| class | Gpgpu |
| GPGPU module — compute shaders + storage buffers via the active Graphics backend. Uses the graphics queue when no dedicated compute family exists (Apple/MoltenVK). 更多... | |
| class | GpuBuffer |
| Backend-agnostic GPU buffer for compute (storage) or CPU staging transfers. Squirrel-owned; derived class destroys GPU resources in destructor. 更多... | |
| class | Sequence |
| class | ShaderSystem |
| class | VulkanComputeShader |
| Vulkan 计算着色器(SPIR-V pipeline + descriptor 管理)。 更多... | |
| class | VulkanGpuBuffer |
| Vulkan 计算缓冲区实现(storage/vertex buffer + device memory)。 更多... | |
| struct | VulkanSequence |
| class | WebGpuComputeShader |
| Compute program for the WebGPU backend. Accepts WGSL source; GLSL/SPIR-V input is rejected (browsers only accept WGSL at runtime). 更多... | |
| class | WebGpuGpuBuffer |
| Storage / staging buffer for the WebGPU backend. 更多... | |
函数 | |
| template<typename Comp > | |
| constexpr int | componentFloatCount () |
| template<typename Base , typename Comp > | |
| int | countViewEntities () |
| Count live entities matching View<Base, Comp>. | |
| template<typename Base , typename Comp > | |
| int | packViewComponent (ShaderSystem &sys, int binding) |
| Pack View<Base, Comp> into ShaderSystem binding as AoS floats. Returns entity count (0 if empty). | |
| template<typename Base , typename Comp > | |
| void | unpackViewComponent (ShaderSystem &sys, int binding, int count) |
Write ShaderSystem binding floats back into View<Base, Comp> (same order as pack). count should be the value returned by packViewComponent. | |
| template<typename Base , typename Comp > | |
| int | runViewComponentSystem (ShaderSystem &sys, int binding, float dt) |
| Pack + dispatch + unpack a single-component GPU system. Additional bindings must be uploaded by the caller before this helper, or use ShaderSystem manually for multi-buffer systems. | |
| int | packScriptEntityFloats (ssq::Object entities, const std::string &slot, ssq::Object fields, GpuBuffer *buf) |
| Pack script ECS entities' component number fields into a GpuBuffer (AoS). entities: Squirrel array of entity instances slot: component slot name on the entity (e.g. "pos") fields: Squirrel array of field name strings (e.g. ["x","y"]) Returns entity count packed (0 on empty / error). | |
| int | unpackScriptEntityFloats (ssq::Object entities, const std::string &slot, ssq::Object fields, GpuBuffer *buf, int entityCount) |
| Inverse of packScriptEntityFloats; entityCount should match pack result. | |
| Module_IMPL (Gpgpu, new Gpgpu()) | |
| bool | vulkanGpgpuReady () |
| Vulkan 后端是否就绪(设备/队列可用)。 | |
| ComputeShader * | vulkanNewShaderFromSpirv (const std::vector< uint32_t > &spv) |
| 从 SPIR-V 字节码创建计算着色器。 | |
| GpuBuffer * | vulkanNewBuffer (int byteSize, const std::string &usage) |
| 创建 GPU 存储/传输缓冲区;usage 为 "storage" | "vertex" 等。 | |
| void | vulkanDispatch (ComputeShader *shader, int groupsX, int groupsY, int groupsZ) |
| 派发计算着色器(groupsX/Y/Z 为线程组数)。 | |
| VulkanSequence * | vulkanSequenceCreate () |
| void | vulkanSequenceDestroy (VulkanSequence *seq) |
| void | vulkanSequenceBegin (VulkanSequence *seq) |
| void | vulkanSequenceRecordUpload (VulkanSequence *seq, GpuBuffer *dst, const void *src, uint64_t nbytes, uint64_t dstOffset) |
| void | vulkanSequenceRecordDownload (VulkanSequence *seq, GpuBuffer *src, GpuBuffer *staging, uint64_t nbytes, uint64_t srcOffset) |
| void | vulkanSequenceRecordDispatch (VulkanSequence *seq, ComputeShader *shader, int groupsX, int groupsY, int groupsZ) |
| void | vulkanSequenceSubmit (VulkanSequence *seq) |
| graphics::vulkan::Graphics * | requireVulkanGraphics () |
| Resolve live Vulkan Graphics (throws if missing / not initialized). | |
| bool | vulkanGraphicsReady () |
| True if Vulkan Graphics device is ready. | |
| vk::Queue | computeQueue (graphics::vulkan::Graphics *vkg) |
| vk::CommandPool | computeCommandPool (graphics::vulkan::Graphics *vkg) |
| std::vector< uint32_t > | loadSpirvFile (const std::string &path) |
| std::vector< uint32_t > | compileComputeGlsl (const std::string &glsl) |
| bool | webgpuGpgpuReady () |
| WebGpuComputeShader * | webgpuNewShaderFromWgsl (const std::string &wgsl) |
| WebGpuComputeShader * | webgpuNewShaderFromSpirv (const std::vector< uint32_t > &spv) |
| WebGpuGpuBuffer * | webgpuNewBuffer (int byteSize, const std::string &usage) |
| void | webgpuDispatch (ComputeShader *shader, int groupsX, int groupsY, int groupsZ) |
函数说明
◆ compileComputeGlsl()
| std::vector< uint32_t > eve::gpgpu::compileComputeGlsl | ( | const std::string & | glsl | ) |
◆ componentFloatCount()
|
constexpr |
◆ computeCommandPool()
| vk::CommandPool eve::gpgpu::computeCommandPool | ( | graphics::vulkan::Graphics * | vkg | ) |
◆ computeQueue()
| vk::Queue eve::gpgpu::computeQueue | ( | graphics::vulkan::Graphics * | vkg | ) |
◆ countViewEntities()
| int eve::gpgpu::countViewEntities | ( | ) |
◆ loadSpirvFile()
| std::vector< uint32_t > eve::gpgpu::loadSpirvFile | ( | const std::string & | path | ) |
在文件 VulkanUtil.cpp 第 75 行定义.
◆ Module_IMPL()
| eve::gpgpu::Module_IMPL | ( | Gpgpu | , |
| new | Gpgpu() | ||
| ) |
◆ packScriptEntityFloats()
| int eve::gpgpu::packScriptEntityFloats | ( | ssq::Object | entitiesObj, |
| const std::string & | slot, | ||
| ssq::Object | fieldsObj, | ||
| GpuBuffer * | buf | ||
| ) |
Pack script ECS entities' component number fields into a GpuBuffer (AoS). entities: Squirrel array of entity instances slot: component slot name on the entity (e.g. "pos") fields: Squirrel array of field name strings (e.g. ["x","y"]) Returns entity count packed (0 on empty / error).
在文件 EcsScriptPack.cpp 第 121 行定义.
引用了 f, eve::gpgpu::GpuBuffer::getSize(), n, v, vm , 以及 eve::gpgpu::GpuBuffer::writeFloat32s().
◆ packViewComponent()
| int eve::gpgpu::packViewComponent | ( | ShaderSystem & | sys, |
| int | binding | ||
| ) |
Pack View<Base, Comp> into ShaderSystem binding as AoS floats. Returns entity count (0 if empty).
引用了 n, eve::gpgpu::ShaderSystem::upload() , 以及 view.
◆ requireVulkanGraphics()
| graphics::vulkan::Graphics * eve::gpgpu::requireVulkanGraphics | ( | ) |
Resolve live Vulkan Graphics (throws if missing / not initialized).
在文件 VulkanUtil.cpp 第 38 行定义.
被这些函数引用 eve::gpgpu::VulkanGpuBuffer::downloadBytes(), eve::gpgpu::VulkanSequence::ensureReady(), eve::gpgpu::VulkanGpuBuffer::uploadBytes(), vulkanDispatch(), vulkanNewBuffer() , 以及 vulkanNewShaderFromSpirv().
◆ runViewComponentSystem()
| int eve::gpgpu::runViewComponentSystem | ( | ShaderSystem & | sys, |
| int | binding, | ||
| float | dt | ||
| ) |
Pack + dispatch + unpack a single-component GPU system. Additional bindings must be uploaded by the caller before this helper, or use ShaderSystem manually for multi-buffer systems.
引用了 eve::gpgpu::ShaderSystem::dispatch() , 以及 n.
◆ unpackScriptEntityFloats()
| int eve::gpgpu::unpackScriptEntityFloats | ( | ssq::Object | entitiesObj, |
| const std::string & | slot, | ||
| ssq::Object | fieldsObj, | ||
| GpuBuffer * | buf, | ||
| int | entityCount | ||
| ) |
Inverse of packScriptEntityFloats; entityCount should match pack result.
在文件 EcsScriptPack.cpp 第 186 行定义.
引用了 f, n, eve::gpgpu::GpuBuffer::readFloat32s(), v , 以及 vm.
◆ unpackViewComponent()
| void eve::gpgpu::unpackViewComponent | ( | ShaderSystem & | sys, |
| int | binding, | ||
| int | count | ||
| ) |
Write ShaderSystem binding floats back into View<Base, Comp> (same order as pack). count should be the value returned by packViewComponent.
引用了 eve::gpgpu::ShaderSystem::download() , 以及 view.
◆ vulkanDispatch()
| void eve::gpgpu::vulkanDispatch | ( | ComputeShader * | shader, |
| int | groupsX, | ||
| int | groupsY, | ||
| int | groupsZ | ||
| ) |
派发计算着色器(groupsX/Y/Z 为线程组数)。
在文件 VulkanGpgpu.cpp 第 98 行定义.
引用了 computeCommandPool(), computeQueue(), device, eve::gpgpu::ComputeShader::kPushConstantBytes, requireVulkanGraphics() , 以及 shader.
被这些函数引用 eve::gpgpu::Gpgpu::dispatch() , 以及 eve::virtualgeometry::vgUpdate().
◆ vulkanGpgpuReady()
| bool eve::gpgpu::vulkanGpgpuReady | ( | ) |
◆ vulkanGraphicsReady()
| bool eve::gpgpu::vulkanGraphicsReady | ( | ) |
◆ vulkanNewBuffer()
| GpuBuffer * eve::gpgpu::vulkanNewBuffer | ( | int | byteSize, |
| const std::string & | usage | ||
| ) |
创建 GPU 存储/传输缓冲区;usage 为 "storage" | "vertex" 等。
在文件 VulkanGpgpu.cpp 第 66 行定义.
引用了 b, device , 以及 requireVulkanGraphics().
被这些函数引用 eve::gpgpu::Gpgpu::newBuffer(), eve::virtualgeometry::vgReset(), eve::virtualgeometry::vgUpload() , 以及 eve::virtualgeometry::vgUploadUniforms().
◆ vulkanNewShaderFromSpirv()
| ComputeShader * eve::gpgpu::vulkanNewShaderFromSpirv | ( | const std::vector< uint32_t > & | spv | ) |
从 SPIR-V 字节码创建计算着色器。
在文件 VulkanGpgpu.cpp 第 13 行定义.
引用了 b, device, eve::gpgpu::ComputeShader::kMaxBindings, eve::gpgpu::ComputeShader::kPushConstantBytes, requireVulkanGraphics() , 以及 shader.
被这些函数引用 eve::gpgpu::Gpgpu::newShader() , 以及 eve::gpgpu::Gpgpu::newShaderFromBytecode().
◆ vulkanSequenceBegin()
| void eve::gpgpu::vulkanSequenceBegin | ( | VulkanSequence * | seq | ) |
◆ vulkanSequenceCreate()
| VulkanSequence * eve::gpgpu::vulkanSequenceCreate | ( | ) |
在文件 VulkanSequence.cpp 第 31 行定义.
◆ vulkanSequenceDestroy()
| void eve::gpgpu::vulkanSequenceDestroy | ( | VulkanSequence * | seq | ) |
在文件 VulkanSequence.cpp 第 78 行定义.
引用了 eve::gpgpu::VulkanSequence::destroy().
被这些函数引用 eve::gpgpu::Sequence::~Sequence().
◆ vulkanSequenceRecordDispatch()
| void eve::gpgpu::vulkanSequenceRecordDispatch | ( | VulkanSequence * | seq, |
| ComputeShader * | shader, | ||
| int | groupsX, | ||
| int | groupsY, | ||
| int | groupsZ | ||
| ) |
在文件 VulkanSequence.cpp 第 145 行定义.
引用了 eve::gpgpu::VulkanSequence::commandBuffer, device, eve::gpgpu::VulkanSequence::ensureCommandBuffer(), eve::graphics::vulkan::Graphics::getDevice(), eve::gpgpu::ComputeShader::kPushConstantBytes, shader, eve::gpgpu::VulkanSequence::usedShaders , 以及 eve::gpgpu::VulkanSequence::vkg.
◆ vulkanSequenceRecordDownload()
| void eve::gpgpu::vulkanSequenceRecordDownload | ( | VulkanSequence * | seq, |
| GpuBuffer * | src, | ||
| GpuBuffer * | staging, | ||
| uint64_t | nbytes, | ||
| uint64_t | srcOffset | ||
| ) |
◆ vulkanSequenceRecordUpload()
| void eve::gpgpu::vulkanSequenceRecordUpload | ( | VulkanSequence * | seq, |
| GpuBuffer * | dst, | ||
| const void * | src, | ||
| uint64_t | nbytes, | ||
| uint64_t | dstOffset | ||
| ) |
在文件 VulkanSequence.cpp 第 91 行定义.
引用了 eve::gpgpu::VulkanSequence::commandBuffer, device, eve::gpgpu::VulkanSequence::ensureCommandBuffer(), eve::graphics::vulkan::Graphics::getDevice(), eve::gpgpu::VulkanSequence::stagingPool, eve::gpgpu::VulkanSequence::stagingUsed , 以及 eve::gpgpu::VulkanSequence::vkg.
被这些函数引用 eve::gpgpu::Sequence::recordUpload().
◆ vulkanSequenceSubmit()
| void eve::gpgpu::vulkanSequenceSubmit | ( | VulkanSequence * | seq | ) |
在文件 VulkanSequence.cpp 第 175 行定义.
引用了 eve::gpgpu::VulkanSequence::commandBuffer, device, eve::gpgpu::VulkanComputeShader::endSequence(), eve::gpgpu::VulkanSequence::ensureReady(), eve::gpgpu::VulkanSequence::fence, eve::graphics::vulkan::Graphics::getDevice(), eve::gpgpu::VulkanSequence::pool, eve::gpgpu::VulkanSequence::queue, eve::gpgpu::VulkanSequence::recording, shader, eve::gpgpu::VulkanSequence::usedShaders , 以及 eve::gpgpu::VulkanSequence::vkg.
被这些函数引用 eve::gpgpu::Sequence::submit().
◆ webgpuDispatch()
| void eve::gpgpu::webgpuDispatch | ( | ComputeShader * | shader, |
| int | groupsX, | ||
| int | groupsY, | ||
| int | groupsZ | ||
| ) |
◆ webgpuGpgpuReady()
| bool eve::gpgpu::webgpuGpgpuReady | ( | ) |
在文件 WebGpuGpgpu.cpp 第 39 行定义.
被这些函数引用 eve::gpgpu::Gpgpu::isAvailable().
◆ webgpuNewBuffer()
| WebGpuGpuBuffer * eve::gpgpu::webgpuNewBuffer | ( | int | byteSize, |
| const std::string & | usage | ||
| ) |
在文件 WebGpuGpgpu.cpp 第 141 行定义.
被这些函数引用 eve::gpgpu::Gpgpu::newBuffer() , 以及 webgpuDispatch().
◆ webgpuNewShaderFromSpirv()
| WebGpuComputeShader * eve::gpgpu::webgpuNewShaderFromSpirv | ( | const std::vector< uint32_t > & | spv | ) |
在文件 WebGpuGpgpu.cpp 第 135 行定义.
◆ webgpuNewShaderFromWgsl()
| WebGpuComputeShader * eve::gpgpu::webgpuNewShaderFromWgsl | ( | const std::string & | wgsl | ) |