#include "gpu/command_buffer/service/shared_image/gl_texture_image_backing_factory.h"
#include <list>
#include <utility>
#include "build/build_config.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/shared_image/gl_texture_image_backing.h"
#include "gpu/config/gpu_preferences.h"
#include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/progress_reporter.h"
namespace gpu {
namespace {
constexpr SharedImageUsageSet kWebGPUUsages = …;
constexpr SharedImageUsageSet kSupportedUsage = …;
}
GLTextureImageBackingFactory::GLTextureImageBackingFactory(
const GpuPreferences& gpu_preferences,
const GpuDriverBugWorkarounds& workarounds,
const gles2::FeatureInfo* feature_info,
gl::ProgressReporter* progress_reporter,
bool supports_cpu_upload)
: … { … }
GLTextureImageBackingFactory::~GLTextureImageBackingFactory() = default;
std::unique_ptr<SharedImageBacking>
GLTextureImageBackingFactory::CreateSharedImage(
const Mailbox& mailbox,
viz::SharedImageFormat format,
SurfaceHandle surface_handle,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
SharedImageUsageSet usage,
std::string debug_label,
bool is_thread_safe) { … }
std::unique_ptr<SharedImageBacking>
GLTextureImageBackingFactory::CreateSharedImage(
const Mailbox& mailbox,
viz::SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
SharedImageUsageSet usage,
std::string debug_label,
bool is_thread_safe,
base::span<const uint8_t> pixel_data) { … }
std::unique_ptr<SharedImageBacking>
GLTextureImageBackingFactory::CreateSharedImage(
const Mailbox& mailbox,
viz::SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
SharedImageUsageSet usage,
std::string debug_label,
gfx::GpuMemoryBufferHandle handle) { … }
bool GLTextureImageBackingFactory::IsSupported(
SharedImageUsageSet usage,
viz::SharedImageFormat format,
const gfx::Size& size,
bool thread_safe,
gfx::GpuMemoryBufferType gmb_type,
GrContextType gr_context_type,
base::span<const uint8_t> pixel_data) { … }
void GLTextureImageBackingFactory::EnableSupportForAllMetalUsagesForTesting(
bool enable) { … }
void GLTextureImageBackingFactory::ForceSetUsingANGLEMetalForTesting(
bool value) { … }
std::unique_ptr<SharedImageBacking>
GLTextureImageBackingFactory::CreateSharedImageInternal(
const Mailbox& mailbox,
viz::SharedImageFormat format,
SurfaceHandle surface_handle,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
SharedImageUsageSet usage,
std::string debug_label,
base::span<const uint8_t> pixel_data) { … }
SharedImageBackingType GLTextureImageBackingFactory::GetBackingType() { … }
}