RenderBundleEncoder parameter missing from wgpu_render_bundle_encoder_finish
alienself opened this issue · comments
Hi,
I am currently implementing a feature that requires a render bundle encoder however it seems like some functions are not implemented yet for it?
For instance the wgpu_render_bundle_encoder_finish
only takes a descriptor as parameter instead of the usual handle + descriptor.
Emscripten implementation:
typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderBundleDescriptor const * descriptor /* nullable */);
While wasm_webgpu is currently like this:
void wgpu_render_bundle_encoder_finish(const WGpuRenderBundleDescriptor *renderBundleDescriptor);
Therefore the render bundle encoder cannot currently be finished.
Ops, looks like something got confused in a recent refactor over the mixin chain.
I'll take a closer look tomorrow. If you run wgpu_command_encoder_finish(myRenderBundleEncoder);
, does that work?
Ok, updated now in above commit to include the missing function wgpu_render_bundle_encoder_finish()
. Notes:
- The implementation of
wgpu_command_encoder_finish()
andwgpu_render_bundle_encoder_finish()
would be identical, so to save code size, there aren't two separate functions that are generated, but calling either will route out to JS to the same functionwgpu_encoder_finish()
that finishes either encoder. - To save code size, I originally took the approach that name labels are never added to objects on creation, but instead the labels should be set afterwards by calling
wgpu_object_set_label()
. This avoids bloating every single create function in the API from needing to independently marshal the label strings. - Currently in the spec,
WGpuRenderBundleDescriptor
andWGpuCommandBufferDescriptor
are both empty objects, except for that abovementioned label. So because this bindings lib does not support setting the label at creation, these descriptors have no fields. So as result, the APIswgpu_command_encoder_finish()
andwgpu_render_bundle_encoder_finish()
do not take in any descriptor pointers, but just the encoder object to finish.
Let me know if you run into any issues with the above commit, and thanks again for the report!
Hey again, I finally got time to use this function.
Thanks for adding the API, however wgpu_render_bundle_encoder_finish
does not take any reference of the bundle encoder :(
I am missing something?
WGpuRenderBundleDescriptor desc;
// desc.?? no way to set reference to encoder handle
wgpu_render_bundle_encoder_finish(&desc);
Could you reopen the issue?
Looking at the IDL, there still aren't any fields that would exist for that descriptor, except to be able to add a label field for debugging, so it was omitted.
I.e. the IDL reads
dictionary GPUObjectDescriptorBase {
USVString label;
};
dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
};
interface GPURenderBundleEncoder {
GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
};
dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
};
interface GPUCommandEncoder {
GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {});
};
Are you looking to be able to set the label
for these finish events?