From 9c061c3437d0be2d94ce4430497edf36dfb8b74c Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Wed, 27 Feb 2019 09:25:26 +0000 Subject: [PATCH] Add ValidateCanRecordCommands to Debug Marker APIs Add ValidateCanRecordCommands to debug marker calls in ProgrammablePassEncoder. Fixes issue found by ClusterFuzz. Bug=chromium:935902 Bug=dawn:44 Change-Id: If1a4890a9de49a1872711a7b1a875ddc13130e88 Reviewed-on: https://dawn-review.googlesource.com/c/5080 Commit-Queue: Corentin Wallez Reviewed-by: Kai Ninomiya Reviewed-by: Corentin Wallez --- src/dawn_native/ProgrammablePassEncoder.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/dawn_native/ProgrammablePassEncoder.cpp b/src/dawn_native/ProgrammablePassEncoder.cpp index 7a16f31098..143144b332 100644 --- a/src/dawn_native/ProgrammablePassEncoder.cpp +++ b/src/dawn_native/ProgrammablePassEncoder.cpp @@ -39,6 +39,10 @@ namespace dawn_native { } void ProgrammablePassEncoder::InsertDebugMarker(const char* groupLabel) { + if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) { + return; + } + InsertDebugMarkerCmd* cmd = mAllocator->Allocate(Command::InsertDebugMarker); new (cmd) InsertDebugMarkerCmd; @@ -49,11 +53,19 @@ namespace dawn_native { } void ProgrammablePassEncoder::PopDebugGroup() { + if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) { + return; + } + PopDebugGroupCmd* cmd = mAllocator->Allocate(Command::PopDebugGroup); new (cmd) PopDebugGroupCmd; } void ProgrammablePassEncoder::PushDebugGroup(const char* groupLabel) { + if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) { + return; + } + PushDebugGroupCmd* cmd = mAllocator->Allocate(Command::PushDebugGroup); new (cmd) PushDebugGroupCmd; cmd->length = strlen(groupLabel);