载入中...
搜索中...
未找到
Gpgpu.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Module.h"
4
5#include <string>
6
7namespace eve::gpgpu {
8
9class ComputeShader;
10class GpuBuffer;
11class Sequence;
12
20class Gpgpu : public Module {
21public:
23 Gpgpu() = default;
24 ~Gpgpu() override = default;
25
27 bool isAvailable() const;
28
30 ComputeShader *newShader(const std::string &source);
31
33 ComputeShader *newShaderFromBytecode(const std::string &path);
34
36 ComputeShader *newShaderFromSpvFile(const std::string &path);
37
42 GpuBuffer *newBuffer(int byteSize, const std::string &usage = "storage");
43
49
54 void dispatch(ComputeShader *shader, int groupsX, int groupsY = 1, int groupsZ = 1);
55};
56
57} // namespace eve::gpgpu
Shader * shader
Backend-agnostic compute program. Bind storage buffers then dispatch via Gpgpu::dispatch....
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
~Gpgpu() override=default
Backend-agnostic GPU buffer for compute (storage) or CPU staging transfers. Squirrel-owned; derived c...
Definition GpuBuffer.h:16