mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 06:27:54 +00:00
spirv backend: do not generate a load for ignored expressions
Fixes spirv-val failing on loads of dynamic arrays. Bug: chromium:1249602 Change-Id: Ic15af9f9ef2beb45bc732e4e45f023651544a1c7 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64400 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
d1d99bc7de
commit
dad26395d8
@@ -2322,7 +2322,8 @@ uint32_t Builder::GenerateIntrinsic(ast::CallExpression* call,
|
||||
|
||||
// Generates the SPIR-V ID for the expression for the indexed call parameter,
|
||||
// and loads it if necessary. Returns 0 on error.
|
||||
auto get_param_as_value_id = [&](size_t i) -> uint32_t {
|
||||
auto get_param_as_value_id = [&](size_t i,
|
||||
bool generate_load = true) -> uint32_t {
|
||||
auto* arg = call->params()[i];
|
||||
auto* param = intrinsic->Parameters()[i];
|
||||
auto val_id = GenerateExpression(arg);
|
||||
@@ -2330,7 +2331,7 @@ uint32_t Builder::GenerateIntrinsic(ast::CallExpression* call,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!param->Type()->Is<sem::Pointer>()) {
|
||||
if (generate_load && !param->Type()->Is<sem::Pointer>()) {
|
||||
val_id = GenerateLoadIfNeeded(TypeOf(arg), val_id);
|
||||
}
|
||||
return val_id;
|
||||
@@ -2427,7 +2428,7 @@ uint32_t Builder::GenerateIntrinsic(ast::CallExpression* call,
|
||||
// Evaluate the single argument, return the non-zero result_id which isn't
|
||||
// associated with any op (ignore returns void, so this cannot be used in
|
||||
// an expression).
|
||||
if (!get_param_as_value_id(0)) {
|
||||
if (!get_param_as_value_id(0, false)) {
|
||||
return 0;
|
||||
}
|
||||
return result_id;
|
||||
|
||||
Reference in New Issue
Block a user