| OLD | NEW | 
|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 
| 6 | 6 | 
| 7 namespace gpu { | 7 namespace gpu { | 
| 8 namespace gles2 { | 8 namespace gles2 { | 
| 9 | 9 | 
| 10 // Custom Handlers | 10 // Custom Handlers | 
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 362   if (*location != -1) { | 362   if (*location != -1) { | 
| 363     return error::kInvalidArguments; | 363     return error::kInvalidArguments; | 
| 364   } | 364   } | 
| 365   error::Error error = DoGetAttribLocation(program, name_str.c_str(), location); | 365   error::Error error = DoGetAttribLocation(program, name_str.c_str(), location); | 
| 366   if (error != error::kNoError) { | 366   if (error != error::kNoError) { | 
| 367     return error; | 367     return error; | 
| 368   } | 368   } | 
| 369   return error::kNoError; | 369   return error::kNoError; | 
| 370 } | 370 } | 
| 371 | 371 | 
|  | 372 error::Error GLES2DecoderPassthroughImpl::HandleGetBufferSubDataAsyncCHROMIUM( | 
|  | 373     uint32_t immediate_data_size, | 
|  | 374     const volatile void* cmd_data) { | 
|  | 375   const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM& c = | 
|  | 376       *static_cast<const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM*>( | 
|  | 377           cmd_data); | 
|  | 378   GLenum target = static_cast<GLenum>(c.target); | 
|  | 379   GLintptr offset = static_cast<GLintptr>(c.offset); | 
|  | 380   GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 
|  | 381   uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); | 
|  | 382 | 
|  | 383   int8_t* mem = | 
|  | 384       GetSharedMemoryAs<int8_t*>(data_shm_id, c.data_shm_offset, size); | 
|  | 385   if (!mem) { | 
|  | 386     return error::kOutOfBounds; | 
|  | 387   } | 
|  | 388 | 
|  | 389   void* ptr = nullptr; | 
|  | 390   error::Error error = | 
|  | 391       DoMapBufferRange(target, offset, size, GL_MAP_READ_BIT, &ptr); | 
|  | 392   if (error != error::kNoError) { | 
|  | 393     return error; | 
|  | 394   } | 
|  | 395   memcpy(mem, ptr, size); | 
|  | 396   error = DoUnmapBuffer(target); | 
|  | 397   if (error != error::kNoError) { | 
|  | 398     return error; | 
|  | 399   } | 
|  | 400 | 
|  | 401   return error::kNoError; | 
|  | 402 } | 
|  | 403 | 
|  | 404 | 
| 372 error::Error GLES2DecoderPassthroughImpl::HandleGetFragDataLocation( | 405 error::Error GLES2DecoderPassthroughImpl::HandleGetFragDataLocation( | 
| 373     uint32_t immediate_data_size, | 406     uint32_t immediate_data_size, | 
| 374     const volatile void* cmd_data) { | 407     const volatile void* cmd_data) { | 
| 375   const volatile gles2::cmds::GetFragDataLocation& c = | 408   const volatile gles2::cmds::GetFragDataLocation& c = | 
| 376       *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data); | 409       *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data); | 
| 377   GLuint program = static_cast<GLuint>(c.program); | 410   GLuint program = static_cast<GLuint>(c.program); | 
| 378   Bucket* bucket = GetBucket(c.name_bucket_id); | 411   Bucket* bucket = GetBucket(c.name_bucket_id); | 
| 379   if (!bucket) { | 412   if (!bucket) { | 
| 380     return error::kInvalidArguments; | 413     return error::kInvalidArguments; | 
| 381   } | 414   } | 
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2392   } | 2425   } | 
| 2393   error::Error error = DoGetFragDataIndexEXT(program, name_str.c_str(), index); | 2426   error::Error error = DoGetFragDataIndexEXT(program, name_str.c_str(), index); | 
| 2394   if (error != error::kNoError) { | 2427   if (error != error::kNoError) { | 
| 2395     return error; | 2428     return error; | 
| 2396   } | 2429   } | 
| 2397   return error::kNoError; | 2430   return error::kNoError; | 
| 2398 } | 2431 } | 
| 2399 | 2432 | 
| 2400 }  // namespace gles2 | 2433 }  // namespace gles2 | 
| 2401 }  // namespace gpu | 2434 }  // namespace gpu | 
| OLD | NEW | 
|---|