mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
implementing webgpu pipeline, fixing vulkan compute pass
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CHECK_PULSE_HANDLE_RETVAL(handle, retval) \
|
||||
if(handle == PULSE_NULL_HANDLE) \
|
||||
@@ -23,6 +24,15 @@ void DebugCallBack(PulseDebugMessageSeverity severity, const char* message)
|
||||
printf("Pulse: %s\n", message);
|
||||
}
|
||||
|
||||
#define WGSL_SOURCE(...) #__VA_ARGS__
|
||||
|
||||
const char* wgsl_source = WGSL_SOURCE(
|
||||
@compute @workgroup_size(32, 32, 1)
|
||||
fn main(@builtin(global_invocation_id) grid: vec3u)
|
||||
{
|
||||
}
|
||||
);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_WEBGPU, PULSE_SHADER_FORMAT_WGSL_BIT, PULSE_HIGH_DEBUG);
|
||||
@@ -31,6 +41,17 @@ int main(void)
|
||||
PulseDevice device = PulseCreateDevice(backend, NULL, 0);
|
||||
CHECK_PULSE_HANDLE_RETVAL(device, 1);
|
||||
|
||||
PulseComputePipelineCreateInfo info = { 0 };
|
||||
info.code_size = strlen(wgsl_source);
|
||||
info.code = (const uint8_t*)wgsl_source;
|
||||
info.entrypoint = "main";
|
||||
info.format = PULSE_SHADER_FORMAT_WGSL_BIT;
|
||||
|
||||
PulseComputePipeline pipeline = PulseCreateComputePipeline(device, &info);
|
||||
CHECK_PULSE_HANDLE_RETVAL(pipeline, 1);
|
||||
|
||||
PulseDestroyComputePipeline(device, pipeline);
|
||||
|
||||
PulseDestroyDevice(device);
|
||||
PulseUnloadBackend(backend);
|
||||
puts("Successfully executed Pulse example using WebGPU !");
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
@compute @workgroup_size(32, 32, 1)
|
||||
fn main(@builtin(global_invocation_id) grid: vec3u)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user