// Copyright 2021 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/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" namespace dawn { namespace { constexpr uint32_t kRTSize = …; constexpr uint32_t kFloat32x2Stride = …; constexpr uint32_t kFloat32x4Stride = …; class DrawVertexAndIndexBufferOOBValidationTests : public ValidationTest { … }; // Control case for Draw TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawBasic) { … } // Verify vertex buffer OOB for non-instanced Draw are caught in command encoder TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawVertexBufferOutOfBoundWithoutInstance) { … } // Verify vertex buffer OOB for instanced Draw are caught in command encoder TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawVertexBufferOutOfBoundWithInstance) { … } // Verify zero-attribute vertex buffer OOB for non-instanced Draw are caught in command encoder TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroAttribute) { … } // Verify vertex buffers don't need to be set to unused (hole) slots for Draw TEST_F(DrawVertexAndIndexBufferOOBValidationTests, UnusedSlots) { … } // Control case for DrawIndexed TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedBasic) { … } // Verify index buffer OOB for DrawIndexed are caught in command encoder TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedIndexBufferOOB) { … } // Verify instance mode vertex buffer OOB for DrawIndexed are caught in command encoder TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedVertexBufferOOB) { … } // Verify zero-attribute instance step mode vertex buffer OOB for instanced DrawIndex // are caught in command encoder TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedZeroAttribute) { … } // Verify vertex buffers don't need to be set to unused (hole) slots for DrawIndexed TEST_F(DrawVertexAndIndexBufferOOBValidationTests, DrawIndexedUnusedSlots) { … } // Verify zero array stride vertex buffer OOB for Draw and DrawIndexed are caught in command encoder // This test only test cases that strideCount > 0. Cases of strideCount == 0 are tested in // ZeroStrideCountVertexBufferNeverOOB. TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroArrayStrideVertexBuffer) { … } // Verify all vertex buffer never OOB for Draw and DrawIndexed with zero stride count TEST_F(DrawVertexAndIndexBufferOOBValidationTests, ZeroStrideCountVertexBufferNeverOOB) { … } // Verify that if setVertexBuffer and/or setIndexBuffer for multiple times, only the last one is // taken into account TEST_F(DrawVertexAndIndexBufferOOBValidationTests, SetBufferMultipleTime) { … } } // anonymous namespace } // namespace dawn