#include <string>
#include <vector>
#include "dawn/common/Constants.h"
#include "dawn/common/Math.h"
#include "dawn/tests/DawnTest.h"
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
#include "dawn/utils/TestUtils.h"
#include "dawn/utils/TextureUtils.h"
#include "dawn/utils/WGPUHelpers.h"
namespace wgpu {
std::ostream& operator<<(std::ostream& o, Origin3D origin) { … }
std::ostream& operator<<(std::ostream& o, Extent3D copySize) { … }
}
namespace dawn {
namespace {
static constexpr wgpu::TextureFormat kTextureFormat = …;
static constexpr uint64_t kDefaultTextureWidth = …;
static constexpr uint64_t kDefaultTextureHeight = …;
enum class ColorSpace : uint32_t { … };
SrcFormat;
DstFormat;
SrcOrigin;
DstOrigin;
CopySize;
FlipY;
SrcColorSpace;
DstColorSpace;
SrcAlphaMode;
DstAlphaMode;
std::ostream& operator<<(std::ostream& o, ColorSpace space) { … }
DAWN_TEST_PARAM_STRUCT(AlphaTestParams, SrcAlphaMode, DstAlphaMode);
DAWN_TEST_PARAM_STRUCT(FormatTestParams, SrcFormat, DstFormat);
DAWN_TEST_PARAM_STRUCT(SubRectTestParams, SrcOrigin, DstOrigin, CopySize, FlipY);
DAWN_TEST_PARAM_STRUCT(ColorSpaceTestParams,
DstFormat,
SrcColorSpace,
DstColorSpace,
SrcAlphaMode,
DstAlphaMode);
struct ColorSpaceInfo { … };
static constexpr size_t kSupportedColorSpaceCount = …;
static constexpr std::array<ColorSpaceInfo, kSupportedColorSpaceCount> ColorSpaceTable = …;
template <typename Parent>
class CopyTextureForBrowserTests : public Parent { … };
class CopyTextureForBrowser_Basic : public CopyTextureForBrowserTests<DawnTest> { … };
class CopyTextureForBrowser_Formats
: public CopyTextureForBrowserTests<DawnTestWithParams<FormatTestParams>> { … };
class CopyTextureForBrowser_SubRects
: public CopyTextureForBrowserTests<DawnTestWithParams<SubRectTestParams>> { … };
class CopyTextureForBrowser_AlphaMode
: public CopyTextureForBrowserTests<DawnTestWithParams<AlphaTestParams>> { … };
class CopyTextureForBrowser_ColorSpace
: public CopyTextureForBrowserTests<DawnTestWithParams<ColorSpaceTestParams>> { … };
TEST_P(CopyTextureForBrowser_Basic, PassthroughCopy) { … }
TEST_P(CopyTextureForBrowser_Basic, VerifyCopyOnXDirection) { … }
TEST_P(CopyTextureForBrowser_Basic, VerifyCopyOnYDirection) { … }
TEST_P(CopyTextureForBrowser_Basic, VerifyCopyFromLargeTexture) { … }
TEST_P(CopyTextureForBrowser_Basic, VerifyFlipY) { … }
TEST_P(CopyTextureForBrowser_Basic, VerifyFlipYInSlimTexture) { … }
DAWN_INSTANTIATE_TEST(CopyTextureForBrowser_Basic,
D3D11Backend(),
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),
OpenGLESBackend(),
VulkanBackend());
TEST_P(CopyTextureForBrowser_Formats, ColorConversion) { … }
DAWN_INSTANTIATE_TEST_P(…);
TEST_P(CopyTextureForBrowser_SubRects, CopySubRect) { … }
DAWN_INSTANTIATE_TEST_P(…);
TEST_P(CopyTextureForBrowser_AlphaMode, alphaMode) { … }
DAWN_INSTANTIATE_TEST_P(…);
TEST_P(CopyTextureForBrowser_ColorSpace, colorSpaceConversion) { … }
DAWN_INSTANTIATE_TEST_P(…);
}
}