ir: Use std::optional::value_or to simplify code
Change-Id: Iaf3ec58a70cd49c508c3279f62c029440b82c599 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131520 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
f789854a94
commit
29bff642fc
|
@ -226,19 +226,11 @@ void BuilderImpl::EmitFunction(const ast::Function* ast_func) {
|
||||||
ir_func->pipeline_stage = Function::PipelineStage::kCompute;
|
ir_func->pipeline_stage = Function::PipelineStage::kCompute;
|
||||||
|
|
||||||
auto wg_size = sem->WorkgroupSize();
|
auto wg_size = sem->WorkgroupSize();
|
||||||
|
ir_func->workgroup_size = {
|
||||||
uint32_t x = wg_size[0].value();
|
wg_size[0].value(),
|
||||||
uint32_t y = 1;
|
wg_size[1].value_or(1),
|
||||||
uint32_t z = 1;
|
wg_size[2].value_or(1),
|
||||||
if (wg_size[1].has_value()) {
|
};
|
||||||
y = wg_size[1].value();
|
|
||||||
|
|
||||||
if (wg_size[2].has_value()) {
|
|
||||||
z = wg_size[2].value();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ir_func->workgroup_size = {x, y, z};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
Loading…
Reference in New Issue