chromium/third_party/dawn/src/dawn/tests/end2end/TextureFormatTests.cpp

// 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 <cmath>
#include <limits>
#include <type_traits>
#include <utility>
#include <vector>

#include "dawn/common/Assert.h"
#include "dawn/common/Math.h"
#include "dawn/tests/DawnTest.h"
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
#include "dawn/utils/TextureUtils.h"
#include "dawn/utils/WGPUHelpers.h"

namespace dawn {
namespace {

enum class TextureComponentType {};

// An expectation for float buffer content that can correctly compare different NaN values and
// supports a basic tolerance for comparison of finite values.
class ExpectFloatWithTolerance : public detail::Expectation {};

// An expectation for float16 buffers that can correctly compare NaNs (all NaNs are equivalent).
class ExpectFloat16 : public detail::Expectation {};

// An expectation for RG11B10Ufloat buffer content that can correctly compare different NaN values
class ExpectRG11B10Ufloat : public detail::Expectation {};

class TextureFormatTest : public DawnTest {};

// Test the R8Unorm format
TEST_P(TextureFormatTest, R8Unorm) {}

// Test the RG8Unorm format
TEST_P(TextureFormatTest, RG8Unorm) {}

// Test the R16Unorm format
TEST_P(TextureFormatTest, R16Unorm) {}

// Test the RG16Unorm format
TEST_P(TextureFormatTest, RG16Unorm) {}

// Test the RGBA16Unorm format
TEST_P(TextureFormatTest, RGBA16Unorm) {}

// Test the RGBA8Unorm format
TEST_P(TextureFormatTest, RGBA8Unorm) {}

// Test the BGRA8Unorm format
TEST_P(TextureFormatTest, BGRA8Unorm) {}

// Test the R8Snorm format
TEST_P(TextureFormatTest, R8Snorm) {}

// Test the RG8Snorm format
TEST_P(TextureFormatTest, RG8Snorm) {}

// Test the RGBA8Snorm format
TEST_P(TextureFormatTest, RGBA8Snorm) {}

// Test the R16Snorm format
TEST_P(TextureFormatTest, R16Snorm) {}

// Test the RG16Snorm format
TEST_P(TextureFormatTest, RG16Snorm) {}

// Test the RGBA16Snorm format
TEST_P(TextureFormatTest, RGBA16Snorm) {}

// Test the R8Uint format
TEST_P(TextureFormatTest, R8Uint) {}

// Test the RG8Uint format
TEST_P(TextureFormatTest, RG8Uint) {}

// Test the RGBA8Uint format
TEST_P(TextureFormatTest, RGBA8Uint) {}

// Test the R16Uint format
TEST_P(TextureFormatTest, R16Uint) {}

// Test the RG16Uint format
TEST_P(TextureFormatTest, RG16Uint) {}

// Test the RGBA16Uint format
TEST_P(TextureFormatTest, RGBA16Uint) {}

// Test the R32Uint format
TEST_P(TextureFormatTest, R32Uint) {}

// Test the RG32Uint format
TEST_P(TextureFormatTest, RG32Uint) {}

// Test the RGBA32Uint format
TEST_P(TextureFormatTest, RGBA32Uint) {}

// Test the R8Sint format
TEST_P(TextureFormatTest, R8Sint) {}

// Test the RG8Sint format
TEST_P(TextureFormatTest, RG8Sint) {}

// Test the RGBA8Sint format
TEST_P(TextureFormatTest, RGBA8Sint) {}

// Test the R16Sint format
TEST_P(TextureFormatTest, R16Sint) {}

// Test the RG16Sint format
TEST_P(TextureFormatTest, RG16Sint) {}

// Test the RGBA16Sint format
TEST_P(TextureFormatTest, RGBA16Sint) {}

// Test the R32Sint format
TEST_P(TextureFormatTest, R32Sint) {}

// Test the RG32Sint format
TEST_P(TextureFormatTest, RG32Sint) {}

// Test the RGBA32Sint format
TEST_P(TextureFormatTest, RGBA32Sint) {}

// Test the R32Float format
TEST_P(TextureFormatTest, R32Float) {}

// Test the RG32Float format
TEST_P(TextureFormatTest, RG32Float) {}

// Test the RGBA32Float format
TEST_P(TextureFormatTest, RGBA32Float) {}

// Test the R16Float format
TEST_P(TextureFormatTest, R16Float) {}

// Test the RG16Float format
TEST_P(TextureFormatTest, RG16Float) {}

// Test the RGBA16Float format
TEST_P(TextureFormatTest, RGBA16Float) {}

// Test the RGBA8Unorm format
TEST_P(TextureFormatTest, RGBA8UnormSrgb) {}

// Test the BGRA8UnormSrgb format
TEST_P(TextureFormatTest, BGRA8UnormSrgb) {}

// Test the RGB10A2Unorm format
TEST_P(TextureFormatTest, RGB10A2Uint) {}

// Test the RGB10A2Unorm format
TEST_P(TextureFormatTest, RGB10A2Unorm) {}

// Test the RG11B10Ufloat format
TEST_P(TextureFormatTest, RG11B10Ufloat) {}

// Test the RGB9E5Ufloat format
TEST_P(TextureFormatTest, RGB9E5Ufloat) {}

DAWN_INSTANTIATE_TEST(TextureFormatTest,
                      D3D11Backend(),
                      D3D12Backend(),
                      MetalBackend(),
                      OpenGLBackend(),
                      OpenGLESBackend(),
                      VulkanBackend());

}  // anonymous namespace
}  // namespace dawn