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 <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Brandon Jones 2019-02-27 09:25:26 +00:00 committed by Commit Bot service account
parent b2c5023c9c
commit 9c061c3437
1 changed files with 12 additions and 0 deletions

View File

@ -39,6 +39,10 @@ namespace dawn_native {
}
void ProgrammablePassEncoder::InsertDebugMarker(const char* groupLabel) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
return;
}
InsertDebugMarkerCmd* cmd =
mAllocator->Allocate<InsertDebugMarkerCmd>(Command::InsertDebugMarker);
new (cmd) InsertDebugMarkerCmd;
@ -49,11 +53,19 @@ namespace dawn_native {
}
void ProgrammablePassEncoder::PopDebugGroup() {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
return;
}
PopDebugGroupCmd* cmd = mAllocator->Allocate<PopDebugGroupCmd>(Command::PopDebugGroup);
new (cmd) PopDebugGroupCmd;
}
void ProgrammablePassEncoder::PushDebugGroup(const char* groupLabel) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
return;
}
PushDebugGroupCmd* cmd = mAllocator->Allocate<PushDebugGroupCmd>(Command::PushDebugGroup);
new (cmd) PushDebugGroupCmd;
cmd->length = strlen(groupLabel);