chromium/gpu/command_buffer/service/shared_image/gl_texture_holder.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/gl_texture_holder.h"

#include "base/bits.h"
#include "build/build_config.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/gl_repack_utils.h"
#include "gpu/command_buffer/service/shared_image/shared_image_gl_utils.h"
#include "gpu/command_buffer/service/skia_utils.h"
#include "third_party/skia/include/gpu/GrContextThreadSafeProxy.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_version_info.h"
#include "ui/gl/progress_reporter.h"
#include "ui/gl/scoped_binders.h"
#include "ui/gl/scoped_restore_texture.h"

namespace gpu {
namespace {

// This value can't be cached as it may change for different contexts.
bool SupportsUnpackSubimage() {}

// This value can't be cached as it may change for different contexts.
bool SupportsPackSubimage() {}

// Shared memory GMBs tend to use a stride that is 4 bytes aligned. If
// bytes_per_pixel is 1 or 2 and `stride` is already 4 byte aligned then
// use a 4 byte alignment. Otherwise use `bytes_per_pixel` as alignment. This
// can avoid a copy if GL_[UN]PACK_ROW_LENGTH isn't supported, eg. `stride` is
// 12 and `bytes_per_pixel` is 1 but there are only 10 bytes of data per row.
constexpr int ComputeBestAlignment(size_t bytes_per_pixel, size_t stride) {}

}  // anonymous namespace

// static
// TODO(hitawala): Check GLFormatCaps for format support.
viz::SharedImageFormat GLTextureHolder::GetPlaneFormat(
    viz::SharedImageFormat format,
    int plane_index) {}

GLTextureHolder::GLTextureHolder(viz::SharedImageFormat format,
                                 const gfx::Size& size,
                                 bool is_passthrough,
                                 gl::ProgressReporter* progress_reporter)
    :{}

// TODO(kylechar): When `texture_` is removed with validating command decoder
// move constructor/assignment can be defaulted.
GLTextureHolder::GLTextureHolder(GLTextureHolder&& other) {}

GLTextureHolder& GLTextureHolder::operator=(GLTextureHolder&& other) {}

GLTextureHolder::~GLTextureHolder() {}

GLuint GLTextureHolder::GetServiceId() const {}

void GLTextureHolder::Initialize(
    const GLCommonImageBackingFactory::FormatInfo& format_info,
    bool framebuffer_attachment_angle,
    base::span<const uint8_t> pixel_data,
    const std::string& debug_label) {}

void GLTextureHolder::InitializeWithTexture(
    const GLFormatDesc& format_desc,
    scoped_refptr<gles2::TexturePassthrough> texture) {}

void GLTextureHolder::InitializeWithTexture(const GLFormatDesc& format_desc,
                                            gles2::Texture* texture) {}

bool GLTextureHolder::UploadFromMemory(const SkPixmap& pixmap) {}

bool GLTextureHolder::ReadbackToMemory(const SkPixmap& pixmap) {}

sk_sp<GrPromiseImageTexture> GLTextureHolder::GetPromiseImage(
    SharedContextState* context_state) {}

gfx::Rect GLTextureHolder::GetClearedRect() const {}

void GLTextureHolder::SetClearedRect(const gfx::Rect& cleared_rect) {}

void GLTextureHolder::SetContextLost() {}

}  // namespace gpu