chromium/gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory_unittest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.h"

#include "base/no_destructor.h"
#include "base/test/scoped_feature_list.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/shared_image_backing.h"
#include "gpu/command_buffer/service/shared_image/shared_image_factory.h"
#include "gpu/command_buffer/service/shared_image/shared_image_manager.h"
#include "gpu/command_buffer/service/shared_image/shared_image_representation.h"
#include "gpu/command_buffer/service/shared_image/shared_image_test_base.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_finch_features.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_implementation.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/gpu/GrBackendSemaphore.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"

namespace gpu {
namespace {

constexpr GrSurfaceOrigin kSurfaceOrigin =;
constexpr SkAlphaType kAlphaType =;
constexpr auto kColorSpace =;

// NOTE: The factory verifies that the usage for SIs created from empty GMBs
// includes GLES2 usage (either read or write) as the factory's entire purpose
// is GL-Vulkan interop, so it's necessary to specify *some* GLES2 usage here
// even though the tests don't actually use the GLES2 interface. The tests do
// exercise Skia read and write accesses, so include RASTER_{READ, WRITE} usage.
constexpr gpu::SharedImageUsageSet kUsage =;

base::NoDestructor<base::test::ScopedFeatureList> g_scoped_feature_list;

// Must be run with --enable-features=DefaultANGLEVulkan so that ANGLE starts
// in right mode.
class AngleVulkanImageBackingFactoryTest
    : public SharedImageTestBase,
      public testing::WithParamInterface<viz::SharedImageFormat> {};

// Verify creation and Skia access works as expected.
TEST_P(AngleVulkanImageBackingFactoryTest, Basic) {}

// Verify that pixel upload works as expected.
TEST_P(AngleVulkanImageBackingFactoryTest, Upload) {}

std::string TestParamToString(
    const testing::TestParamInfo<viz::SharedImageFormat>& param_info) {}

const auto kFormats =;

INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace gpu