#include "gpu/command_buffer/service/shared_image/shared_image_test_base.h"
#include <vector>
#include "base/command_line.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/pixel_test_utils.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/command_buffer/service/service_utils.h"
#include "gpu/command_buffer/service/shared_image/copy_image_plane.h"
#include "gpu/command_buffer/service/shared_image/shared_image_representation.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/gpu/GrBackendSemaphore.h"
#include "third_party/skia/include/gpu/ganesh/SkImageGanesh.h"
#include "third_party/skia/include/gpu/graphite/Context.h"
#include "third_party/skia/include/gpu/graphite/Image.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/init/gl_factory.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
#if BUILDFLAG(ENABLE_VULKAN)
#include "components/viz/common/gpu/vulkan_in_process_context_provider.h"
#include "gpu/vulkan/init/vulkan_factory.h"
#include "gpu/vulkan/vulkan_implementation.h"
#endif
#if BUILDFLAG(SKIA_USE_DAWN)
#include "gpu/command_buffer/service/dawn_context_provider.h"
#endif
#if BUILDFLAG(SKIA_USE_METAL)
#include "components/viz/common/gpu/metal_context_provider.h"
#endif
#if BUILDFLAG(SKIA_USE_DAWN) || BUILDFLAG(USE_DAWN)
#include "third_party/dawn/include/dawn/dawn_proc.h"
#include "third_party/dawn/include/dawn/native/DawnNative.h"
#endif
namespace {
struct ReadPixelsContext { … };
void OnReadPixelsDone(
void* raw_ctx,
std::unique_ptr<const SkImage::AsyncReadResult> async_result) { … }
void InsertRecordingAndSubmit(gpu::SharedContextState* context,
bool sync_cpu = false) { … }
}
namespace gpu {
SkBitmap SharedImageTestBase::MakeRedBitmap(SkColorType color_type,
const gfx::Size& size,
size_t added_stride) { … }
std::vector<SkBitmap> SharedImageTestBase::AllocateRedBitmaps(
viz::SharedImageFormat format,
const gfx::Size& size,
size_t added_stride) { … }
std::vector<SkPixmap> SharedImageTestBase::GetSkPixmaps(
const std::vector<SkBitmap>& bitmaps) { … }
SharedImageTestBase::SharedImageTestBase() { … }
SharedImageTestBase::~SharedImageTestBase() { … }
bool SharedImageTestBase::use_passthrough() const { … }
GrDirectContext* SharedImageTestBase::gr_context() { … }
GrContextType SharedImageTestBase::gr_context_type() { … }
bool SharedImageTestBase::IsGraphiteDawnSupported() { … }
void SharedImageTestBase::InitializeContext(GrContextType context_type) { … }
void SharedImageTestBase::VerifyPixelsWithReadback(
const Mailbox& mailbox,
const std::vector<SkBitmap>& expected_bitmaps) { … }
void SharedImageTestBase::VerifyPixelsWithReadbackGanesh(
const Mailbox& mailbox,
const std::vector<SkBitmap>& expected_bitmaps) { … }
void SharedImageTestBase::VerifyPixelsWithReadbackGraphite(
const Mailbox& mailbox,
const std::vector<SkBitmap>& expected_bitmaps) { … }
#if BUILDFLAG(SKIA_USE_DAWN)
wgpu::BackendType SharedImageTestBase::GetDawnBackendType() const { … }
bool SharedImageTestBase::DawnForceFallbackAdapter() const { … }
#endif
void PrintTo(GrContextType type, std::ostream* os) { … }
}