Fix stack-use-after-scope for usedInterstageVariables pointer

Bug: chromium:1393728
Change-Id: I078f898b9a6a237c81c15bb86736eb790cf6a261
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112260
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
shrekshao 2022-11-29 22:00:13 +00:00 committed by Dawn LUCI CQ
parent 2c4423383a
commit 67d52eb4f2
1 changed files with 3 additions and 2 deletions

View File

@ -358,11 +358,12 @@ MaybeError RenderPipeline::Initialize() {
PerStage<CompiledShader> compiledShader;
std::bitset<kMaxInterStageShaderVariables>* usedInterstageVariables = nullptr;
dawn::native::EntryPointMetadata fragmentEntryPoint;
if (GetStageMask() & wgpu::ShaderStage::Fragment) {
// Now that only fragment shader can have interstage inputs.
const ProgrammableStage& programmableStage = GetStage(SingleShaderStage::Fragment);
auto entryPoint = programmableStage.module->GetEntryPoint(programmableStage.entryPoint);
usedInterstageVariables = &entryPoint.usedInterStageVariables;
fragmentEntryPoint = programmableStage.module->GetEntryPoint(programmableStage.entryPoint);
usedInterstageVariables = &fragmentEntryPoint.usedInterStageVariables;
}
for (auto stage : IterateStages(GetStageMask())) {