载入中...
搜索中...
未找到
Gpgpu.cpp
浏览该文件的文档.
Definition Exception.h:14
virtual std::string getName() const =0
Backend-agnostic compute program. Bind storage buffers then dispatch via Gpgpu::dispatch....
Definition ComputeShader.h:15
virtual void setFloat(int index, float value)=0
virtual GpuBuffer * getBoundBuffer(int binding) const =0
virtual void clearBindings()=0
virtual float getFloat(int index) const =0
virtual void bindBuffer(int binding, GpuBuffer *buffer)=0
Bind a storage buffer to set=0 binding. binding in [0, kMaxBindings).
GPGPU module — compute shaders + storage buffers via the active Graphics backend. Uses the graphics q...
Definition Gpgpu.h:20
ComputeShader * newShaderFromSpvFile(const std::string &path)
Vulkan SPIR-V compatibility wrapper → newShaderFromBytecode.
Definition Gpgpu.cpp:79
ComputeShader * newShader(const std::string &source)
Compile compute source for the active backend (Vulkan: GLSL via glslc).
Definition Gpgpu.cpp:48
bool isAvailable() const
True when the active Graphics backend can run compute (device initialized).
Definition Gpgpu.cpp:38
ComputeShader * newShaderFromBytecode(const std::string &path)
Load precompiled compute bytecode from Filesystem path (Vulkan: SPIR-V).
Definition Gpgpu.cpp:61
void dispatch(ComputeShader *shader, int groupsX, int groupsY=1, int groupsZ=1)
Record + submit a compute dispatch and wait for completion (sync). groups*: workgroup counts (not thr...
Definition Gpgpu.cpp:116
GpuBuffer * newBuffer(int byteSize, const std::string &usage="storage")
Allocate a GPU buffer. usage: "storage" (SSBO, device-local) | "staging" (host-visible transfer).
Definition Gpgpu.cpp:92
Sequence * newSequence()
Create a Kompute-style command Sequence: record buffer transfers and compute dispatches into one comm...
Definition Gpgpu.cpp:104
Backend-agnostic GPU buffer for compute (storage) or CPU staging transfers. Squirrel-owned; derived c...
Definition GpuBuffer.h:16
virtual void writeData(data::ByteData *data, int dstOffset=0)=0
virtual int getSize() const =0
virtual std::string getUsage() const =0
virtual void fillFloat32(float value)=0
virtual float readFloat32(int floatIndex)=0
virtual void writeFloat32(int floatIndex, float value)=0
virtual data::ByteData * readData(int srcOffset=0, int size=-1)=0
Definition Sequence.h:32
void recordUpload(GpuBuffer *dst, const void *src, uint64_t nbytes, uint64_t dstOffset=0)
Definition Sequence.cpp:66
void recordDownload(GpuBuffer *src, GpuBuffer *staging, uint64_t nbytes, uint64_t srcOffset=0)
Definition Sequence.cpp:71
void recordDispatch(ComputeShader *shader, int groupsX, int groupsY=1, int groupsZ=1)
Definition Sequence.cpp:76
GpuBuffer * getBuffer(int binding) const
Definition ShaderSystem.cpp:61
GpuBuffer * ensureBuffer(int binding, int floatCount)
Definition ShaderSystem.cpp:44
void setFloat(int index, float value)
Definition ShaderSystem.cpp:90
void setShaderSource(const std::string &glsl)
Definition ShaderSystem.cpp:23
void setLocalSize(int localSize)
Definition ShaderSystem.cpp:40
Definition ComputeShader.cpp:3
ComputeShader * vulkanNewShaderFromSpirv(const std::vector< uint32_t > &spv)
从 SPIR-V 字节码创建计算着色器。
Definition VulkanGpgpu.cpp:13
GpuBuffer * vulkanNewBuffer(int byteSize, const std::string &usage)
创建 GPU 存储/传输缓冲区;usage 为 "storage" | "vertex" 等。
Definition VulkanGpgpu.cpp:66
int 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...
Definition EcsScriptPack.cpp:121
void webgpuDispatch(ComputeShader *shader, int groupsX, int groupsY, int groupsZ)
Definition WebGpuGpgpu.cpp:208
int unpackScriptEntityFloats(ssq::Object entitiesObj, const std::string &slot, ssq::Object fieldsObj, GpuBuffer *buf, int entityCount)
Inverse of packScriptEntityFloats; entityCount should match pack result.
Definition EcsScriptPack.cpp:186
std::vector< uint32_t > loadSpirvFile(const std::string &path)
Definition VulkanUtil.cpp:75
WebGpuGpuBuffer * webgpuNewBuffer(int byteSize, const std::string &usage)
Definition WebGpuGpgpu.cpp:141
std::vector< uint32_t > compileComputeGlsl(const std::string &glsl)
Definition VulkanUtil.cpp:163
void vulkanDispatch(ComputeShader *shader, int groupsX, int groupsY, int groupsZ)
派发计算着色器(groupsX/Y/Z 为线程组数)。
Definition VulkanGpgpu.cpp:98
WebGpuComputeShader * webgpuNewShaderFromWgsl(const std::string &wgsl)
Definition WebGpuGpgpu.cpp:77