| OLD | NEW |
| 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 11775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11786 return error::kInvalidArguments; | 11786 return error::kInvalidArguments; |
| 11787 } | 11787 } |
| 11788 std::string name_str; | 11788 std::string name_str; |
| 11789 if (!bucket->GetAsString(&name_str)) { | 11789 if (!bucket->GetAsString(&name_str)) { |
| 11790 return error::kInvalidArguments; | 11790 return error::kInvalidArguments; |
| 11791 } | 11791 } |
| 11792 return GetAttribLocationHelper( | 11792 return GetAttribLocationHelper( |
| 11793 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 11793 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 11794 } | 11794 } |
| 11795 | 11795 |
| 11796 error::Error GLES2DecoderImpl::HandleGetBufferSubDataAsyncCHROMIUM( |
| 11797 uint32_t immediate_data_size, |
| 11798 const volatile void* cmd_data) { |
| 11799 if (!unsafe_es3_apis_enabled()) { |
| 11800 return error::kUnknownCommand; |
| 11801 } |
| 11802 const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM& c = |
| 11803 *static_cast<const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM*>( |
| 11804 cmd_data); |
| 11805 GLenum target = static_cast<GLenum>(c.target); |
| 11806 GLintptr offset = static_cast<GLintptr>(c.offset); |
| 11807 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 11808 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); |
| 11809 |
| 11810 int8_t* mem = |
| 11811 GetSharedMemoryAs<int8_t*>(data_shm_id, c.data_shm_offset, size); |
| 11812 if (!mem) { |
| 11813 return error::kOutOfBounds; |
| 11814 } |
| 11815 |
| 11816 if (!validators_->buffer_target.IsValid(target)) { |
| 11817 return error::kInvalidArguments; |
| 11818 } |
| 11819 |
| 11820 Buffer* buffer = buffer_manager()->GetBufferInfoForTarget(&state_, target); |
| 11821 if (!buffer) { |
| 11822 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetBufferSubDataAsyncCHROMIUM", |
| 11823 "no buffer bound to target"); |
| 11824 return error::kNoError; |
| 11825 } |
| 11826 if (!buffer->CheckRange(offset, size)) { |
| 11827 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glGetBufferSubDataAsyncCHROMIUM", |
| 11828 "invalid range"); |
| 11829 return error::kNoError; |
| 11830 } |
| 11831 |
| 11832 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glGetBufferSubDataAsyncCHROMIUM"); |
| 11833 |
| 11834 void* ptr = glMapBufferRange(target, offset, size, GL_MAP_READ_BIT); |
| 11835 if (ptr == nullptr) { |
| 11836 return error::kInvalidArguments; |
| 11837 } |
| 11838 memcpy(mem, ptr, size); |
| 11839 glUnmapBuffer(target); |
| 11840 |
| 11841 GLenum error = LOCAL_PEEK_GL_ERROR("glGetBufferSubDataAsyncCHROMIUM"); |
| 11842 if (error != GL_NO_ERROR) { |
| 11843 return error::kInvalidArguments; |
| 11844 } |
| 11845 return error::kNoError; |
| 11846 } |
| 11847 |
| 11796 error::Error GLES2DecoderImpl::GetUniformLocationHelper( | 11848 error::Error GLES2DecoderImpl::GetUniformLocationHelper( |
| 11797 GLuint client_id, | 11849 GLuint client_id, |
| 11798 uint32_t location_shm_id, | 11850 uint32_t location_shm_id, |
| 11799 uint32_t location_shm_offset, | 11851 uint32_t location_shm_offset, |
| 11800 const std::string& name_str) { | 11852 const std::string& name_str) { |
| 11801 if (!StringIsValidForGLES(name_str)) { | 11853 if (!StringIsValidForGLES(name_str)) { |
| 11802 LOCAL_SET_GL_ERROR( | 11854 LOCAL_SET_GL_ERROR( |
| 11803 GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character"); | 11855 GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character"); |
| 11804 return error::kNoError; | 11856 return error::kNoError; |
| 11805 } | 11857 } |
| (...skipping 6801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18607 } | 18659 } |
| 18608 | 18660 |
| 18609 // Include the auto-generated part of this file. We split this because it means | 18661 // Include the auto-generated part of this file. We split this because it means |
| 18610 // we can easily edit the non-auto generated parts right here in this file | 18662 // we can easily edit the non-auto generated parts right here in this file |
| 18611 // instead of having to edit some template or the code generator. | 18663 // instead of having to edit some template or the code generator. |
| 18612 #include "base/macros.h" | 18664 #include "base/macros.h" |
| 18613 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18665 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18614 | 18666 |
| 18615 } // namespace gles2 | 18667 } // namespace gles2 |
| 18616 } // namespace gpu | 18668 } // namespace gpu |
| OLD | NEW |