载入中...
搜索中...
未找到
eve::gpgpu 命名空间参考

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 后端是否就绪(设备/队列可用)。
 
ComputeShadervulkanNewShaderFromSpirv (const std::vector< uint32_t > &spv)
 从 SPIR-V 字节码创建计算着色器。
 
GpuBuffervulkanNewBuffer (int byteSize, const std::string &usage)
 创建 GPU 存储/传输缓冲区;usage 为 "storage" | "vertex" 等。
 
void vulkanDispatch (ComputeShader *shader, int groupsX, int groupsY, int groupsZ)
 派发计算着色器(groupsX/Y/Z 为线程组数)。
 
VulkanSequencevulkanSequenceCreate ()
 
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::GraphicsrequireVulkanGraphics ()
 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 ()
 
WebGpuComputeShaderwebgpuNewShaderFromWgsl (const std::string &wgsl)
 
WebGpuComputeShaderwebgpuNewShaderFromSpirv (const std::vector< uint32_t > &spv)
 
WebGpuGpuBufferwebgpuNewBuffer (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)

在文件 VulkanUtil.cpp163 行定义.

引用了 f, n , 以及 status.

被这些函数引用 eve::gpgpu::Gpgpu::newShader().

◆ componentFloatCount()

template<typename Comp >
constexpr int eve::gpgpu::componentFloatCount ( )
constexpr

在文件 EcsGpu.h18 行定义.

◆ computeCommandPool()

◆ computeQueue()

◆ countViewEntities()

template<typename Base , typename Comp >
int eve::gpgpu::countViewEntities ( )

Count live entities matching View<Base, Comp>.

在文件 EcsGpu.h28 行定义.

引用了 n , 以及 view.

◆ loadSpirvFile()

std::vector< uint32_t > eve::gpgpu::loadSpirvFile ( const std::string &  path)

在文件 VulkanUtil.cpp75 行定义.

被这些函数引用 eve::gpgpu::Gpgpu::newShaderFromBytecode().

◆ 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.cpp121 行定义.

引用了 f, eve::gpgpu::GpuBuffer::getSize(), n, v, vm , 以及 eve::gpgpu::GpuBuffer::writeFloat32s().

◆ packViewComponent()

template<typename Base , typename Comp >
int eve::gpgpu::packViewComponent ( ShaderSystem sys,
int  binding 
)

Pack View<Base, Comp> into ShaderSystem binding as AoS floats. Returns entity count (0 if empty).

在文件 EcsGpu.h41 行定义.

引用了 n, eve::gpgpu::ShaderSystem::upload() , 以及 view.

◆ requireVulkanGraphics()

graphics::vulkan::Graphics * eve::gpgpu::requireVulkanGraphics ( )

Resolve live Vulkan Graphics (throws if missing / not initialized).

在文件 VulkanUtil.cpp38 行定义.

被这些函数引用 eve::gpgpu::VulkanGpuBuffer::downloadBytes(), eve::gpgpu::VulkanSequence::ensureReady(), eve::gpgpu::VulkanGpuBuffer::uploadBytes(), vulkanDispatch(), vulkanNewBuffer() , 以及 vulkanNewShaderFromSpirv().

◆ runViewComponentSystem()

template<typename Base , typename Comp >
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.

在文件 EcsGpu.h89 行定义.

引用了 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.cpp186 行定义.

引用了 f, n, eve::gpgpu::GpuBuffer::readFloat32s(), v , 以及 vm.

◆ unpackViewComponent()

template<typename Base , typename Comp >
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.

在文件 EcsGpu.h69 行定义.

引用了 eve::gpgpu::ShaderSystem::download() , 以及 view.

◆ vulkanDispatch()

void eve::gpgpu::vulkanDispatch ( ComputeShader shader,
int  groupsX,
int  groupsY,
int  groupsZ 
)

派发计算着色器(groupsX/Y/Z 为线程组数)。

在文件 VulkanGpgpu.cpp98 行定义.

引用了 computeCommandPool(), computeQueue(), device, eve::gpgpu::ComputeShader::kPushConstantBytes, requireVulkanGraphics() , 以及 shader.

被这些函数引用 eve::gpgpu::Gpgpu::dispatch() , 以及 eve::virtualgeometry::vgUpdate().

◆ vulkanGpgpuReady()

bool eve::gpgpu::vulkanGpgpuReady ( )

Vulkan 后端是否就绪(设备/队列可用)。

在文件 VulkanGpgpu.cpp11 行定义.

引用了 vulkanGraphicsReady().

被这些函数引用 eve::gpgpu::Gpgpu::isAvailable().

◆ vulkanGraphicsReady()

bool eve::gpgpu::vulkanGraphicsReady ( )

True if Vulkan Graphics device is ready.

在文件 VulkanUtil.cpp48 行定义.

被这些函数引用 vulkanGpgpuReady().

◆ vulkanNewBuffer()

GpuBuffer * eve::gpgpu::vulkanNewBuffer ( int  byteSize,
const std::string &  usage 
)

创建 GPU 存储/传输缓冲区;usage 为 "storage" | "vertex" 等。

在文件 VulkanGpgpu.cpp66 行定义.

引用了 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)

◆ vulkanSequenceBegin()

◆ vulkanSequenceCreate()

VulkanSequence * eve::gpgpu::vulkanSequenceCreate ( )

在文件 VulkanSequence.cpp31 行定义.

◆ vulkanSequenceDestroy()

void eve::gpgpu::vulkanSequenceDestroy ( VulkanSequence seq)

在文件 VulkanSequence.cpp78 行定义.

引用了 eve::gpgpu::VulkanSequence::destroy().

被这些函数引用 eve::gpgpu::Sequence::~Sequence().

◆ vulkanSequenceRecordDispatch()

◆ vulkanSequenceRecordDownload()

void eve::gpgpu::vulkanSequenceRecordDownload ( VulkanSequence seq,
GpuBuffer src,
GpuBuffer staging,
uint64_t  nbytes,
uint64_t  srcOffset 
)

◆ vulkanSequenceRecordUpload()

◆ vulkanSequenceSubmit()

◆ webgpuDispatch()

void eve::gpgpu::webgpuDispatch ( ComputeShader shader,
int  groupsX,
int  groupsY,
int  groupsZ 
)

◆ webgpuGpgpuReady()

bool eve::gpgpu::webgpuGpgpuReady ( )

在文件 WebGpuGpgpu.cpp39 行定义.

被这些函数引用 eve::gpgpu::Gpgpu::isAvailable().

◆ webgpuNewBuffer()

WebGpuGpuBuffer * eve::gpgpu::webgpuNewBuffer ( int  byteSize,
const std::string &  usage 
)

在文件 WebGpuGpgpu.cpp141 行定义.

引用了 b , 以及 device.

被这些函数引用 eve::gpgpu::Gpgpu::newBuffer() , 以及 webgpuDispatch().

◆ webgpuNewShaderFromSpirv()

WebGpuComputeShader * eve::gpgpu::webgpuNewShaderFromSpirv ( const std::vector< uint32_t > &  spv)

在文件 WebGpuGpgpu.cpp135 行定义.

◆ webgpuNewShaderFromWgsl()

WebGpuComputeShader * eve::gpgpu::webgpuNewShaderFromWgsl ( const std::string &  wgsl)