chromium/gpu/command_buffer/service/shared_image/shared_image_gl_utils.h

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

#ifndef GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_SHARED_IMAGE_GL_UTILS_H_
#define GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_SHARED_IMAGE_GL_UTILS_H_

#include <optional>

#include "base/memory/raw_ptr.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gl/gl_utils.h"

namespace gpu {

// Common utilities for various backings.

// Sets GL state for readback.
class ScopedPackState {};

// Sets GL state for upload and copy.
class ScopedUnpackState {};

// Creates a new GL texture and returns GL texture ID.
GLuint MakeTextureAndSetParameters(
    GLenum target,
    bool framebuffer_attachment_angle,
    scoped_refptr<gles2::TexturePassthrough>* passthrough_texture,
    raw_ptr<gles2::Texture>* texture);

// Returns whether `glTexStorage2DEXTFn` is available to call on the GL driver.
bool IsTexStorage2DAvailable();

}  // namespace gpu

#endif  // GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_SHARED_IMAGE_GL_UTILS_H_