chromium/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"

#include <stddef.h>

#include <unordered_map>

#include "base/containers/heap_array.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "gpu/command_buffer/common/gles2_cmd_copy_texture_chromium_utils.h"
#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/decoder_context.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h"
#include "gpu/command_buffer/service/shader_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gl/gl_enums.h"
#include "ui/gl/gl_version_info.h"

namespace gpu {
namespace gles2 {

namespace {

enum {};

enum {};

enum {};

enum {};

const unsigned kAlphaSize =;
const unsigned kNumVertexShaders =;

static_assert;
const unsigned kNumFragmentShaders =;

ShaderId;

ShaderId GetVertexShaderId(unsigned glslVersion) {}

// Returns the correct fragment shader id to evaluate the copy operation for
// the premultiply alpha pixel store settings and target.
ShaderId GetFragmentShaderId(unsigned glslVersion,
                             bool premultiply_alpha,
                             bool unpremultiply_alpha,
                             GLenum target,
                             GLenum source_format,
                             GLenum dest_format) {}

const char* kShaderPrecisionPreamble =;

void InsertVersionDirective(std::string* source, unsigned glslVersion) {}

unsigned ChooseGLSLVersion(const gl::GLVersionInfo& gl_version_info,
                           GLenum dest_format) {}

std::string GetVertexShaderSource(unsigned glslVersion) {}

std::string GetFragmentShaderSource(unsigned glslVersion,
                                    bool premultiply_alpha,
                                    bool unpremultiply_alpha,
                                    bool nv_egl_stream_consumer_external,
                                    GLenum target,
                                    GLenum source_format,
                                    GLenum dest_format) {}

GLenum getIntermediateFormat(GLenum format) {}

void DeleteShader(GLuint shader) {}

bool BindFramebufferTexture2D(GLenum target,
                              GLuint texture_id,
                              GLint level,
                              GLuint framebuffer) {}

void DoCopyTexImage2D(
    gpu::DecoderContext* decoder,
    GLenum source_target,
    GLuint source_id,
    GLint source_level,
    GLenum source_internal_format,
    GLenum dest_target,
    GLuint dest_id,
    GLint dest_level,
    GLenum dest_internal_format,
    GLsizei width,
    GLsizei height,
    GLuint framebuffer,
    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {}

void DoCopyTexSubImage2D(
    gpu::DecoderContext* decoder,
    GLenum source_target,
    GLuint source_id,
    GLint source_level,
    GLenum source_internal_format,
    GLenum dest_target,
    GLuint dest_id,
    GLint dest_level,
    GLenum dest_internal_format,
    GLint xoffset,
    GLint yoffset,
    GLint source_x,
    GLint source_y,
    GLsizei source_width,
    GLsizei source_height,
    GLuint framebuffer,
    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {}

// Convert RGBA/UNSIGNED_BYTE source to RGB/UNSIGNED_BYTE destination.
void convertToRGB(const uint8_t* source,
                  uint8_t* destination,
                  unsigned length) {}

// Convert RGBA/UNSIGNED_BYTE source to RGB/FLOAT destination.
void convertToRGBFloat(const uint8_t* source,
                       float* destination,
                       unsigned length) {}

// Prepare the image data to be uploaded to a texture in pixel unpack buffer.
void PrepareUnpackBuffer(GLuint buffer[2],
                         GLenum format,
                         GLenum type,
                         GLsizei width,
                         GLsizei height) {}

enum TexImageCommandType {};

void DoReadbackAndTexImage(TexImageCommandType command_type,
                           gpu::DecoderContext* decoder,
                           GLenum source_target,
                           GLuint source_id,
                           GLint source_level,
                           GLenum dest_target,
                           GLuint dest_id,
                           GLint dest_level,
                           GLenum dest_internal_format,
                           GLint xoffset,
                           GLint yoffset,
                           GLsizei width,
                           GLsizei height,
                           GLuint framebuffer) {}

class CopyTextureResourceManagerImpl
    : public CopyTextureCHROMIUMResourceManager {};

CopyTextureResourceManagerImpl::CopyTextureResourceManagerImpl()
    :{}

CopyTextureResourceManagerImpl::~CopyTextureResourceManagerImpl() {}

void CopyTextureResourceManagerImpl::Initialize(
    const DecoderContext* decoder,
    const gles2::FeatureInfo::FeatureFlags& feature_flags) {}

void CopyTextureResourceManagerImpl::Destroy() {}

void CopyTextureResourceManagerImpl::DoCopySubTexture(
    DecoderContext* decoder,
    GLenum source_target,
    GLuint source_id,
    GLint source_level,
    GLenum source_internal_format,
    GLenum dest_target,
    GLuint dest_id,
    GLint dest_level,
    GLenum dest_internal_format,
    GLint xoffset,
    GLint yoffset,
    GLint x,
    GLint y,
    GLsizei width,
    GLsizei height,
    GLsizei dest_width,
    GLsizei dest_height,
    GLsizei source_width,
    GLsizei source_height,
    bool flip_y,
    bool premultiply_alpha,
    bool unpremultiply_alpha,
    CopyTextureMethod method,
    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {}

void CopyTextureResourceManagerImpl::DoCopyTexture(
    DecoderContext* decoder,
    GLenum source_target,
    GLuint source_id,
    GLint source_level,
    GLenum source_internal_format,
    GLenum dest_target,
    GLuint dest_id,
    GLint dest_level,
    GLenum dest_internal_format,
    GLsizei width,
    GLsizei height,
    bool flip_y,
    bool premultiply_alpha,
    bool unpremultiply_alpha,
    CopyTextureMethod method,
    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {}

void CopyTextureResourceManagerImpl::DoCopyTextureInternal(
    DecoderContext* decoder,
    GLenum source_target,
    GLuint source_id,
    GLint source_level,
    GLenum source_format,
    GLenum dest_target,
    GLuint dest_id,
    GLint dest_level,
    GLenum dest_format,
    GLint xoffset,
    GLint yoffset,
    GLint x,
    GLint y,
    GLsizei width,
    GLsizei height,
    GLsizei dest_width,
    GLsizei dest_height,
    GLsizei source_width,
    GLsizei source_height,
    bool flip_y,
    bool premultiply_alpha,
    bool unpremultiply_alpha,
    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {}

}  // namespace

CopyTextureCHROMIUMResourceManager::CopyTextureCHROMIUMResourceManager() =
    default;
CopyTextureCHROMIUMResourceManager::~CopyTextureCHROMIUMResourceManager() =
    default;

// static
CopyTextureCHROMIUMResourceManager*
CopyTextureCHROMIUMResourceManager::Create() {}

}  // namespace gles2
}  // namespace gpu