| 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 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3092 void GLES2DecoderImpl::DeleteFramebuffersHelper( | 3092 void GLES2DecoderImpl::DeleteFramebuffersHelper( | 
| 3093     GLsizei n, const GLuint* client_ids) { | 3093     GLsizei n, const GLuint* client_ids) { | 
| 3094   bool supports_separate_framebuffer_binds = | 3094   bool supports_separate_framebuffer_binds = | 
| 3095      features().chromium_framebuffer_multisample; | 3095      features().chromium_framebuffer_multisample; | 
| 3096 | 3096 | 
| 3097   for (GLsizei ii = 0; ii < n; ++ii) { | 3097   for (GLsizei ii = 0; ii < n; ++ii) { | 
| 3098     Framebuffer* framebuffer = | 3098     Framebuffer* framebuffer = | 
| 3099         GetFramebuffer(client_ids[ii]); | 3099         GetFramebuffer(client_ids[ii]); | 
| 3100     if (framebuffer && !framebuffer->IsDeleted()) { | 3100     if (framebuffer && !framebuffer->IsDeleted()) { | 
| 3101       if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { | 3101       if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { | 
|  | 3102         GLenum target = supports_separate_framebuffer_binds ? | 
|  | 3103             GL_DRAW_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; | 
|  | 3104 | 
|  | 3105         // Unbind attachments on FBO before deletion. | 
|  | 3106         if (workarounds().unbind_attachments_on_bound_render_fbo_delete) | 
|  | 3107           framebuffer->DoUnbindGLAttachmentsForWorkaround(target); | 
|  | 3108 | 
|  | 3109         glBindFramebufferEXT(target, GetBackbufferServiceId()); | 
| 3102         framebuffer_state_.bound_draw_framebuffer = NULL; | 3110         framebuffer_state_.bound_draw_framebuffer = NULL; | 
| 3103         framebuffer_state_.clear_state_dirty = true; | 3111         framebuffer_state_.clear_state_dirty = true; | 
| 3104         GLenum target = supports_separate_framebuffer_binds ? |  | 
| 3105             GL_DRAW_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; |  | 
| 3106         glBindFramebufferEXT(target, GetBackbufferServiceId()); |  | 
| 3107       } | 3112       } | 
| 3108       if (framebuffer == framebuffer_state_.bound_read_framebuffer.get()) { | 3113       if (framebuffer == framebuffer_state_.bound_read_framebuffer.get()) { | 
| 3109         framebuffer_state_.bound_read_framebuffer = NULL; | 3114         framebuffer_state_.bound_read_framebuffer = NULL; | 
| 3110         GLenum target = supports_separate_framebuffer_binds ? | 3115         GLenum target = supports_separate_framebuffer_binds ? | 
| 3111             GL_READ_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; | 3116             GL_READ_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; | 
| 3112         glBindFramebufferEXT(target, GetBackbufferServiceId()); | 3117         glBindFramebufferEXT(target, GetBackbufferServiceId()); | 
| 3113       } | 3118       } | 
| 3114       OnFboChanged(); | 3119       OnFboChanged(); | 
| 3115       RemoveFramebuffer(client_ids[ii]); | 3120       RemoveFramebuffer(client_ids[ii]); | 
| 3116     } | 3121     } | 
| (...skipping 8931 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 12048   Program* program = GetProgramInfoNotShader( | 12053   Program* program = GetProgramInfoNotShader( | 
| 12049       client_id, "glUniformBlockBinding"); | 12054       client_id, "glUniformBlockBinding"); | 
| 12050   if (!program) { | 12055   if (!program) { | 
| 12051     return error::kNoError; | 12056     return error::kNoError; | 
| 12052   } | 12057   } | 
| 12053   GLuint service_id = program->service_id(); | 12058   GLuint service_id = program->service_id(); | 
| 12054   glUniformBlockBinding(service_id, index, binding); | 12059   glUniformBlockBinding(service_id, index, binding); | 
| 12055   return error::kNoError; | 12060   return error::kNoError; | 
| 12056 } | 12061 } | 
| 12057 | 12062 | 
|  | 12063 error::Error GLES2DecoderImpl::HandleClientWaitSync( | 
|  | 12064     uint32_t immediate_data_size, const void* cmd_data) { | 
|  | 12065   if (!unsafe_es3_apis_enabled()) | 
|  | 12066     return error::kUnknownCommand; | 
|  | 12067   const gles2::cmds::ClientWaitSync& c = | 
|  | 12068       *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); | 
|  | 12069   GLuint sync = static_cast<GLuint>(c.sync); | 
|  | 12070   GLbitfield flags = static_cast<GLbitfield>(c.flags); | 
|  | 12071   GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); | 
|  | 12072   typedef cmds::ClientWaitSync::Result Result; | 
|  | 12073   Result* result_dst = GetSharedMemoryAs<Result*>( | 
|  | 12074       c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 
|  | 12075   if (!result_dst) { | 
|  | 12076     return error::kOutOfBounds; | 
|  | 12077   } | 
|  | 12078   if (*result_dst != GL_WAIT_FAILED) { | 
|  | 12079     return error::kInvalidArguments; | 
|  | 12080   } | 
|  | 12081   GLsync service_sync = 0; | 
|  | 12082   if (!group_->GetSyncServiceId(sync, &service_sync)) { | 
|  | 12083     LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "invalid sync"); | 
|  | 12084     return error::kNoError; | 
|  | 12085   } | 
|  | 12086   *result_dst = glClientWaitSync(service_sync, flags, timeout); | 
|  | 12087   return error::kNoError; | 
|  | 12088 } | 
|  | 12089 | 
|  | 12090 error::Error GLES2DecoderImpl::HandleWaitSync( | 
|  | 12091     uint32_t immediate_data_size, const void* cmd_data) { | 
|  | 12092   if (!unsafe_es3_apis_enabled()) | 
|  | 12093     return error::kUnknownCommand; | 
|  | 12094   const gles2::cmds::WaitSync& c = | 
|  | 12095       *static_cast<const gles2::cmds::WaitSync*>(cmd_data); | 
|  | 12096   GLuint sync = static_cast<GLuint>(c.sync); | 
|  | 12097   GLbitfield flags = static_cast<GLbitfield>(c.flags); | 
|  | 12098   GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); | 
|  | 12099   GLsync service_sync = 0; | 
|  | 12100   if (!group_->GetSyncServiceId(sync, &service_sync)) { | 
|  | 12101     LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync"); | 
|  | 12102     return error::kNoError; | 
|  | 12103   } | 
|  | 12104   glWaitSync(service_sync, flags, timeout); | 
|  | 12105   return error::kNoError; | 
|  | 12106 } | 
|  | 12107 | 
| 12058 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( | 12108 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( | 
| 12059     TextureRef* texture_ref) { | 12109     TextureRef* texture_ref) { | 
| 12060   Texture* texture = texture_ref->texture(); | 12110   Texture* texture = texture_ref->texture(); | 
| 12061   DoDidUseTexImageIfNeeded(texture, texture->target()); | 12111   DoDidUseTexImageIfNeeded(texture, texture->target()); | 
| 12062 } | 12112 } | 
| 12063 | 12113 | 
| 12064 void GLES2DecoderImpl::OnContextLostError() { | 12114 void GLES2DecoderImpl::OnContextLostError() { | 
| 12065   group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 12115   group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 
| 12066 } | 12116 } | 
| 12067 | 12117 | 
| 12068 void GLES2DecoderImpl::OnOutOfMemoryError() { | 12118 void GLES2DecoderImpl::OnOutOfMemoryError() { | 
| 12069   if (lose_context_when_out_of_memory_) { | 12119   if (lose_context_when_out_of_memory_) { | 
| 12070     group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 12120     group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 
| 12071   } | 12121   } | 
| 12072 } | 12122 } | 
| 12073 | 12123 | 
| 12074 // Include the auto-generated part of this file. We split this because it means | 12124 // 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 | 12125 // 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. | 12126 // instead of having to edit some template or the code generator. | 
| 12077 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 12127 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 
| 12078 | 12128 | 
| 12079 }  // namespace gles2 | 12129 }  // namespace gles2 | 
| 12080 }  // namespace gpu | 12130 }  // namespace gpu | 
| OLD | NEW | 
|---|