Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2379203002: implement getBufferSubDataAsync prototype (Closed)
Patch Set: Merge branch 'master' into async Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 11683 matching lines...) Expand 10 before | Expand all | Expand 10 after
11694 return error::kInvalidArguments; 11694 return error::kInvalidArguments;
11695 } 11695 }
11696 std::string name_str; 11696 std::string name_str;
11697 if (!bucket->GetAsString(&name_str)) { 11697 if (!bucket->GetAsString(&name_str)) {
11698 return error::kInvalidArguments; 11698 return error::kInvalidArguments;
11699 } 11699 }
11700 return GetAttribLocationHelper( 11700 return GetAttribLocationHelper(
11701 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11701 c.program, c.location_shm_id, c.location_shm_offset, name_str);
11702 } 11702 }
11703 11703
11704 error::Error GLES2DecoderImpl::HandleGetBufferSubDataAsyncCHROMIUM(
11705 uint32_t immediate_data_size,
11706 const volatile void* cmd_data) {
11707 if (!unsafe_es3_apis_enabled()) {
11708 return error::kUnknownCommand;
11709 }
11710 const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM& c =
11711 *static_cast<const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM*>(
11712 cmd_data);
11713 GLenum target = static_cast<GLenum>(c.target);
11714 GLintptr offset = static_cast<GLintptr>(c.offset);
11715 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
11716 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id);
11717
11718 int8_t* mem =
11719 GetSharedMemoryAs<int8_t*>(data_shm_id, c.data_shm_offset, size);
11720 if (!mem) {
11721 return error::kOutOfBounds;
11722 }
11723
11724 if (!validators_->buffer_target.IsValid(target)) {
11725 return error::kInvalidArguments;
11726 }
11727
11728 Buffer* buffer = buffer_manager()->GetBufferInfoForTarget(&state_, target);
11729 if (!buffer) {
11730 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetBufferSubDataAsyncCHROMIUM",
11731 "no buffer bound to target");
11732 return error::kNoError;
11733 }
11734 if (!buffer->CheckRange(offset, size)) {
11735 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glGetBufferSubDataAsyncCHROMIUM",
11736 "invalid range");
11737 return error::kNoError;
11738 }
11739
11740 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glGetBufferSubDataAsyncCHROMIUM");
11741
11742 void* ptr = glMapBufferRange(target, offset, size, GL_MAP_READ_BIT);
11743 if (ptr == nullptr) {
11744 return error::kInvalidArguments;
11745 }
11746 memcpy(mem, ptr, size);
11747 glUnmapBuffer(target);
11748
11749 GLenum error = LOCAL_PEEK_GL_ERROR("glGetBufferSubDataAsyncCHROMIUM");
11750 if (error != GL_NO_ERROR) {
11751 return error::kInvalidArguments;
11752 }
11753 return error::kNoError;
11754 }
11755
11704 error::Error GLES2DecoderImpl::GetUniformLocationHelper( 11756 error::Error GLES2DecoderImpl::GetUniformLocationHelper(
11705 GLuint client_id, 11757 GLuint client_id,
11706 uint32_t location_shm_id, 11758 uint32_t location_shm_id,
11707 uint32_t location_shm_offset, 11759 uint32_t location_shm_offset,
11708 const std::string& name_str) { 11760 const std::string& name_str) {
11709 if (!StringIsValidForGLES(name_str)) { 11761 if (!StringIsValidForGLES(name_str)) {
11710 LOCAL_SET_GL_ERROR( 11762 LOCAL_SET_GL_ERROR(
11711 GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character"); 11763 GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character");
11712 return error::kNoError; 11764 return error::kNoError;
11713 } 11765 }
(...skipping 6805 matching lines...) Expand 10 before | Expand all | Expand 10 after
18519 } 18571 }
18520 18572
18521 // Include the auto-generated part of this file. We split this because it means 18573 // Include the auto-generated part of this file. We split this because it means
18522 // we can easily edit the non-auto generated parts right here in this file 18574 // we can easily edit the non-auto generated parts right here in this file
18523 // instead of having to edit some template or the code generator. 18575 // instead of having to edit some template or the code generator.
18524 #include "base/macros.h" 18576 #include "base/macros.h"
18525 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18577 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18526 18578
18527 } // namespace gles2 18579 } // namespace gles2
18528 } // namespace gpu 18580 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698