-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix for gh issue: 21031, use proper size for WGPUTextureFormat #21034
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -912,7 +912,7 @@ var LibraryWebGPU = { | |||
var viewFormatCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureDescriptor.viewFormatCount) }}}; | ||||
if (viewFormatCount) { | ||||
var viewFormatsPtr = {{{ makeGetValue('descriptor', C_STRUCTS.WGPUTextureDescriptor.viewFormats, '*') }}}; | ||||
desc["viewFormats"] = Array.from({{{ makeHEAPView(`${POINTER_BITS}`, 'viewFormatsPtr', `viewFormatsPtr + viewFormatCount * ${POINTER_SIZE}`) }}}, | ||||
desc["viewFormats"] = Array.from({{{ makeHEAPView(`32`, 'viewFormatsPtr', `viewFormatsPtr + viewFormatCount * 4`) }}}, | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a comment along the lines of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re: testing, I think we could patch a test into this existing test: emscripten/test/webgpu_basic_rendering.cpp Line 308 in 4765f9c
wgpu::TextureDescriptor descriptor{};
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
descriptor.size = {1, 1, 1};
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
+ // Test for viewFormats binding
+ std::array<wgpu::TextureFormat, 2> viewFormats =
+ { wgpu::TextureFormat::BGRA8Unorm, wgpu::TextureFormat::BGRA8Unorm };
+ descriptor.viewFormatCount = viewFormats.size();
+ descriptor.viewFormats = viewFormats.data();
readbackTexture = device.CreateTexture(&descriptor); or something like that. The resulting JS call will be:
Unfortunately it wouldn't be quite so easy to test the requiredFeatures one. |
||||
function(format) { return WebGPU.TextureFormat[format]; }); | ||||
} | ||||
|
||||
|
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.
Nice find, thank you! Glad to find that these bindings work in wasm64 at all :)
We have the same problem in
emscripten/src/library_webgpu.js
Line 2501 in 4765f9c