Return an error ComputePassEncoder when error occurs in BeginComputePass

This patch is a follow-up of the descriptorization of render pass
descriptor. In this patch we changes the return value of
BeginComputePass from nullptr to an error compute pass encoder when
there is any error in BeginComputePass() to keep it consistent with what
we do in BeginRenderPass().

This patch also provides functions to create error render/compute pass
encoders. With this patch we can create a pass encoder in error by
specifying ErrorTag in the constructor, which is more staightforward
and human readable than the current implementation.

BUG=dawn:6

Change-Id: I1899ae65804f8cecd3079dc313e7e18acb88e37c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5140
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao
2019-03-05 01:02:47 +00:00
committed by Commit Bot service account
parent d6eb2e7501
commit b47470daa7
8 changed files with 81 additions and 7 deletions

View File

@@ -27,6 +27,17 @@ namespace dawn_native {
: ProgrammablePassEncoder(device, topLevelEncoder, allocator) {
}
ComputePassEncoderBase::ComputePassEncoderBase(DeviceBase* device,
CommandEncoderBase* topLevelEncoder,
ErrorTag errorTag)
: ProgrammablePassEncoder(device, topLevelEncoder, errorTag) {
}
ComputePassEncoderBase* ComputePassEncoderBase::MakeError(DeviceBase* device,
CommandEncoderBase* topLevelEncoder) {
return new ComputePassEncoderBase(device, topLevelEncoder, ObjectBase::kError);
}
void ComputePassEncoderBase::Dispatch(uint32_t x, uint32_t y, uint32_t z) {
if (mTopLevelEncoder->ConsumedError(ValidateCanRecordCommands())) {
return;