// Copyright 2020 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/Math.h" #include "dawn/tests/unittests/validation/ValidationTest.h" #include "dawn/utils/TestUtils.h" #include "dawn/utils/TextureUtils.h" #include "dawn/utils/WGPUHelpers.h" namespace dawn { namespace { class QueueWriteTextureValidationTest : public ValidationTest { … }; // Test the success case for WriteTexture TEST_F(QueueWriteTextureValidationTest, Success) { … } // Test OOB conditions on the data TEST_F(QueueWriteTextureValidationTest, OutOfBoundsOnData) { … } // Test OOB conditions on the texture TEST_F(QueueWriteTextureValidationTest, OutOfBoundsOnTexture) { … } // Test that we force Depth=1 on writes to 2D textures TEST_F(QueueWriteTextureValidationTest, DepthConstraintFor2DTextures) { … } // Test WriteTexture with incorrect texture usage TEST_F(QueueWriteTextureValidationTest, IncorrectUsage) { … } // Test incorrect values of bytesPerRow and that values not divisible by 256 are allowed. TEST_F(QueueWriteTextureValidationTest, BytesPerRowConstraints) { … } // Test that if rowsPerImage is greater than 0, it must be at least copy height. TEST_F(QueueWriteTextureValidationTest, RowsPerImageConstraints) { … } // Test WriteTexture with data offset TEST_F(QueueWriteTextureValidationTest, DataOffset) { … } // Test multisampled textures can be used in WriteTexture. TEST_F(QueueWriteTextureValidationTest, WriteToMultisampledTexture) { … } // Test that WriteTexture cannot be run with a destroyed texture. TEST_F(QueueWriteTextureValidationTest, DestroyedTexture) { … } // Test WriteTexture with texture in error state causes errors. TEST_F(QueueWriteTextureValidationTest, TextureInErrorState) { … } // Test that WriteTexture throws an error when requiredBytesInCopy overflows uint64_t TEST_F(QueueWriteTextureValidationTest, RequiredBytesInCopyOverflow) { … } // Regression tests for a bug in the computation of texture data size in Dawn. TEST_F(QueueWriteTextureValidationTest, TextureWriteDataSizeLastRowComputation) { … } // Test write from data to mip map of non square texture TEST_F(QueueWriteTextureValidationTest, WriteToMipmapOfNonSquareTexture) { … } // Test writes to multiple array layers of an uncompressed texture TEST_F(QueueWriteTextureValidationTest, WriteToMultipleArrayLayers) { … } // Test it is invalid to write into a depth texture. TEST_F(QueueWriteTextureValidationTest, WriteToDepthAspect) { … } // Test write texture to the stencil aspect TEST_F(QueueWriteTextureValidationTest, WriteToStencilAspect) { … } class WriteTextureTest_CompressedTextureFormats : public QueueWriteTextureValidationTest { … }; // Tests to verify that data offset may not be a multiple of the compressed texture block size TEST_F(WriteTextureTest_CompressedTextureFormats, DataOffset) { … } // Tests to verify that bytesPerRow must not be less than (width / blockWidth) * // blockSizeInBytes and that it doesn't have to be a multiple of the compressed // texture block width. TEST_F(WriteTextureTest_CompressedTextureFormats, BytesPerRow) { … } // rowsPerImage must be >= heightInBlocks. TEST_F(WriteTextureTest_CompressedTextureFormats, RowsPerImage) { … } // Tests to verify that ImageOffset.x must be a multiple of the compressed texture block width // and ImageOffset.y must be a multiple of the compressed texture block height TEST_F(WriteTextureTest_CompressedTextureFormats, ImageOffset) { … } // Tests to verify that ImageExtent.x must be a multiple of the compressed texture block width // and ImageExtent.y must be a multiple of the compressed texture block height TEST_F(WriteTextureTest_CompressedTextureFormats, ImageExtent) { … } // Test writes to multiple array layers of a compressed texture TEST_F(WriteTextureTest_CompressedTextureFormats, WriteToMultipleArrayLayers) { … } } // anonymous namespace } // namespace dawn