mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-09 14:53:33 +00:00
master
PulseGPU
Pulse is a kind of low level GPGPU library with mid-tier control over the hardware. It is built on top of Vulkan/WebGPU/OpenGL/OpenGL ES. A Metal and D3D11 backends are in development.
Unit tests map:
| Linux | Windows | Msys2 (MinGW64) | macOS | |
|---|---|---|---|---|
| Vulkan | ||||
| WebGPU | ||||
| OpenGL | ||||
| OpenGL ES | ||||
| D3D11 | ||||
| Metal | ||||
| Software |
#include <Pulse.h>
int main(void)
{
PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_VULKAN, PULSE_SHADER_FORMAT_SPIRV_BIT, PULSE_NO_DEBUG);
PulseDevice device = PulseCreateDevice(backend, NULL, 0);
const uint8_t shader_bytecode[] = {
#include "shader.spv.h"
};
PulseComputePipelineCreateInfo info = { 0 };
info.code_size = sizeof(shader_bytecode);
info.code = shader_bytecode;
info.entrypoint = "main";
info.format = PULSE_SHADER_FORMAT_SPIRV_BIT;
info.num_readwrite_storage_buffers = 1;
PulseComputePipeline pipeline = PulseCreateComputePipeline(device, &info);
PulseBufferCreateInfo buffer_create_info = { 0 };
buffer_create_info.size = 1024;
buffer_create_info.usage = PULSE_BUFFER_USAGE_STORAGE_WRITE;
PulseBuffer buffer = PulseCreateBuffer(device, &buffer_create_info);
PulseFence fence = PulseCreateFence(device);
PulseCommandList cmd = PulseRequestCommandList(device, PULSE_COMMAND_LIST_GENERAL);
PulseComputePass pass = PulseBeginComputePass(cmd);
PulseBindStorageBuffers(pass, &buffer, 1);
PulseBindComputePipeline(pass, pipeline);
PulseDispatchComputations(pass, 32, 32, 1);
PulseEndComputePass(pass);
PulseSubmitCommandList(device, cmd, fence);
PulseWaitForFences(device, &fence, 1, true);
PulseReleaseCommandList(device, cmd);
PulseDestroyFence(device, fence);
PulseDestroyComputePipeline(device, pipeline);
PulseDestroyBuffer(device, buffer);
PulseDestroyDevice(device);
PulseUnloadBackend(backend);
return 0;
}
Description
A GPGPU library built on top of Vulkan, WebGPU, OpenGL (Core/ES) (Metal and D3D11 to come).
Languages
C
91.1%
Lua
2.9%
Objective-C
2.8%
C++
1.8%
Python
0.9%
Other
0.5%