working on WebGPU support

This commit is contained in:
2025-02-23 17:12:27 +01:00
parent 3a598ab887
commit 443eb6b810
34 changed files with 859 additions and 74 deletions

38
Examples/WebGPU/main.c git.filemode.normal_file
View File

@@ -0,0 +1,38 @@
#include <Pulse.h>
#include <stdio.h>
#include <stdlib.h>
#define CHECK_PULSE_HANDLE_RETVAL(handle, retval) \
if(handle == PULSE_NULL_HANDLE) \
{ \
fprintf(stderr, "Error: '" #handle "' %s\n", PulseVerbaliseErrorType(PulseGetLastErrorType())); \
return retval; \
} \
void DebugCallBack(PulseDebugMessageSeverity severity, const char* message)
{
if(severity == PULSE_DEBUG_MESSAGE_SEVERITY_ERROR)
{
fprintf(stderr, "Pulse Error: %s\n", message);
exit(1);
}
else if(severity == PULSE_DEBUG_MESSAGE_SEVERITY_WARNING)
fprintf(stderr, "Pulse Warning: %s\n", message);
else
printf("Pulse: %s\n", message);
}
int main(void)
{
PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_WEBGPU, PULSE_SHADER_FORMAT_SPIRV_BIT, PULSE_HIGH_DEBUG);
CHECK_PULSE_HANDLE_RETVAL(backend, 1);
PulseSetDebugCallback(backend, DebugCallBack);
PulseDevice device = PulseCreateDevice(backend, NULL, 0);
CHECK_PULSE_HANDLE_RETVAL(device, 1);
PulseDestroyDevice(device);
PulseUnloadBackend(backend);
puts("Successfully executed Pulse example using WebGPU !");
return 0;
}