| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
|
| index 1869165283941acc0c61caf76ebc8bde30459850..e66963231143fef9388733316b684701d0a45fab 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -327,6 +327,11 @@ IdHandlerInterface* GLES2Implementation::GetIdHandler(int namespace_id) const {
|
| return share_group_->GetIdHandler(namespace_id);
|
| }
|
|
|
| +RangeIdHandlerInterface* GLES2Implementation::GetRangeIdHandler(
|
| + int namespace_id) const {
|
| + return share_group_->GetRangeIdHandler(namespace_id);
|
| +}
|
| +
|
| IdAllocator* GLES2Implementation::GetIdAllocator(int namespace_id) const {
|
| if (namespace_id == id_namespaces::kQueries)
|
| return query_id_allocator_.get();
|
| @@ -4109,6 +4114,144 @@ bool GLES2Implementation::ValidateOffset(const char* func, GLintptr offset) {
|
| return true;
|
| }
|
|
|
| +GLuint GLES2Implementation::GenPathsCHROMIUM(GLsizei range) {
|
| + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenPathsCHROMIUM(" << range
|
| + << ")");
|
| + GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| +
|
| + if (range < 0) {
|
| + SetGLError(GL_INVALID_VALUE, "glGenPathsCHROMIUM", "range < 0");
|
| + return 0;
|
| + }
|
| + if (!FitInt32NonNegative(range)) {
|
| + SetGLError(
|
| + GL_INVALID_VALUE, "glGenPathsCHROMIUM", "range more than 32-bit");
|
| + return 0;
|
| + }
|
| +
|
| + if (range == 0) {
|
| + return 0;
|
| + }
|
| +
|
| + GLuint first_client_id = 0;
|
| + GetRangeIdHandler(id_namespaces::kPaths)
|
| + ->MakeIdRange(this, range, &first_client_id);
|
| +
|
| + if (first_client_id == 0) {
|
| + // Ran out of id space. Is not specified to raise any gl errors.
|
| + return 0;
|
| + }
|
| +
|
| + helper_->GenPathsCHROMIUM(first_client_id, range);
|
| +
|
| + GPU_CLIENT_LOG_CODE_BLOCK({
|
| + for (GLsizei i = 0; i < range; ++i) {
|
| + GPU_CLIENT_LOG(" " << i << ": " << (first_client_id + i));
|
| + }
|
| + });
|
| + CheckGLError();
|
| + return first_client_id;
|
| +}
|
| +
|
| +void GLES2Implementation::DeletePathsCHROMIUM(GLuint first_client_id,
|
| + GLsizei range) {
|
| + GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeletePathsCHROMIUM("
|
| + << first_client_id << ", " << range << ")");
|
| +
|
| + if (range < 0) {
|
| + SetGLError(GL_INVALID_VALUE, "glDeletePathsCHROMIUM", "range < 0");
|
| + return;
|
| + }
|
| +
|
| + if (!FitInt32NonNegative(range)) {
|
| + SetGLError(
|
| + GL_INVALID_VALUE, "glGenPathsCHROMIUM", "range more than 32-bit");
|
| + return;
|
| + }
|
| +
|
| + if (range == 0) {
|
| + return;
|
| + }
|
| +
|
| + GetRangeIdHandler(id_namespaces::kPaths)
|
| + ->FreeIdRange(this,
|
| + first_client_id,
|
| + range,
|
| + &GLES2Implementation::DeletePathsCHROMIUMStub);
|
| + // Deleting non-existing paths does not produce errors in the extension.
|
| +}
|
| +
|
| +void GLES2Implementation::DeletePathsCHROMIUMStub(GLuint first_client_id,
|
| + GLsizei range) {
|
| + helper_->DeletePathsCHROMIUM(first_client_id, range);
|
| +}
|
| +
|
| +void GLES2Implementation::PathCommandsCHROMIUM(GLuint path,
|
| + GLsizei num_commands,
|
| + const GLubyte* commands,
|
| + GLsizei num_coords,
|
| + const GLfloat* coords) {
|
| + GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPathCommandsCHROMIUM(" << path
|
| + << ", " << num_commands << ", " << commands << ", "
|
| + << num_coords << ", " << coords << ")");
|
| + if (path == 0) {
|
| + SetGLError(
|
| + GL_INVALID_VALUE, "glPathCommandsCHROMIUM", "invalid path object");
|
| + return;
|
| + }
|
| + if (num_commands < 0) {
|
| + SetGLError(GL_INVALID_VALUE, "glPathCommandsCHROMIUM", "numCommands < 0");
|
| + return;
|
| + }
|
| + if (num_commands != 0 && !commands) {
|
| + SetGLError(GL_INVALID_VALUE, "glPathCommandsCHROMIUM", "missing commands");
|
| + return;
|
| + }
|
| +
|
| + if (num_coords < 0) {
|
| + SetGLError(GL_INVALID_VALUE, "glPathCommandsCHROMIUM", "numCoords < 0");
|
| + return;
|
| + }
|
| + if (num_coords != 0 && !coords) {
|
| + SetGLError(GL_INVALID_VALUE, "glPathCommandsCHROMIUM", "missing coords");
|
| + return;
|
| + }
|
| +
|
| + if (num_commands == 0 && num_coords == 0) {
|
| + helper_->PathCommandsCHROMIUM(path, 0, 0, 0, 0, 0, 0);
|
| + return;
|
| + }
|
| +
|
| + uint32 coords_size = sizeof(GLfloat) * num_coords;
|
| +
|
| + ScopedTransferBufferPtr buffer(
|
| + coords_size + num_commands, helper_, transfer_buffer_);
|
| + if (!buffer.valid() || buffer.size() < coords_size + num_commands) {
|
| + SetGLError(GL_INVALID_VALUE,
|
| + "glPathCommandsCHROMIUM",
|
| + "no room in transfer buffer for coords and commands");
|
| + return;
|
| + }
|
| +
|
| + // Copy coords first because they need stricter alignment.
|
| + unsigned char* coords_addr = static_cast<unsigned char*>(buffer.address());
|
| + memcpy(coords_addr, coords, coords_size);
|
| +
|
| + unsigned char* commands_addr =
|
| + static_cast<unsigned char*>(buffer.address()) + coords_size;
|
| + memcpy(commands_addr, commands, num_commands);
|
| + helper_->PathCommandsCHROMIUM(path,
|
| + num_commands,
|
| + buffer.shm_id(),
|
| + buffer.offset() + coords_size,
|
| + num_coords,
|
| + buffer.shm_id(),
|
| + buffer.offset());
|
| + CheckGLError();
|
| +}
|
| +
|
| // Include the auto-generated part of this file. We split this because it means
|
| // we can easily edit the non-auto generated parts right here in this file
|
| // instead of having to edit some template or the code generator.
|
|
|