chromium/gpu/command_buffer/client/vertex_array_object_manager.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/client/vertex_array_object_manager.h"

#include <stddef.h>
#include <stdint.h>

#include "base/check_op.h"
#include "base/memory/raw_ptr.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"

namespace gpu {
namespace gles2 {

template <typename T>
static T RoundUpToMultipleOf4(T size) {}

// This class tracks VertexAttribPointers and helps emulate client side buffers.
//
// The way client side buffers work is we shadow all the Vertex Attribs so we
// know which ones are pointing to client side buffers.
//
// At Draw time, for any attribs pointing to client side buffers we copy them
// to a special VBO and reset the actual vertex attrib pointers to point to this
// VBO.
//
// This also means we have to catch calls to query those values so that when
// an attrib is a client side buffer we pass the info back the user expects.

class GLES2_IMPL_EXPORT VertexArrayObject {};

VertexArrayObject::VertexArrayObject(GLuint max_vertex_attribs)
    :{}

void VertexArrayObject::UnbindBuffer(GLuint id) {}

bool VertexArrayObject::BindElementArray(GLuint id) {}
bool VertexArrayObject::HaveEnabledClientSideBuffers() const {}

void VertexArrayObject::SetAttribEnable(GLuint index, bool enabled) {}

void VertexArrayObject::SetAttribPointer(
    GLuint buffer_id,
    GLuint index,
    GLint size,
    GLenum type,
    GLboolean normalized,
    GLsizei stride,
    const void* ptr,
    GLboolean integer) {}

bool VertexArrayObject::GetVertexAttrib(GLuint index,
                                        GLenum pname,
                                        uint32_t* param) const {}

void VertexArrayObject::SetAttribDivisor(GLuint index, GLuint divisor) {}

// Gets the Attrib pointer for an attrib but only if it's a client side
// pointer. Returns true if it got the pointer.
bool VertexArrayObject::GetAttribPointer(
    GLuint index, GLenum pname, void** ptr) const {}

// Gets an attrib if it's in range and it's client side.
const VertexArrayObject::VertexAttrib* VertexArrayObject::GetAttrib(
    GLuint index) const {}

VertexArrayObjectManager::VertexArrayObjectManager(
    GLuint max_vertex_attribs,
    GLuint array_buffer_id,
    GLuint element_array_buffer_id,
    bool support_client_side_arrays)
    :{}

VertexArrayObjectManager::~VertexArrayObjectManager() = default;

bool VertexArrayObjectManager::IsReservedId(GLuint id) const {}

GLuint VertexArrayObjectManager::bound_element_array_buffer() const {}

void VertexArrayObjectManager::UnbindBuffer(GLuint id) {}

bool VertexArrayObjectManager::BindElementArray(GLuint id) {}

void VertexArrayObjectManager::GenVertexArrays(
    GLsizei n, const GLuint* arrays) {}

void VertexArrayObjectManager::DeleteVertexArrays(
    GLsizei n, const GLuint* arrays) {}

bool VertexArrayObjectManager::BindVertexArray(GLuint array, bool* changed) {}

bool VertexArrayObjectManager::HaveEnabledClientSideBuffers() const {}

void VertexArrayObjectManager::SetAttribEnable(GLuint index, bool enabled) {}

bool VertexArrayObjectManager::GetVertexAttrib(GLuint index,
                                               GLenum pname,
                                               uint32_t* param) {}

bool VertexArrayObjectManager::GetAttribPointer(
    GLuint index, GLenum pname, void** ptr) const {}

bool VertexArrayObjectManager::SetAttribPointer(
    GLuint buffer_id,
    GLuint index,
    GLint size,
    GLenum type,
    GLboolean normalized,
    GLsizei stride,
    const void* ptr,
    GLboolean integer) {}

void VertexArrayObjectManager::SetAttribDivisor(GLuint index, GLuint divisor) {}

// Collects the data into the collection buffer and returns the number of
// bytes collected.
GLsizei VertexArrayObjectManager::CollectData(
    const void* data,
    GLsizei bytes_per_element,
    GLsizei real_stride,
    GLsizei num_elements) {}

bool VertexArrayObjectManager::IsDefaultVAOBound() const {}

bool VertexArrayObjectManager::SupportsClientSideBuffers() {}

// Returns true if buffers were setup.
bool VertexArrayObjectManager::SetupSimulatedClientSideBuffers(
    const char* function_name,
    GLES2Implementation* gl,
    GLES2CmdHelper* gl_helper,
    GLsizei num_elements,
    GLsizei primcount,
    bool* simulated) {}

// Copies in indices to the service and returns the highest index accessed + 1
bool VertexArrayObjectManager::SetupSimulatedIndexAndClientSideBuffers(
    const char* function_name,
    GLES2Implementation* gl,
    GLES2CmdHelper* gl_helper,
    GLsizei count,
    GLenum type,
    GLsizei primcount,
    const void* indices,
    GLuint* offset,
    bool* simulated) {}

}  // namespace gles2
}  // namespace gpu