#ifdef UNSAFE_BUFFERS_BUILD
#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) { … }
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) { … }
bool VertexArrayObject::GetAttribPointer(
GLuint index, GLenum pname, void** ptr) const { … }
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) { … }
GLsizei VertexArrayObjectManager::CollectData(
const void* data,
GLsizei bytes_per_element,
GLsizei real_stride,
GLsizei num_elements) { … }
bool VertexArrayObjectManager::IsDefaultVAOBound() const { … }
bool VertexArrayObjectManager::SupportsClientSideBuffers() { … }
bool VertexArrayObjectManager::SetupSimulatedClientSideBuffers(
const char* function_name,
GLES2Implementation* gl,
GLES2CmdHelper* gl_helper,
GLsizei num_elements,
GLsizei primcount,
bool* simulated) { … }
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) { … }
}
}