Chromium Code Reviews| 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 <list> | 10 #include <list> |
| (...skipping 12037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12048 Program* program = GetProgramInfoNotShader( | 12048 Program* program = GetProgramInfoNotShader( |
| 12049 client_id, "glUniformBlockBinding"); | 12049 client_id, "glUniformBlockBinding"); |
| 12050 if (!program) { | 12050 if (!program) { |
| 12051 return error::kNoError; | 12051 return error::kNoError; |
| 12052 } | 12052 } |
| 12053 GLuint service_id = program->service_id(); | 12053 GLuint service_id = program->service_id(); |
| 12054 glUniformBlockBinding(service_id, index, binding); | 12054 glUniformBlockBinding(service_id, index, binding); |
| 12055 return error::kNoError; | 12055 return error::kNoError; |
| 12056 } | 12056 } |
| 12057 | 12057 |
| 12058 error::Error GLES2DecoderImpl::HandleClientWaitSync( | |
| 12059 uint32_t immediate_data_size, const void* cmd_data) { | |
| 12060 if (!unsafe_es3_apis_enabled()) | |
| 12061 return error::kUnknownCommand; | |
| 12062 const gles2::cmds::ClientWaitSync& c = | |
| 12063 *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); | |
| 12064 GLuint sync = static_cast<GLuint>(c.sync); | |
| 12065 GLbitfield flags = static_cast<GLbitfield>(c.flags); | |
| 12066 GLuint64Union mapping; | |
| 12067 mapping.param32[0] = c.timeout_0; | |
| 12068 mapping.param32[1] = c.timeout_1; | |
| 12069 GLuint64 timeout = mapping.param64; | |
| 12070 if (timeout != 0) { | |
| 12071 // In Chromium we only allow |timeout| to be 0. | |
|
piman
2015/02/18 16:22:07
We should allow it here, and check this in the web
| |
| 12072 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "timeout not 0"); | |
| 12073 return error::kNoError; | |
| 12074 } | |
| 12075 typedef cmds::ClientWaitSync::Result Result; | |
| 12076 Result* result_dst = GetSharedMemoryAs<Result*>( | |
| 12077 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | |
| 12078 if (!result_dst) { | |
| 12079 return error::kOutOfBounds; | |
| 12080 } | |
| 12081 if (*result_dst != GL_WAIT_FAILED) { | |
| 12082 return error::kInvalidArguments; | |
| 12083 } | |
| 12084 GLsync service_sync = 0; | |
| 12085 if (!group_->GetSyncServiceId(sync, &service_sync)) { | |
| 12086 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "invalid sync"); | |
| 12087 return error::kNoError; | |
| 12088 } | |
| 12089 *result_dst = glClientWaitSync(service_sync, flags, timeout); | |
| 12090 return error::kNoError; | |
| 12091 } | |
| 12092 | |
| 12058 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( | 12093 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( |
| 12059 TextureRef* texture_ref) { | 12094 TextureRef* texture_ref) { |
| 12060 Texture* texture = texture_ref->texture(); | 12095 Texture* texture = texture_ref->texture(); |
| 12061 DoDidUseTexImageIfNeeded(texture, texture->target()); | 12096 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 12062 } | 12097 } |
| 12063 | 12098 |
| 12064 void GLES2DecoderImpl::OnContextLostError() { | 12099 void GLES2DecoderImpl::OnContextLostError() { |
| 12065 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 12100 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 12066 } | 12101 } |
| 12067 | 12102 |
| 12068 void GLES2DecoderImpl::OnOutOfMemoryError() { | 12103 void GLES2DecoderImpl::OnOutOfMemoryError() { |
| 12069 if (lose_context_when_out_of_memory_) { | 12104 if (lose_context_when_out_of_memory_) { |
| 12070 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 12105 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 12071 } | 12106 } |
| 12072 } | 12107 } |
| 12073 | 12108 |
| 12074 // Include the auto-generated part of this file. We split this because it means | 12109 // Include the auto-generated part of this file. We split this because it means |
| 12075 // we can easily edit the non-auto generated parts right here in this file | 12110 // we can easily edit the non-auto generated parts right here in this file |
| 12076 // instead of having to edit some template or the code generator. | 12111 // instead of having to edit some template or the code generator. |
| 12077 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 12112 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 12078 | 12113 |
| 12079 } // namespace gles2 | 12114 } // namespace gles2 |
| 12080 } // namespace gpu | 12115 } // namespace gpu |
| OLD | NEW |