-
Notifications
You must be signed in to change notification settings - Fork 338
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
webgpu continued #946
webgpu continued #946
Conversation
bbe4678
to
5ccafd6
Compare
edb3884
to
5b9583e
Compare
: device_(d), async_(kj::refcounted<AsyncRunner>(d)) { | ||
device_.SetLoggingCallback( | ||
[](WGPULoggingType type, char const *message, void *userdata) { | ||
KJ_LOG(INFO, "WebGPU logging", kj::str(type), message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of the KJ_LOG
statements? We do not generate INFO
logs in production so if these are meant to be seen in production they need to use KJ_LOG(WARNING, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purely for debugging purposes when someone is using --verbose
. I don't yet have a place to send these.
Would it be possible/advisable to simulate console.log()
s so that the script author could see these?
2308d3a
to
278841b
Compare
Implemented more webgpu methods and objects.
Ensure `lost` promise is fulfilled when the callback is triggered or the device is destroyed.
Correctly handle case where there are issues finding a GPU.
If we store a local reference to the detach key it can happen that at detach time it won't match the key stored on the arraybuffer, therefore failing the detach operation.
Any additional comments @jasnell ? |
? buffer_.GetMappedRange(o, s) | ||
: const_cast<void *>(buffer_.GetConstMappedRange(o, s)); | ||
: const_cast<void*>(buffer_.GetConstMappedRange(o, s)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected behavior here if offset
and size
are outside the allocated range? Will this return nullptr? For instance, if the range is only 10
and I specify an offset of 5
and a size
of 10
, will this return nullptr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, ptr
will be nullptr and JSG_REQUIRE will bail out.
Use a kj::Array instead of a std::vector.
} | ||
|
||
kj::Maybe<GPUFeatureName> getFeatureName(wgpu::FeatureName& feature) { | ||
switch (feature) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might consider implementing KJ_STRINGIFY
for these enum structures. The implementation would be largely the same but it would allow you to do kj::str(feature)
, rather than kj::str(getFeatureName(feature))
, etc. Search the code base for examples of where KJ_STRINGIFY
has been implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't use KJ_STRINGIFY
because in this case I want to return an optional value. We may receive unknown features and I don't want to blow up but just ignore those features. KJ_STRINGIFY
AFAICT, forces me to return some string.
Remove unique_ptr usage with V8Refs.
Implemented more webgpu methods and objects.