// Copyright 2019 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 <vector> #include "dawn/common/Constants.h" #include "dawn/tests/unittests/validation/ValidationTest.h" #include "dawn/utils/ComboRenderBundleEncoderDescriptor.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" namespace dawn { namespace { class RenderBundleValidationTest : public ValidationTest { … }; // Test creating and encoding an empty render bundle. TEST_F(RenderBundleValidationTest, Empty) { … } // Test that an empty error bundle encoder produces an error bundle. // This is a regression test for error render bundle encoders containing no commands would // produce non-error render bundles. TEST_F(RenderBundleValidationTest, EmptyErrorEncoderProducesErrorBundle) { … } // Test executing zero render bundles. TEST_F(RenderBundleValidationTest, ZeroBundles) { … } // Test successfully creating and encoding a render bundle into a command buffer. TEST_F(RenderBundleValidationTest, SimpleSuccess) { … } // Test that render bundle debug groups must be well nested. TEST_F(RenderBundleValidationTest, DebugGroups) { … } // Test render bundles do not inherit command buffer state TEST_F(RenderBundleValidationTest, StateInheritance) { … } // Test render bundles do not persist command buffer state TEST_F(RenderBundleValidationTest, StatePersistence) { … } // Test executing render bundles clears command buffer state TEST_F(RenderBundleValidationTest, ClearsState) { … } // Test creating and encoding multiple render bundles. TEST_F(RenderBundleValidationTest, MultipleBundles) { … } // Test that is is valid to execute a render bundle more than once. TEST_F(RenderBundleValidationTest, ExecuteMultipleTimes) { … } // Test that it is an error to call Finish() on a render bundle encoder twice. TEST_F(RenderBundleValidationTest, FinishTwice) { … } // Test that it is invalid to create a render bundle with no texture formats TEST_F(RenderBundleValidationTest, RequiresAtLeastOneTextureFormat) { … } // Test that it is invalid to create a render bundle with no texture formats TEST_F(RenderBundleValidationTest, ColorFormatsCountOutOfBounds) { … } // Test that render bundle sparse color formats. TEST_F(RenderBundleValidationTest, SparseColorFormats) { … } // Test that the render bundle depth stencil format cannot be set to undefined. TEST_F(RenderBundleValidationTest, DepthStencilFormatUndefined) { … } // Test that depthReadOnly and stencilReadOnly don't need to be the same for depth-stencil formats TEST_F(RenderBundleValidationTest, DepthStencilReadOnly) { … } // Test that resource usages are validated inside render bundles. TEST_F(RenderBundleValidationTest, UsageTracking) { … } // Test that encoding SetPipline with an incompatible color format produces an error. TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) { … } // Test that encoding SetPipline with an incompatible depth stencil format produces an error. TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) { … } // Test that encoding SetPipline with an incompatible sample count produces an error. TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) { … } // Test that encoding ExecuteBundles with an incompatible color format produces an error. TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) { … } // Test that encoding ExecuteBundles with an incompatible depth stencil format produces an // error. TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) { … } // Test that encoding ExecuteBundles with an incompatible sample count produces an error. TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) { … } // Test that color attachment texture formats must be color renderable and // depth stencil texture formats must be depth/stencil. TEST_F(RenderBundleValidationTest, TextureFormats) { … } // Tests validation for per-pixel accounting for render targets. The tests currently assume that the // default maxColorAttachmentBytesPerSample limit of 32 is used. TEST_F(RenderBundleValidationTest, RenderBundleColorFormatsBytesPerSample) { … } } // anonymous namespace } // namespace dawn