| 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 12542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12553 return wait_sync_point_callback_.Run(sync_point) ? | 12553 return wait_sync_point_callback_.Run(sync_point) ? |
| 12554 error::kNoError : error::kDeferCommandUntilLater; | 12554 error::kNoError : error::kDeferCommandUntilLater; |
| 12555 } | 12555 } |
| 12556 | 12556 |
| 12557 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( | 12557 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( |
| 12558 uint32 immediate_data_size, | 12558 uint32 immediate_data_size, |
| 12559 const void* cmd_data) { | 12559 const void* cmd_data) { |
| 12560 const gles2::cmds::InsertFenceSyncCHROMIUM& c = | 12560 const gles2::cmds::InsertFenceSyncCHROMIUM& c = |
| 12561 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); | 12561 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); |
| 12562 | 12562 |
| 12563 const uint64_t release_count = c.release_count; | 12563 const uint64_t release_count = c.release_count(); |
| 12564 if (!fence_sync_release_callback_.is_null()) | 12564 if (!fence_sync_release_callback_.is_null()) |
| 12565 fence_sync_release_callback_.Run(release_count); | 12565 fence_sync_release_callback_.Run(release_count); |
| 12566 return error::kNoError; | 12566 return error::kNoError; |
| 12567 } | 12567 } |
| 12568 | 12568 |
| 12569 error::Error GLES2DecoderImpl::HandleGenSyncTokenCHROMIUMImmediate( | 12569 error::Error GLES2DecoderImpl::HandleGenSyncTokenCHROMIUMImmediate( |
| 12570 uint32 immediate_data_size, | 12570 uint32 immediate_data_size, |
| 12571 const void* cmd_data) { | 12571 const void* cmd_data) { |
| 12572 return error::kUnknownCommand; | 12572 return error::kUnknownCommand; |
| 12573 } | 12573 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 12593 const gpu::CommandBufferNamespace kMinNamespaceId = | 12593 const gpu::CommandBufferNamespace kMinNamespaceId = |
| 12594 gpu::CommandBufferNamespace::INVALID; | 12594 gpu::CommandBufferNamespace::INVALID; |
| 12595 const gpu::CommandBufferNamespace kMaxNamespaceId = | 12595 const gpu::CommandBufferNamespace kMaxNamespaceId = |
| 12596 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; | 12596 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; |
| 12597 | 12597 |
| 12598 const gpu::CommandBufferNamespace namespace_id = | 12598 const gpu::CommandBufferNamespace namespace_id = |
| 12599 ((c.namespace_id >= static_cast<int32_t>(kMinNamespaceId)) && | 12599 ((c.namespace_id >= static_cast<int32_t>(kMinNamespaceId)) && |
| 12600 (c.namespace_id < static_cast<int32_t>(kMaxNamespaceId))) | 12600 (c.namespace_id < static_cast<int32_t>(kMaxNamespaceId))) |
| 12601 ? static_cast<gpu::CommandBufferNamespace>(c.namespace_id) | 12601 ? static_cast<gpu::CommandBufferNamespace>(c.namespace_id) |
| 12602 : gpu::CommandBufferNamespace::INVALID; | 12602 : gpu::CommandBufferNamespace::INVALID; |
| 12603 const uint64_t command_buffer_id = c.command_buffer_id; | 12603 const uint64_t command_buffer_id = c.command_buffer_id(); |
| 12604 const uint64_t release = c.release_count; | 12604 const uint64_t release = c.release_count(); |
| 12605 if (wait_fence_sync_callback_.is_null()) | 12605 if (wait_fence_sync_callback_.is_null()) |
| 12606 return error::kNoError; | 12606 return error::kNoError; |
| 12607 | 12607 |
| 12608 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release) | 12608 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release) |
| 12609 ? error::kNoError | 12609 ? error::kNoError |
| 12610 : error::kDeferCommandUntilLater; | 12610 : error::kDeferCommandUntilLater; |
| 12611 } | 12611 } |
| 12612 | 12612 |
| 12613 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( | 12613 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( |
| 12614 uint32 immediate_data_size, | 12614 uint32 immediate_data_size, |
| (...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14507 glUniformBlockBinding(service_id, index, binding); | 14507 glUniformBlockBinding(service_id, index, binding); |
| 14508 return error::kNoError; | 14508 return error::kNoError; |
| 14509 } | 14509 } |
| 14510 | 14510 |
| 14511 error::Error GLES2DecoderImpl::HandleClientWaitSync( | 14511 error::Error GLES2DecoderImpl::HandleClientWaitSync( |
| 14512 uint32_t immediate_data_size, const void* cmd_data) { | 14512 uint32_t immediate_data_size, const void* cmd_data) { |
| 14513 if (!unsafe_es3_apis_enabled()) | 14513 if (!unsafe_es3_apis_enabled()) |
| 14514 return error::kUnknownCommand; | 14514 return error::kUnknownCommand; |
| 14515 const gles2::cmds::ClientWaitSync& c = | 14515 const gles2::cmds::ClientWaitSync& c = |
| 14516 *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); | 14516 *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); |
| 14517 GLuint sync = static_cast<GLuint>(c.sync); | 14517 const GLuint sync = static_cast<GLuint>(c.sync); |
| 14518 GLbitfield flags = static_cast<GLbitfield>(c.flags); | 14518 const GLbitfield flags = static_cast<GLbitfield>(c.flags); |
| 14519 GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); | 14519 const GLuint64 timeout = c.timeout(); |
| 14520 typedef cmds::ClientWaitSync::Result Result; | 14520 typedef cmds::ClientWaitSync::Result Result; |
| 14521 Result* result_dst = GetSharedMemoryAs<Result*>( | 14521 Result* result_dst = GetSharedMemoryAs<Result*>( |
| 14522 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 14522 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
| 14523 if (!result_dst) { | 14523 if (!result_dst) { |
| 14524 return error::kOutOfBounds; | 14524 return error::kOutOfBounds; |
| 14525 } | 14525 } |
| 14526 if (*result_dst != GL_WAIT_FAILED) { | 14526 if (*result_dst != GL_WAIT_FAILED) { |
| 14527 return error::kInvalidArguments; | 14527 return error::kInvalidArguments; |
| 14528 } | 14528 } |
| 14529 GLsync service_sync = 0; | 14529 GLsync service_sync = 0; |
| 14530 if (!group_->GetSyncServiceId(sync, &service_sync)) { | 14530 if (!group_->GetSyncServiceId(sync, &service_sync)) { |
| 14531 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "invalid sync"); | 14531 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "invalid sync"); |
| 14532 return error::kNoError; | 14532 return error::kNoError; |
| 14533 } | 14533 } |
| 14534 *result_dst = glClientWaitSync(service_sync, flags, timeout); | 14534 *result_dst = glClientWaitSync(service_sync, flags, timeout); |
| 14535 return error::kNoError; | 14535 return error::kNoError; |
| 14536 } | 14536 } |
| 14537 | 14537 |
| 14538 error::Error GLES2DecoderImpl::HandleWaitSync( | 14538 error::Error GLES2DecoderImpl::HandleWaitSync( |
| 14539 uint32_t immediate_data_size, const void* cmd_data) { | 14539 uint32_t immediate_data_size, const void* cmd_data) { |
| 14540 if (!unsafe_es3_apis_enabled()) | 14540 if (!unsafe_es3_apis_enabled()) |
| 14541 return error::kUnknownCommand; | 14541 return error::kUnknownCommand; |
| 14542 const gles2::cmds::WaitSync& c = | 14542 const gles2::cmds::WaitSync& c = |
| 14543 *static_cast<const gles2::cmds::WaitSync*>(cmd_data); | 14543 *static_cast<const gles2::cmds::WaitSync*>(cmd_data); |
| 14544 GLuint sync = static_cast<GLuint>(c.sync); | 14544 const GLuint sync = static_cast<GLuint>(c.sync); |
| 14545 GLbitfield flags = static_cast<GLbitfield>(c.flags); | 14545 const GLbitfield flags = static_cast<GLbitfield>(c.flags); |
| 14546 GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); | 14546 const GLuint64 timeout = c.timeout(); |
| 14547 GLsync service_sync = 0; | 14547 GLsync service_sync = 0; |
| 14548 if (!group_->GetSyncServiceId(sync, &service_sync)) { | 14548 if (!group_->GetSyncServiceId(sync, &service_sync)) { |
| 14549 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync"); | 14549 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync"); |
| 14550 return error::kNoError; | 14550 return error::kNoError; |
| 14551 } | 14551 } |
| 14552 glWaitSync(service_sync, flags, timeout); | 14552 glWaitSync(service_sync, flags, timeout); |
| 14553 return error::kNoError; | 14553 return error::kNoError; |
| 14554 } | 14554 } |
| 14555 | 14555 |
| 14556 error::Error GLES2DecoderImpl::HandleGetInternalformativ( | 14556 error::Error GLES2DecoderImpl::HandleGetInternalformativ( |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15785 return error::kNoError; | 15785 return error::kNoError; |
| 15786 } | 15786 } |
| 15787 | 15787 |
| 15788 // Include the auto-generated part of this file. We split this because it means | 15788 // Include the auto-generated part of this file. We split this because it means |
| 15789 // we can easily edit the non-auto generated parts right here in this file | 15789 // we can easily edit the non-auto generated parts right here in this file |
| 15790 // instead of having to edit some template or the code generator. | 15790 // instead of having to edit some template or the code generator. |
| 15791 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15791 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15792 | 15792 |
| 15793 } // namespace gles2 | 15793 } // namespace gles2 |
| 15794 } // namespace gpu | 15794 } // namespace gpu |
| OLD | NEW |