| 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 // XXX: how do I test this? |
| 376 |
| 377 const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM& c = |
| 378 *static_cast<const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM*>( |
| 379 cmd_data); |
| 380 GLenum target = static_cast<GLenum>(c.target); |
| 381 GLintptr offset = static_cast<GLintptr>(c.offset); |
| 382 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 383 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); |
| 384 |
| 385 int8_t* mem = |
| 386 GetSharedMemoryAs<int8_t*>(data_shm_id, c.data_shm_offset, size); |
| 387 if (!mem) { |
| 388 return error::kOutOfBounds; |
| 389 } |
| 390 |
| 391 void* ptr = nullptr; |
| 392 error::Error error = |
| 393 DoMapBufferRange(target, offset, size, GL_MAP_READ_BIT, &ptr); |
| 394 if (error != error::kNoError) { |
| 395 return error; |
| 396 } |
| 397 memcpy(mem, ptr, size); |
| 398 error = DoUnmapBuffer(target); |
| 399 if (error != error::kNoError) { |
| 400 return error; |
| 401 } |
| 402 |
| 403 return error::kNoError; |
| 404 } |
| 405 |
| 406 |
| 372 error::Error GLES2DecoderPassthroughImpl::HandleGetFragDataLocation( | 407 error::Error GLES2DecoderPassthroughImpl::HandleGetFragDataLocation( |
| 373 uint32_t immediate_data_size, | 408 uint32_t immediate_data_size, |
| 374 const volatile void* cmd_data) { | 409 const volatile void* cmd_data) { |
| 375 const volatile gles2::cmds::GetFragDataLocation& c = | 410 const volatile gles2::cmds::GetFragDataLocation& c = |
| 376 *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data); | 411 *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data); |
| 377 GLuint program = static_cast<GLuint>(c.program); | 412 GLuint program = static_cast<GLuint>(c.program); |
| 378 Bucket* bucket = GetBucket(c.name_bucket_id); | 413 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 379 if (!bucket) { | 414 if (!bucket) { |
| 380 return error::kInvalidArguments; | 415 return error::kInvalidArguments; |
| 381 } | 416 } |
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 } | 2427 } |
| 2393 error::Error error = DoGetFragDataIndexEXT(program, name_str.c_str(), index); | 2428 error::Error error = DoGetFragDataIndexEXT(program, name_str.c_str(), index); |
| 2394 if (error != error::kNoError) { | 2429 if (error != error::kNoError) { |
| 2395 return error; | 2430 return error; |
| 2396 } | 2431 } |
| 2397 return error::kNoError; | 2432 return error::kNoError; |
| 2398 } | 2433 } |
| 2399 | 2434 |
| 2400 } // namespace gles2 | 2435 } // namespace gles2 |
| 2401 } // namespace gpu | 2436 } // namespace gpu |
| OLD | NEW |