// Copyright 2017 The Dawn & Tint Authors // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <gmock/gmock.h> #include "dawn/tests/unittests/validation/ValidationTest.h" #include "dawn/utils/WGPUHelpers.h" namespace dawn { namespace { HasSubstr; StartsWith; class CommandBufferValidationTest : public ValidationTest { … }; // Test for an empty command buffer TEST_F(CommandBufferValidationTest, Empty) { … } // Test that a command buffer cannot be ended mid render pass TEST_F(CommandBufferValidationTest, EndedMidRenderPass) { … } // Test that a command buffer cannot be ended mid compute pass TEST_F(CommandBufferValidationTest, EndedMidComputePass) { … } // Test that a render pass cannot be ended twice TEST_F(CommandBufferValidationTest, RenderPassEndedTwice) { … } // Test that a compute pass cannot be ended twice TEST_F(CommandBufferValidationTest, ComputePassEndedTwice) { … } // Test that a pass cannot be ended again in another pass TEST_F(CommandBufferValidationTest, PassEndedAgainMidAnotherPass) { … } // Test that beginning a compute pass before ending the previous pass causes an error. TEST_F(CommandBufferValidationTest, BeginComputePassBeforeEndPreviousPass) { … } // Test that beginning a render pass before ending the previous pass causes an error. TEST_F(CommandBufferValidationTest, BeginRenderPassBeforeEndPreviousPass) { … } // Test that encoding command after a successful finish produces an error TEST_F(CommandBufferValidationTest, CallsAfterASuccessfulFinish) { … } // Test that encoding command after a failed finish produces an error TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) { … } // Test that passes which are de-referenced prior to ending still allow the correct errors to be // produced. TEST_F(CommandBufferValidationTest, PassDereferenced) { … } // Test that calling inject validation error produces an error. TEST_F(CommandBufferValidationTest, InjectValidationError) { … } // Test that calling inject validation error with a std::string_view produces an error which // preserves the string. TEST_F(CommandBufferValidationTest, InjectedValidateErrorStringView) { … } // Test that calling inject validation error with various wgpu::NullableStringView produces // an error which preserves the string. TEST_F(CommandBufferValidationTest, InjectedValidateErrorVariousStringTypes) { … } TEST_F(CommandBufferValidationTest, EncodeAfterDeviceDestroyed) { … } // Test that an error is produced when encoding happens after ending a pass. TEST_F(CommandBufferValidationTest, EncodeAfterEndingPass) { … } } // anonymous namespace } // namespace dawn