chromium/third_party/dawn/src/dawn/tests/unittests/validation/CopyTextureForBrowserTests.cpp

// 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/Assert.h"
#include "dawn/common/Constants.h"
#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 {

wgpu::Texture Create2DTexture(
    wgpu::Device device,
    uint32_t width,
    uint32_t height,
    uint32_t mipLevelCount,
    uint32_t arrayLayerCount,
    wgpu::TextureFormat format,
    wgpu::TextureUsage usage,
    uint32_t sampleCount = 1,
    const wgpu::DawnTextureInternalUsageDescriptor* internalDesc = nullptr) {}

wgpu::ExternalTexture CreateExternalTexture(wgpu::Device device, uint32_t width, uint32_t height) {}

class CopyTextureForBrowserTest : public ValidationTest {};

class CopyTextureForBrowserInternalUsageTest : public CopyTextureForBrowserTest {};

class CopyExternalTextureForBrowserTest : public ValidationTest {};

class CopyExternalTextureForBrowserInternalUsageTest : public CopyExternalTextureForBrowserTest {};

// Tests should be Success
TEST_F(CopyTextureForBrowserTest, Success) {}

// Test source or destination texture has wrong usages
TEST_F(CopyTextureForBrowserTest, IncorrectUsage) {}

// Test source or destination texture is destroyed.
TEST_F(CopyTextureForBrowserTest, DestroyedTexture) {}

// Test non-zero value origin in source and OOB copy rects.
TEST_F(CopyTextureForBrowserTest, OutOfBounds) {}

// Test destination texture has format that not supported by CopyTextureForBrowser().
TEST_F(CopyTextureForBrowserTest, InvalidDstFormat) {}

// Test source or destination texture are multisampled.
TEST_F(CopyTextureForBrowserTest, InvalidSampleCount) {}

// Test color space conversion related attributes in CopyTextureForBrowserOptions.
TEST_F(CopyTextureForBrowserTest, ColorSpaceConversion_ColorSpace) {}

// Test option.srcAlphaMode/dstAlphaMode
TEST_F(CopyTextureForBrowserTest, ColorSpaceConversion_TextureAlphaState) {}

// Tests should be Success
TEST_F(CopyExternalTextureForBrowserTest, Success) {}

// Test destination texture has wrong usages
TEST_F(CopyExternalTextureForBrowserTest, IncorrectUsage) {}

// Test source or destination texture is destroyed.
TEST_F(CopyExternalTextureForBrowserTest, DestroyedTexture) {}

// Test non-zero value origin in source and OOB copy rects.
TEST_F(CopyExternalTextureForBrowserTest, OutOfBounds) {}

// Test destination texture has format that not supported by CopyTextureForBrowser().
TEST_F(CopyExternalTextureForBrowserTest, InvalidDstFormat) {}

// Test destination texture are multisampled.
TEST_F(CopyExternalTextureForBrowserTest, InvalidSampleCount) {}

// Test color space conversion related attributes in CopyTextureForBrowserOptions.
TEST_F(CopyExternalTextureForBrowserTest, ColorSpaceConversion_ColorSpace) {}

// Test option.srcAlphaMode/dstAlphaMode
TEST_F(CopyExternalTextureForBrowserTest, ColorSpaceConversion_TextureAlphaState) {}

// Test that the internal usage can only be set to true when the device internal usage feature is
// enabled
TEST_F(CopyTextureForBrowserTest, InternalUsage) {}

// Test that the internal usages are taken into account when interalUsage = true
TEST_F(CopyTextureForBrowserInternalUsageTest, InternalUsage) {}

// Test that the internal usage can only be set to true when the device internal usage feature is
// enabled
TEST_F(CopyExternalTextureForBrowserTest, InternalUsage) {}

// Test that the internal usages are taken into account when interalUsage = true
TEST_F(CopyExternalTextureForBrowserInternalUsageTest, InternalUsage) {}

}  // anonymous namespace
}  // namespace dawn