Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial proposal for webgpu.h #1

Merged
merged 15 commits into from
Aug 23, 2019
Prev Previous commit
Next Next commit
Removed the proc table
  • Loading branch information
Kangz committed Jul 22, 2019
commit 113792fa9477701f218dedcb4713d160deab1048
82 changes: 4 additions & 78 deletions webgpu.h
Original file line number Diff line number Diff line change
@@ -697,84 +697,7 @@ typedef WGPUTextureView (*WGPUProcTextureCreateView)(WGPUTexture texture, WGPUTe
typedef void (*WGPUProcTextureDestroy)(WGPUTexture texture);


struct WGPUProcTable_s {
WGPUProcReference reference;
WGPUProcRelease release;

WGPUProcBufferUnmap bufferUnmap;
WGPUProcBufferDestroy bufferDestroy;
WGPUProcBufferMapReadAsync bufferMapReadAsync;
WGPUProcBufferMapWriteAsync bufferMapWriteAsync;

WGPUProcCommandEncoderFinish commandEncoderFinish;
WGPUProcCommandEncoderBeginComputePass commandEncoderBeginComputePass;
WGPUProcCommandEncoderBeginRenderPass commandEncoderBeginRenderPass;
WGPUProcCommandEncoderCopyBufferToBuffer commandEncoderCopyBufferToBuffer;
WGPUProcCommandEncoderCopyBufferToTexture commandEncoderCopyBufferToTexture;
WGPUProcCommandEncoderCopyTextureToBuffer commandEncoderCopyTextureToBuffer;
WGPUProcCommandEncoderCopyTextureToTexture commandEncoderCopyTextureToTexture;
WGPUProcCommandEncoderInsertDebugMarker commandEncoderInsertDebugMarker;
WGPUProcCommandEncoderPopDebugGroup commandEncoderPopDebugGroup;
WGPUProcCommandEncoderPushDebugGroup commandEncoderPushDebugGroup;

WGPUProcComputePassEncoderInsertDebugMarker computePassEncoderInsertDebugMarker;
WGPUProcComputePassEncoderPopDebugGroup computePassEncoderPopDebugGroup;
WGPUProcComputePassEncoderPushDebugGroup computePassEncoderPushDebugGroup;
WGPUProcComputePassEncoderSetPipeline computePassEncoderSetPipeline;
WGPUProcComputePassEncoderSetBindGroup computePassEncoderSetBindGroup;
WGPUProcComputePassEncoderDispatch computePassEncoderDispatch;
WGPUProcComputePassEncoderDispatchIndirect computePassEncoderDispatchIndirect;
WGPUProcComputePassEncoderEndPass computePassEncoderEndPass;

WGPUProcDeviceCreateBindGroup deviceCreateBindGroup;
WGPUProcDeviceCreateBindGroupLayout deviceCreateBindGroupLayout;
WGPUProcDeviceCreateBuffer deviceCreateBuffer;
WGPUProcDeviceCreateBufferMapped deviceCreateBufferMapped;
WGPUProcDeviceCreateCommandEncoder deviceCreateCommandEncoder;
WGPUProcDeviceCreateComputePipeline deviceCreateComputePipeline;
WGPUProcDeviceCreateRenderPipeline deviceCreateRenderPipeline;
WGPUProcDeviceCreatePipelineLayout deviceCreatePipelineLayout;
WGPUProcDeviceCreateQueue deviceCreateQueue;
WGPUProcDeviceCreateSampler deviceCreateSampler;
WGPUProcDeviceCreateShaderModule deviceCreateShaderModule;
WGPUProcDeviceCreateTexture deviceCreateTexture;
WGPUProcDeviceCreateBufferMappedAsync deviceCreateBufferMappedAsync;

WGPUProcFenceGetCompletedValue fenceGetCompletedValue;
WGPUProcFenceOnCompletion fenceOnCompletion;

WGPUProcQueueSubmit queueSubmit;
WGPUProcQueueSignal queueSignal;
WGPUProcQueueCreateFence queueCreateFence;

WGPUProcRenderPassEncoderSetPipeline renderPassEncoderSetPipeline;
WGPUProcRenderPassEncoderSetBindGroup renderPassEncoderSetBindGroup;
WGPUProcRenderPassEncoderDraw renderPassEncoderDraw;
WGPUProcRenderPassEncoderDrawIndexed renderPassEncoderDrawIndexed;
WGPUProcRenderPassEncoderDrawIndirect renderPassEncoderDrawIndirect;
WGPUProcRenderPassEncoderDrawIndexedIndirect renderPassEncoderDrawIndexedIndirect;
WGPUProcRenderPassEncoderInsertDebugMarker renderPassEncoderInsertDebugMarker;
WGPUProcRenderPassEncoderPopDebugGroup renderPassEncoderPopDebugGroup;
WGPUProcRenderPassEncoderPushDebugGroup renderPassEncoderPushDebugGroup;
WGPUProcRenderPassEncoderSetStencilReference renderPassEncoderSetStencilReference;
WGPUProcRenderPassEncoderSetBlendColor renderPassEncoderSetBlendColor;
WGPUProcRenderPassEncoderSetViewport renderPassEncoderSetViewport;
WGPUProcRenderPassEncoderSetScissorRect renderPassEncoderSetScissorRect;
WGPUProcRenderPassEncoderSetVertexBuffers renderPassEncoderSetVertexBuffers;
WGPUProcRenderPassEncoderSetIndexBuffer renderPassEncoderSetIndexBuffer;
WGPUProcRenderPassEncoderEndPass renderPassEncoderEndPass;

WGPUProcTextureCreateDefaultView textureCreateDefaultView;
WGPUProcTextureCreateView textureCreateView;
WGPUProcTextureDestroy textureDestroy;

};
typedef struct WGPUProcTable_s WGPUProcTable;

// Stuff below is for convenience and will forward calls to a static WGPUProcTable.

// Set which WGPUProcTable will be used
WGPU_EXPORT void wgpuSetProcs(const WGPUProcTable* procs);
#if !defined(WGPU_SKIP_DECLARATIONS)

WGPU_EXPORT void wgpuReference(WGPUObject object);
WGPU_EXPORT void wgpuRelease(WGPUObject object);
@@ -854,6 +777,9 @@ WGPU_EXPORT WGPUTextureView wgpuTextureCreateDefaultView(WGPUTexture texture);
WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor);
WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture);

Kangz marked this conversation as resolved.
Show resolved Hide resolved

#endif // !defined(WGPU_SKIP_DECLARATIONS)

#ifdef __cplusplus
} // extern "C"
#endif