CommandEncoder: promote errors to device errors after finish()
BUG=dawn:138 Change-Id: Iddb1aab886558c706d0188adc21c7ee8f68533d4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6720 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
3826880f81
commit
ef90079944
|
@ -824,9 +824,13 @@ namespace dawn_native {
|
||||||
// Implementation of functions to interact with sub-encoders
|
// Implementation of functions to interact with sub-encoders
|
||||||
|
|
||||||
void CommandEncoderBase::HandleError(const char* message) {
|
void CommandEncoderBase::HandleError(const char* message) {
|
||||||
if (!mGotError) {
|
if (mEncodingState != EncodingState::Finished) {
|
||||||
mGotError = true;
|
if (!mGotError) {
|
||||||
mErrorMessage = message;
|
mGotError = true;
|
||||||
|
mErrorMessage = message;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GetDevice()->HandleError(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,8 +155,28 @@ TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that beginning a compute pass before ending the previous pass causes an error.
|
// Test that encoding command after a successful finish produces an error
|
||||||
|
TEST_F(CommandBufferValidationTest, CallsAfterASuccessfulFinish) {
|
||||||
|
// A buffer that can be used in CopyBufferToBuffer
|
||||||
|
dawn::BufferDescriptor copyBufferDesc;
|
||||||
|
copyBufferDesc.size = 16;
|
||||||
|
copyBufferDesc.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||||
|
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
|
||||||
|
|
||||||
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
encoder.Finish();
|
||||||
|
|
||||||
|
ASSERT_DEVICE_ERROR(encoder.CopyBufferToBuffer(copyBuffer, 0, copyBuffer, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that encoding command after a failed finish produces an error
|
||||||
TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) {
|
TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) {
|
||||||
|
// A buffer that can be used in CopyBufferToBuffer
|
||||||
|
dawn::BufferDescriptor copyBufferDesc;
|
||||||
|
copyBufferDesc.size = 16;
|
||||||
|
copyBufferDesc.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||||
|
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
|
||||||
|
|
||||||
// A buffer that can't be used in CopyBufferToBuffer
|
// A buffer that can't be used in CopyBufferToBuffer
|
||||||
dawn::BufferDescriptor bufferDesc;
|
dawn::BufferDescriptor bufferDesc;
|
||||||
bufferDesc.size = 16;
|
bufferDesc.size = 16;
|
||||||
|
@ -167,8 +187,7 @@ TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) {
|
||||||
encoder.CopyBufferToBuffer(buffer, 0, buffer, 0, 0);
|
encoder.CopyBufferToBuffer(buffer, 0, buffer, 0, 0);
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
|
|
||||||
// TODO(cwallez@chromium.org): Currently this does nothing, should it be a device error?
|
ASSERT_DEVICE_ERROR(encoder.CopyBufferToBuffer(copyBuffer, 0, copyBuffer, 0, 0));
|
||||||
encoder.CopyBufferToBuffer(buffer, 0, buffer, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that using a single buffer in multiple read usages in the same pass is allowed.
|
// Test that using a single buffer in multiple read usages in the same pass is allowed.
|
||||||
|
|
|
@ -34,31 +34,32 @@ TEST_F(SetScissorRectTest, Success) {
|
||||||
TEST_F(SetScissorRectTest, EmptyScissor) {
|
TEST_F(SetScissorRectTest, EmptyScissor) {
|
||||||
DummyRenderPass renderPass(device);
|
DummyRenderPass renderPass(device);
|
||||||
|
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
|
||||||
|
|
||||||
// Width of scissor rect is zero.
|
// Width of scissor rect is zero.
|
||||||
{
|
{
|
||||||
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||||
pass.SetScissorRect(0, 0, 0, 1);
|
pass.SetScissorRect(0, 0, 0, 1);
|
||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
}
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
// Height of scissor rect is zero.
|
// Height of scissor rect is zero.
|
||||||
{
|
{
|
||||||
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||||
pass.SetScissorRect(0, 0, 1, 0);
|
pass.SetScissorRect(0, 0, 1, 0);
|
||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
}
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
|
|
||||||
// Both width and height of scissor rect are zero.
|
// Both width and height of scissor rect are zero.
|
||||||
{
|
{
|
||||||
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||||
pass.SetScissorRect(0, 0, 0, 0);
|
pass.SetScissorRect(0, 0, 0, 0);
|
||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
}
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test to check that a scissor larger than the framebuffer is allowed
|
// Test to check that a scissor larger than the framebuffer is allowed
|
||||||
|
|
Loading…
Reference in New Issue