mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
yes
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define WGSL_SOURCE(...) #__VA_ARGS__
|
||||||
#define CHECK_PULSE_HANDLE_RETVAL(handle, retval) \
|
#define CHECK_PULSE_HANDLE_RETVAL(handle, retval) \
|
||||||
if(handle == PULSE_NULL_HANDLE) \
|
if(handle == PULSE_NULL_HANDLE) \
|
||||||
{ \
|
{ \
|
||||||
@@ -24,8 +25,6 @@ void DebugCallBack(PulseDebugMessageSeverity severity, const char* message)
|
|||||||
printf("Pulse: %s\n", message);
|
printf("Pulse: %s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WGSL_SOURCE(...) #__VA_ARGS__
|
|
||||||
|
|
||||||
const char* wgsl_source = WGSL_SOURCE(
|
const char* wgsl_source = WGSL_SOURCE(
|
||||||
@compute @workgroup_size(32, 32, 1)
|
@compute @workgroup_size(32, 32, 1)
|
||||||
fn main(@builtin(global_invocation_id) grid: vec3u)
|
fn main(@builtin(global_invocation_id) grid: vec3u)
|
||||||
@@ -50,6 +49,17 @@ int main(void)
|
|||||||
PulseComputePipeline pipeline = PulseCreateComputePipeline(device, &info);
|
PulseComputePipeline pipeline = PulseCreateComputePipeline(device, &info);
|
||||||
CHECK_PULSE_HANDLE_RETVAL(pipeline, 1);
|
CHECK_PULSE_HANDLE_RETVAL(pipeline, 1);
|
||||||
|
|
||||||
|
PulseCommandList cmd = PulseRequestCommandList(device, PULSE_COMMAND_LIST_GENERAL);
|
||||||
|
CHECK_PULSE_HANDLE_RETVAL(cmd, 1);
|
||||||
|
|
||||||
|
PulseComputePass pass = PulseBeginComputePass(cmd);
|
||||||
|
CHECK_PULSE_HANDLE_RETVAL(pass, 1);
|
||||||
|
PulseBindComputePipeline(pass, pipeline);
|
||||||
|
PulseDispatchComputations(pass, 32, 32, 1);
|
||||||
|
PulseEndComputePass(pass);
|
||||||
|
|
||||||
|
PulseReleaseCommandList(device, cmd);
|
||||||
|
|
||||||
PulseDestroyComputePipeline(device, pipeline);
|
PulseDestroyComputePipeline(device, pipeline);
|
||||||
|
|
||||||
PulseDestroyDevice(device);
|
PulseDestroyDevice(device);
|
||||||
|
|||||||
@@ -57,9 +57,12 @@ void WebGPUReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
|||||||
PULSE_CHECK_HANDLE(device);
|
PULSE_CHECK_HANDLE(device);
|
||||||
|
|
||||||
WebGPUCommandList* webgpu_cmd = WEBGPU_RETRIEVE_DRIVER_DATA_AS(cmd, WebGPUCommandList*);
|
WebGPUCommandList* webgpu_cmd = WEBGPU_RETRIEVE_DRIVER_DATA_AS(cmd, WebGPUCommandList*);
|
||||||
|
WebGPUComputePass* webgpu_pass = WEBGPU_RETRIEVE_DRIVER_DATA_AS(cmd->pass, WebGPUComputePass*);
|
||||||
|
|
||||||
wgpuCommandEncoderRelease(webgpu_cmd->encoder);
|
wgpuCommandEncoderRelease(webgpu_cmd->encoder);
|
||||||
|
|
||||||
|
free(webgpu_pass);
|
||||||
|
free(cmd->pass);
|
||||||
free(webgpu_cmd);
|
free(webgpu_cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ void WebGPUEndComputePass(PulseComputePass pass)
|
|||||||
{
|
{
|
||||||
WebGPUComputePass* webgpu_pass = WEBGPU_RETRIEVE_DRIVER_DATA_AS(pass, WebGPUComputePass*);
|
WebGPUComputePass* webgpu_pass = WEBGPU_RETRIEVE_DRIVER_DATA_AS(pass, WebGPUComputePass*);
|
||||||
wgpuComputePassEncoderEnd(webgpu_pass->encoder);
|
wgpuComputePassEncoderEnd(webgpu_pass->encoder);
|
||||||
|
wgpuComputePassEncoderRelease(webgpu_pass->encoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebGPUBindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers)
|
void WebGPUBindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers)
|
||||||
|
|||||||
Reference in New Issue
Block a user