[tint][hlsl] Extract ternary value to let if necessary In the HLSL backend, WGSL selects are lowered to ternary operators (using HLSL 2018), which should match the non-short-circuiting semantics of select. However, in the case that the condition is a constant bool value, a buggy optimization in DXC may constant fold away the ternary operator, resulting in one side of the select not being evaluated. This causes incorrect behavior if the un-selected value would have had side effects. To prevent this bad optimization from being hit, we extract the potentially affected argument to a let variables to force its evaluation to occur. Bug: 478792488 Change-Id: I227cb92e175e5659ddb30b662dd8273cc0e92c9d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/287359 Reviewed-by: dan sinclair <dsinclair@chromium.org> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Natalie Chouinard <chouinard@google.com>
Dawn is an open-source and cross-platform implementation of the WebGPU standard. More precisely it implements webgpu.h that is a one-to-one mapping with the WebGPU IDL. Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium.
Dawn provides several WebGPU building blocks:
webgpu.h version that Dawn implements.webgpu.h.Helpful links:
Developer documentation:
User documentation: (TODO, figure out what overlaps with the webgpu.h docs)
BSD 3-Clause License, please see LICENSE.
This is not an officially supported Google product.